Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Algol68
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C with Coccinelle
C++ with Coccinelle
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Mojo
Nim
Numba
Nix
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
PTX
Python
Racket
Raku
Ruby
Rust
Sail
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
Triton
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Zig
Javascript
GIMPLE
Ygen
sway
c++ source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
6502-c++ 11.1.0
ARM GCC 10.2.0
ARM GCC 10.3.0
ARM GCC 10.4.0
ARM GCC 10.5.0
ARM GCC 11.1.0
ARM GCC 11.2.0
ARM GCC 11.3.0
ARM GCC 11.4.0
ARM GCC 12.1.0
ARM GCC 12.2.0
ARM GCC 12.3.0
ARM GCC 12.4.0
ARM GCC 12.5.0
ARM GCC 13.1.0
ARM GCC 13.2.0
ARM GCC 13.2.0 (unknown-eabi)
ARM GCC 13.3.0
ARM GCC 13.3.0 (unknown-eabi)
ARM GCC 13.4.0
ARM GCC 13.4.0 (unknown-eabi)
ARM GCC 14.1.0
ARM GCC 14.1.0 (unknown-eabi)
ARM GCC 14.2.0
ARM GCC 14.2.0 (unknown-eabi)
ARM GCC 14.3.0
ARM GCC 14.3.0 (unknown-eabi)
ARM GCC 15.1.0
ARM GCC 15.1.0 (unknown-eabi)
ARM GCC 15.2.0
ARM GCC 15.2.0 (unknown-eabi)
ARM GCC 4.5.4
ARM GCC 4.6.4
ARM GCC 5.4
ARM GCC 6.3.0
ARM GCC 6.4.0
ARM GCC 7.3.0
ARM GCC 7.5.0
ARM GCC 8.2.0
ARM GCC 8.5.0
ARM GCC 9.3.0
ARM GCC 9.4.0
ARM GCC 9.5.0
ARM GCC trunk
ARM gcc 10.2.1 (none)
ARM gcc 10.3.1 (2021.07 none)
ARM gcc 10.3.1 (2021.10 none)
ARM gcc 11.2.1 (none)
ARM gcc 5.4.1 (none)
ARM gcc 7.2.1 (none)
ARM gcc 8.2 (WinCE)
ARM gcc 8.3.1 (none)
ARM gcc 9.2.1 (none)
ARM msvc v19.0 (ex-WINE)
ARM msvc v19.10 (ex-WINE)
ARM msvc v19.14 (ex-WINE)
ARM64 Morello gcc 10.1 Alpha 2
ARM64 gcc 10.2
ARM64 gcc 10.3
ARM64 gcc 10.4
ARM64 gcc 10.5.0
ARM64 gcc 11.1
ARM64 gcc 11.2
ARM64 gcc 11.3
ARM64 gcc 11.4.0
ARM64 gcc 12.1
ARM64 gcc 12.2.0
ARM64 gcc 12.3.0
ARM64 gcc 12.4.0
ARM64 gcc 12.5.0
ARM64 gcc 13.1.0
ARM64 gcc 13.2.0
ARM64 gcc 13.3.0
ARM64 gcc 13.4.0
ARM64 gcc 14.1.0
ARM64 gcc 14.2.0
ARM64 gcc 14.3.0
ARM64 gcc 15.1.0
ARM64 gcc 15.2.0
ARM64 gcc 4.9.4
ARM64 gcc 5.4
ARM64 gcc 5.5.0
ARM64 gcc 6.3
ARM64 gcc 6.4
ARM64 gcc 7.3
ARM64 gcc 7.5
ARM64 gcc 8.2
ARM64 gcc 8.5
ARM64 gcc 9.3
ARM64 gcc 9.4
ARM64 gcc 9.5
ARM64 gcc trunk
ARM64 msvc v19.14 (ex-WINE)
AVR gcc 10.3.0
AVR gcc 11.1.0
AVR gcc 12.1.0
AVR gcc 12.2.0
AVR gcc 12.3.0
AVR gcc 12.4.0
AVR gcc 12.5.0
AVR gcc 13.1.0
AVR gcc 13.2.0
AVR gcc 13.3.0
AVR gcc 13.4.0
AVR gcc 14.1.0
AVR gcc 14.2.0
AVR gcc 14.3.0
AVR gcc 15.1.0
AVR gcc 15.2.0
AVR gcc 4.5.4
AVR gcc 4.6.4
AVR gcc 5.4.0
AVR gcc 9.2.0
AVR gcc 9.3.0
Arduino Mega (1.8.9)
Arduino Uno (1.8.9)
BPF clang (trunk)
BPF clang 13.0.0
BPF clang 14.0.0
BPF clang 15.0.0
BPF clang 16.0.0
BPF clang 17.0.1
BPF clang 18.1.0
BPF clang 19.1.0
BPF clang 20.1.0
BPF clang 21.1.0
EDG (experimental reflection)
EDG 6.5
EDG 6.5 (GNU mode gcc 13)
EDG 6.6
EDG 6.6 (GNU mode gcc 13)
EDG 6.7
EDG 6.7 (GNU mode gcc 14)
FRC 2019
FRC 2020
FRC 2023
HPPA gcc 14.2.0
HPPA gcc 14.3.0
HPPA gcc 15.1.0
HPPA gcc 15.2.0
KVX ACB 4.1.0 (GCC 7.5.0)
KVX ACB 4.1.0-cd1 (GCC 7.5.0)
KVX ACB 4.10.0 (GCC 10.3.1)
KVX ACB 4.11.1 (GCC 10.3.1)
KVX ACB 4.12.0 (GCC 11.3.0)
KVX ACB 4.2.0 (GCC 7.5.0)
KVX ACB 4.3.0 (GCC 7.5.0)
KVX ACB 4.4.0 (GCC 7.5.0)
KVX ACB 4.6.0 (GCC 9.4.1)
KVX ACB 4.8.0 (GCC 9.4.1)
KVX ACB 4.9.0 (GCC 9.4.1)
KVX ACB 5.0.0 (GCC 12.2.1)
KVX ACB 5.2.0 (GCC 13.2.1)
LoongArch64 clang (trunk)
LoongArch64 clang 17.0.1
LoongArch64 clang 18.1.0
LoongArch64 clang 19.1.0
LoongArch64 clang 20.1.0
LoongArch64 clang 21.1.0
M68K gcc 13.1.0
M68K gcc 13.2.0
M68K gcc 13.3.0
M68K gcc 13.4.0
M68K gcc 14.1.0
M68K gcc 14.2.0
M68K gcc 14.3.0
M68K gcc 15.1.0
M68K gcc 15.2.0
M68k clang (trunk)
MRISC32 gcc (trunk)
MSP430 gcc 4.5.3
MSP430 gcc 5.3.0
MSP430 gcc 6.2.1
MinGW clang 14.0.3
MinGW clang 14.0.6
MinGW clang 15.0.7
MinGW clang 16.0.0
MinGW clang 16.0.2
MinGW gcc 11.3.0
MinGW gcc 12.1.0
MinGW gcc 12.2.0
MinGW gcc 13.1.0
RISC-V (32-bits) gcc (trunk)
RISC-V (32-bits) gcc 10.2.0
RISC-V (32-bits) gcc 10.3.0
RISC-V (32-bits) gcc 11.2.0
RISC-V (32-bits) gcc 11.3.0
RISC-V (32-bits) gcc 11.4.0
RISC-V (32-bits) gcc 12.1.0
RISC-V (32-bits) gcc 12.2.0
RISC-V (32-bits) gcc 12.3.0
RISC-V (32-bits) gcc 12.4.0
RISC-V (32-bits) gcc 12.5.0
RISC-V (32-bits) gcc 13.1.0
RISC-V (32-bits) gcc 13.2.0
RISC-V (32-bits) gcc 13.3.0
RISC-V (32-bits) gcc 13.4.0
RISC-V (32-bits) gcc 14.1.0
RISC-V (32-bits) gcc 14.2.0
RISC-V (32-bits) gcc 14.3.0
RISC-V (32-bits) gcc 15.1.0
RISC-V (32-bits) gcc 15.2.0
RISC-V (32-bits) gcc 8.2.0
RISC-V (32-bits) gcc 8.5.0
RISC-V (32-bits) gcc 9.4.0
RISC-V (64-bits) gcc (trunk)
RISC-V (64-bits) gcc 10.2.0
RISC-V (64-bits) gcc 10.3.0
RISC-V (64-bits) gcc 11.2.0
RISC-V (64-bits) gcc 11.3.0
RISC-V (64-bits) gcc 11.4.0
RISC-V (64-bits) gcc 12.1.0
RISC-V (64-bits) gcc 12.2.0
RISC-V (64-bits) gcc 12.3.0
RISC-V (64-bits) gcc 12.4.0
RISC-V (64-bits) gcc 12.5.0
RISC-V (64-bits) gcc 13.1.0
RISC-V (64-bits) gcc 13.2.0
RISC-V (64-bits) gcc 13.3.0
RISC-V (64-bits) gcc 13.4.0
RISC-V (64-bits) gcc 14.1.0
RISC-V (64-bits) gcc 14.2.0
RISC-V (64-bits) gcc 14.3.0
RISC-V (64-bits) gcc 15.1.0
RISC-V (64-bits) gcc 15.2.0
RISC-V (64-bits) gcc 8.2.0
RISC-V (64-bits) gcc 8.5.0
RISC-V (64-bits) gcc 9.4.0
RISC-V rv32gc clang (trunk)
RISC-V rv32gc clang 10.0.0
RISC-V rv32gc clang 10.0.1
RISC-V rv32gc clang 11.0.0
RISC-V rv32gc clang 11.0.1
RISC-V rv32gc clang 12.0.0
RISC-V rv32gc clang 12.0.1
RISC-V rv32gc clang 13.0.0
RISC-V rv32gc clang 13.0.1
RISC-V rv32gc clang 14.0.0
RISC-V rv32gc clang 15.0.0
RISC-V rv32gc clang 16.0.0
RISC-V rv32gc clang 17.0.1
RISC-V rv32gc clang 18.1.0
RISC-V rv32gc clang 19.1.0
RISC-V rv32gc clang 20.1.0
RISC-V rv32gc clang 21.1.0
RISC-V rv32gc clang 9.0.0
RISC-V rv32gc clang 9.0.1
RISC-V rv64gc clang (trunk)
RISC-V rv64gc clang 10.0.0
RISC-V rv64gc clang 10.0.1
RISC-V rv64gc clang 11.0.0
RISC-V rv64gc clang 11.0.1
RISC-V rv64gc clang 12.0.0
RISC-V rv64gc clang 12.0.1
RISC-V rv64gc clang 13.0.0
RISC-V rv64gc clang 13.0.1
RISC-V rv64gc clang 14.0.0
RISC-V rv64gc clang 15.0.0
RISC-V rv64gc clang 16.0.0
RISC-V rv64gc clang 17.0.1
RISC-V rv64gc clang 18.1.0
RISC-V rv64gc clang 19.1.0
RISC-V rv64gc clang 20.1.0
RISC-V rv64gc clang 21.1.0
RISC-V rv64gc clang 9.0.0
RISC-V rv64gc clang 9.0.1
Raspbian Buster
Raspbian Stretch
SPARC LEON gcc 12.2.0
SPARC LEON gcc 12.3.0
SPARC LEON gcc 12.4.0
SPARC LEON gcc 12.5.0
SPARC LEON gcc 13.1.0
SPARC LEON gcc 13.2.0
SPARC LEON gcc 13.3.0
SPARC LEON gcc 13.4.0
SPARC LEON gcc 14.1.0
SPARC LEON gcc 14.2.0
SPARC LEON gcc 14.3.0
SPARC LEON gcc 15.1.0
SPARC LEON gcc 15.2.0
SPARC gcc 12.2.0
SPARC gcc 12.3.0
SPARC gcc 12.4.0
SPARC gcc 12.5.0
SPARC gcc 13.1.0
SPARC gcc 13.2.0
SPARC gcc 13.3.0
SPARC gcc 13.4.0
SPARC gcc 14.1.0
SPARC gcc 14.2.0
SPARC gcc 14.3.0
SPARC gcc 15.1.0
SPARC gcc 15.2.0
SPARC64 gcc 12.2.0
SPARC64 gcc 12.3.0
SPARC64 gcc 12.4.0
SPARC64 gcc 12.5.0
SPARC64 gcc 13.1.0
SPARC64 gcc 13.2.0
SPARC64 gcc 13.3.0
SPARC64 gcc 13.4.0
SPARC64 gcc 14.1.0
SPARC64 gcc 14.2.0
SPARC64 gcc 14.3.0
SPARC64 gcc 15.1.0
SPARC64 gcc 15.2.0
TI C6x gcc 12.2.0
TI C6x gcc 12.3.0
TI C6x gcc 12.4.0
TI C6x gcc 12.5.0
TI C6x gcc 13.1.0
TI C6x gcc 13.2.0
TI C6x gcc 13.3.0
TI C6x gcc 13.4.0
TI C6x gcc 14.1.0
TI C6x gcc 14.2.0
TI C6x gcc 14.3.0
TI C6x gcc 15.1.0
TI C6x gcc 15.2.0
TI CL430 21.6.1
Tricore gcc 11.3.0 (EEESlab)
VAX gcc NetBSDELF 10.4.0
VAX gcc NetBSDELF 10.5.0 (Nov 15 03:50:22 2023)
VAX gcc NetBSDELF 12.4.0 (Apr 16 05:27 2025)
WebAssembly clang (trunk)
Xtensa ESP32 gcc 11.2.0 (2022r1)
Xtensa ESP32 gcc 12.2.0 (20230208)
Xtensa ESP32 gcc 14.2.0 (20241119)
Xtensa ESP32 gcc 8.2.0 (2019r2)
Xtensa ESP32 gcc 8.2.0 (2020r1)
Xtensa ESP32 gcc 8.2.0 (2020r2)
Xtensa ESP32 gcc 8.4.0 (2020r3)
Xtensa ESP32 gcc 8.4.0 (2021r1)
Xtensa ESP32 gcc 8.4.0 (2021r2)
Xtensa ESP32-S2 gcc 11.2.0 (2022r1)
Xtensa ESP32-S2 gcc 12.2.0 (20230208)
Xtensa ESP32-S2 gcc 14.2.0 (20241119)
Xtensa ESP32-S2 gcc 8.2.0 (2019r2)
Xtensa ESP32-S2 gcc 8.2.0 (2020r1)
Xtensa ESP32-S2 gcc 8.2.0 (2020r2)
Xtensa ESP32-S2 gcc 8.4.0 (2020r3)
Xtensa ESP32-S2 gcc 8.4.0 (2021r1)
Xtensa ESP32-S2 gcc 8.4.0 (2021r2)
Xtensa ESP32-S3 gcc 11.2.0 (2022r1)
Xtensa ESP32-S3 gcc 12.2.0 (20230208)
Xtensa ESP32-S3 gcc 14.2.0 (20241119)
Xtensa ESP32-S3 gcc 8.4.0 (2020r3)
Xtensa ESP32-S3 gcc 8.4.0 (2021r1)
Xtensa ESP32-S3 gcc 8.4.0 (2021r2)
arm64 msvc v19.20 VS16.0
arm64 msvc v19.21 VS16.1
arm64 msvc v19.22 VS16.2
arm64 msvc v19.23 VS16.3
arm64 msvc v19.24 VS16.4
arm64 msvc v19.25 VS16.5
arm64 msvc v19.27 VS16.7
arm64 msvc v19.28 VS16.8
arm64 msvc v19.28 VS16.9
arm64 msvc v19.29 VS16.10
arm64 msvc v19.29 VS16.11
arm64 msvc v19.30 VS17.0
arm64 msvc v19.31 VS17.1
arm64 msvc v19.32 VS17.2
arm64 msvc v19.33 VS17.3
arm64 msvc v19.34 VS17.4
arm64 msvc v19.35 VS17.5
arm64 msvc v19.36 VS17.6
arm64 msvc v19.37 VS17.7
arm64 msvc v19.38 VS17.8
arm64 msvc v19.39 VS17.9
arm64 msvc v19.40 VS17.10
arm64 msvc v19.41 VS17.11
arm64 msvc v19.42 VS17.12
arm64 msvc v19.43 VS17.13
arm64 msvc v19.latest
armv7-a clang (trunk)
armv7-a clang 10.0.0
armv7-a clang 10.0.1
armv7-a clang 11.0.0
armv7-a clang 11.0.1
armv7-a clang 12.0.0
armv7-a clang 12.0.1
armv7-a clang 13.0.0
armv7-a clang 13.0.1
armv7-a clang 14.0.0
armv7-a clang 15.0.0
armv7-a clang 16.0.0
armv7-a clang 17.0.1
armv7-a clang 18.1.0
armv7-a clang 19.1.0
armv7-a clang 20.1.0
armv7-a clang 21.1.0
armv7-a clang 9.0.0
armv7-a clang 9.0.1
armv8-a clang (all architectural features, trunk)
armv8-a clang (trunk)
armv8-a clang 10.0.0
armv8-a clang 10.0.1
armv8-a clang 11.0.0
armv8-a clang 11.0.1
armv8-a clang 12.0.0
armv8-a clang 13.0.0
armv8-a clang 14.0.0
armv8-a clang 15.0.0
armv8-a clang 16.0.0
armv8-a clang 17.0.1
armv8-a clang 18.1.0
armv8-a clang 19.1.0
armv8-a clang 20.1.0
armv8-a clang 21.1.0
armv8-a clang 9.0.0
armv8-a clang 9.0.1
clad trunk (clang 21.1.0)
clad v1.10 (clang 20.1.0)
clad v1.8 (clang 18.1.0)
clad v1.9 (clang 19.1.0)
clad v2.00 (clang 20.1.0)
clang-cl 18.1.0
ellcc 0.1.33
ellcc 0.1.34
ellcc 2017-07-16
ez80-clang 15.0.0
ez80-clang 15.0.7
hexagon-clang 16.0.5
llvm-mos atari2600-3e
llvm-mos atari2600-4k
llvm-mos atari2600-common
llvm-mos atari5200-supercart
llvm-mos atari8-cart-megacart
llvm-mos atari8-cart-std
llvm-mos atari8-cart-xegs
llvm-mos atari8-common
llvm-mos atari8-dos
llvm-mos c128
llvm-mos c64
llvm-mos commodore
llvm-mos cpm65
llvm-mos cx16
llvm-mos dodo
llvm-mos eater
llvm-mos mega65
llvm-mos nes
llvm-mos nes-action53
llvm-mos nes-cnrom
llvm-mos nes-gtrom
llvm-mos nes-mmc1
llvm-mos nes-mmc3
llvm-mos nes-nrom
llvm-mos nes-unrom
llvm-mos nes-unrom-512
llvm-mos osi-c1p
llvm-mos pce
llvm-mos pce-cd
llvm-mos pce-common
llvm-mos pet
llvm-mos rp6502
llvm-mos rpc8e
llvm-mos supervision
llvm-mos vic20
loongarch64 gcc 12.2.0
loongarch64 gcc 12.3.0
loongarch64 gcc 12.4.0
loongarch64 gcc 12.5.0
loongarch64 gcc 13.1.0
loongarch64 gcc 13.2.0
loongarch64 gcc 13.3.0
loongarch64 gcc 13.4.0
loongarch64 gcc 14.1.0
loongarch64 gcc 14.2.0
loongarch64 gcc 14.3.0
loongarch64 gcc 15.1.0
loongarch64 gcc 15.2.0
mips clang 13.0.0
mips clang 14.0.0
mips clang 15.0.0
mips clang 16.0.0
mips clang 17.0.1
mips clang 18.1.0
mips clang 19.1.0
mips clang 20.1.0
mips clang 21.1.0
mips gcc 11.2.0
mips gcc 12.1.0
mips gcc 12.2.0
mips gcc 12.3.0
mips gcc 12.4.0
mips gcc 12.5.0
mips gcc 13.1.0
mips gcc 13.2.0
mips gcc 13.3.0
mips gcc 13.4.0
mips gcc 14.1.0
mips gcc 14.2.0
mips gcc 14.3.0
mips gcc 15.1.0
mips gcc 15.2.0
mips gcc 4.9.4
mips gcc 5.4
mips gcc 5.5.0
mips gcc 9.3.0 (codescape)
mips gcc 9.5.0
mips64 (el) gcc 12.1.0
mips64 (el) gcc 12.2.0
mips64 (el) gcc 12.3.0
mips64 (el) gcc 12.4.0
mips64 (el) gcc 12.5.0
mips64 (el) gcc 13.1.0
mips64 (el) gcc 13.2.0
mips64 (el) gcc 13.3.0
mips64 (el) gcc 13.4.0
mips64 (el) gcc 14.1.0
mips64 (el) gcc 14.2.0
mips64 (el) gcc 14.3.0
mips64 (el) gcc 15.1.0
mips64 (el) gcc 15.2.0
mips64 (el) gcc 4.9.4
mips64 (el) gcc 5.4.0
mips64 (el) gcc 5.5.0
mips64 (el) gcc 9.5.0
mips64 clang 13.0.0
mips64 clang 14.0.0
mips64 clang 15.0.0
mips64 clang 16.0.0
mips64 clang 17.0.1
mips64 clang 18.1.0
mips64 clang 19.1.0
mips64 clang 20.1.0
mips64 clang 21.1.0
mips64 gcc 11.2.0
mips64 gcc 12.1.0
mips64 gcc 12.2.0
mips64 gcc 12.3.0
mips64 gcc 12.4.0
mips64 gcc 12.5.0
mips64 gcc 13.1.0
mips64 gcc 13.2.0
mips64 gcc 13.3.0
mips64 gcc 13.4.0
mips64 gcc 14.1.0
mips64 gcc 14.2.0
mips64 gcc 14.3.0
mips64 gcc 15.1.0
mips64 gcc 15.2.0
mips64 gcc 4.9.4
mips64 gcc 5.4.0
mips64 gcc 5.5.0
mips64 gcc 9.5.0
mips64el clang 13.0.0
mips64el clang 14.0.0
mips64el clang 15.0.0
mips64el clang 16.0.0
mips64el clang 17.0.1
mips64el clang 18.1.0
mips64el clang 19.1.0
mips64el clang 20.1.0
mips64el clang 21.1.0
mipsel clang 13.0.0
mipsel clang 14.0.0
mipsel clang 15.0.0
mipsel clang 16.0.0
mipsel clang 17.0.1
mipsel clang 18.1.0
mipsel clang 19.1.0
mipsel clang 20.1.0
mipsel clang 21.1.0
mipsel gcc 12.1.0
mipsel gcc 12.2.0
mipsel gcc 12.3.0
mipsel gcc 12.4.0
mipsel gcc 12.5.0
mipsel gcc 13.1.0
mipsel gcc 13.2.0
mipsel gcc 13.3.0
mipsel gcc 13.4.0
mipsel gcc 14.1.0
mipsel gcc 14.2.0
mipsel gcc 14.3.0
mipsel gcc 15.1.0
mipsel gcc 15.2.0
mipsel gcc 4.9.4
mipsel gcc 5.4.0
mipsel gcc 5.5.0
mipsel gcc 9.5.0
nanoMIPS gcc 6.3.0 (mtk)
power gcc 11.2.0
power gcc 12.1.0
power gcc 12.2.0
power gcc 12.3.0
power gcc 12.4.0
power gcc 12.5.0
power gcc 13.1.0
power gcc 13.2.0
power gcc 13.3.0
power gcc 13.4.0
power gcc 14.1.0
power gcc 14.2.0
power gcc 14.3.0
power gcc 15.1.0
power gcc 15.2.0
power gcc 4.8.5
power64 AT12.0 (gcc8)
power64 AT13.0 (gcc9)
power64 gcc 11.2.0
power64 gcc 12.1.0
power64 gcc 12.2.0
power64 gcc 12.3.0
power64 gcc 12.4.0
power64 gcc 12.5.0
power64 gcc 13.1.0
power64 gcc 13.2.0
power64 gcc 13.3.0
power64 gcc 13.4.0
power64 gcc 14.1.0
power64 gcc 14.2.0
power64 gcc 14.3.0
power64 gcc 15.1.0
power64 gcc 15.2.0
power64 gcc trunk
power64le AT12.0 (gcc8)
power64le AT13.0 (gcc9)
power64le clang (trunk)
power64le gcc 11.2.0
power64le gcc 12.1.0
power64le gcc 12.2.0
power64le gcc 12.3.0
power64le gcc 12.4.0
power64le gcc 12.5.0
power64le gcc 13.1.0
power64le gcc 13.2.0
power64le gcc 13.3.0
power64le gcc 13.4.0
power64le gcc 14.1.0
power64le gcc 14.2.0
power64le gcc 14.3.0
power64le gcc 15.1.0
power64le gcc 15.2.0
power64le gcc 6.3.0
power64le gcc trunk
powerpc64 clang (trunk)
qnx 8.0.0
s390x gcc 11.2.0
s390x gcc 12.1.0
s390x gcc 12.2.0
s390x gcc 12.3.0
s390x gcc 12.4.0
s390x gcc 12.5.0
s390x gcc 13.1.0
s390x gcc 13.2.0
s390x gcc 13.3.0
s390x gcc 13.4.0
s390x gcc 14.1.0
s390x gcc 14.2.0
s390x gcc 14.3.0
s390x gcc 15.1.0
s390x gcc 15.2.0
sh gcc 12.2.0
sh gcc 12.3.0
sh gcc 12.4.0
sh gcc 12.5.0
sh gcc 13.1.0
sh gcc 13.2.0
sh gcc 13.3.0
sh gcc 13.4.0
sh gcc 14.1.0
sh gcc 14.2.0
sh gcc 14.3.0
sh gcc 15.1.0
sh gcc 15.2.0
sh gcc 4.9.4
sh gcc 9.5.0
vast (trunk)
x64 msvc v19.0 (ex-WINE)
x64 msvc v19.10 (ex-WINE)
x64 msvc v19.14 (ex-WINE)
x64 msvc v19.20 VS16.0
x64 msvc v19.21 VS16.1
x64 msvc v19.22 VS16.2
x64 msvc v19.23 VS16.3
x64 msvc v19.24 VS16.4
x64 msvc v19.25 VS16.5
x64 msvc v19.27 VS16.7
x64 msvc v19.28 VS16.8
x64 msvc v19.28 VS16.9
x64 msvc v19.29 VS16.10
x64 msvc v19.29 VS16.11
x64 msvc v19.30 VS17.0
x64 msvc v19.31 VS17.1
x64 msvc v19.32 VS17.2
x64 msvc v19.33 VS17.3
x64 msvc v19.34 VS17.4
x64 msvc v19.35 VS17.5
x64 msvc v19.36 VS17.6
x64 msvc v19.37 VS17.7
x64 msvc v19.38 VS17.8
x64 msvc v19.39 VS17.9
x64 msvc v19.40 VS17.10
x64 msvc v19.41 VS17.11
x64 msvc v19.42 VS17.12
x64 msvc v19.43 VS17.13
x64 msvc v19.latest
x86 djgpp 4.9.4
x86 djgpp 5.5.0
x86 djgpp 6.4.0
x86 djgpp 7.2.0
x86 msvc v19.0 (ex-WINE)
x86 msvc v19.10 (ex-WINE)
x86 msvc v19.14 (ex-WINE)
x86 msvc v19.20 VS16.0
x86 msvc v19.21 VS16.1
x86 msvc v19.22 VS16.2
x86 msvc v19.23 VS16.3
x86 msvc v19.24 VS16.4
x86 msvc v19.25 VS16.5
x86 msvc v19.27 VS16.7
x86 msvc v19.28 VS16.8
x86 msvc v19.28 VS16.9
x86 msvc v19.29 VS16.10
x86 msvc v19.29 VS16.11
x86 msvc v19.30 VS17.0
x86 msvc v19.31 VS17.1
x86 msvc v19.32 VS17.2
x86 msvc v19.33 VS17.3
x86 msvc v19.34 VS17.4
x86 msvc v19.35 VS17.5
x86 msvc v19.36 VS17.6
x86 msvc v19.37 VS17.7
x86 msvc v19.38 VS17.8
x86 msvc v19.39 VS17.9
x86 msvc v19.40 VS17.10
x86 msvc v19.41 VS17.11
x86 msvc v19.42 VS17.12
x86 msvc v19.43 VS17.13
x86 msvc v19.latest
x86 nvc++ 22.11
x86 nvc++ 22.7
x86 nvc++ 22.9
x86 nvc++ 23.1
x86 nvc++ 23.11
x86 nvc++ 23.3
x86 nvc++ 23.5
x86 nvc++ 23.7
x86 nvc++ 23.9
x86 nvc++ 24.1
x86 nvc++ 24.11
x86 nvc++ 24.3
x86 nvc++ 24.5
x86 nvc++ 24.7
x86 nvc++ 24.9
x86 nvc++ 25.1
x86 nvc++ 25.3
x86 nvc++ 25.5
x86 nvc++ 25.7
x86-64 Zapcc 190308
x86-64 clang (-fimplicit-constexpr)
x86-64 clang (Chris Bazley N3089)
x86-64 clang (EricWF contracts)
x86-64 clang (amd-staging)
x86-64 clang (assertions trunk)
x86-64 clang (clangir)
x86-64 clang (experimental -Wlifetime)
x86-64 clang (experimental P1061)
x86-64 clang (experimental P1144)
x86-64 clang (experimental P1221)
x86-64 clang (experimental P2998)
x86-64 clang (experimental P3068)
x86-64 clang (experimental P3309)
x86-64 clang (experimental P3367)
x86-64 clang (experimental P3372)
x86-64 clang (experimental P3385)
x86-64 clang (experimental P3776)
x86-64 clang (experimental metaprogramming - P2632)
x86-64 clang (old concepts branch)
x86-64 clang (p1974)
x86-64 clang (pattern matching - P2688)
x86-64 clang (reflection - C++26)
x86-64 clang (reflection - TS)
x86-64 clang (resugar)
x86-64 clang (string interpolation - P3412)
x86-64 clang (thephd.dev)
x86-64 clang (trunk)
x86-64 clang (variadic friends - P2893)
x86-64 clang (widberg)
x86-64 clang 10.0.0
x86-64 clang 10.0.0 (assertions)
x86-64 clang 10.0.1
x86-64 clang 11.0.0
x86-64 clang 11.0.0 (assertions)
x86-64 clang 11.0.1
x86-64 clang 12.0.0
x86-64 clang 12.0.0 (assertions)
x86-64 clang 12.0.1
x86-64 clang 13.0.0
x86-64 clang 13.0.0 (assertions)
x86-64 clang 13.0.1
x86-64 clang 14.0.0
x86-64 clang 14.0.0 (assertions)
x86-64 clang 15.0.0
x86-64 clang 15.0.0 (assertions)
x86-64 clang 16.0.0
x86-64 clang 16.0.0 (assertions)
x86-64 clang 17.0.1
x86-64 clang 17.0.1 (assertions)
x86-64 clang 18.1.0
x86-64 clang 18.1.0 (assertions)
x86-64 clang 19.1.0
x86-64 clang 19.1.0 (assertions)
x86-64 clang 2.6.0 (assertions)
x86-64 clang 2.7.0 (assertions)
x86-64 clang 2.8.0 (assertions)
x86-64 clang 2.9.0 (assertions)
x86-64 clang 20.1.0
x86-64 clang 20.1.0 (assertions)
x86-64 clang 21.1.0
x86-64 clang 21.1.0 (assertions)
x86-64 clang 3.0.0
x86-64 clang 3.0.0 (assertions)
x86-64 clang 3.1
x86-64 clang 3.1 (assertions)
x86-64 clang 3.2
x86-64 clang 3.2 (assertions)
x86-64 clang 3.3
x86-64 clang 3.3 (assertions)
x86-64 clang 3.4 (assertions)
x86-64 clang 3.4.1
x86-64 clang 3.5
x86-64 clang 3.5 (assertions)
x86-64 clang 3.5.1
x86-64 clang 3.5.2
x86-64 clang 3.6
x86-64 clang 3.6 (assertions)
x86-64 clang 3.7
x86-64 clang 3.7 (assertions)
x86-64 clang 3.7.1
x86-64 clang 3.8
x86-64 clang 3.8 (assertions)
x86-64 clang 3.8.1
x86-64 clang 3.9.0
x86-64 clang 3.9.0 (assertions)
x86-64 clang 3.9.1
x86-64 clang 4.0.0
x86-64 clang 4.0.0 (assertions)
x86-64 clang 4.0.1
x86-64 clang 5.0.0
x86-64 clang 5.0.0 (assertions)
x86-64 clang 5.0.1
x86-64 clang 5.0.2
x86-64 clang 6.0.0
x86-64 clang 6.0.0 (assertions)
x86-64 clang 6.0.1
x86-64 clang 7.0.0
x86-64 clang 7.0.0 (assertions)
x86-64 clang 7.0.1
x86-64 clang 7.1.0
x86-64 clang 8.0.0
x86-64 clang 8.0.0 (assertions)
x86-64 clang 8.0.1
x86-64 clang 9.0.0
x86-64 clang 9.0.0 (assertions)
x86-64 clang 9.0.1
x86-64 clang rocm-4.5.2
x86-64 clang rocm-5.0.2
x86-64 clang rocm-5.1.3
x86-64 clang rocm-5.2.3
x86-64 clang rocm-5.3.3
x86-64 clang rocm-5.7.0
x86-64 clang rocm-6.0.2
x86-64 clang rocm-6.1.2
x86-64 clang rocm-6.2.4
x86-64 clang rocm-6.3.3
x86-64 clang rocm-6.4.0
x86-64 gcc (P2034 lambdas)
x86-64 gcc (contract labels)
x86-64 gcc (contracts natural syntax)
x86-64 gcc (contracts)
x86-64 gcc (coroutines)
x86-64 gcc (modules)
x86-64 gcc (trunk)
x86-64 gcc 10.1
x86-64 gcc 10.2
x86-64 gcc 10.3
x86-64 gcc 10.3 (assertions)
x86-64 gcc 10.4
x86-64 gcc 10.4 (assertions)
x86-64 gcc 10.5
x86-64 gcc 10.5 (assertions)
x86-64 gcc 11.1
x86-64 gcc 11.1 (assertions)
x86-64 gcc 11.2
x86-64 gcc 11.2 (assertions)
x86-64 gcc 11.3
x86-64 gcc 11.3 (assertions)
x86-64 gcc 11.4
x86-64 gcc 11.4 (assertions)
x86-64 gcc 12.1
x86-64 gcc 12.1 (assertions)
x86-64 gcc 12.2
x86-64 gcc 12.2 (assertions)
x86-64 gcc 12.3
x86-64 gcc 12.3 (assertions)
x86-64 gcc 12.4
x86-64 gcc 12.4 (assertions)
x86-64 gcc 12.5
x86-64 gcc 12.5 (assertions)
x86-64 gcc 13.1
x86-64 gcc 13.1 (assertions)
x86-64 gcc 13.2
x86-64 gcc 13.2 (assertions)
x86-64 gcc 13.3
x86-64 gcc 13.3 (assertions)
x86-64 gcc 13.4
x86-64 gcc 13.4 (assertions)
x86-64 gcc 14.1
x86-64 gcc 14.1 (assertions)
x86-64 gcc 14.2
x86-64 gcc 14.2 (assertions)
x86-64 gcc 14.3
x86-64 gcc 14.3 (assertions)
x86-64 gcc 15.1
x86-64 gcc 15.1 (assertions)
x86-64 gcc 15.2
x86-64 gcc 15.2 (assertions)
x86-64 gcc 3.4.6
x86-64 gcc 4.0.4
x86-64 gcc 4.1.2
x86-64 gcc 4.4.7
x86-64 gcc 4.5.3
x86-64 gcc 4.6.4
x86-64 gcc 4.7.1
x86-64 gcc 4.7.2
x86-64 gcc 4.7.3
x86-64 gcc 4.7.4
x86-64 gcc 4.8.1
x86-64 gcc 4.8.2
x86-64 gcc 4.8.3
x86-64 gcc 4.8.4
x86-64 gcc 4.8.5
x86-64 gcc 4.9.0
x86-64 gcc 4.9.1
x86-64 gcc 4.9.2
x86-64 gcc 4.9.3
x86-64 gcc 4.9.4
x86-64 gcc 5.1
x86-64 gcc 5.2
x86-64 gcc 5.3
x86-64 gcc 5.4
x86-64 gcc 5.5
x86-64 gcc 6.1
x86-64 gcc 6.2
x86-64 gcc 6.3
x86-64 gcc 6.4
x86-64 gcc 6.5
x86-64 gcc 7.1
x86-64 gcc 7.2
x86-64 gcc 7.3
x86-64 gcc 7.4
x86-64 gcc 7.5
x86-64 gcc 8.1
x86-64 gcc 8.2
x86-64 gcc 8.3
x86-64 gcc 8.4
x86-64 gcc 8.5
x86-64 gcc 9.1
x86-64 gcc 9.2
x86-64 gcc 9.3
x86-64 gcc 9.4
x86-64 gcc 9.5
x86-64 icc 13.0.1
x86-64 icc 16.0.3
x86-64 icc 17.0.0
x86-64 icc 18.0.0
x86-64 icc 19.0.0
x86-64 icc 19.0.1
x86-64 icc 2021.1.2
x86-64 icc 2021.10.0
x86-64 icc 2021.2.0
x86-64 icc 2021.3.0
x86-64 icc 2021.4.0
x86-64 icc 2021.5.0
x86-64 icc 2021.6.0
x86-64 icc 2021.7.0
x86-64 icc 2021.7.1
x86-64 icc 2021.8.0
x86-64 icc 2021.9.0
x86-64 icx 2021.1.2
x86-64 icx 2021.2.0
x86-64 icx 2021.3.0
x86-64 icx 2021.4.0
x86-64 icx 2022.0.0
x86-64 icx 2022.1.0
x86-64 icx 2022.2.0
x86-64 icx 2022.2.1
x86-64 icx 2023.0.0
x86-64 icx 2023.1.0
x86-64 icx 2023.2.1
x86-64 icx 2024.0.0
x86-64 icx 2024.1.0
x86-64 icx 2024.2.0
x86-64 icx 2024.2.1
x86-64 icx 2025.0.0
x86-64 icx 2025.0.1
x86-64 icx 2025.0.3
x86-64 icx 2025.0.4
x86-64 icx 2025.1.0
x86-64 icx 2025.1.1
x86-64 icx 2025.2.0
x86-64 icx 2025.2.1
x86-64 icx 2025.2.1
z180-clang 15.0.0
z180-clang 15.0.7
z80-clang 15.0.0
z80-clang 15.0.7
zig c++ 0.10.0
zig c++ 0.11.0
zig c++ 0.12.0
zig c++ 0.12.1
zig c++ 0.13.0
zig c++ 0.14.0
zig c++ 0.14.1
zig c++ 0.15.1
zig c++ 0.6.0
zig c++ 0.7.0
zig c++ 0.7.1
zig c++ 0.8.0
zig c++ 0.9.0
zig c++ trunk
Options
Source code
extern "C" { extern "C" { extern "C" { typedef signed int int32_t; typedef signed long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef int64_t intmax_t; typedef uint64_t uintmax_t; typedef signed long intptr_t; typedef unsigned long uintptr_t; typedef signed char int_least8_t; typedef signed short int_least16_t; typedef signed int int_least32_t; typedef signed long long int_least64_t; typedef unsigned char uint_least8_t; } typedef struct { intmax_t quot; } imaxdiv_t; extern intmax_t __strtollmax(const char * , char ** , int); static intmax_t strtoimax (const char * __nptr, char ** __endptr, int __base) { return __strtollmax (__nptr, __endptr, __base); } extern intmax_t imaxabs(intmax_t); extern imaxdiv_t imaxdiv (intmax_t, intmax_t); extern uintmax_t strtoumax(const char * , char ** , int); typedef unsigned short wchar_t; extern intmax_t wcstoimax(const wchar_t * , wchar_t ** , int ); extern uintmax_t wcstoumax(const wchar_t * , wchar_t ** , int); typedef int32_t intfast_t; typedef uint32_t uintfast_t; typedef signed long __long32_t; typedef unsigned long __ulong32_t; typedef signed int __long64_t; typedef unsigned int __ulong64_t; typedef signed int int32long64_t; typedef unsigned int uint32long64_t; typedef signed long long32int64_t; typedef unsigned long ulong32int64_t; typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char u_int8; typedef unsigned char u_int8_t; typedef unsigned short u_int16; typedef unsigned short u_int16_t; typedef unsigned int u_int32; typedef unsigned int u_int32_t; typedef unsigned long long u_int64; typedef unsigned long long u_int64_t; } typedef long int ptrdiff_t; typedef unsigned int wctype_t; typedef long fpos_t; typedef long long fpos64_t; typedef int time_t; typedef int clock_t; typedef long unsigned int size_t; typedef unsigned char uchar_t; typedef unsigned short ushort_t; typedef unsigned int uint_t; typedef unsigned long ulong_t; typedef signed long ssize_t; typedef int level_t; typedef __long64_t daddr_t; typedef int daddr32_t; typedef int64_t daddr64_t; typedef char * caddr_t; typedef __ulong64_t ino_t; typedef uint_t ino32_t; typedef uint64_t ino64_t; typedef short cnt_t; typedef __ulong64_t dev_t; typedef uint_t dev32_t; typedef uint64_t dev64_t; typedef int chan_t; typedef int time32_t; typedef int pid32_t; typedef int tid32_t; typedef uint64_t pid64_t; typedef uint64_t tid64_t; typedef int64_t time64_t; typedef void * __ptr32; typedef char * __cptr32; typedef int soff_t; typedef long off_t; typedef long long off64_t; typedef long paddr_t; typedef int32long64_t key_t; typedef __long64_t timer_t; typedef int timer32_t; typedef int64_t timer64_t; typedef short nlink_t; typedef uint_t mode_t; typedef uint_t uid_t; typedef uint_t gid_t; typedef __ptr32 mid_t; typedef int32long64_t pid_t; typedef __long64_t tid_t; typedef char slab_t[12]; typedef long mtyp_t; typedef int boolean_t; typedef int crid_t; typedef __long64_t blkcnt_t; typedef __long64_t blksize_t; typedef int blkcnt32_t; typedef int blksize32_t; typedef uint64_t blkcnt64_t; typedef uint64_t blksize64_t; typedef ulong_t fsblkcnt_t; typedef ulong_t fsfilcnt_t; typedef int wint_t; typedef uint32long64_t id_t; typedef unsigned int useconds_t; typedef signed int suseconds_t; typedef long long clockid_t; typedef struct sigset_t { unsigned int losigs; unsigned int hisigs; } sigset_t; typedef struct { unsigned int losigs, hisigs; } sigset32_t; typedef struct { uint64_t ss_set[4]; } sigset64_t; typedef int signal_t; typedef struct fsid_t { unsigned int val[2]; } fsid_t; typedef struct fsid64_t { uint64_t val[2]; } fsid64_t; typedef void *pthread_attr_t; typedef void *pthread_condattr_t; typedef void *pthread_mutexattr_t; typedef void *pthread_rwlockattr_t; typedef void *pthread_barrierattr_t; typedef unsigned int pthread_t; typedef unsigned int pthread_key_t; typedef struct { int __mt_word[13]; } pthread_mutex_t; typedef struct { int __cv_word[11]; } pthread_cond_t; typedef struct { int __on_word[28]; } pthread_once_t; typedef struct { int __sp_word[6]; } pthread_spinlock_t; typedef struct { int __br_word[8]; } pthread_barrier_t; typedef struct { int __rw_word[52]; } pthread_rwlock_t; typedef struct _quad { int val[2]; } quad; typedef long vmid_t; typedef ulong_t vmhandle_t; typedef int vmid32_t; typedef uint_t vmhandle32_t; typedef long32int64_t kvmid_t; typedef ulong32int64_t kvmhandle_t; typedef long long vmid64_t; typedef long long rpn64_t; typedef long long cnt64_t; typedef long long psize_t; typedef ushort_t pshift_t; typedef ushort_t sshift_t; typedef int unidx_t; typedef int snidx_t; typedef int vmnodeidx_t; typedef int kvpn_t; typedef int krpn_t; typedef int32long64_t vmsize_t; typedef int32long64_t vmm_lock_t; typedef unsigned long ureg_t; typedef struct vmaddr_t { vmhandle_t srval; caddr_t offset; } vmaddr_t; typedef struct adspace_t { ulong32int64_t alloc; vmhandle_t srval[16]; } adspace_t; typedef enum _MR_ATTR_TYPE { BadAttr = 0, VirtAddr = 1 } MR_ATTR_TYPE; typedef enum _MR_LABEL_TYPE { BadMem = 0, FreeMem = 1, IPLCB = 2, RMALLOC = 3, PM_HEAP = 4, RTAS_HEAP = 5, TCE_TABLE = 6, IO_SPACE = 7, HUGE_PAGE = 8 } MR_LABEL_TYPE; typedef struct { unsigned long long mr_addr; unsigned long long mr_size; unsigned char mr_att; unsigned char mr_label; unsigned short mr_nodeid; char reserved[4]; } iplcb_map_reg_t; typedef vmhandle_t vmlpghandle_t; typedef struct label_t { struct label_t *prev; ulong_t iar; ulong_t stack; ulong_t toc; ulong_t cr; ulong_t intpri; ulong_t reg[19]; } label_t; typedef int32long64_t ext_t; typedef char * va_list; typedef unsigned long long __ptr64; typedef unsigned long long __cptr64; typedef ushort_t UniChar; typedef uint_t UTF32Char; typedef uchar_t uchar; typedef ushort_t ushort; typedef uint_t uint; typedef ulong_t ulong; typedef struct { int r[1]; } * physadr_t; typedef physadr_t physadr; typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef int swblk_t; struct sigset { unsigned int losigs; unsigned int hisigs; }; struct fsid { unsigned int val[2]; }; struct fileid { uint_t fid_len; ino32_t fid_ino; uint_t fid_gen; char fid_x[20 - (sizeof(ino32_t) + 2) - sizeof(uint_t)]; }; struct fid { uint_t fid_len; char fid_data[20]; }; typedef struct fid fid_t; struct fhandle { char x[32]; }; typedef struct fhandle fhandle_t; struct filehandle { fsid_t fh_fsid; struct fileid fh_fid; }; struct unique_id { __ulong32_t word1; __ulong32_t word2; __ulong32_t word3; __ulong32_t word4; }; typedef struct unique_id unique_id_t; typedef long long offset_t; typedef long long ssize64_t; typedef long long longlong_t; typedef unsigned long long u_longlong_t; typedef unsigned int class_id_t; typedef uint_t liobn_t; typedef unsigned long long unit_addr_t; typedef unsigned long long size64_t; } namespace std { typedef long unsigned int size_t; typedef long int ptrdiff_t; typedef decltype(nullptr) nullptr_t; } namespace std { typedef enum memory_order { memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; inline memory_order __calculate_memory_order(memory_order __m) noexcept { const bool __cond1 = __m == memory_order_release; const bool __cond2 = __m == memory_order_acq_rel; memory_order __mo1(__cond1 ? memory_order_relaxed : __m); memory_order __mo2(__cond2 ? memory_order_acquire : __mo1); return __mo2; } void atomic_thread_fence(memory_order) noexcept; void atomic_signal_fence(memory_order) noexcept; template<typename _Tp> inline _Tp kill_dependency(_Tp __y) noexcept { _Tp __ret(__y); return __ret; } extern "C" { struct __atomic_flag_base { bool _M_i; }; } namespace __atomic0 { struct atomic_flag; template<typename _IntTp> struct __atomic_base; } namespace __atomic2 { struct atomic_flag; template<typename _IntTp> struct __atomic_base; } namespace __atomic1 { using __atomic2::atomic_flag; using __atomic0::__atomic_base; } inline namespace __atomic1 { } typedef __atomic_base<char> atomic_char; typedef __atomic_base<signed char> atomic_schar; typedef __atomic_base<unsigned char> atomic_uchar; typedef __atomic_base<short> atomic_short; typedef __atomic_base<unsigned short> atomic_ushort; typedef __atomic_base<int> atomic_int; typedef __atomic_base<unsigned int> atomic_uint; typedef __atomic_base<long> atomic_long; typedef __atomic_base<unsigned long> atomic_ulong; typedef __atomic_base<long long> atomic_llong; typedef __atomic_base<unsigned long long> atomic_ullong; typedef __atomic_base<wchar_t> atomic_wchar_t; typedef __atomic_base<char16_t> atomic_char16_t; typedef __atomic_base<char32_t> atomic_char32_t; typedef __atomic_base<char32_t> atomic_char32_t; typedef __atomic_base<int_least8_t> atomic_int_least8_t; typedef __atomic_base<uint_least8_t> atomic_uint_least8_t; typedef __atomic_base<int_least16_t> atomic_int_least16_t; typedef __atomic_base<uint_least16_t> atomic_uint_least16_t; typedef __atomic_base<int_least32_t> atomic_int_least32_t; typedef __atomic_base<uint_least32_t> atomic_uint_least32_t; typedef __atomic_base<int_least64_t> atomic_int_least64_t; typedef __atomic_base<uint_least64_t> atomic_uint_least64_t; typedef __atomic_base<int_fast8_t> atomic_int_fast8_t; typedef __atomic_base<uint_fast8_t> atomic_uint_fast8_t; typedef __atomic_base<int_fast16_t> atomic_int_fast16_t; typedef __atomic_base<uint_fast16_t> atomic_uint_fast16_t; typedef __atomic_base<int_fast32_t> atomic_int_fast32_t; typedef __atomic_base<uint_fast32_t> atomic_uint_fast32_t; typedef __atomic_base<int_fast64_t> atomic_int_fast64_t; typedef __atomic_base<uint_fast64_t> atomic_uint_fast64_t; typedef __atomic_base<intptr_t> atomic_intptr_t; typedef __atomic_base<uintptr_t> atomic_uintptr_t; typedef __atomic_base<size_t> atomic_size_t; typedef __atomic_base<intmax_t> atomic_intmax_t; typedef __atomic_base<uintmax_t> atomic_uintmax_t; typedef __atomic_base<ptrdiff_t> atomic_ptrdiff_t; template<typename _Tp> struct atomic; template<typename _Tp> struct atomic<_Tp*>; } namespace std { namespace __atomic0 { extern "C" { void atomic_flag_clear_explicit(__atomic_flag_base*, memory_order) noexcept; void __atomic_flag_wait_explicit(__atomic_flag_base*, memory_order) noexcept; __attribute__ ((__const__)) __atomic_flag_base* __atomic_flag_for_address(const volatile void* __z) noexcept; } struct atomic_flag : public __atomic_flag_base { atomic_flag() noexcept = default; ~atomic_flag() noexcept = default; atomic_flag(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete; atomic_flag(bool __i) noexcept : __atomic_flag_base({ __i }) { } bool test_and_set(memory_order __m = memory_order_seq_cst) noexcept; bool test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept; void clear(memory_order __m = memory_order_seq_cst) noexcept; void clear(memory_order __m = memory_order_seq_cst) volatile noexcept; }; template<typename _ITp> struct __atomic_base { private: typedef _ITp __int_type; __int_type _M_i; public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { } operator __int_type() const noexcept { return load(); } operator __int_type() const volatile noexcept { return load(); } __int_type operator=(__int_type __i) noexcept { store(__i); return __i; } __int_type operator=(__int_type __i) volatile noexcept { store(__i); return __i; } __int_type operator++(int) noexcept { return fetch_add(1); } __int_type operator++(int) volatile noexcept { return fetch_add(1); } __int_type operator--(int) noexcept { return fetch_sub(1); } __int_type operator--(int) volatile noexcept { return fetch_sub(1); } __int_type operator++() noexcept { return fetch_add(1) + 1; } __int_type operator++() volatile noexcept { return fetch_add(1) + 1; } __int_type operator--() noexcept { return fetch_sub(1) - 1; } __int_type operator--() volatile noexcept { return fetch_sub(1) - 1; } __int_type operator+=(__int_type __i) noexcept { return fetch_add(__i) + __i; } __int_type operator+=(__int_type __i) volatile noexcept { return fetch_add(__i) + __i; } __int_type operator-=(__int_type __i) noexcept { return fetch_sub(__i) - __i; } __int_type operator-=(__int_type __i) volatile noexcept { return fetch_sub(__i) - __i; } __int_type operator&=(__int_type __i) noexcept { return fetch_and(__i) & __i; } __int_type operator&=(__int_type __i) volatile noexcept { return fetch_and(__i) & __i; } __int_type operator|=(__int_type __i) noexcept { return fetch_or(__i) | __i; } __int_type operator|=(__int_type __i) volatile noexcept { return fetch_or(__i) | __i; } __int_type operator^=(__int_type __i) noexcept { return fetch_xor(__i) ^ __i; } __int_type operator^=(__int_type __i) volatile noexcept { return fetch_xor(__i) ^ __i; } bool is_lock_free() const noexcept { return false; } bool is_lock_free() const volatile noexcept { return false; } void store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { ; ; ; ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); *__p = __w; atomic_flag_clear_explicit(__g, __m); __w; }); } void store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { ; ; ; ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); *__p = __w; atomic_flag_clear_explicit(__g, __m); __w; }); } __int_type load(memory_order __m = memory_order_seq_cst) const noexcept { ; ; return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { ; ; return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type exchange(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p = __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p = __w; atomic_flag_clear_explicit(__g, __m); __r; }); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { ; ; ; return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(&__i1) __q = (&__i1); __typeof__(__i2) __w = (__i2); bool __r; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m1); __i_type __t = *__p; if (*__q == __t) { *__p = (__i_type)__w; __r = true; } else { *__q = __t; __r = false; } atomic_flag_clear_explicit(__g, __m1); __r; }); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) volatile noexcept { ; ; ; return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(&__i1) __q = (&__i1); __typeof__(__i2) __w = (__i2); bool __r; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m1); __i_type __t = *__p; if (*__q == __t) { *__p = (__i_type)__w; __r = true; } else { *__q = __t; __r = false; } atomic_flag_clear_explicit(__g, __m1); __r; }); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_weak(__i1, __i2, __m, __calculate_memory_order(__m)); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_weak(__i1, __i2, __m, __calculate_memory_order(__m)); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { ; ; ; return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(&__i1) __q = (&__i1); __typeof__(__i2) __w = (__i2); bool __r; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m1); __i_type __t = *__p; if (*__q == __t) { *__p = (__i_type)__w; __r = true; } else { *__q = __t; __r = false; } atomic_flag_clear_explicit(__g, __m1); __r; }); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) volatile noexcept { ; ; ; return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(&__i1) __q = (&__i1); __typeof__(__i2) __w = (__i2); bool __r; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m1); __i_type __t = *__p; if (*__q == __t) { *__p = (__i_type)__w; __r = true; } else { *__q = __t; __r = false; } atomic_flag_clear_explicit(__g, __m1); __r; }); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_strong(__i1, __i2, __m, __calculate_memory_order(__m)); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_strong(__i1, __i2, __m, __calculate_memory_order(__m)); } __int_type fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p += __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p += __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p -= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p -= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p &= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p &= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p |= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p |= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p ^= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } __int_type fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__i) __w = (__i); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p ^= __w; atomic_flag_clear_explicit(__g, __m); __r; }); } }; template<typename _PTp> struct __atomic_base<_PTp*> { private: typedef _PTp* __return_pointer_type; typedef void* __pointer_type; __pointer_type _M_i; public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; constexpr __atomic_base(__return_pointer_type __p) noexcept : _M_i (__p) { } operator __return_pointer_type() const noexcept { return reinterpret_cast<__return_pointer_type>(load()); } operator __return_pointer_type() const volatile noexcept { return reinterpret_cast<__return_pointer_type>(load()); } __return_pointer_type operator=(__pointer_type __p) noexcept { store(__p); return reinterpret_cast<__return_pointer_type>(__p); } __return_pointer_type operator=(__pointer_type __p) volatile noexcept { store(__p); return reinterpret_cast<__return_pointer_type>(__p); } __return_pointer_type operator++(int) noexcept { return reinterpret_cast<__return_pointer_type>(fetch_add(1)); } __return_pointer_type operator++(int) volatile noexcept { return reinterpret_cast<__return_pointer_type>(fetch_add(1)); } __return_pointer_type operator--(int) noexcept { return reinterpret_cast<__return_pointer_type>(fetch_sub(1)); } __return_pointer_type operator--(int) volatile noexcept { return reinterpret_cast<__return_pointer_type>(fetch_sub(1)); } __return_pointer_type operator++() noexcept { return reinterpret_cast<__return_pointer_type>(fetch_add(1) + 1); } __return_pointer_type operator++() volatile noexcept { return reinterpret_cast<__return_pointer_type>(fetch_add(1) + 1); } __return_pointer_type operator--() noexcept { return reinterpret_cast<__return_pointer_type>(fetch_sub(1) - 1); } __return_pointer_type operator--() volatile noexcept { return reinterpret_cast<__return_pointer_type>(fetch_sub(1) - 1); } __return_pointer_type operator+=(ptrdiff_t __d) noexcept { return reinterpret_cast<__return_pointer_type>(fetch_add(__d) + __d); } __return_pointer_type operator+=(ptrdiff_t __d) volatile noexcept { return reinterpret_cast<__return_pointer_type>(fetch_add(__d) + __d); } __return_pointer_type operator-=(ptrdiff_t __d) noexcept { return reinterpret_cast<__return_pointer_type>(fetch_sub(__d) - __d); } __return_pointer_type operator-=(ptrdiff_t __d) volatile noexcept { return reinterpret_cast<__return_pointer_type>(fetch_sub(__d) - __d); } bool is_lock_free() const noexcept { return true; } bool is_lock_free() const volatile noexcept { return true; } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { ; ; ; ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__p) __w = (__p); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); *__p = __w; atomic_flag_clear_explicit(__g, __m); __w; }); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { ; ; ; volatile __pointer_type* __p2 = &_M_i; __typeof__(__p) __w = (__p); __atomic_flag_base* __g = __atomic_flag_for_address(__p2); __atomic_flag_wait_explicit(__g, __m); *__p2 = reinterpret_cast<__pointer_type>(__w); atomic_flag_clear_explicit(__g, __m); __w; } __return_pointer_type load(memory_order __m = memory_order_seq_cst) const noexcept { ; ; void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } __return_pointer_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { ; ; void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } __return_pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__p) __w = (__p); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p = __w; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } __return_pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { volatile __pointer_type* __p2 = &_M_i; __typeof__(__p) __w = (__p); __atomic_flag_base* __g = __atomic_flag_for_address(__p2); __atomic_flag_wait_explicit(__g, __m); __pointer_type __r = *__p2; *__p2 = __w; atomic_flag_clear_explicit(__g, __m); __r; return reinterpret_cast<__return_pointer_type>(_M_i); } bool compare_exchange_strong(__return_pointer_type& __rp1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { ; ; ; __pointer_type& __p1 = reinterpret_cast<void*&>(__rp1); return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(&__p1) __q = (&__p1); __typeof__(__p2) __w = (__p2); bool __r; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m1); __i_type __t = *__p; if (*__q == __t) { *__p = (__i_type)__w; __r = true; } else { *__q = __t; __r = false; } atomic_flag_clear_explicit(__g, __m1); __r; }); } bool compare_exchange_strong(__return_pointer_type& __rp1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { ; ; ; __pointer_type& __p1 = reinterpret_cast<void*&>(__rp1); return ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(&__p1) __q = (&__p1); __typeof__(__p2) __w = (__p2); bool __r; __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m1); __i_type __t = *__p; if (*__q == __t) { *__p = (__i_type)__w; __r = true; } else { *__q = __t; __r = false; } atomic_flag_clear_explicit(__g, __m1); __r; }); } __return_pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__d) __w = (__d); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p += __w; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } __return_pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__d) __w = (__d); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p += __w; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } __return_pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__d) __w = (__d); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p -= __w; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } __return_pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { void* __v = ({typedef __typeof__(_M_i) __i_type; __i_type* __p = &_M_i; __typeof__(__d) __w = (__d); __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_wait_explicit(__g, __m); __i_type __r = *__p; *__p -= __w; atomic_flag_clear_explicit(__g, __m); __r; }); return reinterpret_cast<__return_pointer_type>(__v); } }; } } namespace std { namespace __atomic2 { struct atomic_flag : public __atomic_flag_base { atomic_flag() noexcept = default; ~atomic_flag() noexcept = default; atomic_flag(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete; atomic_flag(bool __i) noexcept : __atomic_flag_base({ __i }) { } bool test_and_set(memory_order __m = memory_order_seq_cst) noexcept { if (__m != memory_order_acquire && __m != memory_order_acq_rel) __sync_synchronize(); return __sync_lock_test_and_set(&_M_i, 1); } bool test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept { if (__m != memory_order_acquire && __m != memory_order_acq_rel) __sync_synchronize(); return __sync_lock_test_and_set(&_M_i, 1); } void clear(memory_order __m = memory_order_seq_cst) noexcept { ; ; ; __sync_lock_release(&_M_i); if (__m != memory_order_acquire && __m != memory_order_acq_rel) __sync_synchronize(); } void clear(memory_order __m = memory_order_seq_cst) volatile noexcept { ; ; ; __sync_lock_release(&_M_i); if (__m != memory_order_acquire && __m != memory_order_acq_rel) __sync_synchronize(); } }; template<typename _ITp> struct __atomic_base { private: typedef _ITp __int_type; __int_type _M_i; public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { } operator __int_type() const noexcept { return load(); } operator __int_type() const volatile noexcept { return load(); } __int_type operator=(__int_type __i) noexcept { store(__i); return __i; } __int_type operator=(__int_type __i) volatile noexcept { store(__i); return __i; } __int_type operator++(int) noexcept { return fetch_add(1); } __int_type operator++(int) volatile noexcept { return fetch_add(1); } __int_type operator--(int) noexcept { return fetch_sub(1); } __int_type operator--(int) volatile noexcept { return fetch_sub(1); } __int_type operator++() noexcept { return __sync_add_and_fetch(&_M_i, 1); } __int_type operator++() volatile noexcept { return __sync_add_and_fetch(&_M_i, 1); } __int_type operator--() noexcept { return __sync_sub_and_fetch(&_M_i, 1); } __int_type operator--() volatile noexcept { return __sync_sub_and_fetch(&_M_i, 1); } __int_type operator+=(__int_type __i) noexcept { return __sync_add_and_fetch(&_M_i, __i); } __int_type operator+=(__int_type __i) volatile noexcept { return __sync_add_and_fetch(&_M_i, __i); } __int_type operator-=(__int_type __i) noexcept { return __sync_sub_and_fetch(&_M_i, __i); } __int_type operator-=(__int_type __i) volatile noexcept { return __sync_sub_and_fetch(&_M_i, __i); } __int_type operator&=(__int_type __i) noexcept { return __sync_and_and_fetch(&_M_i, __i); } __int_type operator&=(__int_type __i) volatile noexcept { return __sync_and_and_fetch(&_M_i, __i); } __int_type operator|=(__int_type __i) noexcept { return __sync_or_and_fetch(&_M_i, __i); } __int_type operator|=(__int_type __i) volatile noexcept { return __sync_or_and_fetch(&_M_i, __i); } __int_type operator^=(__int_type __i) noexcept { return __sync_xor_and_fetch(&_M_i, __i); } __int_type operator^=(__int_type __i) volatile noexcept { return __sync_xor_and_fetch(&_M_i, __i); } bool is_lock_free() const noexcept { return true; } bool is_lock_free() const volatile noexcept { return true; } void store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { ; ; ; if (__m == memory_order_relaxed) _M_i = __i; else { _M_i = __i; if (__m == memory_order_seq_cst) __sync_synchronize(); } } void store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { ; ; ; if (__m == memory_order_relaxed) _M_i = __i; else { _M_i = __i; if (__m == memory_order_seq_cst) __sync_synchronize(); } } __int_type load(memory_order __m = memory_order_seq_cst) const noexcept { ; ; __sync_synchronize(); __int_type __ret = _M_i; __sync_synchronize(); return __ret; } __int_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { ; ; __sync_synchronize(); __int_type __ret = _M_i; __sync_synchronize(); return __ret; } __int_type exchange(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __sync_lock_test_and_set(&_M_i, __i); } __int_type exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_lock_test_and_set(&_M_i, __i); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { return compare_exchange_strong(__i1, __i2, __m1, __m2); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) volatile noexcept { return compare_exchange_strong(__i1, __i2, __m1, __m2); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_weak(__i1, __i2, __m, __calculate_memory_order(__m)); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_weak(__i1, __i2, __m, __calculate_memory_order(__m)); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { ; ; ; __int_type __i1o = __i1; __int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2); __i1 = __i1n; return __i1o == __i1n; } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) volatile noexcept { ; ; ; __int_type __i1o = __i1; __int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2); __i1 = __i1n; return __i1o == __i1n; } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_strong(__i1, __i2, __m, __calculate_memory_order(__m)); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_strong(__i1, __i2, __m, __calculate_memory_order(__m)); } __int_type fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_add(&_M_i, __i); } __int_type fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_add(&_M_i, __i); } __int_type fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_sub(&_M_i, __i); } __int_type fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_sub(&_M_i, __i); } __int_type fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_and(&_M_i, __i); } __int_type fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_and(&_M_i, __i); } __int_type fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_or(&_M_i, __i); } __int_type fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_or(&_M_i, __i); } __int_type fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_xor(&_M_i, __i); } __int_type fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_xor(&_M_i, __i); } }; template<typename _PTp> struct __atomic_base<_PTp*> { private: typedef _PTp* __pointer_type; __pointer_type _M_p; public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; constexpr __atomic_base(__pointer_type __p) noexcept : _M_p (__p) { } operator __pointer_type() const noexcept { return load(); } operator __pointer_type() const volatile noexcept { return load(); } __pointer_type operator=(__pointer_type __p) noexcept { store(__p); return __p; } __pointer_type operator=(__pointer_type __p) volatile noexcept { store(__p); return __p; } __pointer_type operator++(int) noexcept { return fetch_add(1); } __pointer_type operator++(int) volatile noexcept { return fetch_add(1); } __pointer_type operator--(int) noexcept { return fetch_sub(1); } __pointer_type operator--(int) volatile noexcept { return fetch_sub(1); } __pointer_type operator++() noexcept { return fetch_add(1) + 1; } __pointer_type operator++() volatile noexcept { return fetch_add(1) + 1; } __pointer_type operator--() noexcept { return fetch_sub(1) -1; } __pointer_type operator--() volatile noexcept { return fetch_sub(1) -1; } __pointer_type operator+=(ptrdiff_t __d) noexcept { return fetch_add(__d) + __d; } __pointer_type operator+=(ptrdiff_t __d) volatile noexcept { return fetch_add(__d) + __d; } __pointer_type operator-=(ptrdiff_t __d) noexcept { return fetch_sub(__d) - __d; } __pointer_type operator-=(ptrdiff_t __d) volatile noexcept { return fetch_sub(__d) - __d; } bool is_lock_free() const noexcept { return true; } bool is_lock_free() const volatile noexcept { return true; } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { ; ; ; if (__m == memory_order_relaxed) _M_p = __p; else { _M_p = __p; if (__m == memory_order_seq_cst) __sync_synchronize(); } } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { ; ; ; if (__m == memory_order_relaxed) _M_p = __p; else { _M_p = __p; if (__m == memory_order_seq_cst) __sync_synchronize(); } } __pointer_type load(memory_order __m = memory_order_seq_cst) const noexcept { ; ; __sync_synchronize(); __pointer_type __ret = _M_p; __sync_synchronize(); return __ret; } __pointer_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { ; ; __sync_synchronize(); __pointer_type __ret = _M_p; __sync_synchronize(); return __ret; } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { return __sync_lock_test_and_set(&_M_p, __p); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_lock_test_and_set(&_M_p, __p); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { ; ; ; __pointer_type __p1o = __p1; __pointer_type __p1n = __sync_val_compare_and_swap(&_M_p, __p1o, __p2); __p1 = __p1n; return __p1o == __p1n; } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { ; ; ; __pointer_type __p1o = __p1; __pointer_type __p1n = __sync_val_compare_and_swap(&_M_p, __p1o, __p2); __p1 = __p1n; return __p1o == __p1n; } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_add(&_M_p, __d); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_add(&_M_p, __d); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return __sync_fetch_and_sub(&_M_p, __d); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return __sync_fetch_and_sub(&_M_p, __d); } }; } } namespace std { struct atomic_bool { private: __atomic_base<bool> _M_base; public: atomic_bool() noexcept = default; ~atomic_bool() noexcept = default; atomic_bool(const atomic_bool&) = delete; atomic_bool& operator=(const atomic_bool&) = delete; atomic_bool& operator=(const atomic_bool&) volatile = delete; constexpr atomic_bool(bool __i) noexcept : _M_base(__i) { } bool operator=(bool __i) noexcept { return _M_base.operator=(__i); } operator bool() const noexcept { return _M_base.load(); } operator bool() const volatile noexcept { return _M_base.load(); } bool is_lock_free() const noexcept { return _M_base.is_lock_free(); } bool is_lock_free() const volatile noexcept { return _M_base.is_lock_free(); } void store(bool __i, memory_order __m = memory_order_seq_cst) noexcept { _M_base.store(__i, __m); } void store(bool __i, memory_order __m = memory_order_seq_cst) volatile noexcept { _M_base.store(__i, __m); } bool load(memory_order __m = memory_order_seq_cst) const noexcept { return _M_base.load(__m); } bool load(memory_order __m = memory_order_seq_cst) const volatile noexcept { return _M_base.load(__m); } bool exchange(bool __i, memory_order __m = memory_order_seq_cst) noexcept { return _M_base.exchange(__i, __m); } bool exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_base.exchange(__i, __m); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m); } }; template<typename _Tp> struct atomic { private: _Tp _M_i; public: atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(_Tp __i) noexcept : _M_i(__i) { } operator _Tp() const noexcept; operator _Tp() const volatile noexcept; _Tp operator=(_Tp __i) noexcept { store(__i); return __i; } _Tp operator=(_Tp __i) volatile noexcept { store(__i); return __i; } bool is_lock_free() const noexcept; bool is_lock_free() const volatile noexcept; void store(_Tp, memory_order = memory_order_seq_cst) noexcept; void store(_Tp, memory_order = memory_order_seq_cst) volatile noexcept; _Tp load(memory_order = memory_order_seq_cst) const noexcept; _Tp load(memory_order = memory_order_seq_cst) const volatile noexcept; _Tp exchange(_Tp __i, memory_order = memory_order_seq_cst) noexcept; _Tp exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile noexcept; bool compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) noexcept; bool compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile noexcept; bool compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst) noexcept; bool compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst) volatile noexcept; bool compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) noexcept; bool compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile noexcept; bool compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst) noexcept; bool compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst) volatile noexcept; }; template<typename _Tp> struct atomic<_Tp*> { typedef _Tp* __pointer_type; typedef __atomic_base<_Tp*> __base_type; __base_type _M_b; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__pointer_type __p) noexcept : _M_b(__p) { } operator __pointer_type() const noexcept { return __pointer_type(_M_b); } operator __pointer_type() const volatile noexcept { return __pointer_type(_M_b); } __pointer_type operator=(__pointer_type __p) noexcept { return _M_b.operator=(__p); } __pointer_type operator=(__pointer_type __p) volatile noexcept { return _M_b.operator=(__p); } __pointer_type operator++(int) noexcept { return _M_b++; } __pointer_type operator++(int) volatile noexcept { return _M_b++; } __pointer_type operator--(int) noexcept { return _M_b--; } __pointer_type operator--(int) volatile noexcept { return _M_b--; } __pointer_type operator++() noexcept { return ++_M_b; } __pointer_type operator++() volatile noexcept { return ++_M_b; } __pointer_type operator--() noexcept { return --_M_b; } __pointer_type operator--() volatile noexcept { return --_M_b; } __pointer_type operator+=(ptrdiff_t __d) noexcept { return _M_b.operator+=(__d); } __pointer_type operator+=(ptrdiff_t __d) volatile noexcept { return _M_b.operator+=(__d); } __pointer_type operator-=(ptrdiff_t __d) noexcept { return _M_b.operator-=(__d); } __pointer_type operator-=(ptrdiff_t __d) volatile noexcept { return _M_b.operator-=(__d); } bool is_lock_free() const noexcept { return _M_b.is_lock_free(); } bool is_lock_free() const volatile noexcept { return _M_b.is_lock_free(); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.store(__p, __m); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.store(__p, __m); } __pointer_type load(memory_order __m = memory_order_seq_cst) const noexcept { return _M_b.load(__m); } __pointer_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { return _M_b.load(__m); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.exchange(__p, __m); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.exchange(__p, __m); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_weak(__p1, __p2, __m, __calculate_memory_order(__m)); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_weak(__p1, __p2, __m, __calculate_memory_order(__m)); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m, __calculate_memory_order(__m)); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m, __calculate_memory_order(__m)); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.fetch_add(__d, __m); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.fetch_add(__d, __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.fetch_sub(__d, __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.fetch_sub(__d, __m); } }; template<> struct atomic<bool> : public atomic_bool { typedef bool __integral_type; typedef atomic_bool __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<char> : public atomic_char { typedef char __integral_type; typedef atomic_char __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<signed char> : public atomic_schar { typedef signed char __integral_type; typedef atomic_schar __base_type; atomic() noexcept= default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<unsigned char> : public atomic_uchar { typedef unsigned char __integral_type; typedef atomic_uchar __base_type; atomic() noexcept= default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<short> : public atomic_short { typedef short __integral_type; typedef atomic_short __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<unsigned short> : public atomic_ushort { typedef unsigned short __integral_type; typedef atomic_ushort __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<int> : atomic_int { typedef int __integral_type; typedef atomic_int __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<unsigned int> : public atomic_uint { typedef unsigned int __integral_type; typedef atomic_uint __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<long> : public atomic_long { typedef long __integral_type; typedef atomic_long __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<unsigned long> : public atomic_ulong { typedef unsigned long __integral_type; typedef atomic_ulong __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<long long> : public atomic_llong { typedef long long __integral_type; typedef atomic_llong __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<unsigned long long> : public atomic_ullong { typedef unsigned long long __integral_type; typedef atomic_ullong __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<wchar_t> : public atomic_wchar_t { typedef wchar_t __integral_type; typedef atomic_wchar_t __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<char16_t> : public atomic_char16_t { typedef char16_t __integral_type; typedef atomic_char16_t __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; template<> struct atomic<char32_t> : public atomic_char32_t { typedef char32_t __integral_type; typedef atomic_char32_t __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; inline bool atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m) noexcept { return __a->test_and_set(__m); } inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __m) noexcept { return __a->test_and_set(__m); } inline void atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m) noexcept { __a->clear(__m); } inline void atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m) noexcept { __a->clear(__m); } inline bool atomic_flag_test_and_set(atomic_flag* __a) noexcept { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } inline bool atomic_flag_test_and_set(volatile atomic_flag* __a) noexcept { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } inline void atomic_flag_clear(atomic_flag* __a) noexcept { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } inline void atomic_flag_clear(volatile atomic_flag* __a) noexcept { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_is_lock_free(const atomic<_ITp>* __a) noexcept { return __a->is_lock_free(); } template<typename _ITp> inline bool atomic_is_lock_free(const volatile atomic<_ITp>* __a) noexcept { return __a->is_lock_free(); } template<typename _ITp> inline void atomic_init(atomic<_ITp>* __a, _ITp __i) noexcept; template<typename _ITp> inline void atomic_init(volatile atomic<_ITp>* __a, _ITp __i) noexcept; template<typename _ITp> inline void atomic_store_explicit(atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { __a->store(__i, __m); } template<typename _ITp> inline void atomic_store_explicit(volatile atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { __a->store(__i, __m); } template<typename _ITp> inline _ITp atomic_load_explicit(const atomic<_ITp>* __a, memory_order __m) noexcept { return __a->load(__m); } template<typename _ITp> inline _ITp atomic_load_explicit(const volatile atomic<_ITp>* __a, memory_order __m) noexcept { return __a->load(__m); } template<typename _ITp> inline _ITp atomic_exchange_explicit(atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->exchange(__i, __m); } template<typename _ITp> inline _ITp atomic_exchange_explicit(volatile atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->exchange(__i, __m); } template<typename _ITp> inline bool atomic_compare_exchange_weak_explicit(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline bool atomic_compare_exchange_weak_explicit(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline bool atomic_compare_exchange_strong_explicit(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline bool atomic_compare_exchange_strong_explicit(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline void atomic_store(atomic<_ITp>* __a, _ITp __i) noexcept { atomic_store_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline void atomic_store(volatile atomic<_ITp>* __a, _ITp __i) noexcept { atomic_store_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_load(const atomic<_ITp>* __a) noexcept { return atomic_load_explicit(__a, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_load(const volatile atomic<_ITp>* __a) noexcept { return atomic_load_explicit(__a, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_exchange(atomic<_ITp>* __a, _ITp __i) noexcept { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_exchange(volatile atomic<_ITp>* __a, _ITp __i) noexcept { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_weak(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_weak(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_strong(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_strong(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_add(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_add(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_sub(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_sub(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_and(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_and(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_or(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_or(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_xor(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_xor(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp* atomic_fetch_add_explicit(atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_add(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_add_explicit(volatile atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_add(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_add(volatile atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_add(__d); } template<typename _ITp> inline _ITp* atomic_fetch_add(atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_add(__d); } template<typename _ITp> inline _ITp* atomic_fetch_sub_explicit(volatile atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_sub(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_sub_explicit(atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_sub(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_sub(volatile atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_sub(__d); } template<typename _ITp> inline _ITp* atomic_fetch_sub(atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_sub(__d); } } namespace std { namespace rel_ops { template <class _Tp> inline bool operator!=(const _Tp& __x, const _Tp& __y) { return !(__x == __y); } template <class _Tp> inline bool operator>(const _Tp& __x, const _Tp& __y) { return __y < __x; } template <class _Tp> inline bool operator<=(const _Tp& __x, const _Tp& __y) { return !(__y < __x); } template <class _Tp> inline bool operator>=(const _Tp& __x, const _Tp& __y) { return !(__x < __y); } } } namespace std { template<typename _Tp> inline _Tp* __addressof(_Tp& __r) noexcept { return reinterpret_cast<_Tp*> (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r))); } } namespace std { 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() { return value; } }; typedef integral_constant<bool, true> true_type; typedef integral_constant<bool, false> false_type; template<typename _Tp, _Tp __v> constexpr _Tp integral_constant<_Tp, __v>::value; 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 integral_constant<bool, !_Pp::value> { }; struct __sfinae_types { typedef char __one; typedef struct { char __arr[2]; } __two; }; template<typename> struct remove_cv; template<typename> struct __is_void_helper : public false_type { }; template<> struct __is_void_helper<void> : public true_type { }; 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 { }; 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 { }; template<> struct __is_integral_helper<wchar_t> : public true_type { }; 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 { }; 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 { }; 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 { }; template<typename _Tp> struct is_floating_point : public integral_constant<bool, (__is_floating_point_helper<typename remove_cv<_Tp>::type>::value)> { }; 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 { }; template<typename _Tp> struct is_pointer : public integral_constant<bool, (__is_pointer_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct is_lvalue_reference : public false_type { }; template<typename _Tp> struct is_lvalue_reference<_Tp&> : public true_type { }; 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> { }; 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 { }; template<typename _Tp, typename _Cp> struct __is_member_function_pointer_helper<_Tp _Cp::*> : public integral_constant<bool, is_function<_Tp>::value> { }; template<typename _Tp> struct is_member_function_pointer : public integral_constant<bool, (__is_member_function_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; template<typename _Tp> struct is_enum : public integral_constant<bool, __is_enum(_Tp)> { }; template<typename _Tp> struct is_union : public integral_constant<bool, __is_union(_Tp)> { }; template<typename _Tp> struct is_class : public integral_constant<bool, __is_class(_Tp)> { }; 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 { }; template<typename> struct __is_nullptr_t_helper : public false_type { }; template<> struct __is_nullptr_t_helper<std::nullptr_t> : public true_type { }; template<typename _Tp> struct __is_nullptr_t : public integral_constant<bool, (__is_nullptr_t_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename _Tp> struct is_reference : public __or_<is_lvalue_reference<_Tp>, is_rvalue_reference<_Tp>>::type { }; template<typename _Tp> struct is_arithmetic : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type { }; template<typename _Tp> struct is_fundamental : public __or_<is_arithmetic<_Tp>, is_void<_Tp>>::type { }; 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; template<typename _Tp> struct is_scalar : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>, is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type { }; 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 { }; template<typename _Tp> struct is_member_pointer : public integral_constant<bool, (__is_member_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct is_const : public false_type { }; template<typename _Tp> struct is_const<_Tp const> : public true_type { }; template<typename> struct is_volatile : public false_type { }; template<typename _Tp> struct is_volatile<_Tp volatile> : public true_type { }; template<typename _Tp> struct is_trivial : public integral_constant<bool, __is_trivial(_Tp)> { }; template<typename _Tp> struct is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> { }; template<typename _Tp> struct is_pod : public integral_constant<bool, __is_pod(_Tp)> { }; template<typename _Tp> struct is_literal_type : public integral_constant<bool, __is_literal_type(_Tp)> { }; template<typename _Tp> struct is_empty : public integral_constant<bool, __is_empty(_Tp)> { }; template<typename _Tp> struct is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> { }; template<typename _Tp> struct is_abstract : public integral_constant<bool, __is_abstract(_Tp)> { }; template<typename _Tp, bool = is_integral<_Tp>::value, bool = is_floating_point<_Tp>::value> struct __is_signed_helper : public false_type { }; template<typename _Tp> struct __is_signed_helper<_Tp, false, true> : public true_type { }; template<typename _Tp> struct __is_signed_helper<_Tp, true, false> : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))> { }; template<typename _Tp> struct is_signed : public integral_constant<bool, __is_signed_helper<_Tp>::value> { }; template<typename _Tp> struct is_unsigned : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type { }; template<typename> struct add_rvalue_reference; template<typename _Tp> typename add_rvalue_reference<_Tp>::type declval() noexcept; 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>>>::type { }; struct __do_is_destructible_impl_1 { template<typename _Up> struct __w { _Up __u; }; template<typename _Tp, typename = decltype(declval<__w<_Tp>&>().~__w<_Tp>())> static true_type __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_destructible_impl_1 : public __do_is_destructible_impl_1 { typedef decltype(__test<_Tp>(0)) type; }; struct __do_is_destructible_impl_2 { 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_2 : public __do_is_destructible_impl_2 { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp, bool = __or_<is_void<_Tp>, __is_array_unknown_bounds<_Tp>>::value, bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value> struct __is_destructible_safe; template<typename _Tp> struct __is_destructible_safe<_Tp, false, false> : public conditional<is_abstract<_Tp>::value, __is_destructible_impl_2<_Tp>, __is_destructible_impl_1<_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 { }; template<typename _Tp> struct is_destructible : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)> { }; struct __do_is_default_constructible_impl { template<typename _Tp, typename = decltype(_Tp())> static true_type __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_default_constructible_impl : public __do_is_default_constructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp> struct __is_default_constructible_atom : public __and_<__not_<is_void<_Tp>>, __is_default_constructible_impl<_Tp>>::type { }; template<typename _Tp, bool = is_array<_Tp>::value> struct __is_default_constructible_safe; template<typename _Tp> struct __is_default_constructible_safe<_Tp, true> : public __and_<__is_array_known_bounds<_Tp>, __is_default_constructible_atom<typename remove_all_extents<_Tp>::type>>::type { }; template<typename _Tp> struct __is_default_constructible_safe<_Tp, false> : public __is_default_constructible_atom<_Tp>::type { }; template<typename _Tp> struct is_default_constructible : public integral_constant<bool, (__is_default_constructible_safe< _Tp>::value)> { }; struct __do_is_static_castable_impl { template<typename _From, typename _To, typename = decltype(static_cast<_To>(declval<_From>()))> static true_type __test(int); template<typename, typename> static false_type __test(...); }; template<typename _From, typename _To> struct __is_static_castable_impl : public __do_is_static_castable_impl { typedef decltype(__test<_From, _To>(0)) type; }; template<typename _From, typename _To> struct __is_static_castable_safe : public __is_static_castable_impl<_From, _To>::type { }; template<typename _From, typename _To> struct __is_static_castable : public integral_constant<bool, (__is_static_castable_safe< _From, _To>::value)> { }; struct __do_is_direct_constructible_impl { template<typename _Tp, typename _Arg, typename = decltype(::new _Tp(declval<_Arg>()))> static true_type __test(int); template<typename, typename> static false_type __test(...); }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_impl : public __do_is_direct_constructible_impl { typedef decltype(__test<_Tp, _Arg>(0)) type; }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_new_safe : public __and_<is_destructible<_Tp>, __is_direct_constructible_impl<_Tp, _Arg>>::type { }; template<typename, typename> struct is_same; template<typename, typename> struct is_base_of; template<typename> struct remove_reference; template<typename _From, typename _To, bool = is_reference<_From>::value> struct __is_base_to_derived_ref; template<typename _From, typename _To> struct __is_base_to_derived_ref<_From, _To, true> { typedef typename remove_cv<typename remove_reference<_From ::type>::type __src_t; typedef typename remove_cv<typename remove_reference<_To ::type>::type __dst_t; typedef __and_<__not_<is_same<__src_t, __dst_t>>, is_base_of<__src_t, __dst_t>> type; static constexpr bool value = type::value; }; template<typename _From, typename _To> struct __is_base_to_derived_ref<_From, _To, false> : public false_type { }; template<typename _From, typename _To, bool = __and_<is_lvalue_reference<_From>, is_rvalue_reference<_To>>::value> struct __is_lvalue_to_rvalue_ref; template<typename _From, typename _To> struct __is_lvalue_to_rvalue_ref<_From, _To, true> { typedef typename remove_cv<typename remove_reference< _From>::type>::type __src_t; typedef typename remove_cv<typename remove_reference< _To>::type>::type __dst_t; typedef __or_<is_same<__src_t, __dst_t>, is_base_of<__dst_t, __src_t>> type; static constexpr bool value = type::value; }; template<typename _From, typename _To> struct __is_lvalue_to_rvalue_ref<_From, _To, false> : public false_type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_ref_cast : public __and_<__is_static_castable<_Arg, _Tp>, __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>, __is_lvalue_to_rvalue_ref<_Arg, _Tp> ::type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_new : public conditional<is_reference<_Tp>::value, __is_direct_constructible_ref_cast<_Tp, _Arg>, __is_direct_constructible_new_safe<_Tp, _Arg> ::type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible : public integral_constant<bool, (__is_direct_constructible_new< _Tp, _Arg>::value)> { }; struct __do_is_nary_constructible_impl { template<typename _Tp, typename... _Args, typename = decltype(_Tp(declval<_Args>()...))> static true_type __test(int); template<typename, typename...> static false_type __test(...); }; template<typename _Tp, typename... _Args> struct __is_nary_constructible_impl : public __do_is_nary_constructible_impl { typedef decltype(__test<_Tp, _Args...>(0)) type; }; template<typename _Tp, typename... _Args> struct __is_nary_constructible : public __is_nary_constructible_impl<_Tp, _Args...>::type { static_assert(sizeof...(_Args) > 1, "Only useful for > 1 arguments"); }; template<typename _Tp, typename... _Args> struct __is_constructible_impl : public __is_nary_constructible<_Tp, _Args...> { }; template<typename _Tp, typename _Arg> struct __is_constructible_impl<_Tp, _Arg> : public __is_direct_constructible<_Tp, _Arg> { }; template<typename _Tp> struct __is_constructible_impl<_Tp> : public is_default_constructible<_Tp> { }; template<typename _Tp, typename... _Args> struct is_constructible : public integral_constant<bool, (__is_constructible_impl<_Tp, _Args...>::value)> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_copy_constructible_impl; template<typename _Tp> struct __is_copy_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_copy_constructible_impl<_Tp, false> : public is_constructible<_Tp, const _Tp&> { }; template<typename _Tp> struct is_copy_constructible : public __is_copy_constructible_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_move_constructible_impl; template<typename _Tp> struct __is_move_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_move_constructible_impl<_Tp, false> : public is_constructible<_Tp, _Tp&&> { }; template<typename _Tp> struct is_move_constructible : public __is_move_constructible_impl<_Tp> { }; template<typename _Tp> struct __is_nt_default_constructible_atom : public integral_constant<bool, noexcept(_Tp())> { }; template<typename _Tp, bool = is_array<_Tp>::value> struct __is_nt_default_constructible_impl; template<typename _Tp> struct __is_nt_default_constructible_impl<_Tp, true> : public __and_<__is_array_known_bounds<_Tp>, __is_nt_default_constructible_atom<typename remove_all_extents<_Tp>::type>>::type { }; template<typename _Tp> struct __is_nt_default_constructible_impl<_Tp, false> : public __is_nt_default_constructible_atom<_Tp> { }; template<typename _Tp> struct is_nothrow_default_constructible : public __and_<is_default_constructible<_Tp>, __is_nt_default_constructible_impl<_Tp>>::type { }; template<typename _Tp, typename... _Args> struct __is_nt_constructible_impl : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> { }; template<typename _Tp, typename _Arg> struct __is_nt_constructible_impl<_Tp, _Arg> : public integral_constant<bool, noexcept(static_cast<_Tp>(declval<_Arg>()))> { }; template<typename _Tp> struct __is_nt_constructible_impl<_Tp> : public is_nothrow_default_constructible<_Tp> { }; template<typename _Tp, typename... _Args> struct is_nothrow_constructible : public __and_<is_constructible<_Tp, _Args...>, __is_nt_constructible_impl<_Tp, _Args...>>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nothrow_copy_constructible_impl; template<typename _Tp> struct __is_nothrow_copy_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nothrow_copy_constructible_impl<_Tp, false> : public is_nothrow_constructible<_Tp, const _Tp&> { }; template<typename _Tp> struct is_nothrow_copy_constructible : public __is_nothrow_copy_constructible_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nothrow_move_constructible_impl; template<typename _Tp> struct __is_nothrow_move_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nothrow_move_constructible_impl<_Tp, false> : public is_nothrow_constructible<_Tp, _Tp&&> { }; template<typename _Tp> struct is_nothrow_move_constructible : public __is_nothrow_move_constructible_impl<_Tp> { }; template<typename _Tp, typename _Up> class __is_assignable_helper : public __sfinae_types { template<typename _Tp1, typename _Up1> static decltype(declval<_Tp1>() = declval<_Up1>(), __one()) __test(int); template<typename, typename> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1; }; template<typename _Tp, typename _Up> struct is_assignable : public integral_constant<bool, __is_assignable_helper<_Tp, _Up>::value> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_copy_assignable_impl; template<typename _Tp> struct __is_copy_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_copy_assignable_impl<_Tp, false> : public is_assignable<_Tp&, const _Tp&> { }; template<typename _Tp> struct is_copy_assignable : public __is_copy_assignable_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_move_assignable_impl; template<typename _Tp> struct __is_move_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_move_assignable_impl<_Tp, false> : public is_assignable<_Tp&, _Tp&&> { }; 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>())> { }; template<typename _Tp, typename _Up> struct is_nothrow_assignable : public __and_<is_assignable<_Tp, _Up>, __is_nt_assignable_impl<_Tp, _Up>>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nt_copy_assignable_impl; template<typename _Tp> struct __is_nt_copy_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nt_copy_assignable_impl<_Tp, false> : public is_nothrow_assignable<_Tp&, const _Tp&> { }; template<typename _Tp> struct is_nothrow_copy_assignable : public __is_nt_copy_assignable_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nt_move_assignable_impl; template<typename _Tp> struct __is_nt_move_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nt_move_assignable_impl<_Tp, false> : public is_nothrow_assignable<_Tp&, _Tp&&> { }; template<typename _Tp> struct is_nothrow_move_assignable : public __is_nt_move_assignable_impl<_Tp> { }; template<typename _Tp> struct has_trivial_default_constructor : public integral_constant<bool, __has_trivial_constructor(_Tp)> { }; template<typename _Tp> struct has_trivial_copy_constructor : public integral_constant<bool, __has_trivial_copy(_Tp)> { }; template<typename _Tp> struct has_trivial_copy_assign : public integral_constant<bool, __has_trivial_assign(_Tp)> { }; template<typename _Tp> struct has_trivial_destructor : public integral_constant<bool, __has_trivial_destructor(_Tp)> { }; template<typename _Tp> struct has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> { }; template<typename _Tp> struct alignment_of : public integral_constant<std::size_t, __alignof__(_Tp)> { }; 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> { }; 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> { }; template<typename, typename> struct is_same : public false_type { }; template<typename _Tp> struct is_same<_Tp, _Tp> : public true_type { }; 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 { static constexpr bool value = is_void<_To>::value; }; template<typename _From, typename _To> class __is_convertible_helper<_From, _To, false> : public __sfinae_types { template<typename _To1> static void __test_aux(_To1); template<typename _From1, typename _To1> static decltype(__test_aux<_To1>(std::declval<_From1>()), __one()) __test(int); template<typename, typename> static __two __test(...); public: static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1; }; template<typename _From, typename _To> struct is_convertible : public integral_constant<bool, __is_convertible_helper<_From, _To>::value> { }; template<typename _From, typename _To> struct is_explicitly_convertible : public is_constructible<_To, _From> { }; template<typename _Tp> struct remove_const { typedef _Tp type; }; template<typename _Tp> struct remove_const<_Tp const> { typedef _Tp type; }; template<typename _Tp> struct remove_volatile { typedef _Tp type; }; template<typename _Tp> struct remove_volatile<_Tp volatile> { typedef _Tp type; }; template<typename _Tp> struct remove_cv { typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type; }; template<typename _Tp> struct add_const { typedef _Tp const type; }; template<typename _Tp> struct add_volatile { typedef _Tp volatile type; }; template<typename _Tp> struct add_cv { typedef typename add_const<typename add_volatile<_Tp>::type>::type type; }; 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 = __and_<__not_<is_reference<_Tp>>, __not_<is_void<_Tp>>>::value, bool = is_rvalue_reference<_Tp>::value> struct __add_lvalue_reference_helper { typedef _Tp type; }; template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, true, false> { typedef _Tp& type; }; template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, false, true> { typedef typename remove_reference<_Tp>::type& type; }; template<typename _Tp> struct add_lvalue_reference : public __add_lvalue_reference_helper<_Tp> { }; template<typename _Tp, bool = __and_<__not_<is_reference<_Tp>>, __not_<is_void<_Tp>>>::value> struct __add_rvalue_reference_helper { typedef _Tp type; }; template<typename _Tp> struct __add_rvalue_reference_helper<_Tp, true> { typedef _Tp&& type; }; template<typename _Tp> struct add_rvalue_reference : public __add_rvalue_reference_helper<_Tp> { }; 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; }; 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; }; 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> { 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); typedef conditional<__b2, unsigned int, unsigned long> __cond2; typedef typename __cond2::type __cond2_type; typedef conditional<__b1, unsigned short, __cond2_type> __cond1; typedef typename __cond1::type __cond1_type; public: typedef typename conditional<__b0, __smallest, __cond1_type>::type __type; }; template<typename _Tp> struct make_unsigned { typedef typename __make_unsigned_selector<_Tp>::__type type; }; template<> struct make_unsigned<bool>; 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; }; 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 signed char __smallest; static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest); static const bool __b1 = sizeof(_Tp) <= sizeof(signed short); static const bool __b2 = sizeof(_Tp) <= sizeof(signed int); typedef conditional<__b2, signed int, signed long> __cond2; typedef typename __cond2::type __cond2_type; typedef conditional<__b1, signed short, __cond2_type> __cond1; typedef typename __cond1::type __cond1_type; public: typedef typename conditional<__b0, __smallest, __cond1_type>::type __type; }; template<typename _Tp> struct make_signed { typedef typename __make_signed_selector<_Tp>::__type type; }; template<> struct make_signed<bool>; 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; }; 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; }; 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; }; template<typename _Tp> struct remove_pointer : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> { }; template<typename _Tp> struct add_pointer { typedef typename remove_reference<_Tp>::type* type; }; template<std::size_t _Len> struct __aligned_storage_msa { union __type { unsigned char __data[_Len]; struct __attribute__((__aligned__)) { } __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 _Up, bool _IsArray = is_array<_Up>::value, bool _IsFunction = is_function<_Up>::value> struct __decay_selector; 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; }; 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; 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 _Tp> struct __decay_and_strip { typedef typename __strip_reference_wrapper< typename decay<_Tp>::type>::__type __type; }; template<bool, typename _Tp = void> struct enable_if { }; template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; template<bool _Cond, typename _Iftrue, typename _Iffalse> struct conditional { typedef _Iftrue type; }; template<typename _Iftrue, typename _Iffalse> struct conditional<false, _Iftrue, _Iffalse> { typedef _Iffalse type; }; template<typename... _Tp> struct common_type; template<typename _Tp> struct common_type<_Tp> { typedef _Tp type; }; template<typename _Tp, typename _Up> struct common_type<_Tp, _Up> { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; }; template<typename _Tp, typename _Up, typename... _Vp> struct common_type<_Tp, _Up, _Vp...> { typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; }; template<typename _Tp> struct underlying_type { typedef __underlying_type(_Tp) type; }; template<typename _Tp> struct __declval_protector { static const bool __stop = false; static typename add_rvalue_reference<_Tp>::type __delegate(); }; template<typename _Tp> inline typename add_rvalue_reference<_Tp>::type declval() noexcept { static_assert(__declval_protector<_Tp>::__stop, "declval() must not be used!"); return __declval_protector<_Tp>::__delegate(); } template<typename _Signature> class result_of; template<typename _MemPtr, typename _Arg> struct _Result_of_memobj; template<typename _Res, typename _Class, typename _Arg> struct _Result_of_memobj<_Res _Class::*, _Arg> { private: typedef _Res _Class::* _Func; template<typename _Tp> static _Tp _S_get(const _Class&); template<typename _Tp> static decltype(*std::declval<_Tp>()) _S_get(...); public: typedef decltype(_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>()) __type; }; template<typename _MemPtr, typename _Arg, typename... _ArgTypes> struct _Result_of_memfun; template<typename _Res, typename _Class, typename _Arg, typename... _Args> struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...> { private: typedef _Res _Class::* _Func; template<typename _Tp> static _Tp _S_get(const _Class&); template<typename _Tp> static decltype(*std::declval<_Tp>()) _S_get(...); public: typedef decltype((_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>()) (std::declval<_Args>()...) ) __type; }; template<bool, bool, typename _Functor, typename... _ArgTypes> struct _Result_of_impl; template<typename _Functor, typename... _ArgTypes> struct _Result_of_impl<false, false, _Functor, _ArgTypes...> { typedef decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) ) __type; }; template<typename _MemPtr, typename _Arg> struct _Result_of_impl<true, false, _MemPtr, _Arg> : _Result_of_memobj<typename remove_reference<_MemPtr>::type, _Arg> { typedef typename _Result_of_memobj< typename remove_reference<_MemPtr>::type, _Arg>::__type __type; }; template<typename _MemPtr, typename _Arg, typename... _ArgTypes> struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...> : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...> { typedef typename _Result_of_memfun< typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type __type; }; template<typename _Functor, typename... _ArgTypes> struct result_of<_Functor(_ArgTypes...)> : _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...> { typedef typename _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 type; }; } namespace std { namespace chrono { 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 _ToDur, typename _Rep, typename _Period> constexpr typename enable_if<__is_duration<_ToDur>::value, _ToDur>::type 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> __r_div; typedef typename __r_div::type __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); } template<typename _Rep> struct treat_as_floating_point : is_floating_point<_Rep> { }; template<typename _Rep> struct duration_values { static constexpr _Rep zero() { return _Rep(0); } static constexpr _Rep max() { return numeric_limits<_Rep>::max(); } static constexpr _Rep min() { return numeric_limits<_Rep>::lowest(); } }; template<typename T> struct __is_ratio : std::false_type { }; template<intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den>> : std::true_type { }; template<typename _Rep, typename _Period> struct duration { 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"); constexpr duration() : __r() { } constexpr duration(const duration&) = default; template<typename _Rep2, typename = typename enable_if<is_convertible<_Rep2, rep>::value && (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value)>::type> constexpr explicit duration(const _Rep2& __rep) : __r(static_cast<rep>(__rep)) { } template<typename _Rep2, typename _Period2, typename = typename enable_if<treat_as_floating_point<rep>::value || (ratio_divide<_Period2, period>::type::den == 1 && !treat_as_floating_point<_Rep2>::value)>::type> constexpr duration(const duration<_Rep2, _Period2>& __d) : __r(duration_cast<duration>(__d).count()) { } ~duration() = default; duration& operator=(const duration&) = default; constexpr rep count() const { return __r; } constexpr duration operator+() const { return *this; } constexpr duration operator-() const { return duration(-__r); } duration& operator++() { ++__r; return *this; } duration operator++(int) { return duration(__r++); } duration& operator--() { --__r; return *this; } duration operator--(int) { return duration(__r--); } duration& operator+=(const duration& __d) { __r += __d.count(); return *this; } duration& operator-=(const duration& __d) { __r -= __d.count(); return *this; } duration& operator*=(const rep& __rhs) { __r *= __rhs; return *this; } duration& operator/=(const rep& __rhs) { __r /= __rhs; return *this; } template<typename _Rep2 = rep> typename enable_if<!treat_as_floating_point<_Rep2>::value, duration&>::type operator%=(const rep& __rhs) { __r %= __rhs; return *this; } template<typename _Rep2 = rep> typename enable_if<!treat_as_floating_point<_Rep2>::value, duration&>::type operator%=(const duration& __d) { __r %= __d.count(); return *this; } static constexpr duration zero() { return duration(duration_values<rep>::zero()); } static constexpr duration min() { return duration(duration_values<rep>::min()); } static constexpr duration max() { 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()); } template<typename _Rep1, typename _Rep2, bool = is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value> struct __common_rep_type { }; template<typename _Rep1, typename _Rep2> struct __common_rep_type<_Rep1, _Rep2, true> { typedef typename common_type<_Rep1, _Rep2>::type type; }; template<typename _Rep1, typename _Period, typename _Rep2> constexpr duration<typename __common_rep_type<_Rep1, _Rep2>::type, _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<typename __common_rep_type<_Rep2, _Rep1>::type, _Period> operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; } template<typename _Rep1, typename _Period, typename _Rep2> constexpr duration<typename __common_rep_type<_Rep1, typename enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _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(); } template<typename _Rep1, typename _Period, typename _Rep2> constexpr duration<typename __common_rep_type<_Rep1, typename enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _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()); } 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); } typedef duration<int64_t, nano> nanoseconds; typedef duration<int64_t, micro> microseconds; typedef duration<int64_t, milli> milliseconds; typedef duration<int64_t> seconds; typedef duration<int, ratio< 60>> minutes; typedef duration<int, ratio<3600>> hours; 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) { } template<typename _Dur2> constexpr time_point(const time_point<clock, _Dur2>& __t) : __d(__t.time_since_epoch()) { } constexpr duration time_since_epoch() const { return __d; } time_point& operator+=(const duration& __dur) { __d += __dur; return *this; } time_point& operator-=(const duration& __dur) { __d -= __dur; return *this; } static constexpr time_point min() { return time_point(duration::min()); } static constexpr time_point max() { return time_point(duration::max()); } private: duration __d; }; 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())); } 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); } struct system_clock { typedef chrono::microseconds 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() throw (); static std::time_t to_time_t(const time_point& __t) { return std::time_t(duration_cast<chrono::seconds> (__t.time_since_epoch()).count()); } static time_point from_time_t(std::time_t __t) { typedef chrono::time_point<system_clock, seconds> __from; return time_point_cast<system_clock::duration> (__from(chrono::seconds(__t))); } }; typedef system_clock steady_clock; typedef system_clock high_resolution_clock; } } #pragma GCC visibility pop namespace std { template<typename _Predicate> inline unary_negate<_Predicate> not1(const _Predicate& __pred) { return unary_negate<_Predicate>(__pred); } template<typename _Predicate> class binary_negate : public binary_function<typename _Predicate::first_argument_type, typename _Predicate::second_argument_type, bool> { protected: _Predicate _M_pred; public: explicit binary_negate(const _Predicate& __x) : _M_pred(__x) { } bool operator()(const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const { return !_M_pred(__x, __y); } }; template<typename _Predicate> inline binary_negate<_Predicate> not2(const _Predicate& __pred) { return binary_negate<_Predicate>(__pred); } template<typename _Arg, typename _Result> inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg)) { return pointer_to_unary_function<_Arg, _Result>(__x); } template<typename _Arg1, typename _Arg2, typename _Result> inline pointer_to_binary_function<_Arg1, _Arg2, _Result> ptr_fun(_Result (*__x)(_Arg1, _Arg2)) { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } template<typename _Tp> struct _Identity : public unary_function<_Tp,_Tp> { _Tp& operator()(_Tp& __x) const { return __x; } const _Tp& operator()(const _Tp& __x) const { return __x; } }; template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { typename _Pair::first_type& operator()(_Pair& __x) const { return __x.first; } const typename _Pair::first_type& operator()(const _Pair& __x) const { return __x.first; } template<typename _Pair2> typename _Pair2::first_type& operator()(_Pair2& __x) const { return __x.first; } template<typename _Pair2> const typename _Pair2::first_type& operator()(const _Pair2& __x) const { return __x.first; } }; template<typename _Pair> struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { typename _Pair::second_type& operator()(_Pair& __x) const { return __x.second; } const typename _Pair::second_type& operator()(const _Pair& __x) const { return __x.second; } }; template<typename _Ret, typename _Tp> class mem_fun_t : public unary_function<_Tp*, _Ret> { public: explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; template<typename _Ret, typename _Tp> class const_mem_fun_t : public unary_function<const _Tp*, _Ret> { public: explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; template<typename _Ret, typename _Tp> class mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; template<typename _Ret, typename _Tp> class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> { public: explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret> { public: explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; template<typename _Ret, typename _Tp> inline mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)()) { return mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)() const) { return const_mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)()) { return mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } } namespace std { 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); } typename _Operation::result_type operator()(typename _Operation::second_argument_type& __x) const { return op(value, __x); } } __attribute__ ((__deprecated__)); 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)); } 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); } typename _Operation::result_type operator()(typename _Operation::first_argument_type& __x) const { return op(__x, value); } } __attribute__ ((__deprecated__)); 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)); } } namespace std { size_t _Hash_bytes(const void* __ptr, size_t __len, size_t __seed); size_t _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed); } #pragma GCC visibility push(default) extern "C++" { namespace __cxxabiv1 { class __class_type_info; } namespace std { class type_info { public: virtual ~type_info(); const char* name() const { return __name[0] == '*' ? __name + 1 : __name; } bool before(const type_info& __arg) const; bool operator==(const type_info& __arg) const; bool operator!=(const type_info& __arg) const { return !operator==(__arg); } size_t hash_code() const throw() { return _Hash_bytes(name(), __builtin_strlen(name()), static_cast<size_t>(0xc70f6907UL)); } virtual bool __is_pointer_p() const; virtual bool __is_function_p() const; virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, unsigned __outer) const; 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: type_info& operator=(const type_info&); type_info(const type_info&); }; class bad_cast : public exception { public: bad_cast() throw() { } virtual ~bad_cast() throw(); virtual const char* what() const throw(); }; class bad_typeid : public exception { public: bad_typeid () throw() { } virtual ~bad_typeid() throw(); virtual const char* what() const throw(); }; } #pragma GCC visibility pop } #pragma GCC visibility push(default) extern "C++" { namespace std { class bad_alloc : public exception { public: bad_alloc() throw() { } virtual ~bad_alloc() throw(); virtual const char* what() const throw(); }; struct nothrow_t { }; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler(new_handler) throw(); } void* operator new(std::size_t) __attribute__((__externally_visible__)); void* operator new[](std::size_t) __attribute__((__externally_visible__)); void operator delete(void*) noexcept __attribute__((__externally_visible__)); void operator delete[](void*) noexcept __attribute__((__externally_visible__)); void* operator new(std::size_t, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); void* operator new[](std::size_t, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); void operator delete(void*, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); inline void* operator new(std::size_t, void* __p) noexcept { return __p; } inline void* operator new[](std::size_t, void* __p) noexcept { return __p; } inline void operator delete (void*, void*) noexcept { } inline void operator delete[](void*, void*) noexcept { } } #define _BASIC_STRING_H 1 #define _GLIBCXX_ATOMICITY_H 1 #define _GLIBCXX_GCC_GTHR_H #pragma GCC visibility push(default) #define _GLIBCXX_GCC_GTHR_AIX_H #define _GLIBCXX_GCC_GTHR_POSIX_H #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 #define _PTHREAD_H_ extern "C" { #undef _STD_TYPES_T #define _H_SCHED #define _H_SYS_SCHED #define _H_PRI #define _H_PROC extern "C" { #define _H_PTRACE #define _H_THREAD #define _H_MSTSAVE #define _H_M_PARAM #define _NSRS 16 #define _NGPRS 32 #define _NFPRS 32 #define _LOADWCS(__x) (* (volatile tid_t *) (__x)) #define _STORWCS(__x,__y) (*(__y) = (__x)) #define _HZ 100 #define __hz HZ #define _CLKTICK 20408 #define _MAXSEG (64*1024) #define _MAXTSIZ (256*256*4096) #define _DFLDSIZ (128*256*4096) #define _MAXDSIZ (256*256*4096) #define _DFLSSIZ ( 16*256*4096) #define _MAXSSIZ (256*256*4096) #define NSRS _NSRS #define NGPRS _NGPRS #define NFPRS _NFPRS #define LOADWCS _LOADWCS #define STORWCS _STORWCS #define HZ _HZ #define hz __hz #define CLKTICK _CLKTICK #define MAXSEG _MAXSEG #define MAXTSIZ _MAXTSIZ #define DFLDSIZ _DFLDSIZ #define MAXDSIZ _MAXDSIZ #define DFLSSIZ _DFLSSIZ #define MAXSSIZ _MAXSSIZ struct mstsave { struct mstsave *prev; label_t *kjmpbuf; char *stackfix; char intpri; char backt; char rsvd[2]; pid_t curid; int excp_type; ulong_t iar; ulong_t msr; ulong_t cr; ulong_t lr; ulong_t ctr; ulong_t xer; ulong_t mq; ulong_t tid; ulong_t fpscr; char fpeu; char fpinfo; uchar fpscr24_31; char pad[1]; ulong_t except[5]; char pad1[4]; ulong_t o_iar; ulong_t o_toc; ulong_t o_arg1; ulong_t excbranch; ulong_t fpscrx; ulong_t o_vaddr; ulong_t cachealign[7]; adspace_t as; ulong_t gpr[32]; double fpr[32]; }; #define _FP_NEVER_USED 0 #define _FP_USED 1 #define _FP_IMP_INT 0x01 #define _FP_SYNC_TASK 0x08 #define _PPC_OFF 0x0 #define _PPC_IMP 0x1 #define _PPC_IMP_REC 0x8 #define _PPC_PRECISE 0x9 #define _FP_INT_TYPE 0x02 #define _FP_SYNC_IMP_S 8 #define _FRAMESIZE 7168 #define _FRAME_OVBUF_SIZE 1024 #define _FRAME_OVBUF_CHAR 0x11 #define _FRAME_OVBUF_ULL 0x1111111111111111ULL #define _PMAP_STK_SIZE (3072*2) #define _PMAP_OVBUF_SIZE 768 #define _PMAP_OVBUF_CHAR 0x11 #define _PMAP_OVBUF_ULL 0x1111111111111111ULL #define _SLB_SAVE_SIZE (12*3) extern char __pmap_stack[]; #define _NUMBER_OF_FRAMES 11 #define _FRAME_1(__cpu_id) ((_NUMBER_OF_FRAMES*(__cpu_id+1)) - 1) #define FP_NEVER_USED _FP_NEVER_USED #define FP_USED _FP_USED #define FP_IMP_INT _FP_IMP_INT #define FP_SYNC_TASK _FP_SYNC_TASK #define PPC_OFF _PPC_OFF #define PPC_IMP _PPC_IMP #define PPC_IMP_REC _PPC_IMP_REC #define PPC_PRECISE _PPC_PRECISE #define FP_INT_TYPE _FP_INT_TYPE #define FP_SYNC_IMP_S _FP_SYNC_IMP_S #define FRAMESIZE _FRAMESIZE #define FRAME_OVBUF_SIZE _FRAME_OVBUF_SIZE #define FRAME_OVBUF_CHAR _FRAME_OVBUF_CHAR #define FRAME_OVBUF_ULL _FRAME_OVBUF_ULL #define NUMBER_OF_FRAMES _NUMBER_OF_FRAMES #define FRAME_1 _FRAME_1 #define PMAP_STK_SIZE _PMAP_STK_SIZE #define PMAP_OVBUF_SIZE _PMAP_OVBUF_SIZE #define PMAP_OVBUF_CHAR _PMAP_OVBUF_CHAR #define PMAP_OVBUF_ULL _PMAP_OVBUF_ULL #define SLB_SAVE_SIZE _SLB_SAVE_SIZE #define pmap_stack __pmap_stack #define _H_PROCESSOR typedef short cpu_t; typedef short cpuidx_t; typedef short sradid_t; typedef short processor_t; extern int bindprocessor(int What, int Who, cpu_t Where); #define BINDPROCESS 1 #define BINDTHREAD 2 #define PROCESSOR_CLASS_ANY ((cpu_t)(-1)) extern cpu_t mycpu(void); #define _H_LOCK_DEFINE typedef int32long64_t simple_lock_data; typedef int32long64_t complex_lock_status; struct complex_lock_data { complex_lock_status status; short flags; short recursion_depth; }; struct lock_data_instrumented { union { simple_lock_data s_lock; struct complex_lock_data c_lock; struct lock_data_instrumented *lock_next; } lock_control_word; #define SELECTIVE_TRACE 1 #define LOCK_ALLOCATED 2 unsigned int li_flags; union { int name; struct { short _id; short occurrence; } _lock_id; } _lockname; int reserved[4]; }; union _simple_lock{ simple_lock_data _slock; struct lock_data_instrumented *_slockp; }; union _complex_lock{ struct complex_lock_data _clock; struct lock_data_instrumented *_clockp; }; typedef union _simple_lock Simple_lock; typedef union _complex_lock Complex_lock; typedef Simple_lock *simple_lock_t; typedef Complex_lock *complex_lock_t; typedef int32long64_t lock_t; #define SIMPLE_LOCK_AVAIL ((simple_lock_data)0) #define COMPLEX_LOCK_AVAIL SIMPLE_LOCK_AVAIL #define LOCK_AVAIL ((lock_t) -1) #define LOCKL_OWNER_MASK 0x3fffffff #define IS_LOCKED(x) ((*(x) != LOCK_AVAIL) && ((tid_t)(*(x) & LOCKL_OWNER_MASK) == thread_self())) #define LOCK_SHORT (0) #define LOCK_NDELAY (1) #define LOCK_SIGWAKE (2) #define LOCK_SIGRET (4) #define LOCK_SUCC (0) #define LOCK_NEST (1) #define LOCK_FAIL (-1) #define LOCK_SIG (-2) void simple_lock(simple_lock_t); void simple_lock_hot(simple_lock_t); void simple_unlock(simple_lock_t); void simple_unlock_mem(simple_lock_t); void simple_unlock_hot(simple_lock_t); boolean_t simple_lock_try(simple_lock_t); int disable_lock(int,simple_lock_t); void unlock_enable(int,simple_lock_t); void unlock_enable_mem(int,simple_lock_t); void lock_init(complex_lock_t , boolean_t); void lock_write(complex_lock_t); void lock_read(complex_lock_t); void lock_done(complex_lock_t); void lock_done_mem(complex_lock_t); boolean_t lock_read_to_write(complex_lock_t); void lock_write_to_read(complex_lock_t); boolean_t lock_try_write(complex_lock_t); boolean_t lock_try_read(complex_lock_t); boolean_t lock_try_read_to_write(complex_lock_t); void lock_set_recursive(complex_lock_t); void lock_clear_recursive(complex_lock_t); int lock_islocked(complex_lock_t); int lockl(lock_t *,int); void unlockl(lock_t *); boolean_t lockl_mine(lock_t *); void simple_lock_init(simple_lock_t); #define _H_VAR struct var_hdr { __ulong32_t var_vers; __ulong32_t var_gen; __ulong32_t var_size; }; struct var { struct var_hdr var_hdr; int v_bufhw; int v_mbufhw; int v_maxup; int v_iostrun; int v_leastpriv; int v_autost; int v_maxpout; int v_minpout; int v_memscrub; int v_lock; __cptr32 ve_lock; int v_file; __cptr32 ve_file; int v_proc; __cptr32 ve_proc; int v_clist; int v_thread; __cptr32 ve_thread; __cptr32 vb_proc; __cptr32 vb_thread; int v_ncpus; int v_ncpus_cfg; int v_fullcore; char v_initlvl[4]; char v_pre430core; int v_xmgc; int v_cpuguard; int v_ncargs; int v_pre520tune; long long v_hardstack; int v_xmdbg_segs; int v_max_logname; int v_num_xmfrecs; long long v_sed_config; long long v_acl_config; }; struct kernvars { struct var_hdr var_hdr; long long v_bufhw; long long v_mbufhw; long long v_maxup; long long v_maxpout; long long v_minpout; int v_iostrun; int v_leastpriv; int v_autost; int v_memscrub; long long v_lock; __cptr64 ve_lock; long long v_file; __cptr64 ve_file; long long v_proc; __cptr64 ve_proc; long long v_clist; long long v_thread; __cptr64 ve_thread; __cptr64 vb_proc; __cptr64 vb_thread; int v_ncpus; int v_ncpus_cfg; int v_fullcore; char v_initlvl[4]; int v_coreformat; int v_xmgc; int v_cpuguard; int v_ncargs; int v_pre520tune; long long v_hardstack; int v_xmdbg_segs; int v_max_logname; int v_num_xmfrecs; long long v_sed_config; long long v_acl_config; }; #define SYSCONFIG_VARSIZE ((int)&((struct var *)0)->v_lock) #define MIN_XMFRECS 4096 struct vario { union v { struct { long long value; } v_bufhw; struct { long long value; } v_mbufhw; struct { long long value; } v_maxup; struct { long long value; } v_maxpout; struct { long long value; } v_minpout; struct { int fill; int value; } v_iostrun; struct { int fill; int value; } v_leastpriv; struct { int fill; int value; } v_autost; struct { int fill; int value; } v_memscrub; struct { long long value; } v_lock; struct { __cptr64 value; } ve_lock; struct { long long value; } v_file; struct { __cptr64 value; } ve_file; struct { long long value; } v_proc; struct { __cptr64 value; } ve_proc; struct { long long value; } v_clist; struct { long long value; } v_thread; struct { __cptr64 value; } ve_thread; struct { __cptr64 value; } vb_proc; struct { __cptr64 value; } vb_thread; struct { int fill; int value; } v_ncpus; struct { int fill; int value; } v_ncpus_cfg; struct { int fill; int value; } v_fullcore; struct { int fill; char value[4]; } v_initlvl; struct { int fill; char fill2[3]; char value; } v_coreformat; struct { int fill; int value; } v_xmgc; struct { int fill; int value; } v_cpuguard; struct { int fill; int value; } v_ncargs; struct { int fill; int value; } v_pre520tune; struct { int fill; int value; } v_hardstack; struct { int fill; int value; } v_xmdbg_segs; struct { int fill; int value; } v_max_logname; struct { int fill; int value; } v_num_xmfrecs; struct { long long value; } v_sed_config; struct { long long value; } v_acl_config; struct { int fill; int value; } turbo_acct; } v; }; int sys_parm(int cmd,int parmflag,void *uptr); #define SYSP_GET 0 #define SYSP_SET 1 #define SYSP_V_BUFHW 0 #define SYSP_V_MBUFHW 1 #define SYSP_V_MAXUP 2 #define SYSP_V_IOSTRUN 3 #define SYSP_V_LEASTPRIV 4 #define SYSP_V_AUTOST 5 #define SYSP_V_MAXPOUT 6 #define SYSP_V_MINPOUT 7 #define SYSP_V_MEMSCRUB 8 #define SYSP_V_FULLCORE 9 #define SYSP_V_INITLVL 10 #define SYSP_V_PRE430CORE 11 #define SYSP_V_COREFORMAT 11 #define SYSP_V_XMGC 12 #define SYSP_V_CPUGUARD 13 #define SYSP_V_NCARGS 14 #define SYSP_V_PRE520TUNE 15 #define SYSP_V_HARDSTACK 16 #define SYSP_V_XMDBG_SEGS 17 #define SYSP_V_MAX_LOGNAME 18 #define SYSP_V_NUM_XMFRECS 19 #define SYSP_V_SED_CONFIG 20 #define SYSP_V_ACL_CONFIG 21 #define SYSP_V_TURBO_ACCT 22 #define SYSP_MAX_RW SYSP_V_TURBO_ACCT #define SYSP_V_LOCK 1024 #define SYSP_VE_LOCK 1025 #define SYSP_V_FILE 1026 #define SYSP_VE_FILE 1027 #define SYSP_V_PROC 1028 #define SYSP_VE_PROC 1029 #define SYSP_V_CLIST 1030 #define SYSP_V_THREAD 1031 #define SYSP_VE_THREAD 1032 #define SYSP_VB_PROC 1033 #define SYSP_VB_THREAD 1034 #define SYSP_V_NCPUS 1035 #define SYSP_V_NCPUS_CFG 1036 #define VAR_CORE43 0 #define VAR_COREPRE43 1 #define _H_ATOMIC_OP typedef int *atomic_p; typedef ushort *atomic_h; typedef long *atomic_l; int fetch_and_add(atomic_p,int); uint fetch_and_and(atomic_p,uint); uint fetch_and_or(atomic_p,uint); boolean_t compare_and_swap(atomic_p,int *,int); long fetch_and_addlp(atomic_l,long); ulong fetch_and_andlp(atomic_l,ulong); ulong fetch_and_orlp(atomic_l,ulong); boolean_t compare_and_swaplp(atomic_l, long *, long); ushort fetch_and_add_h(atomic_h,int); boolean_t _check_lock(atomic_p, int, int); void _clear_lock(atomic_p, int); void _clear_lock_mem(atomic_p, int); int _safe_fetch(atomic_p); #pragma mc_func _clear_lock { "48003403" } #pragma mc_func _clear_lock_mem { "48003413" } #pragma mc_func _check_lock { "48003423" } #pragma mc_func _safe_fetch { "80630000" "5463003F" "41820004" } #pragma reg_killed_by _safe_fetch cr0,gr3 #define _H_CONTEXT extern "C" { #define _EXCONTINUE 0 #define _EXRETURN 1 #define _EXRESUME 2 #define _EXPGIO 0 #define _EXTRAP 1 #define _EXIO 2 #define _EXDLOK 3 #define _EXSIG 4 typedef struct { void *ss_sp; size_t ss_size; int ss_flags; int __pad[4]; } stack_t; typedef struct { unsigned long long ss_sp; unsigned long long ss_size; int ss_flags; int __pad[4]; } stack64_t; #define EXCONTINUE _EXCONTINUE #define EXRETURN _EXRETURN #define EXRESUME _EXRESUME #define EXPGIO _EXPGIO #define EXTRAP _EXTRAP #define EXIO _EXIO #define EXDLOK _EXDLOK #define EXSIG _EXSIG #define jmpbuf __jmpbuf #define context64 __context64 struct __context64 { unsigned long long gpr[32]; unsigned long long msr; unsigned long long iar; unsigned long long lr; unsigned long long ctr; unsigned int cr; unsigned int xer; unsigned int fpscr; unsigned int fpscrx; unsigned long long except[1]; double fpr[32]; char fpeu; char fpinfo; char fpscr24_31; char pad[1]; int excp_type; }; struct sigcontext64 { int sc_onstack; sigset64_t sc_mask; int sc_uerror; struct __context64 sc_context; }; #define OFF_FPSCR ((uint) &((struct sigcontext64 *)0)->sc_context.fpscr) #define OFF_FPSCRX ((uint) &((struct sigcontext64 *)0)->sc_context.fpscrx) #define OFF_FPR ((uint) &((struct sigcontext64 *)0)->sc_context.fpr[0]) #define OFF_FPINFO ((uint) &((struct sigcontext64 *)0)->sc_context.fpinfo) #define OFF_CONT64 ((uint) &((struct sigcontext64 *)0)->sc_context) #define OFF_CONT ((uint) &((struct sigcontext *)0)->sc_jmpbuf) typedef struct { unsigned int __v[4]; } __vmxreg_t; typedef struct __vmx_context { __vmxreg_t __vr[32]; unsigned int __pad1[3]; unsigned int __vscr; unsigned int __vrsave; unsigned int __pad2[3]; } __vmx_context_t; #define __EXTCTX 0x2000000 #define __EXTCTX_MAGIC 0x45435458 #define __EXTCTX_VMX 0x00000001 #define __EXTCTX_UKEYS 0x00000002 #define __EXTCTX_RSV (4096 - sizeof(__vmx_context_t) - (7 * sizeof(int))) typedef struct __extctx { unsigned int __flags; unsigned int __rsvd1[3]; union { __vmx_context_t __vmx; } __u1; unsigned int __ukeys[2]; char __reserved[(4096 - sizeof(__vmx_context_t) - (7 * sizeof(int)))]; int __extctx_magic; } __extctx_t; #define __vmx __u1.__vmx struct __jmpbuf { struct mstsave jmp_context; }; struct __sigcontext { int sc_onstack; sigset_t sc_mask; int sc_uerror; struct __jmpbuf sc_jmpbuf; }; typedef struct __jmpbuf mcontext_t; typedef struct ucontext_t { int __sc_onstack; sigset_t uc_sigmask; int __sc_uerror; mcontext_t uc_mcontext; struct ucontext_t *uc_link; stack_t uc_stack; __extctx_t *__extctx; int __extctx_magic; int __pad[2]; } ucontext_t; } #define _H_SYS_TIME extern "C" { #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 #define ITIMER_VIRT 3 #define ITIMER_REAL1 20 struct timeval { time_t tv_sec; suseconds_t tv_usec; }; struct timeval32 { int32_t tv_sec; int32_t tv_usec; }; #define CP_TIMEVAL(__tsrc,__tdest) (__tdest).tv_sec = (__tsrc).tv_sec; (__tdest).tv_usec = (__tsrc).tv_usec struct timeval64 { int64_t tv_sec; int32_t tv_usec; }; struct timezone { int tz_minuteswest; int tz_dsttime; }; #define DST_NONE 0 #define DST_USA 1 #define DST_AUST 2 #define DST_WET 3 #define DST_MET 4 #define DST_EET 5 #define DST_CAN 6 struct itimerval { struct timeval it_interval; struct timeval it_value; }; extern int getitimer(int, struct itimerval *); extern int setitimer(int, const struct itimerval *, struct itimerval *); extern int gettimeofday(struct timeval *, void *); extern int settimeofday(struct timeval *, struct timezone *); extern int utimes(const char *, const struct timeval *); #define FD_SETSIZE 65534 #define __NFDBITS (sizeof(long) * 8) #define __NUM_ENTRIES (FD_SETSIZE/__NFDBITS+1) typedef struct fd_set { long fds_bits[(65534/(sizeof(long) * 8)+1)]; } fd_set; extern int pselect(int, void *, void *, void *, const struct timespec *, const sigset_t *); extern int __fd_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); static int select(int __fds, fd_set * __readlist, fd_set * __writelist, fd_set * __exceptlist, struct timeval * __timeout) { return __fd_select(__fds, __readlist, __writelist, __exceptlist, __timeout); } extern void *memset(void *, int, size_t); #define FD_SET(n,p) ((p)->fds_bits[(n)/__NFDBITS] |= ((long)1 << ((n) % __NFDBITS))) #define FD_CLR(n,p) ((p)->fds_bits[(n)/__NFDBITS] &= ~((long)1 << ((n) % __NFDBITS))) #define FD_ISSET(n,p) (((p)->fds_bits[(n)/__NFDBITS] & ((long)1 << ((n) % __NFDBITS)))?1:0) #define FD_ZERO(p) memset((p), 0, sizeof(*(p))) #define TIMEOFDAY 9 #define TIMERID_ALRM (ITIMER_REAL) #define TIMERID_REAL (ITIMER_REAL) #define TIMERID_VIRTUAL (ITIMER_VIRTUAL) #define TIMERID_PROF (ITIMER_PROF) #define TIMERID_VIRT (ITIMER_VIRT) #define TIMERID_TOD (TIMERID_VIRT+1) #define TIMERID_REAL1 (ITIMER_REAL1) #define NALRM 1 #define NPROF 1 #define NVIRTUAL 2 #define NTIMEOFDAY 5 #define NTIMERS (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY) #define NALRM_THREAD 1 #define NTIMERS_THREAD (NALRM_THREAD) #define MIN_SECS_SINCE_EPOCH 0 #define NS_PER_TICK (NS_PER_SEC/HZ) #define uS_PER_SECOND (1000000) #define NS_PER_uS (1000) #define MAX_SECS_TO_uS 4000 #define MAX_NS_TO_uS 294967296 #define NS_PER_SEC 1000000000 #define uS_PER_SEC (NS_PER_SEC / 1000) #define NS_PER_MSEC (NS_PER_SEC / 1000) #define MS_PER_SEC 1000 #define MAX_DEC_SECS 2 #define MAX_DEC_NS 147483647 struct timestruc_t { time_t tv_sec; suseconds_t tv_nsec; }; struct timestruc32_t { int32_t tv_sec; int32_t tv_nsec; }; struct timestruc64_t { int64_t tv_sec; int32_t tv_nsec; }; #define CP_TIMESTRUCT(__tsrc,__tdest) (__tdest).tv_sec = (__tsrc).tv_sec; (__tdest).tv_nsec = (__tsrc).tv_nsec struct itimerstruc_t { struct timestruc_t it_interval; struct timestruc_t it_value; }; struct itimerstruc32_t { struct timestruc32_t it_interval; struct timestruc32_t it_value; }; struct itimerstruc64_t { struct timestruc64_t it_interval; struct timestruc64_t it_value; }; #define CP_ITIMERSTRUCT(__tsrc,__tdest) (__tdest).it_interval.tv_sec = (__tsrc).it_interval.tv_sec; (__tdest).it_interval.tv_nsec = (__tsrc).it_interval.tv_nsec; (__tdest).it_value.tv_sec = (__tsrc).it_value.tv_sec; (__tdest).it_value.tv_nsec = (__tsrc).it_value.tv_nsec typedef struct timebasestruct { int flag; unsigned int tb_high; unsigned int tb_low; } timebasestruct_t; int read_real_time(timebasestruct_t *, size_t); int read_wall_time(timebasestruct_t *, size_t); int time_base_to_time(timebasestruct_t *, size_t); #define TIMEBASE_SZ (sizeof (struct timebasestruct)) #define ntimerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) #define ntimerclear(tvp) (tvp)->tv_sec = (tvp)->tv_nsec = 0 #define ntimercmp(tvp,fvp,cmp) ((tvp).tv_sec cmp (fvp).tv_sec || (tvp).tv_sec == (fvp).tv_sec && (tvp).tv_nsec cmp (fvp).tv_nsec) #define ntimeradd(tvp,svp,rvp) { (rvp).tv_sec = (tvp).tv_sec + (svp).tv_sec; (rvp).tv_nsec = (tvp).tv_nsec + (svp).tv_nsec; if((rvp).tv_nsec > (NS_PER_SEC - 1)) { (rvp).tv_nsec -= NS_PER_SEC; (rvp).tv_sec++; } assert((rvp).tv_nsec <= NS_PER_SEC); } #define ntimersub(tvp,svp,rvp) { assert((tvp).tv_nsec <= NS_PER_SEC); assert((svp).tv_nsec <= NS_PER_SEC); assert(!((tvp).tv_sec == 0 && ((svp).tv_nsec > (tvp).tv_nsec))); if((tvp).tv_sec == (svp).tv_sec) { assert((tvp).tv_nsec >= (svp).tv_nsec); } else { assert((tvp).tv_sec > (svp).tv_sec); } if((svp).tv_nsec > (tvp).tv_nsec) { assert((tvp).tv_sec > (svp).tv_sec); (rvp).tv_sec = ((tvp).tv_sec - 1) - (svp).tv_sec; (rvp).tv_nsec = ((int)(((uint)((tvp).tv_nsec) + NS_PER_SEC) - (uint)((svp).tv_nsec))); } else { (rvp).tv_sec = (tvp).tv_sec - (svp).tv_sec; (rvp).tv_nsec = (tvp).tv_nsec - (svp).tv_nsec; } assert((tvp).tv_nsec <= NS_PER_SEC); assert((svp).tv_nsec <= NS_PER_SEC); assert((rvp).tv_nsec <= NS_PER_SEC); } #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 #define timercmp(tvp,fvp,cmp) ((tvp)->tv_sec cmp (fvp)->tv_sec || (tvp)->tv_sec == (fvp)->tv_sec && (tvp)->tv_usec cmp (fvp)->tv_usec) #define ADD_TO_NS(tvp,delta) { (tvp).tv_nsec += delta; if((tvp).tv_nsec >= NS_PER_SEC) { (tvp).tv_sec++; (tvp).tv_nsec -= NS_PER_SEC; } } #define ADD_NS_TO_TIMEVAL(tvp,delta) { (tvp).tv_usec += delta; if((tvp).tv_usec >= NS_PER_SEC) { (tvp).tv_sec++; (tvp).tv_usec -= NS_PER_SEC; } } } #define _H_TIMER #define T_TIMEOUT 0xABABABAB #define T_PENDING 0x01 #define T_ACTIVE 0x02 #define T_ABSOLUTE 0x04 #define T_INCINTERVAL 0x10 #define T_COMPLETE 0x20 #define T_MPSAFE 0x40 #define T_LOWRES 0x80 struct trb { struct trb *to_next; struct trb *knext; struct trb *kprev; ulong id; volatile cpu_t cpunum; unsigned short flags; ulong timerid; tid_t eventlist; struct itimerstruc_t timeout; void (*func)(); union parmunion { ulong data; int sdata; caddr_t addr; } t_union; int ipri; void (*tof)(); }; #define func_data t_union.data #define t_func_data t_union.data #define t_func_sdata t_union.sdata #define t_func_addr t_union.addr #define TIMERID_ISBSD(timerid) (((timerid) == ITIMER_VIRTUAL) || ((timerid) == ITIMER_VIRT) || ((timerid) == ITIMER_PROF)) struct cputime_tmr { struct posix_tmr *next; struct posix_tmr *prev; int id; timer_t timerid; unsigned short flags; unsigned int value; unsigned int interval; void (*func)(); caddr_t data; }; struct posix_tmr { clockid_t tmr_clockid; short tmr_active_overrun; short tmr_prev_overrun; int tmr_notify; union { tid_t tid; void *sip; } tmr_notifunion; union { struct trb *trb; struct cputime_tmr cpu_tmr; } tmr_union; }; #define tmr_tid tmr_notifunion.tid #define tmr_sip tmr_notifunion.sip #define tmr_trb tmr_union.trb #define tmr_cpu_tmr tmr_union.cpu_tmr struct cputime_clock { uint_t rt_ticks; struct posix_tmr *active_tmrs; }; #define CPUTIME_GET 0 #define CPUTIME_SET 1 #define CPUTIME_RES 2 #define CLOCKID_TYPE(_clockid) ((long long)(_clockid) & 0xFFFFFFFFLL) #define CLOCKID_INSTANCE(_clockid) ((long long)(_clockid) >> 32LL) #define _H_CRED extern "C" { #define _H_PRIV #define _H_MODE #define _S_IFMT 0170000 #define _S_IFREG 0100000 #define _S_IFDIR 0040000 #define _S_IFBLK 0060000 #define _S_IFCHR 0020000 #define _S_IFIFO 0010000 #define S_ISUID 0004000 #define S_ISGID 0002000 #define S_IRWXU 0000700 #define S_IRUSR 0000400 #define S_IWUSR 0000200 #define S_IXUSR 0000100 #define S_IRWXG 0000070 #define S_IRGRP 0000040 #define S_IWGRP 0000020 #define S_IXGRP 0000010 #define S_IRWXO 0000007 #define S_IROTH 0000004 #define S_IWOTH 0000002 #define S_IXOTH 0000001 #define S_ISFIFO(m) (((m)&(_S_IFMT)) == (_S_IFIFO)) #define S_ISDIR(m) (((m)&(_S_IFMT)) == (_S_IFDIR)) #define S_ISCHR(m) (((m)&(_S_IFMT)) == (_S_IFCHR)) #define S_ISBLK(m) (((m)&(_S_IFMT)) == (_S_IFBLK)) #define S_ISREG(m) (((m)&(_S_IFMT)) == (_S_IFREG)) #define S_ISVTX 0001000 #define S_IFMT _S_IFMT #define S_IFREG _S_IFREG #define S_IFDIR _S_IFDIR #define S_IFBLK _S_IFBLK #define S_IFCHR _S_IFCHR #define S_IFIFO _S_IFIFO #define S_IFLNK 0120000 #define S_IFSOCK 0140000 #define S_ISLNK(m) (((m)&(S_IFMT)) == (S_IFLNK)) #define S_ISSOCK(m) (((m)&(S_IFMT)) == (S_IFSOCK)) #define S_IREAD 0000400 #define S_IWRITE 0000200 #define S_IEXEC 0000100 #define S_ENFMT S_ISGID #define S_IFMPX (S_IFCHR|S_ISVTX) #define S_ISMPX(m) (((m)&(S_IFMT|S_ISVTX)) == (S_IFMPX)) #define IFMT S_IFMT #define IFDIR S_IFDIR #define IFCHR S_IFCHR #define IFBLK S_IFBLK #define IFREG S_IFREG #define IFIFO S_IFIFO #define IFSOCK S_IFSOCK #define IFLNK S_IFLNK #define ISUID S_ISUID #define ISGID S_ISGID #define ISVTX S_ISVTX #define IREAD S_IREAD #define IWRITE S_IWRITE #define IEXEC S_IEXEC #define S_INMOD 0xC0000000 #define S_IXMOD 0x40000000 #define S_IXATTR 0x00040000 #define S_IJRNL 0x04000000 #define S_IXACL 0x02000000 #define S_ITCB 0x01000000 #define S_ITP 0x00800000 #define IXMOD S_IXMOD #define IXATTR S_IXATTR #define IXACL S_IXACL #define _H_TCB #define TCB_ON 0x1 #define TP_ON 0x3 #define TCB_OFF 0x0 #define TCB_QUERY 0x4 struct priv { unsigned int pv_priv[2]; }; typedef struct priv priv_t; #define _H_PCL struct pce_id { unsigned short id_len; unsigned short id_type; #define PCEID_USER 1 #define PCEID_GROUP 2 int id_data[1]; }; #define pcl_id_last(a) ((struct pce_id *)(((char *)(a)) + (a)->pce_len)) #define pcl_id_nxt(id) ((struct pce_id *) (((char*)(id))+(((struct pce_id *)(id))->id_len))) struct pcl_entry { unsigned int pce_len; priv_t pce_privs; struct pce_id pce_id[1]; }; #define pcl_nxt(a) ((struct pcl_entry *)(((char *)(a))+(((struct pcl_entry *)(a))->pce_len))) #define pcl_last(a) ((struct pcl_entry *)(((char *)(a)) + (a)->pcl_len)) struct pcl { unsigned int pcl_len; unsigned int pcl_mode; priv_t pcl_default; struct pcl_entry pcl_ext[1]; }; #define PCL_SIZ ((int) &(((struct pcl *) 0)->pcl_ext[0])) #define PRIV_COMMANDS 0xFFFF0000 #define PRIV_ADD 0x00010000 #define PRIV_SUB 0x00020000 #define PRIV_SET 0x00030000 #define PRIV_EFFECTIVE 0x00000001 #define PRIV_INHERITED 0x00000002 #define PRIV_BEQUEATH 0x00000004 #define PRIV_MAXIMUM 0x00000008 #define PRIV_LAPSE 0x30001 #define PRIV_ACQUIRE 0x30002 #define PRIV_DROP 0x30003 #define SET_OBJ_DAC 10 #define SET_OBJ_RAC 11 #define SET_OBJ_MAC 12 #define SET_OBJ_INFO 13 #define SET_OBJ_STAT 14 #define SET_OBJ_PRIV 15 #define SET_PROC_DAC 20 #define SET_PROC_RAC 21 #define SET_PROC_MAC 22 #define SET_PROC_INFO 23 #define SET_PROC_ENV 24 #define SET_PROC_ACCT 25 #define SET_PROC_AUDIT 26 #define AUDIT_CONFIG 40 #define ACCT_CONFIG 41 #define DEV_CONFIG 42 #define FS_CONFIG 43 #define GSS_CONFIG 44 #define LVM_CONFIG 45 #define NET_CONFIG 46 #define RAS_CONFIG 47 #define RAC_CONFIG 48 #define SYS_CONFIG 49 #define SYS_OPER 50 #define TPATH_CONFIG 51 #define VMM_CONFIG 52 #define BYPASS_DAC_WRITE 1 #define BYPASS_DAC_READ 2 #define BYPASS_DAC_EXEC 3 #define BYPASS_DAC_KILL 4 #define BYPASS_RAC 5 #define BYPASS_MAC_WRITE 6 #define BYPASS_MAC_READ 7 #define BYPASS_TPATH 8 #define BYPASS_DAC 9 #define TRUSTED_PATH 910 extern int chpriv(char *, struct pcl *, int); extern int fchpriv(int, struct pcl *, int); extern int statpriv(char *, int, struct pcl *, int); extern int fstatpriv(int, int, struct pcl *, int); extern int privcheck(int); extern int getpriv(int, priv_t *, int); extern int setpriv(int, priv_t *, int); #define _H_LOCKL extern lock_t kernel_lock; #define _H_SYS_CAP #define CAP_EFFECTIVE 1 #define CAP_INHERITABLE 2 #define CAP_PERMITTED 3 typedef unsigned int cap_flag_t; struct __cap_t { uint64_t cap_effective; uint64_t cap_inheritable; uint64_t cap_permitted; }; typedef void * cap_t; cap_t cap_init(); #define CAP_CLEAR 0 #define CAP_SET 1 typedef unsigned int cap_flag_value_t; typedef int cap_value_t; #define CAP_PROPAGATE 1 #define CAP_PROPOGATE 1 #define CAP_NUMA_ATTACH 2 #define CAP_BYPASS_RAC_VMM 3 #define CAP_EWLM_AGENT 4 #define CAP_ARM_APPLICATION 5 #define CAP_AACCT 6 #define CAP_CREDENTIALS 7 #define CAP_MAXIMUM CAP_CREDENTIALS #define SHORT_NGROUPS NGROUPS_MAX #define PAG_GROUPS 8 #define __NGROUPS_GROUPSET_MAX 32 #define GROUPS_PER_SET ((__NGROUPS_GROUPSET_MAX * sizeof (gid_t) - sizeof (void *)) / sizeof (gid_t)) typedef struct groupset { union { struct { gid_t un_groups[((32 * sizeof (gid_t) - sizeof (void *)) / sizeof (gid_t))]; struct groupset *un_next; } un_struct; gid_t un_groups[32]; } gs_union; } groupset_t; #define PAG_GROUPSET_PADDING_WITH_GROUPS(ngrps) ((((ngrps) % GROUPS_PER_SET) == 0) ? 0 : GROUPS_PER_SET - ((ngrps) % GROUPS_PER_SET)) #define PAG_GROUPSET_PADDING(ngrps) (((ngrps) == 0) ? GROUPS_PER_SET : PAG_GROUPSET_PADDING_WITH_GROUPS((ngrps))) #define PAG_GROUPS_EFFECTIVE(ngrps) (PAG_GROUPSET_PADDING(ngrps) + ((PAG_GROUPS) * 2)) #define MAX_PAG_ENTRIES 16 struct ucred { int cr_ref; uid_t cr_ruid; uid_t cr_uid; uid_t cr_suid; uid_t cr_luid; uid_t cr_acctid; gid_t cr_gid; gid_t cr_rgid; gid_t cr_sgid; short cr_ngrps; short cr_caps; groupset_t cr_groupset; priv_t cr_mpriv; priv_t cr_ipriv; priv_t cr_epriv; priv_t cr_bpriv; int cr_pag; }; typedef struct ucred cred_t; struct ucred_43 { int ocr_ref; uid_t ocr_ruid; uid_t ocr_uid; uid_t ocr_suid; uid_t ocr_luid; uid_t ocr_acctid; gid_t ocr_gid; gid_t ocr_rgid; gid_t ocr_sgid; short ocr_ngrps; gid_t ocr_groups[32]; priv_t ocr_mpriv; priv_t ocr_ipriv; priv_t ocr_epriv; priv_t ocr_bpriv; int ocr_pag; }; typedef struct ucred_43 cred_43_t; #define CRX_PAGID_64BIT 0x80 #define CRX_PAGID_MASK 0x7f #define CRX_MAX_GROUPS 128 typedef struct ucred_ext { uid_t crx_ruid; uid_t crx_uid; uid_t crx_suid; uid_t crx_luid; uid_t crx_acctid; gid_t crx_gid; gid_t crx_rgid; gid_t crx_sgid; int crx_ngrps; gid_t crx_groups[128]; int crx_reserved_1; struct __cap_t crx_caps; priv_t crx_mpriv; priv_t crx_ipriv; priv_t crx_epriv; priv_t crx_bpriv; int crx_npags; char crx_pagids[16]; int crx_pags[16]; int crx_pad[256-173]; } cred_ext_t; void crlock(void); void crunlock(void); void credlock(void); void credunlock(void); void crfree(struct ucred *); struct ucred *crref(void); struct ucred *crxref(struct ucred * volatile *); struct ucred *crget(void); struct ucred *crcopy(struct ucred *); struct ucred *crdup(struct ucred *); void crset(struct ucred *); void crhold(struct ucred *); void crexport(struct ucred *, struct ucred_ext *); struct ucred *crimport(int, void *); #define CRED_GETREF(cr) ((cr)->cr_ref) #define CRED_GETRUID(cr) ((cr)->cr_ruid) #define CRED_GETEUID(cr) ((cr)->cr_uid) #define CRED_GETSUID(cr) ((cr)->cr_suid) #define CRED_GETLUID(cr) ((cr)->cr_luid) #define CRED_GETACCTID(cr) ((cr)->cr_acctid) #define CRED_GETEGID(cr) ((cr)->cr_gid) #define CRED_GETRGID(cr) ((cr)->cr_rgid) #define CRED_GETSGID(cr) ((cr)->cr_sgid) #define CRED_GETNGRPS(cr) ((cr)->cr_ngrps) int kcred_getgroups (struct ucred *, int, gid_t *); int kcred_setgroups (struct ucred *, int, gid_t *); int kcred_getpriv (struct ucred *, int, priv_t *); int kcred_setpriv (struct ucred *, int, priv_t *); void kcred_getcap (struct ucred *, struct __cap_t *); void kcred_setcap (struct ucred *, struct __cap_t *); int kcred_getpag (struct ucred *, int, int *); int kcred_getpag64 (struct ucred *, int, uint64_t *); int kcred_setpag (struct ucred *, int, int); int kcred_setpag64 (struct ucred *, int, uint64_t); int kcred_genpagvalue (struct ucred *, int, uint64_t *, int); int groupmember (gid_t); int groupmember_cr (gid_t, struct ucred *); #define PAG_DFS 0 #define PAG_AFS 1 int get_pag(int which, int *pag); int get_pag64(int which, uint64_t *pag); int set_pag(int which, int pag); int set_pag64(int which, uint64_t pag); struct pag_list { int pag; int active; int spare[2]; }; int validate_pag(int which, struct pag_list pag[], int npag); struct pag_list64 { uint64_t pag; int active; int spare[2]; }; int validate_pag64(int which, struct pag_list64 pag[], int npag); #define U_ROOT_UID 0 #define G_SYSTEM_GRP 0 #define G_SECURITY_GRP 7 } #define _H_RESOURCE extern "C" { #define PRIO_PROCESS 0 #define PRIO_PGRP 1 #define PRIO_USER 2 #define PRIO_MIN -20 #define PRIO_MAX 20 #define RLIM_NLIMITS 8 #define RLIM_INFINITY 0x7FFFFFFF #define RLIM_SAVED_MAX (RLIM_INFINITY-1) #define RLIM_SAVED_CUR (RLIM_INFINITY-2) typedef unsigned long rlim_t; struct rlimit { rlim_t rlim_cur; rlim_t rlim_max; }; #define RLIM64_INFINITY (0x7fffffffffffffffLL) typedef unsigned long long rlim64_t; struct rlimit64 { rlim64_t rlim_cur; rlim64_t rlim_max; }; #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN -1 #define RUSAGE_THREAD 1 #define RUSAGE_TIMES 2 #define ru_first ru_ixrss #define ru_last ru_nivcsw struct rusage { struct timeval ru_utime; struct timeval ru_stime; long ru_maxrss; long ru_ixrss; long ru_idrss; long ru_isrss; long ru_minflt; long ru_majflt; long ru_nswap; long ru_inblock; long ru_oublock; long ru_msgsnd; long ru_msgrcv; long ru_nsignals; long ru_nvcsw; long ru_nivcsw; }; struct rusage64 { struct timeval ru_utime; struct timeval ru_stime; long long ru_maxrss; long long ru_ixrss; long long ru_idrss; long long ru_isrss; long long ru_minflt; long long ru_majflt; long long ru_nswap; long long ru_inblock; long long ru_oublock; long long ru_msgsnd; long long ru_msgrcv; long long ru_nsignals; long long ru_nvcsw; long long ru_nivcsw; }; struct trusage64 { struct timeval64 ru_utime; struct timeval64 ru_stime; longlong_t ru_maxrss; longlong_t ru_ixrss; longlong_t ru_idrss; longlong_t ru_isrss; longlong_t ru_minflt; longlong_t ru_majflt; longlong_t ru_nswap; longlong_t ru_inblock; longlong_t ru_oublock; longlong_t ru_msgsnd; longlong_t ru_msgrcv; longlong_t ru_nsignals; longlong_t ru_nvcsw; longlong_t ru_nivcsw; }; struct trusage32 { struct timeval32 ru_utime; struct timeval32 ru_stime; signed int ru_maxrss; signed int ru_ixrss; signed int ru_idrss; signed int ru_isrss; signed int ru_minflt; signed int ru_majflt; signed int ru_nswap; signed int ru_inblock; signed int ru_oublock; signed int ru_msgsnd; signed int ru_msgrcv; signed int ru_nsignals; signed int ru_nvcsw; signed int ru_nivcsw; }; #define CP_RUSAGE(__tsrc,__tdest) (__tdest)->ru_utime.tv_sec = (__tsrc)->ru_utime.tv_sec; (__tdest)->ru_utime.tv_usec = (__tsrc)->ru_utime.tv_usec; (__tdest)->ru_stime.tv_sec = (__tsrc)->ru_stime.tv_sec; (__tdest)->ru_stime.tv_usec = (__tsrc)->ru_stime.tv_usec; (__tdest)->ru_maxrss = (__tsrc)->ru_maxrss; (__tdest)->ru_ixrss = (__tsrc)->ru_ixrss; (__tdest)->ru_idrss = (__tsrc)->ru_idrss; (__tdest)->ru_isrss = (__tsrc)->ru_isrss; (__tdest)->ru_minflt = (__tsrc)->ru_minflt; (__tdest)->ru_majflt = (__tsrc)->ru_majflt; (__tdest)->ru_nswap = (__tsrc)->ru_nswap; (__tdest)->ru_inblock = (__tsrc)->ru_inblock; (__tdest)->ru_oublock = (__tsrc)->ru_oublock; (__tdest)->ru_msgsnd = (__tsrc)->ru_msgsnd; (__tdest)->ru_msgrcv = (__tsrc)->ru_msgrcv; (__tdest)->ru_nsignals = (__tsrc)->ru_nsignals; (__tdest)->ru_nvcsw = (__tsrc)->ru_nvcsw; (__tdest)->ru_nivcsw = (__tsrc)->ru_nivcsw; #define RUSAGE_ADD(_dest,_src1,_src2) (_dest)->ru_minflt = (_src1)->ru_minflt + (_src2)->ru_minflt; (_dest)->ru_majflt = (_src1)->ru_majflt + (_src2)->ru_majflt; (_dest)->ru_nswap = (_src1)->ru_nswap + (_src2)->ru_nswap; (_dest)->ru_nsignals = (_src1)->ru_nsignals + (_src2)->ru_nsignals; (_dest)->ru_nvcsw = (_src1)->ru_nvcsw + (_src2)->ru_nvcsw; (_dest)->ru_nivcsw = (_src1)->ru_nivcsw + (_src2)->ru_nivcsw; #define RUSAGE_SUB(_dest,_src1,_src2) (_dest)->ru_minflt = (_src1)->ru_minflt - (_src2)->ru_minflt; (_dest)->ru_majflt = (_src1)->ru_majflt - (_src2)->ru_majflt; (_dest)->ru_nswap = (_src1)->ru_nswap - (_src2)->ru_nswap; (_dest)->ru_nsignals = (_src1)->ru_nsignals - (_src2)->ru_nsignals; (_dest)->ru_nvcsw = (_src1)->ru_nvcsw - (_src2)->ru_nvcsw; (_dest)->ru_nivcsw = (_src1)->ru_nivcsw - (_src2)->ru_nivcsw; #define RLIMIT_CPU 0 #define RLIMIT_FSIZE 1 #define RLIMIT_DATA 2 #define RLIMIT_STACK 3 #define RLIMIT_CORE 4 #define RLIMIT_RSS 5 #define RLIMIT_AS 6 #define RLIMIT_NOFILE 7 extern int getpriority(int, id_t); extern int setpriority(int, id_t, int); extern int getrlimit(int, struct rlimit *); extern int setrlimit(int, const struct rlimit *); extern int getrlimit64(int, struct rlimit64 *); extern int setrlimit64(int, const struct rlimit64 *); extern int getrusage(int, struct rusage *); extern int getrusage64(int, struct rusage64 *); } extern "C" { typedef unsigned long thread_eye_catch_t; #define MAXTHREADS 512 #define MRQ_WORDS_IN_MASK 2 #define MRQ_INTS_IN_MASK (MRQ_WORDS_IN_MASK * 2) typedef union { unsigned long long mrq_mask_word[2]; unsigned int mrq_mask_int[(2 * 2)]; } mrq_mask_t; struct thread { tid_t t_tid; tid_t t_vtid; vmhandle_t t_kthreadseg; ulong t_atomic; uint t_flags; uint t_flags2; ushort t_lockcount; short t_suspend; struct pvthread *t_pvthreadp; struct proc *t_procp; struct t_uaddress { struct uthread *uthreadp; struct user *userp; } t_uaddress; uint t_ulock64; uint t_ulock; uint t_uchan64; uint t_uchan; uint t_userdata64; int t_userdata; uint t_cv64; int t_cv; uint t_stackp64; char *t_stackp; uint t_scp64; struct sigcontext *t_scp; char *t_wchan2; char *t_wchan1; struct thread *t_eventlist; ulong t_pevent; ulong t_wevent; vmhandle_t t_usid; char *t_swchan; struct thread *t_slist; struct thread *t_lockowner; vmhandle_t t_wchan1sid; uint t_wchan1offset; int t_fsflags; int t_result; int t_polevel; __ptr64 t_threadcontrolp; struct thread *t_prior; struct thread *t_next; void *t_graphics; struct run_queue *t_run_queue; u_longlong_t t_time_start; u_longlong_t t_spurr_time_start; time_t t_affinity_ts; ulong t_dispct; ulong t_fpuct; mrq_mask_t t_allowed_cpus; ushort t_adsp_flags; ushort t_ticks; char t_pri_band; char t_savsigno; cpu_t t_prefunnel_cpu; cpu_t t_cpuid; cpu_t t_scpuid; ushort t_cpu2; ushort t_cpu; char t_norun_secs; char t_policy; #define T_CPU_MAX 20+HZ char t_lockpri; char t_wakepri; uchar t_time; char t_sav_pri; char t_ceiling; char t_nice; char t_sigproc; char t_cursig; char t_whystop; sigset64_t t_sig; sigset64_t t_sigmask; int t_chkblock; ushort t_whatstop; ushort t_chkerror; pid_t t_wlm_charge; ulong t_minflt; ulong t_majflt; uint t_wlmevtcnt; uint t_trcgenct; uint t_cpu_tb; cpu_t t_ldispcpu; uint t_rt_ticks; unsigned long long t_interval_start; unsigned long long t_cputime; unsigned long long t_scputime; unsigned long long pth_utime; unsigned long long pth_stime; cred_t *t_credp; cpu_t t_homecpu; short t_homenode; void *t_rs_attinfo; void *t_nft_dabr; void *t_nft_descr; void *t_ulock_listp; unsigned long t_ipc_data; uint t_procfslr64; uint t_procfslr; thread_eye_catch_t t_eyec; }; struct pvthread { tid_t tv_tid; tid_t tv_vtid; struct thread *tv_threadp; struct pvproc *tv_pvprocp; struct { struct pvthread *prevthread; struct pvthread *nextthread; } tv_threadlist; Simple_lock tv_lock_d; tid_t tv_synch; tid_t tv_tsleep; char *tv_wchan; uint tv_flags; uint tv_flags2; u_longlong_t tv_totalcputime; u_longlong_t tv_totalscputime; int tv_boosted; cpu_t tv_affinity; char tv_state; char tv_wtype; void *tv_pmcontext; char tv_pri; struct vnode *tv_procfsvn; void *tv_chkfile; unsigned long long tv_prbase; unsigned long long *tv_prpinned; ushort tv_prflags; ushort tv_prbufcount; uint tv_ptid; int tv_wlm; class_id_t tv_class; void *tv_rset; char *tv_ptag; thread_eye_catch_t tv_eyec; #define TV_PAD 0 #define TV_LOGSIZE 7 }; #define tv_link tv_prevthread #define t_uthreadp t_uaddress.uthreadp #define t_userp t_uaddress.userp #define tv_prevthread tv_threadlist.prevthread #define tv_nextthread tv_threadlist.nextthread #define TKTHREAD 0x00001000 #define TCHKCALLER 0x00000400 #define TTERM 0x00000001 #define TSUSP 0x00000002 #define TSIGAVAIL 0x00000004 #define TINTR 0x00000008 #define TLOCAL 0x00000010 #define TTRCSIG 0x00000040 #define TPROCFS 0x00000080 #define TOMASK 0x00000100 #define TWAKEONSIG 0x00000400 #define SWAKEONSIG 0x00000800 #define TFUNNELLED 0x00002000 #define TSETSTATE 0x00004000 #define TGETREGS 0x00008000 #define TWAKEONCHKPT 0x00010000 #define TSIGWAIT 0x00020000 #define TCRED 0x00040000 #define TCANCEL 0x00200000 #define TCDEFER 0x00400000 #define TCDISABLE 0x00800000 #define TSYNCH 0x01000000 #define TUSCHED 0x02000000 #define TLMTSIGS 0x04000000 #define TEVTPROC 0x08000000 #define TPTHSUSP 0x10000000 #define TPTHSTOPPED 0x20000000 #define TPTHCONT 0x40000000 #define TSIGSLIH (TTERM|TSUSP|TSIGAVAIL) #define TSIGINTR (TSIGSLIH|TINTR) #define TSLWTED 0x00000020UL #define TSIGDELIVERY 0x00000080UL #define TSEWTED 0x00000200UL #define TSELECT 0x00008000UL #define TWPDABR 0x00010000UL #define TWPSYSCALL 0x00020000UL #define TSTEP 0x00040000UL #define TFASTWATCH 0x00080000UL #define TSFWTED 0x00100000UL #define TCHKERROR 0x80000000UL #define TUEXEMPT 0x00000001 #define TTIMESLICE_GRANT 0x00000002 #define TNOVALIDATE 0x00000004 #define TISIGINTR 0x00000010 #define TCHKPNT 0x00000020 #define TCHKPNT_BLOCK 0x00000040 #define TCHKPNT_PROCESS 0x00000080 #define TCHKPNT_SLEEP 0x00000100 #define TCHKPTSTOP 0x00000200 #define TCORE 0x00000400 #define TLSLICE 0x00000800 #define TPROFIL 0x00001000 #define TMIGRATE 0x00002000 #define TDISSTK 0x00004000 #define TFINTR 0x00008000 #define TTRAPSTOP 0x00010000 #define TTHRDTRAP 0x00020000 #define TSNONE 0 #define TSIDL 1 #define TSRUN 2 #define TSSLEEP 3 #define TSSWAP 4 #define TSSTOP 5 #define TSZOMB 6 #define TNOWAIT 0 #define TWEVENT 1 #define TWLOCK 2 #define TWTIMER 3 #define TWCPU 4 #define TWPGIN 5 #define TWPGOUT 6 #define TWPLOCK 7 #define TWFREEF 8 #define TWMEM 9 #define TWLOCKREAD 10 #define TWUEXCEPT 11 #define TWZOMB 12 #define TWLOCK_WX 13 #define TWVMMWAIT 14 #define TIDRESERVED 5 #define THREADSHIFT 19 #define TGENSHIFT 8 #define TGENMASK ((1<<TGENSHIFT)-1) #define NTHREAD (1<<THREADSHIFT) #define TIDMASK ((NTHREAD-1)<<TGENSHIFT) #define TSRADSHIFT 4 #define TIDXSHIFT (THREADSHIFT-TSRADSHIFT) #define TSRADMASK ((1L<<TSRADSHIFT)-1) #define TIDXMASK ((1L<<TIDXSHIFT)-1) #define THREADMASK(tid) (((tid)&TIDMASK)>>TGENSHIFT) #define TIDGEN(idx) ((idx)<<TGENSHIFT) #define V_ADSP_R 0x01 #define V_ADSP_W 0x02 #define V_ADSP_CS 0x04 #define MAYBE_TID(tid) (tid & 1) #define NULL_TID 0 #define SWAPPER_TID 3 #define SCHED_OTHER 0 #define EXTRACT_T_NICE(t) (((t)->t_policy == SCHED_OTHER) ? ((t)->t_nice - PUSER) : (P_NICE_MAX + 1)) #define SET_T_NICE(t,n) { if ((t)->t_policy == SCHED_OTHER) { (t)->t_nice=(MIN(P_NICE_MAX,MAX(0,(n)))) + PUSER; } } #define UL_FREE 0x00000000 #define UL_BUSY 0x10000000 #define UL_WAIT 0x20000000 #define UL_WAIT_LOCAL 0x40000000 #define UL_INTERLOCK 0x80000000 #define UL_MASK 0x0fffffff #define THREAD_TWAKEUP_ALL 0 #define THREAD_TWAKEUP_ONE 1 #define TSTATE_LOCAL 0x00000001 #define TSTATE_CANCEL_DEFER 0x00000004 #define TSTATE_CANCEL_DISABLE 0x00000008 #define TSTATE_CANCEL_PENDING 0x00000010 #define TSTATE_CANCEL_CHKPT 0x00000040 #define TSTATE_INTR 0x00000002 #define TSTATE_CANCEL_START TSTATE_INTR #define TSTATE_EXEMPT 0x00000020 #define TSTATE_PROFILING_OFF 0x00000080 #define TSTATE_SUSPEND 0x00000100 #define TSTATE_CONT 0x00000200 #define TSTATE_CREDS 0x00000400 #define TSTATE_PROCHANDLERS 0x00000800 #define TSTATE_ADVH 0x00001000 #define TSTATE_SYNCH 0x00002000 #define TSTATE_USCHED 0x00004000 #define TSTATE_DEFAULT_SCHED 0x00008000 #define TSTATE_INHERIT_SCHED 0x00010000 #define TSTATE_LOCAL_INIT 0x00020000 #define TSTATE_LOCAL_TERM 0x00040000 #define TSTATE_LOCAL_MCHANGE 0x00080000 #define TSTATE_CHANGE_ALL 0xfff00000 #define TSTATE_CHANGE_PTID 0x00100000 #define TSTATE_CHANGE_PROFILE 0x01000000 #define TSTATE_CHANGE_SSTACK 0x02000000 #define TSTATE_CHANGE_ERRNOP 0x04000000 #define TSTATE_CHANGE_SIGMASK 0x08000000 #define TSTATE_CHANGE_PSIG 0x10000000 #define TSTATE_CHANGE_SCHED 0x20000000 #define TSTATE_CHANGE_FLAGS 0x40000000 #define TSTATE_CHANGE_USERDATA 0x80000000 #define TSTATE_MYFAST_ALL (TSTATE_CHANGE_FLAGS | TSTATE_SUSPEND | TSTATE_PROFILING_OFF) #define THREAD_WAIT_OK 0 #define THREAD_WAIT_TIMEDOUT 1 #define THREAD_WAIT_ERROR -1 #define MAX_POSTED_THREADS 512 struct tstate { struct mstsave mst; __ptr32 errnop_addr; sigset_t sigmask; sigset_t psig; int policy; int priority; int flags; int flagmask; long userdata; uint fpinfo; uint fpscrx; stack_t sigaltstack; __ptr64 thread_control_p; void *prbase; void *credp; uint ptid; uint tct_clock; u_longlong_t ukeyset; struct rusage rusg; }; struct func_desc { char *entry_point; char *toc_ptr; char *data_ptr; }; struct func_desc32 { int entry_point; int toc_ptr; int data_ptr; }; typedef struct thread_credentials { uint flags; cred_ext_t cred; int reserved[9]; } thread_creds_t; #define INHERIT_USER_IDS 0x00000001 #define INHERIT_GROUP_IDS 0x00000010 #define INHERIT_GROUP_SETS 0x00000100 #define INHERIT_CAPABILITIES 0x00001000 #define INHERIT_PRIVILEGES 0x00010000 #define INHERIT_ALL 0x00011111 extern int *errnop; tid_t thread_create(void); void thread_init(unsigned long long, unsigned long long); int thread_kill(tid_t, int); int thread_post(tid_t); int thread_post_many(int, tid_t *, tid_t *); tid_t thread_self(void); int thread_setcredentials(int, struct thread_credentials *); int thread_setmystate(struct tstate *, struct tstate *); int thread_setmystate_fast(int, int **, ulong); int thread_setmymask_fast(sigset_t); int thread_boostceiling(int, int); int thread_setsched(tid_t, int, int); int thread_setstate(tid_t, struct tstate *, struct tstate *); int thread_setstate_fast(tid_t, int); void thread_terminate(void); int thread_terminate_ack(tid_t); void thread_terminate_unlock(atomic_p); int thread_getregs(tid_t, mcontext_t *, ulong *, ulong *, int *); int thread_getextregs(tid_t, __extctx_t *); int thread_tsleep(int, atomic_p, const sigset_t *, struct timestruc_t *); int thread_tsleep_chkpnt(int, atomic_p, const sigset_t *); int thread_tsleep_event(void *, atomic_p, int, struct timestruc_t *); int thread_twakeup(tid_t, int); int thread_twakeup_event(void *, int, int); int thread_twakeup_unlock(tid_t, int, atomic_p); int thread_unlock(atomic_p); long thread_userdata(void); int thread_wait(int); int thread_waitlock(atomic_p); int thread_waitlock_local(atomic_p); int thread_waitlock_(atomic_p, int, struct timestruc_t *); int thread_waitlock_local_(atomic_p, tid_t, struct timestruc_t *); int thread_waitact(int); void threads_runnable(int); int count_event_waiters(void *); void thread_callout(tid_t, uint); } #define PT_TRACE_ME 0 #define PT_READ_I 1 #define PT_READ_D 2 #define PT_WRITE_I 4 #define PT_WRITE_D 5 #define PT_CONTINUE 7 #define PT_KILL 8 #define PT_STEP 9 #define PT_READ_GPR 11 #define PT_READ_FPR 12 #define PT_WRITE_GPR 14 #define PT_WRITE_FPR 15 #define PT_READ_BLOCK 17 #define PT_WRITE_BLOCK 19 #define PT_ATTACH 30 #define PT_DETACH 31 #define PT_REGSET 32 #define PT_REATT 33 #define PT_LDINFO 34 #define PT_MULTI 35 #define PT_NEXT 36 #define PT_SET 37 #define PT_CLEAR 38 #define PT_LDXINFO 39 #define PT_QUERY 40 #define PT_WATCH 41 #define PTT_CONTINUE 50 #define PTT_STEP 51 #define PTT_READ_SPRS 52 #define PTT_WRITE_SPRS 53 #define PTT_READ_GPRS 54 #define PTT_WRITE_GPRS 55 #define PTT_READ_FPRS 56 #define PTT_WRITE_FPRS 57 #define PTT_READ_VEC 58 #define PTT_WRITE_VEC 59 #define PTT_WATCH 60 #define PTT_SET_TRAP 61 #define PTT_CLEAR_TRAP 62 #define PTT_READ_UKEYSET 63 #define PT_GET_UKEY 64 #define PTT_READ_FPSCR_HI 65 #define PTT_WRITE_FPSCR_HI 66 #define PT_COMMAND_MAX 66 #define IPCDATA 1024 #define PTFLAG_FAST_TRAP 0x00000001 #define PTFLAG_FAST_WATCH 0x00000002 #define PTFLAG_FAST_MASK (PTFLAG_FAST_TRAP|PTFLAG_FAST_WATCH) #define _FASTTRAP_OP 0x0DDF8000 #define _FASTTRAP_OP_MASK 0xFFFF8000 #define _FASTTRAP_NUM 0x00007FFF int ptrace(int request, int32long64_t id, int *address, int data, int *buffer); int ptracex(int request, int32long64_t id, long long addr, int data, int *buff); int ptrace64(int request, long long id, long long addr, int data, int *buff); struct ptsprs { unsigned int pt_iar; unsigned int pt_msr; unsigned int pt_cr; unsigned int pt_lr; unsigned int pt_ctr; unsigned int pt_xer; unsigned int pt_mq; unsigned int pt_reserved_0; unsigned int pt_fpscr; char pt_reserved_1; char pt_reserved_2; char pt_reserved_3[2]; unsigned int pt_reserved_4[5]; unsigned int pt_reserved_5; unsigned int pt_reserved_6; unsigned int pt_reserved_7; unsigned int pt_reserved_8; unsigned int pt_reserved_9; unsigned int pt_fpscrx; }; struct ptxsprs { unsigned long long pt_msr; unsigned long long pt_iar; unsigned long long pt_lr; unsigned long long pt_ctr; unsigned int pt_cr; unsigned int pt_xer; unsigned int pt_fpscr; unsigned int pt_fpscrx; }; struct ptthreads { tid32_t th[32767]; }; struct ptthreads64 { tid64_t th[32767]; }; typedef struct _ptrace_info { unsigned int ptrace_info_size; unsigned int total_info_size; offset_t watchpoints_hdr_off; } _ptrace_info; typedef struct _pt_watchpoints_hdr { offset_t pt_watchpoints_offset; unsigned int pt_watchpoints_count; unsigned int pt_watchpoint_size; unsigned int pt_validate:1; unsigned int pt_wp_write:1; unsigned int pt_wp_read:1; unsigned int pt_wp_thread:1; unsigned int pt_wp_value:1; unsigned int pt_wp_shmem:1; unsigned int pt_wp_mapped:1; unsigned int :25; unsigned int reserved; } _pt_watchpoints_hdr; typedef struct _pt_watchpoint { unsigned long long wp_start; unsigned long long wp_size; union { unsigned long long wp_tid; struct { unsigned int wp_minsize; unsigned short wp_count; unsigned short wp_align; } pt_watchpoint_info; } pt_wp_u; unsigned int reserved; void *wp_value; unsigned int wp_ignore:1; unsigned int wp_invalid:1; unsigned int wp_filter:1; unsigned int wp_thread:1; unsigned int wp_shmem:1; unsigned int wp_mapped:1; unsigned int wp_read:1; unsigned int wp_write:1; unsigned char wp_style; } _pt_watchpoint; #define _WP_STYLE_ANY 1 #define _WP_STYLE_HARDWARE 2 #define _WP_STYLE_HARDWARE1 3 #define _WP_STYLE_HARDWARE_LAST 127 #define _WP_STYLE_SOFTWARE 128 #define _WP_STYLE_SOFTWARE1 129 #define _WP_STYLE_SOFTWARE_LAST 255 enum __ptrace_request { PTRACE_TRACEME, PTRACE_PEEKTEXT, PTRACE_PEEKDATA, PTRACE_PEEKUSER, PTRACE_POKETEXT, PTRACE_POKEDATA, PTRACE_POKEUSER, PTRACE_CONT, PTRACE_KILL, PTRACE_SINGLESTEP, PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS, PTRACE_ATTACH, PTRACE_DETACH, PTRACE_SYSCALL }; typedef unsigned long proc_eye_catch_t; struct uidinfo { struct uidinfo *pu_next; struct uidinfo *pu_prev; uid_t pu_uid; long pu_cnt; int pu_pad[4]; }; extern struct uidinfo *get_uidinfo (uid_t uid); extern void free_uidinfo (struct uidinfo *uidinfo); #define max_pvproc ((struct pvproc *)v.ve_proc) struct kernext_svc { void (*kernext_svc_cleanup)(void *); }; #define TRP_NUM_COUNTS 10 struct proc_counts { unsigned long long trp_count[10]; }; struct proc { struct pvproc *p_pvprocp; pid_t p_pid; uint p_flag; uint p_flag2; uint p_int; uint p_atomic; ushort p_threadcount; ushort p_active; ushort p_suspended; ushort p_terminating; ushort p_local; ulong p_rss; short p_sradassign; ushort p_boundcount; void *p_rs_attinfo; ulong p_pevent; vmhandle_t p_adspace; sigset64_t p_sig; sigset64_t p_sigignore; sigset64_t p_sigcatch; sigset64_t p_siginfo; struct ksiginfo *p_infoq; unsigned long long p_size; unsigned long long p_minflt; unsigned long long p_majflt; long long p_repage; uint p_pctcpu; int p_sched_count; short p_cpticks; short p_msgcnt; uint p_majfltsec; char p_nice; char p_sched_pri; int p_chkblock; void *p_chkfile; void *p_prtrcset; void *p_lgpage; struct posix_tmr *p_rt_timer[32]; struct cputime_clock p_clock; ushort p_io_priority; time_t p_memory_lbolt; unsigned long long p_interval_start; struct proc_counts p_acct; struct diskiostat { unsigned long long inbytes; unsigned long long outbytes; unsigned long long logbytes; unsigned long long logops; unsigned long long inops; unsigned long long outops; } p_diskiostat; int p_wlmthrds; int p_wlmocthrds; int p_thrsetcnt; void *p_ptbpt; tid_t p_ptsynch; proc_eye_catch_t p_eyec; }; #define p_dkinbytes p_diskiostat.inbytes #define p_dkoutbytes p_diskiostat.outbytes #define p_dklogbytes p_diskiostat.logbytes #define p_dklogops p_diskiostat.logops #define p_dkinops p_diskiostat.inops #define p_dkoutops p_diskiostat.outops struct pvproc { pid_t pv_pid; pid_t pv_ppid; pid_t pv_sid; pid_t pv_pgrp; uid_t pv_uid; uid_t pv_suid; class_id_t pv_class; pid_t pv_vpid; pid_t pv_vppid; pid_t pv_vsid; pid_t pv_vpgrp; crid_t pv_crid; uint pv_crid_token; struct trusage64 pv_ru; ulong pv_spare[1]; Simple_lock pv_lock; char pv_stat; char pv_sigs_queued; ushort pv_xstat; uint pv_atomic; uint pv_flag; uint pv_flag2; int pv_wlm; uint pv_auditmask; Simple_lock pv_usched_lock; struct pvthread *pv_uschedp; struct ptipc *pv_ipc; struct pvproc *pv_dblist; struct pvproc *pv_dbnext; struct vnode * pv_procfsvn; struct pvproc *pv_sched_next; struct pvproc *pv_sched_back; struct proc *pv_procp; struct pvproc *pv_child; struct pvproc *pv_siblings; struct uidinfo *pv_uidinfo; struct pvproc *pv_ganchor; struct pvproc *pv_pgrpl; struct pvproc *pv_pgrpb; struct pvproc *pv_ttyl; struct pvproc *pv_cridnext; Simple_lock pv_session_lock; Simple_lock pv_parent_lock; Simple_lock pv_lock_d; struct pvthread *pv_threadlist; tid_t pv_synch; uint64_t pv_mempools[1]; void *pv_rset; unsigned long long pv_nframes; unsigned long long pv_npsblks; unsigned long long pv_nvpages; struct kernext_svc *pv_asyncio; tid_t pv_chksynch; struct pvthread *pv_chktv; unsigned long long pv_totalcputime; unsigned long long pv_totalscputime; unsigned long long pv_xcputime; unsigned long long pv_xscputime; unsigned long long pv_totaldiskio; time_t pv_termtime; void *pv_gcipc; char pv_pri; char pv_policy; short pv_acctflags; int pv_projid; unsigned long long pv_subproj; int pv_sprojid; int pv_pad1; dev64_t pv_app_dev; ino64_t pv_app_ino; uint_t pv_app_gen; void *pv_ewlmproc; struct prochr *pv_handlers; void *pv_cached_credp; Simple_lock pv_handlers_lock; unsigned long long pv_wlm_nvpages; uint pv_flag3; int pv_pad3; proc_eye_catch_t pv_eyec; #define PV_PAD 1 #define PV_LOGSIZE 9 int pv_pad[1]; }; #define pv_link pv_vpgrp #define pv_utime pv_ru.ru_utime.tv_sec #define pv_stime pv_ru.ru_stime.tv_sec #define p_rt_ticks p_clock.rt_ticks #define p_active_tmrs p_clock.active_tmrs #define SLOAD 0x00000001 #define STRC 0x00000008 #define SKPROC 0x00000200 #define SSIGNOCHLD 0x00000400 #define STRACING 0x00004000 #define SMPTRACE 0x00008000 #define SEXIT 0x00010000 #define STRCME 0x00080000 #define SEXECED 0x00200000 #define SPLOCK 0x10000000 #define S64BIT 0x00000001 #define SWAITPROC 0x00000002 #define SSCHEDPROC 0x00000008 #define SRESTART 0x00000010 #define SPRIMARY 0x00000020 #define SCHKPNTABLE 0x00000040 #define SRESTARTED 0x00000080 #define SRESTARTING 0x00000100 #define SCHKTRC 0x00000200 #define SCRED 0x00002000 #define SCOREFILE 0x00004000 #define SCHKHANDLER 0x00008000 #define SPIDCRIT 0x00200000 #define SFORKCRIT 0x00400000 #define SNOCKPTSHM 0x01000000 #define SINHERITED 0x02000000 #define SPV_HOLD 0x10000000 #define SUKEYAWARE 0x20000000 #define SMPIJOB 0x40000000 #define STRAPSIG 0x80000000 #define SNOSWAP 0x00000002 #define SFIXPRI 0x00000100 #define SLOAD 0x00000001 #define SFORKSTACK 0x00000004 #define STRC 0x00000008 #define SKPROC 0x00000200 #define SSIGSET 0x00000800 #define SXPG1170 0x00001000 #define SGETUREGS 0x00002000 #define SEXIT 0x00010000 #define SLPDATA 0x00020000 #define SEXECING 0x01000000 #define SPSEARLYALLOC 0x04000000 #define SCONTINUED 0x08000000 #define SFASTWATCH 0x20000000 #define SLPDATA_SET(U) ((U)->U_procp->p_flag & SLPDATA) #define USE_LPDATA(U) (SLPDATA_SET(U) || ((U)->U_datal2psize == L2LGPSIZE)) #define S64BIT 0x00000001 #define SFASTTRAP 0x00000004 #define SRT_MPC 0x00000400 #define SRT_GRQ 0x00000800 #define SWP_SIGNALED 0x00001000 #define SDSA 0x00010000 #define SCORENAME 0x00020000 #define SPTHREADED 0x00040000 #define SLPDATAMUST 0x00080000 #define SMCMMEMAFF 0x00100000 #define SFCONTINUED 0x00800000 #define SCORE_MMAP 0x04000000 #define SCORE_NOSHM 0x08000000 #define SLPDATAMUST_SET(U) ((U)->U_procp->p_flag2 & SLPDATAMUST) #define SCORE 0x00000001 #define SCORE_DUMP 0x00000002 #define SRUNQ 0x00000004 #define SCHKPNT 0x00000008 #define SJOBSTOP 0x00000010 #define SPROCFS 0x00000020 #define SPTRACE 0x00000040 #define SCHKPNTING 0x00000080 #define SPRFORK 0x00000100 #define SPRKLC 0x00000200 #define SPRRLC 0x00000400 #define SPRASYNC 0x00000800 #define SPROCTR 0x00001000 #define SPRJOBSIG 0x00002000 #define SPROFIL 0x00010000 #define SJUSTBACKIN 0x00020000 #define SCHKPTSTOP 0x00040000 #define SLOWPSEXCP 0x00080000 #define SWLM 0x00100000 #define SWLMRMEM 0x00200000 #define SWLMVMEM 0x00400000 #define SWLMVMEMPROC 0x00800000 #define SCORESTOP 0x01000000 #define SPSMKILL 0x02000000 #define SNOFCONT 0x04000000 #define STERM 0x10000000 #define SSUSP 0x20000000 #define SSUSPUM 0x40000000 #define SGETOUT 0x80000000 #define SALLSTOPS (SJOBSTOP|SPROCFS|SPTRACE|SCORESTOP|SCHKPTSTOP) #define SSIGSLIH (STERM|SSUSP|SSUSPUM|SGETOUT) #define SORPHANPGRP 0x00040000 #define SPPNOCLDSTOP 0x00100000 #define SWTED 0x00000010 #define SFWTED 0x00000020 #define SEWTED 0x00000040 #define SLWTED 0x00000080 #define UV_SYSCFG 0x00000400 #define UV_PZERO 0x00000800 #define SWLMTERMSENT 0x00001000 #define SPROJFIXED 0x0001 #define SPROJAPP 0x0002 #define SPROJINVOKE 0x0004 #define SPROJABS 0x0008 #define SNONE 0 #define SIDL 4 #define SZOMB 5 #define SSTOP 6 #define SACTIVE 7 #define SSWAP 8 #define SBITS 16 #define PIDRESERVED 6 #define PROCSHIFT 18 #define PGENSHIFT 8 #define PGENMASK ((1<<PGENSHIFT)-1) #define NPROC (1<<PROCSHIFT) #define PIDMASK ((NPROC-1)<<PGENSHIFT) #define PIDMAX ((NPROC<<PGENSHIFT)-1) #define PSRADSHIFT TSRADSHIFT #define PIDXSHIFT (PROCSHIFT-PSRADSHIFT) #define PSRADMASK ((1L<<PSRADSHIFT)-1) #define PIDXMASK ((1L<<PIDXSHIFT)-1) #define MAYBE_PID(pid) (!(pid & 1) || (pid == 1)) #define PROCMASK(pid) ((((pid)&PIDMASK)>>PGENSHIFT) | ((pid)&1)) #define PIDGEN(idx) ((idx)<<PGENSHIFT) #define P_NICE_DEFAULT (NZERO+PUSER) #define P_NICE_MAX 40 #define P_NICE_MIN 0 #define EXTRACT_NICE(p) (((p)->p_pvprocp->pv_flag3 & SFIXPRI) ? (P_NICE_MAX + 1) : ((p)->p_nice - PUSER)) #define SET_NICE(p,n) { if (!((p)->p_pvprocp->pv_flag3 & SFIXPRI)) { (p)->p_nice = (MIN(P_NICE_MAX,MAX(0,(n)))) + PUSER; } } extern Simple_lock crid_lock; extern Simple_lock ptrace_lock; extern Complex_lock core_lock; extern Simple_lock time_lock; extern Simple_lock uidinfo_lock; extern Simple_lock uex_lock; extern Simple_lock suspending_q_lock; struct proch { struct proch *next; void (*handler)(); }; #define PROCH_INITIALIZE 1 #define PROCH_TERMINATE 2 #define PROCH_SWAPOUT 3 #define PROCH_SWAPIN 4 #define PROCH_EXEC 5 #define PROCH_LOAD 6 #define PROCH_UNLOAD 7 #define THREAD_INITIALIZE 11 #define THREAD_TERMINATE 12 #define PROCH_SETUID 13 #define PROCH_SETGID 14 #define PROCH_EXECEXIT 15 #define PROCH_RESTART 16 #define THREAD_LOCAL_INIT 17 #define THREAD_LOCAL_TERM 18 #define THREAD_LOCAL_DISPATCH 19 #define THREAD_LOCAL_MCHANGE 20 #define NONCRITFORK 1 struct prochr { struct prochr *prochr_next; void (*prochr_handler)(); uint prochr_mask; int pad; }; typedef struct prochr_execexit { int len; dev_t dev; ino_t ino; uint_t gen; } prochr_execexit_t; #define PROCHR_INITIALIZE (1UL<<PROCH_INITIALIZE) #define PROCHR_TERMINATE (1UL<<PROCH_TERMINATE) #define PROCHR_EXEC (1UL<<PROCH_EXEC) #define PROCHR_THREADINIT (1UL<<THREAD_INITIALIZE) #define PROCHR_THREADTERM (1UL<<THREAD_TERMINATE) #define PROCHR_SETUID (1UL<<PROCH_SETUID) #define PROCHR_SETGID (1UL<<PROCH_SETGID) #define PROCHR_EXECEXIT (1UL<<PROCH_EXECEXIT) #define PROCHR_RESTART (1UL<<PROCH_RESTART) #define PROCHR_TLOCAL_INIT (1UL<<THREAD_LOCAL_INIT) #define PROCHR_TLOCAL_TERM (1UL<<THREAD_LOCAL_TERM) #define PROCHR_TLOCAL_DISPATCH (1UL<<THREAD_LOCAL_DISPATCH) #define PROCHR_TLOCAL_MODE (1UL<<THREAD_LOCAL_MCHANGE) #define PROCHADD_CALLOUTS (PROCHR_INITIALIZE | PROCHR_TERMINATE | PROCHR_EXEC | PROCHR_THREADINIT | PROCHR_THREADTERM) #define FLT_MODULO (1<<16) } #define PMASK 255 #define PCATCH 0x100 #define PSWP 0 #define PRI_SCHED 16 #define PINOD 18 #define PZERO 25 #define PPIPE 26 #define PMSG 27 #define TTIPRI 30 #define TTOPRI 31 #define PWAIT 33 #define PUSER 40 #define PRI_LOW (PIDLE-1) #define PIDLE PMASK #define MBUF_RTPRI 36 #define NETPCL_RTPRI 37 #define HFTSC_RTPRI 38 #define NETTMR_RTPRI 39 #define PRIO_NO_BOOST 0 #define PRIO_TEMP_BOOST 1 #define PRIO_PERM_BOOST 2 #define PRIORITY_MIN PSWP #define PRIORITY_MAX PIDLE #define RR_INTERVAL HZ #define PTHREAD_PRIO_MIN 1 #define PTHREAD_PRIO_MAX 127 #define SCHED_OTHER 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_LOCAL 3 #define SCHED_GLOBAL 4 #define SCHED_FIFO2 5 #define SCHED_FIFO3 6 #define SCHED_FIFO4 7 extern "C" { struct sched_param { int sched_priority; int sched_policy; int sched_reserved[6]; }; struct timespec; int sched_get_priority_max(int); int sched_get_priority_min(int); int sched_getparam(pid_t, struct sched_param *); int sched_getscheduler(pid_t); int sched_rr_get_interval(pid_t, struct timespec *); int sched_setparam(pid_t, const struct sched_param *); int sched_setscheduler(pid_t, int, const struct sched_param *); int sched_yield(void); } #define _H_UNISTD extern "C" { #undef _STD_TYPES_T #define _H_ACCESS #define F_OK 00 #define X_OK 01 #define W_OK 02 #define R_OK 04 #define R_ACC 04 #define W_ACC 02 #define X_ACC 01 #define E_ACC 00 #define NO_ACC 00 #define ACC_SELF 0x00 #define ACC_INVOKER 0x01 #define ACC_OBJ_OWNER 0x02 #define ACC_OBJ_GROUP 0x04 #define ACC_OTHERS 0x08 #define ACC_ANY 0x10 #define ACC_ALL 0x20 #define ACC_PERMIT 0x01 #define ACC_DENY 0x02 #define ACC_SPECIFY 0x03 extern char *acl_get(char *); extern char *acl_fget(int); extern int acl_chg(char *, int, int, int); extern int acl_fchg(int, int, int, int); extern int acl_put(char *, char *, int); extern int acl_fput(int, char *, int); extern int acl_set(char *, int, int, int); extern int acl_fset(int, int, int, int); extern int accessx(char *, int, int); extern int access(const char *, int); extern unsigned int alarm(unsigned int); extern int chdir(const char *); extern int chown(const char *, uid_t, gid_t); extern int close(int); extern char *ctermid(char *); extern int dup(int); extern int dup2(int, int); extern int execl(const char *, const char *, ...); extern int execv(const char *, char *const []); extern int execle(const char *, const char *, ...); extern int execve(const char *, char *const [], char *const []); extern int execlp(const char *, const char *, ...); extern int execvp(const char *, char *const []); extern void _exit(int); extern pid_t fork(void); extern long fpathconf(int, int); extern char *getcwd(char *, size_t); extern gid_t getegid(void); extern uid_t geteuid(void); extern gid_t getgid(void); extern int getgroups(int, gid_t []); extern char *getlogin(void); extern pid_t getpgrp(void); extern pid_t getpid(void); extern pid_t getppid(void); extern uid_t getuid(void); extern int isatty(int); extern int link(const char *, const char *); extern off_t lseek(int, off_t, int); extern off64_t lseek64(int, off64_t, int); extern long pathconf(const char *, int); extern int pause(void); extern int pipe(int []); extern int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); extern ssize_t read(int, void *, size_t); extern int rmdir(const char *); extern int setgid(gid_t); extern int setpgid(pid_t, pid_t); extern pid_t setsid(void); extern int setuid(uid_t); extern unsigned int sleep(unsigned int); extern long sysconf(int); extern pid_t tcgetpgrp(int); extern int tcsetpgrp(int, pid_t); extern char *ttyname(int); extern int unlink(const char *); extern ssize_t write(int, const void *, size_t); #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #define _POSIX_JOB_CONTROL 1 #define _POSIX_SAVED_IDS 1 #define _POSIX_VERSION 200112L #define _POSIX2_VERSION 200112L #define _POSIX2_C_VERSION 200112L #define _XOPEN_VERSION 600 #define _XOPEN_XCU_VERSION 4 #define _XOPEN_XPG3 1 #define _XOPEN_XPG4 1 #define _XOPEN_UNIX 1 #define _XOPEN_REALTIME (-1) #define _XOPEN_REALTIME_THREADS (-1) #define _XOPEN_STREAMS 1 #define _XBS5_ILP32_OFF32 1 #define _XBS5_ILP32_OFFBIG 1 #define _XBS5_LP64_OFF64 1 #define _XBS5_LPBIG_OFFBIG 1 #define _POSIX2_C_BIND 200112L #define _POSIX2_C_DEV 200112L #define _POSIX2_CHAR_TERM 200112L #define _POSIX2_LOCALEDEF 200112L #define _POSIX2_UPE 200112L #define _POSIX2_FORT_DEV (-1) #define _POSIX2_FORT_RUN (-1) #define _POSIX2_SW_DEV (-1) #define _POSIX_REGEXP 1 #define _POSIX_SHELL 1 #define _POSIX2_PBS (-1) #define _POSIX2_PBS_ACCOUNTING (-1) #define _POSIX2_PBS_CHECKPOINT (-1) #define _POSIX2_PBS_LOCATE (-1) #define _POSIX2_PBS_MESSAGE (-1) #define _POSIX2_PBS_TRACK (-1) #define _V6_ILP32_OFF32 1 #define _V6_ILP32_OFFBIG 1 #define _V6_LP64_OFF64 1 #define _V6_LPBIG_OFFBIG 1 #define _POSIX_ADVISORY_INFO 200112L #define _POSIX_BARRIERS 200112L #define _POSIX_CLOCK_SELECTION 200112L #define _POSIX_CPUTIME 200112L #define _POSIX_MONOTONIC_CLOCK 200112L #define _POSIX_SPAWN 200112L #define _POSIX_SPIN_LOCKS 200112L #define _POSIX_SPORADIC_SERVER (-1) #define _POSIX_THREAD_CPUTIME 200112L #define _POSIX_THREAD_SPORADIC_SERVER (-1) #define _POSIX_TIMEOUTS 200112L #define _POSIX_TRACE (-1) #define _POSIX_TRACE_EVENT_FILTER (-1) #define _POSIX_TRACE_INHERIT (-1) #define _POSIX_TRACE_LOG (-1) #define _POSIX_TYPED_MEMORY_OBJECTS (-1) #define _XOPEN_CRYPT 1 #define _XOPEN_SHM 1 #define _XOPEN_ENH_I18N 1 #define _XOPEN_LEGACY (-1) #define _UNIX_ABI (-1) #define _UNIX_ABI_IA64 (-1) #define _UNIX_ABI_BIG_ENDIAN (-1) #define _UNIX_ABI_LITTLE_ENDIAN (-1) extern char *optarg; extern int optind, opterr, optopt; extern size_t confstr(int, char*, size_t); extern char *crypt(const char *, const char *); extern void encrypt(char *, int); extern int fsync(int); extern int getopt(int, char* const*, const char*); extern int nice(int); extern void swab(const void *, void *, ssize_t); extern int fdatasync(int); extern char *getpass(const char *); extern int chroot(const char *); #define _POSIX_THREADS 200112L #define _POSIX_THREAD_ATTR_STACKADDR 200112L #define _POSIX_THREAD_ATTR_STACKSIZE 200112L #define _POSIX_THREAD_PROCESS_SHARED 200112L #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L #define _POSIX_REENTRANT_FUNCTIONS _POSIX_THREAD_SAFE_FUNCTIONS #define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) #define _POSIX_THREAD_PRIO_INHERIT (-1) #define _POSIX_THREAD_PRIO_PROTECT (-1) #undef _POSIX_THREAD_FORKALL #define _POSIX_ASYNCHRONOUS_IO 200112L #define _POSIX_FSYNC 200112L #define _POSIX_MAPPED_FILES 200112L #define _POSIX_MEMLOCK 200112L #define _POSIX_MEMLOCK_RANGE 200112L #define _POSIX_MEMORY_PROTECTION 200112L #define _POSIX_MESSAGE_PASSING 200112L #define _POSIX_PRIORITIZED_IO 200112L #define _POSIX_PRIORITY_SCHEDULING 200112L #define _POSIX_REALTIME_SIGNALS 200112L #define _POSIX_SEMAPHORES 200112L #define _POSIX_SHARED_MEMORY_OBJECTS 200112L #define _POSIX_SYNCHRONIZED_IO 200112L #define _POSIX_TIMERS 200112L #define _POSIX_ASYNC_IO (-1) #undef _POSIX_SYNC_IO #define _POSIX_PRIO_IO (-1) #define _POSIX_CHOWN_RESTRICTED 0 #define _POSIX_VDISABLE 0xFF #define _POSIX_NO_TRUNC 0 #define _POSIX_IPV6 200112L #define _POSIX_RAW_SOCKETS 200112L #define _POSIX_READER_WRITER_LOCKS 200112L #define _CS_PATH 1 #define _CS_XBS5_ILP32_OFF32_CFLAGS 2 #define _CS_XBS5_ILP32_OFF32_LDFLAGS 3 #define _CS_XBS5_ILP32_OFF32_LIBS 4 #define _CS_XBS5_ILP32_OFF32_LINTFLAGS 5 #define _CS_XBS5_ILP32_OFFBIG_CFLAGS 6 #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 7 #define _CS_XBS5_ILP32_OFFBIG_LIBS 8 #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 9 #define _CS_XBS5_LP64_OFF64_CFLAGS 10 #define _CS_XBS5_LP64_OFF64_LDFLAGS 11 #define _CS_XBS5_LP64_OFF64_LIBS 12 #define _CS_XBS5_LP64_OFF64_LINTFLAGS 13 #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 14 #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 15 #define _CS_XBS5_LPBIG_OFFBIG_LIBS 16 #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 17 #define _CS_AIX_BOOTDEV 24 #define _CS_AIX_MODEL_CODE 25 #define _CS_AIX_ARCHITECTURE 26 #define _CS_AIX_MODEL_CLASS 40 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 27 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 28 #define _CS_POSIX_V6_ILP32_OFF32_LIBS 29 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 30 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 31 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 32 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 33 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 34 #define _CS_POSIX_V6_LP64_OFF64_LIBS 35 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 36 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 37 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 38 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 39 #define _CSPATH "/usr/bin:/usr/vac/bin" #define _CSPOSIX_V6_ILP32_OFF32_CFLAGS "-q32" #define _CSXBS5_ILP32_OFF32_CFLAGS _CSPOSIX_V6_ILP32_OFF32_CFLAGS #define _CSPOSIX_V6_ILP32_OFF32_LDFLAGS "-b32" #define _CSXBS5_ILP32_OFF32_LDFLAGS _CSPOSIX_V6_ILP32_OFF32_LDFLAGS #define _CSPOSIX_V6_ILP32_OFF32_LIBS "-lc -lpthread -lm" #define _CSXBS5_ILP32_OFF32_LIBS _CSPOSIX_V6_ILP32_OFF32_LIBS #define _CSXBS5_ILP32_OFF32_LINTFLAGS "" #define _CSPOSIX_V6_ILP32_OFFBIG_CFLAGS "-q32 -D_LARGE_FILES -qlonglong" #define _CSXBS5_ILP32_OFFBIG_CFLAGS _CSPOSIX_V6_ILP32_OFFBIG_CFLAGS #define _CSPOSIX_V6_ILP32_OFFBIG_LDFLAGS "-b32" #define _CSXBS5_ILP32_OFFBIG_LDFLAGS _CSPOSIX_V6_ILP32_OFFBIG_LDFLAGS #define _CSPOSIX_V6_ILP32_OFFBIG_LIBS "-lc -lpthread -lm" #define _CSXBS5_ILP32_OFFBIG_LIBS _CSPOSIX_V6_ILP32_OFFBIG_LIBS #define _CSXBS5_ILP32_OFFBIG_LINTFLAGS "-D_LARGE_FILES -qlonglong" #define _CSPOSIX_V6_LP64_OFF64_CFLAGS "-q64" #define _CSXBS5_LP64_OFF64_CFLAGS _CSPOSIX_V6_LP64_OFF64_CFLAGS #define _CSPOSIX_V6_LP64_OFF64_LDFLAGS "-b64" #define _CSXBS5_LP64_OFF64_LDFLAGS _CSPOSIX_V6_LP64_OFF64_LDFLAGS #define _CSPOSIX_V6_LP64_OFF64_LIBS "-lc -lpthread -lm" #define _CSXBS5_LP64_OFF64_LIBS _CSPOSIX_V6_LP64_OFF64_LIBS #define _CSXBS5_LP64_OFF64_LINTFLAGS "-D__64BIT__" #define _CSPOSIX_V6_LPBIG_OFFBIG_CFLAGS "-q64" #define _CSXBS5_LPBIG_OFFBIG_CFLAGS _CSPOSIX_V6_LPBIG_OFFBIG_CFLAGS #define _CSPOSIX_V6_LPBIG_OFFBIG_LDFLAGS "-b64" #define _CSXBS5_LPBIG_OFFBIG_LDFLAGS _CSPOSIX_V6_LPBIG_OFFBIG_LDFLAGS #define _CSPOSIX_V6_LPBIG_OFFBIG_LIBS "-lc -lpthread -lm" #define _CSXBS5_LPBIG_OFFBIG_LIBS _CSPOSIX_V6_LPBIG_OFFBIG_LIBS #define _CSXBS5_LPBIG_OFFBIG_LINTFLAGS "-D__64BIT__" #define _CSPOSIX_V6_WIDTH_RESTRICTED_ENVS "POSIX_V6_ILP32_OFF32\n" "POSIX_V6_ILP32_OFFBIG\n" "POSIX_V6_LP64_OFF64\n" "POSIX_V6_LPBIG_OFFBIG" #define _PC_CHOWN_RESTRICTED 10 #define _PC_LINK_MAX 11 #define _PC_MAX_CANON 12 #define _PC_MAX_INPUT 13 #define _PC_NAME_MAX 14 #define _PC_NO_TRUNC 15 #define _PC_PATH_MAX 16 #define _PC_PIPE_BUF 17 #define _PC_VDISABLE 18 #define _PC_ASYNC_IO 19 #define _PC_SYNC_IO 20 #define _PC_PRIO_IO 21 #define _PC_FILESIZEBITS 22 #define _PC_AIX_DISK_PARTITION 23 #define _PC_AIX_DISK_SIZE 24 #define _PC_SYMLINK_MAX 25 #define _PC_ALLOC_SIZE_MIN 26 #define _PC_REC_INCR_XFER_SIZE 27 #define _PC_REC_MAX_XFER_SIZE 28 #define _PC_REC_MIN_XFER_SIZE 29 #define _PC_REC_XFER_ALIGN 30 #define _PC_2_SYMLINKS 31 #define _SC_ARG_MAX 0 #define _SC_CHILD_MAX 1 #define _SC_CLK_TCK 2 #define _SC_NGROUPS_MAX 3 #define _SC_OPEN_MAX 4 #define _SC_STREAM_MAX 5 #define _SC_TZNAME_MAX 6 #define _SC_JOB_CONTROL 7 #define _SC_SAVED_IDS 8 #define _SC_VERSION 9 #define _SC_POSIX_ARG_MAX 10 #define _SC_POSIX_CHILD_MAX 11 #define _SC_POSIX_LINK_MAX 12 #define _SC_POSIX_MAX_CANON 13 #define _SC_POSIX_MAX_INPUT 14 #define _SC_POSIX_NAME_MAX 15 #define _SC_POSIX_NGROUPS_MAX 16 #define _SC_POSIX_OPEN_MAX 17 #define _SC_POSIX_PATH_MAX 18 #define _SC_POSIX_PIPE_BUF 19 #define _SC_POSIX_SSIZE_MAX 20 #define _SC_POSIX_STREAM_MAX 21 #define _SC_POSIX_TZNAME_MAX 22 #define _SC_BC_BASE_MAX 23 #define _SC_BC_DIM_MAX 24 #define _SC_BC_SCALE_MAX 25 #define _SC_BC_STRING_MAX 26 #define _SC_EQUIV_CLASS_MAX 27 #define _SC_EXPR_NEST_MAX 28 #define _SC_LINE_MAX 29 #define _SC_RE_DUP_MAX 30 #define _SC_2_VERSION 31 #define _SC_2_C_DEV 32 #define _SC_2_FORT_DEV 33 #define _SC_2_FORT_RUN 34 #define _SC_2_LOCALEDEF 35 #define _SC_2_SW_DEV 36 #define _SC_POSIX2_BC_BASE_MAX 37 #define _SC_POSIX2_BC_DIM_MAX 38 #define _SC_POSIX2_BC_SCALE_MAX 39 #define _SC_POSIX2_BC_STRING_MAX 40 #define _SC_POSIX2_EQUIV_CLASS_MAX 41 #define _SC_POSIX2_EXPR_NEST_MAX 42 #define _SC_POSIX2_LINE_MAX 43 #define _SC_POSIX2_RE_DUP_MAX 44 #define _SC_PASS_MAX 45 #define _SC_XOPEN_VERSION 46 #define _SC_ATEXIT_MAX 47 #define _SC_PAGE_SIZE 48 #define _SC_AES_OS_VERSION 49 #define _SC_COLL_WEIGHTS_MAX 50 #define _SC_2_C_BIND 51 #define _SC_2_C_VERSION 52 #define _SC_2_UPE 53 #define _SC_2_CHAR_TERM 54 #define _SC_XOPEN_SHM 55 #define _SC_XOPEN_CRYPT 56 #define _SC_XOPEN_ENH_I18N 57 #define _SC_PAGESIZE _SC_PAGE_SIZE #define _SC_IOV_MAX 58 #define _SC_THREAD_SAFE_FUNCTIONS 59 #define _SC_THREADS 60 #define _SC_THREAD_ATTR_STACKADDR 61 #define _SC_THREAD_ATTR_STACKSIZE 62 #define _SC_THREAD_FORKALL 63 #define _SC_THREAD_PRIORITY_SCHEDULING 64 #define _SC_THREAD_PRIO_INHERIT 65 #define _SC_THREAD_PRIO_PROTECT 66 #define _SC_THREAD_PROCESS_SHARED 67 #define _SC_THREAD_KEYS_MAX 68 #define _SC_THREAD_DATAKEYS_MAX _SC_THREAD_KEYS_MAX #define _SC_THREAD_STACK_MIN 69 #define _SC_THREAD_THREADS_MAX 70 #define _SC_NPROCESSORS_CONF 71 #define _SC_NPROCESSORS_ONLN 72 #define _SC_XOPEN_UNIX 73 #define _SC_AIO_LISTIO_MAX 75 #define _SC_AIO_MAX 76 #define _SC_AIO_PRIO_DELTA_MAX 77 #define _SC_ASYNCHRONOUS_IO 78 #define _SC_DELAYTIMER_MAX 79 #define _SC_FSYNC 80 #define _SC_GETGR_R_SIZE_MAX 81 #define _SC_GETPW_R_SIZE_MAX 82 #define _SC_LOGIN_NAME_MAX 83 #define _SC_MAPPED_FILES 84 #define _SC_MEMLOCK 85 #define _SC_MEMLOCK_RANGE 86 #define _SC_MEMORY_PROTECTION 87 #define _SC_MESSAGE_PASSING 88 #define _SC_MQ_OPEN_MAX 89 #define _SC_MQ_PRIO_MAX 90 #define _SC_PRIORITIZED_IO 91 #define _SC_PRIORITY_SCHEDULING 92 #define _SC_REALTIME_SIGNALS 93 #define _SC_RTSIG_MAX 94 #define _SC_SEMAPHORES 95 #define _SC_SEM_NSEMS_MAX 96 #define _SC_SEM_VALUE_MAX 97 #define _SC_SHARED_MEMORY_OBJECTS 98 #define _SC_SIGQUEUE_MAX 99 #define _SC_SYNCHRONIZED_IO 100 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 101 #define _SC_TIMERS 102 #define _SC_TIMER_MAX 103 #define _SC_TTY_NAME_MAX 104 #define _SC_XBS5_ILP32_OFF32 105 #define _SC_XBS5_ILP32_OFFBIG 106 #define _SC_XBS5_LP64_OFF64 107 #define _SC_XBS5_LPBIG_OFFBIG 108 #define _SC_XOPEN_XCU_VERSION 109 #define _SC_XOPEN_REALTIME 110 #define _SC_XOPEN_REALTIME_THREADS 111 #define _SC_XOPEN_LEGACY 112 #define _SC_REENTRANT_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS #define _SC_PHYS_PAGES 113 #define _SC_AVPHYS_PAGES 114 #define _SC_LPAR_ENABLED 115 #define _SC_LARGE_PAGESIZE 116 #define _SC_AIX_KERNEL_BITMODE 117 #define _SC_AIX_REALMEM 118 #define _SC_AIX_HARDWARE_BITMODE 119 #define _SC_AIX_MP_CAPABLE 120 #define _SC_V6_ILP32_OFF32 121 #define _SC_V6_ILP32_OFFBIG 122 #define _SC_V6_LP64_OFF64 123 #define _SC_V6_LPBIG_OFFBIG 124 #define _SC_XOPEN_STREAMS 125 #define _SC_HOST_NAME_MAX 126 #define _SC_REGEXP 127 #define _SC_SHELL 128 #define _SC_SYMLOOP_MAX 129 #define _SC_ADVISORY_INFO 130 #define _SC_FILE_LOCKING 131 #define _SC_2_PBS 132 #define _SC_2_PBS_ACCOUNTING 133 #define _SC_2_PBS_CHECKPOINT 134 #define _SC_2_PBS_LOCATE 135 #define _SC_2_PBS_MESSAGE 136 #define _SC_2_PBS_TRACK 137 #define _SC_BARRIERS 138 #define _SC_CLOCK_SELECTION 139 #define _SC_CPUTIME 140 #define _SC_MONOTONIC_CLOCK 141 #define _SC_READER_WRITER_LOCKS 142 #define _SC_SPAWN 143 #define _SC_SPIN_LOCKS 144 #define _SC_SPORADIC_SERVER 145 #define _SC_THREAD_CPUTIME 146 #define _SC_THREAD_SPORADIC_SERVER 147 #define _SC_TIMEOUTS 148 #define _SC_TRACE 149 #define _SC_TRACE_EVENT_FILTER 150 #define _SC_TRACE_INHERIT 151 #define _SC_TRACE_LOG 152 #define _SC_TYPED_MEMORY_OBJECTS 153 #define _SC_IPV6 154 #define _SC_RAW_SOCKETS 155 #define _SC_SS_REPL_MAX 156 #define _SC_TRACE_EVENT_NAME_MAX 157 #define _SC_TRACE_NAME_MAX 158 #define _SC_TRACE_SYS_MAX 159 #define _SC_TRACE_USER_EVENT_MAX 160 #define _SC_AIX_UKEYS 161 #define _H_LOCKF extern "C" { #define S_ENFMT S_ISGID #define F_ULOCK 0 #define F_LOCK 1 #define F_TLOCK 2 #define F_TEST 3 extern int lockf (int, int, off_t); extern int lockf64 (int, int, off64_t); } extern int brk(void *); extern int getpagesize(void); extern int __fd_getdtablesize(void); static int getdtablesize() { return __fd_getdtablesize(); } extern void *sbrk(intptr_t); extern int fchdir(int); extern int fchown(int, uid_t, gid_t); extern int ftruncate(int, off_t); extern int ftruncate64(int, off64_t); extern int gethostname(char *, size_t); extern long gethostid(void); extern pid_t getpgid(pid_t); extern pid_t getsid(pid_t); extern char *getwd(char *); extern int lchown(const char *, uid_t, gid_t); extern int readlink(const char *, char *, size_t); extern pid_t setpgrp(void); extern int setregid(gid_t, gid_t); extern int setreuid(uid_t, uid_t); extern int symlink(const char *, const char *); extern void sync(void); extern int truncate(const char *, off_t); extern int truncate64(const char *, off64_t); extern useconds_t ualarm(useconds_t, useconds_t); extern int usleep(useconds_t); extern pid_t vfork(void); extern int getlogin_r(char *, size_t); extern int ttyname_r(int, char *, size_t); extern ssize_t pread(int, void *, size_t, off_t); extern ssize_t pwrite(int, const void *, size_t, off_t); extern ssize_t pread64(int, void *, size_t, off64_t); extern ssize_t pwrite64(int, const void *, size_t, off64_t); extern char **environ; extern pid_t f_fork(void); extern char * cuserid(char *); extern int setegid(gid_t); extern int seteuid(uid_t); extern int setrgid(gid_t); extern int setruid(uid_t); extern int ioctl(int, int, ...); extern int setgroups(int, gid_t []); extern int readx(int, char*, unsigned, long); extern int writex(int, char*, unsigned, long); extern off_t fclear(int, off_t); extern int fsync_range(int, int, off_t, off_t); extern off64_t fclear64(int, off64_t); extern int fsync_range64(int, int, off64_t, off64_t); extern offset_t llseek(int, offset_t, int); extern char * getusershell(void); extern void setusershell(void); extern void endusershell(void); extern char * get_current_dir_name(void); extern int sysfs(int, ...); extern int finfo(const char *, int, void *, int32long64_t); extern int ffinfo(int, int, void *, int32long64_t); #define _AES_OS_VERSION 1 } #define PTHREAD_PROCESS_SHARED 0 #define PTHREAD_PROCESS_PRIVATE 1 #define PTHREAD_MUTEX_ERRORCHECK 3 #define PTHREAD_MUTEX_NORMAL 5 #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL #define PTHREAD_MUTEX_RECURSIVE 4 #define PTHREAD_PRIO_DEFAULT 0 #define PTHREAD_PRIO_NONE 1 #define PTHREAD_PRIO_PROTECT 2 #define PTHREAD_PRIO_INHERIT 3 #define PTHREAD_INHERIT_SCHED 0 #define PTHREAD_EXPLICIT_SCHED 1 #define PTHREAD_SCOPE_SYSTEM 0 #define PTHREAD_SCOPE_PROCESS 1 #define PTHREAD_CREATE_DETACHED 1 #define PTHREAD_CREATE_JOINABLE 0 #define PTHREAD_CANCELED ((void *)-1) #define PTHREAD_CANCEL_DISABLE 0 #define PTHREAD_CANCEL_ENABLE 1 #define PTHREAD_CANCEL_DEFERRED 0 #define PTHREAD_CANCEL_ASYNCHRONOUS 1 #define PTHREAD_BARRIER_SERIAL_THREAD 2 #define _PTH_FLAGS_INIT64 2 #define PTHREAD_MUTEX_INITIALIZER {{ 0, 0, 0, 2, 0 }} #define PTHREAD_COND_INITIALIZER {{ 0, 0, 0, 2, 0 }} #define PTHREAD_RWLOCK_INITIALIZER {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }} #define PTHREAD_ONCE_INIT { 0, 0, 0, 0, 0, 0, 0, 2, 0 } #define __(args) args extern int pthread_attr_init (pthread_attr_t *); extern int pthread_attr_destroy (pthread_attr_t *); extern int pthread_attr_setstack (pthread_attr_t *, void *, size_t) ; extern int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *) ; extern int pthread_attr_setstacksize (pthread_attr_t *, size_t) ; extern int pthread_attr_getstacksize (const pthread_attr_t *, size_t *) ; extern int pthread_attr_setstackaddr (pthread_attr_t *, void *) ; extern int pthread_attr_getstackaddr (const pthread_attr_t *, void **) ; extern int pthread_attr_setschedpolicy (pthread_attr_t *, int) ; extern int pthread_attr_getschedpolicy (const pthread_attr_t *, int *) ; extern int pthread_attr_setschedparam (pthread_attr_t *, const struct sched_param *) ; extern int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *) ; extern int pthread_attr_setinheritsched (pthread_attr_t *, int) ; extern int pthread_attr_getinheritsched (const pthread_attr_t *, int *) ; extern int pthread_attr_setdetachstate (pthread_attr_t *, int) ; extern int pthread_attr_getdetachstate (const pthread_attr_t *, int *) ; extern int pthread_attr_setguardsize (pthread_attr_t *, size_t) ; extern int pthread_attr_getguardsize (const pthread_attr_t *, size_t *) ; extern int pthread_setschedparam (pthread_t, int, const struct sched_param *) ; extern int pthread_getschedparam (pthread_t, int *, struct sched_param *) ; extern int pthread_setschedprio (pthread_t, int) ; extern pthread_t pthread_self (void); extern int pthread_create (pthread_t *, const pthread_attr_t *, void *(*)(void *), void *) ; extern int pthread_detach (pthread_t); extern int pthread_join (pthread_t, void **) ; extern void pthread_exit (void *); extern void pthread_cleanup_push (void (*)(void *), void *); extern void pthread_cleanup_pop (int); extern int pthread_cancel (pthread_t); extern int pthread_attr_setscope (pthread_attr_t *, int) ; extern int pthread_attr_getscope (const pthread_attr_t *, int *) ; extern int pthread_equal (pthread_t, pthread_t) ; extern int pthread_kill (pthread_t, int) ; extern int pthread_checkpnt_pending (); #define pthread_equal(t1,t2) ((t1) == (t2)) extern int pthread_getcpuclockid (pthread_t, clockid_t *) ; extern int pthread_mutexattr_init (pthread_mutexattr_t *); extern int pthread_mutexattr_destroy (pthread_mutexattr_t *); extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *, int) ; extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *, int) ; extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *, int) ; extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_settype (pthread_mutexattr_t *, int) ; extern int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *) ; extern int pthread_mutex_destroy (pthread_mutex_t *); extern int pthread_mutex_lock (pthread_mutex_t *); extern int pthread_mutex_timedlock (pthread_mutex_t *, const struct timespec *) ; extern int pthread_mutex_trylock (pthread_mutex_t *); extern int pthread_mutex_unlock (pthread_mutex_t *); extern int pthread_mutex_setprioceiling (pthread_mutex_t *, int, int *) ; extern int pthread_mutex_getprioceiling (const pthread_mutex_t *, int *) ; extern int pthread_condattr_init (pthread_condattr_t *); extern int pthread_condattr_destroy (pthread_condattr_t *); extern int pthread_condattr_getpshared (const pthread_condattr_t *, int *) ; extern int pthread_condattr_setpshared (pthread_condattr_t *, int) ; extern int pthread_condattr_getclock (const pthread_condattr_t *, clockid_t *) ; extern int pthread_condattr_setclock (pthread_condattr_t *, clockid_t) ; extern int pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *) ; extern int pthread_cond_destroy (pthread_cond_t *); extern int pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *) ; extern int pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, const struct timespec *) ; extern int pthread_cond_signal (pthread_cond_t *); extern int pthread_cond_broadcast (pthread_cond_t *); extern int pthread_key_create (pthread_key_t *, void (*)(void *)) ; extern int pthread_key_delete (pthread_key_t); extern void * pthread_getspecific (pthread_key_t); extern int pthread_setspecific (pthread_key_t, const void *) ; extern void pthread_testcancel (void); extern int pthread_setcancelstate (int, int *) ; extern int pthread_setcanceltype (int, int *) ; extern int pthread_once (pthread_once_t *, void (*)(void)) ; extern int pthread_rwlock_destroy (pthread_rwlock_t *); extern int pthread_rwlock_init (pthread_rwlock_t *, const pthread_rwlockattr_t *) ; extern int pthread_rwlock_rdlock (pthread_rwlock_t *); extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *); extern int pthread_rwlock_trywrlock (pthread_rwlock_t *); extern int pthread_rwlock_unlock (pthread_rwlock_t *); extern int pthread_rwlock_wrlock (pthread_rwlock_t *); extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *); extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *, int *) ; extern int pthread_rwlockattr_init (pthread_rwlockattr_t *); extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *, int) ; extern int pthread_atfork (void (*)(void), void (*)(void), void (*)(void)); extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *, const struct timespec *) ; extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *, const struct timespec *) ; extern int pthread_getconcurrency (void); extern int pthread_setconcurrency (int); extern int pthread_spin_init (pthread_spinlock_t *, int) ; extern int pthread_spin_destroy (pthread_spinlock_t *); extern int pthread_spin_lock (pthread_spinlock_t *); extern int pthread_spin_unlock (pthread_spinlock_t *); extern int pthread_spin_trylock (pthread_spinlock_t *); extern int pthread_barrierattr_init (pthread_barrierattr_t *); extern int pthread_barrierattr_destroy (pthread_barrierattr_t *); extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *, int *) ; extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *, int) ; extern int pthread_barrier_init (pthread_barrier_t *, const pthread_barrierattr_t *, unsigned) ; extern int pthread_barrier_destroy (pthread_barrier_t *); extern int pthread_barrier_wait (pthread_barrier_t *); extern int __pthread_trace; extern int __n_pthreads; #define LOG_GENERAL 1 #define LOG_LOCKS 2 #define LOG_DATA 4 #define LOG_CREATE 8 #define LOG_USCHED 16 #define LOG_CANCEL 32 #define LOG_SIGNAL 64 #define LOG_SUSPEND 128 #define LOG_MRQ 256 #define LOG_MRQ1 512 #define LOG_HANG 1024 #define LOG_LOCKBOOST 2048 #define MUTEX_FAST_NP 2 #define MUTEX_RECURSIVE_NP 1 #define MUTEX_NONRECURSIVE_NP 0 #define DEFAULT_SCHED SCHED_OTHER #define DEFAULT_PRIO PTHREAD_PRIO_MIN #define DEFAULT_INHERIT PTHREAD_INHERIT_SCHED #define PTHREAD_SCOPE_GLOBAL PTHREAD_SCOPE_SYSTEM #define PTHREAD_SCOPE_LOCAL PTHREAD_SCOPE_PROCESS #define DEFAULT_SCOPE PTHREAD_SCOPE_LOCAL #define PTHREAD_CREATE_UNDETACHED 0 #define PTHREAD_CREATE_SUSPENDED_NP 1 #define PTHREAD_CREATE_UNSUSPENDED_NP 0 #define DEFAULT_DETACHSTATE PTHREAD_CREATE_JOINABLE #define pthread_mutex_getowner_np(mutex) ((mutex)->__mt_word[4]) #define PTHREAD_SPECIFIC_DATA PAGESIZE #define APTHREAD_DATAKEYS_MAX (PTHREAD_SPECIFIC_DATA / 8) #define PTHREAD_STACK_MIN_NP (PAGESIZE * 2) #undef PTHREAD_THREADS_MAX #define PTHREAD_THREADS_MAX 512 struct __pthrdscontext { unsigned long long __pc_gpr[32]; unsigned long long __pc_msr; unsigned long long __pc_iar; unsigned long long __pc_lr; unsigned long long __pc_ctr; unsigned int __pc_cr; unsigned int __pc_xer; unsigned int __pc_fpscr; unsigned int __pc_fpscrx; unsigned long long __pc_except[1]; double __pc_fpr[32]; char __pc_fpeu; char __pc_fpinfo; unsigned char __pc_fpscr24_31; unsigned char __pc_pad; unsigned int __pc_mq; int __pc_excp_type; }; struct __pthrdsinfo { unsigned long long __pi_handle; pthread_t __pi_ptid; tid_t __pi_tid; int __pi_state; int __pi_suspendstate; void * __pi_exit; unsigned long __pi_ustk; void * __pi_func; void * __pi_arg; unsigned int __pi_siglevel; unsigned int __pi_frame_count; char * __pi_stackaddr; char * __pi_stackend; size_t __pi_stacksize; ulong __pi_pad[13]; struct __pthrdscontext __pi_context; }; struct __pthrdsinfox { struct __pthrdsinfo __pi; __extctx_t __pi_ec; }; typedef struct __pthrdstlsinfo { void *pti_vaddr; int pti_region; } PTHRDS_TLS_INFO; struct __pthrdscreds { uint __pc_flags; cred_ext_t __pc_cred; int __pc_reserved[9]; }; #define __pi_suspended __pi_suspendstate #define __pi_returned __pi_exit #define PTHRDSINFO_STATE_NOTSUP 0x00000100 #define PTHRDSINFO_STATE_IDLE 0x00000004 #define PTHRDSINFO_STATE_RUN 0x00000001 #define PTHRDSINFO_STATE_SLEEP 0x00000008 #define PTHRDSINFO_STATE_READY 0x00000002 #define PTHRDSINFO_STATE_TERM 0x00000010 #define PTHRDSINFO_SUSPENDSTATE_NOTSUP 0x00000100 #define PTHRDSINFO_SUSPENDSTATE_SUSPENDED 0x00000001 #define PTHRDSINFO_SUSPENDSTATE_UNSUSPENDED 0x00000000 #define PTHRDSINFO_SIGCTX_BASE ((unsigned int)-1) #define PTHRDSINFO_SIGCTX_INVALID ((unsigned int)-1) #define PTHRDSINFO_QUERY_GPRS 0x00000001 #define PTHRDSINFO_QUERY_SPRS 0x00000002 #define PTHRDSINFO_QUERY_FPRS 0x00000004 #define PTHRDSINFO_QUERY_REGS 0x0000000F #define PTHRDSINFO_QUERY_TID 0x00000010 #define PTHRDSINFO_QUERY_ALL 0x0000001F #define PTHRDSINFO_QUERY_SIGCTX 0x00000100 #define PTHRDSINFO_QUERY_EXTCTX 0x00000200 #define PTHRDSINFO_QUERY_TLS 0x00000400 #define PTHRDSINFO_RUSAGE_START 0x00000001 #define PTHRDSINFO_RUSAGE_STOP 0x00000002 #define PTHRDSINFO_RUSAGE_COLLECT 0x00000004 #define PTHRDSCREDS_INHERIT_UIDS 0x00000001 #define PTHRDSCREDS_INHERIT_GIDS 0x00000010 #define PTHRDSCREDS_INHERIT_GSETS 0x00000100 #define PTHRDSCREDS_INHERIT_CAPS 0x00001000 #define PTHRDSCREDS_INHERIT_PRIVS 0x00010000 #define PTHRDSCREDS_INHERIT_ALL 0x00011111 extern void __funcblock_np(); extern int pthread_getunique_np (pthread_t *, int *) ; extern int pthread_mutexattr_getkind_np (pthread_mutexattr_t *, int *) ; extern int pthread_geteffectiveprio_np (pthread_t , int *) ; extern int pthread_mutexattr_setkind_np (pthread_mutexattr_t *, int) ; extern int pthread_set_mutexattr_default_np (int); extern int pthread_signal_to_cancel_np (sigset_t *, pthread_t *) ; extern int pthread_delay_np (struct timespec *); extern int pthread_get_expiration_np (struct timespec *, struct timespec *) ; extern void pthread_lock_global_np (void); extern void pthread_unlock_global_np (void); extern int pthread_atfork_np (void *, void (*)(void *), void (*)(void *), void (*)(void *)) ; #define PTHREAD_ATFORK_ARGUMENT 0x00000001 #define PTHREAD_ATFORK_ALL 0x00000002 extern int pthread_atfork_unregister_np (void *, void (*)(), void (*)(), void (*)(), int) ; extern int pthread_test_exit_np (int *); extern void pthread_clear_exit_np (pthread_t); extern int pthread_setcancelstate_np (int, int *) ; extern int pthread_join_np (pthread_t, void **) ; extern void pthread_cleanup_push_np (void (*)(void *), void *, pthread_t *) ; extern void pthread_cleanup_pop_np (int, pthread_t) ; extern int pthread_cleanup_information_np (pthread_t, void *, tid_t *, void *, pthread_t *) ; extern int pthread_create_withcred_np (pthread_t *, const pthread_attr_t *, void *(*)(void *), void *, struct __pthrdscreds *) ; extern int sigthreadmask (int, const sigset_t *, sigset_t *) ; extern int pthread_attr_setsuspendstate_np (pthread_attr_t *, int) ; extern int pthread_attr_getsuspendstate_np (const pthread_attr_t *, int *) ; extern int pthread_suspend_np (pthread_t); extern int pthread_suspend_others_np (void); extern int pthread_suspend (pthread_t); extern int pthread_continue_np (pthread_t); extern int pthread_unsuspend_np (pthread_t); extern int pthread_continue_others_np (void); extern int pthread_unsuspend_others_np (void); extern int pthread_continue (pthread_t); extern int pthread_attr_setstacksize_np (pthread_attr_t *, size_t) ; extern int pthread_attr_setukeyset_np (pthread_attr_t *, unsigned long long *) ; extern int pthread_attr_getukeyset_np (const pthread_attr_t *, unsigned long long *) ; extern int pthread_getthrds_np (pthread_t *, int, struct __pthrdsinfo *, int, void *, int *) ; extern int pthread_getrusage_np (pthread_t, struct rusage *, int) ; #undef __ } 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; #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER #define __GTHREAD_TIME_INIT {0,0} #define __gthrw2(name,name2,type) #define __gthrw_(name) name #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) static inline int __gthread_active_p (void) { return 1; } static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return pthread_create (__threadid, (0), __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return pthread_join (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return pthread_detach (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return ((__t1) == (__t2)); } static inline __gthread_t __gthread_self (void) { return pthread_self (); } static inline int __gthread_yield (void) { return sched_yield (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return pthread_once (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return pthread_key_create (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return pthread_key_delete (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return pthread_getspecific (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return pthread_setspecific (__key, __ptr); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_destroy (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_lock (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_trylock (__mutex); else return 0; } static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return pthread_mutex_timedlock (__mutex, __abs_timeout); else return 0; } static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_unlock (__mutex); else return 0; } static inline int __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { if (__gthread_active_p ()) { pthread_mutexattr_t __attr; int __r; __r = pthread_mutexattr_init (&__attr); if (!__r) __r = pthread_mutexattr_settype (&__attr, 4); if (!__r) __r = pthread_mutex_init (__mutex, &__attr); if (!__r) __r = pthread_mutexattr_destroy (&__attr); return __r; } 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_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_mutex_timedlock (__mutex, __abs_timeout); } static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return pthread_cond_broadcast (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return pthread_cond_signal (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return 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 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_timedwait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return pthread_cond_destroy (__cond); } namespace std { template<typename _CharT, typename _Traits, typename _Alloc> class basic_string { typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; 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 typename _CharT_alloc_type::reference reference; typedef typename _CharT_alloc_type::const_reference const_reference; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator; typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string> const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; private: struct _Rep_base { size_type _M_length; size_type _M_capacity; _Atomic_word _M_refcount; }; struct _Rep : _Rep_base { typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc; static const size_type _S_max_size; static const _CharT _S_terminal; static size_type _S_empty_rep_storage[]; static _Rep& _S_empty_rep() { void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage); return *reinterpret_cast<_Rep*>(__p); } bool _M_is_leaked() const { return this->_M_refcount < 0; } bool _M_is_shared() const { return this->_M_refcount > 0; } void _M_set_leaked() { this->_M_refcount = -1; } void _M_set_sharable() { this->_M_refcount = 0; } void _M_set_length_and_sharable(size_type __n) { if (__builtin_expect(this != &_S_empty_rep(), false)) { this->_M_set_sharable(); this->_M_length = __n; traits_type::assign(this->_M_refdata()[__n], _S_terminal); } } _CharT* _M_refdata() throw() { return reinterpret_cast<_CharT*>(this + 1); } _CharT* _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2) { return (!_M_is_leaked() && __alloc1 == __alloc2) ? _M_refcopy() : _M_clone(__alloc1); } static _Rep* _S_create(size_type, size_type, const _Alloc&); void _M_dispose(const _Alloc& __a) { if (__builtin_expect(this != &_S_empty_rep(), false)) { ; if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) { ; _M_destroy(__a); } } } void _M_destroy(const _Alloc&) throw(); _CharT* _M_refcopy() throw() { if (__builtin_expect(this != &_S_empty_rep(), false)) __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1); return _M_refdata(); } _CharT* _M_clone(const _Alloc&, size_type __res = 0); }; struct _Alloc_hider : _Alloc { _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) { } _CharT* _M_p; }; public: static const size_type npos = static_cast<size_type>(-1); private: mutable _Alloc_hider _M_dataplus; _CharT* _M_data() const { return _M_dataplus._M_p; } _CharT* _M_data(_CharT* __p) { return (_M_dataplus._M_p = __p); } _Rep* _M_rep() const { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); } iterator _M_ibegin() const { return iterator(_M_data()); } iterator _M_iend() const { return iterator(_M_data() + this->size()); } void _M_leak() { if (!_M_rep()->_M_is_leaked()) _M_leak_hard(); } size_type _M_check(size_type __pos, const char* __s) const { if (__pos > this->size()) __throw_out_of_range((__s)); return __pos; } void _M_check_length(size_type __n1, size_type __n2, const char* __s) const { if (this->max_size() - (this->size() - __n1) < __n2) __throw_length_error((__s)); } size_type _M_limit(size_type __pos, size_type __off) const { const bool __testoff = __off < this->size() - __pos; return __testoff ? __off : this->size() - __pos; } bool _M_disjunct(const _CharT* __s) const { return (less<const _CharT*>()(__s, _M_data()) || less<const _CharT*>()(_M_data() + this->size(), __s)); } static void _M_copy(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::copy(__d, __s, __n); } static void _M_move(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::move(__d, __s, __n); } static void _M_assign(_CharT* __d, size_type __n, _CharT __c) { if (__n == 1) traits_type::assign(*__d, __c); else traits_type::assign(__d, __n, __c); } template<class _Iterator> static void _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) { for (; __k1 != __k2; ++__k1, ++__p) traits_type::assign(*__p, *__k1); } static void _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) { _M_copy(__p, __k1, __k2 - __k1); } static void _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) { _M_copy(__p, __k1, __k2 - __k1); } static int _S_compare(size_type __n1, size_type __n2) { const difference_type __d = difference_type(__n1 - __n2); if (__d > __gnu_cxx::__numeric_traits<int>::__max) return __gnu_cxx::__numeric_traits<int>::__max; else if (__d < __gnu_cxx::__numeric_traits<int>::__min) return __gnu_cxx::__numeric_traits<int>::__min; else return int(__d); } void _M_mutate(size_type __pos, size_type __len1, size_type __len2); void _M_leak_hard(); static _Rep& _S_empty_rep() { return _Rep::_S_empty_rep(); } public: basic_string() : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } explicit basic_string(const _Alloc& __a); basic_string(const basic_string& __str); basic_string(const basic_string& __str, size_type __pos, size_type __n = npos); basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a); basic_string(const _CharT* __s, size_type __n, const _Alloc& __a = _Alloc()); basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()); basic_string(basic_string&& __str) noexcept : _M_dataplus(__str._M_dataplus) { __str._M_data(_S_empty_rep()._M_refdata()); } basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()); template<class _InputIterator> basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc()); ~basic_string() noexcept { _M_rep()->_M_dispose(this->get_allocator()); } basic_string& operator=(const basic_string& __str) { return this->assign(__str); } basic_string& operator=(const _CharT* __s) { return this->assign(__s); } basic_string& operator=(_CharT __c) { this->assign(1, __c); return *this; } basic_string& operator=(basic_string&& __str) { this->swap(__str); return *this; } basic_string& operator=(initializer_list<_CharT> __l) { this->assign(__l.begin(), __l.size()); return *this; } iterator begin() noexcept { _M_leak(); return iterator(_M_data()); } const_iterator begin() const noexcept { return const_iterator(_M_data()); } iterator end() noexcept { _M_leak(); return iterator(_M_data() + this->size()); } const_iterator end() const noexcept { return const_iterator(_M_data() + this->size()); } reverse_iterator rbegin() noexcept { return reverse_iterator(this->end()); } const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(this->end()); } reverse_iterator rend() noexcept { return reverse_iterator(this->begin()); } const_reverse_iterator rend() const noexcept { return const_reverse_iterator(this->begin()); } const_iterator cbegin() const noexcept { return const_iterator(this->_M_data()); } const_iterator cend() const noexcept { return const_iterator(this->_M_data() + this->size()); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(this->end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(this->begin()); } public: size_type size() const noexcept { return _M_rep()->_M_length; } size_type length() const noexcept { return _M_rep()->_M_length; } size_type max_size() const noexcept { return _Rep::_S_max_size; } void resize(size_type __n, _CharT __c); void resize(size_type __n) { this->resize(__n, _CharT()); } void shrink_to_fit() { if (capacity() > size()) { try { reserve(0); } catch(...) { } } } size_type capacity() const noexcept { return _M_rep()->_M_capacity; } void reserve(size_type __res_arg = 0); void clear() noexcept { _M_mutate(0, this->size(), 0); } bool empty() const noexcept { return this->size() == 0; } const_reference operator[] (size_type __pos) const { ; return _M_data()[__pos]; } reference operator[](size_type __pos) { ; ; _M_leak(); return _M_data()[__pos]; } const_reference at(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(("basic_string::at")); return _M_data()[__n]; } reference front() { return operator[](0); } const_reference front() const { return operator[](0); } reference back() { return operator[](this->size() - 1); } const_reference back() const { return operator[](this->size() - 1); } reference at(size_type __n) { if (__n >= size()) __throw_out_of_range(("basic_string::at")); _M_leak(); return _M_data()[__n]; } basic_string& operator+=(const basic_string& __str) { return this->append(__str); } basic_string& operator+=(const _CharT* __s) { return this->append(__s); } basic_string& operator+=(_CharT __c) { this->push_back(__c); return *this; } basic_string& operator+=(initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.size()); } basic_string& append(const basic_string& __str); basic_string& append(const basic_string& __str, size_type __pos, size_type __n); basic_string& append(const _CharT* __s, size_type __n); basic_string& append(const _CharT* __s) { ; return this->append(__s, traits_type::length(__s)); } basic_string& append(size_type __n, _CharT __c); basic_string& append(initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.size()); } template<class _InputIterator> basic_string& append(_InputIterator __first, _InputIterator __last) { return this->replace(_M_iend(), _M_iend(), __first, __last); } void push_back(_CharT __c) { const size_type __len = 1 + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); traits_type::assign(_M_data()[this->size()], __c); _M_rep()->_M_set_length_and_sharable(__len); } basic_string& assign(const basic_string& __str); basic_string& assign(basic_string&& __str) { this->swap(__str); return *this; } basic_string& assign(const basic_string& __str, size_type __pos, size_type __n) { return this->assign(__str._M_data() + __str._M_check(__pos, "basic_string::assign"), __str._M_limit(__pos, __n)); } basic_string& assign(const _CharT* __s, size_type __n); basic_string& assign(const _CharT* __s) { ; return this->assign(__s, traits_type::length(__s)); } basic_string& assign(size_type __n, _CharT __c) { return _M_replace_aux(size_type(0), this->size(), __n, __c); } template<class _InputIterator> basic_string& assign(_InputIterator __first, _InputIterator __last) { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } basic_string& assign(initializer_list<_CharT> __l) { return this->assign(__l.begin(), __l.size()); } void insert(iterator __p, size_type __n, _CharT __c) { this->replace(__p, __p, __n, __c); } template<class _InputIterator> void insert(iterator __p, _InputIterator __beg, _InputIterator __end) { this->replace(__p, __p, __beg, __end); } void insert(iterator __p, initializer_list<_CharT> __l) { ; this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); } basic_string& insert(size_type __pos1, const basic_string& __str) { return this->insert(__pos1, __str, size_type(0), __str.size()); } basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { return this->insert(__pos1, __str._M_data() + __str._M_check(__pos2, "basic_string::insert"), __str._M_limit(__pos2, __n)); } basic_string& insert(size_type __pos, const _CharT* __s, size_type __n); basic_string& insert(size_type __pos, const _CharT* __s) { ; return this->insert(__pos, __s, traits_type::length(__s)); } basic_string& insert(size_type __pos, size_type __n, _CharT __c) { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), size_type(0), __n, __c); } iterator insert(iterator __p, _CharT __c) { ; const size_type __pos = __p - _M_ibegin(); _M_replace_aux(__pos, size_type(0), size_type(1), __c); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } basic_string& erase(size_type __pos = 0, size_type __n = npos) { _M_mutate(_M_check(__pos, "basic_string::erase"), _M_limit(__pos, __n), size_type(0)); return *this; } iterator erase(iterator __position) { ; const size_type __pos = __position - _M_ibegin(); _M_mutate(__pos, size_type(1), size_type(0)); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } iterator erase(iterator __first, iterator __last); basic_string& replace(size_type __pos, size_type __n, const basic_string& __str) { return this->replace(__pos, __n, __str._M_data(), __str.size()); } basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { return this->replace(__pos1, __n1, __str._M_data() + __str._M_check(__pos2, "basic_string::replace"), __str._M_limit(__pos2, __n2)); } basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2); basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s) { ; return this->replace(__pos, __n1, __s, traits_type::length(__s)); } basic_string& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), _M_limit(__pos, __n1), __n2, __c); } basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str) { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { ; return this->replace(__i1, __i2, __s, traits_type::length(__s)); } basic_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { ; return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); } template<class _InputIterator> basic_string& replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2) { ; ; typedef typename std::__is_integer<_InputIterator>::__type _Integral; return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); } basic_string& replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, initializer_list<_CharT> __l) { return this->replace(__i1, __i2, __l.begin(), __l.end()); } private: template<class _Integer> basic_string& _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, _Integer __val, __true_type) { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } template<class _InputIterator> basic_string& _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, __false_type); basic_string& _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c); basic_string& _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2); template<class _InIterator> static _CharT* _S_construct_aux(_InIterator __beg, _InIterator __end, const _Alloc& __a, __false_type) { typedef typename iterator_traits<_InIterator>::iterator_category _Tag; return _S_construct(__beg, __end, __a, _Tag()); } template<class _Integer> static _CharT* _S_construct_aux(_Integer __beg, _Integer __end, const _Alloc& __a, __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<class _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()); } template<class _InIterator> static _CharT* _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, input_iterator_tag); template<class _FwdIterator> static _CharT* _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, forward_iterator_tag); static _CharT* _S_construct(size_type __req, _CharT __c, const _Alloc& __a); public: size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const; void swap(basic_string& __s); const _CharT* c_str() const noexcept { return _M_data(); } const _CharT* data() const noexcept { return _M_data(); } allocator_type get_allocator() const noexcept { return _M_dataplus; } size_type find(const _CharT* __s, size_type __pos, size_type __n) const; size_type find(const basic_string& __str, size_type __pos = 0) const noexcept { return this->find(__str.data(), __pos, __str.size()); } size_type find(const _CharT* __s, size_type __pos = 0) const { ; return this->find(__s, __pos, traits_type::length(__s)); } size_type find(_CharT __c, size_type __pos = 0) const noexcept; size_type rfind(const basic_string& __str, size_type __pos = npos) const noexcept { return this->rfind(__str.data(), __pos, __str.size()); } size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; size_type rfind(const _CharT* __s, size_type __pos = npos) const { ; return this->rfind(__s, __pos, traits_type::length(__s)); } size_type rfind(_CharT __c, size_type __pos = npos) const noexcept; size_type find_first_of(const basic_string& __str, size_type __pos = 0) const noexcept { return this->find_first_of(__str.data(), __pos, __str.size()); } size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { ; return this->find_first_of(__s, __pos, traits_type::length(__s)); } size_type find_first_of(_CharT __c, size_type __pos = 0) const noexcept { return this->find(__c, __pos); } size_type find_last_of(const basic_string& __str, size_type __pos = npos) const noexcept { return this->find_last_of(__str.data(), __pos, __str.size()); } size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { ; return this->find_last_of(__s, __pos, traits_type::length(__s)); } size_type find_last_of(_CharT __c, size_type __pos = npos) const noexcept { return this->rfind(__c, __pos); } size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const noexcept { return this->find_first_not_of(__str.data(), __pos, __str.size()); } size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { ; return this->find_first_not_of(__s, __pos, traits_type::length(__s)); } size_type find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept; size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const noexcept { return this->find_last_not_of(__str.data(), __pos, __str.size()); } size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const { ; return this->find_last_not_of(__s, __pos, traits_type::length(__s)); } size_type find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept; basic_string substr(size_type __pos = 0, size_type __n = npos) const { return basic_string(*this, _M_check(__pos, "basic_string::substr"), __n); } int compare(const basic_string& __str) const { 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(_M_data(), __str.data(), __len); if (!__r) __r = _S_compare(__size, __osize); return __r; } int compare(size_type __pos, size_type __n, const basic_string& __str) const; int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const; int compare(const _CharT* __s) const; int compare(size_type __pos, size_type __n1, const _CharT* __s) const; int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const; }; template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { basic_string<_CharT, _Traits, _Alloc> __str(__lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { basic_string<_CharT, _Traits, _Alloc> __str(__lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) { typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; __string_type __str(__lhs); __str.append(__size_type(1), __rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, basic_string<_CharT, _Traits, _Alloc>&& __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> inline basic_string<_CharT, _Traits, _Alloc> operator+(const _CharT* __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(_CharT __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, 1, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, const _CharT* __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, _CharT __rhs) { return std::move(__lhs.append(1, __rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) == 0; } template<typename _CharT> inline typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type operator==(const basic_string<_CharT>& __lhs, const basic_string<_CharT>& __rhs) { return (__lhs.size() == __rhs.size() && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), __lhs.size())); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) == 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) == 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return !(__lhs == __rhs); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return !(__lhs == __rhs); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return !(__lhs == __rhs); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) < 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) < 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) > 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) > 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) > 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) < 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) <= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) <= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) >= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) >= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) >= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) <= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline void swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>& __rhs) { __lhs.swap(__rhs); } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str); template<> basic_istream<char>& operator>>(basic_istream<char>& __is, basic_string<char>& __str); template<typename _CharT, typename _Traits, typename _Alloc> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Alloc>& __str) { return __ostream_insert(__os, __str.data(), __str.size()); } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); template<typename _CharT, typename _Traits, typename _Alloc> inline basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str) { return getline(__is, __str, __is.widen('\n')); } template<> basic_istream<char>& getline(basic_istream<char>& __in, basic_string<char>& __str, char __delim); template<> basic_istream<wchar_t>& getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str, wchar_t __delim); } #define _STRING_CONVERSIONS_H 1 #define _GLIBCXX_CSTDLIB 1 #define _H_STDLIB extern "C" { typedef struct div_t { int quot; int rem; } div_t; typedef struct ldiv_t { long int quot; long int rem; } ldiv_t; #define EXIT_FAILURE (1) #define EXIT_SUCCESS 0 #define RAND_MAX 32767 extern size_t __getmbcurmax (void); extern int __getmaxdispwidth (void); #define MB_CUR_MAX (__getmbcurmax()) #define __max_disp_width (__getmaxdispwidth()) extern double strtod(const char * , char ** ); extern long int strtol(const char * , char ** , int); extern unsigned long int strtoul(const char * , char ** , int); extern void _Exit(int); extern float strtof(const char * , char ** ); typedef struct lldiv_t { long long int quot; long long int rem ; } lldiv_t; extern long long int atoll(const char *); extern long long int llabs( long long int ); extern lldiv_t lldiv( long long int, long long int ); extern long long int strtoll( const char * , char ** , int ); extern unsigned long long int strtoull( const char * , char ** , int ); #define _STRTOLD static long double strtold(const char * __a, char ** __b) { return ((long double)strtod (__a, __b)); } extern int mblen(const char *, size_t); extern size_t mbstowcs(wchar_t * , const char * , size_t); extern int mbtowc(wchar_t * , const char * , size_t); extern size_t wcstombs(char * , const wchar_t * , size_t); extern int wctomb(char *, const wchar_t); extern double atof(const char *); extern int atoi(const char *); extern long int atol(const char *); extern int rand(void); extern void srand(unsigned int); extern void *calloc(size_t, size_t); extern void free(void *); extern void *malloc(size_t); extern void *realloc(void *, size_t); extern void abort(void); extern int atexit(void (*)(void)); extern void exit(int); extern char *getenv(const char *); extern int system(const char *); extern void *bsearch(const void *, const void *, size_t, size_t, int(*)(const void *,const void *)); extern void qsort(void *, size_t, size_t, int(*)(const void *,const void *)); extern int abs(int); extern struct div_t div(int, int); extern long int labs(long int); extern struct ldiv_t ldiv(long int, long int); extern int posix_memalign(void **,size_t,size_t); #define _H_WAIT #undef _STD_TYPES_T extern "C" { #define _H_SYS_SIGNAL extern "C" { extern void (*signal(int, void (*)(int)))(int); extern int raise(int); typedef int sig_atomic_t; #define SIGMAX64 255 #define SIGMAX32 63 #define SIGMAX SIGMAX32 #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGEMT 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGBUS 10 #define SIGSEGV 11 #define SIGSYS 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGURG 16 #define SIGSTOP 17 #define SIGTSTP 18 #define SIGCONT 19 #define SIGCHLD 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGIO 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGMSG 27 #define SIGWINCH 28 #define SIGPWR 29 #define SIGUSR1 30 #define SIGUSR2 31 #define SIGPROF 32 #define SIGDANGER 33 #define SIGVTALRM 34 #define SIGMIGRATE 35 #define SIGPRE 36 #define SIGVIRT 37 #define SIGALRM1 38 #define SIGWAITING 39 #define SIGRECONFIG 58 #define SIGCPUFAIL 59 #define SIGKAP 60 #define SIGGRANT SIGKAP #define SIGRETRACT 61 #define SIGSOUND 62 #define SIGSAK 63 #define SIGIOINT SIGURG #define SIGAIO SIGIO #define SIGPTY SIGIO #define SIGIOT SIGABRT #define SIGCLD SIGCHLD #define SIGLOST SIGIOT #define SIGPOLL SIGIO #define SIG_DFL (void (*)(int))0 #define SIG_IGN (void (*)(int))1 #define SIG_HOLD (void (*)(int))2 #define SIG_CATCH (void (*)(int))3 #define SIG_ERR (void (*)(int))-1 #define SIG_BLOCK 0 #define SIG_UNBLOCK 1 #define SIG_SETMASK 2 union sigval { void * sival_ptr; int sival_int; }; typedef struct { int si_signo; int si_errno; int si_code; pid_t si_pid; uid_t si_uid; void *si_addr; int si_status; long si_band; union sigval si_value; int __si_flags; int __pad[6]; } siginfo_t; struct sigaction { union { void (*__su_handler)(int); void (*__su_sigaction) (int, siginfo_t *, void *); } sa_union; sigset_t sa_mask; int sa_flags; }; #define sa_handler sa_union.__su_handler #define sa_sigaction sa_union.__su_sigaction #define SA_NOCLDSTOP 0x00000004 struct sigstack { void *ss_sp; int ss_onstack; }; #define SA_ONSTACK 0x00000001 #define SA_RESTART 0x00000008 #define SA_RESETHAND 0x00000002 #define SA_SIGINFO 0x00000100 #define SA_NODEFER 0x00000200 #define SA_NOCLDWAIT 0x00000400 #define SS_ONSTACK 0x00000001 #define SS_DISABLE 0x00000002 #define SI_USER 0 #define SI_UNDEFINED 8 #define SI_EMPTY 9 #define BUS_ADRALN 1 #define BUS_ADRERR 2 #define BUS_OBJERR 3 #define BUS_UEGARD 4 #define CLD_EXITED 10 #define CLD_KILLED 11 #define CLD_DUMPED 12 #define CLD_TRAPPED 13 #define CLD_STOPPED 14 #define CLD_CONTINUED 15 #define FPE_INTDIV 20 #define FPE_INTOVF 21 #define FPE_FLTDIV 22 #define FPE_FLTOVF 23 #define FPE_FLTUND 24 #define FPE_FLTRES 25 #define FPE_FLTINV 26 #define FPE_FLTSUB 27 #define ILL_ILLOPC 30 #define ILL_ILLOPN 31 #define ILL_ILLADR 32 #define ILL_ILLTRP 33 #define ILL_PRVOPC 34 #define ILL_PRVREG 35 #define ILL_COPROC 36 #define ILL_BADSTK 37 #define POLL_IN 40 #define POLL_OUT 41 #define POLL_MSG -3 #define POLL_ERR 43 #define POLL_PRI 44 #define POLL_HUP 45 #define SEGV_MAPERR 50 #define SEGV_ACCERR 51 #define SEGV_KEYERR 52 #define TRAP_BRKPT 60 #define TRAP_TRACE 61 #define SI_QUEUE 71 #define SI_TIMER 72 #define SI_ASYNCIO 73 #define SI_MESGQ 74 #define SI_WPDABR 1 #define SI_FAST_WATCH 2 #define SI_WP_SYSCALL 3 extern int sigmask(int); #define sigmask(__m) (1 << ((__m)-1)) #define _STACK_FLOOR 256 #define MINSIGSTKSZ ((sizeof (ucontext_t))+2*_STACK_FLOOR) #define SIGSTKSZ 4096 struct sigevent { union sigval sigev_value; int sigev_signo; int sigev_notify; void (*sigev_notify_function)(union sigval); pthread_attr_t * sigev_notify_attributes; }; #define SIGEV_NONE 1 #define SIGEV_SIGNAL 2 #define SIGEV_THREAD 3 #define SIGRTMIN 50 #define SIGRTMAX 57 struct osigevent { void *sevt_value; signal_t sevt_signo; }; #define BADSIG SIG_ERR #define SA_OLDSTYLE SA_RESETHAND #define SA_NODUMP 0x00000010 #define SA_PARTDUMP 0x00000020 #define SA_FULLDUMP 0x00000040 #define SA_SIGSETSTYLE 0x00000080 #define sigcontext __sigcontext #define NO_VOLATILE_REGS 0x0001 #define USE_SAVE_AREA 0x0002 #define SIGMASKLO(__s) ( 1 << ((__s) - 1) ) #define SIGMASKHI(__s) ( 1 << (((__s)-32) - 1) ) #define LOW_SIG(__s) ((__s) <= 32 ) #define SIGMASK(__s) (1<<(((__s)-1)%32)) #define SIGFILLSET(__set) { (__set).losigs = ~0; (__set).hisigs = ~0; } #define SIGDELSET(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) &= ~(1<<(((__s)-1)%32));} #define SIGADDSET(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) |= (1<<(((__s)-1)%32));} #define SIGSETEMPTY(__set) (!((__set).losigs) && !((__set).hisigs)) #define SIGISMEMBER(__set,__s) ( (*((&(__set).losigs)+(((__s)-1)/32)) >> (((__s)-1)%32) ) & 1 ) #define SIG_PENDING(__p) (( (__p)->p_sig.losigs & ~((__p)->p_sigignore.losigs | (__p)->p_sigmask.losigs) ) || ( (__p)->p_sig.hisigs & ~((__p)->p_sigignore.hisigs | (__p)->p_sigmask.hisigs) )) #define SIGINITSET(__set) { (__set).losigs = 0; (__set).hisigs = 0; } #define SIGMASKSET(__dest,__mask) { (__dest).losigs &= ~(__mask).losigs; (__dest).hisigs &= ~(__mask).hisigs; } #define SIGORSET(__dest,__mask) { (__dest).losigs |= (__mask).losigs; (__dest).hisigs |= (__mask).hisigs; } #define SIGANDSET(__dest,__m1,__m2) { (__dest).losigs = (__m1).losigs & (__m2).losigs; (__dest).hisigs = (__m1).hisigs & (__m2).hisigs; } #define SIGSETTOLLONG(__set,__ll) { *(int *)&(__ll) = (__set).hisigs; *((int *)&(__ll)+1) = (__set).losigs; } #define LLONGTOSIGSET(__ll,__set) { (__set).hisigs = *(int *)&(__ll); (__set).losigs = *((int *)&(__ll)+1); } #define SIGFILLSET64(__set) { *(__set).ss_set = ~(0ULL); *((__set).ss_set + 1) = ~(0ULL); *((__set).ss_set + 2) = ~(0ULL); *((__set).ss_set + 3) = ~(0ULL); } #define SIGINITSET64(__set) { *(__set).ss_set = 0ULL; *((__set).ss_set + 1) = 0ULL; *((__set).ss_set + 2) = 0ULL; *((__set).ss_set + 3) = 0ULL; } #define SIGDELSET64(__set,__s) {*((__set).ss_set+(((__s)-1)/64)) &= ~(1ULL<<(((__s)-1)%64));} #define SIGADDSET64(__set,__s) {*((__set).ss_set+(((__s)-1)/64)) |= (1ULL<<(((__s)-1)%64));} #define SIGSETEMPTY64(__set) (!*(__set).ss_set && !*((__set).ss_set + 1) && !*((__set).ss_set + 2) && !*((__set).ss_set + 3)) #define SIGISMEMBER64(__set,__s) ((*((__set).ss_set+(((__s)-1)/64)) >> (((__s)-1)%64))&1ULL) #define SIG_PENDING64(__p) (( *(__p)->p_sig & ~(*(__p)->p_sigignore.ss_set | *(__p)->p_sigmask.ss_set) ) || ( *((__p)->p_sig + 1) & ~(*((__p)->p_sigignore.ss_set + 1) | *((__p)->p_sigmask.ss_set + 1))) || ( *((__p)->p_sig + 2) & ~(*((__p)->p_sigignore.ss_set + 2) | *((__p)->p_sigmask.ss_set + 2))) || ( *((__p)->p_sig + 3) & ~(*((__p)->p_sigignore.ss_set + 3) | *((__p)->p_sigmask.ss_set + 3))) ) #define SIGMASKSET64(__dest,__mask) { *(__dest).ss_set &= ~*(__mask).ss_set; *((__dest).ss_set + 1) &= ~*((__mask).ss_set + 1); *((__dest).ss_set + 2) &= ~*((__mask).ss_set + 2); *((__dest).ss_set + 3) &= ~*((__mask).ss_set + 3); } #define SIGORSET64(__dest,__mask) { *(__dest).ss_set |= *(__mask).ss_set; *((__dest).ss_set + 1) |= *((__mask).ss_set + 1); *((__dest).ss_set + 2) |= *((__mask).ss_set + 2); *((__dest).ss_set + 3) |= *((__mask).ss_set + 3); } #define SIGANDSET64(__dest,__m1,__m2) { *(__dest).ss_set = *(__m1).ss_set & *(__m2).ss_set; *((__dest).ss_set + 1) = *((__m1).ss_set + 1) & *((__m2).ss_set + 1); *((__dest).ss_set + 2) = *((__m1).ss_set + 2) & *((__m2).ss_set + 2); *((__dest).ss_set + 3) = *((__m1).ss_set + 3) & *((__m2).ss_set + 3); } #define SIGMASKLO32(__s) ( 1 << ((__s) - 1) ) #define SIGMASKHI32(__s) ( 1 << (((__s)-32) - 1) ) #define LOW_SIG32(__s) ((__s) <= 32 ) #define SIGMASK32(__s) (1<<(((__s)-1)%32)) #define SIGFILLSET32(__set) { (__set).losigs = ~0; (__set).hisigs = ~0; } #define SIGDELSET32(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) &= ~(1<<(((__s)-1)%32));} #define SIGADDSET32(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) |= (1<<(((__s)-1)%32));} #define SIGSETEMPTY32(__set) (!((__set).losigs) && !((__set).hisigs)) #define SIGISMEMBER32(__set,__s) ( (*((&(__set).losigs)+(((__s)-1)/32)) >> (((__s)-1)%32) ) & 1 ) #define SIG_PENDING32(__p) (( (__p)->p_sig.losigs & ~((__p)->p_sigignore.losigs | (__p)->p_sigmask.losigs) ) || ( (__p)->p_sig.hisigs & ~((__p)->p_sigignore.hisigs | (__p)->p_sigmask.hisigs) )) #define SIGINITSET32(__set) { (__set).losigs = 0; (__set).hisigs = 0; } #define SIGMASKSET32(__dest,__mask) { (__dest).losigs &= ~(__mask).losigs; (__dest).hisigs &= ~(__mask).hisigs; } #define SIGORSET32(__dest,__mask) { (__dest).losigs |= (__mask).losigs; (__dest).hisigs |= (__mask).hisigs; } #define SIGANDSET32(__dest,__m1,__m2) { (__dest).losigs = (__m1).losigs & (__m2).losigs; (__dest).hisigs = (__m1).hisigs & (__m2).hisigs; } struct sigvec { union { void (*sv_handler)(int); void (*sv_sigaction) (int, siginfo_t *, void *); } sv_union; int sv_mask; int sv_flags; }; #define sv_onstack sv_flags #define sv_handler sv_union.sv_handler #define sv_sigaction sv_union.sv_sigaction #define NSIG64 (SIGMAX64+1) #define NSIG32 (SIGMAX32+1) #define NSIG NSIG32 #define SIG_STK SA_ONSTACK #define SIG_STD SA_OLDSTYLE #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART #define _OLDSTYLE (SA_OLDSTYLE) #define _ONSTACK (SA_ONSTACK) #define _teststyle(__n) ((__n) & _OLDSTYLE) #define _testonstack(__n) ((__n) & _ONSTACK) #define _setoldstyle(__n) ((__n) | _OLDSTYLE) #define _setnewstyle(__n) ((__n) & ~_OLDSTYLE) #define _setonstack(__n) ((__n) | _ONSTACK) #define _clronstack(__n) ((__n) & ~_ONSTACK) void (*ssignal_r(int, void (*)(int), void (*[])(int)))(int); int gsignal_r(int, void (*[])(int)); #define MAXSIG 16 #define MINSIG (-4) #define TOT_USER_SIG (MAXSIG - MINSIG + 1) extern int sigblock(int); extern int siglocalmask(int, const sigset_t *); extern int sigvec(int, struct sigvec *, struct sigvec *); extern int siggetmask(void); extern int sigsetmask(int); extern int kill(pid_t, int); extern int sigprocmask(int, const sigset_t *, sigset_t *); extern int sigsuspend(const sigset_t *); extern int sigwait(const sigset_t *, int *); extern int sigaction(int, const struct sigaction *, struct sigaction *); extern int sigemptyset(sigset_t *); extern int sigfillset(sigset_t *); extern int sigaddset(sigset_t *, int); extern int sigdelset(sigset_t *, int); extern int sigismember(const sigset_t *, int); extern int sigpending(sigset_t *); extern void (*bsd_signal (int, void (*)(int)))(int); extern int killpg(pid_t, int); extern int sighold(int); extern int sigignore(int); extern int siginterrupt(int, int); extern int sigpause(int); extern int sigrelse(int); extern void (*sigset(int, void(*)(int)))(int); extern int sigaltstack(const stack_t *, stack_t *); extern int sigstack(struct sigstack *, struct sigstack *); extern int pthread_kill(pthread_t, int); extern int pthread_sigmask(int, const sigset_t *, sigset_t *); extern int sigqueue(pid_t, int, const union sigval); struct timespec; extern int sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *); extern int sigwaitinfo(const sigset_t *, siginfo_t *); } #define WNOHANG 0x1 #define WUNTRACED 0x2 #define _W_STOPPED 0x00000040 #define _W_SLWTED 0x0000007c #define _W_SEWTED 0x0000007d #define _W_SFWTED 0x0000007e #define _W_STRC 0x0000007f #define WIFSTOPPED(__x) ((__x) & _W_STOPPED) #define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? (int)((((unsigned int)__x) >> 8) & 0xff) : -1) #define WIFEXITED(__x) (!((__x) & 0xff)) #define WEXITSTATUS(__x) (int)(WIFEXITED(__x) ? (int)((((unsigned int)__x) >> 8) & 0xff) : -1) #define WIFSIGNALED(__x) (!WIFEXITED(__x) && !WIFSTOPPED(__x)) #define WTERMSIG(__x) (int)(WIFSIGNALED(__x) ? (int)((((unsigned int)__x) >> 16) & 0xff) : -1) #define WEXITED 0x04 #define WSTOPPED _W_STOPPED #define _W_OCONTINUED 0x00000008 #define WCONTINUED 0x01000000 #define WNOWAIT 0x10 #define WIFCONTINUED(__x) ((__x) & WCONTINUED) #undef WIFSIGNALED #define WIFSIGNALED(__x) (!WIFEXITED(__x) && !WIFSTOPPED(__x) && !WIFCONTINUED(__x)) typedef enum {P_ALL, P_PID, P_PGID} idtype_t; extern pid_t wait(int *); extern pid_t waitpid(pid_t, int *, int); extern int waitid(idtype_t, id_t, siginfo_t *, int); extern pid_t wait3(int *, int, struct rusage *); extern pid_t kwaitpid(int *, pid_t, int, struct rusage *, siginfo_t *); extern pid_t kwaitpid64(int *, pid_t, int, struct rusage64 *, siginfo_t *); extern pid_t wait364(int *, int, struct rusage64 *); extern pid_t wait4(pid_t, int *, int, struct rusage *); #define W_STOPPED _W_STOPPED #define W_SLWTED _W_SLWTED #define W_SEWTED _W_SEWTED #define W_SFWTED _W_SFWTED #define W_STRC _W_STRC } typedef struct drand48_data { unsigned x[3]; unsigned a[3]; unsigned c; unsigned short lastx[3]; int init; } DRAND48D; extern double drand48(void); extern double erand48(unsigned short[]); extern long jrand48(unsigned short[]); extern void lcong48(unsigned short int *); extern long lrand48(void); extern long mrand48(void); extern long nrand48(unsigned short[]); extern unsigned short *seed48(unsigned short[]); extern void setkey(const char *); extern void srand48(long); extern int putenv(char *); extern int rand_r(unsigned int *); extern int getopt_r( int, char* const*, const char*, int *, char **, int *, int , int *, int *); extern int drand48_r(DRAND48D *, double *); extern int erand48_r(unsigned short [], DRAND48D *, double *); extern int lrand48_r(DRAND48D *, long *); extern int mrand48_r(DRAND48D *, long *); extern int srand48_r(long, DRAND48D *); extern int seed48_r(unsigned short [], DRAND48D *); extern int lcong48_r(unsigned short [], DRAND48D *); extern int nrand48_r(unsigned short [], DRAND48D *, long *); extern int jrand48_r(unsigned short [], DRAND48D *, long *); extern int ecvt_r(double, int, int *, int *, char *, int); extern int fcvt_r(double, int, int *, int *, char *, int); extern long a64l(const char *); extern char *ecvt(double, int, int *, int *); extern char *fcvt(double, int, int *, int *); extern char *gcvt(double, int, char *); extern int getsubopt(char **, char *const *, char **); extern int grantpt(int); extern char *initstate(unsigned, char *, size_t); extern char *l64a(long); extern char *mktemp(char *); extern int mkstemp(char *); extern int mkstemp64(char *); extern char *ptsname(int); extern long random(void); extern char *realpath(const char *, char *); extern char *setstate(const char *); extern void srandom(unsigned); extern int unlockpt(int); extern int posix_openpt (int); extern int setenv (const char *, const char *, int); extern int unsetenv (const char *); typedef struct random_data { int *fptr; int *rptr; int *state; int rand_type; int rand_deg; int rand_sep; int *end_ptr; } RANDOMD; extern int srandom_r(unsigned, RANDOMD *); extern int initstate_r(unsigned, char *, size_t, char **,RANDOMD *); extern int setstate_r(char *, char **, RANDOMD *); extern int random_r(long *, RANDOMD *); extern int l64a_r(long, char*, int); #undef MB_CUR_MAX #undef __max_disp_width #define MB_CUR_MAX (__OBJ_DATA(*__lc_charmap_ptr)->cm_mb_cur_max) #define __max_disp_width (__OBJ_DATA(*__lc_charmap_ptr)->cm_max_disp_width) #define __XMB_CUR_MAX(__cmap) (__OBJ_DATA(*__cmap)->cm_mb_cur_max) #define __x__max_disp_width(__cmap) (__OBJ_DATA(*__cmap)->cm_max_disp_width) extern char *optarg; extern int optind; extern int opterr; #define ATEXIT_MAX 2048 extern float atoff(char *); extern void imul_dbl(long, long, long *); extern void umul_dbl(unsigned long, unsigned long, unsigned long *); extern int on_exit(void (*)(int, void *), void *); extern int unatexit(void (*)(void)); extern double wcstod(const wchar_t *, wchar_t **); extern long int wcstol(const wchar_t *, wchar_t **, int); extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int); extern int rpmatch(const char *); extern int clearenv(void); extern int getopt(int, char* const*, const char*); extern char *getpass(const char *); extern int ttyslot(void); extern void *valloc(size_t); extern void *vec_malloc(size_t); extern void *vec_calloc(size_t, size_t); #define vec_realloc realloc #define vec_free free } #undef abort #undef abs #undef atexit #undef atof #undef atoi #undef atol #undef bsearch #undef calloc #undef div #undef exit #undef free #undef getenv #undef labs #undef ldiv #undef malloc #undef mblen #undef mbstowcs #undef mbtowc #undef qsort #undef rand #undef realloc #undef srand #undef strtod #undef strtol #undef strtoul #undef system #undef wcstombs #undef wctomb #undef _Exit #undef llabs #undef lldiv #undef atoll #undef strtoll #undef strtoull #undef strtof #undef strtold #define __need___va_list #undef __need___va_list #define _GLIBCXX_CSTDIO 1 #undef clearerr #undef fclose #undef feof #undef ferror #undef fflush #undef fgetc #undef fgetpos #undef fgets #undef fopen #undef fprintf #undef fputc #undef fputs #undef fread #undef freopen #undef fscanf #undef fseek #undef fsetpos #undef ftell #undef fwrite #undef getc #undef getchar #undef gets #undef perror #undef printf #undef putc #undef putchar #undef puts #undef remove #undef rename #undef rewind #undef scanf #undef setbuf #undef setvbuf #undef sprintf #undef sscanf #undef tmpfile #undef tmpnam #undef ungetc #undef vfprintf #undef vprintf #undef vsprintf #define _BASIC_STRING_TCC 1 namespace std { template<typename _CharT, typename _Traits, typename _Alloc> const typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4; template<typename _CharT, typename _Traits, typename _Alloc> const _CharT basic_string<_CharT, _Traits, _Alloc>:: _Rep::_S_terminal = _CharT(); template<typename _CharT, typename _Traits, typename _Alloc> const typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>::npos; template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[ (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) / sizeof(size_type)]; template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, input_iterator_tag) { if (__beg == __end && __a == _Alloc()) return _S_empty_rep()._M_refdata(); _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); _M_copy(__r->_M_refdata(), __buf, __len); try { while (__beg != __end) { if (__len == __r->_M_capacity) { _Rep* __another = _Rep::_S_create(__len + 1, __len, __a); _M_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; } __r->_M_set_length_and_sharable(__len); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> template <typename _InIterator> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, forward_iterator_tag) { if (__beg == __end && __a == _Alloc()) return _S_empty_rep()._M_refdata(); if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end) __throw_logic_error(("basic_string::_S_construct null not valid")); const size_type __dnew = static_cast<size_type>(std::distance(__beg, __end)); _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a); try { _S_copy_chars(__r->_M_refdata(), __beg, __end); } catch(...) { __r->_M_destroy(__a); throw; } __r->_M_set_length_and_sharable(__dnew); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(size_type __n, _CharT __c, const _Alloc& __a) { if (__n == 0 && __a == _Alloc()) return _S_empty_rep()._M_refdata(); _Rep* __r = _Rep::_S_create(__n, size_type(0), __a); if (__n) _M_assign(__r->_M_refdata(), __n, __c); __r->_M_set_length_and_sharable(__n); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str) : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()), __str.get_allocator()), __str.get_allocator()) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _Alloc& __a) : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, size_type __n) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, "basic_string::basic_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, _Alloc()), _Alloc()) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, "basic_string::basic_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _CharT* __s, size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__s, __s + __n, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _CharT* __s, const _Alloc& __a) : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : __s + npos, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(size_type __n, _CharT __c, const _Alloc& __a) : _M_dataplus(_S_construct(__n, __c, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> basic_string<_CharT, _Traits, _Alloc>:: basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(_S_construct(__beg, __end, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(initializer_list<_CharT> __l, const _Alloc& __a) : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: assign(const basic_string& __str) { if (_M_rep() != __str._M_rep()) { const allocator_type __a = this->get_allocator(); _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator()); _M_rep()->_M_dispose(__a); _M_data(__tmp); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: assign(const _CharT* __s, size_type __n) { ; _M_check_length(this->size(), __n, "basic_string::assign"); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(size_type(0), this->size(), __s, __n); else { const size_type __pos = __s - _M_data(); if (__pos >= __n) _M_copy(_M_data(), __s, __n); else if (__pos) _M_move(_M_data(), __s, __n); _M_rep()->_M_set_length_and_sharable(__n); return *this; } } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(size_type __n, _CharT __c) { if (__n) { _M_check_length(size_type(0), __n, "basic_string::append"); const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); _M_assign(_M_data() + this->size(), __n, __c); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(const _CharT* __s, size_type __n) { ; if (__n) { _M_check_length(size_type(0), __n, "basic_string::append"); const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) { if (_M_disjunct(__s)) this->reserve(__len); else { const size_type __off = __s - _M_data(); this->reserve(__len); __s = _M_data() + __off; } } _M_copy(_M_data() + this->size(), __s, __n); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(const basic_string& __str) { const size_type __size = __str.size(); if (__size) { const size_type __len = __size + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); _M_copy(_M_data() + this->size(), __str._M_data(), __size); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(const basic_string& __str, size_type __pos, size_type __n) { __str._M_check(__pos, "basic_string::append"); __n = __str._M_limit(__pos, __n); if (__n) { const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: insert(size_type __pos, const _CharT* __s, size_type __n) { ; _M_check(__pos, "basic_string::insert"); _M_check_length(size_type(0), __n, "basic_string::insert"); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(__pos, size_type(0), __s, __n); else { const size_type __off = __s - _M_data(); _M_mutate(__pos, 0, __n); __s = _M_data() + __off; _CharT* __p = _M_data() + __pos; if (__s + __n <= __p) _M_copy(__p, __s, __n); else if (__s >= __p) _M_copy(__p, __s + __n, __n); else { const size_type __nleft = __p - __s; _M_copy(__p, __s, __nleft); _M_copy(__p + __nleft, __p + __n, __n - __nleft); } return *this; } } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::iterator basic_string<_CharT, _Traits, _Alloc>:: erase(iterator __first, iterator __last) { ; const size_type __size = __last - __first; if (__size) { const size_type __pos = __first - _M_ibegin(); _M_mutate(__pos, __size, size_type(0)); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } else return __first; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { ; _M_check(__pos, "basic_string::replace"); __n1 = _M_limit(__pos, __n1); _M_check_length(__n1, __n2, "basic_string::replace"); bool __left; if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(__pos, __n1, __s, __n2); else if ((__left = __s + __n2 <= _M_data() + __pos) || _M_data() + __pos + __n1 <= __s) { size_type __off = __s - _M_data(); __left ? __off : (__off += __n2 - __n1); _M_mutate(__pos, __n1, __n2); _M_copy(_M_data() + __pos, _M_data() + __off, __n2); return *this; } else { const basic_string __tmp(__s, __n2); return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2); } } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>::_Rep:: _M_destroy(const _Alloc& __a) throw () { const size_type __size = sizeof(_Rep_base) + (this->_M_capacity + 1) * sizeof(_CharT); _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: _M_leak_hard() { if (_M_rep() == &_S_empty_rep()) return; if (_M_rep()->_M_is_shared()) _M_mutate(0, 0, 0); _M_rep()->_M_set_leaked(); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: _M_mutate(size_type __pos, size_type __len1, size_type __len2) { const size_type __old_size = this->size(); const size_type __new_size = __old_size + __len2 - __len1; const size_type __how_much = __old_size - __pos - __len1; if (__new_size > this->capacity() || _M_rep()->_M_is_shared()) { const allocator_type __a = get_allocator(); _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a); if (__pos) _M_copy(__r->_M_refdata(), _M_data(), __pos); if (__how_much) _M_copy(__r->_M_refdata() + __pos + __len2, _M_data() + __pos + __len1, __how_much); _M_rep()->_M_dispose(__a); _M_data(__r->_M_refdata()); } else if (__how_much && __len1 != __len2) { _M_move(_M_data() + __pos + __len2, _M_data() + __pos + __len1, __how_much); } _M_rep()->_M_set_length_and_sharable(__new_size); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: reserve(size_type __res) { if (__res != this->capacity() || _M_rep()->_M_is_shared()) { if (__res < this->size()) __res = this->size(); const allocator_type __a = get_allocator(); _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size()); _M_rep()->_M_dispose(__a); _M_data(__tmp); } } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: swap(basic_string& __s) { if (_M_rep()->_M_is_leaked()) _M_rep()->_M_set_sharable(); if (__s._M_rep()->_M_is_leaked()) __s._M_rep()->_M_set_sharable(); if (this->get_allocator() == __s.get_allocator()) { _CharT* __tmp = _M_data(); _M_data(__s._M_data()); __s._M_data(__tmp); } else { const basic_string __tmp1(_M_ibegin(), _M_iend(), __s.get_allocator()); const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(), this->get_allocator()); *this = __tmp2; __s = __tmp1; } } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::_Rep* basic_string<_CharT, _Traits, _Alloc>::_Rep:: _S_create(size_type __capacity, size_type __old_capacity, const _Alloc& __alloc) { if (__capacity > _S_max_size) __throw_length_error(("basic_string::_S_create")); const size_type __pagesize = 4096; const size_type __malloc_header_size = 4 * sizeof(void*); if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) __capacity = 2 * __old_capacity; size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep); 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 > _S_max_size) __capacity = _S_max_size; __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep); } void* __place = _Raw_bytes_alloc(__alloc).allocate(__size); _Rep *__p = new (__place) _Rep; __p->_M_capacity = __capacity; __p->_M_set_sharable(); return __p; } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* basic_string<_CharT, _Traits, _Alloc>::_Rep:: _M_clone(const _Alloc& __alloc, size_type __res) { const size_type __requested_cap = this->_M_length + __res; _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity, __alloc); if (this->_M_length) _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length); __r->_M_set_length_and_sharable(this->_M_length); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: resize(size_type __n, _CharT __c) { const size_type __size = this->size(); _M_check_length(__size, __n, "basic_string::resize"); if (__size < __n) this->append(__n - __size, __c); else if (__n < __size) this->erase(__n); } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, __false_type) { const basic_string __s(__k1, __k2); const size_type __n1 = __i2 - __i1; _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch"); return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(), __s.size()); } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c) { _M_check_length(__n1, __n2, "basic_string::_M_replace_aux"); _M_mutate(__pos1, __n1, __n2); if (__n2) _M_assign(_M_data() + __pos1, __n2, __c); return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) { _M_mutate(__pos1, __n1, __n2); if (__n2) _M_copy(_M_data() + __pos1, __s, __n2); return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { ; typedef basic_string<_CharT, _Traits, _Alloc> __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> basic_string<_CharT, _Traits, _Alloc> operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; __string_type __str; const __size_type __len = __rhs.size(); __str.reserve(__len + 1); __str.append(__size_type(1), __lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: copy(_CharT* __s, size_type __n, size_type __pos) const { _M_check(__pos, "basic_string::copy"); __n = _M_limit(__pos, __n); ; if (__n) _M_copy(__s, _M_data() + __pos, __n); return __n; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find(const _CharT* __s, size_type __pos, size_type __n) const { ; const size_type __size = this->size(); const _CharT* __data = _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> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find(_CharT __c, size_type __pos) const noexcept { size_type __ret = npos; const size_type __size = this->size(); if (__pos < __size) { const _CharT* __data = _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> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: rfind(const _CharT* __s, size_type __pos, size_type __n) const { ; const size_type __size = this->size(); if (__n <= __size) { __pos = std::min(size_type(__size - __n), __pos); const _CharT* __data = _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> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: rfind(_CharT __c, size_type __pos) const noexcept { size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; for (++__size; __size-- > 0; ) if (traits_type::eq(_M_data()[__size], __c)) return __size; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { ; for (; __n && __pos < this->size(); ++__pos) { const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]); if (__p) return __pos; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { ; size_type __size = this->size(); if (__size && __n) { if (--__size > __pos) __size = __pos; do { if (traits_type::find(__s, __n, _M_data()[__size])) return __size; } while (__size-- != 0); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { ; for (; __pos < this->size(); ++__pos) if (!traits_type::find(__s, __n, _M_data()[__pos])) return __pos; return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_first_not_of(_CharT __c, size_type __pos) const noexcept { for (; __pos < this->size(); ++__pos) if (!traits_type::eq(_M_data()[__pos], __c)) return __pos; return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { ; size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; do { if (!traits_type::find(__s, __n, _M_data()[__size])) return __size; } while (__size--); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_last_not_of(_CharT __c, size_type __pos) const noexcept { size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; do { if (!traits_type::eq(_M_data()[__size], __c)) return __size; } while (__size--); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string<_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n, const basic_string& __str) const { _M_check(__pos, "basic_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(_M_data() + __pos, __str.data(), __len); if (!__r) __r = _S_compare(__n, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string<_CharT, _Traits, _Alloc>:: compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const { _M_check(__pos1, "basic_string::compare"); __str._M_check(__pos2, "basic_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(_M_data() + __pos1, __str.data() + __pos2, __len); if (!__r) __r = _S_compare(__n1, __n2); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string<_CharT, _Traits, _Alloc>:: compare(const _CharT* __s) const { ; 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(_M_data(), __s, __len); if (!__r) __r = _S_compare(__size, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string <_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n1, const _CharT* __s) const { ; _M_check(__pos, "basic_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(_M_data() + __pos, __s, __len); if (!__r) __r = _S_compare(__n1, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string <_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const { ; _M_check(__pos, "basic_string::compare"); __n1 = _M_limit(__pos, __n1); const size_type __len = std::min(__n1, __n2); int __r = traits_type::compare(_M_data() + __pos, __s, __len); if (!__r) __r = _S_compare(__n1, __n2); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, basic_string<_CharT, _Traits, _Alloc>& __str) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __istream_type::ios_base __ios_base; 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 { __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; } catch(...) { __in._M_setstate(__ios_base::badbit); } } if (!__extracted) __err |= __ios_base::failbit; if (__err) __in.setstate(__err); return __in; } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __in, basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __istream_type::ios_base __ios_base; 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 { __str.erase(); 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)) { __str += _Traits::to_char_type(__c); ++__extracted; __c = __in.rdbuf()->snextc(); } 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; } catch(...) { __in._M_setstate(__ios_base::badbit); } } if (!__extracted) __err |= __ios_base::failbit; if (__err) __in.setstate(__err); return __in; } extern template class basic_string<char>; extern template basic_istream<char>& operator>>(basic_istream<char>&, string&); extern template basic_ostream<char>& operator<<(basic_ostream<char>&, const string&); extern template basic_istream<char>& getline(basic_istream<char>&, string&, char); extern template basic_istream<char>& getline(basic_istream<char>&, string&); extern template class basic_string<wchar_t>; extern template basic_istream<wchar_t>& operator>>(basic_istream<wchar_t>&, wstring&); extern template basic_ostream<wchar_t>& operator<<(basic_ostream<wchar_t>&, const wstring&); extern template basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&, wchar_t); extern template basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&); } namespace std { class logic_error : public exception { string _M_msg; public: explicit logic_error(const string& __arg); virtual ~logic_error() throw(); virtual const char* what() const throw(); }; class domain_error : public logic_error { public: explicit domain_error(const string& __arg); virtual ~domain_error() throw(); }; class invalid_argument : public logic_error { public: explicit invalid_argument(const string& __arg); virtual ~invalid_argument() throw(); }; class length_error : public logic_error { public: explicit length_error(const string& __arg); virtual ~length_error() throw(); }; class out_of_range : public logic_error { public: explicit out_of_range(const string& __arg); virtual ~out_of_range() throw(); }; class runtime_error : public exception { string _M_msg; public: explicit runtime_error(const string& __arg); virtual ~runtime_error() throw(); virtual const char* what() const throw(); }; class range_error : public runtime_error { public: explicit range_error(const string& __arg); virtual ~range_error() throw(); }; class overflow_error : public runtime_error { public: explicit overflow_error(const string& __arg); virtual ~overflow_error() throw(); }; class underflow_error : public runtime_error { public: explicit underflow_error(const string& __arg); virtual ~underflow_error() throw(); }; } namespace std { class error_code; class error_condition; class error_category; class system_error; template<typename _Tp> struct is_error_code_enum : public false_type { }; template<typename _Tp> struct is_error_condition_enum : public false_type { }; template<> struct is_error_condition_enum<errc> : public true_type { }; class error_category { protected: error_category() noexcept; public: virtual ~error_category() noexcept; error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; virtual const char* name() const noexcept = 0; virtual string message(int) const = 0; virtual error_condition default_error_condition(int __i) const noexcept; virtual bool equivalent(int __i, const error_condition& __cond) const noexcept; virtual bool equivalent(const error_code& __code, int __i) const noexcept; bool operator<(const error_category& __other) const noexcept { return less<const error_category*>()(this, &__other); } bool operator==(const error_category& __other) const noexcept { return this == &__other; } bool operator!=(const error_category& __other) const noexcept { return this != &__other; } }; __attribute__ ((__const__)) const error_category& system_category() noexcept; __attribute__ ((__const__)) const error_category& generic_category() noexcept; error_code make_error_code(errc) noexcept; template<typename _Tp> struct hash; struct error_code { error_code() noexcept : _M_value(0), _M_cat(&system_category()) { } error_code(int __v, const error_category& __cat) noexcept : _M_value(__v), _M_cat(&__cat) { } template<typename _ErrorCodeEnum, typename = typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type> error_code(_ErrorCodeEnum __e) noexcept { *this = make_error_code(__e); } void assign(int __v, const error_category& __cat) noexcept { _M_value = __v; _M_cat = &__cat; } void clear() noexcept { assign(0, system_category()); } template<typename _ErrorCodeEnum> typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value, error_code&>::type operator=(_ErrorCodeEnum __e) noexcept { return *this = make_error_code(__e); } int value() const noexcept { return _M_value; } const error_category& category() const noexcept { return *_M_cat; } error_condition default_error_condition() const noexcept; string message() const { return category().message(value()); } explicit operator bool() const noexcept { return _M_value != 0 ? true : false; } private: friend class hash<error_code>; int _M_value; const error_category* _M_cat; }; inline error_code make_error_code(errc __e) noexcept { return error_code(static_cast<int>(__e), generic_category()); } inline bool operator<(const error_code& __lhs, const error_code& __rhs) noexcept { return (__lhs.category() < __rhs.category() || (__lhs.category() == __rhs.category() && __lhs.value() < __rhs.value())); } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) { return (__os << __e.category().name() << ':' << __e.value()); } error_condition make_error_condition(errc) noexcept; struct error_condition { error_condition() noexcept : _M_value(0), _M_cat(&generic_category()) { } error_condition(int __v, const error_category& __cat) noexcept : _M_value(__v), _M_cat(&__cat) { } template<typename _ErrorConditionEnum, typename = typename enable_if<is_error_condition_enum<_ErrorConditionEnum>::value>::type> error_condition(_ErrorConditionEnum __e) noexcept { *this = make_error_condition(__e); } void assign(int __v, const error_category& __cat) noexcept { _M_value = __v; _M_cat = &__cat; } template<typename _ErrorConditionEnum> typename enable_if<is_error_condition_enum <_ErrorConditionEnum>::value, error_condition&>::type operator=(_ErrorConditionEnum __e) noexcept { return *this = make_error_condition(__e); } void clear() noexcept { assign(0, generic_category()); } int value() const noexcept { return _M_value; } const error_category& category() const noexcept { return *_M_cat; } string message() const { return category().message(value()); } explicit operator bool() const noexcept { return _M_value != 0 ? true : false; } private: int _M_value; const error_category* _M_cat; }; inline error_condition make_error_condition(errc __e) noexcept { return error_condition(static_cast<int>(__e), generic_category()); } inline bool operator<(const error_condition& __lhs, const error_condition& __rhs) noexcept { return (__lhs.category() < __rhs.category() || (__lhs.category() == __rhs.category() && __lhs.value() < __rhs.value())); } inline bool operator==(const error_code& __lhs, const error_code& __rhs) noexcept { return (__lhs.category() == __rhs.category() && __lhs.value() == __rhs.value()); } inline bool operator==(const error_code& __lhs, const error_condition& __rhs) noexcept { return (__lhs.category().equivalent(__lhs.value(), __rhs) || __rhs.category().equivalent(__lhs, __rhs.value())); } inline bool operator==(const error_condition& __lhs, const error_code& __rhs) noexcept { return (__rhs.category().equivalent(__rhs.value(), __lhs) || __lhs.category().equivalent(__rhs, __lhs.value())); } inline bool operator==(const error_condition& __lhs, const error_condition& __rhs) noexcept { return (__lhs.category() == __rhs.category() && __lhs.value() == __rhs.value()); } inline bool operator!=(const error_code& __lhs, const error_code& __rhs) noexcept { return !(__lhs == __rhs); } inline bool operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept { return !(__lhs == __rhs); } inline bool operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept { return !(__lhs == __rhs); } inline bool operator!=(const error_condition& __lhs, const error_condition& __rhs) noexcept { return !(__lhs == __rhs); } class system_error : public std::runtime_error { private: error_code _M_code; public: system_error(error_code __ec = error_code()) : runtime_error(__ec.message()), _M_code(__ec) { } system_error(error_code __ec, const string& __what) : runtime_error(__what + ": " + __ec.message()), _M_code(__ec) { } system_error(int __v, const error_category& __ecat) : runtime_error(error_code(__v, __ecat).message()), _M_code(__v, __ecat) { } system_error(int __v, const error_category& __ecat, const string& __what) : runtime_error(__what + ": " + error_code(__v, __ecat).message()), _M_code(__v, __ecat) { } virtual ~system_error() throw(); const error_code& code() const noexcept { return _M_code; } }; } #define __STDC__ 1 #define __cplusplus 201103L #define __STDC_HOSTED__ 1 #define __GNUC__ 4 #define __GNUC_MINOR__ 7 #define __GNUC_PATCHLEVEL__ 0 #define __VERSION__ "4.7.0 20111102 (experimental) [trunk revision 180770]" #define __OPTIMIZE__ 1 #define __FINITE_MATH_ONLY__ 0 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 4 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_SHORT__ 2 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_LONG_DOUBLE__ 8 #define __SIZEOF_SIZE_T__ 4 #define __CHAR_BIT__ 8 #define __BIGGEST_ALIGNMENT__ 16 #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_PDP_ENDIAN__ 3412 #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ #define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__ #define __SIZEOF_POINTER__ 4 #define __GNUG__ 4 #define __SIZE_TYPE__ long unsigned int #define __PTRDIFF_TYPE__ long int #define __WCHAR_TYPE__ short unsigned int #define __WINT_TYPE__ int #define __INTMAX_TYPE__ long long int #define __UINTMAX_TYPE__ long long unsigned int #define __CHAR16_TYPE__ short unsigned int #define __CHAR32_TYPE__ unsigned int #define __SIG_ATOMIC_TYPE__ int #define __INT8_TYPE__ signed char #define __INT16_TYPE__ short int #define __INT32_TYPE__ int #define __INT64_TYPE__ long long int #define __UINT8_TYPE__ unsigned char #define __UINT16_TYPE__ short unsigned int #define __UINT32_TYPE__ unsigned int #define __UINT64_TYPE__ long long unsigned int #define __INT_LEAST8_TYPE__ signed char #define __INT_LEAST16_TYPE__ short int #define __INT_LEAST32_TYPE__ int #define __INT_LEAST64_TYPE__ long long int #define __UINT_LEAST8_TYPE__ unsigned char #define __UINT_LEAST16_TYPE__ short unsigned int #define __UINT_LEAST32_TYPE__ unsigned int #define __UINT_LEAST64_TYPE__ long long unsigned int #define __INT_FAST8_TYPE__ signed char #define __INT_FAST16_TYPE__ short int #define __INT_FAST32_TYPE__ int #define __INT_FAST64_TYPE__ long long int #define __UINT_FAST8_TYPE__ unsigned char #define __UINT_FAST16_TYPE__ short unsigned int #define __UINT_FAST32_TYPE__ unsigned int #define __UINT_FAST64_TYPE__ long long unsigned int #define __INTPTR_TYPE__ long int #define __UINTPTR_TYPE__ long unsigned int #define __GXX_WEAK__ 0 #define __DEPRECATED 1 #define __GXX_RTTI 1 #define __GXX_EXPERIMENTAL_CXX0X__ 1 #define __EXCEPTIONS 1 #define __GXX_ABI_VERSION 1002 #define __SCHAR_MAX__ 127 #define __SHRT_MAX__ 32767 #define __INT_MAX__ 2147483647 #define __LONG_MAX__ 2147483647L #define __LONG_LONG_MAX__ 9223372036854775807LL #define __WCHAR_MAX__ 65535 #define __WCHAR_MIN__ 0 #define __WINT_MAX__ 2147483647 #define __WINT_MIN__ (-__WINT_MAX__ - 1) #define __PTRDIFF_MAX__ 2147483647L #define __SIZE_MAX__ 4294967295UL #define __INTMAX_MAX__ 9223372036854775807LL #define __INTMAX_C(c) c ## LL #define __UINTMAX_MAX__ 18446744073709551615ULL #define __UINTMAX_C(c) c ## ULL #define __SIG_ATOMIC_MAX__ 2147483647 #define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) #define __INT8_MAX__ 127 #define __INT16_MAX__ 32767 #define __INT32_MAX__ 2147483647 #define __INT64_MAX__ 9223372036854775807LL #define __UINT8_MAX__ 255 #define __UINT16_MAX__ 65535 #define __UINT32_MAX__ 4294967295U #define __UINT64_MAX__ 18446744073709551615ULL #define __INT_LEAST8_MAX__ 127 #define __INT8_C(c) c #define __INT_LEAST16_MAX__ 32767 #define __INT16_C(c) c #define __INT_LEAST32_MAX__ 2147483647 #define __INT32_C(c) c #define __INT_LEAST64_MAX__ 9223372036854775807LL #define __INT64_C(c) c ## LL #define __UINT_LEAST8_MAX__ 255 #define __UINT8_C(c) c #define __UINT_LEAST16_MAX__ 65535 #define __UINT16_C(c) c #define __UINT_LEAST32_MAX__ 4294967295U #define __UINT32_C(c) c ## U #define __UINT_LEAST64_MAX__ 18446744073709551615ULL #define __UINT64_C(c) c ## ULL #define __INT_FAST8_MAX__ 127 #define __INT_FAST16_MAX__ 32767 #define __INT_FAST32_MAX__ 2147483647 #define __INT_FAST64_MAX__ 9223372036854775807LL #define __UINT_FAST8_MAX__ 255 #define __UINT_FAST16_MAX__ 65535 #define __UINT_FAST32_MAX__ 4294967295U #define __UINT_FAST64_MAX__ 18446744073709551615ULL #define __INTPTR_MAX__ 2147483647L #define __UINTPTR_MAX__ 4294967295UL #define __FLT_EVAL_METHOD__ 0 #define __DEC_EVAL_METHOD__ 2 #define __FLT_RADIX__ 2 #define __FLT_MANT_DIG__ 24 #define __FLT_DIG__ 6 #define __FLT_MIN_EXP__ (-125) #define __FLT_MIN_10_EXP__ (-37) #define __FLT_MAX_EXP__ 128 #define __FLT_MAX_10_EXP__ 38 #define __FLT_DECIMAL_DIG__ 9 #define __FLT_MAX__ 3.4028234663852886e+38F #define __FLT_MIN__ 1.1754943508222875e-38F #define __FLT_EPSILON__ 1.1920928955078125e-7F #define __FLT_DENORM_MIN__ 1.4012984643248171e-45F #define __FLT_HAS_DENORM__ 1 #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FP_FAST_FMAF 1 #define __DBL_MANT_DIG__ 53 #define __DBL_DIG__ 15 #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX_10_EXP__ 308 #define __DBL_DECIMAL_DIG__ 17 #define __DBL_MAX__ double(1.7976931348623157e+308L) #define __DBL_MIN__ double(2.2250738585072014e-308L) #define __DBL_EPSILON__ double(2.2204460492503131e-16L) #define __DBL_DENORM_MIN__ double(4.9406564584124654e-324L) #define __DBL_HAS_DENORM__ 1 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __FP_FAST_FMA 1 #define __LDBL_MANT_DIG__ 53 #define __LDBL_DIG__ 15 #define __LDBL_MIN_EXP__ (-1021) #define __LDBL_MIN_10_EXP__ (-307) #define __LDBL_MAX_EXP__ 1024 #define __LDBL_MAX_10_EXP__ 308 #define __DECIMAL_DIG__ 17 #define __LDBL_MAX__ 1.7976931348623157e+308L #define __LDBL_MIN__ 2.2250738585072014e-308L #define __LDBL_EPSILON__ 2.2204460492503131e-16L #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L #define __LDBL_HAS_DENORM__ 1 #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __FP_FAST_FMAL 1 #define __DEC32_MANT_DIG__ 7 #define __DEC32_MIN_EXP__ (-94) #define __DEC32_MAX_EXP__ 97 #define __DEC32_MIN__ 1E-95DF #define __DEC32_MAX__ 9.999999E96DF #define __DEC32_EPSILON__ 1E-6DF #define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF #define __DEC64_MANT_DIG__ 16 #define __DEC64_MIN_EXP__ (-382) #define __DEC64_MAX_EXP__ 385 #define __DEC64_MIN__ 1E-383DD #define __DEC64_MAX__ 9.999999999999999E384DD #define __DEC64_EPSILON__ 1E-15DD #define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD #define __DEC128_MANT_DIG__ 34 #define __DEC128_MIN_EXP__ (-6142) #define __DEC128_MAX_EXP__ 6145 #define __DEC128_MIN__ 1E-6143DL #define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL #define __DEC128_EPSILON__ 1E-33DL #define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL #define __REGISTER_PREFIX__ #define __USER_LABEL_PREFIX__ #define __GNUC_STDC_INLINE__ 1 #define __CHAR_UNSIGNED__ 1 #define __WCHAR_UNSIGNED__ 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __SIZEOF_WCHAR_T__ 2 #define __SIZEOF_WINT_T__ 4 #define __SIZEOF_PTRDIFF_T__ 4 #define _ARCH_PPC 1 #define __HAVE_BSWAP__ 1 #define __BIG_ENDIAN__ 1 #define _BIG_ENDIAN 1 #define _AIX43 1 #define _AIX51 1 #define _AIX52 1 #define _AIX53 1 #define _IBMR2 1 #define _POWER 1 #define __powerpc__ 1 #define __PPC__ 1 #define __unix__ 1 #define _AIX 1 #define _AIX32 1 #define _AIX41 1 #define _LONG_LONG 1 #define _ALL_SOURCE 1 #define _THREAD_SAFE 1 #define PIC 1 #define GCC_GENERATED_STDINT_H 1 #define _H_TYPES extern "C" { #define _H_STANDARDS #define _AIXVERSION_430 1 #define _AIXVERSION_431 1 #define _AIXVERSION_434 1 #define _AIXVERSION_510 1 #define _AIXVERSION_520 1 #define _AIXVERSION_530 1 #undef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 #define _POSIX_SOURCE #define _POSIX_C_SOURCE 200112L #define _ANSI_SOURCE #define _ANSI_C_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _LARGE_FILE_API #define __restrict__ #define _ISOC99_SOURCE #define __bool__ bool #define _H_INTTYPES extern "C" { #define _H_STDINT extern "C" { typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef signed long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef int64_t intmax_t; typedef uint64_t uintmax_t; typedef signed long intptr_t; typedef unsigned long uintptr_t; typedef signed char int_least8_t; typedef signed short int_least16_t; typedef signed int int_least32_t; typedef signed long long int_least64_t; typedef unsigned char uint_least8_t; typedef unsigned short uint_least16_t; typedef unsigned int uint_least32_t; typedef unsigned long long uint_least64_t; typedef signed char int_fast8_t; typedef int16_t int_fast16_t; typedef int32_t int_fast32_t; typedef unsigned char uint_fast8_t; typedef uint16_t uint_fast16_t; typedef uint32_t uint_fast32_t; typedef int64_t int_fast64_t; typedef uint64_t uint_fast64_t; #define INT8_MIN (-128) #define INT16_MIN (-32767-1) #define INT32_MIN (-2147483647-1) #define INT64_MIN (INT64_C(-9223372036854775807)-1) #define INT8_MAX (127) #define INT16_MAX (32767) #define INT32_MAX (2147483647) #define INT64_MAX (INT64_C(9223372036854775807)) #define UINT8_MAX (255) #define UINT16_MAX (65535) #define UINT32_MAX (4294967295U) #define UINT64_MAX (UINT64_C(18446744073709551615)) #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST64_MIN INT64_MIN #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MAX INT64_MAX #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX #define INT_FAST8_MIN INT8_MIN #define INT_FAST16_MIN INT16_MIN #define INT_FAST32_MIN INT32_MIN #define INT_FAST64_MIN INT64_MIN #define INT_FAST8_MAX INT8_MAX #define INT_FAST16_MAX INT16_MAX #define INT_FAST32_MAX INT32_MAX #define INT_FAST64_MAX INT64_MAX #define UINT_FAST8_MAX UINT8_MAX #define UINT_FAST16_MAX UINT16_MAX #define UINT_FAST32_MAX UINT32_MAX #define UINT_FAST64_MAX UINT64_MAX #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX #define INTPTR_MIN (-INTPTR_MAX-1) #define INTPTR_MAX 2147483647L #define UINTPTR_MAX 4294967295UL #define PTRDIFF_MIN (-2147483647L - 1) #define PTRDIFF_MAX 2147483647L #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX #define _WCHAR_MAX #define WCHAR_MAX UINT16_MAX #define WCHAR_MIN 0 #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX #define SIZE_MAX 4294967295UL #define __CONCAT__(A,B) A ## B #define INT8_C(c) c #define INT16_C(c) c #define INT32_C(c) c #define INT64_C(c) __CONCAT__(c,LL) #define UINT8_C(c) c #define UINT16_C(c) c #define UINT32_C(c) __CONCAT__(c,U) #define UINT64_C(c) __CONCAT__(c,ULL) #define INTMAX_C(c) __CONCAT__(c,LL) #define UINTMAX_C(c) __CONCAT__(c,ULL) } #define _GCC_WRAP_STDINT_H typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; extern intmax_t __strtollmax(const char * , char ** , int); static intmax_t strtoimax (const char * __nptr, char ** __endptr, int __base) { return __strtollmax (__nptr, __endptr, __base); } extern intmax_t imaxabs(intmax_t); extern imaxdiv_t imaxdiv (intmax_t, intmax_t); extern uintmax_t strtoumax(const char * , char ** , int); #define _WCHAR_T typedef unsigned short wchar_t; extern intmax_t wcstoimax(const wchar_t * , wchar_t ** , int ); extern uintmax_t wcstoumax(const wchar_t * , wchar_t ** , int); typedef int32_t intfast_t; typedef uint32_t uintfast_t; typedef signed long __long32_t; typedef unsigned long __ulong32_t; #define __LONG64_T typedef signed int __long64_t; typedef unsigned int __ulong64_t; typedef signed int int32long64_t; typedef unsigned int uint32long64_t; typedef signed long long32int64_t; typedef unsigned long ulong32int64_t; #define INTFAST_MIN INT32_MIN #define INTFAST_MAX INT32_MAX #define UINTFAST_MAX UINT32_MAX typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char u_int8; typedef unsigned char u_int8_t; typedef unsigned short u_int16; typedef unsigned short u_int16_t; typedef unsigned int u_int32; typedef unsigned int u_int32_t; typedef unsigned long long u_int64; typedef unsigned long long u_int64_t; } #undef _STD_TYPES_T #define __align(x) #define _PTRDIFF_T #define _GCC_PTRDIFF_T typedef long int ptrdiff_t; #define _WCTYPE_T typedef unsigned int wctype_t; #define _FPOS_T typedef long fpos_t; typedef long long fpos64_t; #define _TIME_T typedef int time_t; #define _CLOCK_T typedef int clock_t; #define _SIZE_T #define _GCC_SIZE_T typedef long unsigned int size_t; #define _UCHAR_T typedef unsigned char uchar_t; typedef unsigned short ushort_t; typedef unsigned int uint_t; typedef unsigned long ulong_t; #define _SSIZE_T typedef signed long ssize_t; typedef int level_t; typedef __long64_t daddr_t; typedef int daddr32_t; typedef int64_t daddr64_t; typedef char * caddr_t; typedef __ulong64_t ino_t; typedef uint_t ino32_t; typedef uint64_t ino64_t; typedef short cnt_t; typedef __ulong64_t dev_t; typedef uint_t dev32_t; typedef uint64_t dev64_t; typedef int chan_t; typedef int time32_t; typedef int pid32_t; typedef int tid32_t; typedef uint64_t pid64_t; typedef uint64_t tid64_t; typedef int64_t time64_t; typedef void * __ptr32; typedef char * __cptr32; typedef int soff_t; #define _OFF_T typedef long off_t; typedef long long off64_t; typedef long paddr_t; #define _KEY_T typedef int32long64_t key_t; #define _TIMER_T typedef __long64_t timer_t; typedef int timer32_t; typedef int64_t timer64_t; typedef short nlink_t; #define _MODE_T typedef uint_t mode_t; #define _UID_GID_T typedef uint_t uid_t; typedef uint_t gid_t; typedef __ptr32 mid_t; #define _PID_T typedef int32long64_t pid_t; typedef __long64_t tid_t; typedef char slab_t[12]; typedef long mtyp_t; typedef int boolean_t; typedef int crid_t; typedef __long64_t blkcnt_t; typedef __long64_t blksize_t; typedef int blkcnt32_t; typedef int blksize32_t; typedef uint64_t blkcnt64_t; typedef uint64_t blksize64_t; typedef ulong_t fsblkcnt_t; typedef ulong_t fsfilcnt_t; #define _WINT_T typedef int wint_t; typedef uint32long64_t id_t; typedef unsigned int useconds_t; typedef signed int suseconds_t; #define _CLOCKID_T typedef long long clockid_t; typedef struct sigset_t { unsigned int losigs; unsigned int hisigs; } sigset_t; typedef struct { unsigned int losigs, hisigs; } sigset32_t; typedef struct { uint64_t ss_set[4]; } sigset64_t; typedef int signal_t; typedef struct fsid_t { unsigned int val[2]; } fsid_t; typedef struct fsid64_t { uint64_t val[2]; } fsid64_t; typedef void *pthread_attr_t; typedef void *pthread_condattr_t; typedef void *pthread_mutexattr_t; typedef void *pthread_rwlockattr_t; typedef void *pthread_barrierattr_t; typedef unsigned int pthread_t; typedef unsigned int pthread_key_t; typedef struct { int __mt_word[13]; } pthread_mutex_t; typedef struct { int __cv_word[11]; } pthread_cond_t; typedef struct { int __on_word[28]; } pthread_once_t; typedef struct { int __sp_word[6]; } pthread_spinlock_t; typedef struct { int __br_word[8]; } pthread_barrier_t; typedef struct { int __rw_word[52]; } pthread_rwlock_t; typedef struct _quad { int val[2]; } quad; #define _H_M_TYPES #define _H_VM_TYPES typedef long vmid_t; typedef ulong_t vmhandle_t; typedef int vmid32_t; typedef uint_t vmhandle32_t; typedef long32int64_t kvmid_t; typedef ulong32int64_t kvmhandle_t; typedef long long vmid64_t; typedef long long rpn64_t; typedef long long cnt64_t; typedef long long psize_t; typedef int32long64_t vmidx_t; typedef uint32long64_t vmfkey_t; typedef uint32long64_t vmprkey_t; typedef int32long64_t vmkey_t; typedef int32long64_t vmhwkey_t; typedef int32long64_t vpn_t; typedef int32long64_t rpn_t; typedef unsigned long ptex_t; typedef unsigned long swhatx_t; typedef uint32long64_t esid_t; typedef ushort_t aptx_t; typedef int pdtx_t; typedef short psx_t; typedef ushort_t pshift_t; typedef ushort_t sshift_t; typedef int unidx_t; typedef int snidx_t; typedef int vmnodeidx_t; typedef int kvpn_t; typedef int krpn_t; typedef int32long64_t vmsize_t; typedef int32long64_t vmm_lock_t; typedef unsigned long ureg_t; typedef struct vmaddr_t { vmhandle_t srval; caddr_t offset; } vmaddr_t; typedef struct adspace_t { ulong32int64_t alloc; vmhandle_t srval[16]; } adspace_t; #define ADSP_MASK(_x) ((1U << 31) >> (_x)) #define adsp_is_alloc(_a,_x) ((_a)->alloc & ADSP_MASK(_x)) typedef enum _MR_ATTR_TYPE { BadAttr = 0, VirtAddr = 1 } MR_ATTR_TYPE; typedef enum _MR_LABEL_TYPE { BadMem = 0, FreeMem = 1, IPLCB = 2, RMALLOC = 3, PM_HEAP = 4, RTAS_HEAP = 5, TCE_TABLE = 6, IO_SPACE = 7, HUGE_PAGE = 8 } MR_LABEL_TYPE; typedef struct { unsigned long long mr_addr; unsigned long long mr_size; unsigned char mr_att; unsigned char mr_label; unsigned short mr_nodeid; char reserved[4]; } iplcb_map_reg_t; typedef vmhandle_t vmlpghandle_t; typedef struct label_t { struct label_t *prev; ulong_t iar; ulong_t stack; ulong_t toc; ulong_t cr; ulong_t intpri; ulong_t reg[19]; } label_t; typedef int32long64_t ext_t; #define _VA_LIST typedef char * va_list; #define NULL 0 #define TRUE 1 #define FALSE 0 typedef unsigned long long __ptr64; typedef unsigned long long __cptr64; typedef ushort_t UniChar; typedef uint_t UTF32Char; typedef uchar_t uchar; typedef ushort_t ushort; typedef uint_t uint; typedef ulong_t ulong; typedef struct { int r[1]; } * physadr_t; typedef physadr_t physadr; typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef int swblk_t; #define NBBY 8 struct sigset { unsigned int losigs; unsigned int hisigs; }; struct fsid { unsigned int val[2]; }; #define fsid_dev val[0] #define fsid_type val[1] #define FHSIZE 32 #define MAXFIDSZ 20 struct fileid { uint_t fid_len; ino32_t fid_ino; uint_t fid_gen; char fid_x[20 - (sizeof(ino32_t) + 2) - sizeof(uint_t)]; }; struct fid { uint_t fid_len; char fid_data[20]; }; typedef struct fid fid_t; struct fhandle { char x[32]; }; typedef struct fhandle fhandle_t; struct filehandle { fsid_t fh_fsid; struct fileid fh_fid; }; #define fh_dev fh_fsid.fsid_dev #define fh_type fh_fsid.fsid_type #define fh_len fh_fid.fid_len #define fh_ino fh_fid.fid_ino #define fh_gen fh_fid.fid_gen struct unique_id { __ulong32_t word1; __ulong32_t word2; __ulong32_t word3; __ulong32_t word4; }; typedef struct unique_id unique_id_t; typedef long long offset_t; typedef long long ssize64_t; typedef long long longlong_t; typedef unsigned long long u_longlong_t; typedef unsigned int class_id_t; typedef uint_t liobn_t; typedef unsigned long long unit_addr_t; typedef unsigned long long size64_t; } #define _INT8_T #define _INT16_T #define _INT32_T #define _UINT8_T #define _UINT16_T #define _UINT32_T #define _INT64_T #define _UINT64_T #define _GLIBCXX_ATOMIC 1 #define _GLIBCXX_ATOMIC_BASE_H 1 #define _GLIBCXX_CXX_CONFIG_H 1 #define __GLIBCXX__ 20111102 #define _GLIBCXX_PURE __attribute__ ((__pure__)) #define _GLIBCXX_CONST __attribute__ ((__const__)) #define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 0 #define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) #define _GLIBCXX_USE_DEPRECATED 1 #define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) #define _GLIBCXX_CONSTEXPR constexpr #define _GLIBCXX_USE_CONSTEXPR constexpr #define _GLIBCXX_NOEXCEPT noexcept #define _GLIBCXX_USE_NOEXCEPT noexcept #define _GLIBCXX_THROW(_EXC) #define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT #define _GLIBCXX_EXTERN_TEMPLATE 1 #define __glibcxx_assert(_Condition) #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) #define _GLIBCXX_BEGIN_EXTERN_C extern "C" { #define _GLIBCXX_END_EXTERN_C } #define _GLIBCXX_OS_DEFINES #define __COMPATMATH__ #define _GLIBCXX_CPU_DEFINES 1 #define __glibcxx_integral_traps false #define _GLIBCXX_PSEUDO_VISIBILITY(V) #define _GLIBCXX_WEAK_DEFINITION #define _GLIBCXX_FAST_MATH 0 #define __N(msgid) (msgid) #undef min #undef max namespace std { 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() { return value; } }; typedef integral_constant<bool, true> true_type; typedef integral_constant<bool, false> false_type; template<typename _Tp, _Tp __v> constexpr _Tp integral_constant<_Tp, __v>::value; 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 integral_constant<bool, !_Pp::value> { }; struct __sfinae_types { typedef char __one; typedef struct { char __arr[2]; } __two; }; template<typename> struct remove_cv; template<typename> struct __is_void_helper : public false_type { }; template<> struct __is_void_helper<void> : public true_type { }; 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 { }; 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 { }; template<> struct __is_integral_helper<wchar_t> : public true_type { }; 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 { }; 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 { }; 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 { }; template<typename _Tp> struct is_floating_point : public integral_constant<bool, (__is_floating_point_helper<typename remove_cv<_Tp>::type>::value)> { }; 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 { }; template<typename _Tp> struct is_pointer : public integral_constant<bool, (__is_pointer_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct is_lvalue_reference : public false_type { }; template<typename _Tp> struct is_lvalue_reference<_Tp&> : public true_type { }; 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> { }; 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 { }; template<typename _Tp, typename _Cp> struct __is_member_function_pointer_helper<_Tp _Cp::*> : public integral_constant<bool, is_function<_Tp>::value> { }; template<typename _Tp> struct is_member_function_pointer : public integral_constant<bool, (__is_member_function_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; template<typename _Tp> struct is_enum : public integral_constant<bool, __is_enum(_Tp)> { }; template<typename _Tp> struct is_union : public integral_constant<bool, __is_union(_Tp)> { }; template<typename _Tp> struct is_class : public integral_constant<bool, __is_class(_Tp)> { }; 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 { }; template<typename> struct __is_nullptr_t_helper : public false_type { }; template<> struct __is_nullptr_t_helper<std::nullptr_t> : public true_type { }; template<typename _Tp> struct __is_nullptr_t : public integral_constant<bool, (__is_nullptr_t_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename _Tp> struct is_reference : public __or_<is_lvalue_reference<_Tp>, is_rvalue_reference<_Tp>>::type { }; template<typename _Tp> struct is_arithmetic : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type { }; template<typename _Tp> struct is_fundamental : public __or_<is_arithmetic<_Tp>, is_void<_Tp>>::type { }; 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; template<typename _Tp> struct is_scalar : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>, is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type { }; 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 { }; template<typename _Tp> struct is_member_pointer : public integral_constant<bool, (__is_member_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct is_const : public false_type { }; template<typename _Tp> struct is_const<_Tp const> : public true_type { }; template<typename> struct is_volatile : public false_type { }; template<typename _Tp> struct is_volatile<_Tp volatile> : public true_type { }; template<typename _Tp> struct is_trivial : public integral_constant<bool, __is_trivial(_Tp)> { }; template<typename _Tp> struct is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> { }; template<typename _Tp> struct is_pod : public integral_constant<bool, __is_pod(_Tp)> { }; template<typename _Tp> struct is_literal_type : public integral_constant<bool, __is_literal_type(_Tp)> { }; template<typename _Tp> struct is_empty : public integral_constant<bool, __is_empty(_Tp)> { }; template<typename _Tp> struct is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> { }; template<typename _Tp> struct is_abstract : public integral_constant<bool, __is_abstract(_Tp)> { }; template<typename _Tp, bool = is_integral<_Tp>::value, bool = is_floating_point<_Tp>::value> struct __is_signed_helper : public false_type { }; template<typename _Tp> struct __is_signed_helper<_Tp, false, true> : public true_type { }; template<typename _Tp> struct __is_signed_helper<_Tp, true, false> : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))> { }; template<typename _Tp> struct is_signed : public integral_constant<bool, __is_signed_helper<_Tp>::value> { }; template<typename _Tp> struct is_unsigned : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type { }; template<typename> struct add_rvalue_reference; template<typename _Tp> typename add_rvalue_reference<_Tp>::type declval() noexcept; 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>>>::type { }; struct __do_is_destructible_impl_1 { template<typename _Up> struct __w { _Up __u; }; template<typename _Tp, typename = decltype(declval<__w<_Tp>&>().~__w<_Tp>())> static true_type __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_destructible_impl_1 : public __do_is_destructible_impl_1 { typedef decltype(__test<_Tp>(0)) type; }; struct __do_is_destructible_impl_2 { 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_2 : public __do_is_destructible_impl_2 { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp, bool = __or_<is_void<_Tp>, __is_array_unknown_bounds<_Tp>>::value, bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value> struct __is_destructible_safe; template<typename _Tp> struct __is_destructible_safe<_Tp, false, false> : public conditional<is_abstract<_Tp>::value, __is_destructible_impl_2<_Tp>, __is_destructible_impl_1<_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 { }; template<typename _Tp> struct is_destructible : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)> { }; struct __do_is_default_constructible_impl { template<typename _Tp, typename = decltype(_Tp())> static true_type __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_default_constructible_impl : public __do_is_default_constructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp> struct __is_default_constructible_atom : public __and_<__not_<is_void<_Tp>>, __is_default_constructible_impl<_Tp>>::type { }; template<typename _Tp, bool = is_array<_Tp>::value> struct __is_default_constructible_safe; template<typename _Tp> struct __is_default_constructible_safe<_Tp, true> : public __and_<__is_array_known_bounds<_Tp>, __is_default_constructible_atom<typename remove_all_extents<_Tp>::type>>::type { }; template<typename _Tp> struct __is_default_constructible_safe<_Tp, false> : public __is_default_constructible_atom<_Tp>::type { }; template<typename _Tp> struct is_default_constructible : public integral_constant<bool, (__is_default_constructible_safe< _Tp>::value)> { }; struct __do_is_static_castable_impl { template<typename _From, typename _To, typename = decltype(static_cast<_To>(declval<_From>()))> static true_type __test(int); template<typename, typename> static false_type __test(...); }; template<typename _From, typename _To> struct __is_static_castable_impl : public __do_is_static_castable_impl { typedef decltype(__test<_From, _To>(0)) type; }; template<typename _From, typename _To> struct __is_static_castable_safe : public __is_static_castable_impl<_From, _To>::type { }; template<typename _From, typename _To> struct __is_static_castable : public integral_constant<bool, (__is_static_castable_safe< _From, _To>::value)> { }; struct __do_is_direct_constructible_impl { template<typename _Tp, typename _Arg, typename = decltype(::new _Tp(declval<_Arg>()))> static true_type __test(int); template<typename, typename> static false_type __test(...); }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_impl : public __do_is_direct_constructible_impl { typedef decltype(__test<_Tp, _Arg>(0)) type; }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_new_safe : public __and_<is_destructible<_Tp>, __is_direct_constructible_impl<_Tp, _Arg>>::type { }; template<typename, typename> struct is_same; template<typename, typename> struct is_base_of; template<typename> struct remove_reference; template<typename _From, typename _To, bool = is_reference<_From>::value> struct __is_base_to_derived_ref; template<typename _From, typename _To> struct __is_base_to_derived_ref<_From, _To, true> { typedef typename remove_cv<typename remove_reference<_From >::type>::type __src_t; typedef typename remove_cv<typename remove_reference<_To >::type>::type __dst_t; typedef __and_<__not_<is_same<__src_t, __dst_t>>, is_base_of<__src_t, __dst_t>> type; static constexpr bool value = type::value; }; template<typename _From, typename _To> struct __is_base_to_derived_ref<_From, _To, false> : public false_type { }; template<typename _From, typename _To, bool = __and_<is_lvalue_reference<_From>, is_rvalue_reference<_To>>::value> struct __is_lvalue_to_rvalue_ref; template<typename _From, typename _To> struct __is_lvalue_to_rvalue_ref<_From, _To, true> { typedef typename remove_cv<typename remove_reference< _From>::type>::type __src_t; typedef typename remove_cv<typename remove_reference< _To>::type>::type __dst_t; typedef __or_<is_same<__src_t, __dst_t>, is_base_of<__dst_t, __src_t>> type; static constexpr bool value = type::value; }; template<typename _From, typename _To> struct __is_lvalue_to_rvalue_ref<_From, _To, false> : public false_type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_ref_cast : public __and_<__is_static_castable<_Arg, _Tp>, __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>, __is_lvalue_to_rvalue_ref<_Arg, _Tp> >>>::type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_new : public conditional<is_reference<_Tp>::value, __is_direct_constructible_ref_cast<_Tp, _Arg>, __is_direct_constructible_new_safe<_Tp, _Arg> >::type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible : public integral_constant<bool, (__is_direct_constructible_new< _Tp, _Arg>::value)> { }; struct __do_is_nary_constructible_impl { template<typename _Tp, typename... _Args, typename = decltype(_Tp(declval<_Args>()...))> static true_type __test(int); template<typename, typename...> static false_type __test(...); }; template<typename _Tp, typename... _Args> struct __is_nary_constructible_impl : public __do_is_nary_constructible_impl { typedef decltype(__test<_Tp, _Args...>(0)) type; }; template<typename _Tp, typename... _Args> struct __is_nary_constructible : public __is_nary_constructible_impl<_Tp, _Args...>::type { static_assert(sizeof...(_Args) > 1, "Only useful for > 1 arguments"); }; template<typename _Tp, typename... _Args> struct __is_constructible_impl : public __is_nary_constructible<_Tp, _Args...> { }; template<typename _Tp, typename _Arg> struct __is_constructible_impl<_Tp, _Arg> : public __is_direct_constructible<_Tp, _Arg> { }; template<typename _Tp> struct __is_constructible_impl<_Tp> : public is_default_constructible<_Tp> { }; template<typename _Tp, typename... _Args> struct is_constructible : public integral_constant<bool, (__is_constructible_impl<_Tp, _Args...>::value)> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_copy_constructible_impl; template<typename _Tp> struct __is_copy_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_copy_constructible_impl<_Tp, false> : public is_constructible<_Tp, const _Tp&> { }; template<typename _Tp> struct is_copy_constructible : public __is_copy_constructible_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_move_constructible_impl; template<typename _Tp> struct __is_move_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_move_constructible_impl<_Tp, false> : public is_constructible<_Tp, _Tp&&> { }; template<typename _Tp> struct is_move_constructible : public __is_move_constructible_impl<_Tp> { }; template<typename _Tp> struct __is_nt_default_constructible_atom : public integral_constant<bool, noexcept(_Tp())> { }; template<typename _Tp, bool = is_array<_Tp>::value> struct __is_nt_default_constructible_impl; template<typename _Tp> struct __is_nt_default_constructible_impl<_Tp, true> : public __and_<__is_array_known_bounds<_Tp>, __is_nt_default_constructible_atom<typename remove_all_extents<_Tp>::type>>::type { }; template<typename _Tp> struct __is_nt_default_constructible_impl<_Tp, false> : public __is_nt_default_constructible_atom<_Tp> { }; template<typename _Tp> struct is_nothrow_default_constructible : public __and_<is_default_constructible<_Tp>, __is_nt_default_constructible_impl<_Tp>>::type { }; template<typename _Tp, typename... _Args> struct __is_nt_constructible_impl : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> { }; template<typename _Tp, typename _Arg> struct __is_nt_constructible_impl<_Tp, _Arg> : public integral_constant<bool, noexcept(static_cast<_Tp>(declval<_Arg>()))> { }; template<typename _Tp> struct __is_nt_constructible_impl<_Tp> : public is_nothrow_default_constructible<_Tp> { }; template<typename _Tp, typename... _Args> struct is_nothrow_constructible : public __and_<is_constructible<_Tp, _Args...>, __is_nt_constructible_impl<_Tp, _Args...>>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nothrow_copy_constructible_impl; template<typename _Tp> struct __is_nothrow_copy_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nothrow_copy_constructible_impl<_Tp, false> : public is_nothrow_constructible<_Tp, const _Tp&> { }; template<typename _Tp> struct is_nothrow_copy_constructible : public __is_nothrow_copy_constructible_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nothrow_move_constructible_impl; template<typename _Tp> struct __is_nothrow_move_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nothrow_move_constructible_impl<_Tp, false> : public is_nothrow_constructible<_Tp, _Tp&&> { }; template<typename _Tp> struct is_nothrow_move_constructible : public __is_nothrow_move_constructible_impl<_Tp> { }; template<typename _Tp, typename _Up> class __is_assignable_helper : public __sfinae_types { template<typename _Tp1, typename _Up1> static decltype(declval<_Tp1>() = declval<_Up1>(), __one()) __test(int); template<typename, typename> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1; }; template<typename _Tp, typename _Up> struct is_assignable : public integral_constant<bool, __is_assignable_helper<_Tp, _Up>::value> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_copy_assignable_impl; template<typename _Tp> struct __is_copy_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_copy_assignable_impl<_Tp, false> : public is_assignable<_Tp&, const _Tp&> { }; template<typename _Tp> struct is_copy_assignable : public __is_copy_assignable_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_move_assignable_impl; template<typename _Tp> struct __is_move_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_move_assignable_impl<_Tp, false> : public is_assignable<_Tp&, _Tp&&> { }; 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>())> { }; template<typename _Tp, typename _Up> struct is_nothrow_assignable : public __and_<is_assignable<_Tp, _Up>, __is_nt_assignable_impl<_Tp, _Up>>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nt_copy_assignable_impl; template<typename _Tp> struct __is_nt_copy_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nt_copy_assignable_impl<_Tp, false> : public is_nothrow_assignable<_Tp&, const _Tp&> { }; template<typename _Tp> struct is_nothrow_copy_assignable : public __is_nt_copy_assignable_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nt_move_assignable_impl; template<typename _Tp> struct __is_nt_move_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nt_move_assignable_impl<_Tp, false> : public is_nothrow_assignable<_Tp&, _Tp&&> { }; template<typename _Tp> struct is_nothrow_move_assignable : public __is_nt_move_assignable_impl<_Tp> { }; template<typename _Tp> struct has_trivial_default_constructor : public integral_constant<bool, __has_trivial_constructor(_Tp)> { }; template<typename _Tp> struct has_trivial_copy_constructor : public integral_constant<bool, __has_trivial_copy(_Tp)> { }; template<typename _Tp> struct has_trivial_copy_assign : public integral_constant<bool, __has_trivial_assign(_Tp)> { }; template<typename _Tp> struct has_trivial_destructor : public integral_constant<bool, __has_trivial_destructor(_Tp)> { }; template<typename _Tp> struct has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> { }; template<typename _Tp> struct alignment_of : public integral_constant<std::size_t, __alignof__(_Tp)> { }; 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> { }; 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> { }; template<typename, typename> struct is_same : public false_type { }; template<typename _Tp> struct is_same<_Tp, _Tp> : public true_type { }; 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 { static constexpr bool value = is_void<_To>::value; }; template<typename _From, typename _To> class __is_convertible_helper<_From, _To, false> : public __sfinae_types { template<typename _To1> static void __test_aux(_To1); template<typename _From1, typename _To1> static decltype(__test_aux<_To1>(std::declval<_From1>()), __one()) __test(int); template<typename, typename> static __two __test(...); public: static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1; }; template<typename _From, typename _To> struct is_convertible : public integral_constant<bool, __is_convertible_helper<_From, _To>::value> { }; template<typename _From, typename _To> struct is_explicitly_convertible : public is_constructible<_To, _From> { }; template<typename _Tp> struct remove_const { typedef _Tp type; }; template<typename _Tp> struct remove_const<_Tp const> { typedef _Tp type; }; template<typename _Tp> struct remove_volatile { typedef _Tp type; }; template<typename _Tp> struct remove_volatile<_Tp volatile> { typedef _Tp type; }; template<typename _Tp> struct remove_cv { typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type; }; template<typename _Tp> struct add_const { typedef _Tp const type; }; template<typename _Tp> struct add_volatile { typedef _Tp volatile type; }; template<typename _Tp> struct add_cv { typedef typename add_const<typename add_volatile<_Tp>::type>::type type; }; 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 = __and_<__not_<is_reference<_Tp>>, __not_<is_void<_Tp>>>::value, bool = is_rvalue_reference<_Tp>::value> struct __add_lvalue_reference_helper { typedef _Tp type; }; template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, true, false> { typedef _Tp& type; }; template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, false, true> { typedef typename remove_reference<_Tp>::type& type; }; template<typename _Tp> struct add_lvalue_reference : public __add_lvalue_reference_helper<_Tp> { }; template<typename _Tp, bool = __and_<__not_<is_reference<_Tp>>, __not_<is_void<_Tp>>>::value> struct __add_rvalue_reference_helper { typedef _Tp type; }; template<typename _Tp> struct __add_rvalue_reference_helper<_Tp, true> { typedef _Tp&& type; }; template<typename _Tp> struct add_rvalue_reference : public __add_rvalue_reference_helper<_Tp> { }; 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; }; 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; }; 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> { 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); typedef conditional<__b2, unsigned int, unsigned long> __cond2; typedef typename __cond2::type __cond2_type; typedef conditional<__b1, unsigned short, __cond2_type> __cond1; typedef typename __cond1::type __cond1_type; public: typedef typename conditional<__b0, __smallest, __cond1_type>::type __type; }; template<typename _Tp> struct make_unsigned { typedef typename __make_unsigned_selector<_Tp>::__type type; }; template<> struct make_unsigned<bool>; 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; }; 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 signed char __smallest; static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest); static const bool __b1 = sizeof(_Tp) <= sizeof(signed short); static const bool __b2 = sizeof(_Tp) <= sizeof(signed int); typedef conditional<__b2, signed int, signed long> __cond2; typedef typename __cond2::type __cond2_type; typedef conditional<__b1, signed short, __cond2_type> __cond1; typedef typename __cond1::type __cond1_type; public: typedef typename conditional<__b0, __smallest, __cond1_type>::type __type; }; template<typename _Tp> struct make_signed { typedef typename __make_signed_selector<_Tp>::__type type; }; template<> struct make_signed<bool>; 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; }; 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; }; 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; }; template<typename _Tp> struct remove_pointer : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> { }; template<typename _Tp> struct add_pointer { typedef typename remove_reference<_Tp>::type* type; }; template<std::size_t _Len> struct __aligned_storage_msa { union __type { unsigned char __data[_Len]; struct __attribute__((__aligned__)) { } __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 _Up, bool _IsArray = is_array<_Up>::value, bool _IsFunction = is_function<_Up>::value> struct __decay_selector; 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; }; 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; 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 _Tp> struct __decay_and_strip { typedef typename __strip_reference_wrapper< typename decay<_Tp>::type>::__type __type; }; template<bool, typename _Tp = void> struct enable_if { }; template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; template<bool _Cond, typename _Iftrue, typename _Iffalse> struct conditional { typedef _Iftrue type; }; template<typename _Iftrue, typename _Iffalse> struct conditional<false, _Iftrue, _Iffalse> { typedef _Iffalse type; }; template<typename... _Tp> struct common_type; template<typename _Tp> struct common_type<_Tp> { typedef _Tp type; }; template<typename _Tp, typename _Up> struct common_type<_Tp, _Up> { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; }; template<typename _Tp, typename _Up, typename... _Vp> struct common_type<_Tp, _Up, _Vp...> { typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; }; template<typename _Tp> struct underlying_type { typedef __underlying_type(_Tp) type; }; template<typename _Tp> struct __declval_protector { static const bool __stop = false; static typename add_rvalue_reference<_Tp>::type __delegate(); }; template<typename _Tp> inline typename add_rvalue_reference<_Tp>::type declval() noexcept { static_assert(__declval_protector<_Tp>::__stop, "declval() must not be used!"); return __declval_protector<_Tp>::__delegate(); } template<typename _Signature> class result_of; template<typename _MemPtr, typename _Arg> struct _Result_of_memobj; template<typename _Res, typename _Class, typename _Arg> struct _Result_of_memobj<_Res _Class::*, _Arg> { private: typedef _Res _Class::* _Func; template<typename _Tp> static _Tp _S_get(const _Class&); template<typename _Tp> static decltype(*std::declval<_Tp>()) _S_get(...); public: typedef decltype(_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>()) __type; }; template<typename _MemPtr, typename _Arg, typename... _ArgTypes> struct _Result_of_memfun; template<typename _Res, typename _Class, typename _Arg, typename... _Args> struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...> { private: typedef _Res _Class::* _Func; template<typename _Tp> static _Tp _S_get(const _Class&); template<typename _Tp> static decltype(*std::declval<_Tp>()) _S_get(...); public: typedef decltype((_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>()) (std::declval<_Args>()...) ) __type; }; template<bool, bool, typename _Functor, typename... _ArgTypes> struct _Result_of_impl; template<typename _Functor, typename... _ArgTypes> struct _Result_of_impl<false, false, _Functor, _ArgTypes...> { typedef decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) ) __type; }; template<typename _MemPtr, typename _Arg> struct _Result_of_impl<true, false, _MemPtr, _Arg> : _Result_of_memobj<typename remove_reference<_MemPtr>::type, _Arg> { typedef typename _Result_of_memobj< typename remove_reference<_MemPtr>::type, _Arg>::__type __type; }; template<typename _MemPtr, typename _Arg, typename... _ArgTypes> struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...> : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...> { typedef typename _Result_of_memfun< typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type __type; }; template<typename _Functor, typename... _ArgTypes> struct result_of<_Functor(_ArgTypes...)> : _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...> { typedef typename _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 type; }; #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) template<typename _Tp> class __has_ ##_NTYPE ##_helper : __sfinae_types { template<typename _Up> struct _Wrap_type { }; template<typename _Up> static __one __test(_Wrap_type<typename _Up::_NTYPE>*); template<typename _Up> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; }; template<typename _Tp> struct __has_ ##_NTYPE : integral_constant<bool, __has_ ##_NTYPE ##_helper <typename remove_cv<_Tp>::type>::value> { }; } namespace std { enum float_round_style { round_indeterminate = -1, round_toward_zero = 0, round_to_nearest = 1, round_toward_infinity = 2, round_toward_neg_infinity = 3 }; enum float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; struct __numeric_limits_base { static constexpr bool is_specialized = false; static constexpr int digits = 0; static constexpr int digits10 = 0; static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = false; static constexpr bool is_exact = false; static constexpr int radix = 0; static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr bool is_iec559 = false; static constexpr bool is_bounded = false; static constexpr bool is_modulo = false; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<typename _Tp> struct numeric_limits : public __numeric_limits_base { static constexpr _Tp min() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp max() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp lowest() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp epsilon() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp round_error() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp infinity() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp quiet_NaN() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp signaling_NaN() noexcept { return static_cast<_Tp>(0); } static constexpr _Tp denorm_min() noexcept { return static_cast<_Tp>(0); } }; template<typename _Tp> struct numeric_limits<const _Tp> : public numeric_limits<_Tp> { }; template<typename _Tp> struct numeric_limits<volatile _Tp> : public numeric_limits<_Tp> { }; template<typename _Tp> struct numeric_limits<const volatile _Tp> : public numeric_limits<_Tp> { }; template<> struct numeric_limits<bool> { static constexpr bool is_specialized = true; static constexpr bool min() noexcept { return false; } static constexpr bool max() noexcept { return true; } static constexpr bool lowest() noexcept { return min(); } static constexpr int digits = 1; static constexpr int digits10 = 0; static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr bool epsilon() noexcept { return false; } static constexpr bool round_error() noexcept { return false; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr bool infinity() noexcept { return false; } static constexpr bool quiet_NaN() noexcept { return false; } static constexpr bool signaling_NaN() noexcept { return false; } static constexpr bool denorm_min() noexcept { return false; } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = false; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<char> { static constexpr bool is_specialized = true; static constexpr char min() noexcept { return (((char)(-1) < 0) ? (char)1 << (sizeof(char) * 8 - ((char)(-1) < 0)) : (char)0); } static constexpr char max() noexcept { return (((char)(-1) < 0) ? (((((char)1 << ((sizeof(char) * 8 - ((char)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(char)0); } static constexpr char lowest() noexcept { return min(); } static constexpr int digits = (sizeof(char) * 8 - ((char)(-1) < 0)); static constexpr int digits10 = ((sizeof(char) * 8 - ((char)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = ((char)(-1) < 0); static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr char epsilon() noexcept { return 0; } static constexpr char round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr char infinity() noexcept { return char(); } static constexpr char quiet_NaN() noexcept { return char(); } static constexpr char signaling_NaN() noexcept { return char(); } static constexpr char denorm_min() noexcept { return static_cast<char>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<signed char> { static constexpr bool is_specialized = true; static constexpr signed char min() noexcept { return -127 - 1; } static constexpr signed char max() noexcept { return 127; } static constexpr signed char lowest() noexcept { return min(); } static constexpr int digits = (sizeof(signed char) * 8 - ((signed char)(-1) < 0)); static constexpr int digits10 = ((sizeof(signed char) * 8 - ((signed char)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = true; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr signed char epsilon() noexcept { return 0; } static constexpr signed char round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr signed char infinity() noexcept { return static_cast<signed char>(0); } static constexpr signed char quiet_NaN() noexcept { return static_cast<signed char>(0); } static constexpr signed char signaling_NaN() noexcept { return static_cast<signed char>(0); } static constexpr signed char denorm_min() noexcept { return static_cast<signed char>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<unsigned char> { static constexpr bool is_specialized = true; static constexpr unsigned char min() noexcept { return 0; } static constexpr unsigned char max() noexcept { return 127 * 2U + 1; } static constexpr unsigned char lowest() noexcept { return min(); } static constexpr int digits = (sizeof(unsigned char) * 8 - ((unsigned char)(-1) < 0)); static constexpr int digits10 = ((sizeof(unsigned char) * 8 - ((unsigned char)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr unsigned char epsilon() noexcept { return 0; } static constexpr unsigned char round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr unsigned char infinity() noexcept { return static_cast<unsigned char>(0); } static constexpr unsigned char quiet_NaN() noexcept { return static_cast<unsigned char>(0); } static constexpr unsigned char signaling_NaN() noexcept { return static_cast<unsigned char>(0); } static constexpr unsigned char denorm_min() noexcept { return static_cast<unsigned char>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<wchar_t> { static constexpr bool is_specialized = true; static constexpr wchar_t min() noexcept { return (((wchar_t)(-1) < 0) ? (wchar_t)1 << (sizeof(wchar_t) * 8 - ((wchar_t)(-1) < 0)) : (wchar_t)0); } static constexpr wchar_t max() noexcept { return (((wchar_t)(-1) < 0) ? (((((wchar_t)1 << ((sizeof(wchar_t) * 8 - ((wchar_t)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(wchar_t)0); } static constexpr wchar_t lowest() noexcept { return min(); } static constexpr int digits = (sizeof(wchar_t) * 8 - ((wchar_t)(-1) < 0)); static constexpr int digits10 = ((sizeof(wchar_t) * 8 - ((wchar_t)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = ((wchar_t)(-1) < 0); static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr wchar_t epsilon() noexcept { return 0; } static constexpr wchar_t round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr wchar_t infinity() noexcept { return wchar_t(); } static constexpr wchar_t quiet_NaN() noexcept { return wchar_t(); } static constexpr wchar_t signaling_NaN() noexcept { return wchar_t(); } static constexpr wchar_t denorm_min() noexcept { return wchar_t(); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<char16_t> { static constexpr bool is_specialized = true; static constexpr char16_t min() noexcept { return (((char16_t)(-1) < 0) ? (char16_t)1 << (sizeof(char16_t) * 8 - ((char16_t)(-1) < 0)) : (char16_t)0); } static constexpr char16_t max() noexcept { return (((char16_t)(-1) < 0) ? (((((char16_t)1 << ((sizeof(char16_t) * 8 - ((char16_t)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(char16_t)0); } static constexpr char16_t lowest() noexcept { return min(); } static constexpr int digits = (sizeof(char16_t) * 8 - ((char16_t)(-1) < 0)); static constexpr int digits10 = ((sizeof(char16_t) * 8 - ((char16_t)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = ((char16_t)(-1) < 0); static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr char16_t epsilon() noexcept { return 0; } static constexpr char16_t round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr char16_t infinity() noexcept { return char16_t(); } static constexpr char16_t quiet_NaN() noexcept { return char16_t(); } static constexpr char16_t signaling_NaN() noexcept { return char16_t(); } static constexpr char16_t denorm_min() noexcept { return char16_t(); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<char32_t> { static constexpr bool is_specialized = true; static constexpr char32_t min() noexcept { return (((char32_t)(-1) < 0) ? (char32_t)1 << (sizeof(char32_t) * 8 - ((char32_t)(-1) < 0)) : (char32_t)0); } static constexpr char32_t max() noexcept { return (((char32_t)(-1) < 0) ? (((((char32_t)1 << ((sizeof(char32_t) * 8 - ((char32_t)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(char32_t)0); } static constexpr char32_t lowest() noexcept { return min(); } static constexpr int digits = (sizeof(char32_t) * 8 - ((char32_t)(-1) < 0)); static constexpr int digits10 = ((sizeof(char32_t) * 8 - ((char32_t)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = ((char32_t)(-1) < 0); static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr char32_t epsilon() noexcept { return 0; } static constexpr char32_t round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr char32_t infinity() noexcept { return char32_t(); } static constexpr char32_t quiet_NaN() noexcept { return char32_t(); } static constexpr char32_t signaling_NaN() noexcept { return char32_t(); } static constexpr char32_t denorm_min() noexcept { return char32_t(); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<short> { static constexpr bool is_specialized = true; static constexpr short min() noexcept { return -32767 - 1; } static constexpr short max() noexcept { return 32767; } static constexpr short lowest() noexcept { return min(); } static constexpr int digits = (sizeof(short) * 8 - ((short)(-1) < 0)); static constexpr int digits10 = ((sizeof(short) * 8 - ((short)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = true; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr short epsilon() noexcept { return 0; } static constexpr short round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr short infinity() noexcept { return short(); } static constexpr short quiet_NaN() noexcept { return short(); } static constexpr short signaling_NaN() noexcept { return short(); } static constexpr short denorm_min() noexcept { return short(); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<unsigned short> { static constexpr bool is_specialized = true; static constexpr unsigned short min() noexcept { return 0; } static constexpr unsigned short max() noexcept { return 32767 * 2U + 1; } static constexpr unsigned short lowest() noexcept { return min(); } static constexpr int digits = (sizeof(unsigned short) * 8 - ((unsigned short)(-1) < 0)); static constexpr int digits10 = ((sizeof(unsigned short) * 8 - ((unsigned short)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr unsigned short epsilon() noexcept { return 0; } static constexpr unsigned short round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr unsigned short infinity() noexcept { return static_cast<unsigned short>(0); } static constexpr unsigned short quiet_NaN() noexcept { return static_cast<unsigned short>(0); } static constexpr unsigned short signaling_NaN() noexcept { return static_cast<unsigned short>(0); } static constexpr unsigned short denorm_min() noexcept { return static_cast<unsigned short>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<int> { static constexpr bool is_specialized = true; static constexpr int min() noexcept { return -2147483647 - 1; } static constexpr int max() noexcept { return 2147483647; } static constexpr int lowest() noexcept { return min(); } static constexpr int digits = (sizeof(int) * 8 - ((int)(-1) < 0)); static constexpr int digits10 = ((sizeof(int) * 8 - ((int)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = true; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr int epsilon() noexcept { return 0; } static constexpr int round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr int infinity() noexcept { return static_cast<int>(0); } static constexpr int quiet_NaN() noexcept { return static_cast<int>(0); } static constexpr int signaling_NaN() noexcept { return static_cast<int>(0); } static constexpr int denorm_min() noexcept { return static_cast<int>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<unsigned int> { static constexpr bool is_specialized = true; static constexpr unsigned int min() noexcept { return 0; } static constexpr unsigned int max() noexcept { return 2147483647 * 2U + 1; } static constexpr unsigned int lowest() noexcept { return min(); } static constexpr int digits = (sizeof(unsigned int) * 8 - ((unsigned int)(-1) < 0)); static constexpr int digits10 = ((sizeof(unsigned int) * 8 - ((unsigned int)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr unsigned int epsilon() noexcept { return 0; } static constexpr unsigned int round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr unsigned int infinity() noexcept { return static_cast<unsigned int>(0); } static constexpr unsigned int quiet_NaN() noexcept { return static_cast<unsigned int>(0); } static constexpr unsigned int signaling_NaN() noexcept { return static_cast<unsigned int>(0); } static constexpr unsigned int denorm_min() noexcept { return static_cast<unsigned int>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<long> { static constexpr bool is_specialized = true; static constexpr long min() noexcept { return -2147483647L - 1; } static constexpr long max() noexcept { return 2147483647L; } static constexpr long lowest() noexcept { return min(); } static constexpr int digits = (sizeof(long) * 8 - ((long)(-1) < 0)); static constexpr int digits10 = ((sizeof(long) * 8 - ((long)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = true; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr long epsilon() noexcept { return 0; } static constexpr long round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr long infinity() noexcept { return static_cast<long>(0); } static constexpr long quiet_NaN() noexcept { return static_cast<long>(0); } static constexpr long signaling_NaN() noexcept { return static_cast<long>(0); } static constexpr long denorm_min() noexcept { return static_cast<long>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<unsigned long> { static constexpr bool is_specialized = true; static constexpr unsigned long min() noexcept { return 0; } static constexpr unsigned long max() noexcept { return 2147483647L * 2UL + 1; } static constexpr unsigned long lowest() noexcept { return min(); } static constexpr int digits = (sizeof(unsigned long) * 8 - ((unsigned long)(-1) < 0)); static constexpr int digits10 = ((sizeof(unsigned long) * 8 - ((unsigned long)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr unsigned long epsilon() noexcept { return 0; } static constexpr unsigned long round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr unsigned long infinity() noexcept { return static_cast<unsigned long>(0); } static constexpr unsigned long quiet_NaN() noexcept { return static_cast<unsigned long>(0); } static constexpr unsigned long signaling_NaN() noexcept { return static_cast<unsigned long>(0); } static constexpr unsigned long denorm_min() noexcept { return static_cast<unsigned long>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<long long> { static constexpr bool is_specialized = true; static constexpr long long min() noexcept { return -9223372036854775807LL - 1; } static constexpr long long max() noexcept { return 9223372036854775807LL; } static constexpr long long lowest() noexcept { return min(); } static constexpr int digits = (sizeof(long long) * 8 - ((long long)(-1) < 0)); static constexpr int digits10 = ((sizeof(long long) * 8 - ((long long)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = true; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr long long epsilon() noexcept { return 0; } static constexpr long long round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr long long infinity() noexcept { return static_cast<long long>(0); } static constexpr long long quiet_NaN() noexcept { return static_cast<long long>(0); } static constexpr long long signaling_NaN() noexcept { return static_cast<long long>(0); } static constexpr long long denorm_min() noexcept { return static_cast<long long>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<unsigned long long> { static constexpr bool is_specialized = true; static constexpr unsigned long long min() noexcept { return 0; } static constexpr unsigned long long max() noexcept { return 9223372036854775807LL * 2ULL + 1; } static constexpr unsigned long long lowest() noexcept { return min(); } static constexpr int digits = (sizeof(unsigned long long) * 8 - ((unsigned long long)(-1) < 0)); static constexpr int digits10 = ((sizeof(unsigned long long) * 8 - ((unsigned long long)(-1) < 0)) * 643L / 2136); static constexpr int max_digits10 = 0; static constexpr bool is_signed = false; static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr unsigned long long epsilon() noexcept { return 0; } static constexpr unsigned long long round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr unsigned long long infinity() noexcept { return static_cast<unsigned long long>(0); } static constexpr unsigned long long quiet_NaN() noexcept { return static_cast<unsigned long long>(0); } static constexpr unsigned long long signaling_NaN() noexcept { return static_cast<unsigned long long>(0); } static constexpr unsigned long long denorm_min() noexcept { return static_cast<unsigned long long>(0); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = true; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; template<> struct numeric_limits<float> { static constexpr bool is_specialized = true; static constexpr float min() noexcept { return 1.1754943508222875e-38F; } static constexpr float max() noexcept { return 3.4028234663852886e+38F; } static constexpr float lowest() noexcept { return -3.4028234663852886e+38F; } static constexpr int digits = 24; static constexpr int digits10 = 6; static constexpr int max_digits10 = (2 + (24) * 643L / 2136); static constexpr bool is_signed = true; static constexpr bool is_integer = false; static constexpr bool is_exact = false; static constexpr int radix = 2; static constexpr float epsilon() noexcept { return 1.1920928955078125e-7F; } static constexpr float round_error() noexcept { return 0.5F; } static constexpr int min_exponent = (-125); static constexpr int min_exponent10 = (-37); static constexpr int max_exponent = 128; static constexpr int max_exponent10 = 38; static constexpr bool has_infinity = 1; static constexpr bool has_quiet_NaN = 1; static constexpr bool has_signaling_NaN = has_quiet_NaN; static constexpr float_denorm_style has_denorm = bool(1) ? denorm_present : denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr float infinity() noexcept { return __builtin_huge_valf(); } static constexpr float quiet_NaN() noexcept { return __builtin_nanf(""); } static constexpr float signaling_NaN() noexcept { return __builtin_nansf(""); } static constexpr float denorm_min() noexcept { return 1.4012984643248171e-45F; } static constexpr bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static constexpr bool is_bounded = true; static constexpr bool is_modulo = false; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_to_nearest; }; #undef __glibcxx_float_has_denorm_loss #undef __glibcxx_float_traps #undef __glibcxx_float_tinyness_before template<> struct numeric_limits<double> { static constexpr bool is_specialized = true; static constexpr double min() noexcept { return double(2.2250738585072014e-308L); } static constexpr double max() noexcept { return double(1.7976931348623157e+308L); } static constexpr double lowest() noexcept { return -double(1.7976931348623157e+308L); } static constexpr int digits = 53; static constexpr int digits10 = 15; static constexpr int max_digits10 = (2 + (53) * 643L / 2136); static constexpr bool is_signed = true; static constexpr bool is_integer = false; static constexpr bool is_exact = false; static constexpr int radix = 2; static constexpr double epsilon() noexcept { return double(2.2204460492503131e-16L); } static constexpr double round_error() noexcept { return 0.5; } static constexpr int min_exponent = (-1021); static constexpr int min_exponent10 = (-307); static constexpr int max_exponent = 1024; static constexpr int max_exponent10 = 308; static constexpr bool has_infinity = 1; static constexpr bool has_quiet_NaN = 1; static constexpr bool has_signaling_NaN = has_quiet_NaN; static constexpr float_denorm_style has_denorm = bool(1) ? denorm_present : denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr double infinity() noexcept { return __builtin_huge_val(); } static constexpr double quiet_NaN() noexcept { return __builtin_nan(""); } static constexpr double signaling_NaN() noexcept { return __builtin_nans(""); } static constexpr double denorm_min() noexcept { return double(4.9406564584124654e-324L); } static constexpr bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static constexpr bool is_bounded = true; static constexpr bool is_modulo = false; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_to_nearest; }; #undef __glibcxx_double_has_denorm_loss #undef __glibcxx_double_traps #undef __glibcxx_double_tinyness_before template<> struct numeric_limits<long double> { static constexpr bool is_specialized = true; static constexpr long double min() noexcept { return 2.2250738585072014e-308L; } static constexpr long double max() noexcept { return 1.7976931348623157e+308L; } static constexpr long double lowest() noexcept { return -1.7976931348623157e+308L; } static constexpr int digits = 53; static constexpr int digits10 = 15; static constexpr int max_digits10 = (2 + (53) * 643L / 2136); static constexpr bool is_signed = true; static constexpr bool is_integer = false; static constexpr bool is_exact = false; static constexpr int radix = 2; static constexpr long double epsilon() noexcept { return 2.2204460492503131e-16L; } static constexpr long double round_error() noexcept { return 0.5L; } static constexpr int min_exponent = (-1021); static constexpr int min_exponent10 = (-307); static constexpr int max_exponent = 1024; static constexpr int max_exponent10 = 308; static constexpr bool has_infinity = 1; static constexpr bool has_quiet_NaN = 1; static constexpr bool has_signaling_NaN = has_quiet_NaN; static constexpr float_denorm_style has_denorm = bool(1) ? denorm_present : denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr long double infinity() noexcept { return __builtin_huge_vall(); } static constexpr long double quiet_NaN() noexcept { return __builtin_nanl(""); } static constexpr long double signaling_NaN() noexcept { return __builtin_nansl(""); } static constexpr long double denorm_min() noexcept { return 4.9406564584124654e-324L; } static constexpr bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static constexpr bool is_bounded = true; static constexpr bool is_modulo = false; static constexpr bool traps = false; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_to_nearest; }; #undef __glibcxx_long_double_has_denorm_loss #undef __glibcxx_long_double_traps #undef __glibcxx_long_double_tinyness_before } #undef __glibcxx_signed #undef __glibcxx_min #undef __glibcxx_max #undef __glibcxx_digits #undef __glibcxx_digits10 #undef __glibcxx_max_digits10 #define _H_TIME extern "C" { #define CLOCKS_PER_SEC 1000000 struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; extern size_t strftime(char *, size_t, const char *, const struct tm *); extern clock_t clock(void); extern double difftime(time_t, time_t); extern time_t mktime(struct tm *); extern time_t time(time_t *); extern char *asctime(const struct tm *); extern char *ctime(const time_t *); extern struct tm *gmtime(const time_t *); extern struct tm *localtime(const time_t *); extern char *asctime_r(const struct tm *, char *); extern char *ctime_r(const time_t *, char *); extern struct tm *gmtime_r(const time_t *, struct tm *); extern struct tm *localtime_r(const time_t *, struct tm *); #undef _STD_TYPES_T #define CLK_TCK 100 extern char *tzname[]; extern void tzset(void); extern long timezone; extern int daylight; extern char *strptime(const char *, const char *, struct tm *); extern int getdate_err; extern struct tm *getdate(const char *); #define _TIMESPEC struct timespec { time_t tv_sec; long tv_nsec; }; struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #define CLOCK_REALTIME ((clockid_t) 9) #define CLOCK_MONOTONIC ((clockid_t) 10) #define CLOCK_PROCESS_CPUTIME_ID ((clockid_t) 11) #define CLOCK_THREAD_CPUTIME_ID ((clockid_t) 12) #define TIMER_ABSTIME 999 extern int clock_getres(clockid_t, struct timespec *); extern int clock_gettime(clockid_t, struct timespec *); extern int clock_settime(clockid_t, const struct timespec *); extern int clock_getcpuclockid(pid_t, clockid_t *); extern int nanosleep(const struct timespec *, struct timespec *); extern int timer_create(clockid_t, void *, timer_t *); extern int timer_delete(timer_t); extern int timer_gettime(timer_t, struct itimerspec *); extern int timer_getoverrun(timer_t); extern int timer_settime(timer_t, int, const struct itimerspec *, struct itimerspec *); extern int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*); #define _STDDEF_H #define _STDDEF_H_ #define _ANSI_STDDEF_H #define __STDDEF_H__ #undef __need_ptrdiff_t #undef __need_size_t #undef __need_wchar_t #undef NULL #define NULL __null #undef __need_NULL #define offsetof(TYPE,MEMBER) __builtin_offsetof (TYPE, MEMBER) #define TIMELEN 26 #define NLTBMAX 64 extern unsigned char *NLctime(long *); extern unsigned char *NLasctime(struct tm *); extern char *NLstrtime(char *, size_t, const char *, const struct tm *); extern char *ctime64(const time64_t *); extern struct tm *localtime64(const time64_t *); extern struct tm *gmtime64(const time64_t *); extern char *asctime64(const struct tm *); extern time64_t mktime64(struct tm *); extern char *ctime64_r(const time64_t *, char *); extern struct tm *localtime64_r(const time64_t *, struct tm *); extern struct tm *gmtime64_r(const time64_t *, struct tm *); extern char *asctime64_r(const struct tm *, char *); } #define _GLIBCXX_CTIME 1 #undef clock #undef difftime #undef mktime #undef time #undef asctime #undef ctime #undef gmtime #undef localtime #undef strftime extern "C++" { namespace std { class nested_exception { exception_ptr _M_ptr; public: nested_exception() throw() : _M_ptr(current_exception()) { } nested_exception(const nested_exception&) = default; nested_exception& operator=(const nested_exception&) = default; virtual ~nested_exception(); void rethrow_nested() const __attribute__ ((__noreturn__)) { rethrow_exception(_M_ptr); } exception_ptr nested_ptr() const { return _M_ptr; } }; template<typename _Except> struct _Nested_exception : public _Except, public nested_exception { explicit _Nested_exception(_Except&& __ex) : _Except(static_cast<_Except&&>(__ex)) { } }; template<typename _Ex> struct __get_nested_helper { static const nested_exception* _S_get(const _Ex& __ex) { return dynamic_cast<const nested_exception*>(&__ex); } }; template<typename _Ex> struct __get_nested_helper<_Ex*> { static const nested_exception* _S_get(const _Ex* __ex) { return dynamic_cast<const nested_exception*>(__ex); } }; template<typename _Ex> inline const nested_exception* __get_nested_exception(const _Ex& __ex) { return __get_nested_helper<_Ex>::_S_get(__ex); } template<typename _Ex> void __throw_with_nested(_Ex&&, const nested_exception* = 0) __attribute__ ((__noreturn__)); template<typename _Ex> void __throw_with_nested(_Ex&&, ...) __attribute__ ((__noreturn__)); template<typename _Ex> inline void __throw_with_nested(_Ex&& __ex, const nested_exception*) { throw __ex; } template<typename _Ex> inline void __throw_with_nested(_Ex&& __ex, ...) { throw _Nested_exception<_Ex>(static_cast<_Ex&&>(__ex)); } template<typename _Ex> void throw_with_nested(_Ex __ex) __attribute__ ((__noreturn__)); template<typename _Ex> inline void throw_with_nested(_Ex __ex) { if (__get_nested_exception(__ex)) throw __ex; __throw_with_nested(static_cast<_Ex&&>(__ex), &__ex); } template<typename _Ex> inline void rethrow_if_nested(const _Ex& __ex) { if (const nested_exception* __nested = __get_nested_exception(__ex)) __nested->rethrow_nested(); } inline void rethrow_if_nested(const nested_exception& __ex) { __ex.rethrow_nested(); } } } namespace std { template<typename _Arg, typename _Result> struct unary_function { typedef _Arg argument_type; typedef _Result result_type; }; template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function { typedef _Arg1 first_argument_type; typedef _Arg2 second_argument_type; typedef _Result result_type; }; template<typename _Tp> struct plus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } }; template<typename _Tp> struct minus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } }; template<typename _Tp> struct multiplies : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } }; template<typename _Tp> struct divides : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } }; template<typename _Tp> struct modulus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } }; template<typename _Tp> struct negate : public unary_function<_Tp, _Tp> { _Tp operator()(const _Tp& __x) const { return -__x; } }; template<typename _Tp> struct equal_to : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } }; template<typename _Tp> struct not_equal_to : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } }; template<typename _Tp> struct greater : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } }; template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } }; template<typename _Tp> struct greater_equal : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } }; template<typename _Tp> struct less_equal : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } }; template<typename _Tp> struct logical_and : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } }; template<typename _Tp> struct logical_or : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } }; template<typename _Tp> struct logical_not : public unary_function<_Tp, bool> { bool operator()(const _Tp& __x) const { return !__x; } }; template<typename _Tp> struct bit_and : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x & __y; } }; template<typename _Tp> struct bit_or : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x | __y; } }; template<typename _Tp> struct bit_xor : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x ^ __y; } }; template<typename _Predicate> class unary_negate : public unary_function<typename _Predicate::argument_type, bool> { protected: _Predicate _M_pred; public: explicit unary_negate(const _Predicate& __x) : _M_pred(__x) { } bool operator()(const typename _Predicate::argument_type& __x) const { return !_M_pred(__x); } }; template<typename _Predicate> inline unary_negate<_Predicate> not1(const _Predicate& __pred) { return unary_negate<_Predicate>(__pred); } template<typename _Predicate> class binary_negate : public binary_function<typename _Predicate::first_argument_type, typename _Predicate::second_argument_type, bool> { protected: _Predicate _M_pred; public: explicit binary_negate(const _Predicate& __x) : _M_pred(__x) { } bool operator()(const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const { return !_M_pred(__x, __y); } }; template<typename _Predicate> inline binary_negate<_Predicate> not2(const _Predicate& __pred) { return binary_negate<_Predicate>(__pred); } template<typename _Arg, typename _Result> class pointer_to_unary_function : public unary_function<_Arg, _Result> { protected: _Result (*_M_ptr)(_Arg); public: pointer_to_unary_function() { } explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) { } _Result operator()(_Arg __x) const { return _M_ptr(__x); } }; template<typename _Arg, typename _Result> inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg)) { return pointer_to_unary_function<_Arg, _Result>(__x); } template<typename _Arg1, typename _Arg2, typename _Result> class pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result> { protected: _Result (*_M_ptr)(_Arg1, _Arg2); public: pointer_to_binary_function() { } explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) : _M_ptr(__x) { } _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_ptr(__x, __y); } }; template<typename _Arg1, typename _Arg2, typename _Result> inline pointer_to_binary_function<_Arg1, _Arg2, _Result> ptr_fun(_Result (*__x)(_Arg1, _Arg2)) { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } template<typename _Tp> struct _Identity : public unary_function<_Tp,_Tp> { _Tp& operator()(_Tp& __x) const { return __x; } const _Tp& operator()(const _Tp& __x) const { return __x; } }; template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { typename _Pair::first_type& operator()(_Pair& __x) const { return __x.first; } const typename _Pair::first_type& operator()(const _Pair& __x) const { return __x.first; } template<typename _Pair2> typename _Pair2::first_type& operator()(_Pair2& __x) const { return __x.first; } template<typename _Pair2> const typename _Pair2::first_type& operator()(const _Pair2& __x) const { return __x.first; } }; template<typename _Pair> struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { typename _Pair::second_type& operator()(_Pair& __x) const { return __x.second; } const typename _Pair::second_type& operator()(const _Pair& __x) const { return __x.second; } }; template<typename _Ret, typename _Tp> class mem_fun_t : public unary_function<_Tp*, _Ret> { public: explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; template<typename _Ret, typename _Tp> class const_mem_fun_t : public unary_function<const _Tp*, _Ret> { public: explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; template<typename _Ret, typename _Tp> class mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; template<typename _Ret, typename _Tp> class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> { public: explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret> { public: explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; template<typename _Ret, typename _Tp> inline mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)()) { return mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)() const) { return const_mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)()) { return mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } } #define _BACKWARD_BINDERS_H 1 namespace std { 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); } typename _Operation::result_type operator()(typename _Operation::second_argument_type& __x) const { return op(value, __x); } } __attribute__ ((__deprecated__)); 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)); } 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); } typename _Operation::result_type operator()(typename _Operation::first_argument_type& __x) const { return op(__x, value); } } __attribute__ ((__deprecated__)); 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)); } } extern "C++" { #define __GXX_MERGED_TYPEINFO_NAMES 0 #define __GXX_TYPEINFO_EQUALITY_INLINE 0 namespace std { class type_info { public: virtual ~type_info(); const char* name() const { return __name[0] == '*' ? __name + 1 : __name; } bool before(const type_info& __arg) const; bool operator==(const type_info& __arg) const; bool operator!=(const type_info& __arg) const { return !operator==(__arg); } size_t hash_code() const throw() { return _Hash_bytes(name(), __builtin_strlen(name()), static_cast<size_t>(0xc70f6907UL)); } virtual bool __is_pointer_p() const; virtual bool __is_function_p() const; virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, unsigned __outer) const; 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: type_info& operator=(const type_info&); type_info(const type_info&); }; class bad_cast : public exception { public: bad_cast() throw() { } virtual ~bad_cast() throw(); virtual const char* what() const throw(); }; class bad_typeid : public exception { public: bad_typeid () throw() { } virtual ~bad_typeid() throw(); virtual const char* what() const throw(); }; } #pragma GCC visibility pop } extern "C++" { namespace std { class bad_alloc : public exception { public: bad_alloc() throw() { } virtual ~bad_alloc() throw(); virtual const char* what() const throw(); }; struct nothrow_t { }; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler(new_handler) throw(); } void* operator new(std::size_t) __attribute__((__externally_visible__)); void* operator new[](std::size_t) __attribute__((__externally_visible__)); void operator delete(void*) noexcept __attribute__((__externally_visible__)); void operator delete[](void*) noexcept __attribute__((__externally_visible__)); void* operator new(std::size_t, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); void* operator new[](std::size_t, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); void operator delete(void*, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) noexcept __attribute__((__externally_visible__)); inline void* operator new(std::size_t, void* __p) noexcept { return __p; } inline void* operator new[](std::size_t, void* __p) noexcept { return __p; } inline void operator delete (void*, void*) noexcept { } inline void operator delete[](void*, void*) noexcept { } } #pragma GCC visibility pop #define _FUNCTEXCEPT_H 1 namespace std { void __throw_bad_exception(void) __attribute__((__noreturn__)); void __throw_bad_alloc(void) __attribute__((__noreturn__)); void __throw_bad_cast(void) __attribute__((__noreturn__)); void __throw_bad_typeid(void) __attribute__((__noreturn__)); void __throw_logic_error(const char*) __attribute__((__noreturn__)); void __throw_domain_error(const char*) __attribute__((__noreturn__)); void __throw_invalid_argument(const char*) __attribute__((__noreturn__)); void __throw_length_error(const char*) __attribute__((__noreturn__)); void __throw_out_of_range(const char*) __attribute__((__noreturn__)); void __throw_runtime_error(const char*) __attribute__((__noreturn__)); void __throw_range_error(const char*) __attribute__((__noreturn__)); void __throw_overflow_error(const char*) __attribute__((__noreturn__)); void __throw_underflow_error(const char*) __attribute__((__noreturn__)); void __throw_ios_failure(const char*) __attribute__((__noreturn__)); void __throw_system_error(int) __attribute__((__noreturn__)); void __throw_future_error(int) __attribute__((__noreturn__)); void __throw_bad_function_call() __attribute__((__noreturn__)); } #define _FUNCTIONAL_HASH_H 1 namespace std { template<typename _Result, typename _Arg> struct __hash_base { typedef _Result result_type; typedef _Arg argument_type; }; template<typename _Tp> struct hash : public __hash_base<size_t, _Tp> { size_t operator()(_Tp __val) const; }; template<typename _Tp> struct hash<_Tp*> : public __hash_base<size_t, _Tp*> { size_t operator()(_Tp* __p) const { return reinterpret_cast<size_t>(__p); } }; #define _Cxx_hashtable_define_trivial_hash(_Tp) template<> inline size_t hash<_Tp>::operator()(_Tp __val) const { return static_cast<size_t>(__val); } template<> inline size_t hash<bool>::operator()(bool __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<char>::operator()(char __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<signed char>::operator()(signed char __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<unsigned char>::operator()(unsigned char __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<wchar_t>::operator()(wchar_t __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<char16_t>::operator()(char16_t __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<char32_t>::operator()(char32_t __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<short>::operator()(short __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<int>::operator()(int __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<long>::operator()(long __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<long long>::operator()(long long __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<unsigned short>::operator()(unsigned short __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<unsigned int>::operator()(unsigned int __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<unsigned long>::operator()(unsigned long __val) const { return static_cast<size_t>(__val); }; template<> inline size_t hash<unsigned long long>::operator()(unsigned long long __val) const { return static_cast<size_t>(__val); }; #undef _Cxx_hashtable_define_trivial_hash struct _Hash_impl { static size_t hash(const void* __ptr, size_t __clength, size_t __seed = static_cast<size_t>(0xc70f6907UL)) { return _Hash_bytes(__ptr, __clength, __seed); } template<typename _Tp> static size_t hash(const _Tp& __val) { return hash(&__val, sizeof(__val)); } template<typename _Tp> static size_t __hash_combine(const _Tp& __val, size_t __hash) { return hash(&__val, sizeof(__val), __hash); } }; struct _Fnv_hash_impl { static size_t hash(const void* __ptr, size_t __clength, size_t __seed = static_cast<size_t>(2166136261UL)) { return _Fnv_hash_bytes(__ptr, __clength, __seed); } template<typename _Tp> static size_t hash(const _Tp& __val) { return hash(&__val, sizeof(__val)); } template<typename _Tp> static size_t __hash_combine(const _Tp& __val, size_t __hash) { return hash(&__val, sizeof(__val), __hash); } }; } namespace std { template<typename _MemberPointer> class _Mem_fn; template<typename _Tp, typename _Class> _Mem_fn<_Tp _Class::*> mem_fn(_Tp _Class::*); 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 constexpr 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> { }; 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; }; template<typename _Functor> struct _Weak_result_type_impl : _Maybe_get_result_type<__has_result_type<_Functor>::value, _Functor> { }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...) const> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......) const> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...) volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......) volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...) const volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......) const volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(&)(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(&)(_ArgTypes......)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(*)(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(*)(_ArgTypes......)> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......)> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) volatile> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const volatile> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const volatile> { typedef _Res result_type; }; template<typename _Functor> struct _Weak_result_type : _Weak_result_type_impl<typename remove_cv<_Functor>::type> { }; 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>*); static __two __test(...); public: static const bool value = sizeof(__test((_Tp*)0)) == 1; }; 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>*); static __two __test(...); public: static const bool value = sizeof(__test((_Tp*)0)) == 1; }; template<typename _Functor, typename... _Args> inline typename 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(std::forward<_Args>(__args)...); } template<typename _Functor, typename... _Args> inline typename 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)(std::forward<_Args>(__args)...); } template<typename _Functor, typename... _Args> inline typename 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(std::forward<_Args>(__args)...); } template<bool _Unary, bool _Binary, typename _Tp> struct _Reference_wrapper_base_impl; template<typename _Tp> struct _Reference_wrapper_base_impl<false, false, _Tp> : _Weak_result_type<_Tp> { }; template<typename _Tp> struct _Reference_wrapper_base_impl<true, false, _Tp> : _Weak_result_type<_Tp> { typedef typename _Tp::argument_type argument_type; }; template<typename _Tp> struct _Reference_wrapper_base_impl<false, true, _Tp> : _Weak_result_type<_Tp> { typedef typename _Tp::first_argument_type first_argument_type; typedef typename _Tp::second_argument_type second_argument_type; }; template<typename _Tp> struct _Reference_wrapper_base_impl<true, true, _Tp> : _Weak_result_type<_Tp> { typedef typename _Tp::argument_type argument_type; typedef typename _Tp::first_argument_type first_argument_type; typedef typename _Tp::second_argument_type second_argument_type; }; template<typename _Tp> class __has_argument_type_helper : __sfinae_types { template<typename _Up> struct _Wrap_type { }; template<typename _Up> static __one __test(_Wrap_type<typename _Up::argument_type>*); template<typename _Up> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; }; template<typename _Tp> struct __has_argument_type : integral_constant<bool, __has_argument_type_helper <typename remove_cv<_Tp>::type>::value> { }; template<typename _Tp> class __has_first_argument_type_helper : __sfinae_types { template<typename _Up> struct _Wrap_type { }; template<typename _Up> static __one __test(_Wrap_type<typename _Up::first_argument_type>*); template<typename _Up> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; }; template<typename _Tp> struct __has_first_argument_type : integral_constant<bool, __has_first_argument_type_helper <typename remove_cv<_Tp>::type>::value> { }; template<typename _Tp> class __has_second_argument_type_helper : __sfinae_types { template<typename _Up> struct _Wrap_type { }; template<typename _Up> static __one __test(_Wrap_type<typename _Up::second_argument_type>*); template<typename _Up> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; }; template<typename _Tp> struct __has_second_argument_type : integral_constant<bool, __has_second_argument_type_helper <typename remove_cv<_Tp>::type>::value> { }; template<typename _Tp> struct _Reference_wrapper_base : _Reference_wrapper_base_impl< __has_argument_type<_Tp>::value, __has_first_argument_type<_Tp>::value && __has_second_argument_type<_Tp>::value, _Tp> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1)> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1) const> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1) volatile> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1) const volatile> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2)> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2) const> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2) volatile> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2) const volatile> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(*)(_T1)> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(*)(_T1, _T2)> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)()> : unary_function<_T1*, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2)> : binary_function<_T1*, _T2, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() const> : unary_function<const _T1*, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const> : binary_function<const _T1*, _T2, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() volatile> : unary_function<volatile _T1*, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile> : binary_function<volatile _T1*, _T2, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() const volatile> : unary_function<const volatile _T1*, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile> : binary_function<const volatile _T1*, _T2, _Res> { }; template<typename _Tp> class reference_wrapper : public _Reference_wrapper_base<typename remove_cv<_Tp>::type> { _Tp* _M_data; public: typedef _Tp type; reference_wrapper(_Tp& __indata) noexcept : _M_data(std::__addressof(__indata)) { } reference_wrapper(_Tp&&) = delete; reference_wrapper(const reference_wrapper<_Tp>& __inref) noexcept : _M_data(__inref._M_data) { } reference_wrapper& operator=(const reference_wrapper<_Tp>& __inref) noexcept { _M_data = __inref._M_data; return *this; } operator _Tp&() const noexcept { return this->get(); } _Tp& get() const noexcept { return *_M_data; } template<typename... _Args> typename result_of<_Tp&(_Args&&...)>::type operator()(_Args&&... __args) const { return __invoke(get(), std::forward<_Args>(__args)...); } }; template<typename _Tp> inline reference_wrapper<_Tp> ref(_Tp& __t) noexcept { return reference_wrapper<_Tp>(__t); } template<typename _Tp> inline reference_wrapper<const _Tp> cref(const _Tp& __t) noexcept { return reference_wrapper<const _Tp>(__t); } template<typename _Tp> void ref(const _Tp&&) = delete; template<typename _Tp> void cref(const _Tp&&) = delete; template<typename _Tp> inline reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t) noexcept { return ref(__t.get()); } template<typename _Tp> inline reference_wrapper<const _Tp> cref(reference_wrapper<_Tp> __t) noexcept { return cref(__t.get()); } template<typename _Res, typename... _ArgTypes> struct _Maybe_unary_or_binary_function { }; template<typename _Res, typename _T1> struct _Maybe_unary_or_binary_function<_Res, _T1> : std::unary_function<_T1, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Maybe_unary_or_binary_function<_Res, _T1, _T2> : std::binary_function<_T1, _T2, _Res> { }; 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)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__args)...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } _Res operator()(_Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(std::forward<_ArgTypes>(__args)...); } _Res operator()(_Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, std::forward<_ArgTypes>(__args)...); } private: _Functor __pmf; }; 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)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__args)...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } _Res operator()(const _Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(std::forward<_ArgTypes>(__args)...); } _Res operator()(const _Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, std::forward<_ArgTypes>(__args)...); } private: _Functor __pmf; }; 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)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__args)...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } _Res operator()(volatile _Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(std::forward<_ArgTypes>(__args)...); } _Res operator()(volatile _Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, std::forward<_ArgTypes>(__args)...); } private: _Functor __pmf; }; 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)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__args)...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } _Res operator()(const volatile _Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(std::forward<_ArgTypes>(__args)...); } _Res operator()(const volatile _Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); } template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, std::forward<_ArgTypes>(__args)...); } private: _Functor __pmf; }; 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; }; template<typename _Res, typename _Class> class _Mem_fn<_Res _Class::*> { 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) { } _Res& operator()(_Class& __object) const { return __object.*__pm; } const _Res& operator()(const _Class& __object) const { return __object.*__pm; } _Res& operator()(_Class* __object) const { return __object->*__pm; } const _Res& operator()(const _Class* __object) const { return __object->*__pm; } template<typename _Tp> typename _Result_type<_Tp>::type operator()(_Tp& __unknown) const { return _M_call(__unknown, &__unknown); } private: _Res _Class::*__pm; }; template<typename _Tp, typename _Class> inline _Mem_fn<_Tp _Class::*> mem_fn(_Tp _Class::* __pm) { return _Mem_fn<_Tp _Class::*>(__pm); } template<typename _Tp> struct is_bind_expression : public false_type { }; template<typename _Tp> struct is_placeholder : public integral_constant<int, 0> { }; template<int _Num> struct _Placeholder { }; namespace placeholders { 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; } template<int _Num> struct is_placeholder<_Placeholder<_Num> > : public integral_constant<int, _Num> { }; struct _No_tuple_element; template<std::size_t __i, typename _Tuple, bool _IsSafe> struct _Safe_tuple_element_impl : tuple_element<__i, _Tuple> { }; template<std::size_t __i, typename _Tuple> struct _Safe_tuple_element_impl<__i, _Tuple, false> { typedef _No_tuple_element type; }; template<std::size_t __i, typename _Tuple> struct _Safe_tuple_element : _Safe_tuple_element_impl<__i, _Tuple, (__i < tuple_size<_Tuple>::value)> { }; template<typename _Arg, bool _IsBindExp = is_bind_expression<_Arg>::value, bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)> class _Mu; template<typename _Tp> class _Mu<reference_wrapper<_Tp>, false, false> { public: typedef _Tp& result_type; template<typename _CVRef, typename _Tuple> result_type operator()(_CVRef& __arg, _Tuple&) const volatile { return __arg.get(); } }; 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>()...)) { typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indexes; return this->__call(__arg, __tuple, _Indexes()); } private: 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::forward<_Args>(get<_Indexes>(__tuple))...); } }; 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)> { typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value - 1), _Tuple>::type __base_type; public: typedef typename add_rvalue_reference<__base_type>::type type; }; template<typename _Tuple> typename result<_Mu(_Arg, _Tuple)>::type operator()(const volatile _Arg&, _Tuple& __tuple) const volatile { return std::forward<typename result<_Mu(_Arg, _Tuple)>::type>( ::std::get<(is_placeholder<_Arg>::value - 1)>(__tuple)); } }; 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_lvalue_reference<_CVArg>::type type; }; template<typename _CVArg, typename _Tuple> _CVArg&& operator()(_CVArg&& __arg, _Tuple&) const volatile { return std::forward<_CVArg>(__arg); } }; template<typename _Tp> struct _Maybe_wrap_member_pointer { typedef _Tp type; static const _Tp& __do_wrap(const _Tp& __x) { return __x; } static _Tp&& __do_wrap(_Tp&& __x) { return static_cast<_Tp&&>(__x); } }; 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); } }; template<> struct _Maybe_wrap_member_pointer<void> { typedef void type; }; template<std::size_t _Ind, typename... _Tp> inline auto __volget(volatile tuple<_Tp...>& __tuple) -> typename tuple_element<_Ind, tuple<_Tp...>>::type volatile& { return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); } template<std::size_t _Ind, typename... _Tp> inline auto __volget(const volatile tuple<_Tp...>& __tuple) -> typename tuple_element<_Ind, tuple<_Tp...>>::type const volatile& { return std::get<_Ind>(const_cast<const tuple<_Tp...>&>(__tuple)); } 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; template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call_v(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call_c_v(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } 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)) { } template<typename... _Args, typename _Result = decltype( std::declval<_Functor>()( _Mu<_Bound_args>()( std::declval<_Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } template<typename... _Args, typename _Result = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0), typename add_const<_Functor>::type>::type>()( _Mu<_Bound_args>()( std::declval<const _Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) const { return this->__call_c<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } template<typename... _Args, typename _Result = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0), typename add_volatile<_Functor>::type>::type>()( _Mu<_Bound_args>()( std::declval<volatile _Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) volatile { return this->__call_v<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } template<typename... _Args, typename _Result = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0), typename add_cv<_Functor>::type>::type>()( _Mu<_Bound_args>()( std::declval<const volatile _Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) const volatile { return this->__call_c_v<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } }; 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; template<typename _Res> struct __enable_if_void : enable_if<is_void<_Res>::value, int> { }; template<typename _Res> struct __disable_if_void : enable_if<!is_void<_Res>::value, int> { }; template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) { _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) const { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) const { _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) volatile { _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) const volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) const volatile { _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)) { } template<typename... _Args> result_type operator()(_Args&&... __args) { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } template<typename... _Args> result_type operator()(_Args&&... __args) const { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } template<typename... _Args> result_type operator()(_Args&&... __args) volatile { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } template<typename... _Args> result_type operator()(_Args&&... __args) const volatile { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } }; template<typename _Signature> struct is_bind_expression<_Bind<_Signature> > : public true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<_Bind_result<_Result, _Signature> > : public true_type { }; template<typename _Tp> class __is_socketlike { typedef typename decay<_Tp>::type _Tp2; public: static const bool value = is_integral<_Tp2>::value || is_enum<_Tp2>::value; }; template<bool _SocketLike, typename _Func, typename... _BoundArgs> struct _Bind_helper { typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type> __maybe_type; typedef typename __maybe_type::type __func_type; typedef _Bind<__func_type(typename decay<_BoundArgs>::type...)> type; }; template<typename _Func, typename... _BoundArgs> struct _Bind_helper<true, _Func, _BoundArgs...> { }; 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; typedef typename __helper_type::__maybe_type __maybe_type; typedef typename __helper_type::type __result_type; return __result_type(__maybe_type::__do_wrap(std::forward<_Func>(__f)), std::forward<_BoundArgs>(__args)...); } template<typename _Result, typename _Func, typename... _BoundArgs> struct _Bindres_helper { typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type> __maybe_type; typedef typename __maybe_type::type __functor_type; typedef _Bind_result<_Result, __functor_type(typename decay<_BoundArgs>::type...)> type; }; 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; typedef typename __helper_type::__maybe_type __maybe_type; typedef typename __helper_type::type __result_type; return __result_type(__maybe_type::__do_wrap(std::forward<_Func>(__f)), std::forward<_BoundArgs>(__args)...); } template<typename _Signature> struct _Bind_simple; template<typename _Callable, typename... _Args> struct _Bind_simple<_Callable(_Args...)> { typedef typename result_of<_Callable(_Args...)>::type result_type; template<typename... _Args2, typename = typename enable_if< sizeof...(_Args) == sizeof...(_Args2)>::type> explicit _Bind_simple(const _Callable& __callable, _Args2&&... __args) : _M_bound(__callable, std::forward<_Args2>(__args)...) { } template<typename... _Args2, typename = typename enable_if< sizeof...(_Args) == sizeof...(_Args2)>::type> explicit _Bind_simple(_Callable&& __callable, _Args2&&... __args) : _M_bound(std::move(__callable), std::forward<_Args2>(__args)...) { } _Bind_simple(const _Bind_simple&) = default; _Bind_simple(_Bind_simple&&) = default; result_type operator()() { typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indices; return _M_invoke(_Indices()); } private: template<std::size_t... _Indices> typename result_of<_Callable(_Args...)>::type _M_invoke(_Index_tuple<_Indices...>) { return std::forward<_Callable>(std::get<0>(_M_bound))( std::forward<_Args>(std::get<_Indices+1>(_M_bound))...); } std::tuple<_Callable, _Args...> _M_bound; }; template<typename _Func, typename... _BoundArgs> struct _Bind_simple_helper { typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type> __maybe_type; typedef typename __maybe_type::type __func_type; typedef _Bind_simple<__func_type(typename decay<_BoundArgs>::type...)> __type; }; template<typename _Callable, typename... _Args> typename _Bind_simple_helper<_Callable, _Args...>::__type __bind_simple(_Callable&& __callable, _Args&&... __args) { typedef _Bind_simple_helper<_Callable, _Args...> __helper_type; typedef typename __helper_type::__maybe_type __maybe_type; typedef typename __helper_type::__type __result_type; return __result_type( __maybe_type::__do_wrap( std::forward<_Callable>(__callable)), std::forward<_Args>(__args)...); } class bad_function_call : public std::exception { public: virtual ~bad_function_call() throw(); }; 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 }; 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> { }; 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; 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; static _Functor* _M_get_pointer(const _Any_data& __source) { const _Functor* __ptr = __stored_locally? std::__addressof(__source._M_access<_Functor>()) : __source._M_access<_Functor*>(); return const_cast<_Functor*>(__ptr); } static void _M_clone(_Any_data& __dest, const _Any_data& __source, true_type) { new (__dest._M_access()) _Functor(__source._M_access<_Functor>()); } static void _M_clone(_Any_data& __dest, const _Any_data& __source, false_type) { __dest._M_access<_Functor*>() = new _Functor(*__source._M_access<_Functor*>()); } static void _M_destroy(_Any_data& __victim, true_type) { __victim._M_access<_Functor>().~_Functor(); } 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) { case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; 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, _Functor&& __f) { _M_init_functor(__functor, std::move(__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, _Functor&& __f, true_type) { new (__functor._M_access()) _Functor(std::move(__f)); } static void _M_init_functor(_Any_data& __functor, _Functor&& __f, false_type) { __functor._M_access<_Functor*>() = new _Functor(std::move(__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) { case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; 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, &__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))( std::forward<_ArgTypes>(__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))( std::forward<_ArgTypes>(__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))( std::forward<_ArgTypes>(__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))( std::forward<_ArgTypes>(__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 mem_fn(_Base::_M_get_pointer(__functor)->__value)( std::forward<_ArgTypes>(__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) { case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; 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) { mem_fn(_Base::_M_get_pointer(__functor)->__value)( std::forward<_ArgTypes>(__args)...); } }; template<typename _Res, typename... _ArgTypes> class function<_Res(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, private _Function_base { typedef _Res _Signature_type(_ArgTypes...); struct _Useless { }; public: typedef _Res result_type; function() noexcept : _Function_base() { } function(nullptr_t) noexcept : _Function_base() { } function(const function& __x); function(function&& __x) : _Function_base() { __x.swap(*this); } template<typename _Functor> function(_Functor __f, typename enable_if< !is_integral<_Functor>::value, _Useless>::type = _Useless()); function& operator=(const function& __x) { function(__x).swap(*this); return *this; } function& operator=(function&& __x) { function(std::move(__x)).swap(*this); return *this; } function& operator=(nullptr_t) { if (_M_manager) { _M_manager(_M_functor, _M_functor, __destroy_functor); _M_manager = 0; _M_invoker = 0; } return *this; } template<typename _Functor> typename enable_if<!is_integral<_Functor>::value, function&>::type operator=(_Functor&& __f) { function(std::forward<_Functor>(__f)).swap(*this); return *this; } template<typename _Functor> typename enable_if<!is_integral<_Functor>::value, function&>::type operator=(reference_wrapper<_Functor> __f) noexcept { function(__f).swap(*this); return *this; } 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); } explicit operator bool() const noexcept { return !_M_empty(); } _Res operator()(_ArgTypes... __args) const; const type_info& target_type() const noexcept; template<typename _Functor> _Functor* target() noexcept; template<typename _Functor> const _Functor* target() const noexcept; private: 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)) { _M_invoker = __x._M_invoker; _M_manager = __x._M_manager; __x._M_manager(_M_functor, __x._M_functor, __clone_functor); } } template<typename _Res, typename... _ArgTypes> template<typename _Functor> function<_Res(_ArgTypes...)>:: function(_Functor __f, typename 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)) { _M_invoker = &_My_handler::_M_invoke; _M_manager = &_My_handler::_M_manager; _My_handler::_M_init_functor(_M_functor, std::move(__f)); } } template<typename _Res, typename... _ArgTypes> _Res function<_Res(_ArgTypes...)>:: operator()(_ArgTypes... __args) const { if (_M_empty()) __throw_bad_function_call(); return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...); } template<typename _Res, typename... _ArgTypes> const type_info& function<_Res(_ArgTypes...)>:: target_type() const noexcept { 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() noexcept { 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 noexcept { 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; } template<typename _Res, typename... _Args> inline bool operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept { return !static_cast<bool>(__f); } template<typename _Res, typename... _Args> inline bool operator==(nullptr_t, const function<_Res(_Args...)>& __f) noexcept { return !static_cast<bool>(__f); } template<typename _Res, typename... _Args> inline bool operator!=(const function<_Res(_Args...)>& __f, nullptr_t) noexcept { return static_cast<bool>(__f); } template<typename _Res, typename... _Args> inline bool operator!=(nullptr_t, const function<_Res(_Args...)>& __f) noexcept { return static_cast<bool>(__f); } template<typename _Res, typename... _Args> inline void swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) { __x.swap(__y); } } #define _GLIBCXX_SYSTEM_ERROR 1 #define _GLIBCXX_ERROR_CONSTANTS 1 #define _H_ERRNO extern int *_Errno( void ); #define errno (*_Errno()) extern char *sys_errlist[]; extern int sys_nerr; #define EPERM 1 #define ENOENT 2 #define ESRCH 3 #define EINTR 4 #define EIO 5 #define ENXIO 6 #define E2BIG 7 #define ENOEXEC 8 #define EBADF 9 #define ECHILD 10 #define EAGAIN 11 #define ENOMEM 12 #define EACCES 13 #define EFAULT 14 #define ENOTBLK 15 #define EBUSY 16 #define EEXIST 17 #define EXDEV 18 #define ENODEV 19 #define ENOTDIR 20 #define EISDIR 21 #define EINVAL 22 #define ENFILE 23 #define EMFILE 24 #define ENOTTY 25 #define ETXTBSY 26 #define EFBIG 27 #define ENOSPC 28 #define ESPIPE 29 #define EROFS 30 #define EMLINK 31 #define EPIPE 32 #define EDOM 33 #define ERANGE 34 #define ENOMSG 35 #define EIDRM 36 #define ECHRNG 37 #define EL2NSYNC 38 #define EL3HLT 39 #define EL3RST 40 #define ELNRNG 41 #define EUNATCH 42 #define ENOCSI 43 #define EL2HLT 44 #define EDEADLK 45 #define ENOTREADY 46 #define EWRPROTECT 47 #define EFORMAT 48 #define ENOLCK 49 #define ENOCONNECT 50 #define ESTALE 52 #define EDIST 53 #define EWOULDBLOCK EAGAIN #define EINPROGRESS 55 #define EALREADY 56 #define ENOTSOCK 57 #define EDESTADDRREQ 58 #define EDESTADDREQ EDESTADDRREQ #define EMSGSIZE 59 #define EPROTOTYPE 60 #define ENOPROTOOPT 61 #define EPROTONOSUPPORT 62 #define ESOCKTNOSUPPORT 63 #define EOPNOTSUPP 64 #define EPFNOSUPPORT 65 #define EAFNOSUPPORT 66 #define EADDRINUSE 67 #define EADDRNOTAVAIL 68 #define ENETDOWN 69 #define ENETUNREACH 70 #define ENETRESET 71 #define ECONNABORTED 72 #define ECONNRESET 73 #define ENOBUFS 74 #define EISCONN 75 #define ENOTCONN 76 #define ESHUTDOWN 77 #define ETIMEDOUT 78 #define ECONNREFUSED 79 #define EHOSTDOWN 80 #define EHOSTUNREACH 81 #define ERESTART 82 #define EPROCLIM 83 #define EUSERS 84 #define ELOOP 85 #define ENAMETOOLONG 86 #define ENOTEMPTY EEXIST #define EDQUOT 88 #define ECORRUPT 89 #define EREMOTE 93 #define ENOSYS 109 #define EMEDIA 110 #define ESOFT 111 #define ENOATTR 112 #define ESAD 113 #define ENOTRUST 114 #define ETOOMANYREFS 115 #define EILSEQ 116 #define ECANCELED 117 #define ENOSR 118 #define ETIME 119 #define EBADMSG 120 #define EPROTO 121 #define ENODATA 122 #define ENOSTR 123 #define ECLONEME ERESTART #define ENOTSUP 124 #define EMULTIHOP 125 #define ENOLINK 126 #define EOVERFLOW 127 #define _GLIBCXX_CERRNO 1 namespace std { enum class errc { address_family_not_supported = 66, address_in_use = 67, address_not_available = 68, already_connected = 75, argument_list_too_long = 7, argument_out_of_domain = 33, bad_address = 14, bad_file_descriptor = 9, bad_message = 120, broken_pipe = 32, connection_aborted = 72, connection_already_in_progress = 56, connection_refused = 79, connection_reset = 73, cross_device_link = 18, destination_address_required = 58, device_or_resource_busy = 16, directory_not_empty = 17, executable_format_error = 8, file_exists = 17, file_too_large = 27, filename_too_long = 86, function_not_supported = 109, host_unreachable = 81, identifier_removed = 36, illegal_byte_sequence = 116, inappropriate_io_control_operation = 25, interrupted = 4, invalid_argument = 22, invalid_seek = 29, io_error = 5, is_a_directory = 21, message_size = 59, network_down = 69, network_reset = 71, network_unreachable = 70, no_buffer_space = 74, no_child_process = 10, no_link = 126, no_lock_available = 49, no_message_available = 122, no_message = 35, no_protocol_option = 61, no_space_on_device = 28, no_stream_resources = 118, no_such_device_or_address = 6, no_such_device = 19, no_such_file_or_directory = 2, no_such_process = 3, not_a_directory = 20, not_a_socket = 57, not_a_stream = 123, not_connected = 76, not_enough_memory = 12, not_supported = 124, operation_canceled = 117, operation_in_progress = 55, operation_not_permitted = 1, operation_not_supported = 64, operation_would_block = 11, permission_denied = 13, protocol_error = 121, protocol_not_supported = 62, read_only_file_system = 30, resource_deadlock_would_occur = 45, resource_unavailable_try_again = 11, result_out_of_range = 34, stream_timeout = 119, text_file_busy = 26, timed_out = 78, too_many_files_open_in_system = 23, too_many_files_open = 24, too_many_links = 31, too_many_symbolic_link_levels = 85, value_too_large = 127, wrong_protocol_type = 60 }; } #define _GLIBCXX_IOSFWD 1 #define _STRINGFWD_H 1 namespace std { template<typename _Alloc> class allocator; template<class _CharT> struct char_traits; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string; template<> struct char_traits<char>; typedef basic_string<char> string; template<> struct char_traits<wchar_t>; typedef basic_string<wchar_t> wstring; template<> struct char_traits<char16_t>; template<> struct char_traits<char32_t>; typedef basic_string<char16_t> u16string; typedef basic_string<char32_t> u32string; } #define _GLIBCXX_POSTYPES_H 1 #define _H_WCHAR #undef _STD_TYPES_T extern "C" { #define __need___va_list #undef __need___va_list #define __GNUC_VA_LIST typedef __builtin_va_list __gnuc_va_list; #define FIXINC_WRAP_STDIO_H_AAB_AIX_STDIO 1 #define _H_STDIO extern "C" { #define TMP_MAX 16384 #define FOPEN_MAX 32767 #define FILENAME_MAX 255 #define BUFSIZ 4096 #define _P_tmpdir "/tmp/" #define L_tmpnam (sizeof(_P_tmpdir) + 15) #define _IOFBF 0000 #define _IOLBF 0100 #define _IONBF 0004 #define EOF (-1) #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 typedef struct { unsigned char *_ptr; int _cnt; unsigned char *_base; unsigned char *_bufendp; short _flag; short _file; int __stdioid; char *__newbase; void *_lock; } FILE; #define _IOEOF 0020 #define _IOERR 0040 #define _NIOBRW 16 extern FILE _iob[16]; #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) extern size_t fread(void *, size_t, size_t, FILE *); extern size_t fwrite(const void *, size_t, size_t,FILE *); extern int vscanf(const char *, __gnuc_va_list); extern int vfscanf(FILE *, const char *, __gnuc_va_list); extern int vsscanf(const char *, const char *, __gnuc_va_list); extern int __flsbuf(unsigned char, FILE *); extern int __filbuf(FILE *); extern int ferror(FILE *); extern int feof(FILE *); extern void clearerr(FILE *); extern int putchar(int); extern int getchar(void); extern int putc(int, FILE *); extern int getc(FILE *); extern int remove(const char *); extern int rename(const char *, const char *); extern FILE *tmpfile(void); extern char *tmpnam(char *); extern int fclose(FILE *); extern int fflush(FILE *); extern FILE * fopen(const char *, const char *); extern FILE * freopen(const char *, const char *, FILE *); extern void setbuf(FILE *, char *); extern int setvbuf(FILE *, char *, int, size_t); extern int fprintf(FILE *, const char *, ...); extern int fscanf(FILE *, const char *, ...); extern int printf(const char *, ...); extern int scanf(const char *, ...); extern int sprintf(char *, const char *, ...); extern int snprintf(char *, size_t, const char *, ...); extern int sscanf(const char *, const char *, ...); #define _HIDDEN_DUMMY_VA_LIST extern int vfprintf(FILE *, const char *, __gnuc_va_list); extern int vprintf(const char *, __gnuc_va_list); extern int vsprintf(char *, const char *, __gnuc_va_list); extern int vsnprintf(char *, size_t, const char *, __gnuc_va_list); extern int fgetc(FILE *); extern char * fgets(char *, int, FILE *); extern int fputc(int, FILE *); extern int fputs(const char *, FILE *); extern char *gets(char *); extern int puts(const char *); extern int ungetc(int, FILE *); extern int fgetpos(FILE *, fpos_t *); extern int fseek(FILE *, long int, int); extern int fsetpos(FILE *, const fpos_t *); extern long ftell(FILE *); extern void rewind(FILE *); extern void perror(const char *); extern int getc_unlocked(FILE *); extern int getchar_unlocked(void); extern int putc_unlocked(int, FILE *); extern int putchar_unlocked(int); #define getc_unlocked(p) (((!((p)->_flag & 0xC000)) && ((p)->_flag = ((p)->_flag & 0x3FFF) | 0x8000)), (--(p)->_cnt < 0 ? __filbuf(p) : (int) *(p)->_ptr++)) #define getchar_unlocked() getc_unlocked(stdin) #define getchar_locked() fgetc(stdin) #define getc_locked(p) fgetc(p) #define putc_unlocked(x,p) (((!((p)->_flag & 0xC000)) && ((p)->_flag = ((p)->_flag & 0x3FFF) | 0x8000)), (--(p)->_cnt < 0 ? __flsbuf((unsigned char) (x), (p)) : (int) (*(p)->_ptr++ = (unsigned char) (x)))) #define putchar_unlocked(x) putc_unlocked(x,stdout) #define putc_locked(x,p) fputc(x, p) #define putchar_locked(x) putc_locked(x,stdout) #define clearerr_unlocked(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF))) #define feof_unlocked(p) ((p)->_flag & _IOEOF) #define ferror_unlocked(p) ((p)->_flag & _IOERR) #define fileno_unlocked(p) ((p)->_file) #define L_ctermid 9 #define L_cuserid 9 extern int fileno(FILE *); extern FILE *fdopen(int,const char *); extern char *ctermid(char *); extern FILE *popen(const char *, const char *); extern int pclose(FILE *); extern void flockfile(FILE *); extern void funlockfile(FILE *); extern int fseeko(FILE *, off_t, int); extern off_t ftello(FILE *); extern int ftrylockfile(FILE *); extern void funlockfile(FILE *); #define fileno(__p) ((__p)->_file) extern char *optarg; extern int opterr; extern int optind; extern int optopt; #define P_tmpdir _P_tmpdir extern int getw(FILE *); extern int getopt(int, char * const [], const char*); extern char *cuserid(char *); extern int putw(int, FILE *); extern char *tempnam(const char*, const char*); #define _H_LIMITS extern "C" { #define CHAR_BIT (8) #define CHAR_MAX UCHAR_MAX #define CHAR_MIN (0) #define INT_MAX (2147483647) #define INT_MIN (-INT_MAX - 1) #define LONG_MAX (2147483647L) #define LONG_MIN (-LONG_MAX - 1) #define ULONG_MAX (4294967295UL) #define LLONG_MAX (9223372036854775807LL) #define LLONG_MIN (-9223372036854775807LL -1LL) #define ULLONG_MAX (18446744073709551615ULL) #define SCHAR_MAX (127) #define SCHAR_MIN (-SCHAR_MAX - 1) #define SHRT_MAX (32767) #define SHRT_MIN (-SHRT_MAX - 1) #define UCHAR_MAX (255) #define UINT_MAX (4294967295U) #define USHRT_MAX (65535) #define MB_LEN_MAX 4 #define _POSIX_ARG_MAX 4096 #define _POSIX_CHILD_MAX 25 #define _POSIX_HOST_NAME_MAX 255 #define _POSIX_SYMLINK_MAX 255 #define _POSIX_SYMLOOP_MAX 8 #define _POSIX_LINK_MAX 8 #define _POSIX_MAX_CANON 255 #define _POSIX_NAME_MAX 14 #define _POSIX_NGROUPS_MAX 8 #define _POSIX_MAX_INPUT 255 #define _POSIX_OPEN_MAX 20 #define _POSIX_PATH_MAX 256 #define _POSIX_PIPE_BUF 512 #define _POSIX_SSIZE_MAX 32767 #define _POSIX_STREAM_MAX 8 #define _POSIX_THREAD_KEYS_MAX 128 #define _POSIX_THREAD_DATAKEYS_MAX _POSIX_THREAD_KEYS_MAX #define _POSIX_THREAD_THREADS_MAX 64 #define _POSIX_TZNAME_MAX 6 #define _POSIX_LOGIN_NAME_MAX 9 #define _POSIX_TTY_NAME_MAX 9 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 #define _POSIX_CLOCKRES_MIN 20000000 #define _POSIX_AIO_LISTIO_MAX 2 #define _POSIX_AIO_MAX 1 #define _POSIX_DELAYTIMER_MAX 32 #define _POSIX_MQ_OPEN_MAX 8 #define _POSIX_MQ_PRIO_MAX 32 #define _POSIX_RTSIG_MAX 8 #define _POSIX_SEM_NSEMS_MAX 256 #define _POSIX_SEM_VALUE_MAX 32767 #define _POSIX_SIGQUEUE_MAX 32 #define _POSIX_TIMER_MAX 32 #define _POSIX2_BC_BASE_MAX 99 #define _POSIX2_BC_DIM_MAX 2048 #define _POSIX2_BC_SCALE_MAX 99 #define _POSIX2_BC_STRING_MAX 1000 #define _POSIX2_EQUIV_CLASS_MAX 2 #define _POSIX2_COLL_WEIGHTS_MAX 2 #define _POSIX2_EXPR_NEST_MAX 32 #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX 255 #define _POSIX2_CHARCLASS_NAME_MAX 14 #define BC_BASE_MAX _POSIX2_BC_BASE_MAX #define BC_DIM_MAX _POSIX2_BC_DIM_MAX #define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX #define BC_STRING_MAX 2048 #define EQUIV_CLASS_MAX 4 #define COLL_WEIGHTS_MAX 4 #define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX #define LINE_MAX _POSIX2_LINE_MAX #define RE_DUP_MAX _POSIX2_RE_DUP_MAX #define MAX_INPUT 512 #define NGROUPS_MAX 128 #define SSIZE_MAX LONG_MAX #define _SSIZE_MAX LONG_MAX #define ARG_MAX 24576 #define CHILD_MAX 128 #define MAX_CANON 256 #define OPEN_MAX 65534 #define STREAM_MAX 32767 #define PTHREAD_KEYS_MAX 450 #define PTHREAD_THREADS_MAX 512 #define PTHREAD_DATAKEYS_MAX PTHREAD_KEYS_MAX #define TZNAME_MAX 255 #define TTY_NAME_MAX PATH_MAX #define AIO_LISTIO_MAX 4096 #define AIO_MAX 4096 #define AIO_PRIO_DELTA_MAX 20 #define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX #define MQ_OPEN_MAX 32768 #define MQ_PRIO_MAX 128 #define RTSIG_MAX _POSIX_RTSIG_MAX #define SEM_NSEMS_MAX 32768 #define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX #define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX #define TIMER_MAX _POSIX_TIMER_MAX #undef NAME_MAX #define PATH_MAX 1023 #define LINK_MAX SHRT_MAX #define LOGIN_NAME_MAX 9 #define PIPE_BUF 32768 #define HOST_NAME_MAX 256 #undef SYMLINK_MAX #define SYMLOOP_MAX 20 #define _FLOAT_H___ #undef FLT_RADIX #define FLT_RADIX __FLT_RADIX__ #undef FLT_MANT_DIG #undef DBL_MANT_DIG #undef LDBL_MANT_DIG #define FLT_MANT_DIG __FLT_MANT_DIG__ #define DBL_MANT_DIG __DBL_MANT_DIG__ #define LDBL_MANT_DIG __LDBL_MANT_DIG__ #undef FLT_DIG #undef DBL_DIG #undef LDBL_DIG #define FLT_DIG __FLT_DIG__ #define DBL_DIG __DBL_DIG__ #define LDBL_DIG __LDBL_DIG__ #undef FLT_MIN_EXP #undef DBL_MIN_EXP #undef LDBL_MIN_EXP #define FLT_MIN_EXP __FLT_MIN_EXP__ #define DBL_MIN_EXP __DBL_MIN_EXP__ #define LDBL_MIN_EXP __LDBL_MIN_EXP__ #undef FLT_MIN_10_EXP #undef DBL_MIN_10_EXP #undef LDBL_MIN_10_EXP #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ #undef FLT_MAX_EXP #undef DBL_MAX_EXP #undef LDBL_MAX_EXP #define FLT_MAX_EXP __FLT_MAX_EXP__ #define DBL_MAX_EXP __DBL_MAX_EXP__ #define LDBL_MAX_EXP __LDBL_MAX_EXP__ #undef FLT_MAX_10_EXP #undef DBL_MAX_10_EXP #undef LDBL_MAX_10_EXP #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ #undef FLT_MAX #undef DBL_MAX #undef LDBL_MAX #define FLT_MAX __FLT_MAX__ #define DBL_MAX __DBL_MAX__ #define LDBL_MAX __LDBL_MAX__ #undef FLT_EPSILON #undef DBL_EPSILON #undef LDBL_EPSILON #define FLT_EPSILON __FLT_EPSILON__ #define DBL_EPSILON __DBL_EPSILON__ #define LDBL_EPSILON __LDBL_EPSILON__ #undef FLT_MIN #undef DBL_MIN #undef LDBL_MIN #define FLT_MIN __FLT_MIN__ #define DBL_MIN __DBL_MIN__ #define LDBL_MIN __LDBL_MIN__ #undef FLT_ROUNDS #define FLT_ROUNDS 1 #define NL_ARGMAX 9 #define NL_MSGMAX 65535 #define NL_SETMAX 65535 #define NL_TEXTMAX 8192 #define PASS_MAX 255 #define NL_LANGMAX 14 #define NL_NMAX 10 #define NZERO 20 #define LONG_BIT 32 #define WORD_BIT 32 #define CHARCLASS_NAME_MAX 14 #define ATEXIT_MAX 2048 #define _XOPEN_IOV_MAX 16 #define IOV_MAX _XOPEN_IOV_MAX #define PAGE_SIZE 4096 #define PAGESIZE PAGE_SIZE #undef FILESIZEBITS #define PTHREAD_STACK_MIN ( PAGESIZE * 2 ) #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS #define _XOPEN_NAME_MAX 255 #define _XOPEN_PATH_MAX 1024 #define AIO_PRIO_DFL 1 #define AIO_PRIO_MAX 1 #define AIO_PRIO_MIN 1 #define AIO_LISTIO_MAX_SIZE AIO_LISTIO_MAX #define PID_MAX INT_MAX #define UID_MAX UINT_MAX #define LONGLONG_MAX (0x7fffffffffffffffLL) #define LONGLONG_MIN (-LONGLONG_MAX - 1) #define ULONGLONG_MAX (0xffffffffffffffffuLL) #define DEV_OFF_MAX 0xffffffffffLL #define OFF_MAX 0x7fffffff } extern int fgetpos64(FILE *, fpos64_t *); extern FILE *fopen64(const char *, const char *); extern FILE *freopen64(const char *, const char *, FILE *); extern int fseeko64(FILE *, off64_t, int); extern int fsetpos64(FILE *, const fpos64_t *); extern off64_t ftello64(FILE *); extern void setbuffer(FILE *, char *, size_t); extern void setlinebuf(FILE *); #define WEOF (-1) #define _NFILE 32767 #define _NRWS (_NFILE / _NIOBRW )+1 #define _SBFSIZ 8 #define _IOREAD 000001 #define _IOWRT 000002 #define _IOMYBUF 000010 #define _IORW 000200 #define _IONOFD 000400 #define _IOUNGETC 001000 #define _IOCLOSE 002000 #define _IOINUSE 002000 #define _IONONSTD 004000 #define _IOISTTY 010000 #define _IO_BYTE 0200000 #define _IO_WIDE 0400000 #define _SET_BYTE(__stream) ((!((__stream)->_flag & 0xC000)) && ((__stream)->_flag = ((__stream)->_flag & 0x3FFF) | 0x8000)) #define _SET_WIDE(__stream) ((!((__stream)->_flag & 0xC000)) && ((__stream)->_flag = ((__stream)->_flag & 0x3FFF) | 0x4000)) #define _bufend(__p) ((__p)->_bufendp) #define _bufsiz(__p) (_bufend(__p) - (__p)->_base) } typedef char * mbstate_t; extern int vfwscanf(FILE * , const wchar_t * , __gnuc_va_list); extern int vswscanf(const wchar_t * , const wchar_t * , __gnuc_va_list); extern int vwscanf(const wchar_t * , __gnuc_va_list); extern long double wcstold(const wchar_t * , wchar_t ** ); extern float wcstof(const wchar_t * , wchar_t ** ); extern long long int wcstoll( const wchar_t * , wchar_t ** , int ); extern unsigned long long int wcstoull( const wchar_t * , wchar_t ** , int ); extern wint_t fgetwc(FILE *); extern wchar_t *fgetws(wchar_t * , int, FILE * ); extern int fputws(const wchar_t * , FILE * ); extern wint_t getwc(FILE *); extern wint_t getwchar(void); extern int iswalnum(wint_t); extern int iswalpha(wint_t); extern int iswcntrl(wint_t); extern int iswdigit(wint_t); extern int iswgraph(wint_t); extern int iswlower(wint_t); extern int iswprint(wint_t); extern int iswpunct(wint_t); extern int iswspace(wint_t); extern int iswupper(wint_t); extern int iswxdigit(wint_t); extern int iswctype (wint_t, wctype_t); extern int towlower(wint_t); extern int towupper(wint_t); extern wint_t fputwc(wchar_t, FILE *); extern wint_t putwc(wchar_t, FILE *); extern wint_t putwchar(wchar_t); extern wchar_t *wcschr(const wchar_t *, wchar_t); extern wint_t ungetwc(wint_t, FILE *); extern wctype_t wctype(const char*); extern wchar_t *wcscat(wchar_t * , const wchar_t *); extern int wcscmp(const wchar_t *, const wchar_t *); extern int wcscoll(const wchar_t *, const wchar_t *); extern wchar_t *wcscpy(wchar_t * , const wchar_t * ); extern size_t wcscspn(const wchar_t *, const wchar_t *); static size_t wcsftime(wchar_t *__wcsftime_wcs, size_t __wcsftime_maxsize, const wchar_t *__wcsftime_format, const struct tm *__wcsftime_timptr) { extern size_t __iso_wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *); return __iso_wcsftime(__wcsftime_wcs, __wcsftime_maxsize, __wcsftime_format, __wcsftime_timptr); } extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *); extern wchar_t *wcsrchr(const wchar_t *, wchar_t); extern size_t wcslen(const wchar_t *); extern wchar_t *wcsncat(wchar_t * , const wchar_t * , size_t); extern int wcsncmp(const wchar_t *, const wchar_t *, size_t); extern wchar_t *wcsncpy(wchar_t * , const wchar_t * , size_t); extern size_t wcsspn(const wchar_t *, const wchar_t *); extern double wcstod(const wchar_t * , wchar_t ** ); static wchar_t *wcstok(wchar_t *__wcstok_ws1, const wchar_t *__wcstok_ws2, wchar_t **__wcstok_ptr) { extern wchar_t *__iso_wcstok(wchar_t *, const wchar_t *, wchar_t **); return __iso_wcstok(__wcstok_ws1, __wcstok_ws2, __wcstok_ptr); } extern wchar_t *wcstok_r(wchar_t *, const wchar_t *, wchar_t **); extern long wcstol(const wchar_t * , wchar_t ** , int); extern unsigned long wcstoul(const wchar_t * , wchar_t ** , int); extern wchar_t *wcswcs(const wchar_t *, const wchar_t *); extern int wcswidth(const wchar_t *, size_t); extern int wcwidth(wchar_t); extern size_t wcsxfrm(wchar_t * , const wchar_t * , size_t); extern wint_t btowc(int); extern int fwprintf(FILE * , const wchar_t * , ...); extern int fwscanf(FILE * , const wchar_t * , ...); extern int fwide(FILE *, int); extern int mbsinit(const mbstate_t *); extern size_t mbrlen(const char * , size_t, mbstate_t *); extern size_t mbrtowc(wchar_t * , const char * , size_t, mbstate_t * ); extern size_t mbsrtowcs(wchar_t * , const char ** , size_t, mbstate_t * ); extern int swprintf(wchar_t * , size_t, const wchar_t * , ...); extern int swscanf(const wchar_t * , const wchar_t * , ...); #define _HIDDEN_DUMMY_VA_LIST extern int vfwprintf(FILE * , const wchar_t * , __gnuc_va_list); extern int vwprintf(const wchar_t * , __gnuc_va_list); extern int vswprintf(wchar_t * , size_t, const wchar_t * , __gnuc_va_list); extern wchar_t *wcsstr(const wchar_t *, const wchar_t *); extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); extern size_t wcrtomb(char * , wchar_t, mbstate_t * ); extern size_t wcsrtombs(char * , const wchar_t ** , size_t, mbstate_t * ); extern int wctob(wint_t); extern wctype_t wctype(const char *); extern int wmemcmp(const wchar_t *, const wchar_t *, size_t); extern wchar_t *wmemcpy(wchar_t * , const wchar_t * , size_t); extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); extern wchar_t *wmemset(wchar_t *, wchar_t, size_t); extern int wprintf(const wchar_t * , ...); extern int wscanf(const wchar_t * , ...); #define getwchar() getwc(stdin) extern wchar_t *getws(wchar_t *); extern int putws(const wchar_t *); extern int wsprintf(wchar_t *, const char *, ...); #define _HIDDEN_DUMMY_VA_LIST extern int vwsprintf(wchar_t *, const char *, __gnuc_va_list); extern int wcscasecmp(const wchar_t *, const wchar_t *); extern wchar_t *wcsdup(const wchar_t *); extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); extern size_t wcsnlen(const wchar_t *, size_t); extern size_t wcsnrtombs(char *, const wchar_t **, size_t, size_t, mbstate_t *); extern size_t mbsnrtowcs(wchar_t *, const char **, size_t, size_t, mbstate_t *); extern wchar_t *wcpcpy(wchar_t *, const wchar_t *); extern wchar_t *wcpncpy(wchar_t *, const wchar_t *, size_t); extern wchar_t *strtows(wchar_t *, char *); extern char *wstrtos(char *, wchar_t *); #define wstrcat NCstrcat #define wstrlen NCstrlen #define wstrdup NCstrdup #define wstrncat NCstrncat #define wstrcmp NCstrcmp #define wstrncmp NCstrncmp #define wstrcpy NCstrcpy #define wstrncpy NCstrncpy } #define _GLIBCXX_CWCHAR 1 namespace std { using ::mbstate_t; } #undef btowc #undef fgetwc #undef fgetws #undef fputwc #undef fputws #undef fwide #undef fwprintf #undef fwscanf #undef getwc #undef getwchar #undef mbrlen #undef mbrtowc #undef mbsinit #undef mbsrtowcs #undef putwc #undef putwchar #undef swprintf #undef swscanf #undef ungetwc #undef vfwprintf #undef vfwscanf #undef vswprintf #undef vswscanf #undef vwprintf #undef vwscanf #undef wcrtomb #undef wcscat #undef wcschr #undef wcscmp #undef wcscoll #undef wcscpy #undef wcscspn #undef wcsftime #undef wcslen #undef wcsncat #undef wcsncmp #undef wcsncpy #undef wcspbrk #undef wcsrchr #undef wcsrtombs #undef wcsspn #undef wcsstr #undef wcstod #undef wcstof #undef wcstok #undef wcstol #undef wcstoul #undef wcsxfrm #undef wctob #undef wmemchr #undef wmemcmp #undef wmemcpy #undef wmemmove #undef wmemset #undef wprintf #undef wscanf namespace std { using ::wint_t; using ::btowc; using ::fgetwc; using ::fgetws; using ::fputwc; using ::fputws; using ::fwide; using ::fwprintf; using ::fwscanf; using ::getwc; using ::getwchar; using ::mbrlen; using ::mbrtowc; using ::mbsinit; using ::mbsrtowcs; using ::putwc; using ::putwchar; using ::swprintf; using ::swscanf; using ::ungetwc; using ::vfwprintf; using ::vfwscanf; using ::vswprintf; using ::vswscanf; using ::vwprintf; using ::vwscanf; using ::wcrtomb; using ::wcscat; using ::wcscmp; using ::wcscoll; using ::wcscpy; using ::wcscspn; using ::wcsftime; using ::wcslen; using ::wcsncat; using ::wcsncmp; using ::wcsncpy; using ::wcsrtombs; using ::wcsspn; using ::wcstod; using ::wcstof; using ::wcstok; using ::wcstol; using ::wcstoul; using ::wcsxfrm; using ::wctob; using ::wmemcmp; using ::wmemcpy; using ::wmemmove; using ::wmemset; using ::wprintf; using ::wscanf; using ::wcschr; using ::wcspbrk; using ::wcsrchr; using ::wcsstr; using ::wmemchr; inline wchar_t* wcschr(wchar_t* __p, wchar_t __c) { return wcschr(const_cast<const wchar_t*>(__p), __c); } inline wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } inline wchar_t* wcsrchr(wchar_t* __p, wchar_t __c) { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } inline wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } inline wchar_t* wmemchr(wchar_t* __p, wchar_t __c, size_t __n) { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } } #undef wcstold #undef wcstoll #undef wcstoull namespace __gnu_cxx { using ::wcstold; using ::wcstoll; using ::wcstoull; } namespace std { using ::__gnu_cxx::wcstold; using ::__gnu_cxx::wcstoll; using ::__gnu_cxx::wcstoull; } namespace std { using std::wcstof; using std::vfwscanf; using std::vswscanf; using std::vwscanf; using std::wcstold; using std::wcstoll; using std::wcstoull; } namespace std { typedef long long streamoff; typedef ptrdiff_t streamsize; template<typename _StateT> class fpos { private: streamoff _M_off; _StateT _M_state; public: fpos() : _M_off(0), _M_state() { } fpos(streamoff __off) : _M_off(__off), _M_state() { } operator streamoff() const { return _M_off; } void state(_StateT __st) { _M_state = __st; } _StateT state() const { return _M_state; } fpos& operator+=(streamoff __off) { _M_off += __off; return *this; } fpos& operator-=(streamoff __off) { _M_off -= __off; return *this; } fpos operator+(streamoff __off) const { fpos __pos(*this); __pos += __off; return __pos; } fpos operator-(streamoff __off) const { fpos __pos(*this); __pos -= __off; return __pos; } streamoff operator-(const fpos& __other) const { return _M_off - __other._M_off; } }; template<typename _StateT> inline bool operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) { return streamoff(__lhs) == streamoff(__rhs); } template<typename _StateT> inline bool operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) { return streamoff(__lhs) != streamoff(__rhs); } typedef fpos<mbstate_t> streampos; typedef fpos<mbstate_t> wstreampos; typedef fpos<mbstate_t> u16streampos; typedef fpos<mbstate_t> u32streampos; } namespace std { class ios_base; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ios; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_streambuf; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_istream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ostream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_iostream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_stringbuf; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_istringstream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_ostringstream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_stringstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_filebuf; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ifstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ofstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_fstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class istreambuf_iterator; template<typename _CharT, typename _Traits = char_traits<_CharT> > class ostreambuf_iterator; typedef basic_ios<char> ios; typedef basic_streambuf<char> streambuf; typedef basic_istream<char> istream; typedef basic_ostream<char> ostream; typedef basic_iostream<char> iostream; typedef basic_stringbuf<char> stringbuf; typedef basic_istringstream<char> istringstream; typedef basic_ostringstream<char> ostringstream; typedef basic_stringstream<char> stringstream; typedef basic_filebuf<char> filebuf; typedef basic_ifstream<char> ifstream; typedef basic_ofstream<char> ofstream; typedef basic_fstream<char> fstream; typedef basic_ios<wchar_t> wios; typedef basic_streambuf<wchar_t> wstreambuf; typedef basic_istream<wchar_t> wistream; typedef basic_ostream<wchar_t> wostream; typedef basic_iostream<wchar_t> wiostream; typedef basic_stringbuf<wchar_t> wstringbuf; typedef basic_istringstream<wchar_t> wistringstream; typedef basic_ostringstream<wchar_t> wostringstream; typedef basic_stringstream<wchar_t> wstringstream; typedef basic_filebuf<wchar_t> wfilebuf; typedef basic_ifstream<wchar_t> wifstream; typedef basic_ofstream<wchar_t> wofstream; typedef basic_fstream<wchar_t> wfstream; } #define _GLIBCXX_STDEXCEPT 1 #define _GLIBCXX_STRING 1 #define _CHAR_TRAITS_H 1 #define _STL_ALGOBASE_H 1 #define _CPP_TYPE_TRAITS_H 1 namespace __gnu_cxx { template<typename _Iterator, typename _Container> class __normal_iterator; } namespace std { struct __true_type { }; struct __false_type { }; template<bool> struct __truth_type { typedef __false_type __type; }; template<> struct __truth_type<true> { typedef __true_type __type; }; template<class _Sp, class _Tp> struct __traitor { enum { __value = bool(_Sp::__value) || bool(_Tp::__value) }; typedef typename __truth_type<__value>::__type __type; }; template<typename, typename> struct __are_same { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Tp> struct __are_same<_Tp, _Tp> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_void { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_void<void> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_integer { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_integer<bool> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<signed char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<wchar_t> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<char16_t> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<char32_t> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<short> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned short> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<int> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned int> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<long> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned long> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<long long> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned long long> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_floating { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_floating<float> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_floating<double> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_floating<long double> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_pointer { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Tp> struct __is_pointer<_Tp*> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_normal_iterator { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Iterator, typename _Container> struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator, _Container> > { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > { }; template<typename _Tp> struct __is_fundamental : public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> > { }; template<typename _Tp> struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > { }; template<typename _Tp> struct __is_char { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_char<char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_char<wchar_t> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_byte { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_byte<char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_byte<signed char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_byte<unsigned char> { enum { __value = 1 }; typedef __true_type __type; }; template<typename _Tp> struct __is_move_iterator { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Iterator> class move_iterator; template<typename _Iterator> struct __is_move_iterator< move_iterator<_Iterator> > { enum { __value = 1 }; typedef __true_type __type; }; } #define _EXT_TYPE_TRAITS 1 namespace __gnu_cxx { template<bool, typename> struct __enable_if { }; template<typename _Tp> struct __enable_if<true, _Tp> { typedef _Tp __type; }; 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; }; 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; }; template<> struct __add_unsigned<bool>; template<> struct __add_unsigned<wchar_t>; 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; }; template<> struct __remove_unsigned<bool>; template<> struct __remove_unsigned<wchar_t>; template<typename _Type> inline bool __is_null_pointer(_Type* __ptr) { return __ptr == 0; } template<typename _Type> inline bool __is_null_pointer(_Type) { return false; } template<typename _Tp, bool = std::__is_integer<_Tp>::__value> struct __promote { typedef double __type; }; template<typename _Tp> struct __promote<_Tp, false> { typedef _Tp __type; }; template<typename _Tp, typename _Up> struct __promote_2 { private: typedef typename __promote<_Tp>::__type __type1; typedef typename __promote<_Up>::__type __type2; public: typedef __typeof__(__type1() + __type2()) __type; }; template<typename _Tp, typename _Up, typename _Vp> struct __promote_3 { private: typedef typename __promote<_Tp>::__type __type1; typedef typename __promote<_Up>::__type __type2; typedef typename __promote<_Vp>::__type __type3; public: typedef __typeof__(__type1() + __type2() + __type3()) __type; }; template<typename _Tp, typename _Up, typename _Vp, typename _Wp> struct __promote_4 { private: typedef typename __promote<_Tp>::__type __type1; typedef typename __promote<_Up>::__type __type2; typedef typename __promote<_Vp>::__type __type3; typedef typename __promote<_Wp>::__type __type4; public: typedef __typeof__(__type1() + __type2() + __type3() + __type4()) __type; }; } #define _EXT_NUMERIC_TRAITS 1 namespace __gnu_cxx { #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 { static const _Value __min = (((_Value)(-1) < 0) ? (_Value)1 << (sizeof(_Value) * 8 - ((_Value)(-1) < 0)) : (_Value)0); static const _Value __max = (((_Value)(-1) < 0) ? (((((_Value)1 << ((sizeof(_Value) * 8 - ((_Value)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(_Value)0); static const bool __is_signed = ((_Value)(-1) < 0); static const int __digits = (sizeof(_Value) * 8 - ((_Value)(-1) < 0)); }; 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 { static const int __max_digits10 = (2 + (std::__are_same<_Value, float>::__value ? 24 : std::__are_same<_Value, double>::__value ? 53 : 53) * 643L / 2136); static const bool __is_signed = true; static const int __digits10 = (std::__are_same<_Value, float>::__value ? 6 : std::__are_same<_Value, double>::__value ? 15 : 15); static const int __max_exponent10 = (std::__are_same<_Value, float>::__value ? 38 : std::__are_same<_Value, double>::__value ? 308 : 308); }; 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 { }; } #undef __glibcxx_floating #undef __glibcxx_max_digits10 #undef __glibcxx_digits10 #undef __glibcxx_max_exponent10 #define _STL_ITERATOR_BASE_TYPES_H 1 namespace std { struct input_iterator_tag { }; struct output_iterator_tag { }; struct forward_iterator_tag : public input_iterator_tag { }; struct bidirectional_iterator_tag : public forward_iterator_tag { }; struct random_access_iterator_tag : public bidirectional_iterator_tag { }; template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator { typedef _Category iterator_category; typedef _Tp value_type; typedef _Distance difference_type; typedef _Pointer pointer; typedef _Reference reference; }; template<typename _Tp> class __has_iterator_category_helper : __sfinae_types { template<typename _Up> struct _Wrap_type { }; template<typename _Up> static __one __test(_Wrap_type<typename _Up::iterator_category>*); template<typename _Up> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; }; template<typename _Tp> struct __has_iterator_category : integral_constant<bool, __has_iterator_category_helper <typename remove_cv<_Tp>::type>::value> { }; template<typename _Iterator, bool = __has_iterator_category<_Iterator>::value> struct __iterator_traits { }; template<typename _Iterator> struct __iterator_traits<_Iterator, true> { typedef typename _Iterator::iterator_category iterator_category; typedef typename _Iterator::value_type value_type; typedef typename _Iterator::difference_type difference_type; typedef typename _Iterator::pointer pointer; typedef typename _Iterator::reference reference; }; template<typename _Iterator> struct iterator_traits : public __iterator_traits<_Iterator> { }; template<typename _Tp> struct iterator_traits<_Tp*> { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; template<typename _Tp> struct iterator_traits<const _Tp*> { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef ptrdiff_t difference_type; typedef const _Tp* pointer; typedef const _Tp& reference; }; template<typename _Iter> inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) { return typename iterator_traits<_Iter>::iterator_category(); } template<typename _Iterator, bool _HasBase> struct _Iter_base { typedef _Iterator iterator_type; static iterator_type _S_base(_Iterator __it) { return __it; } }; template<typename _Iterator> struct _Iter_base<_Iterator, true> { typedef typename _Iterator::iterator_type iterator_type; static iterator_type _S_base(_Iterator __it) { return __it.base(); } }; } #define _STL_ITERATOR_BASE_FUNCS_H 1 namespace std { template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type __distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) { typename iterator_traits<_InputIterator>::difference_type __n = 0; while (__first != __last) { ++__first; ++__n; } return __n; } template<typename _RandomAccessIterator> inline typename iterator_traits<_RandomAccessIterator>::difference_type __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) { return __last - __first; } template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type distance(_InputIterator __first, _InputIterator __last) { return std::__distance(__first, __last, std::__iterator_category(__first)); } template<typename _InputIterator, typename _Distance> inline void __advance(_InputIterator& __i, _Distance __n, input_iterator_tag) { while (__n--) ++__i; } template<typename _BidirectionalIterator, typename _Distance> inline void __advance(_BidirectionalIterator& __i, _Distance __n, bidirectional_iterator_tag) { if (__n > 0) while (__n--) ++__i; else while (__n++) --__i; } template<typename _RandomAccessIterator, typename _Distance> inline void __advance(_RandomAccessIterator& __i, _Distance __n, random_access_iterator_tag) { __i += __n; } template<typename _InputIterator, typename _Distance> inline void advance(_InputIterator& __i, _Distance __n) { typename iterator_traits<_InputIterator>::difference_type __d = __n; std::__advance(__i, __d, std::__iterator_category(__i)); } template<typename _ForwardIterator> inline _ForwardIterator next(_ForwardIterator __x, typename iterator_traits<_ForwardIterator>::difference_type __n = 1) { std::advance(__x, __n); return __x; } template<typename _BidirectionalIterator> inline _BidirectionalIterator prev(_BidirectionalIterator __x, typename iterator_traits<_BidirectionalIterator>::difference_type __n = 1) { std::advance(__x, -__n); return __x; } } #define _STL_ITERATOR_H 1 namespace std { template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference> { protected: _Iterator current; typedef iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; typedef typename __traits_type::difference_type difference_type; typedef typename __traits_type::pointer pointer; typedef typename __traits_type::reference reference; reverse_iterator() : current() { } explicit reverse_iterator(iterator_type __x) : current(__x) { } reverse_iterator(const reverse_iterator& __x) : current(__x.current) { } template<typename _Iter> reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) { } iterator_type base() const { return current; } reference operator*() const { _Iterator __tmp = current; return *--__tmp; } pointer operator->() const { return &(operator*()); } reverse_iterator& operator++() { --current; return *this; } reverse_iterator operator++(int) { reverse_iterator __tmp = *this; --current; return __tmp; } reverse_iterator& operator--() { ++current; return *this; } reverse_iterator operator--(int) { reverse_iterator __tmp = *this; ++current; return __tmp; } reverse_iterator operator+(difference_type __n) const { return reverse_iterator(current - __n); } reverse_iterator& operator+=(difference_type __n) { current -= __n; return *this; } reverse_iterator operator-(difference_type __n) const { return reverse_iterator(current + __n); } reverse_iterator& operator-=(difference_type __n) { current += __n; return *this; } reference operator[](difference_type __n) const { return *(*this + __n); } }; template<typename _Iterator> inline bool operator==(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __x.base() == __y.base(); } template<typename _Iterator> inline bool operator<(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y.base() < __x.base(); } template<typename _Iterator> inline bool operator!=(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return !(__x == __y); } template<typename _Iterator> inline bool operator>(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y < __x; } template<typename _Iterator> inline bool operator<=(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return !(__y < __x); } template<typename _Iterator> inline bool operator>=(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return !(__x < __y); } template<typename _Iterator> inline typename reverse_iterator<_Iterator>::difference_type operator-(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y.base() - __x.base(); } template<typename _Iterator> inline reverse_iterator<_Iterator> operator+(typename reverse_iterator<_Iterator>::difference_type __n, const reverse_iterator<_Iterator>& __x) { return reverse_iterator<_Iterator>(__x.base() - __n); } template<typename _IteratorL, typename _IteratorR> inline bool operator==(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __x.base() == __y.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator<(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __y.base() < __x.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator!=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__x == __y); } template<typename _IteratorL, typename _IteratorR> inline bool operator>(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __y < __x; } template<typename _IteratorL, typename _IteratorR> inline bool operator<=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__y < __x); } template<typename _IteratorL, typename _IteratorR> inline bool operator>=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__x < __y); } template<typename _IteratorL, typename _IteratorR> inline auto operator-(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) -> decltype(__y.base() - __x.base()) { return __y.base() - __x.base(); } template<typename _Container> class back_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; public: typedef _Container container_type; explicit back_insert_iterator(_Container& __x) : container(&__x) { } back_insert_iterator& operator=(const typename _Container::value_type& __value) { container->push_back(__value); return *this; } back_insert_iterator& operator=(typename _Container::value_type&& __value) { container->push_back(std::move(__value)); return *this; } back_insert_iterator& operator*() { return *this; } back_insert_iterator& operator++() { return *this; } back_insert_iterator operator++(int) { return *this; } }; template<typename _Container> inline back_insert_iterator<_Container> back_inserter(_Container& __x) { return back_insert_iterator<_Container>(__x); } template<typename _Container> class front_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; public: typedef _Container container_type; explicit front_insert_iterator(_Container& __x) : container(&__x) { } front_insert_iterator& operator=(const typename _Container::value_type& __value) { container->push_front(__value); return *this; } front_insert_iterator& operator=(typename _Container::value_type&& __value) { container->push_front(std::move(__value)); return *this; } front_insert_iterator& operator*() { return *this; } front_insert_iterator& operator++() { return *this; } front_insert_iterator operator++(int) { return *this; } }; template<typename _Container> inline front_insert_iterator<_Container> front_inserter(_Container& __x) { return front_insert_iterator<_Container>(__x); } template<typename _Container> class insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; insert_iterator(_Container& __x, typename _Container::iterator __i) : container(&__x), iter(__i) {} insert_iterator& operator=(const typename _Container::value_type& __value) { iter = container->insert(iter, __value); ++iter; return *this; } insert_iterator& operator=(typename _Container::value_type&& __value) { iter = container->insert(iter, std::move(__value)); ++iter; return *this; } insert_iterator& operator*() { return *this; } insert_iterator& operator++() { return *this; } insert_iterator& operator++(int) { return *this; } }; template<typename _Container, typename _Iterator> inline insert_iterator<_Container> inserter(_Container& __x, _Iterator __i) { return insert_iterator<_Container>(__x, typename _Container::iterator(__i)); } } namespace __gnu_cxx { using std::iterator_traits; using std::iterator; template<typename _Iterator, typename _Container> class __normal_iterator { protected: _Iterator _M_current; typedef iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; typedef typename __traits_type::iterator_category iterator_category; typedef typename __traits_type::value_type value_type; typedef typename __traits_type::difference_type difference_type; typedef typename __traits_type::reference reference; typedef typename __traits_type::pointer pointer; constexpr __normal_iterator() : _M_current(_Iterator()) { } explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) { } template<typename _Iter> __normal_iterator(const __normal_iterator<_Iter, typename __enable_if< (std::__are_same<_Iter, typename _Container::pointer>::__value), _Container>::__type>& __i) : _M_current(__i.base()) { } reference operator*() const { return *_M_current; } pointer operator->() const { return _M_current; } __normal_iterator& operator++() { ++_M_current; return *this; } __normal_iterator operator++(int) { return __normal_iterator(_M_current++); } __normal_iterator& operator--() { --_M_current; return *this; } __normal_iterator operator--(int) { return __normal_iterator(_M_current--); } reference operator[](const difference_type& __n) const { return _M_current[__n]; } __normal_iterator& operator+=(const difference_type& __n) { _M_current += __n; return *this; } __normal_iterator operator+(const difference_type& __n) const { return __normal_iterator(_M_current + __n); } __normal_iterator& operator-=(const difference_type& __n) { _M_current -= __n; return *this; } __normal_iterator operator-(const difference_type& __n) const { return __normal_iterator(_M_current - __n); } const _Iterator& base() const { return _M_current; } }; template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator==(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() == __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator==(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() == __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() != __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator!=(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() != __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() < __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator<(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() < __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator>(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() > __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator>(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() > __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() <= __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator<=(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() <= __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() >= __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator>=(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() >= __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline auto operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) -> decltype(__lhs.base() - __rhs.base()) { return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Container> inline typename __normal_iterator<_Iterator, _Container>::difference_type operator-(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Container> inline __normal_iterator<_Iterator, _Container> operator+(typename __normal_iterator<_Iterator, _Container>::difference_type __n, const __normal_iterator<_Iterator, _Container>& __i) { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); } } namespace std { template<typename _Iterator> class move_iterator { protected: _Iterator _M_current; typedef iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; typedef typename __traits_type::iterator_category iterator_category; typedef typename __traits_type::value_type value_type; typedef typename __traits_type::difference_type difference_type; typedef _Iterator pointer; typedef value_type&& reference; move_iterator() : _M_current() { } explicit move_iterator(iterator_type __i) : _M_current(__i) { } template<typename _Iter> move_iterator(const move_iterator<_Iter>& __i) : _M_current(__i.base()) { } iterator_type base() const { return _M_current; } reference operator*() const { return std::move(*_M_current); } pointer operator->() const { return _M_current; } move_iterator& operator++() { ++_M_current; return *this; } move_iterator operator++(int) { move_iterator __tmp = *this; ++_M_current; return __tmp; } move_iterator& operator--() { --_M_current; return *this; } move_iterator operator--(int) { move_iterator __tmp = *this; --_M_current; return __tmp; } move_iterator operator+(difference_type __n) const { return move_iterator(_M_current + __n); } move_iterator& operator+=(difference_type __n) { _M_current += __n; return *this; } move_iterator operator-(difference_type __n) const { return move_iterator(_M_current - __n); } move_iterator& operator-=(difference_type __n) { _M_current -= __n; return *this; } reference operator[](difference_type __n) const { return std::move(_M_current[__n]); } }; template<typename _IteratorL, typename _IteratorR> inline bool operator==(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return __x.base() == __y.base(); } template<typename _Iterator> inline bool operator==(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return __x.base() == __y.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator!=(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return !(__x == __y); } template<typename _Iterator> inline bool operator!=(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return !(__x == __y); } template<typename _IteratorL, typename _IteratorR> inline bool operator<(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return __x.base() < __y.base(); } template<typename _Iterator> inline bool operator<(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return __x.base() < __y.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator<=(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return !(__y < __x); } template<typename _Iterator> inline bool operator<=(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return !(__y < __x); } template<typename _IteratorL, typename _IteratorR> inline bool operator>(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return __y < __x; } template<typename _Iterator> inline bool operator>(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return __y < __x; } template<typename _IteratorL, typename _IteratorR> inline bool operator>=(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return !(__x < __y); } template<typename _Iterator> inline bool operator>=(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return !(__x < __y); } template<typename _IteratorL, typename _IteratorR> inline auto operator-(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template<typename _Iterator> inline auto operator-(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template<typename _Iterator> inline move_iterator<_Iterator> operator+(typename move_iterator<_Iterator>::difference_type __n, const move_iterator<_Iterator>& __x) { return __x + __n; } template<typename _Iterator> inline move_iterator<_Iterator> make_move_iterator(_Iterator __i) { return move_iterator<_Iterator>(__i); } template<typename _Iterator, typename _ReturnType = typename conditional<__move_if_noexcept_cond <typename iterator_traits<_Iterator>::value_type>::value, _Iterator, move_iterator<_Iterator>>::type> inline _ReturnType __make_move_if_noexcept_iterator(_Iterator __i) { return _ReturnType(__i); } } #define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter) #define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) std::__make_move_if_noexcept_iterator(_Iter) #define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 namespace std { namespace __debug { } } namespace __gnu_debug { using namespace std::__debug; } #define _GLIBCXX_DEBUG_ASSERT(_Condition) #define _GLIBCXX_DEBUG_PEDASSERT(_Condition) #define _GLIBCXX_DEBUG_ONLY(_Statement) ; #define __glibcxx_requires_cond(_Cond,_Msg) #define __glibcxx_requires_valid_range(_First,_Last) #define __glibcxx_requires_sorted(_First,_Last) #define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) #define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) #define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) #define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) #define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) #define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) #define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) #define __glibcxx_requires_heap(_First,_Last) #define __glibcxx_requires_heap_pred(_First,_Last,_Pred) #define __glibcxx_requires_nonempty() #define __glibcxx_requires_string(_String) #define __glibcxx_requires_string_len(_String,_Len) #define __glibcxx_requires_subscript(_N) namespace std { template<bool _BoolType> struct __iter_swap { template<typename _ForwardIterator1, typename _ForwardIterator2> static void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { typedef typename iterator_traits<_ForwardIterator1>::value_type _ValueType1; _ValueType1 __tmp = std::move(*__a); *__a = std::move(*__b); *__b = std::move(__tmp); } }; template<> struct __iter_swap<true> { template<typename _ForwardIterator1, typename _ForwardIterator2> static void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { swap(*__a, *__b); } }; template<typename _ForwardIterator1, typename _ForwardIterator2> inline void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { typedef typename iterator_traits<_ForwardIterator1>::value_type _ValueType1; typedef typename iterator_traits<_ForwardIterator2>::value_type _ValueType2; typedef typename iterator_traits<_ForwardIterator1>::reference _ReferenceType1; typedef typename iterator_traits<_ForwardIterator2>::reference _ReferenceType2; std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value && __are_same<_ValueType1&, _ReferenceType1>::__value && __are_same<_ValueType2&, _ReferenceType2>::__value>:: iter_swap(__a, __b); } template<typename _ForwardIterator1, typename _ForwardIterator2> _ForwardIterator2 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { ; for (; __first1 != __last1; ++__first1, ++__first2) std::iter_swap(__first1, __first2); return __first2; } template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) { if (__b < __a) return __b; return __a; } template<typename _Tp> inline const _Tp& max(const _Tp& __a, const _Tp& __b) { if (__a < __b) return __b; return __a; } template<typename _Tp, typename _Compare> inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { if (__comp(__b, __a)) return __b; return __a; } template<typename _Tp, typename _Compare> inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { if (__comp(__a, __b)) return __b; return __a; } template<typename _Iterator> struct _Niter_base : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value> { }; template<typename _Iterator> inline typename _Niter_base<_Iterator>::iterator_type __niter_base(_Iterator __it) { return std::_Niter_base<_Iterator>::_S_base(__it); } template<typename _Iterator> struct _Miter_base : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value> { }; template<typename _Iterator> inline typename _Miter_base<_Iterator>::iterator_type __miter_base(_Iterator __it) { return std::_Miter_base<_Iterator>::_S_base(__it); } template<bool, bool, typename> struct __copy_move { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { for (; __first != __last; ++__result, ++__first) *__result = *__first; return __result; } }; template<typename _Category> struct __copy_move<true, false, _Category> { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { for (; __first != __last; ++__result, ++__first) *__result = std::move(*__first); return __result; } }; template<> struct __copy_move<false, false, random_access_iterator_tag> { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::difference_type _Distance; for(_Distance __n = __last - __first; __n > 0; --__n) { *__result = *__first; ++__first; ++__result; } return __result; } }; template<> struct __copy_move<true, false, random_access_iterator_tag> { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::difference_type _Distance; for(_Distance __n = __last - __first; __n > 0; --__n) { *__result = std::move(*__first); ++__first; ++__result; } return __result; } }; template<bool _IsMove> struct __copy_move<_IsMove, true, random_access_iterator_tag> { template<typename _Tp> static _Tp* __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; if (_Num) __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); return __result + _Num; } }; template<bool _IsMove, typename _II, typename _OI> inline _OI __copy_move_a(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::value_type _ValueTypeI; typedef typename iterator_traits<_OI>::value_type _ValueTypeO; typedef typename iterator_traits<_II>::iterator_category _Category; const bool __simple = (__is_trivial(_ValueTypeI) && __is_pointer<_II>::__value && __is_pointer<_OI>::__value && __are_same<_ValueTypeI, _ValueTypeO>::__value); return std::__copy_move<_IsMove, __simple, _Category>::__copy_m(__first, __last, __result); } template<typename _CharT> struct char_traits; template<typename _CharT, typename _Traits> class istreambuf_iterator; template<typename _CharT, typename _Traits> class ostreambuf_iterator; template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type __copy_move_a2(_CharT*, _CharT*, ostreambuf_iterator<_CharT, char_traits<_CharT> >); template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type __copy_move_a2(const _CharT*, const _CharT*, ostreambuf_iterator<_CharT, char_traits<_CharT> >); template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, _CharT*>::__type __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*); template<bool _IsMove, typename _II, typename _OI> inline _OI __copy_move_a2(_II __first, _II __last, _OI __result) { return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first), std::__niter_base(__last), std::__niter_base(__result))); } template<typename _II, typename _OI> inline _OI copy(_II __first, _II __last, _OI __result) { ; return (std::__copy_move_a2<__is_move_iterator<_II>::__value> (std::__miter_base(__first), std::__miter_base(__last), __result)); } template<typename _II, typename _OI> inline _OI move(_II __first, _II __last, _OI __result) { ; return std::__copy_move_a2<true>(std::__miter_base(__first), std::__miter_base(__last), __result); } #define _GLIBCXX_MOVE3(_Tp,_Up,_Vp) std::move(_Tp, _Up, _Vp) template<bool, bool, typename> struct __copy_move_backward { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { while (__first != __last) *--__result = *--__last; return __result; } }; template<typename _Category> struct __copy_move_backward<true, false, _Category> { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { while (__first != __last) *--__result = std::move(*--__last); return __result; } }; template<> struct __copy_move_backward<false, false, random_access_iterator_tag> { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { typename iterator_traits<_BI1>::difference_type __n; for (__n = __last - __first; __n > 0; --__n) *--__result = *--__last; return __result; } }; template<> struct __copy_move_backward<true, false, random_access_iterator_tag> { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { typename iterator_traits<_BI1>::difference_type __n; for (__n = __last - __first; __n > 0; --__n) *--__result = std::move(*--__last); return __result; } }; template<bool _IsMove> struct __copy_move_backward<_IsMove, true, random_access_iterator_tag> { template<typename _Tp> static _Tp* __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; if (_Num) __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); return __result - _Num; } }; template<bool _IsMove, typename _BI1, typename _BI2> inline _BI2 __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result) { typedef typename iterator_traits<_BI1>::value_type _ValueType1; typedef typename iterator_traits<_BI2>::value_type _ValueType2; typedef typename iterator_traits<_BI1>::iterator_category _Category; const bool __simple = (__is_trivial(_ValueType1) && __is_pointer<_BI1>::__value && __is_pointer<_BI2>::__value && __are_same<_ValueType1, _ValueType2>::__value); return std::__copy_move_backward<_IsMove, __simple, _Category>::__copy_move_b(__first, __last, __result); } template<bool _IsMove, typename _BI1, typename _BI2> inline _BI2 __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result) { return _BI2(std::__copy_move_backward_a<_IsMove> (std::__niter_base(__first), std::__niter_base(__last), std::__niter_base(__result))); } template<typename _BI1, typename _BI2> inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { ; return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value> (std::__miter_base(__first), std::__miter_base(__last), __result)); } template<typename _BI1, typename _BI2> inline _BI2 move_backward(_BI1 __first, _BI1 __last, _BI2 __result) { ; return std::__copy_move_backward_a2<true>(std::__miter_base(__first), std::__miter_base(__last), __result); } #define _GLIBCXX_MOVE_BACKWARD3(_Tp,_Up,_Vp) std::move_backward(_Tp, _Up, _Vp) template<typename _ForwardIterator, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type __fill_a(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { for (; __first != __last; ++__first) *__first = __value; } template<typename _ForwardIterator, typename _Tp> inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __fill_a(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { const _Tp __tmp = __value; for (; __first != __last; ++__first) *__first = __tmp; } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c) { const _Tp __tmp = __c; __builtin_memset(__first, static_cast<unsigned char>(__tmp), __last - __first); } template<typename _ForwardIterator, typename _Tp> inline void fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { ; std::__fill_a(std::__niter_base(__first), std::__niter_base(__last), __value); } template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first) *__first = __value; return __first; } template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { const _Tp __tmp = __value; for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first) *__first = __tmp; return __first; } template<typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c) { std::__fill_a(__first, __first + __n, __c); return __first + __n; } template<typename _OI, typename _Size, typename _Tp> inline _OI fill_n(_OI __first, _Size __n, const _Tp& __value) { return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value)); } template<bool _BoolType> struct __equal { template<typename _II1, typename _II2> static bool equal(_II1 __first1, _II1 __last1, _II2 __first2) { for (; __first1 != __last1; ++__first1, ++__first2) if (!(*__first1 == *__first2)) return false; return true; } }; template<> struct __equal<true> { template<typename _Tp> static bool equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) { return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * (__last1 - __first1)); } }; template<typename _II1, typename _II2> inline bool __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) { typedef typename iterator_traits<_II1>::value_type _ValueType1; typedef typename iterator_traits<_II2>::value_type _ValueType2; const bool __simple = ((__is_integer<_ValueType1>::__value || __is_pointer<_ValueType1>::__value) && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value && __are_same<_ValueType1, _ValueType2>::__value); return std::__equal<__simple>::equal(__first1, __last1, __first2); } template<typename, typename> struct __lc_rai { template<typename _II1, typename _II2> static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) { return __last1; } template<typename _II> static bool __cnd2(_II __first, _II __last) { return __first != __last; } }; template<> struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag> { template<typename _RAI1, typename _RAI2> static _RAI1 __newlast1(_RAI1 __first1, _RAI1 __last1, _RAI2 __first2, _RAI2 __last2) { const typename iterator_traits<_RAI1>::difference_type __diff1 = __last1 - __first1; const typename iterator_traits<_RAI2>::difference_type __diff2 = __last2 - __first2; return __diff2 < __diff1 ? __first1 + __diff2 : __last1; } template<typename _RAI> static bool __cnd2(_RAI, _RAI) { return true; } }; template<bool _BoolType> struct __lexicographical_compare { template<typename _II1, typename _II2> static bool __lc(_II1, _II1, _II2, _II2); }; template<bool _BoolType> template<typename _II1, typename _II2> bool __lexicographical_compare<_BoolType>:: __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { typedef typename iterator_traits<_II1>::iterator_category _Category1; typedef typename iterator_traits<_II2>::iterator_category _Category2; typedef std::__lc_rai<_Category1, _Category2> __rai_type; __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); ++__first1, ++__first2) { if (*__first1 < *__first2) return true; if (*__first2 < *__first1) return false; } return __first1 == __last1 && __first2 != __last2; } template<> struct __lexicographical_compare<true> { template<typename _Tp, typename _Up> static bool __lc(const _Tp* __first1, const _Tp* __last1, const _Up* __first2, const _Up* __last2) { const size_t __len1 = __last1 - __first1; const size_t __len2 = __last2 - __first2; const int __result = __builtin_memcmp(__first1, __first2, std::min(__len1, __len2)); return __result != 0 ? __result < 0 : __len1 < __len2; } }; template<typename _II1, typename _II2> inline bool __lexicographical_compare_aux(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { typedef typename iterator_traits<_II1>::value_type _ValueType1; typedef typename iterator_traits<_II2>::value_type _ValueType2; const bool __simple = (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value); return std::__lexicographical_compare<__simple>::__lc(__first1, __last1, __first2, __last2); } template<typename _ForwardIterator, typename _Tp> _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; ; _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (*__middle < __val) { __first = __middle; ++__first; __len = __len - __half - 1; } else __len = __half; } return __first; } template<typename _Size> inline _Size __lg(_Size __n) { _Size __k; for (__k = 0; __n != 0; __n >>= 1) ++__k; return __k - 1; } inline int __lg(int __n) { return sizeof(int) * 8 - 1 - __builtin_clz(__n); } inline long __lg(long __n) { return sizeof(long) * 8 - 1 - __builtin_clzl(__n); } inline long long __lg(long long __n) { return sizeof(long long) * 8 - 1 - __builtin_clzll(__n); } template<typename _II1, typename _II2> inline bool equal(_II1 __first1, _II1 __last1, _II2 __first2) { ; return std::__equal_aux(std::__niter_base(__first1), std::__niter_base(__last1), std::__niter_base(__first2)); } template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> inline bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _BinaryPredicate __binary_pred) { ; for (; __first1 != __last1; ++__first1, ++__first2) if (!bool(__binary_pred(*__first1, *__first2))) return false; return true; } template<typename _II1, typename _II2> inline bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { typedef typename iterator_traits<_II1>::value_type _ValueType1; typedef typename iterator_traits<_II2>::value_type _ValueType2; ; ; return std::__lexicographical_compare_aux(std::__niter_base(__first1), std::__niter_base(__last1), std::__niter_base(__first2), std::__niter_base(__last2)); } template<typename _II1, typename _II2, typename _Compare> bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp) { typedef typename iterator_traits<_II1>::iterator_category _Category1; typedef typename iterator_traits<_II2>::iterator_category _Category2; typedef std::__lc_rai<_Category1, _Category2> __rai_type; ; ; __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); ++__first1, ++__first2) { if (__comp(*__first1, *__first2)) return true; if (__comp(*__first2, *__first1)) return false; } return __first1 == __last1 && __first2 != __last2; } template<typename _InputIterator1, typename _InputIterator2> pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { ; while (__first1 != __last1 && *__first1 == *__first2) { ++__first1; ++__first2; } return pair<_InputIterator1, _InputIterator2>(__first1, __first2); } template<typename _InputIterator1, typename _InputIterator2, typename _BinaryPredicate> pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __binary_pred) { ; while (__first1 != __last1 && bool(__binary_pred(*__first1, *__first2))) { ++__first1; ++__first2; } return pair<_InputIterator1, _InputIterator2>(__first1, __first2); } } namespace __gnu_cxx { template<typename _CharT> struct _Char_types { typedef unsigned long int_type; typedef std::streampos pos_type; typedef std::streamoff off_type; typedef std::mbstate_t state_type; }; template<typename _CharT> struct char_traits { typedef _CharT char_type; typedef typename _Char_types<_CharT>::int_type int_type; typedef typename _Char_types<_CharT>::pos_type pos_type; typedef typename _Char_types<_CharT>::off_type off_type; typedef typename _Char_types<_CharT>::state_type state_type; static void assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, std::size_t __n); static std::size_t length(const char_type* __s); static const char_type* find(const char_type* __s, std::size_t __n, const char_type& __a); static char_type* move(char_type* __s1, const char_type* __s2, std::size_t __n); static char_type* copy(char_type* __s1, const char_type* __s2, std::size_t __n); static char_type* assign(char_type* __s, std::size_t __n, char_type __a); static constexpr char_type to_char_type(const int_type& __c) { return static_cast<char_type>(__c); } static constexpr int_type to_int_type(const char_type& __c) { return static_cast<int_type>(__c); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) { return __c1 == __c2; } static constexpr int_type eof() { return static_cast<int_type>(-1); } static constexpr int_type not_eof(const int_type& __c) { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } }; template<typename _CharT> int char_traits<_CharT>:: compare(const char_type* __s1, const char_type* __s2, std::size_t __n) { for (std::size_t __i = 0; __i < __n; ++__i) if (lt(__s1[__i], __s2[__i])) return -1; else if (lt(__s2[__i], __s1[__i])) return 1; return 0; } template<typename _CharT> std::size_t char_traits<_CharT>:: length(const char_type* __p) { std::size_t __i = 0; while (!eq(__p[__i], char_type())) ++__i; return __i; } template<typename _CharT> const typename char_traits<_CharT>::char_type* char_traits<_CharT>:: find(const char_type* __s, std::size_t __n, const char_type& __a) { for (std::size_t __i = 0; __i < __n; ++__i) if (eq(__s[__i], __a)) return __s + __i; return 0; } template<typename _CharT> typename char_traits<_CharT>::char_type* char_traits<_CharT>:: move(char_type* __s1, const char_type* __s2, std::size_t __n) { return static_cast<_CharT*>(__builtin_memmove(__s1, __s2, __n * sizeof(char_type))); } template<typename _CharT> typename char_traits<_CharT>::char_type* char_traits<_CharT>:: copy(char_type* __s1, const char_type* __s2, std::size_t __n) { std::copy(__s2, __s2 + __n, __s1); return __s1; } template<typename _CharT> typename char_traits<_CharT>::char_type* char_traits<_CharT>:: assign(char_type* __s, std::size_t __n, char_type __a) { std::fill_n(__s, __n, __a); return __s; } } namespace std { template<class _CharT> struct char_traits : public __gnu_cxx::char_traits<_CharT> { }; template<> struct char_traits<char> { typedef char char_type; typedef int int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) noexcept { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) noexcept { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) noexcept { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { return __builtin_memcmp(__s1, __s2, __n); } static size_t length(const char_type* __s) { return __builtin_strlen(__s); } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n)); } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return static_cast<char_type*>(__builtin_memmove(__s1, __s2, __n)); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n)); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); } static constexpr char_type to_char_type(const int_type& __c) noexcept { return static_cast<char_type>(__c); } static constexpr int_type to_int_type(const char_type& __c) noexcept { return static_cast<int_type>(static_cast<unsigned char>(__c)); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) noexcept { return __c1 == __c2; } static constexpr int_type eof() noexcept { return static_cast<int_type>(-1); } static constexpr int_type not_eof(const int_type& __c) noexcept { return (__c == eof()) ? 0 : __c; } }; template<> struct char_traits<wchar_t> { typedef wchar_t char_type; typedef wint_t int_type; typedef streamoff off_type; typedef wstreampos pos_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) noexcept { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) noexcept { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) noexcept { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { return wmemcmp(__s1, __s2, __n); } static size_t length(const char_type* __s) { return wcslen(__s); } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { return wmemchr(__s, __a, __n); } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return wmemmove(__s1, __s2, __n); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { return wmemcpy(__s1, __s2, __n); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { return wmemset(__s, __a, __n); } static constexpr char_type to_char_type(const int_type& __c) noexcept { return char_type(__c); } static constexpr int_type to_int_type(const char_type& __c) noexcept { return int_type(__c); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) noexcept { return __c1 == __c2; } static constexpr int_type eof() noexcept { return static_cast<int_type>((-1)); } static constexpr int_type not_eof(const int_type& __c) noexcept { return eq_int_type(__c, eof()) ? 0 : __c; } }; } namespace std { template<> struct char_traits<char16_t> { typedef char16_t char_type; typedef uint_least16_t int_type; typedef streamoff off_type; typedef u16streampos pos_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) noexcept { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) noexcept { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) noexcept { 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 (lt(__s1[__i], __s2[__i])) return -1; else if (lt(__s2[__i], __s1[__i])) return 1; return 0; } static size_t length(const char_type* __s) { size_t __i = 0; while (!eq(__s[__i], char_type())) ++__i; return __i; } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { for (size_t __i = 0; __i < __n; ++__i) if (eq(__s[__i], __a)) return __s + __i; return 0; } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { 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) { return (static_cast<char_type*> (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { for (size_t __i = 0; __i < __n; ++__i) assign(__s[__i], __a); return __s; } static constexpr char_type to_char_type(const int_type& __c) noexcept { return char_type(__c); } static constexpr int_type to_int_type(const char_type& __c) noexcept { return int_type(__c); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) noexcept { return __c1 == __c2; } static constexpr int_type eof() noexcept { return static_cast<int_type>(-1); } static constexpr int_type not_eof(const int_type& __c) noexcept { return eq_int_type(__c, eof()) ? 0 : __c; } }; template<> struct char_traits<char32_t> { typedef char32_t char_type; typedef uint_least32_t int_type; typedef streamoff off_type; typedef u32streampos pos_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) noexcept { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) noexcept { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) noexcept { 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 (lt(__s1[__i], __s2[__i])) return -1; else if (lt(__s2[__i], __s1[__i])) return 1; return 0; } static size_t length(const char_type* __s) { size_t __i = 0; while (!eq(__s[__i], char_type())) ++__i; return __i; } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { for (size_t __i = 0; __i < __n; ++__i) if (eq(__s[__i], __a)) return __s + __i; return 0; } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { 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) { return (static_cast<char_type*> (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { for (size_t __i = 0; __i < __n; ++__i) assign(__s[__i], __a); return __s; } static constexpr char_type to_char_type(const int_type& __c) noexcept { return char_type(__c); } static constexpr int_type to_int_type(const char_type& __c) noexcept { return int_type(__c); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) noexcept { return __c1 == __c2; } static constexpr int_type eof() noexcept { return static_cast<int_type>(-1); } static constexpr int_type not_eof(const int_type& __c) noexcept { return eq_int_type(__c, eof()) ? 0 : __c; } }; } #define _ALLOCATOR_H 1 #define _GLIBCXX_CXX_ALLOCATOR_H 1 #define _NEW_ALLOCATOR_H 1 namespace __gnu_cxx { using std::size_t; using std::ptrdiff_t; 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; }; new_allocator() noexcept { } new_allocator(const new_allocator&) noexcept { } template<typename _Tp1> new_allocator(const new_allocator<_Tp1>&) noexcept { } ~new_allocator() noexcept { } pointer address(reference __x) const noexcept { return std::__addressof(__x); } const_pointer address(const_reference __x) const noexcept { return std::__addressof(__x); } pointer allocate(size_type __n, const void* = 0) { if (__n > this->max_size()) std::__throw_bad_alloc(); return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); } void deallocate(pointer __p, size_type) { ::operator delete(__p); } size_type max_size() const noexcept { return size_t(-1) / sizeof(_Tp); } 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(); } }; 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; } } #define __glibcxx_base_allocator __gnu_cxx::new_allocator namespace std { template<typename _Tp> class allocator; template<> class allocator<void> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; }; template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_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; template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; allocator() throw() { } allocator(const allocator& __a) throw() : __gnu_cxx::new_allocator<_Tp>(__a) { } template<typename _Tp1> allocator(const allocator<_Tp1>&) throw() { } ~allocator() throw() { } }; template<typename _T1, typename _T2> inline bool operator==(const allocator<_T1>&, const allocator<_T2>&) { return true; } template<typename _Tp> inline bool operator==(const allocator<_Tp>&, const allocator<_Tp>&) { return true; } template<typename _T1, typename _T2> inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&) { return false; } template<typename _Tp> inline bool operator!=(const allocator<_Tp>&, const allocator<_Tp>&) { return false; } extern template class allocator<char>; extern template class allocator<wchar_t>; #undef __glibcxx_base_allocator template<typename _Alloc, bool = __is_empty(_Alloc)> struct __alloc_swap { static void _S_do_it(_Alloc&, _Alloc&) { } }; template<typename _Alloc> struct __alloc_swap<_Alloc, false> { static void _S_do_it(_Alloc& __one, _Alloc& __two) { if (__one != __two) swap(__one, __two); } }; template<typename _Alloc, bool = __is_empty(_Alloc)> struct __alloc_neq { static bool _S_do_it(const _Alloc&, const _Alloc&) { return false; } }; template<typename _Alloc> struct __alloc_neq<_Alloc, false> { static bool _S_do_it(const _Alloc& __one, const _Alloc& __two) { return __one != __two; } }; template<typename _Tp, bool = __or_<is_copy_constructible<typename _Tp::value_type>, is_nothrow_move_constructible<typename _Tp::value_type>>::value> struct __shrink_to_fit_aux { static bool _S_do_it(_Tp&) { return false; } }; template<typename _Tp> struct __shrink_to_fit_aux<_Tp, true> { static bool _S_do_it(_Tp& __c) { try { _Tp(__make_move_if_noexcept_iterator(__c.begin()), __make_move_if_noexcept_iterator(__c.end())).swap(__c); return true; } catch(...) { return false; } } }; template<typename, typename> struct uses_allocator; } #define _LOCALE_FWD_H 1 #define _GLIBCXX_CXX_LOCALE_H 1 #define __H_LOCALE extern "C" { #undef NULL #define NULL (0) struct lconv { char *decimal_point; char *thousands_sep; char *grouping; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; char *left_parenthesis; char *right_parenthesis; char int_p_cs_precedes; char int_p_sep_by_space; char int_n_cs_precedes; char int_n_sep_by_space; char int_p_sign_posn; char int_n_sign_posn; } ; #define LC_ALL -1 #define LC_COLLATE 0 #define LC_CTYPE 1 #define LC_MONETARY 2 #define LC_NUMERIC 3 #define LC_TIME 4 #define LC_MESSAGES 5 struct lconv *localeconv(void); char *setlocale(int, const char *); typedef struct lconv lconv; } #define _GLIBCXX_CLOCALE 1 #undef setlocale #undef localeconv namespace std { using ::lconv; using ::setlocale; using ::localeconv; } #define _GLIBCXX_NUM_CATEGORIES 0 namespace std { typedef int* __c_locale; inline int __convert_from_v(const __c_locale&, char* __out, const int __size __attribute__((__unused__)), const char* __fmt, ...) { char* __old = std::setlocale(3, 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(3, "C"); } __builtin_va_list __args; __builtin_va_start(__args, __fmt); const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); __builtin_va_end(__args); if (__sav) { std::setlocale(3, __sav); delete [] __sav; } return __ret; } } #define __H_CTYPE #define _ISALPHA 0x001 #define _ISALNUM 0x002 #define _ISBLANK 0x004 #define _ISCNTRL 0x008 #define _ISDIGIT 0x010 #define _ISGRAPH 0x020 #define _ISLOWER 0x040 #define _ISPRINT 0x080 #define _ISPUNCT 0x100 #define _ISSPACE 0x200 #define _ISUPPER 0x400 #define _ISXDIGIT 0x800 extern int isalpha(int); extern int isalnum(int); extern int isblank(int); extern int iscntrl(int); extern int isdigit(int); extern int isgraph(int); extern int islower(int); extern int isprint(int); extern int ispunct(int); extern int isspace(int); extern int isupper(int); extern int isxdigit(int); extern int toupper(int); extern int tolower(int); extern int isascii(int); extern int toascii(int); #define _toupper(__a) toupper(__a) #define _tolower(__a) tolower(__a) #define __H_LOCALEDEF #define __METHOD_TBL -1 struct __LC_locale; struct _LC_locale_objhdl; #define __H_LC_CORE extern "C" { #define __DECL_METH(__h,__n) int __n #define __OBJ_DATA(__h) (__h).obj #define __OBJ_METH(__h) (__h).meth typedef struct { unsigned short __type_id, __magic; unsigned long __version; size_t __size; } _LC_object_t; #define _LC_CAR 1 #define _LC_LOCALE 2 #define _LC_CHARMAP 3 #define _LC_CTYPE 4 #define _LC_COLLATE 5 #define _LC_NUMERIC 6 #define _LC_MONETARY 7 #define _LC_TIME 8 #define _LC_RESP 9 #define _LC_OBJ_HDL 10 #define _LC_MAGIC 0x4C43 #define _LC_VERSION 0x40000000 #define _AIX320_LC_VERSION 0x33323030 #define _AIX323_LC_VERSION 0x33323130 #define _LC_MAJOR_PART(_lc_version) ((_lc_version >> 16) & 0x0000FFFF) #define _LC_MINOR_PART(_lc_version) (_lc_version & 0x0000FFFF) #define _LC_MAJOR (_LC_MAJOR_PART(_LC_VERSION)) #define _LC_MINOR (_LC_MINOR_PART(_LC_VERSION)) typedef struct { _LC_object_t __hdr; int __catgets; int __catclose; int __compress; int __decompress; int __start_compress; int __end_compress; int __init; void *__data; } _LC_core_car_t; typedef struct { _LC_object_t __hdr; int __nl_langinfo; int __mbtowc; int __mbstowcs; int __wctomb; int __wcstombs; int __mblen; int __wcswidth; int __wcwidth; int __mbtopc; int __mbstopcs; int __pctomb; int __pcstombs; int __csid; int __wcsid; int __init; void *__data; } _LC_core_charmap_t; typedef struct { _LC_object_t __hdr; int __towupper; int __towlower; int __get_wctype; int __is_wctype; int __init; void *__data; } _LC_core_ctype_t; typedef struct { _LC_object_t __hdr; int __strcoll; int __strxfrm; int __wcscoll; int __wcsxfrm; int __fnmatch; int __regcomp; int __regerror; int __regexec; int __regfree; int __init; void *__data; } _LC_core_collate_t; typedef struct { _LC_object_t __hdr; int __nl_langinfo; int __strftime; int __strptime; int __wcsftime; int __init; void *__data; } _LC_core_time_t; typedef struct { _LC_object_t __hdr; int __nl_langinfo; int __strfmon; int __init; void *__data; } _LC_core_monetary_t; typedef struct { _LC_object_t __hdr; int __nl_langinfo; int __init; void *__data; } _LC_core_numeric_t; typedef struct { _LC_object_t __hdr; int __nl_langinfo; int __rpmatch; int __init; void *__data; } _LC_core_resp_t; typedef struct { _LC_object_t __hdr; int __nl_langinfo; int __localeconv; int __init; void *__data; } _LC_core_locale_t; } #define _H_LOCALEDEF typedef struct coldesc { short cd_stroff; short cd_repoff; short cd_cval; short cd_cuniq; } coldesc_t; typedef struct collation_table { short lc_version; short lc_length; char *lc_locale_name; int len_collate; short *lc_collate; int len_coluniq; short *lc_coluniq; int len_coldesc; coldesc_t *lc_coldesc; int len_strings; wchar_t *lc_strings; int high_cvalue; } col_t; typedef struct char_classification_table { short lc_version; short lc_length; short lc_code_type; short mb_cur_max; short mb_cur_min; short lc_dsp_width; char *lc_locale_name; int len_caseconv; wchar_t *lc_caseconv; int len_ctype; unsigned short *lc_ctype; } ctype_t; typedef struct lc_monetary_table { short lc_version; short lc_length; char *lc_locale_name; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; } mon_t; typedef struct numeric_table { short lc_version; short lc_length; char *lc_locale_name; char *decimal_point; char *thousands_sep; char *grouping; } num_t; typedef struct lc_messages_table { short lc_version; short lc_length; char *lc_locale_name; char *messages; char *yes_string; char *no_string; } msg_t; typedef struct lc_time_table { short lc_version; short lc_length; char *lc_locale_name; char *t_fmt; char *d_fmt; char *nlldate; char *d_t_fmt; char *abday; char *day; char *abmon; char *mon; char *misc; char *tstrs; char *tunits; char *year; char *am_pm; } tim_t; typedef struct wchar_mapping_table { short lc_version; short lc_length; char *lc_identifier; } map_t; #define NLCTMAG0 (unsigned char)0x01 #define NLCTMAG1 (unsigned char)0x05 typedef struct localeinfo_table { char lc_mag0, lc_mag1; short lc_version; short lc_code_type; short lc_length; col_t *lc_coltbl; ctype_t *lc_chrtbl; mon_t *lc_montbl; num_t *lc_numtbl; tim_t *lc_timtbl; msg_t *lc_msgtbl; map_t *lc_maptbl; } loc_t; #define _COLL_WEIGHTS_MAX COLL_WEIGHTS_MAX #define _UCW_ORDER _COLL_WEIGHTS_MAX #define _LOC_HAS_MCCE 1 typedef struct { _LC_core_charmap_t core; char *cm_csname; size_t cm_mb_cur_max; size_t cm_mb_cur_min; unsigned char cm_max_disp_width; unsigned char *cm_cstab; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; } _LC_charmap_t; typedef struct _LC_charmap_objhdl _LC_charmap_objhdl_t; struct _LC_charmap_objhdl { _LC_charmap_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct { _LC_core_monetary_t core; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; signed char int_frac_digits; signed char frac_digits; signed char p_cs_precedes; signed char p_sep_by_space; signed char n_cs_precedes; signed char n_sep_by_space; signed char p_sign_posn; signed char n_sign_posn; char *debit_sign; char *credit_sign; char *left_parenthesis; char *right_parenthesis; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; signed char int_p_cs_precedes; signed char int_p_sep_by_space; signed char int_n_cs_precedes; signed char int_n_sep_by_space; signed char int_p_sign_posn; signed char int_n_sign_posn; } _LC_monetary_t; typedef struct _LC_monetary_objhdl _LC_monetary_objhdl_t; struct _LC_monetary_objhdl { _LC_monetary_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct { _LC_core_numeric_t core; char *decimal_point; char *thousands_sep; char *grouping; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; } _LC_numeric_t; typedef struct _LC_numeric_objhdl _LC_numeric_objhdl_t; struct _LC_numeric_objhdl { _LC_numeric_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct { _LC_core_resp_t core; char *yesexpr; char *noexpr; char *yesstr; char *nostr; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; } _LC_resp_t; typedef struct _LC_resp_objhdl _LC_resp_objhdl_t; struct _LC_resp_objhdl { _LC_resp_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct { _LC_core_time_t core; char *d_fmt; char *t_fmt; char *d_t_fmt; char *t_fmt_ampm; char *abday[7]; char *day[7]; char *abmon[12]; char *mon[12]; char *am_pm[2]; char *era; char *era_year; char *era_d_fmt; char *alt_digits; char *era_d_t_fmt; char *era_t_fmt; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; } _LC_time_t; typedef struct _LC_time_objhdl _LC_time_objhdl_t; struct _LC_time_objhdl { _LC_time_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct { unsigned short n[4 +1]; } _LC_weight_t; typedef struct { char *ce_sym; _LC_weight_t ce_wgt; } _LC_collel_t; typedef struct { _LC_weight_t ct_wgt; _LC_collel_t *ct_collel; } _LC_coltbl_t; #define _SUB_STRING (USHRT_MAX - 1) typedef struct { char *tgt_wgt_str[4 +1]; } _LC_subs_t; typedef struct { _LC_core_collate_t core; unsigned char co_nord; _LC_weight_t co_sort; wchar_t co_wc_min; wchar_t co_wc_max; wchar_t co_col_min; wchar_t co_col_max; _LC_coltbl_t *co_coltbl; unsigned char co_nsubs; _LC_subs_t *co_subs; unsigned short co_special; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; } _LC_collate_t; typedef struct _LC_collate_objhdl _LC_collate_objhdl_t; struct _LC_collate_objhdl { _LC_collate_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; #define _COLL_FORWARD_MASK 1 #define _COLL_BACKWARD_MASK 2 #define _COLL_NOSUBS_MASK 4 #define _COLL_POSITION_MASK 8 typedef struct { char *name; unsigned int mask; } _LC_classnm_t; typedef struct { _LC_core_ctype_t core; wchar_t min_wc; wchar_t max_wc; wchar_t *upper; wchar_t *lower; unsigned int *mask; unsigned int *qmask; unsigned char *qidx; unsigned char nclasses; _LC_classnm_t *classnms; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; } _LC_ctype_t; typedef struct _LC_ctype_objhdl _LC_ctype_objhdl_t; struct _LC_ctype_objhdl { _LC_ctype_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; #define _NL_NUM_ITEMS 63 typedef struct __LC_locale { _LC_core_locale_t core; char *nl_info[63]; struct lconv *nl_lconv; _LC_charmap_objhdl_t lc_charmap; _LC_collate_objhdl_t lc_collate; _LC_ctype_objhdl_t lc_ctype; _LC_monetary_objhdl_t lc_monetary; _LC_numeric_objhdl_t lc_numeric; _LC_resp_objhdl_t lc_resp; _LC_time_objhdl_t lc_time; struct __LC_locale *loc_rec; void *__meth_ptr; void *__data_ptr; char *__nl_yesstr; char *__nl_nostr; char *__nl_crncystr; } _LC_locale_t; typedef struct _LC_locale_objhdl _LC_locale_objhdl_t; struct _LC_locale_objhdl { _LC_locale_t *obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct _LC_object_handle _LC_object_handle_t; struct _LC_object_handle { union { _LC_object_t lc_object; _LC_locale_objhdl_t lc_locale; _LC_charmap_objhdl_t lc_charmap; _LC_collate_objhdl_t lc_collate; _LC_ctype_objhdl_t lc_ctype; _LC_monetary_objhdl_t lc_monetary; _LC_numeric_objhdl_t lc_numeric; _LC_resp_objhdl_t lc_resp; _LC_time_objhdl_t lc_time; } obj; void *(**meth)(); struct _LC_locale_objhdl *loc_hdl; }; typedef struct { _LC_object_t hdr; _LC_locale_objhdl_t handle; } _LC_load_object_t; #define _LC_MAX_OBJECTS 256 #define _DFLT_LOC_PATH "/usr/lib/nls/loc/" extern _LC_charmap_objhdl_t *__lc_charmap_ptr; extern _LC_collate_objhdl_t *__lc_collate_ptr; extern _LC_ctype_objhdl_t *__lc_ctype_ptr; extern _LC_monetary_objhdl_t *__lc_monetary_ptr; extern _LC_numeric_objhdl_t *__lc_numeric_ptr; extern _LC_resp_objhdl_t *__lc_resp_ptr; extern _LC_time_objhdl_t *__lc_time_ptr; extern _LC_locale_objhdl_t *__lc_locale_ptr; extern _LC_charmap_objhdl_t __lc_charmap; extern _LC_collate_objhdl_t __lc_collate; extern _LC_ctype_objhdl_t __lc_ctype; extern _LC_monetary_objhdl_t __lc_monetary; extern _LC_numeric_objhdl_t __lc_numeric; extern _LC_resp_objhdl_t __lc_resp; extern _LC_time_objhdl_t __lc_time; extern _LC_locale_objhdl_t __lc_locale; extern int is_wctype(wint_t, wctype_t); extern wctype_t get_wctype(char *); #define _GLIBCXX_CCTYPE 1 #undef isalnum #undef isalpha #undef iscntrl #undef isdigit #undef isgraph #undef islower #undef isprint #undef ispunct #undef isspace #undef isupper #undef isxdigit #undef tolower #undef toupper namespace std { using ::isalnum; using ::isalpha; using ::iscntrl; using ::isdigit; using ::isgraph; using ::islower; using ::isprint; using ::ispunct; using ::isspace; using ::isupper; using ::isxdigit; using ::tolower; using ::toupper; } #undef isblank namespace std { using ::isblank; } namespace std { class locale; template<typename _Facet> bool has_facet(const locale&) throw(); template<typename _Facet> const _Facet& use_facet(const locale&); template<typename _CharT> bool isspace(_CharT, const locale&); template<typename _CharT> bool isprint(_CharT, const locale&); template<typename _CharT> bool iscntrl(_CharT, const locale&); template<typename _CharT> bool isupper(_CharT, const locale&); template<typename _CharT> bool islower(_CharT, const locale&); template<typename _CharT> bool isalpha(_CharT, const locale&); template<typename _CharT> bool isdigit(_CharT, const locale&); template<typename _CharT> bool ispunct(_CharT, const locale&); template<typename _CharT> bool isxdigit(_CharT, const locale&); template<typename _CharT> bool isalnum(_CharT, const locale&); template<typename _CharT> bool isgraph(_CharT, const locale&); template<typename _CharT> _CharT toupper(_CharT, const locale&); template<typename _CharT> _CharT tolower(_CharT, const locale&); class ctype_base; template<typename _CharT> class ctype; template<> class ctype<char>; template<> class ctype<wchar_t>; template<typename _CharT> class ctype_byname; class codecvt_base; template<typename _InternT, typename _ExternT, typename _StateT> class codecvt; template<> class codecvt<char, char, mbstate_t>; template<> class codecvt<wchar_t, char, mbstate_t>; template<typename _InternT, typename _ExternT, typename _StateT> class codecvt_byname; template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class num_get; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class num_put; template<typename _CharT> class numpunct; template<typename _CharT> class numpunct_byname; template<typename _CharT> class collate; template<typename _CharT> class collate_byname; class time_base; template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class time_get; template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class time_get_byname; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class time_put; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class time_put_byname; class money_base; template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class money_get; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class money_put; template<typename _CharT, bool _Intl = false> class moneypunct; template<typename _CharT, bool _Intl = false> class moneypunct_byname; class messages_base; template<typename _CharT> class messages; template<typename _CharT> class messages_byname; } #define _OSTREAM_INSERT_H 1 #define _CXXABI_FORCED_H 1 #pragma GCC visibility push(default) namespace __cxxabiv1 { class __forced_unwind { virtual ~__forced_unwind() throw(); virtual void __pure_dummy() = 0; }; } #pragma GCC visibility pop namespace std { template<typename _CharT, typename _Traits> inline void __ostream_write(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s, streamsize __n) { typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const streamsize __put = __out.rdbuf()->sputn(__s, __n); if (__put != __n) __out.setstate(__ios_base::badbit); } template<typename _CharT, typename _Traits> inline void __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n) { typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const _CharT __c = __out.fill(); for (; __n > 0; --__n) { const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c); if (_Traits::eq_int_type(__put, _Traits::eof())) { __out.setstate(__ios_base::badbit); break; } } } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& __ostream_insert(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s, streamsize __n) { typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; typename __ostream_type::sentry __cerb(__out); if (__cerb) { try { const streamsize __w = __out.width(); if (__w > __n) { const bool __left = ((__out.flags() & __ios_base::adjustfield) == __ios_base::left); if (!__left) __ostream_fill(__out, __w - __n); if (__out.good()) __ostream_write(__out, __s, __n); if (__left && __out.good()) __ostream_fill(__out, __w - __n); } else __ostream_write(__out, __s, __n); __out.width(0); } catch(__cxxabiv1::__forced_unwind&) { __out._M_setstate(__ios_base::badbit); throw; } catch(...) { __out._M_setstate(__ios_base::badbit); } } return __out; } extern template ostream& __ostream_insert(ostream&, const char*, streamsize); extern template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize); } #define _GLIBCXX_RANGE_ACCESS_H 1 namespace std { template<class _Container> inline auto begin(_Container& __cont) -> decltype(__cont.begin()) { return __cont.begin(); } template<class _Container> inline auto begin(const _Container& __cont) -> decltype(__cont.begin()) { return __cont.begin(); } template<class _Container> inline auto end(_Container& __cont) -> decltype(__cont.end()) { return __cont.end(); } template<class _Container> inline auto end(const _Container& __cont) -> decltype(__cont.end()) { return __cont.end(); } template<class _Tp, size_t _Nm> inline _Tp* begin(_Tp (&__arr)[_Nm]) { return __arr; } template<class _Tp, size_t _Nm> inline _Tp* end(_Tp (&__arr)[_Nm]) { return __arr + _Nm; } } #define _BASIC_STRING_H 1 #define _GLIBCXX_ATOMICITY_H 1 #define _GLIBCXX_GCC_GTHR_H #pragma GCC visibility push(default) #define _GLIBCXX_GCC_GTHR_AIX_H #define _GLIBCXX_GCC_GTHR_POSIX_H #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 #define _PTHREAD_H_ extern "C" { #undef _STD_TYPES_T #define _H_SCHED #define _H_SYS_SCHED #define _H_PRI #define _H_PROC extern "C" { #define _H_PTRACE #define _H_THREAD #define _H_MSTSAVE #define _H_M_PARAM #define _NSRS 16 #define _NGPRS 32 #define _NFPRS 32 #define _LOADWCS(__x) (* (volatile tid_t *) (__x)) #define _STORWCS(__x,__y) (*(__y) = (__x)) #define _HZ 100 #define __hz HZ #define _CLKTICK 20408 #define _MAXSEG (64*1024) #define _MAXTSIZ (256*256*4096) #define _DFLDSIZ (128*256*4096) #define _MAXDSIZ (256*256*4096) #define _DFLSSIZ ( 16*256*4096) #define _MAXSSIZ (256*256*4096) #define NSRS _NSRS #define NGPRS _NGPRS #define NFPRS _NFPRS #define LOADWCS _LOADWCS #define STORWCS _STORWCS #define HZ _HZ #define hz __hz #define CLKTICK _CLKTICK #define MAXSEG _MAXSEG #define MAXTSIZ _MAXTSIZ #define DFLDSIZ _DFLDSIZ #define MAXDSIZ _MAXDSIZ #define DFLSSIZ _DFLSSIZ #define MAXSSIZ _MAXSSIZ struct mstsave { struct mstsave *prev; label_t *kjmpbuf; char *stackfix; char intpri; char backt; char rsvd[2]; pid_t curid; int excp_type; ulong_t iar; ulong_t msr; ulong_t cr; ulong_t lr; ulong_t ctr; ulong_t xer; ulong_t mq; ulong_t tid; ulong_t fpscr; char fpeu; char fpinfo; uchar fpscr24_31; char pad[1]; ulong_t except[5]; char pad1[4]; ulong_t o_iar; ulong_t o_toc; ulong_t o_arg1; ulong_t excbranch; ulong_t fpscrx; ulong_t o_vaddr; ulong_t cachealign[7]; adspace_t as; ulong_t gpr[32]; double fpr[32]; }; #define _FP_NEVER_USED 0 #define _FP_USED 1 #define _FP_IMP_INT 0x01 #define _FP_SYNC_TASK 0x08 #define _PPC_OFF 0x0 #define _PPC_IMP 0x1 #define _PPC_IMP_REC 0x8 #define _PPC_PRECISE 0x9 #define _FP_INT_TYPE 0x02 #define _FP_SYNC_IMP_S 8 #define _FRAMESIZE 7168 #define _FRAME_OVBUF_SIZE 1024 #define _FRAME_OVBUF_CHAR 0x11 #define _FRAME_OVBUF_ULL 0x1111111111111111ULL #define _PMAP_STK_SIZE (3072*2) #define _PMAP_OVBUF_SIZE 768 #define _PMAP_OVBUF_CHAR 0x11 #define _PMAP_OVBUF_ULL 0x1111111111111111ULL #define _SLB_SAVE_SIZE (12*3) extern char __pmap_stack[]; #define _NUMBER_OF_FRAMES 11 #define _FRAME_1(__cpu_id) ((_NUMBER_OF_FRAMES*(__cpu_id+1)) - 1) #define FP_NEVER_USED _FP_NEVER_USED #define FP_USED _FP_USED #define FP_IMP_INT _FP_IMP_INT #define FP_SYNC_TASK _FP_SYNC_TASK #define PPC_OFF _PPC_OFF #define PPC_IMP _PPC_IMP #define PPC_IMP_REC _PPC_IMP_REC #define PPC_PRECISE _PPC_PRECISE #define FP_INT_TYPE _FP_INT_TYPE #define FP_SYNC_IMP_S _FP_SYNC_IMP_S #define FRAMESIZE _FRAMESIZE #define FRAME_OVBUF_SIZE _FRAME_OVBUF_SIZE #define FRAME_OVBUF_CHAR _FRAME_OVBUF_CHAR #define FRAME_OVBUF_ULL _FRAME_OVBUF_ULL #define NUMBER_OF_FRAMES _NUMBER_OF_FRAMES #define FRAME_1 _FRAME_1 #define PMAP_STK_SIZE _PMAP_STK_SIZE #define PMAP_OVBUF_SIZE _PMAP_OVBUF_SIZE #define PMAP_OVBUF_CHAR _PMAP_OVBUF_CHAR #define PMAP_OVBUF_ULL _PMAP_OVBUF_ULL #define SLB_SAVE_SIZE _SLB_SAVE_SIZE #define pmap_stack __pmap_stack #define _H_PROCESSOR typedef short cpu_t; typedef short cpuidx_t; typedef short sradid_t; typedef short processor_t; extern int bindprocessor(int What, int Who, cpu_t Where); #define BINDPROCESS 1 #define BINDTHREAD 2 #define PROCESSOR_CLASS_ANY ((cpu_t)(-1)) extern cpu_t mycpu(void); #define _H_LOCK_DEFINE typedef int32long64_t simple_lock_data; typedef int32long64_t complex_lock_status; struct complex_lock_data { complex_lock_status status; short flags; short recursion_depth; }; struct lock_data_instrumented { union { simple_lock_data s_lock; struct complex_lock_data c_lock; struct lock_data_instrumented *lock_next; } lock_control_word; #define SELECTIVE_TRACE 1 #define LOCK_ALLOCATED 2 unsigned int li_flags; union { int name; struct { short _id; short occurrence; } _lock_id; } _lockname; int reserved[4]; }; union _simple_lock{ simple_lock_data _slock; struct lock_data_instrumented *_slockp; }; union _complex_lock{ struct complex_lock_data _clock; struct lock_data_instrumented *_clockp; }; typedef union _simple_lock Simple_lock; typedef union _complex_lock Complex_lock; typedef Simple_lock *simple_lock_t; typedef Complex_lock *complex_lock_t; typedef int32long64_t lock_t; #define SIMPLE_LOCK_AVAIL ((simple_lock_data)0) #define COMPLEX_LOCK_AVAIL SIMPLE_LOCK_AVAIL #define LOCK_AVAIL ((lock_t) -1) #define LOCKL_OWNER_MASK 0x3fffffff #define IS_LOCKED(x) ((*(x) != LOCK_AVAIL) && ((tid_t)(*(x) & LOCKL_OWNER_MASK) == thread_self())) #define LOCK_SHORT (0) #define LOCK_NDELAY (1) #define LOCK_SIGWAKE (2) #define LOCK_SIGRET (4) #define LOCK_SUCC (0) #define LOCK_NEST (1) #define LOCK_FAIL (-1) #define LOCK_SIG (-2) void simple_lock(simple_lock_t); void simple_lock_hot(simple_lock_t); void simple_unlock(simple_lock_t); void simple_unlock_mem(simple_lock_t); void simple_unlock_hot(simple_lock_t); boolean_t simple_lock_try(simple_lock_t); int disable_lock(int,simple_lock_t); void unlock_enable(int,simple_lock_t); void unlock_enable_mem(int,simple_lock_t); void lock_init(complex_lock_t , boolean_t); void lock_write(complex_lock_t); void lock_read(complex_lock_t); void lock_done(complex_lock_t); void lock_done_mem(complex_lock_t); boolean_t lock_read_to_write(complex_lock_t); void lock_write_to_read(complex_lock_t); boolean_t lock_try_write(complex_lock_t); boolean_t lock_try_read(complex_lock_t); boolean_t lock_try_read_to_write(complex_lock_t); void lock_set_recursive(complex_lock_t); void lock_clear_recursive(complex_lock_t); int lock_islocked(complex_lock_t); int lockl(lock_t *,int); void unlockl(lock_t *); boolean_t lockl_mine(lock_t *); void simple_lock_init(simple_lock_t); #define _H_VAR struct var_hdr { __ulong32_t var_vers; __ulong32_t var_gen; __ulong32_t var_size; }; struct var { struct var_hdr var_hdr; int v_bufhw; int v_mbufhw; int v_maxup; int v_iostrun; int v_leastpriv; int v_autost; int v_maxpout; int v_minpout; int v_memscrub; int v_lock; __cptr32 ve_lock; int v_file; __cptr32 ve_file; int v_proc; __cptr32 ve_proc; int v_clist; int v_thread; __cptr32 ve_thread; __cptr32 vb_proc; __cptr32 vb_thread; int v_ncpus; int v_ncpus_cfg; int v_fullcore; char v_initlvl[4]; char v_pre430core; int v_xmgc; int v_cpuguard; int v_ncargs; int v_pre520tune; long long v_hardstack; int v_xmdbg_segs; int v_max_logname; int v_num_xmfrecs; long long v_sed_config; long long v_acl_config; }; struct kernvars { struct var_hdr var_hdr; long long v_bufhw; long long v_mbufhw; long long v_maxup; long long v_maxpout; long long v_minpout; int v_iostrun; int v_leastpriv; int v_autost; int v_memscrub; long long v_lock; __cptr64 ve_lock; long long v_file; __cptr64 ve_file; long long v_proc; __cptr64 ve_proc; long long v_clist; long long v_thread; __cptr64 ve_thread; __cptr64 vb_proc; __cptr64 vb_thread; int v_ncpus; int v_ncpus_cfg; int v_fullcore; char v_initlvl[4]; int v_coreformat; int v_xmgc; int v_cpuguard; int v_ncargs; int v_pre520tune; long long v_hardstack; int v_xmdbg_segs; int v_max_logname; int v_num_xmfrecs; long long v_sed_config; long long v_acl_config; }; #define SYSCONFIG_VARSIZE ((int)&((struct var *)0)->v_lock) #define MIN_XMFRECS 4096 struct vario { union v { struct { long long value; } v_bufhw; struct { long long value; } v_mbufhw; struct { long long value; } v_maxup; struct { long long value; } v_maxpout; struct { long long value; } v_minpout; struct { int fill; int value; } v_iostrun; struct { int fill; int value; } v_leastpriv; struct { int fill; int value; } v_autost; struct { int fill; int value; } v_memscrub; struct { long long value; } v_lock; struct { __cptr64 value; } ve_lock; struct { long long value; } v_file; struct { __cptr64 value; } ve_file; struct { long long value; } v_proc; struct { __cptr64 value; } ve_proc; struct { long long value; } v_clist; struct { long long value; } v_thread; struct { __cptr64 value; } ve_thread; struct { __cptr64 value; } vb_proc; struct { __cptr64 value; } vb_thread; struct { int fill; int value; } v_ncpus; struct { int fill; int value; } v_ncpus_cfg; struct { int fill; int value; } v_fullcore; struct { int fill; char value[4]; } v_initlvl; struct { int fill; char fill2[3]; char value; } v_coreformat; struct { int fill; int value; } v_xmgc; struct { int fill; int value; } v_cpuguard; struct { int fill; int value; } v_ncargs; struct { int fill; int value; } v_pre520tune; struct { int fill; int value; } v_hardstack; struct { int fill; int value; } v_xmdbg_segs; struct { int fill; int value; } v_max_logname; struct { int fill; int value; } v_num_xmfrecs; struct { long long value; } v_sed_config; struct { long long value; } v_acl_config; struct { int fill; int value; } turbo_acct; } v; }; int sys_parm(int cmd,int parmflag,void *uptr); #define SYSP_GET 0 #define SYSP_SET 1 #define SYSP_V_BUFHW 0 #define SYSP_V_MBUFHW 1 #define SYSP_V_MAXUP 2 #define SYSP_V_IOSTRUN 3 #define SYSP_V_LEASTPRIV 4 #define SYSP_V_AUTOST 5 #define SYSP_V_MAXPOUT 6 #define SYSP_V_MINPOUT 7 #define SYSP_V_MEMSCRUB 8 #define SYSP_V_FULLCORE 9 #define SYSP_V_INITLVL 10 #define SYSP_V_PRE430CORE 11 #define SYSP_V_COREFORMAT 11 #define SYSP_V_XMGC 12 #define SYSP_V_CPUGUARD 13 #define SYSP_V_NCARGS 14 #define SYSP_V_PRE520TUNE 15 #define SYSP_V_HARDSTACK 16 #define SYSP_V_XMDBG_SEGS 17 #define SYSP_V_MAX_LOGNAME 18 #define SYSP_V_NUM_XMFRECS 19 #define SYSP_V_SED_CONFIG 20 #define SYSP_V_ACL_CONFIG 21 #define SYSP_V_TURBO_ACCT 22 #define SYSP_MAX_RW SYSP_V_TURBO_ACCT #define SYSP_V_LOCK 1024 #define SYSP_VE_LOCK 1025 #define SYSP_V_FILE 1026 #define SYSP_VE_FILE 1027 #define SYSP_V_PROC 1028 #define SYSP_VE_PROC 1029 #define SYSP_V_CLIST 1030 #define SYSP_V_THREAD 1031 #define SYSP_VE_THREAD 1032 #define SYSP_VB_PROC 1033 #define SYSP_VB_THREAD 1034 #define SYSP_V_NCPUS 1035 #define SYSP_V_NCPUS_CFG 1036 #define VAR_CORE43 0 #define VAR_COREPRE43 1 #define _H_ATOMIC_OP typedef int *atomic_p; typedef ushort *atomic_h; typedef long *atomic_l; int fetch_and_add(atomic_p,int); uint fetch_and_and(atomic_p,uint); uint fetch_and_or(atomic_p,uint); boolean_t compare_and_swap(atomic_p,int *,int); long fetch_and_addlp(atomic_l,long); ulong fetch_and_andlp(atomic_l,ulong); ulong fetch_and_orlp(atomic_l,ulong); boolean_t compare_and_swaplp(atomic_l, long *, long); ushort fetch_and_add_h(atomic_h,int); boolean_t _check_lock(atomic_p, int, int); void _clear_lock(atomic_p, int); void _clear_lock_mem(atomic_p, int); int _safe_fetch(atomic_p); #pragma mc_func _clear_lock { "48003403" } #pragma mc_func _clear_lock_mem { "48003413" } #pragma mc_func _check_lock { "48003423" } #pragma mc_func _safe_fetch { "80630000" "5463003F" "41820004" } #pragma reg_killed_by _safe_fetch cr0,gr3 #define _H_CONTEXT extern "C" { #define _EXCONTINUE 0 #define _EXRETURN 1 #define _EXRESUME 2 #define _EXPGIO 0 #define _EXTRAP 1 #define _EXIO 2 #define _EXDLOK 3 #define _EXSIG 4 typedef struct { void *ss_sp; size_t ss_size; int ss_flags; int __pad[4]; } stack_t; typedef struct { unsigned long long ss_sp; unsigned long long ss_size; int ss_flags; int __pad[4]; } stack64_t; #define EXCONTINUE _EXCONTINUE #define EXRETURN _EXRETURN #define EXRESUME _EXRESUME #define EXPGIO _EXPGIO #define EXTRAP _EXTRAP #define EXIO _EXIO #define EXDLOK _EXDLOK #define EXSIG _EXSIG #define jmpbuf __jmpbuf #define context64 __context64 struct __context64 { unsigned long long gpr[32]; unsigned long long msr; unsigned long long iar; unsigned long long lr; unsigned long long ctr; unsigned int cr; unsigned int xer; unsigned int fpscr; unsigned int fpscrx; unsigned long long except[1]; double fpr[32]; char fpeu; char fpinfo; char fpscr24_31; char pad[1]; int excp_type; }; struct sigcontext64 { int sc_onstack; sigset64_t sc_mask; int sc_uerror; struct __context64 sc_context; }; #define OFF_FPSCR ((uint) &((struct sigcontext64 *)0)->sc_context.fpscr) #define OFF_FPSCRX ((uint) &((struct sigcontext64 *)0)->sc_context.fpscrx) #define OFF_FPR ((uint) &((struct sigcontext64 *)0)->sc_context.fpr[0]) #define OFF_FPINFO ((uint) &((struct sigcontext64 *)0)->sc_context.fpinfo) #define OFF_CONT64 ((uint) &((struct sigcontext64 *)0)->sc_context) #define OFF_CONT ((uint) &((struct sigcontext *)0)->sc_jmpbuf) typedef struct { unsigned int __v[4]; } __vmxreg_t; typedef struct __vmx_context { __vmxreg_t __vr[32]; unsigned int __pad1[3]; unsigned int __vscr; unsigned int __vrsave; unsigned int __pad2[3]; } __vmx_context_t; #define __EXTCTX 0x2000000 #define __EXTCTX_MAGIC 0x45435458 #define __EXTCTX_VMX 0x00000001 #define __EXTCTX_UKEYS 0x00000002 #define __EXTCTX_RSV (4096 - sizeof(__vmx_context_t) - (7 * sizeof(int))) typedef struct __extctx { unsigned int __flags; unsigned int __rsvd1[3]; union { __vmx_context_t __vmx; } __u1; unsigned int __ukeys[2]; char __reserved[(4096 - sizeof(__vmx_context_t) - (7 * sizeof(int)))]; int __extctx_magic; } __extctx_t; #define __vmx __u1.__vmx struct __jmpbuf { struct mstsave jmp_context; }; struct __sigcontext { int sc_onstack; sigset_t sc_mask; int sc_uerror; struct __jmpbuf sc_jmpbuf; }; typedef struct __jmpbuf mcontext_t; typedef struct ucontext_t { int __sc_onstack; sigset_t uc_sigmask; int __sc_uerror; mcontext_t uc_mcontext; struct ucontext_t *uc_link; stack_t uc_stack; __extctx_t *__extctx; int __extctx_magic; int __pad[2]; } ucontext_t; } #define _H_SYS_TIME extern "C" { #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 #define ITIMER_VIRT 3 #define ITIMER_REAL1 20 struct timeval { time_t tv_sec; suseconds_t tv_usec; }; struct timeval32 { int32_t tv_sec; int32_t tv_usec; }; #define CP_TIMEVAL(__tsrc,__tdest) (__tdest).tv_sec = (__tsrc).tv_sec; (__tdest).tv_usec = (__tsrc).tv_usec struct timeval64 { int64_t tv_sec; int32_t tv_usec; }; struct timezone { int tz_minuteswest; int tz_dsttime; }; #define DST_NONE 0 #define DST_USA 1 #define DST_AUST 2 #define DST_WET 3 #define DST_MET 4 #define DST_EET 5 #define DST_CAN 6 struct itimerval { struct timeval it_interval; struct timeval it_value; }; extern int getitimer(int, struct itimerval *); extern int setitimer(int, const struct itimerval *, struct itimerval *); extern int gettimeofday(struct timeval *, void *); extern int settimeofday(struct timeval *, struct timezone *); extern int utimes(const char *, const struct timeval *); #define FD_SETSIZE 65534 #define __NFDBITS (sizeof(long) * 8) #define __NUM_ENTRIES (FD_SETSIZE/__NFDBITS+1) typedef struct fd_set { long fds_bits[(65534/(sizeof(long) * 8)+1)]; } fd_set; extern int pselect(int, void *, void *, void *, const struct timespec *, const sigset_t *); extern int __fd_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); static int select(int __fds, fd_set * __readlist, fd_set * __writelist, fd_set * __exceptlist, struct timeval * __timeout) { return __fd_select(__fds, __readlist, __writelist, __exceptlist, __timeout); } extern void *memset(void *, int, size_t); #define FD_SET(n,p) ((p)->fds_bits[(n)/__NFDBITS] |= ((long)1 << ((n) % __NFDBITS))) #define FD_CLR(n,p) ((p)->fds_bits[(n)/__NFDBITS] &= ~((long)1 << ((n) % __NFDBITS))) #define FD_ISSET(n,p) (((p)->fds_bits[(n)/__NFDBITS] & ((long)1 << ((n) % __NFDBITS)))?1:0) #define FD_ZERO(p) memset((p), 0, sizeof(*(p))) #define TIMEOFDAY 9 #define TIMERID_ALRM (ITIMER_REAL) #define TIMERID_REAL (ITIMER_REAL) #define TIMERID_VIRTUAL (ITIMER_VIRTUAL) #define TIMERID_PROF (ITIMER_PROF) #define TIMERID_VIRT (ITIMER_VIRT) #define TIMERID_TOD (TIMERID_VIRT+1) #define TIMERID_REAL1 (ITIMER_REAL1) #define NALRM 1 #define NPROF 1 #define NVIRTUAL 2 #define NTIMEOFDAY 5 #define NTIMERS (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY) #define NALRM_THREAD 1 #define NTIMERS_THREAD (NALRM_THREAD) #define MIN_SECS_SINCE_EPOCH 0 #define NS_PER_TICK (NS_PER_SEC/HZ) #define uS_PER_SECOND (1000000) #define NS_PER_uS (1000) #define MAX_SECS_TO_uS 4000 #define MAX_NS_TO_uS 294967296 #define NS_PER_SEC 1000000000 #define uS_PER_SEC (NS_PER_SEC / 1000) #define NS_PER_MSEC (NS_PER_SEC / 1000) #define MS_PER_SEC 1000 #define MAX_DEC_SECS 2 #define MAX_DEC_NS 147483647 struct timestruc_t { time_t tv_sec; suseconds_t tv_nsec; }; struct timestruc32_t { int32_t tv_sec; int32_t tv_nsec; }; struct timestruc64_t { int64_t tv_sec; int32_t tv_nsec; }; #define CP_TIMESTRUCT(__tsrc,__tdest) (__tdest).tv_sec = (__tsrc).tv_sec; (__tdest).tv_nsec = (__tsrc).tv_nsec struct itimerstruc_t { struct timestruc_t it_interval; struct timestruc_t it_value; }; struct itimerstruc32_t { struct timestruc32_t it_interval; struct timestruc32_t it_value; }; struct itimerstruc64_t { struct timestruc64_t it_interval; struct timestruc64_t it_value; }; #define CP_ITIMERSTRUCT(__tsrc,__tdest) (__tdest).it_interval.tv_sec = (__tsrc).it_interval.tv_sec; (__tdest).it_interval.tv_nsec = (__tsrc).it_interval.tv_nsec; (__tdest).it_value.tv_sec = (__tsrc).it_value.tv_sec; (__tdest).it_value.tv_nsec = (__tsrc).it_value.tv_nsec typedef struct timebasestruct { int flag; unsigned int tb_high; unsigned int tb_low; } timebasestruct_t; int read_real_time(timebasestruct_t *, size_t); int read_wall_time(timebasestruct_t *, size_t); int time_base_to_time(timebasestruct_t *, size_t); #define TIMEBASE_SZ (sizeof (struct timebasestruct)) #define ntimerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) #define ntimerclear(tvp) (tvp)->tv_sec = (tvp)->tv_nsec = 0 #define ntimercmp(tvp,fvp,cmp) ((tvp).tv_sec cmp (fvp).tv_sec || (tvp).tv_sec == (fvp).tv_sec && (tvp).tv_nsec cmp (fvp).tv_nsec) #define ntimeradd(tvp,svp,rvp) { (rvp).tv_sec = (tvp).tv_sec + (svp).tv_sec; (rvp).tv_nsec = (tvp).tv_nsec + (svp).tv_nsec; if((rvp).tv_nsec > (NS_PER_SEC - 1)) { (rvp).tv_nsec -= NS_PER_SEC; (rvp).tv_sec++; } assert((rvp).tv_nsec <= NS_PER_SEC); } #define ntimersub(tvp,svp,rvp) { assert((tvp).tv_nsec <= NS_PER_SEC); assert((svp).tv_nsec <= NS_PER_SEC); assert(!((tvp).tv_sec == 0 && ((svp).tv_nsec > (tvp).tv_nsec))); if((tvp).tv_sec == (svp).tv_sec) { assert((tvp).tv_nsec >= (svp).tv_nsec); } else { assert((tvp).tv_sec > (svp).tv_sec); } if((svp).tv_nsec > (tvp).tv_nsec) { assert((tvp).tv_sec > (svp).tv_sec); (rvp).tv_sec = ((tvp).tv_sec - 1) - (svp).tv_sec; (rvp).tv_nsec = ((int)(((uint)((tvp).tv_nsec) + NS_PER_SEC) - (uint)((svp).tv_nsec))); } else { (rvp).tv_sec = (tvp).tv_sec - (svp).tv_sec; (rvp).tv_nsec = (tvp).tv_nsec - (svp).tv_nsec; } assert((tvp).tv_nsec <= NS_PER_SEC); assert((svp).tv_nsec <= NS_PER_SEC); assert((rvp).tv_nsec <= NS_PER_SEC); } #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 #define timercmp(tvp,fvp,cmp) ((tvp)->tv_sec cmp (fvp)->tv_sec || (tvp)->tv_sec == (fvp)->tv_sec && (tvp)->tv_usec cmp (fvp)->tv_usec) #define ADD_TO_NS(tvp,delta) { (tvp).tv_nsec += delta; if((tvp).tv_nsec >= NS_PER_SEC) { (tvp).tv_sec++; (tvp).tv_nsec -= NS_PER_SEC; } } #define ADD_NS_TO_TIMEVAL(tvp,delta) { (tvp).tv_usec += delta; if((tvp).tv_usec >= NS_PER_SEC) { (tvp).tv_sec++; (tvp).tv_usec -= NS_PER_SEC; } } } #define _H_TIMER #define T_TIMEOUT 0xABABABAB #define T_PENDING 0x01 #define T_ACTIVE 0x02 #define T_ABSOLUTE 0x04 #define T_INCINTERVAL 0x10 #define T_COMPLETE 0x20 #define T_MPSAFE 0x40 #define T_LOWRES 0x80 struct trb { struct trb *to_next; struct trb *knext; struct trb *kprev; ulong id; volatile cpu_t cpunum; unsigned short flags; ulong timerid; tid_t eventlist; struct itimerstruc_t timeout; void (*func)(); union parmunion { ulong data; int sdata; caddr_t addr; } t_union; int ipri; void (*tof)(); }; #define func_data t_union.data #define t_func_data t_union.data #define t_func_sdata t_union.sdata #define t_func_addr t_union.addr #define TIMERID_ISBSD(timerid) (((timerid) == ITIMER_VIRTUAL) || ((timerid) == ITIMER_VIRT) || ((timerid) == ITIMER_PROF)) struct cputime_tmr { struct posix_tmr *next; struct posix_tmr *prev; int id; timer_t timerid; unsigned short flags; unsigned int value; unsigned int interval; void (*func)(); caddr_t data; }; struct posix_tmr { clockid_t tmr_clockid; short tmr_active_overrun; short tmr_prev_overrun; int tmr_notify; union { tid_t tid; void *sip; } tmr_notifunion; union { struct trb *trb; struct cputime_tmr cpu_tmr; } tmr_union; }; #define tmr_tid tmr_notifunion.tid #define tmr_sip tmr_notifunion.sip #define tmr_trb tmr_union.trb #define tmr_cpu_tmr tmr_union.cpu_tmr struct cputime_clock { uint_t rt_ticks; struct posix_tmr *active_tmrs; }; #define CPUTIME_GET 0 #define CPUTIME_SET 1 #define CPUTIME_RES 2 #define CLOCKID_TYPE(_clockid) ((long long)(_clockid) & 0xFFFFFFFFLL) #define CLOCKID_INSTANCE(_clockid) ((long long)(_clockid) >> 32LL) #define _H_CRED extern "C" { #define _H_PRIV #define _H_MODE #define _S_IFMT 0170000 #define _S_IFREG 0100000 #define _S_IFDIR 0040000 #define _S_IFBLK 0060000 #define _S_IFCHR 0020000 #define _S_IFIFO 0010000 #define S_ISUID 0004000 #define S_ISGID 0002000 #define S_IRWXU 0000700 #define S_IRUSR 0000400 #define S_IWUSR 0000200 #define S_IXUSR 0000100 #define S_IRWXG 0000070 #define S_IRGRP 0000040 #define S_IWGRP 0000020 #define S_IXGRP 0000010 #define S_IRWXO 0000007 #define S_IROTH 0000004 #define S_IWOTH 0000002 #define S_IXOTH 0000001 #define S_ISFIFO(m) (((m)&(_S_IFMT)) == (_S_IFIFO)) #define S_ISDIR(m) (((m)&(_S_IFMT)) == (_S_IFDIR)) #define S_ISCHR(m) (((m)&(_S_IFMT)) == (_S_IFCHR)) #define S_ISBLK(m) (((m)&(_S_IFMT)) == (_S_IFBLK)) #define S_ISREG(m) (((m)&(_S_IFMT)) == (_S_IFREG)) #define S_ISVTX 0001000 #define S_IFMT _S_IFMT #define S_IFREG _S_IFREG #define S_IFDIR _S_IFDIR #define S_IFBLK _S_IFBLK #define S_IFCHR _S_IFCHR #define S_IFIFO _S_IFIFO #define S_IFLNK 0120000 #define S_IFSOCK 0140000 #define S_ISLNK(m) (((m)&(S_IFMT)) == (S_IFLNK)) #define S_ISSOCK(m) (((m)&(S_IFMT)) == (S_IFSOCK)) #define S_IREAD 0000400 #define S_IWRITE 0000200 #define S_IEXEC 0000100 #define S_ENFMT S_ISGID #define S_IFMPX (S_IFCHR|S_ISVTX) #define S_ISMPX(m) (((m)&(S_IFMT|S_ISVTX)) == (S_IFMPX)) #define IFMT S_IFMT #define IFDIR S_IFDIR #define IFCHR S_IFCHR #define IFBLK S_IFBLK #define IFREG S_IFREG #define IFIFO S_IFIFO #define IFSOCK S_IFSOCK #define IFLNK S_IFLNK #define ISUID S_ISUID #define ISGID S_ISGID #define ISVTX S_ISVTX #define IREAD S_IREAD #define IWRITE S_IWRITE #define IEXEC S_IEXEC #define S_INMOD 0xC0000000 #define S_IXMOD 0x40000000 #define S_IXATTR 0x00040000 #define S_IJRNL 0x04000000 #define S_IXACL 0x02000000 #define S_ITCB 0x01000000 #define S_ITP 0x00800000 #define IXMOD S_IXMOD #define IXATTR S_IXATTR #define IXACL S_IXACL #define _H_TCB #define TCB_ON 0x1 #define TP_ON 0x3 #define TCB_OFF 0x0 #define TCB_QUERY 0x4 struct priv { unsigned int pv_priv[2]; }; typedef struct priv priv_t; #define _H_PCL struct pce_id { unsigned short id_len; unsigned short id_type; #define PCEID_USER 1 #define PCEID_GROUP 2 int id_data[1]; }; #define pcl_id_last(a) ((struct pce_id *)(((char *)(a)) + (a)->pce_len)) #define pcl_id_nxt(id) ((struct pce_id *) (((char*)(id))+(((struct pce_id *)(id))->id_len))) struct pcl_entry { unsigned int pce_len; priv_t pce_privs; struct pce_id pce_id[1]; }; #define pcl_nxt(a) ((struct pcl_entry *)(((char *)(a))+(((struct pcl_entry *)(a))->pce_len))) #define pcl_last(a) ((struct pcl_entry *)(((char *)(a)) + (a)->pcl_len)) struct pcl { unsigned int pcl_len; unsigned int pcl_mode; priv_t pcl_default; struct pcl_entry pcl_ext[1]; }; #define PCL_SIZ ((int) &(((struct pcl *) 0)->pcl_ext[0])) #define PRIV_COMMANDS 0xFFFF0000 #define PRIV_ADD 0x00010000 #define PRIV_SUB 0x00020000 #define PRIV_SET 0x00030000 #define PRIV_EFFECTIVE 0x00000001 #define PRIV_INHERITED 0x00000002 #define PRIV_BEQUEATH 0x00000004 #define PRIV_MAXIMUM 0x00000008 #define PRIV_LAPSE 0x30001 #define PRIV_ACQUIRE 0x30002 #define PRIV_DROP 0x30003 #define SET_OBJ_DAC 10 #define SET_OBJ_RAC 11 #define SET_OBJ_MAC 12 #define SET_OBJ_INFO 13 #define SET_OBJ_STAT 14 #define SET_OBJ_PRIV 15 #define SET_PROC_DAC 20 #define SET_PROC_RAC 21 #define SET_PROC_MAC 22 #define SET_PROC_INFO 23 #define SET_PROC_ENV 24 #define SET_PROC_ACCT 25 #define SET_PROC_AUDIT 26 #define AUDIT_CONFIG 40 #define ACCT_CONFIG 41 #define DEV_CONFIG 42 #define FS_CONFIG 43 #define GSS_CONFIG 44 #define LVM_CONFIG 45 #define NET_CONFIG 46 #define RAS_CONFIG 47 #define RAC_CONFIG 48 #define SYS_CONFIG 49 #define SYS_OPER 50 #define TPATH_CONFIG 51 #define VMM_CONFIG 52 #define BYPASS_DAC_WRITE 1 #define BYPASS_DAC_READ 2 #define BYPASS_DAC_EXEC 3 #define BYPASS_DAC_KILL 4 #define BYPASS_RAC 5 #define BYPASS_MAC_WRITE 6 #define BYPASS_MAC_READ 7 #define BYPASS_TPATH 8 #define BYPASS_DAC 9 #define TRUSTED_PATH 910 extern int chpriv(char *, struct pcl *, int); extern int fchpriv(int, struct pcl *, int); extern int statpriv(char *, int, struct pcl *, int); extern int fstatpriv(int, int, struct pcl *, int); extern int privcheck(int); extern int getpriv(int, priv_t *, int); extern int setpriv(int, priv_t *, int); #define _H_LOCKL extern lock_t kernel_lock; #define _H_SYS_CAP #define CAP_EFFECTIVE 1 #define CAP_INHERITABLE 2 #define CAP_PERMITTED 3 typedef unsigned int cap_flag_t; struct __cap_t { uint64_t cap_effective; uint64_t cap_inheritable; uint64_t cap_permitted; }; typedef void * cap_t; cap_t cap_init(); #define CAP_CLEAR 0 #define CAP_SET 1 typedef unsigned int cap_flag_value_t; typedef int cap_value_t; #define CAP_PROPAGATE 1 #define CAP_PROPOGATE 1 #define CAP_NUMA_ATTACH 2 #define CAP_BYPASS_RAC_VMM 3 #define CAP_EWLM_AGENT 4 #define CAP_ARM_APPLICATION 5 #define CAP_AACCT 6 #define CAP_CREDENTIALS 7 #define CAP_MAXIMUM CAP_CREDENTIALS #define SHORT_NGROUPS NGROUPS_MAX #define PAG_GROUPS 8 #define __NGROUPS_GROUPSET_MAX 32 #define GROUPS_PER_SET ((__NGROUPS_GROUPSET_MAX * sizeof (gid_t) - sizeof (void *)) / sizeof (gid_t)) typedef struct groupset { union { struct { gid_t un_groups[((32 * sizeof (gid_t) - sizeof (void *)) / sizeof (gid_t))]; struct groupset *un_next; } un_struct; gid_t un_groups[32]; } gs_union; } groupset_t; #define PAG_GROUPSET_PADDING_WITH_GROUPS(ngrps) ((((ngrps) % GROUPS_PER_SET) == 0) ? 0 : GROUPS_PER_SET - ((ngrps) % GROUPS_PER_SET)) #define PAG_GROUPSET_PADDING(ngrps) (((ngrps) == 0) ? GROUPS_PER_SET : PAG_GROUPSET_PADDING_WITH_GROUPS((ngrps))) #define PAG_GROUPS_EFFECTIVE(ngrps) (PAG_GROUPSET_PADDING(ngrps) + ((PAG_GROUPS) * 2)) #define MAX_PAG_ENTRIES 16 struct ucred { int cr_ref; uid_t cr_ruid; uid_t cr_uid; uid_t cr_suid; uid_t cr_luid; uid_t cr_acctid; gid_t cr_gid; gid_t cr_rgid; gid_t cr_sgid; short cr_ngrps; short cr_caps; groupset_t cr_groupset; priv_t cr_mpriv; priv_t cr_ipriv; priv_t cr_epriv; priv_t cr_bpriv; int cr_pag; }; typedef struct ucred cred_t; struct ucred_43 { int ocr_ref; uid_t ocr_ruid; uid_t ocr_uid; uid_t ocr_suid; uid_t ocr_luid; uid_t ocr_acctid; gid_t ocr_gid; gid_t ocr_rgid; gid_t ocr_sgid; short ocr_ngrps; gid_t ocr_groups[32]; priv_t ocr_mpriv; priv_t ocr_ipriv; priv_t ocr_epriv; priv_t ocr_bpriv; int ocr_pag; }; typedef struct ucred_43 cred_43_t; #define CRX_PAGID_64BIT 0x80 #define CRX_PAGID_MASK 0x7f #define CRX_MAX_GROUPS 128 typedef struct ucred_ext { uid_t crx_ruid; uid_t crx_uid; uid_t crx_suid; uid_t crx_luid; uid_t crx_acctid; gid_t crx_gid; gid_t crx_rgid; gid_t crx_sgid; int crx_ngrps; gid_t crx_groups[128]; int crx_reserved_1; struct __cap_t crx_caps; priv_t crx_mpriv; priv_t crx_ipriv; priv_t crx_epriv; priv_t crx_bpriv; int crx_npags; char crx_pagids[16]; int crx_pags[16]; int crx_pad[256-173]; } cred_ext_t; void crlock(void); void crunlock(void); void credlock(void); void credunlock(void); void crfree(struct ucred *); struct ucred *crref(void); struct ucred *crxref(struct ucred * volatile *); struct ucred *crget(void); struct ucred *crcopy(struct ucred *); struct ucred *crdup(struct ucred *); void crset(struct ucred *); void crhold(struct ucred *); void crexport(struct ucred *, struct ucred_ext *); struct ucred *crimport(int, void *); #define CRED_GETREF(cr) ((cr)->cr_ref) #define CRED_GETRUID(cr) ((cr)->cr_ruid) #define CRED_GETEUID(cr) ((cr)->cr_uid) #define CRED_GETSUID(cr) ((cr)->cr_suid) #define CRED_GETLUID(cr) ((cr)->cr_luid) #define CRED_GETACCTID(cr) ((cr)->cr_acctid) #define CRED_GETEGID(cr) ((cr)->cr_gid) #define CRED_GETRGID(cr) ((cr)->cr_rgid) #define CRED_GETSGID(cr) ((cr)->cr_sgid) #define CRED_GETNGRPS(cr) ((cr)->cr_ngrps) int kcred_getgroups (struct ucred *, int, gid_t *); int kcred_setgroups (struct ucred *, int, gid_t *); int kcred_getpriv (struct ucred *, int, priv_t *); int kcred_setpriv (struct ucred *, int, priv_t *); void kcred_getcap (struct ucred *, struct __cap_t *); void kcred_setcap (struct ucred *, struct __cap_t *); int kcred_getpag (struct ucred *, int, int *); int kcred_getpag64 (struct ucred *, int, uint64_t *); int kcred_setpag (struct ucred *, int, int); int kcred_setpag64 (struct ucred *, int, uint64_t); int kcred_genpagvalue (struct ucred *, int, uint64_t *, int); int groupmember (gid_t); int groupmember_cr (gid_t, struct ucred *); #define PAG_DFS 0 #define PAG_AFS 1 int get_pag(int which, int *pag); int get_pag64(int which, uint64_t *pag); int set_pag(int which, int pag); int set_pag64(int which, uint64_t pag); struct pag_list { int pag; int active; int spare[2]; }; int validate_pag(int which, struct pag_list pag[], int npag); struct pag_list64 { uint64_t pag; int active; int spare[2]; }; int validate_pag64(int which, struct pag_list64 pag[], int npag); #define U_ROOT_UID 0 #define G_SYSTEM_GRP 0 #define G_SECURITY_GRP 7 } #define _H_RESOURCE extern "C" { #define PRIO_PROCESS 0 #define PRIO_PGRP 1 #define PRIO_USER 2 #define PRIO_MIN -20 #define PRIO_MAX 20 #define RLIM_NLIMITS 8 #define RLIM_INFINITY 0x7FFFFFFF #define RLIM_SAVED_MAX (RLIM_INFINITY-1) #define RLIM_SAVED_CUR (RLIM_INFINITY-2) typedef unsigned long rlim_t; struct rlimit { rlim_t rlim_cur; rlim_t rlim_max; }; #define RLIM64_INFINITY (0x7fffffffffffffffLL) typedef unsigned long long rlim64_t; struct rlimit64 { rlim64_t rlim_cur; rlim64_t rlim_max; }; #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN -1 #define RUSAGE_THREAD 1 #define RUSAGE_TIMES 2 #define ru_first ru_ixrss #define ru_last ru_nivcsw struct rusage { struct timeval ru_utime; struct timeval ru_stime; long ru_maxrss; long ru_ixrss; long ru_idrss; long ru_isrss; long ru_minflt; long ru_majflt; long ru_nswap; long ru_inblock; long ru_oublock; long ru_msgsnd; long ru_msgrcv; long ru_nsignals; long ru_nvcsw; long ru_nivcsw; }; struct rusage64 { struct timeval ru_utime; struct timeval ru_stime; long long ru_maxrss; long long ru_ixrss; long long ru_idrss; long long ru_isrss; long long ru_minflt; long long ru_majflt; long long ru_nswap; long long ru_inblock; long long ru_oublock; long long ru_msgsnd; long long ru_msgrcv; long long ru_nsignals; long long ru_nvcsw; long long ru_nivcsw; }; struct trusage64 { struct timeval64 ru_utime; struct timeval64 ru_stime; longlong_t ru_maxrss; longlong_t ru_ixrss; longlong_t ru_idrss; longlong_t ru_isrss; longlong_t ru_minflt; longlong_t ru_majflt; longlong_t ru_nswap; longlong_t ru_inblock; longlong_t ru_oublock; longlong_t ru_msgsnd; longlong_t ru_msgrcv; longlong_t ru_nsignals; longlong_t ru_nvcsw; longlong_t ru_nivcsw; }; struct trusage32 { struct timeval32 ru_utime; struct timeval32 ru_stime; signed int ru_maxrss; signed int ru_ixrss; signed int ru_idrss; signed int ru_isrss; signed int ru_minflt; signed int ru_majflt; signed int ru_nswap; signed int ru_inblock; signed int ru_oublock; signed int ru_msgsnd; signed int ru_msgrcv; signed int ru_nsignals; signed int ru_nvcsw; signed int ru_nivcsw; }; #define CP_RUSAGE(__tsrc,__tdest) (__tdest)->ru_utime.tv_sec = (__tsrc)->ru_utime.tv_sec; (__tdest)->ru_utime.tv_usec = (__tsrc)->ru_utime.tv_usec; (__tdest)->ru_stime.tv_sec = (__tsrc)->ru_stime.tv_sec; (__tdest)->ru_stime.tv_usec = (__tsrc)->ru_stime.tv_usec; (__tdest)->ru_maxrss = (__tsrc)->ru_maxrss; (__tdest)->ru_ixrss = (__tsrc)->ru_ixrss; (__tdest)->ru_idrss = (__tsrc)->ru_idrss; (__tdest)->ru_isrss = (__tsrc)->ru_isrss; (__tdest)->ru_minflt = (__tsrc)->ru_minflt; (__tdest)->ru_majflt = (__tsrc)->ru_majflt; (__tdest)->ru_nswap = (__tsrc)->ru_nswap; (__tdest)->ru_inblock = (__tsrc)->ru_inblock; (__tdest)->ru_oublock = (__tsrc)->ru_oublock; (__tdest)->ru_msgsnd = (__tsrc)->ru_msgsnd; (__tdest)->ru_msgrcv = (__tsrc)->ru_msgrcv; (__tdest)->ru_nsignals = (__tsrc)->ru_nsignals; (__tdest)->ru_nvcsw = (__tsrc)->ru_nvcsw; (__tdest)->ru_nivcsw = (__tsrc)->ru_nivcsw; #define RUSAGE_ADD(_dest,_src1,_src2) (_dest)->ru_minflt = (_src1)->ru_minflt + (_src2)->ru_minflt; (_dest)->ru_majflt = (_src1)->ru_majflt + (_src2)->ru_majflt; (_dest)->ru_nswap = (_src1)->ru_nswap + (_src2)->ru_nswap; (_dest)->ru_nsignals = (_src1)->ru_nsignals + (_src2)->ru_nsignals; (_dest)->ru_nvcsw = (_src1)->ru_nvcsw + (_src2)->ru_nvcsw; (_dest)->ru_nivcsw = (_src1)->ru_nivcsw + (_src2)->ru_nivcsw; #define RUSAGE_SUB(_dest,_src1,_src2) (_dest)->ru_minflt = (_src1)->ru_minflt - (_src2)->ru_minflt; (_dest)->ru_majflt = (_src1)->ru_majflt - (_src2)->ru_majflt; (_dest)->ru_nswap = (_src1)->ru_nswap - (_src2)->ru_nswap; (_dest)->ru_nsignals = (_src1)->ru_nsignals - (_src2)->ru_nsignals; (_dest)->ru_nvcsw = (_src1)->ru_nvcsw - (_src2)->ru_nvcsw; (_dest)->ru_nivcsw = (_src1)->ru_nivcsw - (_src2)->ru_nivcsw; #define RLIMIT_CPU 0 #define RLIMIT_FSIZE 1 #define RLIMIT_DATA 2 #define RLIMIT_STACK 3 #define RLIMIT_CORE 4 #define RLIMIT_RSS 5 #define RLIMIT_AS 6 #define RLIMIT_NOFILE 7 extern int getpriority(int, id_t); extern int setpriority(int, id_t, int); extern int getrlimit(int, struct rlimit *); extern int setrlimit(int, const struct rlimit *); extern int getrlimit64(int, struct rlimit64 *); extern int setrlimit64(int, const struct rlimit64 *); extern int getrusage(int, struct rusage *); extern int getrusage64(int, struct rusage64 *); } extern "C" { typedef unsigned long thread_eye_catch_t; #define MAXTHREADS 512 #define MRQ_WORDS_IN_MASK 2 #define MRQ_INTS_IN_MASK (MRQ_WORDS_IN_MASK * 2) typedef union { unsigned long long mrq_mask_word[2]; unsigned int mrq_mask_int[(2 * 2)]; } mrq_mask_t; struct thread { tid_t t_tid; tid_t t_vtid; vmhandle_t t_kthreadseg; ulong t_atomic; uint t_flags; uint t_flags2; ushort t_lockcount; short t_suspend; struct pvthread *t_pvthreadp; struct proc *t_procp; struct t_uaddress { struct uthread *uthreadp; struct user *userp; } t_uaddress; uint t_ulock64; uint t_ulock; uint t_uchan64; uint t_uchan; uint t_userdata64; int t_userdata; uint t_cv64; int t_cv; uint t_stackp64; char *t_stackp; uint t_scp64; struct sigcontext *t_scp; char *t_wchan2; char *t_wchan1; struct thread *t_eventlist; ulong t_pevent; ulong t_wevent; vmhandle_t t_usid; char *t_swchan; struct thread *t_slist; struct thread *t_lockowner; vmhandle_t t_wchan1sid; uint t_wchan1offset; int t_fsflags; int t_result; int t_polevel; __ptr64 t_threadcontrolp; struct thread *t_prior; struct thread *t_next; void *t_graphics; struct run_queue *t_run_queue; u_longlong_t t_time_start; u_longlong_t t_spurr_time_start; time_t t_affinity_ts; ulong t_dispct; ulong t_fpuct; mrq_mask_t t_allowed_cpus; ushort t_adsp_flags; ushort t_ticks; char t_pri_band; char t_savsigno; cpu_t t_prefunnel_cpu; cpu_t t_cpuid; cpu_t t_scpuid; ushort t_cpu2; ushort t_cpu; char t_norun_secs; char t_policy; #define T_CPU_MAX 20+HZ char t_lockpri; char t_wakepri; uchar t_time; char t_sav_pri; char t_ceiling; char t_nice; char t_sigproc; char t_cursig; char t_whystop; sigset64_t t_sig; sigset64_t t_sigmask; int t_chkblock; ushort t_whatstop; ushort t_chkerror; pid_t t_wlm_charge; ulong t_minflt; ulong t_majflt; uint t_wlmevtcnt; uint t_trcgenct; uint t_cpu_tb; cpu_t t_ldispcpu; uint t_rt_ticks; unsigned long long t_interval_start; unsigned long long t_cputime; unsigned long long t_scputime; unsigned long long pth_utime; unsigned long long pth_stime; cred_t *t_credp; cpu_t t_homecpu; short t_homenode; void *t_rs_attinfo; void *t_nft_dabr; void *t_nft_descr; void *t_ulock_listp; unsigned long t_ipc_data; uint t_procfslr64; uint t_procfslr; thread_eye_catch_t t_eyec; }; struct pvthread { tid_t tv_tid; tid_t tv_vtid; struct thread *tv_threadp; struct pvproc *tv_pvprocp; struct { struct pvthread *prevthread; struct pvthread *nextthread; } tv_threadlist; Simple_lock tv_lock_d; tid_t tv_synch; tid_t tv_tsleep; char *tv_wchan; uint tv_flags; uint tv_flags2; u_longlong_t tv_totalcputime; u_longlong_t tv_totalscputime; int tv_boosted; cpu_t tv_affinity; char tv_state; char tv_wtype; void *tv_pmcontext; char tv_pri; struct vnode *tv_procfsvn; void *tv_chkfile; unsigned long long tv_prbase; unsigned long long *tv_prpinned; ushort tv_prflags; ushort tv_prbufcount; uint tv_ptid; int tv_wlm; class_id_t tv_class; void *tv_rset; char *tv_ptag; thread_eye_catch_t tv_eyec; #define TV_PAD 0 #define TV_LOGSIZE 7 }; #define tv_link tv_prevthread #define t_uthreadp t_uaddress.uthreadp #define t_userp t_uaddress.userp #define tv_prevthread tv_threadlist.prevthread #define tv_nextthread tv_threadlist.nextthread #define TKTHREAD 0x00001000 #define TCHKCALLER 0x00000400 #define TTERM 0x00000001 #define TSUSP 0x00000002 #define TSIGAVAIL 0x00000004 #define TINTR 0x00000008 #define TLOCAL 0x00000010 #define TTRCSIG 0x00000040 #define TPROCFS 0x00000080 #define TOMASK 0x00000100 #define TWAKEONSIG 0x00000400 #define SWAKEONSIG 0x00000800 #define TFUNNELLED 0x00002000 #define TSETSTATE 0x00004000 #define TGETREGS 0x00008000 #define TWAKEONCHKPT 0x00010000 #define TSIGWAIT 0x00020000 #define TCRED 0x00040000 #define TCANCEL 0x00200000 #define TCDEFER 0x00400000 #define TCDISABLE 0x00800000 #define TSYNCH 0x01000000 #define TUSCHED 0x02000000 #define TLMTSIGS 0x04000000 #define TEVTPROC 0x08000000 #define TPTHSUSP 0x10000000 #define TPTHSTOPPED 0x20000000 #define TPTHCONT 0x40000000 #define TSIGSLIH (TTERM|TSUSP|TSIGAVAIL) #define TSIGINTR (TSIGSLIH|TINTR) #define TSLWTED 0x00000020UL #define TSIGDELIVERY 0x00000080UL #define TSEWTED 0x00000200UL #define TSELECT 0x00008000UL #define TWPDABR 0x00010000UL #define TWPSYSCALL 0x00020000UL #define TSTEP 0x00040000UL #define TFASTWATCH 0x00080000UL #define TSFWTED 0x00100000UL #define TCHKERROR 0x80000000UL #define TUEXEMPT 0x00000001 #define TTIMESLICE_GRANT 0x00000002 #define TNOVALIDATE 0x00000004 #define TISIGINTR 0x00000010 #define TCHKPNT 0x00000020 #define TCHKPNT_BLOCK 0x00000040 #define TCHKPNT_PROCESS 0x00000080 #define TCHKPNT_SLEEP 0x00000100 #define TCHKPTSTOP 0x00000200 #define TCORE 0x00000400 #define TLSLICE 0x00000800 #define TPROFIL 0x00001000 #define TMIGRATE 0x00002000 #define TDISSTK 0x00004000 #define TFINTR 0x00008000 #define TTRAPSTOP 0x00010000 #define TTHRDTRAP 0x00020000 #define TSNONE 0 #define TSIDL 1 #define TSRUN 2 #define TSSLEEP 3 #define TSSWAP 4 #define TSSTOP 5 #define TSZOMB 6 #define TNOWAIT 0 #define TWEVENT 1 #define TWLOCK 2 #define TWTIMER 3 #define TWCPU 4 #define TWPGIN 5 #define TWPGOUT 6 #define TWPLOCK 7 #define TWFREEF 8 #define TWMEM 9 #define TWLOCKREAD 10 #define TWUEXCEPT 11 #define TWZOMB 12 #define TWLOCK_WX 13 #define TWVMMWAIT 14 #define TIDRESERVED 5 #define THREADSHIFT 19 #define TGENSHIFT 8 #define TGENMASK ((1<<TGENSHIFT)-1) #define NTHREAD (1<<THREADSHIFT) #define TIDMASK ((NTHREAD-1)<<TGENSHIFT) #define TSRADSHIFT 4 #define TIDXSHIFT (THREADSHIFT-TSRADSHIFT) #define TSRADMASK ((1L<<TSRADSHIFT)-1) #define TIDXMASK ((1L<<TIDXSHIFT)-1) #define THREADMASK(tid) (((tid)&TIDMASK)>>TGENSHIFT) #define TIDGEN(idx) ((idx)<<TGENSHIFT) #define V_ADSP_R 0x01 #define V_ADSP_W 0x02 #define V_ADSP_CS 0x04 #define MAYBE_TID(tid) (tid & 1) #define NULL_TID 0 #define SWAPPER_TID 3 #define SCHED_OTHER 0 #define EXTRACT_T_NICE(t) (((t)->t_policy == SCHED_OTHER) ? ((t)->t_nice - PUSER) : (P_NICE_MAX + 1)) #define SET_T_NICE(t,n) { if ((t)->t_policy == SCHED_OTHER) { (t)->t_nice=(MIN(P_NICE_MAX,MAX(0,(n)))) + PUSER; } } #define UL_FREE 0x00000000 #define UL_BUSY 0x10000000 #define UL_WAIT 0x20000000 #define UL_WAIT_LOCAL 0x40000000 #define UL_INTERLOCK 0x80000000 #define UL_MASK 0x0fffffff #define THREAD_TWAKEUP_ALL 0 #define THREAD_TWAKEUP_ONE 1 #define TSTATE_LOCAL 0x00000001 #define TSTATE_CANCEL_DEFER 0x00000004 #define TSTATE_CANCEL_DISABLE 0x00000008 #define TSTATE_CANCEL_PENDING 0x00000010 #define TSTATE_CANCEL_CHKPT 0x00000040 #define TSTATE_INTR 0x00000002 #define TSTATE_CANCEL_START TSTATE_INTR #define TSTATE_EXEMPT 0x00000020 #define TSTATE_PROFILING_OFF 0x00000080 #define TSTATE_SUSPEND 0x00000100 #define TSTATE_CONT 0x00000200 #define TSTATE_CREDS 0x00000400 #define TSTATE_PROCHANDLERS 0x00000800 #define TSTATE_ADVH 0x00001000 #define TSTATE_SYNCH 0x00002000 #define TSTATE_USCHED 0x00004000 #define TSTATE_DEFAULT_SCHED 0x00008000 #define TSTATE_INHERIT_SCHED 0x00010000 #define TSTATE_LOCAL_INIT 0x00020000 #define TSTATE_LOCAL_TERM 0x00040000 #define TSTATE_LOCAL_MCHANGE 0x00080000 #define TSTATE_CHANGE_ALL 0xfff00000 #define TSTATE_CHANGE_PTID 0x00100000 #define TSTATE_CHANGE_PROFILE 0x01000000 #define TSTATE_CHANGE_SSTACK 0x02000000 #define TSTATE_CHANGE_ERRNOP 0x04000000 #define TSTATE_CHANGE_SIGMASK 0x08000000 #define TSTATE_CHANGE_PSIG 0x10000000 #define TSTATE_CHANGE_SCHED 0x20000000 #define TSTATE_CHANGE_FLAGS 0x40000000 #define TSTATE_CHANGE_USERDATA 0x80000000 #define TSTATE_MYFAST_ALL (TSTATE_CHANGE_FLAGS | TSTATE_SUSPEND | TSTATE_PROFILING_OFF) #define THREAD_WAIT_OK 0 #define THREAD_WAIT_TIMEDOUT 1 #define THREAD_WAIT_ERROR -1 #define MAX_POSTED_THREADS 512 struct tstate { struct mstsave mst; __ptr32 errnop_addr; sigset_t sigmask; sigset_t psig; int policy; int priority; int flags; int flagmask; long userdata; uint fpinfo; uint fpscrx; stack_t sigaltstack; __ptr64 thread_control_p; void *prbase; void *credp; uint ptid; uint tct_clock; u_longlong_t ukeyset; struct rusage rusg; }; struct func_desc { char *entry_point; char *toc_ptr; char *data_ptr; }; struct func_desc32 { int entry_point; int toc_ptr; int data_ptr; }; typedef struct thread_credentials { uint flags; cred_ext_t cred; int reserved[9]; } thread_creds_t; #define INHERIT_USER_IDS 0x00000001 #define INHERIT_GROUP_IDS 0x00000010 #define INHERIT_GROUP_SETS 0x00000100 #define INHERIT_CAPABILITIES 0x00001000 #define INHERIT_PRIVILEGES 0x00010000 #define INHERIT_ALL 0x00011111 extern int *errnop; tid_t thread_create(void); void thread_init(unsigned long long, unsigned long long); int thread_kill(tid_t, int); int thread_post(tid_t); int thread_post_many(int, tid_t *, tid_t *); tid_t thread_self(void); int thread_setcredentials(int, struct thread_credentials *); int thread_setmystate(struct tstate *, struct tstate *); int thread_setmystate_fast(int, int **, ulong); int thread_setmymask_fast(sigset_t); int thread_boostceiling(int, int); int thread_setsched(tid_t, int, int); int thread_setstate(tid_t, struct tstate *, struct tstate *); int thread_setstate_fast(tid_t, int); void thread_terminate(void); int thread_terminate_ack(tid_t); void thread_terminate_unlock(atomic_p); int thread_getregs(tid_t, mcontext_t *, ulong *, ulong *, int *); int thread_getextregs(tid_t, __extctx_t *); int thread_tsleep(int, atomic_p, const sigset_t *, struct timestruc_t *); int thread_tsleep_chkpnt(int, atomic_p, const sigset_t *); int thread_tsleep_event(void *, atomic_p, int, struct timestruc_t *); int thread_twakeup(tid_t, int); int thread_twakeup_event(void *, int, int); int thread_twakeup_unlock(tid_t, int, atomic_p); int thread_unlock(atomic_p); long thread_userdata(void); int thread_wait(int); int thread_waitlock(atomic_p); int thread_waitlock_local(atomic_p); int thread_waitlock_(atomic_p, int, struct timestruc_t *); int thread_waitlock_local_(atomic_p, tid_t, struct timestruc_t *); int thread_waitact(int); void threads_runnable(int); int count_event_waiters(void *); void thread_callout(tid_t, uint); } #define PT_TRACE_ME 0 #define PT_READ_I 1 #define PT_READ_D 2 #define PT_WRITE_I 4 #define PT_WRITE_D 5 #define PT_CONTINUE 7 #define PT_KILL 8 #define PT_STEP 9 #define PT_READ_GPR 11 #define PT_READ_FPR 12 #define PT_WRITE_GPR 14 #define PT_WRITE_FPR 15 #define PT_READ_BLOCK 17 #define PT_WRITE_BLOCK 19 #define PT_ATTACH 30 #define PT_DETACH 31 #define PT_REGSET 32 #define PT_REATT 33 #define PT_LDINFO 34 #define PT_MULTI 35 #define PT_NEXT 36 #define PT_SET 37 #define PT_CLEAR 38 #define PT_LDXINFO 39 #define PT_QUERY 40 #define PT_WATCH 41 #define PTT_CONTINUE 50 #define PTT_STEP 51 #define PTT_READ_SPRS 52 #define PTT_WRITE_SPRS 53 #define PTT_READ_GPRS 54 #define PTT_WRITE_GPRS 55 #define PTT_READ_FPRS 56 #define PTT_WRITE_FPRS 57 #define PTT_READ_VEC 58 #define PTT_WRITE_VEC 59 #define PTT_WATCH 60 #define PTT_SET_TRAP 61 #define PTT_CLEAR_TRAP 62 #define PTT_READ_UKEYSET 63 #define PT_GET_UKEY 64 #define PTT_READ_FPSCR_HI 65 #define PTT_WRITE_FPSCR_HI 66 #define PT_COMMAND_MAX 66 #define IPCDATA 1024 #define PTFLAG_FAST_TRAP 0x00000001 #define PTFLAG_FAST_WATCH 0x00000002 #define PTFLAG_FAST_MASK (PTFLAG_FAST_TRAP|PTFLAG_FAST_WATCH) #define _FASTTRAP_OP 0x0DDF8000 #define _FASTTRAP_OP_MASK 0xFFFF8000 #define _FASTTRAP_NUM 0x00007FFF int ptrace(int request, int32long64_t id, int *address, int data, int *buffer); int ptracex(int request, int32long64_t id, long long addr, int data, int *buff); int ptrace64(int request, long long id, long long addr, int data, int *buff); struct ptsprs { unsigned int pt_iar; unsigned int pt_msr; unsigned int pt_cr; unsigned int pt_lr; unsigned int pt_ctr; unsigned int pt_xer; unsigned int pt_mq; unsigned int pt_reserved_0; unsigned int pt_fpscr; char pt_reserved_1; char pt_reserved_2; char pt_reserved_3[2]; unsigned int pt_reserved_4[5]; unsigned int pt_reserved_5; unsigned int pt_reserved_6; unsigned int pt_reserved_7; unsigned int pt_reserved_8; unsigned int pt_reserved_9; unsigned int pt_fpscrx; }; struct ptxsprs { unsigned long long pt_msr; unsigned long long pt_iar; unsigned long long pt_lr; unsigned long long pt_ctr; unsigned int pt_cr; unsigned int pt_xer; unsigned int pt_fpscr; unsigned int pt_fpscrx; }; struct ptthreads { tid32_t th[32767]; }; struct ptthreads64 { tid64_t th[32767]; }; typedef struct _ptrace_info { unsigned int ptrace_info_size; unsigned int total_info_size; offset_t watchpoints_hdr_off; } _ptrace_info; typedef struct _pt_watchpoints_hdr { offset_t pt_watchpoints_offset; unsigned int pt_watchpoints_count; unsigned int pt_watchpoint_size; unsigned int pt_validate:1; unsigned int pt_wp_write:1; unsigned int pt_wp_read:1; unsigned int pt_wp_thread:1; unsigned int pt_wp_value:1; unsigned int pt_wp_shmem:1; unsigned int pt_wp_mapped:1; unsigned int :25; unsigned int reserved; } _pt_watchpoints_hdr; typedef struct _pt_watchpoint { unsigned long long wp_start; unsigned long long wp_size; union { unsigned long long wp_tid; struct { unsigned int wp_minsize; unsigned short wp_count; unsigned short wp_align; } pt_watchpoint_info; } pt_wp_u; unsigned int reserved; void *wp_value; unsigned int wp_ignore:1; unsigned int wp_invalid:1; unsigned int wp_filter:1; unsigned int wp_thread:1; unsigned int wp_shmem:1; unsigned int wp_mapped:1; unsigned int wp_read:1; unsigned int wp_write:1; unsigned char wp_style; } _pt_watchpoint; #define _WP_STYLE_ANY 1 #define _WP_STYLE_HARDWARE 2 #define _WP_STYLE_HARDWARE1 3 #define _WP_STYLE_HARDWARE_LAST 127 #define _WP_STYLE_SOFTWARE 128 #define _WP_STYLE_SOFTWARE1 129 #define _WP_STYLE_SOFTWARE_LAST 255 enum __ptrace_request { PTRACE_TRACEME, PTRACE_PEEKTEXT, PTRACE_PEEKDATA, PTRACE_PEEKUSER, PTRACE_POKETEXT, PTRACE_POKEDATA, PTRACE_POKEUSER, PTRACE_CONT, PTRACE_KILL, PTRACE_SINGLESTEP, PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS, PTRACE_ATTACH, PTRACE_DETACH, PTRACE_SYSCALL }; typedef unsigned long proc_eye_catch_t; struct uidinfo { struct uidinfo *pu_next; struct uidinfo *pu_prev; uid_t pu_uid; long pu_cnt; int pu_pad[4]; }; extern struct uidinfo *get_uidinfo (uid_t uid); extern void free_uidinfo (struct uidinfo *uidinfo); #define max_pvproc ((struct pvproc *)v.ve_proc) struct kernext_svc { void (*kernext_svc_cleanup)(void *); }; #define TRP_NUM_COUNTS 10 struct proc_counts { unsigned long long trp_count[10]; }; struct proc { struct pvproc *p_pvprocp; pid_t p_pid; uint p_flag; uint p_flag2; uint p_int; uint p_atomic; ushort p_threadcount; ushort p_active; ushort p_suspended; ushort p_terminating; ushort p_local; ulong p_rss; short p_sradassign; ushort p_boundcount; void *p_rs_attinfo; ulong p_pevent; vmhandle_t p_adspace; sigset64_t p_sig; sigset64_t p_sigignore; sigset64_t p_sigcatch; sigset64_t p_siginfo; struct ksiginfo *p_infoq; unsigned long long p_size; unsigned long long p_minflt; unsigned long long p_majflt; long long p_repage; uint p_pctcpu; int p_sched_count; short p_cpticks; short p_msgcnt; uint p_majfltsec; char p_nice; char p_sched_pri; int p_chkblock; void *p_chkfile; void *p_prtrcset; void *p_lgpage; struct posix_tmr *p_rt_timer[32]; struct cputime_clock p_clock; ushort p_io_priority; time_t p_memory_lbolt; unsigned long long p_interval_start; struct proc_counts p_acct; struct diskiostat { unsigned long long inbytes; unsigned long long outbytes; unsigned long long logbytes; unsigned long long logops; unsigned long long inops; unsigned long long outops; } p_diskiostat; int p_wlmthrds; int p_wlmocthrds; int p_thrsetcnt; void *p_ptbpt; tid_t p_ptsynch; proc_eye_catch_t p_eyec; }; #define p_dkinbytes p_diskiostat.inbytes #define p_dkoutbytes p_diskiostat.outbytes #define p_dklogbytes p_diskiostat.logbytes #define p_dklogops p_diskiostat.logops #define p_dkinops p_diskiostat.inops #define p_dkoutops p_diskiostat.outops struct pvproc { pid_t pv_pid; pid_t pv_ppid; pid_t pv_sid; pid_t pv_pgrp; uid_t pv_uid; uid_t pv_suid; class_id_t pv_class; pid_t pv_vpid; pid_t pv_vppid; pid_t pv_vsid; pid_t pv_vpgrp; crid_t pv_crid; uint pv_crid_token; struct trusage64 pv_ru; ulong pv_spare[1]; Simple_lock pv_lock; char pv_stat; char pv_sigs_queued; ushort pv_xstat; uint pv_atomic; uint pv_flag; uint pv_flag2; int pv_wlm; uint pv_auditmask; Simple_lock pv_usched_lock; struct pvthread *pv_uschedp; struct ptipc *pv_ipc; struct pvproc *pv_dblist; struct pvproc *pv_dbnext; struct vnode * pv_procfsvn; struct pvproc *pv_sched_next; struct pvproc *pv_sched_back; struct proc *pv_procp; struct pvproc *pv_child; struct pvproc *pv_siblings; struct uidinfo *pv_uidinfo; struct pvproc *pv_ganchor; struct pvproc *pv_pgrpl; struct pvproc *pv_pgrpb; struct pvproc *pv_ttyl; struct pvproc *pv_cridnext; Simple_lock pv_session_lock; Simple_lock pv_parent_lock; Simple_lock pv_lock_d; struct pvthread *pv_threadlist; tid_t pv_synch; uint64_t pv_mempools[1]; void *pv_rset; unsigned long long pv_nframes; unsigned long long pv_npsblks; unsigned long long pv_nvpages; struct kernext_svc *pv_asyncio; tid_t pv_chksynch; struct pvthread *pv_chktv; unsigned long long pv_totalcputime; unsigned long long pv_totalscputime; unsigned long long pv_xcputime; unsigned long long pv_xscputime; unsigned long long pv_totaldiskio; time_t pv_termtime; void *pv_gcipc; char pv_pri; char pv_policy; short pv_acctflags; int pv_projid; unsigned long long pv_subproj; int pv_sprojid; int pv_pad1; dev64_t pv_app_dev; ino64_t pv_app_ino; uint_t pv_app_gen; void *pv_ewlmproc; struct prochr *pv_handlers; void *pv_cached_credp; Simple_lock pv_handlers_lock; unsigned long long pv_wlm_nvpages; uint pv_flag3; int pv_pad3; proc_eye_catch_t pv_eyec; #define PV_PAD 1 #define PV_LOGSIZE 9 int pv_pad[1]; }; #define pv_link pv_vpgrp #define pv_utime pv_ru.ru_utime.tv_sec #define pv_stime pv_ru.ru_stime.tv_sec #define p_rt_ticks p_clock.rt_ticks #define p_active_tmrs p_clock.active_tmrs #define SLOAD 0x00000001 #define STRC 0x00000008 #define SKPROC 0x00000200 #define SSIGNOCHLD 0x00000400 #define STRACING 0x00004000 #define SMPTRACE 0x00008000 #define SEXIT 0x00010000 #define STRCME 0x00080000 #define SEXECED 0x00200000 #define SPLOCK 0x10000000 #define S64BIT 0x00000001 #define SWAITPROC 0x00000002 #define SSCHEDPROC 0x00000008 #define SRESTART 0x00000010 #define SPRIMARY 0x00000020 #define SCHKPNTABLE 0x00000040 #define SRESTARTED 0x00000080 #define SRESTARTING 0x00000100 #define SCHKTRC 0x00000200 #define SCRED 0x00002000 #define SCOREFILE 0x00004000 #define SCHKHANDLER 0x00008000 #define SPIDCRIT 0x00200000 #define SFORKCRIT 0x00400000 #define SNOCKPTSHM 0x01000000 #define SINHERITED 0x02000000 #define SPV_HOLD 0x10000000 #define SUKEYAWARE 0x20000000 #define SMPIJOB 0x40000000 #define STRAPSIG 0x80000000 #define SNOSWAP 0x00000002 #define SFIXPRI 0x00000100 #define SLOAD 0x00000001 #define SFORKSTACK 0x00000004 #define STRC 0x00000008 #define SKPROC 0x00000200 #define SSIGSET 0x00000800 #define SXPG1170 0x00001000 #define SGETUREGS 0x00002000 #define SEXIT 0x00010000 #define SLPDATA 0x00020000 #define SEXECING 0x01000000 #define SPSEARLYALLOC 0x04000000 #define SCONTINUED 0x08000000 #define SFASTWATCH 0x20000000 #define SLPDATA_SET(U) ((U)->U_procp->p_flag & SLPDATA) #define USE_LPDATA(U) (SLPDATA_SET(U) || ((U)->U_datal2psize == L2LGPSIZE)) #define S64BIT 0x00000001 #define SFASTTRAP 0x00000004 #define SRT_MPC 0x00000400 #define SRT_GRQ 0x00000800 #define SWP_SIGNALED 0x00001000 #define SDSA 0x00010000 #define SCORENAME 0x00020000 #define SPTHREADED 0x00040000 #define SLPDATAMUST 0x00080000 #define SMCMMEMAFF 0x00100000 #define SFCONTINUED 0x00800000 #define SCORE_MMAP 0x04000000 #define SCORE_NOSHM 0x08000000 #define SLPDATAMUST_SET(U) ((U)->U_procp->p_flag2 & SLPDATAMUST) #define SCORE 0x00000001 #define SCORE_DUMP 0x00000002 #define SRUNQ 0x00000004 #define SCHKPNT 0x00000008 #define SJOBSTOP 0x00000010 #define SPROCFS 0x00000020 #define SPTRACE 0x00000040 #define SCHKPNTING 0x00000080 #define SPRFORK 0x00000100 #define SPRKLC 0x00000200 #define SPRRLC 0x00000400 #define SPRASYNC 0x00000800 #define SPROCTR 0x00001000 #define SPRJOBSIG 0x00002000 #define SPROFIL 0x00010000 #define SJUSTBACKIN 0x00020000 #define SCHKPTSTOP 0x00040000 #define SLOWPSEXCP 0x00080000 #define SWLM 0x00100000 #define SWLMRMEM 0x00200000 #define SWLMVMEM 0x00400000 #define SWLMVMEMPROC 0x00800000 #define SCORESTOP 0x01000000 #define SPSMKILL 0x02000000 #define SNOFCONT 0x04000000 #define STERM 0x10000000 #define SSUSP 0x20000000 #define SSUSPUM 0x40000000 #define SGETOUT 0x80000000 #define SALLSTOPS (SJOBSTOP|SPROCFS|SPTRACE|SCORESTOP|SCHKPTSTOP) #define SSIGSLIH (STERM|SSUSP|SSUSPUM|SGETOUT) #define SORPHANPGRP 0x00040000 #define SPPNOCLDSTOP 0x00100000 #define SWTED 0x00000010 #define SFWTED 0x00000020 #define SEWTED 0x00000040 #define SLWTED 0x00000080 #define UV_SYSCFG 0x00000400 #define UV_PZERO 0x00000800 #define SWLMTERMSENT 0x00001000 #define SPROJFIXED 0x0001 #define SPROJAPP 0x0002 #define SPROJINVOKE 0x0004 #define SPROJABS 0x0008 #define SNONE 0 #define SIDL 4 #define SZOMB 5 #define SSTOP 6 #define SACTIVE 7 #define SSWAP 8 #define SBITS 16 #define PIDRESERVED 6 #define PROCSHIFT 18 #define PGENSHIFT 8 #define PGENMASK ((1<<PGENSHIFT)-1) #define NPROC (1<<PROCSHIFT) #define PIDMASK ((NPROC-1)<<PGENSHIFT) #define PIDMAX ((NPROC<<PGENSHIFT)-1) #define PSRADSHIFT TSRADSHIFT #define PIDXSHIFT (PROCSHIFT-PSRADSHIFT) #define PSRADMASK ((1L<<PSRADSHIFT)-1) #define PIDXMASK ((1L<<PIDXSHIFT)-1) #define MAYBE_PID(pid) (!(pid & 1) || (pid == 1)) #define PROCMASK(pid) ((((pid)&PIDMASK)>>PGENSHIFT) | ((pid)&1)) #define PIDGEN(idx) ((idx)<<PGENSHIFT) #define P_NICE_DEFAULT (NZERO+PUSER) #define P_NICE_MAX 40 #define P_NICE_MIN 0 #define EXTRACT_NICE(p) (((p)->p_pvprocp->pv_flag3 & SFIXPRI) ? (P_NICE_MAX + 1) : ((p)->p_nice - PUSER)) #define SET_NICE(p,n) { if (!((p)->p_pvprocp->pv_flag3 & SFIXPRI)) { (p)->p_nice = (MIN(P_NICE_MAX,MAX(0,(n)))) + PUSER; } } extern Simple_lock crid_lock; extern Simple_lock ptrace_lock; extern Complex_lock core_lock; extern Simple_lock time_lock; extern Simple_lock uidinfo_lock; extern Simple_lock uex_lock; extern Simple_lock suspending_q_lock; struct proch { struct proch *next; void (*handler)(); }; #define PROCH_INITIALIZE 1 #define PROCH_TERMINATE 2 #define PROCH_SWAPOUT 3 #define PROCH_SWAPIN 4 #define PROCH_EXEC 5 #define PROCH_LOAD 6 #define PROCH_UNLOAD 7 #define THREAD_INITIALIZE 11 #define THREAD_TERMINATE 12 #define PROCH_SETUID 13 #define PROCH_SETGID 14 #define PROCH_EXECEXIT 15 #define PROCH_RESTART 16 #define THREAD_LOCAL_INIT 17 #define THREAD_LOCAL_TERM 18 #define THREAD_LOCAL_DISPATCH 19 #define THREAD_LOCAL_MCHANGE 20 #define NONCRITFORK 1 struct prochr { struct prochr *prochr_next; void (*prochr_handler)(); uint prochr_mask; int pad; }; typedef struct prochr_execexit { int len; dev_t dev; ino_t ino; uint_t gen; } prochr_execexit_t; #define PROCHR_INITIALIZE (1UL<<PROCH_INITIALIZE) #define PROCHR_TERMINATE (1UL<<PROCH_TERMINATE) #define PROCHR_EXEC (1UL<<PROCH_EXEC) #define PROCHR_THREADINIT (1UL<<THREAD_INITIALIZE) #define PROCHR_THREADTERM (1UL<<THREAD_TERMINATE) #define PROCHR_SETUID (1UL<<PROCH_SETUID) #define PROCHR_SETGID (1UL<<PROCH_SETGID) #define PROCHR_EXECEXIT (1UL<<PROCH_EXECEXIT) #define PROCHR_RESTART (1UL<<PROCH_RESTART) #define PROCHR_TLOCAL_INIT (1UL<<THREAD_LOCAL_INIT) #define PROCHR_TLOCAL_TERM (1UL<<THREAD_LOCAL_TERM) #define PROCHR_TLOCAL_DISPATCH (1UL<<THREAD_LOCAL_DISPATCH) #define PROCHR_TLOCAL_MODE (1UL<<THREAD_LOCAL_MCHANGE) #define PROCHADD_CALLOUTS (PROCHR_INITIALIZE | PROCHR_TERMINATE | PROCHR_EXEC | PROCHR_THREADINIT | PROCHR_THREADTERM) #define FLT_MODULO (1<<16) } #define PMASK 255 #define PCATCH 0x100 #define PSWP 0 #define PRI_SCHED 16 #define PINOD 18 #define PZERO 25 #define PPIPE 26 #define PMSG 27 #define TTIPRI 30 #define TTOPRI 31 #define PWAIT 33 #define PUSER 40 #define PRI_LOW (PIDLE-1) #define PIDLE PMASK #define MBUF_RTPRI 36 #define NETPCL_RTPRI 37 #define HFTSC_RTPRI 38 #define NETTMR_RTPRI 39 #define PRIO_NO_BOOST 0 #define PRIO_TEMP_BOOST 1 #define PRIO_PERM_BOOST 2 #define PRIORITY_MIN PSWP #define PRIORITY_MAX PIDLE #define RR_INTERVAL HZ #define PTHREAD_PRIO_MIN 1 #define PTHREAD_PRIO_MAX 127 #define SCHED_OTHER 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_LOCAL 3 #define SCHED_GLOBAL 4 #define SCHED_FIFO2 5 #define SCHED_FIFO3 6 #define SCHED_FIFO4 7 extern "C" { struct sched_param { int sched_priority; int sched_policy; int sched_reserved[6]; }; struct timespec; int sched_get_priority_max(int); int sched_get_priority_min(int); int sched_getparam(pid_t, struct sched_param *); int sched_getscheduler(pid_t); int sched_rr_get_interval(pid_t, struct timespec *); int sched_setparam(pid_t, const struct sched_param *); int sched_setscheduler(pid_t, int, const struct sched_param *); int sched_yield(void); } #define _H_UNISTD extern "C" { #undef _STD_TYPES_T #define _H_ACCESS #define F_OK 00 #define X_OK 01 #define W_OK 02 #define R_OK 04 #define R_ACC 04 #define W_ACC 02 #define X_ACC 01 #define E_ACC 00 #define NO_ACC 00 #define ACC_SELF 0x00 #define ACC_INVOKER 0x01 #define ACC_OBJ_OWNER 0x02 #define ACC_OBJ_GROUP 0x04 #define ACC_OTHERS 0x08 #define ACC_ANY 0x10 #define ACC_ALL 0x20 #define ACC_PERMIT 0x01 #define ACC_DENY 0x02 #define ACC_SPECIFY 0x03 extern char *acl_get(char *); extern char *acl_fget(int); extern int acl_chg(char *, int, int, int); extern int acl_fchg(int, int, int, int); extern int acl_put(char *, char *, int); extern int acl_fput(int, char *, int); extern int acl_set(char *, int, int, int); extern int acl_fset(int, int, int, int); extern int accessx(char *, int, int); extern int access(const char *, int); extern unsigned int alarm(unsigned int); extern int chdir(const char *); extern int chown(const char *, uid_t, gid_t); extern int close(int); extern char *ctermid(char *); extern int dup(int); extern int dup2(int, int); extern int execl(const char *, const char *, ...); extern int execv(const char *, char *const []); extern int execle(const char *, const char *, ...); extern int execve(const char *, char *const [], char *const []); extern int execlp(const char *, const char *, ...); extern int execvp(const char *, char *const []); extern void _exit(int); extern pid_t fork(void); extern long fpathconf(int, int); extern char *getcwd(char *, size_t); extern gid_t getegid(void); extern uid_t geteuid(void); extern gid_t getgid(void); extern int getgroups(int, gid_t []); extern char *getlogin(void); extern pid_t getpgrp(void); extern pid_t getpid(void); extern pid_t getppid(void); extern uid_t getuid(void); extern int isatty(int); extern int link(const char *, const char *); extern off_t lseek(int, off_t, int); extern off64_t lseek64(int, off64_t, int); extern long pathconf(const char *, int); extern int pause(void); extern int pipe(int []); extern int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); extern ssize_t read(int, void *, size_t); extern int rmdir(const char *); extern int setgid(gid_t); extern int setpgid(pid_t, pid_t); extern pid_t setsid(void); extern int setuid(uid_t); extern unsigned int sleep(unsigned int); extern long sysconf(int); extern pid_t tcgetpgrp(int); extern int tcsetpgrp(int, pid_t); extern char *ttyname(int); extern int unlink(const char *); extern ssize_t write(int, const void *, size_t); #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #define _POSIX_JOB_CONTROL 1 #define _POSIX_SAVED_IDS 1 #define _POSIX_VERSION 200112L #define _POSIX2_VERSION 200112L #define _POSIX2_C_VERSION 200112L #define _XOPEN_VERSION 600 #define _XOPEN_XCU_VERSION 4 #define _XOPEN_XPG3 1 #define _XOPEN_XPG4 1 #define _XOPEN_UNIX 1 #define _XOPEN_REALTIME (-1) #define _XOPEN_REALTIME_THREADS (-1) #define _XOPEN_STREAMS 1 #define _XBS5_ILP32_OFF32 1 #define _XBS5_ILP32_OFFBIG 1 #define _XBS5_LP64_OFF64 1 #define _XBS5_LPBIG_OFFBIG 1 #define _POSIX2_C_BIND 200112L #define _POSIX2_C_DEV 200112L #define _POSIX2_CHAR_TERM 200112L #define _POSIX2_LOCALEDEF 200112L #define _POSIX2_UPE 200112L #define _POSIX2_FORT_DEV (-1) #define _POSIX2_FORT_RUN (-1) #define _POSIX2_SW_DEV (-1) #define _POSIX_REGEXP 1 #define _POSIX_SHELL 1 #define _POSIX2_PBS (-1) #define _POSIX2_PBS_ACCOUNTING (-1) #define _POSIX2_PBS_CHECKPOINT (-1) #define _POSIX2_PBS_LOCATE (-1) #define _POSIX2_PBS_MESSAGE (-1) #define _POSIX2_PBS_TRACK (-1) #define _V6_ILP32_OFF32 1 #define _V6_ILP32_OFFBIG 1 #define _V6_LP64_OFF64 1 #define _V6_LPBIG_OFFBIG 1 #define _POSIX_ADVISORY_INFO 200112L #define _POSIX_BARRIERS 200112L #define _POSIX_CLOCK_SELECTION 200112L #define _POSIX_CPUTIME 200112L #define _POSIX_MONOTONIC_CLOCK 200112L #define _POSIX_SPAWN 200112L #define _POSIX_SPIN_LOCKS 200112L #define _POSIX_SPORADIC_SERVER (-1) #define _POSIX_THREAD_CPUTIME 200112L #define _POSIX_THREAD_SPORADIC_SERVER (-1) #define _POSIX_TIMEOUTS 200112L #define _POSIX_TRACE (-1) #define _POSIX_TRACE_EVENT_FILTER (-1) #define _POSIX_TRACE_INHERIT (-1) #define _POSIX_TRACE_LOG (-1) #define _POSIX_TYPED_MEMORY_OBJECTS (-1) #define _XOPEN_CRYPT 1 #define _XOPEN_SHM 1 #define _XOPEN_ENH_I18N 1 #define _XOPEN_LEGACY (-1) #define _UNIX_ABI (-1) #define _UNIX_ABI_IA64 (-1) #define _UNIX_ABI_BIG_ENDIAN (-1) #define _UNIX_ABI_LITTLE_ENDIAN (-1) extern char *optarg; extern int optind, opterr, optopt; extern size_t confstr(int, char*, size_t); extern char *crypt(const char *, const char *); extern void encrypt(char *, int); extern int fsync(int); extern int getopt(int, char* const*, const char*); extern int nice(int); extern void swab(const void *, void *, ssize_t); extern int fdatasync(int); extern char *getpass(const char *); extern int chroot(const char *); #define _POSIX_THREADS 200112L #define _POSIX_THREAD_ATTR_STACKADDR 200112L #define _POSIX_THREAD_ATTR_STACKSIZE 200112L #define _POSIX_THREAD_PROCESS_SHARED 200112L #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L #define _POSIX_REENTRANT_FUNCTIONS _POSIX_THREAD_SAFE_FUNCTIONS #define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) #define _POSIX_THREAD_PRIO_INHERIT (-1) #define _POSIX_THREAD_PRIO_PROTECT (-1) #undef _POSIX_THREAD_FORKALL #define _POSIX_ASYNCHRONOUS_IO 200112L #define _POSIX_FSYNC 200112L #define _POSIX_MAPPED_FILES 200112L #define _POSIX_MEMLOCK 200112L #define _POSIX_MEMLOCK_RANGE 200112L #define _POSIX_MEMORY_PROTECTION 200112L #define _POSIX_MESSAGE_PASSING 200112L #define _POSIX_PRIORITIZED_IO 200112L #define _POSIX_PRIORITY_SCHEDULING 200112L #define _POSIX_REALTIME_SIGNALS 200112L #define _POSIX_SEMAPHORES 200112L #define _POSIX_SHARED_MEMORY_OBJECTS 200112L #define _POSIX_SYNCHRONIZED_IO 200112L #define _POSIX_TIMERS 200112L #define _POSIX_ASYNC_IO (-1) #undef _POSIX_SYNC_IO #define _POSIX_PRIO_IO (-1) #define _POSIX_CHOWN_RESTRICTED 0 #define _POSIX_VDISABLE 0xFF #define _POSIX_NO_TRUNC 0 #define _POSIX_IPV6 200112L #define _POSIX_RAW_SOCKETS 200112L #define _POSIX_READER_WRITER_LOCKS 200112L #define _CS_PATH 1 #define _CS_XBS5_ILP32_OFF32_CFLAGS 2 #define _CS_XBS5_ILP32_OFF32_LDFLAGS 3 #define _CS_XBS5_ILP32_OFF32_LIBS 4 #define _CS_XBS5_ILP32_OFF32_LINTFLAGS 5 #define _CS_XBS5_ILP32_OFFBIG_CFLAGS 6 #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 7 #define _CS_XBS5_ILP32_OFFBIG_LIBS 8 #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 9 #define _CS_XBS5_LP64_OFF64_CFLAGS 10 #define _CS_XBS5_LP64_OFF64_LDFLAGS 11 #define _CS_XBS5_LP64_OFF64_LIBS 12 #define _CS_XBS5_LP64_OFF64_LINTFLAGS 13 #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 14 #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 15 #define _CS_XBS5_LPBIG_OFFBIG_LIBS 16 #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 17 #define _CS_AIX_BOOTDEV 24 #define _CS_AIX_MODEL_CODE 25 #define _CS_AIX_ARCHITECTURE 26 #define _CS_AIX_MODEL_CLASS 40 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 27 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 28 #define _CS_POSIX_V6_ILP32_OFF32_LIBS 29 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 30 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 31 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 32 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 33 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 34 #define _CS_POSIX_V6_LP64_OFF64_LIBS 35 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 36 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 37 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 38 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 39 #define _CSPATH "/usr/bin:/usr/vac/bin" #define _CSPOSIX_V6_ILP32_OFF32_CFLAGS "-q32" #define _CSXBS5_ILP32_OFF32_CFLAGS _CSPOSIX_V6_ILP32_OFF32_CFLAGS #define _CSPOSIX_V6_ILP32_OFF32_LDFLAGS "-b32" #define _CSXBS5_ILP32_OFF32_LDFLAGS _CSPOSIX_V6_ILP32_OFF32_LDFLAGS #define _CSPOSIX_V6_ILP32_OFF32_LIBS "-lc -lpthread -lm" #define _CSXBS5_ILP32_OFF32_LIBS _CSPOSIX_V6_ILP32_OFF32_LIBS #define _CSXBS5_ILP32_OFF32_LINTFLAGS "" #define _CSPOSIX_V6_ILP32_OFFBIG_CFLAGS "-q32 -D_LARGE_FILES -qlonglong" #define _CSXBS5_ILP32_OFFBIG_CFLAGS _CSPOSIX_V6_ILP32_OFFBIG_CFLAGS #define _CSPOSIX_V6_ILP32_OFFBIG_LDFLAGS "-b32" #define _CSXBS5_ILP32_OFFBIG_LDFLAGS _CSPOSIX_V6_ILP32_OFFBIG_LDFLAGS #define _CSPOSIX_V6_ILP32_OFFBIG_LIBS "-lc -lpthread -lm" #define _CSXBS5_ILP32_OFFBIG_LIBS _CSPOSIX_V6_ILP32_OFFBIG_LIBS #define _CSXBS5_ILP32_OFFBIG_LINTFLAGS "-D_LARGE_FILES -qlonglong" #define _CSPOSIX_V6_LP64_OFF64_CFLAGS "-q64" #define _CSXBS5_LP64_OFF64_CFLAGS _CSPOSIX_V6_LP64_OFF64_CFLAGS #define _CSPOSIX_V6_LP64_OFF64_LDFLAGS "-b64" #define _CSXBS5_LP64_OFF64_LDFLAGS _CSPOSIX_V6_LP64_OFF64_LDFLAGS #define _CSPOSIX_V6_LP64_OFF64_LIBS "-lc -lpthread -lm" #define _CSXBS5_LP64_OFF64_LIBS _CSPOSIX_V6_LP64_OFF64_LIBS #define _CSXBS5_LP64_OFF64_LINTFLAGS "-D__64BIT__" #define _CSPOSIX_V6_LPBIG_OFFBIG_CFLAGS "-q64" #define _CSXBS5_LPBIG_OFFBIG_CFLAGS _CSPOSIX_V6_LPBIG_OFFBIG_CFLAGS #define _CSPOSIX_V6_LPBIG_OFFBIG_LDFLAGS "-b64" #define _CSXBS5_LPBIG_OFFBIG_LDFLAGS _CSPOSIX_V6_LPBIG_OFFBIG_LDFLAGS #define _CSPOSIX_V6_LPBIG_OFFBIG_LIBS "-lc -lpthread -lm" #define _CSXBS5_LPBIG_OFFBIG_LIBS _CSPOSIX_V6_LPBIG_OFFBIG_LIBS #define _CSXBS5_LPBIG_OFFBIG_LINTFLAGS "-D__64BIT__" #define _CSPOSIX_V6_WIDTH_RESTRICTED_ENVS "POSIX_V6_ILP32_OFF32\n" "POSIX_V6_ILP32_OFFBIG\n" "POSIX_V6_LP64_OFF64\n" "POSIX_V6_LPBIG_OFFBIG" #define _PC_CHOWN_RESTRICTED 10 #define _PC_LINK_MAX 11 #define _PC_MAX_CANON 12 #define _PC_MAX_INPUT 13 #define _PC_NAME_MAX 14 #define _PC_NO_TRUNC 15 #define _PC_PATH_MAX 16 #define _PC_PIPE_BUF 17 #define _PC_VDISABLE 18 #define _PC_ASYNC_IO 19 #define _PC_SYNC_IO 20 #define _PC_PRIO_IO 21 #define _PC_FILESIZEBITS 22 #define _PC_AIX_DISK_PARTITION 23 #define _PC_AIX_DISK_SIZE 24 #define _PC_SYMLINK_MAX 25 #define _PC_ALLOC_SIZE_MIN 26 #define _PC_REC_INCR_XFER_SIZE 27 #define _PC_REC_MAX_XFER_SIZE 28 #define _PC_REC_MIN_XFER_SIZE 29 #define _PC_REC_XFER_ALIGN 30 #define _PC_2_SYMLINKS 31 #define _SC_ARG_MAX 0 #define _SC_CHILD_MAX 1 #define _SC_CLK_TCK 2 #define _SC_NGROUPS_MAX 3 #define _SC_OPEN_MAX 4 #define _SC_STREAM_MAX 5 #define _SC_TZNAME_MAX 6 #define _SC_JOB_CONTROL 7 #define _SC_SAVED_IDS 8 #define _SC_VERSION 9 #define _SC_POSIX_ARG_MAX 10 #define _SC_POSIX_CHILD_MAX 11 #define _SC_POSIX_LINK_MAX 12 #define _SC_POSIX_MAX_CANON 13 #define _SC_POSIX_MAX_INPUT 14 #define _SC_POSIX_NAME_MAX 15 #define _SC_POSIX_NGROUPS_MAX 16 #define _SC_POSIX_OPEN_MAX 17 #define _SC_POSIX_PATH_MAX 18 #define _SC_POSIX_PIPE_BUF 19 #define _SC_POSIX_SSIZE_MAX 20 #define _SC_POSIX_STREAM_MAX 21 #define _SC_POSIX_TZNAME_MAX 22 #define _SC_BC_BASE_MAX 23 #define _SC_BC_DIM_MAX 24 #define _SC_BC_SCALE_MAX 25 #define _SC_BC_STRING_MAX 26 #define _SC_EQUIV_CLASS_MAX 27 #define _SC_EXPR_NEST_MAX 28 #define _SC_LINE_MAX 29 #define _SC_RE_DUP_MAX 30 #define _SC_2_VERSION 31 #define _SC_2_C_DEV 32 #define _SC_2_FORT_DEV 33 #define _SC_2_FORT_RUN 34 #define _SC_2_LOCALEDEF 35 #define _SC_2_SW_DEV 36 #define _SC_POSIX2_BC_BASE_MAX 37 #define _SC_POSIX2_BC_DIM_MAX 38 #define _SC_POSIX2_BC_SCALE_MAX 39 #define _SC_POSIX2_BC_STRING_MAX 40 #define _SC_POSIX2_EQUIV_CLASS_MAX 41 #define _SC_POSIX2_EXPR_NEST_MAX 42 #define _SC_POSIX2_LINE_MAX 43 #define _SC_POSIX2_RE_DUP_MAX 44 #define _SC_PASS_MAX 45 #define _SC_XOPEN_VERSION 46 #define _SC_ATEXIT_MAX 47 #define _SC_PAGE_SIZE 48 #define _SC_AES_OS_VERSION 49 #define _SC_COLL_WEIGHTS_MAX 50 #define _SC_2_C_BIND 51 #define _SC_2_C_VERSION 52 #define _SC_2_UPE 53 #define _SC_2_CHAR_TERM 54 #define _SC_XOPEN_SHM 55 #define _SC_XOPEN_CRYPT 56 #define _SC_XOPEN_ENH_I18N 57 #define _SC_PAGESIZE _SC_PAGE_SIZE #define _SC_IOV_MAX 58 #define _SC_THREAD_SAFE_FUNCTIONS 59 #define _SC_THREADS 60 #define _SC_THREAD_ATTR_STACKADDR 61 #define _SC_THREAD_ATTR_STACKSIZE 62 #define _SC_THREAD_FORKALL 63 #define _SC_THREAD_PRIORITY_SCHEDULING 64 #define _SC_THREAD_PRIO_INHERIT 65 #define _SC_THREAD_PRIO_PROTECT 66 #define _SC_THREAD_PROCESS_SHARED 67 #define _SC_THREAD_KEYS_MAX 68 #define _SC_THREAD_DATAKEYS_MAX _SC_THREAD_KEYS_MAX #define _SC_THREAD_STACK_MIN 69 #define _SC_THREAD_THREADS_MAX 70 #define _SC_NPROCESSORS_CONF 71 #define _SC_NPROCESSORS_ONLN 72 #define _SC_XOPEN_UNIX 73 #define _SC_AIO_LISTIO_MAX 75 #define _SC_AIO_MAX 76 #define _SC_AIO_PRIO_DELTA_MAX 77 #define _SC_ASYNCHRONOUS_IO 78 #define _SC_DELAYTIMER_MAX 79 #define _SC_FSYNC 80 #define _SC_GETGR_R_SIZE_MAX 81 #define _SC_GETPW_R_SIZE_MAX 82 #define _SC_LOGIN_NAME_MAX 83 #define _SC_MAPPED_FILES 84 #define _SC_MEMLOCK 85 #define _SC_MEMLOCK_RANGE 86 #define _SC_MEMORY_PROTECTION 87 #define _SC_MESSAGE_PASSING 88 #define _SC_MQ_OPEN_MAX 89 #define _SC_MQ_PRIO_MAX 90 #define _SC_PRIORITIZED_IO 91 #define _SC_PRIORITY_SCHEDULING 92 #define _SC_REALTIME_SIGNALS 93 #define _SC_RTSIG_MAX 94 #define _SC_SEMAPHORES 95 #define _SC_SEM_NSEMS_MAX 96 #define _SC_SEM_VALUE_MAX 97 #define _SC_SHARED_MEMORY_OBJECTS 98 #define _SC_SIGQUEUE_MAX 99 #define _SC_SYNCHRONIZED_IO 100 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 101 #define _SC_TIMERS 102 #define _SC_TIMER_MAX 103 #define _SC_TTY_NAME_MAX 104 #define _SC_XBS5_ILP32_OFF32 105 #define _SC_XBS5_ILP32_OFFBIG 106 #define _SC_XBS5_LP64_OFF64 107 #define _SC_XBS5_LPBIG_OFFBIG 108 #define _SC_XOPEN_XCU_VERSION 109 #define _SC_XOPEN_REALTIME 110 #define _SC_XOPEN_REALTIME_THREADS 111 #define _SC_XOPEN_LEGACY 112 #define _SC_REENTRANT_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS #define _SC_PHYS_PAGES 113 #define _SC_AVPHYS_PAGES 114 #define _SC_LPAR_ENABLED 115 #define _SC_LARGE_PAGESIZE 116 #define _SC_AIX_KERNEL_BITMODE 117 #define _SC_AIX_REALMEM 118 #define _SC_AIX_HARDWARE_BITMODE 119 #define _SC_AIX_MP_CAPABLE 120 #define _SC_V6_ILP32_OFF32 121 #define _SC_V6_ILP32_OFFBIG 122 #define _SC_V6_LP64_OFF64 123 #define _SC_V6_LPBIG_OFFBIG 124 #define _SC_XOPEN_STREAMS 125 #define _SC_HOST_NAME_MAX 126 #define _SC_REGEXP 127 #define _SC_SHELL 128 #define _SC_SYMLOOP_MAX 129 #define _SC_ADVISORY_INFO 130 #define _SC_FILE_LOCKING 131 #define _SC_2_PBS 132 #define _SC_2_PBS_ACCOUNTING 133 #define _SC_2_PBS_CHECKPOINT 134 #define _SC_2_PBS_LOCATE 135 #define _SC_2_PBS_MESSAGE 136 #define _SC_2_PBS_TRACK 137 #define _SC_BARRIERS 138 #define _SC_CLOCK_SELECTION 139 #define _SC_CPUTIME 140 #define _SC_MONOTONIC_CLOCK 141 #define _SC_READER_WRITER_LOCKS 142 #define _SC_SPAWN 143 #define _SC_SPIN_LOCKS 144 #define _SC_SPORADIC_SERVER 145 #define _SC_THREAD_CPUTIME 146 #define _SC_THREAD_SPORADIC_SERVER 147 #define _SC_TIMEOUTS 148 #define _SC_TRACE 149 #define _SC_TRACE_EVENT_FILTER 150 #define _SC_TRACE_INHERIT 151 #define _SC_TRACE_LOG 152 #define _SC_TYPED_MEMORY_OBJECTS 153 #define _SC_IPV6 154 #define _SC_RAW_SOCKETS 155 #define _SC_SS_REPL_MAX 156 #define _SC_TRACE_EVENT_NAME_MAX 157 #define _SC_TRACE_NAME_MAX 158 #define _SC_TRACE_SYS_MAX 159 #define _SC_TRACE_USER_EVENT_MAX 160 #define _SC_AIX_UKEYS 161 #define _H_LOCKF extern "C" { #define S_ENFMT S_ISGID #define F_ULOCK 0 #define F_LOCK 1 #define F_TLOCK 2 #define F_TEST 3 extern int lockf (int, int, off_t); extern int lockf64 (int, int, off64_t); } extern int brk(void *); extern int getpagesize(void); extern int __fd_getdtablesize(void); static int getdtablesize() { return __fd_getdtablesize(); } extern void *sbrk(intptr_t); extern int fchdir(int); extern int fchown(int, uid_t, gid_t); extern int ftruncate(int, off_t); extern int ftruncate64(int, off64_t); extern int gethostname(char *, size_t); extern long gethostid(void); extern pid_t getpgid(pid_t); extern pid_t getsid(pid_t); extern char *getwd(char *); extern int lchown(const char *, uid_t, gid_t); extern int readlink(const char *, char *, size_t); extern pid_t setpgrp(void); extern int setregid(gid_t, gid_t); extern int setreuid(uid_t, uid_t); extern int symlink(const char *, const char *); extern void sync(void); extern int truncate(const char *, off_t); extern int truncate64(const char *, off64_t); extern useconds_t ualarm(useconds_t, useconds_t); extern int usleep(useconds_t); extern pid_t vfork(void); extern int getlogin_r(char *, size_t); extern int ttyname_r(int, char *, size_t); extern ssize_t pread(int, void *, size_t, off_t); extern ssize_t pwrite(int, const void *, size_t, off_t); extern ssize_t pread64(int, void *, size_t, off64_t); extern ssize_t pwrite64(int, const void *, size_t, off64_t); extern char **environ; extern pid_t f_fork(void); extern char * cuserid(char *); extern int setegid(gid_t); extern int seteuid(uid_t); extern int setrgid(gid_t); extern int setruid(uid_t); extern int ioctl(int, int, ...); extern int setgroups(int, gid_t []); extern int readx(int, char*, unsigned, long); extern int writex(int, char*, unsigned, long); extern off_t fclear(int, off_t); extern int fsync_range(int, int, off_t, off_t); extern off64_t fclear64(int, off64_t); extern int fsync_range64(int, int, off64_t, off64_t); extern offset_t llseek(int, offset_t, int); extern char * getusershell(void); extern void setusershell(void); extern void endusershell(void); extern char * get_current_dir_name(void); extern int sysfs(int, ...); extern int finfo(const char *, int, void *, int32long64_t); extern int ffinfo(int, int, void *, int32long64_t); #define _AES_OS_VERSION 1 } #define PTHREAD_PROCESS_SHARED 0 #define PTHREAD_PROCESS_PRIVATE 1 #define PTHREAD_MUTEX_ERRORCHECK 3 #define PTHREAD_MUTEX_NORMAL 5 #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL #define PTHREAD_MUTEX_RECURSIVE 4 #define PTHREAD_PRIO_DEFAULT 0 #define PTHREAD_PRIO_NONE 1 #define PTHREAD_PRIO_PROTECT 2 #define PTHREAD_PRIO_INHERIT 3 #define PTHREAD_INHERIT_SCHED 0 #define PTHREAD_EXPLICIT_SCHED 1 #define PTHREAD_SCOPE_SYSTEM 0 #define PTHREAD_SCOPE_PROCESS 1 #define PTHREAD_CREATE_DETACHED 1 #define PTHREAD_CREATE_JOINABLE 0 #define PTHREAD_CANCELED ((void *)-1) #define PTHREAD_CANCEL_DISABLE 0 #define PTHREAD_CANCEL_ENABLE 1 #define PTHREAD_CANCEL_DEFERRED 0 #define PTHREAD_CANCEL_ASYNCHRONOUS 1 #define PTHREAD_BARRIER_SERIAL_THREAD 2 #define _PTH_FLAGS_INIT64 2 #define PTHREAD_MUTEX_INITIALIZER {{ 0, 0, 0, 2, 0 }} #define PTHREAD_COND_INITIALIZER {{ 0, 0, 0, 2, 0 }} #define PTHREAD_RWLOCK_INITIALIZER {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }} #define PTHREAD_ONCE_INIT { 0, 0, 0, 0, 0, 0, 0, 2, 0 } #define __(args) args extern int pthread_attr_init (pthread_attr_t *); extern int pthread_attr_destroy (pthread_attr_t *); extern int pthread_attr_setstack (pthread_attr_t *, void *, size_t) ; extern int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *) ; extern int pthread_attr_setstacksize (pthread_attr_t *, size_t) ; extern int pthread_attr_getstacksize (const pthread_attr_t *, size_t *) ; extern int pthread_attr_setstackaddr (pthread_attr_t *, void *) ; extern int pthread_attr_getstackaddr (const pthread_attr_t *, void **) ; extern int pthread_attr_setschedpolicy (pthread_attr_t *, int) ; extern int pthread_attr_getschedpolicy (const pthread_attr_t *, int *) ; extern int pthread_attr_setschedparam (pthread_attr_t *, const struct sched_param *) ; extern int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *) ; extern int pthread_attr_setinheritsched (pthread_attr_t *, int) ; extern int pthread_attr_getinheritsched (const pthread_attr_t *, int *) ; extern int pthread_attr_setdetachstate (pthread_attr_t *, int) ; extern int pthread_attr_getdetachstate (const pthread_attr_t *, int *) ; extern int pthread_attr_setguardsize (pthread_attr_t *, size_t) ; extern int pthread_attr_getguardsize (const pthread_attr_t *, size_t *) ; extern int pthread_setschedparam (pthread_t, int, const struct sched_param *) ; extern int pthread_getschedparam (pthread_t, int *, struct sched_param *) ; extern int pthread_setschedprio (pthread_t, int) ; extern pthread_t pthread_self (void); extern int pthread_create (pthread_t *, const pthread_attr_t *, void *(*)(void *), void *) ; extern int pthread_detach (pthread_t); extern int pthread_join (pthread_t, void **) ; extern void pthread_exit (void *); extern void pthread_cleanup_push (void (*)(void *), void *); extern void pthread_cleanup_pop (int); extern int pthread_cancel (pthread_t); extern int pthread_attr_setscope (pthread_attr_t *, int) ; extern int pthread_attr_getscope (const pthread_attr_t *, int *) ; extern int pthread_equal (pthread_t, pthread_t) ; extern int pthread_kill (pthread_t, int) ; extern int pthread_checkpnt_pending (); #define pthread_equal(t1,t2) ((t1) == (t2)) extern int pthread_getcpuclockid (pthread_t, clockid_t *) ; extern int pthread_mutexattr_init (pthread_mutexattr_t *); extern int pthread_mutexattr_destroy (pthread_mutexattr_t *); extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *, int) ; extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *, int) ; extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *, int) ; extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *, int *) ; extern int pthread_mutexattr_settype (pthread_mutexattr_t *, int) ; extern int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *) ; extern int pthread_mutex_destroy (pthread_mutex_t *); extern int pthread_mutex_lock (pthread_mutex_t *); extern int pthread_mutex_timedlock (pthread_mutex_t *, const struct timespec *) ; extern int pthread_mutex_trylock (pthread_mutex_t *); extern int pthread_mutex_unlock (pthread_mutex_t *); extern int pthread_mutex_setprioceiling (pthread_mutex_t *, int, int *) ; extern int pthread_mutex_getprioceiling (const pthread_mutex_t *, int *) ; extern int pthread_condattr_init (pthread_condattr_t *); extern int pthread_condattr_destroy (pthread_condattr_t *); extern int pthread_condattr_getpshared (const pthread_condattr_t *, int *) ; extern int pthread_condattr_setpshared (pthread_condattr_t *, int) ; extern int pthread_condattr_getclock (const pthread_condattr_t *, clockid_t *) ; extern int pthread_condattr_setclock (pthread_condattr_t *, clockid_t) ; extern int pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *) ; extern int pthread_cond_destroy (pthread_cond_t *); extern int pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *) ; extern int pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, const struct timespec *) ; extern int pthread_cond_signal (pthread_cond_t *); extern int pthread_cond_broadcast (pthread_cond_t *); extern int pthread_key_create (pthread_key_t *, void (*)(void *)) ; extern int pthread_key_delete (pthread_key_t); extern void * pthread_getspecific (pthread_key_t); extern int pthread_setspecific (pthread_key_t, const void *) ; extern void pthread_testcancel (void); extern int pthread_setcancelstate (int, int *) ; extern int pthread_setcanceltype (int, int *) ; extern int pthread_once (pthread_once_t *, void (*)(void)) ; extern int pthread_rwlock_destroy (pthread_rwlock_t *); extern int pthread_rwlock_init (pthread_rwlock_t *, const pthread_rwlockattr_t *) ; extern int pthread_rwlock_rdlock (pthread_rwlock_t *); extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *); extern int pthread_rwlock_trywrlock (pthread_rwlock_t *); extern int pthread_rwlock_unlock (pthread_rwlock_t *); extern int pthread_rwlock_wrlock (pthread_rwlock_t *); extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *); extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *, int *) ; extern int pthread_rwlockattr_init (pthread_rwlockattr_t *); extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *, int) ; extern int pthread_atfork (void (*)(void), void (*)(void), void (*)(void)); extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *, const struct timespec *) ; extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *, const struct timespec *) ; extern int pthread_getconcurrency (void); extern int pthread_setconcurrency (int); extern int pthread_spin_init (pthread_spinlock_t *, int) ; extern int pthread_spin_destroy (pthread_spinlock_t *); extern int pthread_spin_lock (pthread_spinlock_t *); extern int pthread_spin_unlock (pthread_spinlock_t *); extern int pthread_spin_trylock (pthread_spinlock_t *); extern int pthread_barrierattr_init (pthread_barrierattr_t *); extern int pthread_barrierattr_destroy (pthread_barrierattr_t *); extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *, int *) ; extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *, int) ; extern int pthread_barrier_init (pthread_barrier_t *, const pthread_barrierattr_t *, unsigned) ; extern int pthread_barrier_destroy (pthread_barrier_t *); extern int pthread_barrier_wait (pthread_barrier_t *); extern int __pthread_trace; extern int __n_pthreads; #define LOG_GENERAL 1 #define LOG_LOCKS 2 #define LOG_DATA 4 #define LOG_CREATE 8 #define LOG_USCHED 16 #define LOG_CANCEL 32 #define LOG_SIGNAL 64 #define LOG_SUSPEND 128 #define LOG_MRQ 256 #define LOG_MRQ1 512 #define LOG_HANG 1024 #define LOG_LOCKBOOST 2048 #define MUTEX_FAST_NP 2 #define MUTEX_RECURSIVE_NP 1 #define MUTEX_NONRECURSIVE_NP 0 #define DEFAULT_SCHED SCHED_OTHER #define DEFAULT_PRIO PTHREAD_PRIO_MIN #define DEFAULT_INHERIT PTHREAD_INHERIT_SCHED #define PTHREAD_SCOPE_GLOBAL PTHREAD_SCOPE_SYSTEM #define PTHREAD_SCOPE_LOCAL PTHREAD_SCOPE_PROCESS #define DEFAULT_SCOPE PTHREAD_SCOPE_LOCAL #define PTHREAD_CREATE_UNDETACHED 0 #define PTHREAD_CREATE_SUSPENDED_NP 1 #define PTHREAD_CREATE_UNSUSPENDED_NP 0 #define DEFAULT_DETACHSTATE PTHREAD_CREATE_JOINABLE #define pthread_mutex_getowner_np(mutex) ((mutex)->__mt_word[4]) #define PTHREAD_SPECIFIC_DATA PAGESIZE #define APTHREAD_DATAKEYS_MAX (PTHREAD_SPECIFIC_DATA / 8) #define PTHREAD_STACK_MIN_NP (PAGESIZE * 2) #undef PTHREAD_THREADS_MAX #define PTHREAD_THREADS_MAX 512 struct __pthrdscontext { unsigned long long __pc_gpr[32]; unsigned long long __pc_msr; unsigned long long __pc_iar; unsigned long long __pc_lr; unsigned long long __pc_ctr; unsigned int __pc_cr; unsigned int __pc_xer; unsigned int __pc_fpscr; unsigned int __pc_fpscrx; unsigned long long __pc_except[1]; double __pc_fpr[32]; char __pc_fpeu; char __pc_fpinfo; unsigned char __pc_fpscr24_31; unsigned char __pc_pad; unsigned int __pc_mq; int __pc_excp_type; }; struct __pthrdsinfo { unsigned long long __pi_handle; pthread_t __pi_ptid; tid_t __pi_tid; int __pi_state; int __pi_suspendstate; void * __pi_exit; unsigned long __pi_ustk; void * __pi_func; void * __pi_arg; unsigned int __pi_siglevel; unsigned int __pi_frame_count; char * __pi_stackaddr; char * __pi_stackend; size_t __pi_stacksize; ulong __pi_pad[13]; struct __pthrdscontext __pi_context; }; struct __pthrdsinfox { struct __pthrdsinfo __pi; __extctx_t __pi_ec; }; typedef struct __pthrdstlsinfo { void *pti_vaddr; int pti_region; } PTHRDS_TLS_INFO; struct __pthrdscreds { uint __pc_flags; cred_ext_t __pc_cred; int __pc_reserved[9]; }; #define __pi_suspended __pi_suspendstate #define __pi_returned __pi_exit #define PTHRDSINFO_STATE_NOTSUP 0x00000100 #define PTHRDSINFO_STATE_IDLE 0x00000004 #define PTHRDSINFO_STATE_RUN 0x00000001 #define PTHRDSINFO_STATE_SLEEP 0x00000008 #define PTHRDSINFO_STATE_READY 0x00000002 #define PTHRDSINFO_STATE_TERM 0x00000010 #define PTHRDSINFO_SUSPENDSTATE_NOTSUP 0x00000100 #define PTHRDSINFO_SUSPENDSTATE_SUSPENDED 0x00000001 #define PTHRDSINFO_SUSPENDSTATE_UNSUSPENDED 0x00000000 #define PTHRDSINFO_SIGCTX_BASE ((unsigned int)-1) #define PTHRDSINFO_SIGCTX_INVALID ((unsigned int)-1) #define PTHRDSINFO_QUERY_GPRS 0x00000001 #define PTHRDSINFO_QUERY_SPRS 0x00000002 #define PTHRDSINFO_QUERY_FPRS 0x00000004 #define PTHRDSINFO_QUERY_REGS 0x0000000F #define PTHRDSINFO_QUERY_TID 0x00000010 #define PTHRDSINFO_QUERY_ALL 0x0000001F #define PTHRDSINFO_QUERY_SIGCTX 0x00000100 #define PTHRDSINFO_QUERY_EXTCTX 0x00000200 #define PTHRDSINFO_QUERY_TLS 0x00000400 #define PTHRDSINFO_RUSAGE_START 0x00000001 #define PTHRDSINFO_RUSAGE_STOP 0x00000002 #define PTHRDSINFO_RUSAGE_COLLECT 0x00000004 #define PTHRDSCREDS_INHERIT_UIDS 0x00000001 #define PTHRDSCREDS_INHERIT_GIDS 0x00000010 #define PTHRDSCREDS_INHERIT_GSETS 0x00000100 #define PTHRDSCREDS_INHERIT_CAPS 0x00001000 #define PTHRDSCREDS_INHERIT_PRIVS 0x00010000 #define PTHRDSCREDS_INHERIT_ALL 0x00011111 extern void __funcblock_np(); extern int pthread_getunique_np (pthread_t *, int *) ; extern int pthread_mutexattr_getkind_np (pthread_mutexattr_t *, int *) ; extern int pthread_geteffectiveprio_np (pthread_t , int *) ; extern int pthread_mutexattr_setkind_np (pthread_mutexattr_t *, int) ; extern int pthread_set_mutexattr_default_np (int); extern int pthread_signal_to_cancel_np (sigset_t *, pthread_t *) ; extern int pthread_delay_np (struct timespec *); extern int pthread_get_expiration_np (struct timespec *, struct timespec *) ; extern void pthread_lock_global_np (void); extern void pthread_unlock_global_np (void); extern int pthread_atfork_np (void *, void (*)(void *), void (*)(void *), void (*)(void *)) ; #define PTHREAD_ATFORK_ARGUMENT 0x00000001 #define PTHREAD_ATFORK_ALL 0x00000002 extern int pthread_atfork_unregister_np (void *, void (*)(), void (*)(), void (*)(), int) ; extern int pthread_test_exit_np (int *); extern void pthread_clear_exit_np (pthread_t); extern int pthread_setcancelstate_np (int, int *) ; extern int pthread_join_np (pthread_t, void **) ; extern void pthread_cleanup_push_np (void (*)(void *), void *, pthread_t *) ; extern void pthread_cleanup_pop_np (int, pthread_t) ; extern int pthread_cleanup_information_np (pthread_t, void *, tid_t *, void *, pthread_t *) ; extern int pthread_create_withcred_np (pthread_t *, const pthread_attr_t *, void *(*)(void *), void *, struct __pthrdscreds *) ; extern int sigthreadmask (int, const sigset_t *, sigset_t *) ; extern int pthread_attr_setsuspendstate_np (pthread_attr_t *, int) ; extern int pthread_attr_getsuspendstate_np (const pthread_attr_t *, int *) ; extern int pthread_suspend_np (pthread_t); extern int pthread_suspend_others_np (void); extern int pthread_suspend (pthread_t); extern int pthread_continue_np (pthread_t); extern int pthread_unsuspend_np (pthread_t); extern int pthread_continue_others_np (void); extern int pthread_unsuspend_others_np (void); extern int pthread_continue (pthread_t); extern int pthread_attr_setstacksize_np (pthread_attr_t *, size_t) ; extern int pthread_attr_setukeyset_np (pthread_attr_t *, unsigned long long *) ; extern int pthread_attr_getukeyset_np (const pthread_attr_t *, unsigned long long *) ; extern int pthread_getthrds_np (pthread_t *, int, struct __pthrdsinfo *, int, void *, int *) ; extern int pthread_getrusage_np (pthread_t, struct rusage *, int) ; #undef __ } 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; #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER #define __GTHREAD_TIME_INIT {0,0} #define __gthrw2(name,name2,type) #define __gthrw_(name) name #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) static inline int __gthread_active_p (void) { return 1; } static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return pthread_create (__threadid, (0), __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return pthread_join (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return pthread_detach (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return ((__t1) == (__t2)); } static inline __gthread_t __gthread_self (void) { return pthread_self (); } static inline int __gthread_yield (void) { return sched_yield (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return pthread_once (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return pthread_key_create (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return pthread_key_delete (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return pthread_getspecific (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return pthread_setspecific (__key, __ptr); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_destroy (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_lock (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_trylock (__mutex); else return 0; } static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return pthread_mutex_timedlock (__mutex, __abs_timeout); else return 0; } static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return pthread_mutex_unlock (__mutex); else return 0; } static inline int __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { if (__gthread_active_p ()) { pthread_mutexattr_t __attr; int __r; __r = pthread_mutexattr_init (&__attr); if (!__r) __r = pthread_mutexattr_settype (&__attr, 4); if (!__r) __r = pthread_mutex_init (__mutex, &__attr); if (!__r) __r = pthread_mutexattr_destroy (&__attr); return __r; } 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_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_mutex_timedlock (__mutex, __abs_timeout); } static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return pthread_cond_broadcast (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return pthread_cond_signal (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return 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 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_timedwait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return pthread_cond_destroy (__cond); } #pragma GCC visibility pop #define _GLIBCXX_ATOMIC_WORD_H 1 typedef int _Atomic_word; #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("isync":::"memory") #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("sync":::"memory") namespace __gnu_cxx { static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val) { return __sync_fetch_and_add(__mem, __val); } static inline void __atomic_add(volatile _Atomic_word* __mem, int __val) { __sync_fetch_and_add(__mem, __val); } static inline _Atomic_word __exchange_and_add_single(_Atomic_word* __mem, int __val) { _Atomic_word __result = *__mem; *__mem += __val; return __result; } static inline void __atomic_add_single(_Atomic_word* __mem, int __val) { *__mem += __val; } static inline _Atomic_word __attribute__ ((__unused__)) __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) { if (__gthread_active_p()) return __exchange_and_add(__mem, __val); else return __exchange_and_add_single(__mem, __val); } static inline void __attribute__ ((__unused__)) __atomic_add_dispatch(_Atomic_word* __mem, int __val) { if (__gthread_active_p()) __atomic_add(__mem, __val); else __atomic_add_single(__mem, __val); } } namespace std { template<typename _CharT, typename _Traits, typename _Alloc> class basic_string { typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; 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 typename _CharT_alloc_type::reference reference; typedef typename _CharT_alloc_type::const_reference const_reference; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator; typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string> const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; private: struct _Rep_base { size_type _M_length; size_type _M_capacity; _Atomic_word _M_refcount; }; struct _Rep : _Rep_base { typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc; static const size_type _S_max_size; static const _CharT _S_terminal; static size_type _S_empty_rep_storage[]; static _Rep& _S_empty_rep() { void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage); return *reinterpret_cast<_Rep*>(__p); } bool _M_is_leaked() const { return this->_M_refcount < 0; } bool _M_is_shared() const { return this->_M_refcount > 0; } void _M_set_leaked() { this->_M_refcount = -1; } void _M_set_sharable() { this->_M_refcount = 0; } void _M_set_length_and_sharable(size_type __n) { if (__builtin_expect(this != &_S_empty_rep(), false)) { this->_M_set_sharable(); this->_M_length = __n; traits_type::assign(this->_M_refdata()[__n], _S_terminal); } } _CharT* _M_refdata() throw() { return reinterpret_cast<_CharT*>(this + 1); } _CharT* _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2) { return (!_M_is_leaked() && __alloc1 == __alloc2) ? _M_refcopy() : _M_clone(__alloc1); } static _Rep* _S_create(size_type, size_type, const _Alloc&); void _M_dispose(const _Alloc& __a) { if (__builtin_expect(this != &_S_empty_rep(), false)) { ; if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) { ; _M_destroy(__a); } } } void _M_destroy(const _Alloc&) throw(); _CharT* _M_refcopy() throw() { if (__builtin_expect(this != &_S_empty_rep(), false)) __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1); return _M_refdata(); } _CharT* _M_clone(const _Alloc&, size_type __res = 0); }; struct _Alloc_hider : _Alloc { _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) { } _CharT* _M_p; }; public: static const size_type npos = static_cast<size_type>(-1); private: mutable _Alloc_hider _M_dataplus; _CharT* _M_data() const { return _M_dataplus._M_p; } _CharT* _M_data(_CharT* __p) { return (_M_dataplus._M_p = __p); } _Rep* _M_rep() const { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); } iterator _M_ibegin() const { return iterator(_M_data()); } iterator _M_iend() const { return iterator(_M_data() + this->size()); } void _M_leak() { if (!_M_rep()->_M_is_leaked()) _M_leak_hard(); } size_type _M_check(size_type __pos, const char* __s) const { if (__pos > this->size()) __throw_out_of_range((__s)); return __pos; } void _M_check_length(size_type __n1, size_type __n2, const char* __s) const { if (this->max_size() - (this->size() - __n1) < __n2) __throw_length_error((__s)); } size_type _M_limit(size_type __pos, size_type __off) const { const bool __testoff = __off < this->size() - __pos; return __testoff ? __off : this->size() - __pos; } bool _M_disjunct(const _CharT* __s) const { return (less<const _CharT*>()(__s, _M_data()) || less<const _CharT*>()(_M_data() + this->size(), __s)); } static void _M_copy(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::copy(__d, __s, __n); } static void _M_move(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::move(__d, __s, __n); } static void _M_assign(_CharT* __d, size_type __n, _CharT __c) { if (__n == 1) traits_type::assign(*__d, __c); else traits_type::assign(__d, __n, __c); } template<class _Iterator> static void _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) { for (; __k1 != __k2; ++__k1, ++__p) traits_type::assign(*__p, *__k1); } static void _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) { _M_copy(__p, __k1, __k2 - __k1); } static void _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) { _M_copy(__p, __k1, __k2 - __k1); } static int _S_compare(size_type __n1, size_type __n2) { const difference_type __d = difference_type(__n1 - __n2); if (__d > __gnu_cxx::__numeric_traits<int>::__max) return __gnu_cxx::__numeric_traits<int>::__max; else if (__d < __gnu_cxx::__numeric_traits<int>::__min) return __gnu_cxx::__numeric_traits<int>::__min; else return int(__d); } void _M_mutate(size_type __pos, size_type __len1, size_type __len2); void _M_leak_hard(); static _Rep& _S_empty_rep() { return _Rep::_S_empty_rep(); } public: basic_string() : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } explicit basic_string(const _Alloc& __a); basic_string(const basic_string& __str); basic_string(const basic_string& __str, size_type __pos, size_type __n = npos); basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a); basic_string(const _CharT* __s, size_type __n, const _Alloc& __a = _Alloc()); basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()); basic_string(basic_string&& __str) noexcept : _M_dataplus(__str._M_dataplus) { __str._M_data(_S_empty_rep()._M_refdata()); } basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()); template<class _InputIterator> basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc()); ~basic_string() noexcept { _M_rep()->_M_dispose(this->get_allocator()); } basic_string& operator=(const basic_string& __str) { return this->assign(__str); } basic_string& operator=(const _CharT* __s) { return this->assign(__s); } basic_string& operator=(_CharT __c) { this->assign(1, __c); return *this; } basic_string& operator=(basic_string&& __str) { this->swap(__str); return *this; } basic_string& operator=(initializer_list<_CharT> __l) { this->assign(__l.begin(), __l.size()); return *this; } iterator begin() noexcept { _M_leak(); return iterator(_M_data()); } const_iterator begin() const noexcept { return const_iterator(_M_data()); } iterator end() noexcept { _M_leak(); return iterator(_M_data() + this->size()); } const_iterator end() const noexcept { return const_iterator(_M_data() + this->size()); } reverse_iterator rbegin() noexcept { return reverse_iterator(this->end()); } const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(this->end()); } reverse_iterator rend() noexcept { return reverse_iterator(this->begin()); } const_reverse_iterator rend() const noexcept { return const_reverse_iterator(this->begin()); } const_iterator cbegin() const noexcept { return const_iterator(this->_M_data()); } const_iterator cend() const noexcept { return const_iterator(this->_M_data() + this->size()); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(this->end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(this->begin()); } public: size_type size() const noexcept { return _M_rep()->_M_length; } size_type length() const noexcept { return _M_rep()->_M_length; } size_type max_size() const noexcept { return _Rep::_S_max_size; } void resize(size_type __n, _CharT __c); void resize(size_type __n) { this->resize(__n, _CharT()); } void shrink_to_fit() { if (capacity() > size()) { try { reserve(0); } catch(...) { } } } size_type capacity() const noexcept { return _M_rep()->_M_capacity; } void reserve(size_type __res_arg = 0); void clear() noexcept { _M_mutate(0, this->size(), 0); } bool empty() const noexcept { return this->size() == 0; } const_reference operator[] (size_type __pos) const { ; return _M_data()[__pos]; } reference operator[](size_type __pos) { ; ; _M_leak(); return _M_data()[__pos]; } const_reference at(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(("basic_string::at")); return _M_data()[__n]; } reference front() { return operator[](0); } const_reference front() const { return operator[](0); } reference back() { return operator[](this->size() - 1); } const_reference back() const { return operator[](this->size() - 1); } reference at(size_type __n) { if (__n >= size()) __throw_out_of_range(("basic_string::at")); _M_leak(); return _M_data()[__n]; } basic_string& operator+=(const basic_string& __str) { return this->append(__str); } basic_string& operator+=(const _CharT* __s) { return this->append(__s); } basic_string& operator+=(_CharT __c) { this->push_back(__c); return *this; } basic_string& operator+=(initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.size()); } basic_string& append(const basic_string& __str); basic_string& append(const basic_string& __str, size_type __pos, size_type __n); basic_string& append(const _CharT* __s, size_type __n); basic_string& append(const _CharT* __s) { ; return this->append(__s, traits_type::length(__s)); } basic_string& append(size_type __n, _CharT __c); basic_string& append(initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.size()); } template<class _InputIterator> basic_string& append(_InputIterator __first, _InputIterator __last) { return this->replace(_M_iend(), _M_iend(), __first, __last); } void push_back(_CharT __c) { const size_type __len = 1 + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); traits_type::assign(_M_data()[this->size()], __c); _M_rep()->_M_set_length_and_sharable(__len); } basic_string& assign(const basic_string& __str); basic_string& assign(basic_string&& __str) { this->swap(__str); return *this; } basic_string& assign(const basic_string& __str, size_type __pos, size_type __n) { return this->assign(__str._M_data() + __str._M_check(__pos, "basic_string::assign"), __str._M_limit(__pos, __n)); } basic_string& assign(const _CharT* __s, size_type __n); basic_string& assign(const _CharT* __s) { ; return this->assign(__s, traits_type::length(__s)); } basic_string& assign(size_type __n, _CharT __c) { return _M_replace_aux(size_type(0), this->size(), __n, __c); } template<class _InputIterator> basic_string& assign(_InputIterator __first, _InputIterator __last) { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } basic_string& assign(initializer_list<_CharT> __l) { return this->assign(__l.begin(), __l.size()); } void insert(iterator __p, size_type __n, _CharT __c) { this->replace(__p, __p, __n, __c); } template<class _InputIterator> void insert(iterator __p, _InputIterator __beg, _InputIterator __end) { this->replace(__p, __p, __beg, __end); } void insert(iterator __p, initializer_list<_CharT> __l) { ; this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); } basic_string& insert(size_type __pos1, const basic_string& __str) { return this->insert(__pos1, __str, size_type(0), __str.size()); } basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { return this->insert(__pos1, __str._M_data() + __str._M_check(__pos2, "basic_string::insert"), __str._M_limit(__pos2, __n)); } basic_string& insert(size_type __pos, const _CharT* __s, size_type __n); basic_string& insert(size_type __pos, const _CharT* __s) { ; return this->insert(__pos, __s, traits_type::length(__s)); } basic_string& insert(size_type __pos, size_type __n, _CharT __c) { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), size_type(0), __n, __c); } iterator insert(iterator __p, _CharT __c) { ; const size_type __pos = __p - _M_ibegin(); _M_replace_aux(__pos, size_type(0), size_type(1), __c); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } basic_string& erase(size_type __pos = 0, size_type __n = npos) { _M_mutate(_M_check(__pos, "basic_string::erase"), _M_limit(__pos, __n), size_type(0)); return *this; } iterator erase(iterator __position) { ; const size_type __pos = __position - _M_ibegin(); _M_mutate(__pos, size_type(1), size_type(0)); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } iterator erase(iterator __first, iterator __last); basic_string& replace(size_type __pos, size_type __n, const basic_string& __str) { return this->replace(__pos, __n, __str._M_data(), __str.size()); } basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { return this->replace(__pos1, __n1, __str._M_data() + __str._M_check(__pos2, "basic_string::replace"), __str._M_limit(__pos2, __n2)); } basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2); basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s) { ; return this->replace(__pos, __n1, __s, traits_type::length(__s)); } basic_string& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), _M_limit(__pos, __n1), __n2, __c); } basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str) { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { ; return this->replace(__i1, __i2, __s, traits_type::length(__s)); } basic_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { ; return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); } template<class _InputIterator> basic_string& replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2) { ; ; typedef typename std::__is_integer<_InputIterator>::__type _Integral; return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); } basic_string& replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2) { ; ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, initializer_list<_CharT> __l) { return this->replace(__i1, __i2, __l.begin(), __l.end()); } private: template<class _Integer> basic_string& _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, _Integer __val, __true_type) { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } template<class _InputIterator> basic_string& _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, __false_type); basic_string& _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c); basic_string& _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2); template<class _InIterator> static _CharT* _S_construct_aux(_InIterator __beg, _InIterator __end, const _Alloc& __a, __false_type) { typedef typename iterator_traits<_InIterator>::iterator_category _Tag; return _S_construct(__beg, __end, __a, _Tag()); } template<class _Integer> static _CharT* _S_construct_aux(_Integer __beg, _Integer __end, const _Alloc& __a, __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<class _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()); } template<class _InIterator> static _CharT* _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, input_iterator_tag); template<class _FwdIterator> static _CharT* _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, forward_iterator_tag); static _CharT* _S_construct(size_type __req, _CharT __c, const _Alloc& __a); public: size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const; void swap(basic_string& __s); const _CharT* c_str() const noexcept { return _M_data(); } const _CharT* data() const noexcept { return _M_data(); } allocator_type get_allocator() const noexcept { return _M_dataplus; } size_type find(const _CharT* __s, size_type __pos, size_type __n) const; size_type find(const basic_string& __str, size_type __pos = 0) const noexcept { return this->find(__str.data(), __pos, __str.size()); } size_type find(const _CharT* __s, size_type __pos = 0) const { ; return this->find(__s, __pos, traits_type::length(__s)); } size_type find(_CharT __c, size_type __pos = 0) const noexcept; size_type rfind(const basic_string& __str, size_type __pos = npos) const noexcept { return this->rfind(__str.data(), __pos, __str.size()); } size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; size_type rfind(const _CharT* __s, size_type __pos = npos) const { ; return this->rfind(__s, __pos, traits_type::length(__s)); } size_type rfind(_CharT __c, size_type __pos = npos) const noexcept; size_type find_first_of(const basic_string& __str, size_type __pos = 0) const noexcept { return this->find_first_of(__str.data(), __pos, __str.size()); } size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { ; return this->find_first_of(__s, __pos, traits_type::length(__s)); } size_type find_first_of(_CharT __c, size_type __pos = 0) const noexcept { return this->find(__c, __pos); } size_type find_last_of(const basic_string& __str, size_type __pos = npos) const noexcept { return this->find_last_of(__str.data(), __pos, __str.size()); } size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { ; return this->find_last_of(__s, __pos, traits_type::length(__s)); } size_type find_last_of(_CharT __c, size_type __pos = npos) const noexcept { return this->rfind(__c, __pos); } size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const noexcept { return this->find_first_not_of(__str.data(), __pos, __str.size()); } size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { ; return this->find_first_not_of(__s, __pos, traits_type::length(__s)); } size_type find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept; size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const noexcept { return this->find_last_not_of(__str.data(), __pos, __str.size()); } size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const { ; return this->find_last_not_of(__s, __pos, traits_type::length(__s)); } size_type find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept; basic_string substr(size_type __pos = 0, size_type __n = npos) const { return basic_string(*this, _M_check(__pos, "basic_string::substr"), __n); } int compare(const basic_string& __str) const { 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(_M_data(), __str.data(), __len); if (!__r) __r = _S_compare(__size, __osize); return __r; } int compare(size_type __pos, size_type __n, const basic_string& __str) const; int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const; int compare(const _CharT* __s) const; int compare(size_type __pos, size_type __n1, const _CharT* __s) const; int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const; }; template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { basic_string<_CharT, _Traits, _Alloc> __str(__lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { basic_string<_CharT, _Traits, _Alloc> __str(__lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) { typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; __string_type __str(__lhs); __str.append(__size_type(1), __rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, basic_string<_CharT, _Traits, _Alloc>&& __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> inline basic_string<_CharT, _Traits, _Alloc> operator+(const _CharT* __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(_CharT __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, 1, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, const _CharT* __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, _CharT __rhs) { return std::move(__lhs.append(1, __rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) == 0; } template<typename _CharT> inline typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type operator==(const basic_string<_CharT>& __lhs, const basic_string<_CharT>& __rhs) { return (__lhs.size() == __rhs.size() && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), __lhs.size())); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) == 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) == 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return !(__lhs == __rhs); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return !(__lhs == __rhs); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return !(__lhs == __rhs); } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) < 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) < 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) > 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) > 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) > 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) < 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) <= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) <= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) >= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) >= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) >= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) <= 0; } template<typename _CharT, typename _Traits, typename _Alloc> inline void swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>& __rhs) { __lhs.swap(__rhs); } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str); template<> basic_istream<char>& operator>>(basic_istream<char>& __is, basic_string<char>& __str); template<typename _CharT, typename _Traits, typename _Alloc> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Alloc>& __str) { return __ostream_insert(__os, __str.data(), __str.size()); } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); template<typename _CharT, typename _Traits, typename _Alloc> inline basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str) { return getline(__is, __str, __is.widen('\n')); } template<> basic_istream<char>& getline(basic_istream<char>& __in, basic_string<char>& __str, char __delim); template<> basic_istream<wchar_t>& getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str, wchar_t __delim); } #define _STRING_CONVERSIONS_H 1 #define _GLIBCXX_CSTDLIB 1 #define _H_STDLIB extern "C" { typedef struct div_t { int quot; int rem; } div_t; typedef struct ldiv_t { long int quot; long int rem; } ldiv_t; #define EXIT_FAILURE (1) #define EXIT_SUCCESS 0 #define RAND_MAX 32767 extern size_t __getmbcurmax (void); extern int __getmaxdispwidth (void); #define MB_CUR_MAX (__getmbcurmax()) #define __max_disp_width (__getmaxdispwidth()) extern double strtod(const char * , char ** ); extern long int strtol(const char * , char ** , int); extern unsigned long int strtoul(const char * , char ** , int); extern void _Exit(int); extern float strtof(const char * , char ** ); typedef struct lldiv_t { long long int quot; long long int rem ; } lldiv_t; extern long long int atoll(const char *); extern long long int llabs( long long int ); extern lldiv_t lldiv( long long int, long long int ); extern long long int strtoll( const char * , char ** , int ); extern unsigned long long int strtoull( const char * , char ** , int ); #define _STRTOLD static long double strtold(const char * __a, char ** __b) { return ((long double)strtod (__a, __b)); } extern int mblen(const char *, size_t); extern size_t mbstowcs(wchar_t * , const char * , size_t); extern int mbtowc(wchar_t * , const char * , size_t); extern size_t wcstombs(char * , const wchar_t * , size_t); extern int wctomb(char *, const wchar_t); extern double atof(const char *); extern int atoi(const char *); extern long int atol(const char *); extern int rand(void); extern void srand(unsigned int); extern void *calloc(size_t, size_t); extern void free(void *); extern void *malloc(size_t); extern void *realloc(void *, size_t); extern void abort(void); extern int atexit(void (*)(void)); extern void exit(int); extern char *getenv(const char *); extern int system(const char *); extern void *bsearch(const void *, const void *, size_t, size_t, int(*)(const void *,const void *)); extern void qsort(void *, size_t, size_t, int(*)(const void *,const void *)); extern int abs(int); extern struct div_t div(int, int); extern long int labs(long int); extern struct ldiv_t ldiv(long int, long int); extern int posix_memalign(void **,size_t,size_t); #define _H_WAIT #undef _STD_TYPES_T extern "C" { #define _H_SYS_SIGNAL extern "C" { extern void (*signal(int, void (*)(int)))(int); extern int raise(int); typedef int sig_atomic_t; #define SIGMAX64 255 #define SIGMAX32 63 #define SIGMAX SIGMAX32 #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGEMT 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGBUS 10 #define SIGSEGV 11 #define SIGSYS 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGURG 16 #define SIGSTOP 17 #define SIGTSTP 18 #define SIGCONT 19 #define SIGCHLD 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGIO 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGMSG 27 #define SIGWINCH 28 #define SIGPWR 29 #define SIGUSR1 30 #define SIGUSR2 31 #define SIGPROF 32 #define SIGDANGER 33 #define SIGVTALRM 34 #define SIGMIGRATE 35 #define SIGPRE 36 #define SIGVIRT 37 #define SIGALRM1 38 #define SIGWAITING 39 #define SIGRECONFIG 58 #define SIGCPUFAIL 59 #define SIGKAP 60 #define SIGGRANT SIGKAP #define SIGRETRACT 61 #define SIGSOUND 62 #define SIGSAK 63 #define SIGIOINT SIGURG #define SIGAIO SIGIO #define SIGPTY SIGIO #define SIGIOT SIGABRT #define SIGCLD SIGCHLD #define SIGLOST SIGIOT #define SIGPOLL SIGIO #define SIG_DFL (void (*)(int))0 #define SIG_IGN (void (*)(int))1 #define SIG_HOLD (void (*)(int))2 #define SIG_CATCH (void (*)(int))3 #define SIG_ERR (void (*)(int))-1 #define SIG_BLOCK 0 #define SIG_UNBLOCK 1 #define SIG_SETMASK 2 union sigval { void * sival_ptr; int sival_int; }; typedef struct { int si_signo; int si_errno; int si_code; pid_t si_pid; uid_t si_uid; void *si_addr; int si_status; long si_band; union sigval si_value; int __si_flags; int __pad[6]; } siginfo_t; struct sigaction { union { void (*__su_handler)(int); void (*__su_sigaction) (int, siginfo_t *, void *); } sa_union; sigset_t sa_mask; int sa_flags; }; #define sa_handler sa_union.__su_handler #define sa_sigaction sa_union.__su_sigaction #define SA_NOCLDSTOP 0x00000004 struct sigstack { void *ss_sp; int ss_onstack; }; #define SA_ONSTACK 0x00000001 #define SA_RESTART 0x00000008 #define SA_RESETHAND 0x00000002 #define SA_SIGINFO 0x00000100 #define SA_NODEFER 0x00000200 #define SA_NOCLDWAIT 0x00000400 #define SS_ONSTACK 0x00000001 #define SS_DISABLE 0x00000002 #define SI_USER 0 #define SI_UNDEFINED 8 #define SI_EMPTY 9 #define BUS_ADRALN 1 #define BUS_ADRERR 2 #define BUS_OBJERR 3 #define BUS_UEGARD 4 #define CLD_EXITED 10 #define CLD_KILLED 11 #define CLD_DUMPED 12 #define CLD_TRAPPED 13 #define CLD_STOPPED 14 #define CLD_CONTINUED 15 #define FPE_INTDIV 20 #define FPE_INTOVF 21 #define FPE_FLTDIV 22 #define FPE_FLTOVF 23 #define FPE_FLTUND 24 #define FPE_FLTRES 25 #define FPE_FLTINV 26 #define FPE_FLTSUB 27 #define ILL_ILLOPC 30 #define ILL_ILLOPN 31 #define ILL_ILLADR 32 #define ILL_ILLTRP 33 #define ILL_PRVOPC 34 #define ILL_PRVREG 35 #define ILL_COPROC 36 #define ILL_BADSTK 37 #define POLL_IN 40 #define POLL_OUT 41 #define POLL_MSG -3 #define POLL_ERR 43 #define POLL_PRI 44 #define POLL_HUP 45 #define SEGV_MAPERR 50 #define SEGV_ACCERR 51 #define SEGV_KEYERR 52 #define TRAP_BRKPT 60 #define TRAP_TRACE 61 #define SI_QUEUE 71 #define SI_TIMER 72 #define SI_ASYNCIO 73 #define SI_MESGQ 74 #define SI_WPDABR 1 #define SI_FAST_WATCH 2 #define SI_WP_SYSCALL 3 extern int sigmask(int); #define sigmask(__m) (1 << ((__m)-1)) #define _STACK_FLOOR 256 #define MINSIGSTKSZ ((sizeof (ucontext_t))+2*_STACK_FLOOR) #define SIGSTKSZ 4096 struct sigevent { union sigval sigev_value; int sigev_signo; int sigev_notify; void (*sigev_notify_function)(union sigval); pthread_attr_t * sigev_notify_attributes; }; #define SIGEV_NONE 1 #define SIGEV_SIGNAL 2 #define SIGEV_THREAD 3 #define SIGRTMIN 50 #define SIGRTMAX 57 struct osigevent { void *sevt_value; signal_t sevt_signo; }; #define BADSIG SIG_ERR #define SA_OLDSTYLE SA_RESETHAND #define SA_NODUMP 0x00000010 #define SA_PARTDUMP 0x00000020 #define SA_FULLDUMP 0x00000040 #define SA_SIGSETSTYLE 0x00000080 #define sigcontext __sigcontext #define NO_VOLATILE_REGS 0x0001 #define USE_SAVE_AREA 0x0002 #define SIGMASKLO(__s) ( 1 << ((__s) - 1) ) #define SIGMASKHI(__s) ( 1 << (((__s)-32) - 1) ) #define LOW_SIG(__s) ((__s) <= 32 ) #define SIGMASK(__s) (1<<(((__s)-1)%32)) #define SIGFILLSET(__set) { (__set).losigs = ~0; (__set).hisigs = ~0; } #define SIGDELSET(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) &= ~(1<<(((__s)-1)%32));} #define SIGADDSET(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) |= (1<<(((__s)-1)%32));} #define SIGSETEMPTY(__set) (!((__set).losigs) && !((__set).hisigs)) #define SIGISMEMBER(__set,__s) ( (*((&(__set).losigs)+(((__s)-1)/32)) >> (((__s)-1)%32) ) & 1 ) #define SIG_PENDING(__p) (( (__p)->p_sig.losigs & ~((__p)->p_sigignore.losigs | (__p)->p_sigmask.losigs) ) || ( (__p)->p_sig.hisigs & ~((__p)->p_sigignore.hisigs | (__p)->p_sigmask.hisigs) )) #define SIGINITSET(__set) { (__set).losigs = 0; (__set).hisigs = 0; } #define SIGMASKSET(__dest,__mask) { (__dest).losigs &= ~(__mask).losigs; (__dest).hisigs &= ~(__mask).hisigs; } #define SIGORSET(__dest,__mask) { (__dest).losigs |= (__mask).losigs; (__dest).hisigs |= (__mask).hisigs; } #define SIGANDSET(__dest,__m1,__m2) { (__dest).losigs = (__m1).losigs & (__m2).losigs; (__dest).hisigs = (__m1).hisigs & (__m2).hisigs; } #define SIGSETTOLLONG(__set,__ll) { *(int *)&(__ll) = (__set).hisigs; *((int *)&(__ll)+1) = (__set).losigs; } #define LLONGTOSIGSET(__ll,__set) { (__set).hisigs = *(int *)&(__ll); (__set).losigs = *((int *)&(__ll)+1); } #define SIGFILLSET64(__set) { *(__set).ss_set = ~(0ULL); *((__set).ss_set + 1) = ~(0ULL); *((__set).ss_set + 2) = ~(0ULL); *((__set).ss_set + 3) = ~(0ULL); } #define SIGINITSET64(__set) { *(__set).ss_set = 0ULL; *((__set).ss_set + 1) = 0ULL; *((__set).ss_set + 2) = 0ULL; *((__set).ss_set + 3) = 0ULL; } #define SIGDELSET64(__set,__s) {*((__set).ss_set+(((__s)-1)/64)) &= ~(1ULL<<(((__s)-1)%64));} #define SIGADDSET64(__set,__s) {*((__set).ss_set+(((__s)-1)/64)) |= (1ULL<<(((__s)-1)%64));} #define SIGSETEMPTY64(__set) (!*(__set).ss_set && !*((__set).ss_set + 1) && !*((__set).ss_set + 2) && !*((__set).ss_set + 3)) #define SIGISMEMBER64(__set,__s) ((*((__set).ss_set+(((__s)-1)/64)) >> (((__s)-1)%64))&1ULL) #define SIG_PENDING64(__p) (( *(__p)->p_sig & ~(*(__p)->p_sigignore.ss_set | *(__p)->p_sigmask.ss_set) ) || ( *((__p)->p_sig + 1) & ~(*((__p)->p_sigignore.ss_set + 1) | *((__p)->p_sigmask.ss_set + 1))) || ( *((__p)->p_sig + 2) & ~(*((__p)->p_sigignore.ss_set + 2) | *((__p)->p_sigmask.ss_set + 2))) || ( *((__p)->p_sig + 3) & ~(*((__p)->p_sigignore.ss_set + 3) | *((__p)->p_sigmask.ss_set + 3))) ) #define SIGMASKSET64(__dest,__mask) { *(__dest).ss_set &= ~*(__mask).ss_set; *((__dest).ss_set + 1) &= ~*((__mask).ss_set + 1); *((__dest).ss_set + 2) &= ~*((__mask).ss_set + 2); *((__dest).ss_set + 3) &= ~*((__mask).ss_set + 3); } #define SIGORSET64(__dest,__mask) { *(__dest).ss_set |= *(__mask).ss_set; *((__dest).ss_set + 1) |= *((__mask).ss_set + 1); *((__dest).ss_set + 2) |= *((__mask).ss_set + 2); *((__dest).ss_set + 3) |= *((__mask).ss_set + 3); } #define SIGANDSET64(__dest,__m1,__m2) { *(__dest).ss_set = *(__m1).ss_set & *(__m2).ss_set; *((__dest).ss_set + 1) = *((__m1).ss_set + 1) & *((__m2).ss_set + 1); *((__dest).ss_set + 2) = *((__m1).ss_set + 2) & *((__m2).ss_set + 2); *((__dest).ss_set + 3) = *((__m1).ss_set + 3) & *((__m2).ss_set + 3); } #define SIGMASKLO32(__s) ( 1 << ((__s) - 1) ) #define SIGMASKHI32(__s) ( 1 << (((__s)-32) - 1) ) #define LOW_SIG32(__s) ((__s) <= 32 ) #define SIGMASK32(__s) (1<<(((__s)-1)%32)) #define SIGFILLSET32(__set) { (__set).losigs = ~0; (__set).hisigs = ~0; } #define SIGDELSET32(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) &= ~(1<<(((__s)-1)%32));} #define SIGADDSET32(__set,__s) {*((&(__set).losigs)+(((__s)-1)/32)) |= (1<<(((__s)-1)%32));} #define SIGSETEMPTY32(__set) (!((__set).losigs) && !((__set).hisigs)) #define SIGISMEMBER32(__set,__s) ( (*((&(__set).losigs)+(((__s)-1)/32)) >> (((__s)-1)%32) ) & 1 ) #define SIG_PENDING32(__p) (( (__p)->p_sig.losigs & ~((__p)->p_sigignore.losigs | (__p)->p_sigmask.losigs) ) || ( (__p)->p_sig.hisigs & ~((__p)->p_sigignore.hisigs | (__p)->p_sigmask.hisigs) )) #define SIGINITSET32(__set) { (__set).losigs = 0; (__set).hisigs = 0; } #define SIGMASKSET32(__dest,__mask) { (__dest).losigs &= ~(__mask).losigs; (__dest).hisigs &= ~(__mask).hisigs; } #define SIGORSET32(__dest,__mask) { (__dest).losigs |= (__mask).losigs; (__dest).hisigs |= (__mask).hisigs; } #define SIGANDSET32(__dest,__m1,__m2) { (__dest).losigs = (__m1).losigs & (__m2).losigs; (__dest).hisigs = (__m1).hisigs & (__m2).hisigs; } struct sigvec { union { void (*sv_handler)(int); void (*sv_sigaction) (int, siginfo_t *, void *); } sv_union; int sv_mask; int sv_flags; }; #define sv_onstack sv_flags #define sv_handler sv_union.sv_handler #define sv_sigaction sv_union.sv_sigaction #define NSIG64 (SIGMAX64+1) #define NSIG32 (SIGMAX32+1) #define NSIG NSIG32 #define SIG_STK SA_ONSTACK #define SIG_STD SA_OLDSTYLE #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART #define _OLDSTYLE (SA_OLDSTYLE) #define _ONSTACK (SA_ONSTACK) #define _teststyle(__n) ((__n) & _OLDSTYLE) #define _testonstack(__n) ((__n) & _ONSTACK) #define _setoldstyle(__n) ((__n) | _OLDSTYLE) #define _setnewstyle(__n) ((__n) & ~_OLDSTYLE) #define _setonstack(__n) ((__n) | _ONSTACK) #define _clronstack(__n) ((__n) & ~_ONSTACK) void (*ssignal_r(int, void (*)(int), void (*[])(int)))(int); int gsignal_r(int, void (*[])(int)); #define MAXSIG 16 #define MINSIG (-4) #define TOT_USER_SIG (MAXSIG - MINSIG + 1) extern int sigblock(int); extern int siglocalmask(int, const sigset_t *); extern int sigvec(int, struct sigvec *, struct sigvec *); extern int siggetmask(void); extern int sigsetmask(int); extern int kill(pid_t, int); extern int sigprocmask(int, const sigset_t *, sigset_t *); extern int sigsuspend(const sigset_t *); extern int sigwait(const sigset_t *, int *); extern int sigaction(int, const struct sigaction *, struct sigaction *); extern int sigemptyset(sigset_t *); extern int sigfillset(sigset_t *); extern int sigaddset(sigset_t *, int); extern int sigdelset(sigset_t *, int); extern int sigismember(const sigset_t *, int); extern int sigpending(sigset_t *); extern void (*bsd_signal (int, void (*)(int)))(int); extern int killpg(pid_t, int); extern int sighold(int); extern int sigignore(int); extern int siginterrupt(int, int); extern int sigpause(int); extern int sigrelse(int); extern void (*sigset(int, void(*)(int)))(int); extern int sigaltstack(const stack_t *, stack_t *); extern int sigstack(struct sigstack *, struct sigstack *); extern int pthread_kill(pthread_t, int); extern int pthread_sigmask(int, const sigset_t *, sigset_t *); extern int sigqueue(pid_t, int, const union sigval); struct timespec; extern int sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *); extern int sigwaitinfo(const sigset_t *, siginfo_t *); } #define WNOHANG 0x1 #define WUNTRACED 0x2 #define _W_STOPPED 0x00000040 #define _W_SLWTED 0x0000007c #define _W_SEWTED 0x0000007d #define _W_SFWTED 0x0000007e #define _W_STRC 0x0000007f #define WIFSTOPPED(__x) ((__x) & _W_STOPPED) #define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? (int)((((unsigned int)__x) >> 8) & 0xff) : -1) #define WIFEXITED(__x) (!((__x) & 0xff)) #define WEXITSTATUS(__x) (int)(WIFEXITED(__x) ? (int)((((unsigned int)__x) >> 8) & 0xff) : -1) #define WIFSIGNALED(__x) (!WIFEXITED(__x) && !WIFSTOPPED(__x)) #define WTERMSIG(__x) (int)(WIFSIGNALED(__x) ? (int)((((unsigned int)__x) >> 16) & 0xff) : -1) #define WEXITED 0x04 #define WSTOPPED _W_STOPPED #define _W_OCONTINUED 0x00000008 #define WCONTINUED 0x01000000 #define WNOWAIT 0x10 #define WIFCONTINUED(__x) ((__x) & WCONTINUED) #undef WIFSIGNALED #define WIFSIGNALED(__x) (!WIFEXITED(__x) && !WIFSTOPPED(__x) && !WIFCONTINUED(__x)) typedef enum {P_ALL, P_PID, P_PGID} idtype_t; extern pid_t wait(int *); extern pid_t waitpid(pid_t, int *, int); extern int waitid(idtype_t, id_t, siginfo_t *, int); extern pid_t wait3(int *, int, struct rusage *); extern pid_t kwaitpid(int *, pid_t, int, struct rusage *, siginfo_t *); extern pid_t kwaitpid64(int *, pid_t, int, struct rusage64 *, siginfo_t *); extern pid_t wait364(int *, int, struct rusage64 *); extern pid_t wait4(pid_t, int *, int, struct rusage *); #define W_STOPPED _W_STOPPED #define W_SLWTED _W_SLWTED #define W_SEWTED _W_SEWTED #define W_SFWTED _W_SFWTED #define W_STRC _W_STRC } typedef struct drand48_data { unsigned x[3]; unsigned a[3]; unsigned c; unsigned short lastx[3]; int init; } DRAND48D; extern double drand48(void); extern double erand48(unsigned short[]); extern long jrand48(unsigned short[]); extern void lcong48(unsigned short int *); extern long lrand48(void); extern long mrand48(void); extern long nrand48(unsigned short[]); extern unsigned short *seed48(unsigned short[]); extern void setkey(const char *); extern void srand48(long); extern int putenv(char *); extern int rand_r(unsigned int *); extern int getopt_r( int, char* const*, const char*, int *, char **, int *, int , int *, int *); extern int drand48_r(DRAND48D *, double *); extern int erand48_r(unsigned short [], DRAND48D *, double *); extern int lrand48_r(DRAND48D *, long *); extern int mrand48_r(DRAND48D *, long *); extern int srand48_r(long, DRAND48D *); extern int seed48_r(unsigned short [], DRAND48D *); extern int lcong48_r(unsigned short [], DRAND48D *); extern int nrand48_r(unsigned short [], DRAND48D *, long *); extern int jrand48_r(unsigned short [], DRAND48D *, long *); extern int ecvt_r(double, int, int *, int *, char *, int); extern int fcvt_r(double, int, int *, int *, char *, int); extern long a64l(const char *); extern char *ecvt(double, int, int *, int *); extern char *fcvt(double, int, int *, int *); extern char *gcvt(double, int, char *); extern int getsubopt(char **, char *const *, char **); extern int grantpt(int); extern char *initstate(unsigned, char *, size_t); extern char *l64a(long); extern char *mktemp(char *); extern int mkstemp(char *); extern int mkstemp64(char *); extern char *ptsname(int); extern long random(void); extern char *realpath(const char *, char *); extern char *setstate(const char *); extern void srandom(unsigned); extern int unlockpt(int); extern int posix_openpt (int); extern int setenv (const char *, const char *, int); extern int unsetenv (const char *); typedef struct random_data { int *fptr; int *rptr; int *state; int rand_type; int rand_deg; int rand_sep; int *end_ptr; } RANDOMD; extern int srandom_r(unsigned, RANDOMD *); extern int initstate_r(unsigned, char *, size_t, char **,RANDOMD *); extern int setstate_r(char *, char **, RANDOMD *); extern int random_r(long *, RANDOMD *); extern int l64a_r(long, char*, int); #undef MB_CUR_MAX #undef __max_disp_width #define MB_CUR_MAX (__OBJ_DATA(*__lc_charmap_ptr)->cm_mb_cur_max) #define __max_disp_width (__OBJ_DATA(*__lc_charmap_ptr)->cm_max_disp_width) #define __XMB_CUR_MAX(__cmap) (__OBJ_DATA(*__cmap)->cm_mb_cur_max) #define __x__max_disp_width(__cmap) (__OBJ_DATA(*__cmap)->cm_max_disp_width) extern char *optarg; extern int optind; extern int opterr; #define ATEXIT_MAX 2048 extern float atoff(char *); extern void imul_dbl(long, long, long *); extern void umul_dbl(unsigned long, unsigned long, unsigned long *); extern int on_exit(void (*)(int, void *), void *); extern int unatexit(void (*)(void)); extern double wcstod(const wchar_t *, wchar_t **); extern long int wcstol(const wchar_t *, wchar_t **, int); extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int); extern int rpmatch(const char *); extern int clearenv(void); extern int getopt(int, char* const*, const char*); extern char *getpass(const char *); extern int ttyslot(void); extern void *valloc(size_t); extern void *vec_malloc(size_t); extern void *vec_calloc(size_t, size_t); #define vec_realloc realloc #define vec_free free } #undef abort #undef abs #undef atexit #undef atof #undef atoi #undef atol #undef bsearch #undef calloc #undef div #undef exit #undef free #undef getenv #undef labs #undef ldiv #undef malloc #undef mblen #undef mbstowcs #undef mbtowc #undef qsort #undef rand #undef realloc #undef srand #undef strtod #undef strtol #undef strtoul #undef system #undef wcstombs #undef wctomb namespace std { using ::div_t; using ::ldiv_t; using ::abort; using ::abs; using ::atexit; using ::atof; using ::atoi; using ::atol; using ::bsearch; using ::calloc; using ::div; using ::exit; using ::free; using ::getenv; using ::labs; using ::ldiv; using ::malloc; using ::mblen; using ::mbstowcs; using ::mbtowc; using ::qsort; using ::rand; using ::realloc; using ::srand; using ::strtod; using ::strtol; using ::strtoul; using ::system; using ::wcstombs; using ::wctomb; inline long abs(long __i) { return labs(__i); } inline ldiv_t div(long __i, long __j) { return ldiv(__i, __j); } } #undef _Exit #undef llabs #undef lldiv #undef atoll #undef strtoll #undef strtoull #undef strtof #undef strtold namespace __gnu_cxx { using ::lldiv_t; using ::_Exit; inline long long abs(long long __x) { return __x >= 0 ? __x : -__x; } using ::llabs; inline lldiv_t div(long long __n, long long __d) { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } using ::lldiv; using ::atoll; using ::strtoll; using ::strtoull; using ::strtof; using ::strtold; } namespace std { using ::__gnu_cxx::lldiv_t; using ::__gnu_cxx::_Exit; using ::__gnu_cxx::abs; using ::__gnu_cxx::llabs; using ::__gnu_cxx::div; using ::__gnu_cxx::lldiv; using ::__gnu_cxx::atoll; using ::__gnu_cxx::strtof; using ::__gnu_cxx::strtoll; using ::__gnu_cxx::strtoull; using ::__gnu_cxx::strtold; } namespace std { using std::lldiv_t; using std::llabs; using std::lldiv; using std::atoll; using std::strtoll; using std::strtoull; using std::strtof; using std::strtold; using std::abs; using std::div; } #define __need___va_list #undef __need___va_list #define _GLIBCXX_CSTDIO 1 #undef clearerr #undef fclose #undef feof #undef ferror #undef fflush #undef fgetc #undef fgetpos #undef fgets #undef fopen #undef fprintf #undef fputc #undef fputs #undef fread #undef freopen #undef fscanf #undef fseek #undef fsetpos #undef ftell #undef fwrite #undef getc #undef getchar #undef gets #undef perror #undef printf #undef putc #undef putchar #undef puts #undef remove #undef rename #undef rewind #undef scanf #undef setbuf #undef setvbuf #undef sprintf #undef sscanf #undef tmpfile #undef tmpnam #undef ungetc #undef vfprintf #undef vprintf #undef vsprintf namespace std { using ::FILE; using ::fpos_t; using ::clearerr; using ::fclose; using ::feof; using ::ferror; using ::fflush; using ::fgetc; using ::fgetpos; using ::fgets; using ::fopen; using ::fprintf; using ::fputc; using ::fputs; using ::fread; using ::freopen; using ::fscanf; using ::fseek; using ::fsetpos; using ::ftell; using ::fwrite; using ::getc; using ::getchar; using ::gets; using ::perror; using ::printf; using ::putc; using ::putchar; using ::puts; using ::remove; using ::rename; using ::rewind; using ::scanf; using ::setbuf; using ::setvbuf; using ::sprintf; using ::sscanf; using ::tmpfile; using ::tmpnam; using ::ungetc; using ::vfprintf; using ::vprintf; using ::vsprintf; } #undef snprintf #undef vfscanf #undef vscanf #undef vsnprintf #undef vsscanf namespace __gnu_cxx { using ::snprintf; using ::vfscanf; using ::vscanf; using ::vsnprintf; using ::vsscanf; } namespace std { using ::__gnu_cxx::snprintf; using ::__gnu_cxx::vfscanf; using ::__gnu_cxx::vscanf; using ::__gnu_cxx::vsnprintf; using ::__gnu_cxx::vsscanf; } namespace __gnu_cxx { 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; (*_Errno()) = 0; const _TRet __tmp = __convf(__str, &__endptr, __base...); if (__endptr == __str) std::__throw_invalid_argument(__name); else if ((*_Errno()) == 34 || (std::__are_same<_Ret, int>::__value && (__tmp < __numeric_traits<int>::__min || __tmp > __numeric_traits<int>::__max))) std::__throw_out_of_range(__name); else __ret = __tmp; if (__idx) *__idx = __endptr - __str; return __ret; } 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, ...) { _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); } } namespace std { inline int stoi(const string& __str, 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 string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), __idx, __base); } inline unsigned long stoul(const string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), __idx, __base); } inline long long stoll(const string& __str, 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 string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), __idx, __base); } inline float stof(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } inline double stod(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } inline long double stold(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } inline string to_string(int __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int), "%d", __val); } inline string to_string(unsigned __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(unsigned), "%u", __val); } inline string to_string(long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long), "%ld", __val); } inline string to_string(unsigned long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(unsigned long), "%lu", __val); } inline string to_string(long long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long long), "%lld", __val); } inline string to_string(unsigned long long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(unsigned long long), "%llu", __val); } inline string to_string(float __val) { const int __n = __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, "%f", __val); } inline string to_string(double __val) { const int __n = __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, "%f", __val); } inline string to_string(long double __val) { const int __n = __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, "%Lf", __val); } inline int stoi(const wstring& __str, 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 wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), __idx, __base); } inline unsigned long stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), __idx, __base); } inline long long stoll(const wstring& __str, 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 wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), __idx, __base); } inline float stof(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } inline double stod(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } inline long double stold(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } inline wstring to_wstring(int __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(int), L"%d", __val); } inline wstring to_wstring(unsigned __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(unsigned), L"%u", __val); } inline wstring to_wstring(long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long), L"%ld", __val); } inline wstring to_wstring(unsigned long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(unsigned long), L"%lu", __val); } inline wstring to_wstring(long long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long long), L"%lld", __val); } inline wstring to_wstring(unsigned long long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(unsigned long long), L"%llu", __val); } inline wstring to_wstring(float __val) { const int __n = __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n, L"%f", __val); } inline wstring to_wstring(double __val) { const int __n = __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n, L"%f", __val); } inline wstring to_wstring(long double __val) { const int __n = __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n, L"%Lf", __val); } } namespace std { template<> struct hash<string> : public __hash_base<size_t, string> { size_t operator()(const string& __s) const { return std::_Hash_impl::hash(__s.data(), __s.length()); } }; template<> struct hash<wstring> : public __hash_base<size_t, wstring> { size_t operator()(const wstring& __s) const { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); } }; template<> struct hash<u16string> : public __hash_base<size_t, u16string> { size_t operator()(const u16string& __s) const { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(char16_t)); } }; template<> struct hash<u32string> : public __hash_base<size_t, u32string> { size_t operator()(const u32string& __s) const { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(char32_t)); } }; } #define _BASIC_STRING_TCC 1 namespace std { template<typename _CharT, typename _Traits, typename _Alloc> const typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4; template<typename _CharT, typename _Traits, typename _Alloc> const _CharT basic_string<_CharT, _Traits, _Alloc>:: _Rep::_S_terminal = _CharT(); template<typename _CharT, typename _Traits, typename _Alloc> const typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>::npos; template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[ (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) / sizeof(size_type)]; template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, input_iterator_tag) { if (__beg == __end && __a == _Alloc()) return _S_empty_rep()._M_refdata(); _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); _M_copy(__r->_M_refdata(), __buf, __len); try { while (__beg != __end) { if (__len == __r->_M_capacity) { _Rep* __another = _Rep::_S_create(__len + 1, __len, __a); _M_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; } __r->_M_set_length_and_sharable(__len); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> template <typename _InIterator> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, forward_iterator_tag) { if (__beg == __end && __a == _Alloc()) return _S_empty_rep()._M_refdata(); if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end) __throw_logic_error(("basic_string::_S_construct null not valid")); const size_type __dnew = static_cast<size_type>(std::distance(__beg, __end)); _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a); try { _S_copy_chars(__r->_M_refdata(), __beg, __end); } catch(...) { __r->_M_destroy(__a); throw; } __r->_M_set_length_and_sharable(__dnew); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(size_type __n, _CharT __c, const _Alloc& __a) { if (__n == 0 && __a == _Alloc()) return _S_empty_rep()._M_refdata(); _Rep* __r = _Rep::_S_create(__n, size_type(0), __a); if (__n) _M_assign(__r->_M_refdata(), __n, __c); __r->_M_set_length_and_sharable(__n); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str) : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()), __str.get_allocator()), __str.get_allocator()) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _Alloc& __a) : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, size_type __n) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, "basic_string::basic_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, _Alloc()), _Alloc()) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, "basic_string::basic_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _CharT* __s, size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__s, __s + __n, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _CharT* __s, const _Alloc& __a) : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : __s + npos, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(size_type __n, _CharT __c, const _Alloc& __a) : _M_dataplus(_S_construct(__n, __c, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> basic_string<_CharT, _Traits, _Alloc>:: basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(_S_construct(__beg, __end, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(initializer_list<_CharT> __l, const _Alloc& __a) : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: assign(const basic_string& __str) { if (_M_rep() != __str._M_rep()) { const allocator_type __a = this->get_allocator(); _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator()); _M_rep()->_M_dispose(__a); _M_data(__tmp); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: assign(const _CharT* __s, size_type __n) { ; _M_check_length(this->size(), __n, "basic_string::assign"); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(size_type(0), this->size(), __s, __n); else { const size_type __pos = __s - _M_data(); if (__pos >= __n) _M_copy(_M_data(), __s, __n); else if (__pos) _M_move(_M_data(), __s, __n); _M_rep()->_M_set_length_and_sharable(__n); return *this; } } } namespace std { namespace __atomic0 { bool atomic_flag::test_and_set(memory_order) noexcept { lock_guard<mutex> __lock(get_atomic_mutex()); bool result = _M_i; _M_i = true; return result; } void atomic_flag::clear(memory_order) noexcept { lock_guard<mutex> __lock(get_atomic_mutex()); _M_i = false; } extern "C" { bool atomic_flag_test_and_set_explicit(__atomic_flag_base* __a, memory_order __m) noexcept { atomic_flag* d = static_cast<atomic_flag*>(__a); return d->test_and_set(__m); } void atomic_flag_clear_explicit(__atomic_flag_base* __a, memory_order __m) noexcept { atomic_flag* d = static_cast<atomic_flag*>(__a); return d->clear(__m); } void __atomic_flag_wait_explicit(__atomic_flag_base* __a, memory_order __x) noexcept { while (atomic_flag_test_and_set_explicit(__a, __x)) { }; } __attribute__ ((__const__)) __atomic_flag_base* __atomic_flag_for_address(const volatile void* __z) noexcept { uintptr_t __u = reinterpret_cast<uintptr_t>(__z); __u += (__u >> 2) + (__u << 4); __u += (__u >> 7) + (__u << 5); __u += (__u >> 17) + (__u << 13); if (sizeof(uintptr_t) > 4) __u += (__u >> 31); __u &= ~((~uintptr_t(0)) << 4); return flag_table + __u; } } } }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Compiler Explorer Shop
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
Statistics
Changelog
Version tree