blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
01f7138b13532ad1c64d9d7bbd621a9be014ce33
bff757517d48e1964c1c5ae7c88dd9a2d2a5a0f9
/Copy-paste.cpp
8f0744fcdcf6e41523be5d5e06edf5ca96331b04
[]
no_license
firoze-hossain/CodeForces-1
c8f98c546c142b7c19ec0d3c23b10f00d3c88aad
4e6a0a23f0ce542d3e3f061eb9001d1853f26c08
refs/heads/master
2023-06-26T05:50:53.589258
2021-07-30T14:47:28
2021-07-30T14:47:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
604
cpp
#include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; for (int i = 0; i < t; ++i) { int n,k; cin>>n>>k; int ar[n]; for (int j = 0; j < n; ++j) { cin>>ar[j]; } int maxEl=-1; for (int j = 0; j < n; ++j) { int out=0; for (int l = 0; l < n; ++l) { if (j!=l) { out += abs(k-ar[l])/ar[j]; } } maxEl=max(out,maxEl); } cout<<maxEl<<"\n"; } }
[ "54479676+CormacKrum@users.noreply.github.com" ]
54479676+CormacKrum@users.noreply.github.com
80c2d26b5d093161c28efbf3fe867de53fa4baa3
a084484005b7e37e166c067ea54f22afd24e4be9
/Project2/Project2/Set.h
93720217c8fc0bcee56ff5afb813a285ddf79844
[]
no_license
leogretz2/CS32
c3f6e0ffc676bb2c927866784614783e4f66aae5
9e95f7fb84aee9b35ebaa486c0038e8c5dce4f7f
refs/heads/master
2020-05-22T21:01:52.909800
2019-05-14T02:08:17
2019-05-14T02:08:17
186,520,559
0
0
null
null
null
null
UTF-8
C++
false
false
1,864
h
#ifndef NEWSET_H #define NEWSET_H #include <string> #include <iostream> using ItemType = std::string; const int DEFAULT_MAX_ITEMS = 250; class Set { public: Set(); // Create an empty set (i.e., one with no items). Set(const Set& other); ~Set(); Set& operator=(const Set& rhs); bool empty() const; // Return true if the set is empty, otherwise false. int size() const; // Return the number of items in the set. void dump() const; bool insert(const ItemType& value); // Insert value into the set if it is not already present. Return // true if the value was actually inserted. Leave the set unchanged // and return false if the value was not inserted (perhaps because it // was already in the set or because the set has a fixed capacity and // is full). bool erase(const ItemType& value); // Remove the value from the set if present. Return true if the // value was removed; otherwise, leave the set unchanged and // return false. bool contains(const ItemType& value) const; // Return true if the value is in the set, otherwise false. bool get(int i, ItemType& value) const; // If 0 <= i < size(), copy into value the item in the set that is // strictly greater than exactly i items in the set and return true. // Otherwise, leave value unchanged and return false. void swap(Set& other); // Exchange the contents of this set with the other one. private: //int m_max; int m_size; //ItemType* m_arr_d; struct Node { Node(); ItemType data; Node* next; Node* prev; }; bool findVal(Node* a, ItemType val) const; //Node* findLeastPos(const ItemType& value) const; Node* head; Node* tail; Node dummy; }; void unite(const Set& s1, const Set& s2, Set& result); void subtract(const Set& s1, const Set& s2, Set& result); #endif
[ "noreply@github.com" ]
noreply@github.com
cbd7708319122caf938614153c68323643ee5137
2a9390355be52ed3faf56d345846e564961980ea
/practice/array.cpp
ab59365977ce4599738105625e2988f167a4b944
[]
no_license
Anshulguptag/Data-Structures
44890900bc49f2a752a10528c6279d4aafc17bc5
3ca979418f30278a2227ac3eabbe6cf21ec6c3aa
refs/heads/master
2020-03-22T01:56:48.315518
2018-08-10T06:06:04
2018-08-10T06:06:04
139,340,074
0
0
null
null
null
null
UTF-8
C++
false
false
2,039
cpp
#include<bits/stdc++.h> using namespace std; double sum(vector<int> A,int start,int end) { double sum = 0; for(int i=start;i<end;i++) { if(A[i]>=0) sum = sum+A[i]; } return sum; } vector<int> maxset(vector<int> &A) { int i; vector<int> temp; for(i=0;i<A.size();i++) { if(A[i]<0) break; } if(i==0) { for(int j=i+1;j<A.size();j++) if(A[j]>=0) temp.push_back(A[j]); } else if(i==A.size()-1) { for(int j=0;j<A.size()-1;j++) if(A[j]>=0) temp.push_back(A[j]); } else { if(sum(A,0,i)>sum(A,i+1,A.size())) { for(int j=0;j<i;j++) if(A[j]>=0) temp.push_back(A[j]); } else if(sum(A,0,i)<sum(A,i+1,A.size())) { for(int j=i+1;j<A.size();j++) if(A[j]>=0) temp.push_back(A[j]); } else { vector<int> temp1; vector<int> temp2; for(int j=0;j<i;j++) temp1.push_back(A[j]); for(int j=i+1;j<A.size();j++) temp2.push_back(A[j]); if(temp1.size()>=temp2.size()) { for(int j=0;j<i;j++) if(temp1[j]>=0) temp.push_back(temp1[j]); } else if(temp1.size()<temp2.size()) { for(int j=i+1;j<A.size();j++) if(temp2[j]>=0) temp.push_back(temp2[j]); } temp1.clear(); temp2.clear(); } } return temp; } int main() { int arr[] = {336465782, -278722862, -2145174067, 1101513929, 1315634022, -1369133069, 1059961393, 628175011, -1131176229, -859484421}; vector<int> A; for(int i=0;i<10;i++) A.push_back(arr[i]); vector<int> max1 = maxset(A); for(int i=0;i<max1.size();i++) cout<<max1[i]<<" "; }
[ "anshulguptamasteramazon@gmail.com" ]
anshulguptamasteramazon@gmail.com
983b2ea4a931a81b3f40ddd596555a84b7da3b1f
590f586058538edd13c4f2d1c864a05b6ead1ee0
/Lucky Division.cpp
e0dd9172ab23378a2e0edc49cbf2552f7a16bf52
[]
no_license
srb2719/Competitive-programming
8940f1cc3aa79952d3f224e83b1ab9bc9265abd4
81c333837a60108842d8c23fe93963ebbfc6713a
refs/heads/master
2020-05-18T04:46:15.205446
2019-04-30T03:17:19
2019-04-30T03:17:19
184,182,686
0
0
null
null
null
null
UTF-8
C++
false
false
509
cpp
#include<bits/stdc++.h> #include<vector> #include<string> #include<set> #include<algorithm> using namespace std; int main() { string n; cin>>n; int flag = 0; for(int i=0; i<n.length(); i++) { if(n[i] == '4' || n[i] == '7') { flag = 0 ; } else { flag = 1; break; } } int i = atoi(n.c_str()); if(flag == 0) { cout<<"YES"; } else { if(i%4 == 0 || i%7 == 0 || i%47 == 0) { cout<<"YES"; } else { cout<<"NO"; } } }
[ "noreply@github.com" ]
noreply@github.com
6143b87a21d13b83f9c8fe0885a583cefd081c99
e5c6f0782cb49bd49e6c6015b477db7d6aee0481
/application.h
67e66c541b5aeef6ad34c2631704406389317c9e
[]
no_license
hu602271981/QT
768d9073d0dc2e21c0ed8ddb219018081f623b87
88095101e7ae3118c4e36861eb879185077ea599
refs/heads/master
2020-12-02T10:04:37.713457
2017-07-09T14:20:21
2017-07-09T14:20:21
96,688,189
0
0
null
null
null
null
UTF-8
C++
false
false
445
h
#ifndef APPLICATION_H #define APPLICATION_H #include <QApplication> #include <screensaver.h> #include <QDebug> #include <QTimer> //application重写 class Application : public QApplication { public : Application (int & argc, char ** argv); bool notify(QObject *, QEvent *); void setWindowInstence (ScreenSaver *wnd); private: ScreenSaver *window; //保存一个窗体的指针 QTimer *timer; }; #endif // APPLICATION_H
[ "noreply@github.com" ]
noreply@github.com
f7663c9323d288d68ed5b4e2db29c1984dfa4241
54ead317ee9feb62a8176ba8a43822d24ac79ef0
/main.cpp
0d3e6b2770f64090f4109efeb4df0fb37238a13d
[]
no_license
ytl0623/1091-System-Programmnig-Cross-Assembler
68ea7bfd6b54ace928c708afeb8f588048e13702
328cf3a5ac404bdcdeb7e000946b09945ac25b17
refs/heads/main
2023-06-16T06:38:33.715122
2021-07-01T16:52:20
2021-07-01T16:52:20
382,099,480
0
0
null
null
null
null
UTF-8
C++
false
false
1,458
cpp
# include <iostream> # include <fstream> # include <cstdio> # include <stdio.h> # include <cstdlib> # include <stdlib.h> # include <cstring> # include <string.h> # include <cmath> # include <math.h> # include <time.h> # include <vector> # include <stack> # include <queue> # include <iomanip> # include <string.h> # include "table.h" # include "buffer.h" # include "function.h" # include "SIC.h" # include "SICXE.h" # include "assembler.h" using namespace std ; int main() { Function::SetTable() ; string command ; Assembler assembler ; while (1) { cout << "*****************************************" << endl ; cout << "***** Cross Assembler *****" << endl ; cout << "***** 0 : QUIT *****" << endl ; cout << "***** 1 : SIC *****" << endl ; cout << "***** 2 : SIC/XE *****" << endl ; cout << "*****************************************" << endl ; cout << "Input a command(0, 1, 2): " ; cin >> command ; if ( command == "0" ) return 0 ; else if ( command == "1" ) { assembler.SIC_Pass1() ; assembler.SIC_Pass2() ; cout << endl ; } else if ( command == "2" ) { assembler.SICXE_Pass1() ; assembler.SICXE_Pass2() ; cout << endl ; } else { cout << endl << "Command does not exit!" << endl << endl ; fflush(stdin) ; } } }
[ "noreply@github.com" ]
noreply@github.com
2b4e3c50f826896b1ef42993e2a3373c5ac407f0
1dd080a31d885c2bac39d7066ccc09e5b221f879
/planet.cpp
b15f943ff81de528918bb7dfb59d519f39aa2e68
[]
no_license
celestialphineas/SolarSys
552af09a022c1bb48c057ea54eea1ad45c693e49
716c2eff40b0fed6f5d3d28d9cd795f20bb03520
refs/heads/master
2021-08-14T15:20:32.555761
2017-11-16T03:37:23
2017-11-16T03:37:23
108,384,413
0
0
null
null
null
null
UTF-8
C++
false
false
3,180
cpp
#include "planet.h" void Planet::update(float time_) { x = parent->x + semi_majoraxis*cos(deg2rad(orbit_epoch_offset) + time_/orbit_period*2*M_PI); y = parent->y + semi_majoraxis*sin(deg2rad(orbit_epoch_offset) + time_/orbit_period*2*M_PI); z = 0.f; rotation_about_axis = rotation_epoch_offset + time_/rotation_period*360.; } void Planet::draw() { glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glPushMatrix(); // Model GLfloat light_p[]={-x,-y,-z,0}; glLightfv(GL_LIGHT0,GL_POSITION,light_p); glTranslatef(this->get_x(), this->get_y(), this->get_z()); glRotatef(this->get_rotation_inclination(), 0.f, 1.f, 0.f); glRotatef(this->get_rotation(), 0.f, 0.f, 1.f); GLUquadricObj *sphere = NULL; sphere = gluNewQuadric(); gluQuadricDrawStyle(sphere, GLU_FILL); if(texture_set) { glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluQuadricTexture(sphere, true); } gluQuadricNormals(sphere, GLU_SMOOTH); gluSphere(sphere, this->get_body_radius(), N_SEGMENTS, N_SEGMENTS); glEndList(); gluDeleteQuadric(sphere); glPopMatrix(); } bool Planet::set_texture(const char *filename) { if(!filename) return false; texture = load_texture(filename); if(!texture) return false; return texture_set = true; } void Planet::draw_orbit() { glDisable(GL_LIGHTING); glDisable(GL_LIGHT0); glPushMatrix(); // Model GLfloat light_p[]={-x,-y,-z,0}; glLightfv(GL_LIGHT0,GL_POSITION,light_p); glTranslatef(parent->get_x(), parent->get_y(), parent->get_z()); glScalef(this->get_semi_majoraxis(), this->get_semi_majoraxis(), this->get_semi_majoraxis()); int n_sample = 1024; glBegin(GL_LINE_LOOP); glColor3f(1.0f, 1.0f, 1.0f); for(int j = 0;j < n_sample;++j) { glVertex2f(cos(2*M_PI*j/(float)n_sample), sin(2*M_PI*j/(float)n_sample)); } glEnd(); glPopMatrix(); } void Sol::draw() { glDisable(GL_LIGHTING); glDisable(GL_LIGHT0); glPushMatrix(); // Model glTranslatef(this->get_x(), this->get_y(), this->get_z()); glRotatef(this->get_rotation_inclination(), 0.f, 1.f, 0.f); glRotatef(this->get_rotation(), 0.f, 0.f, 1.f); GLUquadricObj *sphere = NULL; sphere = gluNewQuadric(); gluQuadricDrawStyle(sphere, GLU_FILL); if(texture_set) { glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluQuadricTexture(sphere, true); } gluQuadricNormals(sphere, GLU_SMOOTH); gluSphere(sphere, this->get_body_radius(), N_SEGMENTS, N_SEGMENTS); glEndList(); gluDeleteQuadric(sphere); glPopMatrix(); }
[ "hanghang0713@hotmail.com" ]
hanghang0713@hotmail.com
e955f03d381b79e49f78969d3acd01dc5dfd22d1
6d78f273c2b9a3c75a117ae04e506bc31ae34b7e
/include/internal/AvatarHelpers.h
e732dd6a8ab3936caaa2461d1fd2307dd3fcdefe
[ "Apache-2.0" ]
permissive
UCAS-IIGROUP/avatar
22687d558b7b67d215bdea46fe288d3a25a0ca70
e08ca9629ecda301f19a6686b4d5c0bc87971075
refs/heads/master
2023-05-11T10:00:27.823500
2021-05-20T19:59:48
2021-05-20T19:59:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,674
h
#pragma once #include <utility> #include <algorithm> #include <vector> #include <Eigen/Core> #include <opencv2/core.hpp> namespace ark { /** Hand-written faster function to load a saved PCL point cloud directly * into an Eigen vector, where points are stored: x1 y1 z1 x2 y2 z2 ... * The reason we flatten the cloud instead of using a matrix is to make it * easier to add in shape keys, which would otherwise need to be tensors */ Eigen::VectorXd loadPCDToPointVectorFast(const std::string& path); /** Spherical to rectangular coords */ void fromSpherical(double rho, double theta, double phi, Eigen::Vector3d& out); /** Paint projected triangle on depth map using barycentric linear interp */ template <class T> void paintTriangleBary(cv::Mat& output, const cv::Size& image_size, const std::vector<cv::Point2f>& projected, const cv::Vec3i& face, const float* zvec, float maxz = 255.0f); /** Paint projected triangle on part mask (CV_8U) using nearest neighbors interp */ void paintPartsTriangleNN( cv::Mat& output_assigned_joint_mask, const cv::Size& image_size, const std::vector<cv::Point2f>& projected, const std::vector<std::vector<std::pair<double, int>>>& assigned_joint, const cv::Vec3i& face, const std::vector<int>& part_map); /** Paint projected triangle on image to single color (based on template type) */ template <class T> void paintTriangleSingleColor(cv::Mat& output_image, const cv::Size& image_size, const std::vector<cv::Point2f>& projected, const cv::Vec3i& face, T color); } // namespace ark
[ "sxyu@berkeley.edu" ]
sxyu@berkeley.edu
9ced34c7ea686ccfb5b86ff6e087835cc39f71b7
6bbee2a1f319c06a140b0afe80806f4d3608fc3a
/birrt_star_algorithm/include/birrt_star_algorithm/birrt_star.h
4e2ac30bf0032a611c60726ea310fa4cb931d4e6
[]
no_license
yt100323/robot_motion_planning
39abea8dd22fb961999db3381d57879b700e8548
f625c65017ba6098b693fa3b5dac3ab64f5862f5
refs/heads/master
2020-05-23T13:45:19.969390
2017-01-23T12:42:59
2017-01-23T12:42:59
84,773,583
0
1
null
2017-03-13T02:02:26
2017-03-13T02:02:26
null
UTF-8
C++
false
false
21,250
h
/* * birrt_star.h * * Created on: July 06, 2015 * Author: Felix Burget */ // --- Includes -- #include <ros/ros.h> #include <planner_data_structures/data_structs.h> #include <kuka_motion_control/control_laws.h> #include <validity_checker/feasibility_checker.h> #include <planning_heuristics/distance_heuristics.h> #include <planning_world_builder/planning_world_builder.h> //Needed for planning with the real robot #include <robot_interface_definition/robot_interface.h> //#include <rrt_star_algorithm/ProlateHyperspheroid.h> #include <omp.h> #ifndef BIRRT_STAR_H #define BIRRT_STAR_H // --Namespaces -- using namespace std; namespace birrt_star_motion_planning{ class BiRRTstarPlanner : public robot_interface_definition::RobotInterface { public: BiRRTstarPlanner(string planning_group); ~BiRRTstarPlanner(); //Set the planning scene void setPlanningSceneInfo(double size_x, double size_y, string scene_name); void setPlanningSceneInfo(planning_world::PlanningWorldBuilder world_builder); //Implementation of the virtual function "move" defined in Abstract Class robot_interface_definition bool plan(const Eigen::Affine3d& goal); //Move function for base, base+endeffector and endeffector only bool move_base(const Eigen::Affine3d& goal); bool move_base_endeffector(const Eigen::Affine3d& goal); bool move_endeffector(const Eigen::Affine3d& goal); //Initialize RRT* Planner (reading start and goal config from file) bool init_planner(char *start_goal_config_file, int search_space); //Initialize RRT* Planner (given start and goal config) bool init_planner(vector<double> start_conf, vector<double> goal_conf, int search_space); //Initialize RRT* Planner (given start config and final endeffector pose) bool init_planner(vector<double> start_conf, vector<double> ee_goal_pose, vector<int> constraint_vec_goal_pose, vector<pair<double,double> > coordinate_dev, int search_space); //Initialize RRT* Planner (given start and final endeffector pose) bool init_planner(vector<double> ee_start_pose, vector<int> constraint_vec_start_pose, vector<double> ee_goal_pose, vector<int> constraint_vec_goal_pose, vector<pair<double,double> > coordinate_dev, int search_space); //Read / Write Start and Goal Config void writeStartGoalConfig(char *start_goal_config_file, vector<double> start_config, vector<double> goal_config); bool readStartGoalConfig(char *start_goal_config_file, vector<double> &start_config, vector<double> &goal_config); //Generate start and goal configuration for a given start and goal EE pose vector<vector<double> > generate_start_goal_config(vector<double> start_pose, vector<int> constraint_vec_start_pose, vector<double> goal_pose, vector<int> constraint_vec_goal_pose, vector<pair<double,double> > coordinate_dev, bool show_motion ); //Compute IK for given endeffector pose vector<double> findIKSolution(vector<double> goal_ee_pose, vector<int> constraint_vec, vector<pair<double,double> > coordinate_dev, bool show_motion); //Compute IK for given endeffector goal pose (given a specific initial config) vector<double> findIKSolution(vector<double> goal_ee_pose, vector<int> constraint_vec, vector<pair<double,double> > coordinate_dev, vector<double> mean_init_config, bool show_motion); //Attach/Detach an given Object to the End-effector void attachObject(moveit_msgs::AttachedCollisionObject attached_object); void detachObject(moveit_msgs::AttachedCollisionObject attached_object); //Function to set parameterized task frame void setParameterizedTaskFrame(vector<int> cv, vector<pair<double,double> > coordinate_dev, bool task_pos_global, bool task_orient_global); //Function to set fixed task frame void setFixedTaskFrame(vector<int> cv, vector<pair<double,double> > coordinate_dev, KDL::Frame task_frame); //Function to set edge cost weights (to punish certain joint motions) void setEdgeCostWeights(vector<double> ecw); //Function to set the configuration projection error threshold (used in constraint satisfaction function) //void setConfigProjectionErrorThreshold(double threshold); //Activate/Deactivate Tree Optimization Features void activateTreeOptimization(); void deactivateTreeOptimization(); //Activate/Deactivate Informed Sampling Heuristic Features void activateInformedSampling(); void deactivateInformedSampling(); //Run RRT* Planner (given max. planning time or iterations) bool run_planner(int search_space, bool flag_iter_or_time, double max_iter_time, bool show_tree_vis, double iter_sleep, int planner_run_number = 0); //Get the planned joint trajectory vector<vector<double> > getJointTrajectory(); //Get the planned endeffector trajectory vector<vector<double> > getEndeffectorTrajectory(); //Reset RRT* Planner Data void reset_planner_complete(); //reset everything void reset_planner(); //reset planner to initial trees (containing only start and goal config) private: //-- Class Objects -- //Node handle ros::NodeHandle m_nh; // Path to package (to be read from param server) string m_planner_package_path; //Path to start goal config files string m_terminal_configs_path; //Planning World and Environment Size boost::shared_ptr<planning_world::PlanningWorldBuilder> m_planning_world; double m_env_size_x; double m_env_size_y; //Planning Scene Monitor (used for Collision Checking) //planning_scene_monitor::PlanningSceneMonitorPtr m_planning_scene_monitor; //Generate KDL Tree from Kuka LBR urdf // -> used to generate samples for the kinematic chain of the robot boost::shared_ptr<kuka_motion_controller::KDLRobotModel> m_KDLRobotModel; //Create RobotController Object for Motion Control of the robot // -> used to connect samples of the RRT* planner boost::shared_ptr<kuka_motion_controller::RobotController> m_RobotMotionController; //FeasibilityChecker to check configurations/nodes and edges for collisions boost::shared_ptr<state_feasibility_checker::FeasibilityChecker> m_FeasibilityChecker; //Heuristics for measuring distances between nodes heuristics_motion_planning::DistanceHeuristics m_Heuristic; //Group for which planning is performed (set in constructor + must be a group defined in the robot srdf) string m_planning_group; //Kinematic Chain of robot KDL::Chain m_manipulator_chain; //Joint Names of KDL::Chain vector<string> m_joint_names; //Name of Base Link Frame of Kinematic Chain string m_base_link_name; //Number of joints int m_num_joints; int m_num_joints_revolute; int m_num_joints_prismatic; //RRT* trees Rrt_star_tree m_start_tree; Rrt_star_tree m_goal_tree; //Start and Goal Endeffector Pose vector<double> m_ee_start_pose; vector<double> m_ee_goal_pose; //Start and Goal Configuration vector<double> m_config_start_pose; vector<double> m_config_goal_pose; //Maximal Planner iterations/time and actually executed planner iterations/time int m_max_planner_iter; double m_max_planner_time; int m_executed_planner_iter; double m_executed_planner_time; //Iteration when first and last solution is found int m_first_solution_iter; int m_last_solution_iter; //Tree Optimization Flag // -> If "activated" near nodes are considered in the nearest neighbour search // -> Nodes are rewired when a new node is added // -> If "deactivated" the planner reduces to the standard RRT-CONNECT bool m_tree_optimization_active; //Informed Sampling Heuristic Flag // -> If "activated" , samples are drawn from an informed subset once a solution is found // -> If "deactivated" , samples are drawn uniformly from the C-Space bool m_informed_sampling_active; //Bidirectional planner type string m_planner_type; //Distance threshold for workspace samples(Defines "nearness" of ndoes in "find_near_vertices"-function) double m_near_threshold_control; //Distance threshold for C-Space samples(Defines "nearness" of ndoes in "find_near_vertices"-function) double m_near_threshold_interpolation; //Weights for individual edge cost components (to punish motions of some variables stronger/less than the one of others) vector<double> m_edge_cost_weights; //Number of points for C-Space interpolation int m_num_traj_segments_interp; //Step width from nearest neighbour in the direction of random sample double m_unconstraint_extend_step_factor; //Cost solution path available bool m_solution_path_available; //Theoretical Minimum Cost for Solution Path (linear interpolation betweeen start and goal pose/config) vector<double> m_cost_theoretical_solution_path; //Cost of selected best solution path (total cost + cost for prismatic and rotational joints) double m_cost_best_solution_path; double m_cost_best_solution_path_revolute; double m_cost_best_solution_path_prismatic; //Tree and nodes that have established a connection string m_connected_tree_name; Node m_node_tree_B; //Node of the tree "m_connected_tree_name" that has connected "to m_node_tee_A" Node m_node_tree_A; //Node of the other tree that has been reached by tree "m_connected_tree_name" //Timer for measuring performance of planner timeval m_timer; double m_time_planning_start; double m_time_planning_end; double m_time_first_solution; double m_time_last_solution; //Random number generator to generate a number between 0 and 1 for sampling the unit n-dimensional ball random_numbers::RandomNumberGenerator m_random_number_generator; // ++ Class Functions ++ //++ Cartesian Space Search (with local Controller) ++ //Compute pose of endeffector in configuration vector<double> computeEEPose(vector<double> start_conf); vector<double> computeEEPose(KDL::JntArray start_conf); //Sample Endeffector pose (used for Control-based tree expansion) vector<double> sampleEEpose(); //Sample Endeffector pose from Informed Subset / Ellipse vector<double> sampleEEposefromEllipse(); //Find the nearest neighbour (node storing the ee pose closest to the sampled pose) Node find_nearest_neighbour_control(Rrt_star_tree *tree, vector<double> x_rand); //Connect Nodes (running Variable DLS Controller) kuka_motion_controller::Status connectNodesControl(Rrt_star_tree *tree, Node near_node, Node end_node, Node &x_new, Edge &e_new); //Compute the cost of an edge connecting two nodes double compute_edge_cost_control(vector<vector<double> > ee_traj); //Find the set of vertices in the vicinity of x_new vector<int> find_near_vertices_control(Rrt_star_tree *tree, Node x_new); //Choose Parent for x_new minimizing the cost of reaching x_new (given the set of vertices surrounding x_new as potential parents) bool choose_node_parent_control(Rrt_star_tree *tree, vector<int> near_vertices, Node nn_node, Edge &e_new, Node &x_new); //Rewire Nodes of the Tree, i.e. checking if some if the nodes can be reached by a lower cost path void rewireTreeControl(Rrt_star_tree *tree, vector<int> near_vertices, Node x_new, bool show_tree_vis); //Try to connect the two RRT* Trees given the new node added to "tree_A" and its nearest neighbour in "tree_B" void connectGraphsControl(Rrt_star_tree *tree, Node x_connect, Node x_new, bool show_tree_vis); //++ C-Space Search (with local interpolation) ++ //Initialize constant parameters for Joint Config sampling from Ellipse void jointConfigEllipseInitialization(); //Sample Configuration (as JntArray) from Ellipse containing configurations that may improve current solution KDL::JntArray sampleJointConfigfromEllipse_JntArray(); //Sample Configuration (as std::vector) vector<double> sampleJointConfig_Vector(); //Sample Configuration (as JntArray) KDL::JntArray sampleJointConfig_JntArray(); //Sample Configuration around mean config vector(as std::vector) vector<double> sampleJointConfig_Vector(vector<double> mean_config, double std_dev); //Sample Configuration around mean config vector(as JntArray) KDL::JntArray sampleJointConfig_JntArray(vector<double> mean_config, double std_dev); //Tree expansions step bool expandTree(Rrt_star_tree *tree, Node nn_node, Node x_rand, Node &x_new, Edge &e_new, bool show_tree_vis); //Connect Nodes (by interpolating configurations) bool connectNodesInterpolation(Rrt_star_tree *tree, Node near_node, Node end_node, int num_points, Node &x_new, Edge &e_new); //Interpolate configurations of near_node and end_node bool interpolateConfigurations(Node near_node, Node end_node, int num_points ,vector<vector<double> > &joint_traj, vector<vector<double> > &ee_traj); //Compute the cost of an edge connecting two nodes vector<double> compute_edge_cost_interpolation(vector<vector<double> > joint_traj); //Find the nearest neighbour (node storing the ee pose closest to the sampled config) Node find_nearest_neighbour_interpolation(Rrt_star_tree *tree, vector<double> x_rand); //Find the set of vertices in the vicinity of x_new vector<int> find_near_vertices_interpolation(Rrt_star_tree *tree, Node x_new); //Choose Parent for x_new minimizing the cost of reaching x_new (given the set of vertices surrounding x_new as potential parents) bool choose_node_parent_interpolation(Rrt_star_tree *tree, vector<int> near_vertices, Node nn_node, Edge &e_new, Node &x_new, bool show_tree_vis); //Rewire Nodes of the Tree, i.e. checking if some if the nodes can be reached by a lower cost path void rewireTreeInterpolation(Rrt_star_tree *tree, vector<int> near_vertices, Node x_new, bool show_tree_vis); //Update cost of nodes following to a rewired near_vertices void recursiveNodeCostUpdate(Rrt_star_tree *tree, Node tree_vertex, vector<double> cost_reduction, bool show_tree_vis); //Insert Node and Edge into the RRT* Tree void insertNode(Rrt_star_tree *tree, Edge e_new, Node x_new, bool show_tree_vis); //Try to connect the two RRT* Trees given the new node added to "tree_A" and its nearest neighbour in "tree_B" void connectGraphsInterpolation(Rrt_star_tree *tree, Node x_connect, Node x_new, bool show_tree_vis); //Check whether a solution has been found (not neccessarily the optimal one) //bool solution_path_available(); //Compute and show the current solution path (computes node sequence for line strip for visualization) // -> node_tree_A and node_tree_B are the same nodes exrpessed w.r.t tree_A and tree_B respectively // -> "tree_name" tells us which tree has established the connection (either start or goal tree) void showCurrentSolutionPath(string connected_tree_name, Node node_tree_B, Node node_tree_A); //++ Joint config sampling from Ellipse ++ //Center of the 7-dimensional unit ball Eigen::VectorXd m_ball_center_revolute; Eigen::VectorXd m_ball_center_prismatic; //Rotation Matrix "C" Eigen::MatrixXd m_rotation_C_revolute; Eigen::MatrixXd m_rotation_C_prismatic; //++ Constraint motion planning ++ //Flag indicating whether constraint motion planning is active bool m_constraint_active; //Flags indicating whether the constraint is global (i.e the task frame always corresponds to the start ee frame) //or local (i.e the task frame always corresponds to the current ee frame) bool m_task_pos_global; bool m_task_orient_global; //Constraint Selection Vector // -> specifying which axes of the task frame permit valid displacement vector<int> m_constraint_vector; //Permitted deviation for constrained coordinates // -> specifies an lower and upper deviation boundary vector<pair<double,double> > m_coordinate_dev; //Position and orientation of Task Frame // -> Position defined by nearest neighbour (i.e. locally) // -> Orientation defined globally by start ee pose KDL::Frame m_task_frame; //Transformation between end-effector and task frame after grasping KDL::Frame m_grasp_transform; //Step width from nearest neighbour in the direction of random sample double m_constraint_extend_step_factor; //Perform a step from nearest neighbour towards random sample bool stepTowardsRandSample(Node nn_node, Node &x_rand, double extend_step_factor); //Permitted sample projection error //double m_projection_error_threshold; //Minimum distance between near sample and projected sample // -> to avoid random samples being projected back onto near sample double m_min_projection_distance; //Maximum permitted task error for intermediate ee poses between two given configurations //double m_max_task_error_interpolation; //Maximum iterations for projection operation int m_max_projection_iter; //Maximum number of near nodes considered in "choose_node_parent_iterpolation" and "rewireTreeInterpolation" // -> "choose_node_parent_iterpolation" : Only first "m_max_near_nodes" nodes are considered // -> "rewireTreeInterpolation" : Only last "m_max_near_nodes" nodes are considered // Note: Near Nodes are stored in ascending order of cost-to-reach int m_max_near_nodes; //++ Planning with Attached Objects ++ //Attached object moveit_msgs::AttachedCollisionObject m_attached_object; // ++ RRT* Tree visualization ++ //Scale for node and edge markers double m_node_marker_scale; double m_edge_marker_scale; double m_terminal_nodes_marker_scale; double m_solution_path_ee_marker_scale; double m_solution_path_base_marker_scale; // MarkerArray for start and goal node (SPHERES) visualization_msgs::MarkerArray m_terminal_nodes_marker_array_msg; //array storing terminal nodes // Marker to add/remove edges (LINE_LIST) visualization_msgs::MarkerArray m_start_tree_add_edge_marker_array_msg; //Vector of Line Strips / Edges visualization_msgs::MarkerArray m_goal_tree_add_edge_marker_array_msg; //Vector of Line Strips / Edges // Marker for nodes (SPHERE_LIST) visualization_msgs::Marker m_start_tree_add_nodes_marker; //add nodes to tree visualization visualization_msgs::Marker m_goal_tree_add_nodes_marker; //add nodes to tree visualization //Tree edges and node Publisher ros::Publisher m_start_tree_edge_pub; ros::Publisher m_start_tree_node_pub; ros::Publisher m_goal_tree_edge_pub; ros::Publisher m_goal_tree_node_pub; //Publisher for terminal nodes (start and goal node) ros::Publisher m_tree_terminal_nodes_pub; //Solution path publisher (for ee trajectory) ros::Publisher m_ee_solution_path_pub; //Solution path publisher (for base trajectory) ros::Publisher m_base_solution_path_pub; //Functions void add_tree_edge_vis(string tree_name,Edge new_edge); void remove_tree_edge_vis(string tree_name,Edge old_edge); void add_tree_node_vis(string tree_name,Node new_node); void add_tree_node_vis(string tree_name, Node new_node, vector<double> color_rgb); // ++ Store results of RRT* planner ()++ //Result of Motion Planning int m_planner_success; //Arrays storing the result vector< vector<double> > m_result_joint_trajectory; vector< vector<double> > m_result_ee_trajectory; //Evolution of the best solution cost vector< vector<double> > m_solution_cost_trajectory; //Path to files storing the trajectories generated by RRT* char* m_file_path_joint_trajectory; char* m_file_path_ee_trajectory; //Compute the final solution path (fills array for joint and endeffector trajectory and writes them to file) void computeFinalSolutionPathTrajectories(); //Path to files storing the Planner Statistics char* m_file_path_planner_statistics; //Path to files storing the Solution Path Cost Evolution char* m_file_path_cost_evolution; //Write Planner Statistics to File void writePlannerStatistics(char *statistics_file, char *cost_evolution_file); //Method for Solution Path Smoothing //void basic_solution_path_smoothing(vector< vector<double> > raw_joint_trajectory); //Subscriber to get current joint state from real lbr arm ros::Subscriber m_lbr_joint_state_sub; //LBR Joint State Subscriber Callback void callback_lbr_joint_states(const sensor_msgs::JointState::ConstPtr& msg); //Flag indicating that lbr joint state is available bool m_lbr_joint_state_received; //Current Lbr joint state vector<double> m_lbr_joint_state; //Namespace prefix for robot string m_ns_prefix_robot; // ++ Functions and Variables for consistency checks ++ //Variable to test for loops in the tree vector<int> testing_; //Tree consistency checks void no_two_parents_check(Rrt_star_tree *tree); void cost_consistency_check(Rrt_star_tree *tree); }; }//end of namespace #endif // BiRRT_STAR_H
[ "burgetf@informatik.uni-freiburg.de" ]
burgetf@informatik.uni-freiburg.de
861a545ba3024e89a46c5b84fe89a50c3b59cde7
74b88b5195fb8696a84eff08dbe6fc658c7e712c
/GOESP/Hacks/ESP.cpp
66adb7b9d18b1f533e4eabb2629d458be758cbf5
[ "MIT" ]
permissive
guotengfff/GOESP
31dbe906d387bbbb2689b11dca5443ce279756cb
5aff1e67ccf64a2d39e264a5cf42dfd67400d7d9
refs/heads/master
2021-04-10T17:41:40.167782
2020-03-19T14:37:27
2020-03-19T14:37:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
21,346
cpp
#define NOMINMAX #include "ESP.h" #include "../imgui/imgui.h" #include "../imgui/imgui_internal.h" #include "../Config.h" #include "../Helpers.h" #include "../Interfaces.h" #include "../Memory.h" #include "../SDK/ClassId.h" #include "../SDK/Engine.h" #include "../SDK/Entity.h" #include "../SDK/EntityList.h" #include "../SDK/GlobalVars.h" #include "../SDK/Localize.h" #include "../SDK/Vector.h" #include "../SDK/WeaponInfo.h" #include "../SDK/WeaponId.h" #include <mutex> #include <optional> #include <tuple> static D3DMATRIX viewMatrix; static bool worldToScreen(const Vector& in, ImVec2& out) noexcept { const auto& matrix = viewMatrix; float w = matrix._41 * in.x + matrix._42 * in.y + matrix._43 * in.z + matrix._44; if (w > 0.001f) { const auto [width, height] = interfaces->engine->getScreenSize(); out.x = width / 2 * (1 + (matrix._11 * in.x + matrix._12 * in.y + matrix._13 * in.z + matrix._14) / w); out.y = height / 2 * (1 - (matrix._21 * in.x + matrix._22 * in.y + matrix._23 * in.z + matrix._24) / w); return true; } return false; } struct BaseData { BaseData(Entity* entity) noexcept { const auto localPlayer = interfaces->entityList->getEntity(interfaces->engine->getLocalPlayer()); if (!localPlayer) return; distanceToLocal = (localPlayer->getAbsOrigin() - entity->getAbsOrigin()).length(); obbMins = entity->getCollideable()->obbMins(); obbMaxs = entity->getCollideable()->obbMaxs(); coordinateFrame = entity->coordinateFrame(); } float distanceToLocal; Vector obbMins; Vector obbMaxs; Matrix3x4 coordinateFrame; }; struct EntityData : BaseData { EntityData(Entity* entity) noexcept : BaseData{ entity } { classId = entity->getClientClass()->classId; if (const auto model = entity->getModel(); model && std::strstr(model->name, "flashbang")) flashbang = true; else flashbang = false; } ClassId classId; bool flashbang; }; struct PlayerData : BaseData { PlayerData(Entity* entity) noexcept : BaseData{ entity } { const auto localPlayer = interfaces->entityList->getEntity(interfaces->engine->getLocalPlayer()); if (!localPlayer) return; enemy = memory->isOtherEnemy(entity, localPlayer); visible = entity->visibleTo(localPlayer); flashDuration = entity->flashDuration(); name = entity->getPlayerName(config->normalizePlayerNames); if (const auto weapon = entity->getActiveWeapon()) { if (const auto weaponData = weapon->getWeaponInfo()) { if (char weaponName[100]; WideCharToMultiByte(CP_UTF8, 0, interfaces->localize->find(weaponData->name), -1, weaponName, _countof(weaponName), nullptr, nullptr)) activeWeapon = weaponName; } } } bool enemy; bool visible; float flashDuration; std::string name; std::string activeWeapon; }; struct WeaponData : BaseData { WeaponData(Entity* entity) noexcept : BaseData{ entity } { clip = entity->clip(); reserveAmmo = entity->reserveAmmoCount(); id = entity->weaponId(); if (const auto weaponData = entity->getWeaponInfo()) { type = weaponData->type; name = weaponData->name; } } int clip; int reserveAmmo; WeaponId id; WeaponType type = WeaponType::Unknown; std::string name; }; static std::vector<PlayerData> players; static std::vector<WeaponData> weapons; static std::vector<EntityData> entities; static std::mutex dataMutex; void ESP::collectData() noexcept { std::scoped_lock _{ dataMutex }; players.clear(); weapons.clear(); entities.clear(); const auto localPlayer = interfaces->entityList->getEntity(interfaces->engine->getLocalPlayer()); if (!localPlayer) return; viewMatrix = interfaces->engine->worldToScreenMatrix(); const auto observerTarget = localPlayer->getObserverMode() == ObsMode::InEye ? localPlayer->getObserverTarget() : nullptr; for (int i = 1; i <= memory->globalVars->maxClients; ++i) { const auto entity = interfaces->entityList->getEntity(i); if (!entity || entity == localPlayer || entity == observerTarget || entity->isDormant() || !entity->isAlive()) continue; players.emplace_back(entity); } for (int i = memory->globalVars->maxClients + 1; i <= interfaces->entityList->getHighestEntityIndex(); ++i) { const auto entity = interfaces->entityList->getEntity(i); if (!entity || entity->isDormant()) continue; if (entity->isWeapon()) { if (entity->ownerEntity() == -1) weapons.emplace_back(entity); } else { const auto classId = entity->getClientClass()->classId; switch (classId) { case ClassId::BaseCSGrenadeProjectile: if (entity->grenadeExploded()) break; case ClassId::BreachChargeProjectile: case ClassId::BumpMineProjectile: case ClassId::DecoyProjectile: case ClassId::MolotovProjectile: case ClassId::SensorGrenadeProjectile: case ClassId::SmokeGrenadeProjectile: case ClassId::SnowballProjectile: case ClassId::EconEntity: case ClassId::Chicken: case ClassId::PlantedC4: entities.emplace_back(entity); } } } } struct BoundingBox { private: bool valid; public: ImVec2 min, max; ImVec2 vertices[8]; BoundingBox(const BaseData& data) noexcept { const auto [width, height] = interfaces->engine->getScreenSize(); min.x = static_cast<float>(width * 2); min.y = static_cast<float>(height * 2); max.x = -min.x; max.y = -min.y; const auto& mins = data.obbMins; const auto& maxs = data.obbMaxs; for (int i = 0; i < 8; ++i) { const Vector point{ i & 1 ? maxs.x : mins.x, i & 2 ? maxs.y : mins.y, i & 4 ? maxs.z : mins.z }; if (!worldToScreen(point.transform(data.coordinateFrame), vertices[i])) { valid = false; return; } min.x = std::min(min.x, vertices[i].x); min.y = std::min(min.y, vertices[i].y); max.x = std::max(max.x, vertices[i].x); max.y = std::max(max.y, vertices[i].y); } valid = true; } operator bool() const noexcept { return valid; } }; static void renderBox(ImDrawList* drawList, const BoundingBox& bbox, const Shared& config) noexcept { if (!config.box.enabled) return; const ImU32 color = Helpers::calculateColor(config.box, memory->globalVars->realtime); switch (config.boxType) { case 0: drawList->AddRect(bbox.min, bbox.max, color, config.box.rounding, ImDrawCornerFlags_All, config.box.thickness); break; case 1: drawList->AddLine(bbox.min, { bbox.min.x, bbox.min.y * 0.75f + bbox.max.y * 0.25f }, color, config.box.thickness); drawList->AddLine(bbox.min, { bbox.min.x * 0.75f + bbox.max.x * 0.25f, bbox.min.y }, color, config.box.thickness); drawList->AddLine({ bbox.max.x, bbox.min.y }, { bbox.max.x * 0.75f + bbox.min.x * 0.25f, bbox.min.y }, color, config.box.thickness); drawList->AddLine({ bbox.max.x, bbox.min.y }, { bbox.max.x, bbox.min.y * 0.75f + bbox.max.y * 0.25f }, color, config.box.thickness); drawList->AddLine({ bbox.min.x, bbox.max.y }, { bbox.min.x, bbox.max.y * 0.75f + bbox.min.y * 0.25f }, color, config.box.thickness); drawList->AddLine({ bbox.min.x, bbox.max.y }, { bbox.min.x * 0.75f + bbox.max.x * 0.25f, bbox.max.y }, color, config.box.thickness); drawList->AddLine(bbox.max, { bbox.max.x * 0.75f + bbox.min.x * 0.25f, bbox.max.y }, color, config.box.thickness); drawList->AddLine(bbox.max, { bbox.max.x, bbox.max.y * 0.75f + bbox.min.y * 0.25f }, color, config.box.thickness); break; case 2: for (int i = 0; i < 8; ++i) { for (int j = 1; j <= 4; j <<= 1) { if (!(i & j)) drawList->AddLine(bbox.vertices[i], bbox.vertices[i + j], color, config.box.thickness); } } break; case 3: for (int i = 0; i < 8; ++i) { for (int j = 1; j <= 4; j <<= 1) { if (!(i & j)) { drawList->AddLine(bbox.vertices[i], { bbox.vertices[i].x * 0.75f + bbox.vertices[i + j].x * 0.25f, bbox.vertices[i].y * 0.75f + bbox.vertices[i + j].y * 0.25f }, color, config.box.thickness); drawList->AddLine({ bbox.vertices[i].x * 0.25f + bbox.vertices[i + j].x * 0.75f, bbox.vertices[i].y * 0.25f + bbox.vertices[i + j].y * 0.75f }, bbox.vertices[i + j], color, config.box.thickness); } } } break; } } static ImVec2 renderText(ImDrawList* drawList, float distance, float cullDistance, const Color& textCfg, const ColorToggleRounding& backgroundCfg, const char* text, const ImVec2& pos, bool centered = true, bool adjustHeight = true) noexcept { if (cullDistance && Helpers::units2meters(distance) > cullDistance) return { }; const auto fontSize = std::clamp(15.0f * 10.0f / std::sqrt(distance), 10.0f, 15.0f); const auto textSize = ImGui::GetFont()->CalcTextSizeA(fontSize, FLT_MAX, -1.0f, text); const auto horizontalOffset = centered ? textSize.x / 2 : 0.0f; const auto verticalOffset = adjustHeight ? textSize.y : 0.0f; if (backgroundCfg.enabled) { const ImU32 color = Helpers::calculateColor(backgroundCfg, memory->globalVars->realtime); drawList->AddRectFilled({ pos.x - horizontalOffset - 2, pos.y - verticalOffset - 2 }, { pos.x - horizontalOffset + textSize.x + 2, pos.y - verticalOffset + textSize.y + 2 }, color, backgroundCfg.rounding); } const ImU32 color = Helpers::calculateColor(textCfg, memory->globalVars->realtime); drawList->AddText(nullptr, fontSize, { pos.x - horizontalOffset, pos.y - verticalOffset }, color, text); return textSize; } static void renderSnaplines(ImDrawList* drawList, const BoundingBox& bbox, const ColorToggleThickness& config, int type) noexcept { if (!config.enabled) return; const auto [width, height] = interfaces->engine->getScreenSize(); const ImU32 color = Helpers::calculateColor(config, memory->globalVars->realtime); drawList->AddLine({ static_cast<float>(width / 2), static_cast<float>(type == 0 ? height : type == 1 ? 0 : height / 2) }, { (bbox.min.x + bbox.max.x) / 2, type == 0 ? bbox.max.y : type == 1 ? bbox.min.y : (bbox.min.y + bbox.max.y) / 2 }, color, config.thickness); } static void renderPlayerBox(ImDrawList* drawList, const PlayerData& playerData, const Player& config) noexcept { const BoundingBox bbox{ playerData }; if (!bbox) return; renderBox(drawList, bbox, config); renderSnaplines(drawList, bbox, config.snaplines, config.snaplineType); ImGui::PushFont(::config->fonts[config.font.fullName]); ImVec2 flashDurationPos{ (bbox.min.x + bbox.max.x) / 2, bbox.min.y - 12.5f }; if (config.name.enabled && !playerData.name.empty()) { const auto nameSize = renderText(drawList, playerData.distanceToLocal, config.textCullDistance, config.name, config.textBackground, playerData.name.c_str(), { (bbox.min.x + bbox.max.x) / 2, bbox.min.y - 5 }); flashDurationPos.y -= nameSize.y; } if (config.flashDuration.enabled && playerData.flashDuration > 0.0f) { drawList->PathArcTo(flashDurationPos, 5.0f, IM_PI / 2 - (playerData.flashDuration / 255.0f * IM_PI), IM_PI / 2 + (playerData.flashDuration / 255.0f * IM_PI)); const ImU32 color = Helpers::calculateColor(config.flashDuration, memory->globalVars->realtime); drawList->PathStroke(color, false, 1.5f); } if (config.weapon.enabled && !playerData.activeWeapon.empty()) renderText(drawList, playerData.distanceToLocal, config.textCullDistance, config.weapon, config.textBackground, playerData.activeWeapon.c_str(), { (bbox.min.x + bbox.max.x) / 2, bbox.max.y + 5 }, true, false); ImGui::PopFont(); } static void renderWeaponBox(ImDrawList* drawList, const WeaponData& weaponData, const Weapon& config) noexcept { const BoundingBox bbox{ weaponData }; if (!bbox) return; renderBox(drawList, bbox, config); renderSnaplines(drawList, bbox, config.snaplines, config.snaplineType); ImGui::PushFont(::config->fonts[config.font.fullName]); if (config.name.enabled && !weaponData.name.empty()) { if (char weaponName[100]; WideCharToMultiByte(CP_UTF8, 0, interfaces->localize->find(weaponData.name.c_str()), -1, weaponName, _countof(weaponName), nullptr, nullptr)) renderText(drawList, weaponData.distanceToLocal, config.textCullDistance, config.name, config.textBackground, weaponName, { (bbox.min.x + bbox.max.x) / 2, bbox.min.y - 5 }); } if (config.ammo.enabled && weaponData.clip != -1) { const auto text{ std::to_string(weaponData.clip) + " / " + std::to_string(weaponData.reserveAmmo) }; renderText(drawList, weaponData.distanceToLocal, config.textCullDistance, config.ammo, config.textBackground, text.c_str(), { (bbox.min.x + bbox.max.x) / 2, bbox.max.y + 5 }, true, false); } ImGui::PopFont(); } static void renderEntityBox(ImDrawList* drawList, const EntityData& entityData, const char* name, const Shared& config) noexcept { const BoundingBox bbox{ entityData }; if (!bbox) return; renderBox(drawList, bbox, config); renderSnaplines(drawList, bbox, config.snaplines, config.snaplineType); ImGui::PushFont(::config->fonts[config.font.fullName]); if (config.name.enabled) renderText(drawList, entityData.distanceToLocal, config.textCullDistance, config.name, config.textBackground, name, { (bbox.min.x + bbox.max.x) / 2, bbox.min.y - 5 }); ImGui::PopFont(); } enum EspId { ALLIES_ALL = 0, ALLIES_VISIBLE, ALLIES_OCCLUDED, ENEMIES_ALL, ENEMIES_VISIBLE, ENEMIES_OCCLUDED }; static constexpr bool renderPlayerEsp(ImDrawList* drawList, const PlayerData& playerData, EspId id) noexcept { if (config->players[id].enabled) { renderPlayerBox(drawList, playerData, config->players[id]); } return config->players[id].enabled; } static constexpr void renderWeaponEsp(ImDrawList* drawList, const WeaponData& weaponData, const Weapon& parentConfig, const Weapon& itemConfig) noexcept { const auto& config = parentConfig.enabled ? parentConfig : itemConfig; if (config.enabled) { renderWeaponBox(drawList, weaponData, config); } } static void renderEntityEsp(ImDrawList* drawList, const EntityData& entityData, const Shared& parentConfig, const Shared& itemConfig, const char* name) noexcept { const auto& config = parentConfig.enabled ? parentConfig : itemConfig; if (config.enabled) { renderEntityBox(drawList, entityData, name, config); } } void ESP::render(ImDrawList* drawList) noexcept { std::scoped_lock _{ dataMutex }; for (const auto& player : players) { if (!player.enemy) { if (!renderPlayerEsp(drawList, player, ALLIES_ALL)) { if (player.visible) renderPlayerEsp(drawList, player, ALLIES_VISIBLE); else renderPlayerEsp(drawList, player, ALLIES_OCCLUDED); } } else if (!renderPlayerEsp(drawList, player, ENEMIES_ALL)) { if (player.visible) renderPlayerEsp(drawList, player, ENEMIES_VISIBLE); else renderPlayerEsp(drawList, player, ENEMIES_OCCLUDED); } } for (const auto& weapon : weapons) { constexpr auto getWeaponIndex = [](WeaponId weaponId) constexpr noexcept { switch (weaponId) { default: return 0; case WeaponId::Glock: case WeaponId::Mac10: case WeaponId::GalilAr: case WeaponId::Ssg08: case WeaponId::Nova: case WeaponId::M249: case WeaponId::Flashbang: return 1; case WeaponId::Hkp2000: case WeaponId::Mp9: case WeaponId::Famas: case WeaponId::Awp: case WeaponId::Xm1014: case WeaponId::Negev: case WeaponId::HeGrenade: return 2; case WeaponId::Usp_s: case WeaponId::Mp7: case WeaponId::Ak47: case WeaponId::G3SG1: case WeaponId::Sawedoff: case WeaponId::SmokeGrenade: return 3; case WeaponId::Elite: case WeaponId::Mp5sd: case WeaponId::M4A1: case WeaponId::Scar20: case WeaponId::Mag7: case WeaponId::Molotov: return 4; case WeaponId::P250: case WeaponId::Ump45: case WeaponId::M4a1_s: case WeaponId::Decoy: return 5; case WeaponId::Tec9: case WeaponId::P90: case WeaponId::Sg553: case WeaponId::IncGrenade: return 6; case WeaponId::Fiveseven: case WeaponId::Bizon: case WeaponId::Aug: case WeaponId::TaGrenade: return 7; case WeaponId::Cz75a: case WeaponId::Firebomb: return 8; case WeaponId::Deagle: case WeaponId::Diversion: return 9; case WeaponId::Revolver: case WeaponId::FragGrenade: return 10; case WeaponId::Snowball: return 11; } }; if (!config->weapons.enabled) { constexpr auto dispatchWeapon = [](WeaponType type, int idx) -> std::optional<std::pair<const Weapon&, const Weapon&>> { switch (type) { case WeaponType::Pistol: return { { config->pistols[0], config->pistols[idx] } }; case WeaponType::SubMachinegun: return { { config->smgs[0], config->smgs[idx] } }; case WeaponType::Rifle: return { { config->rifles[0], config->rifles[idx] } }; case WeaponType::SniperRifle: return { { config->sniperRifles[0], config->sniperRifles[idx] } }; case WeaponType::Shotgun: return { { config->shotguns[0], config->shotguns[idx] } }; case WeaponType::Machinegun: return { { config->machineguns[0], config->machineguns[idx] } }; case WeaponType::Grenade: return { { config->grenades[0], config->grenades[idx] } }; default: return std::nullopt; } }; if (const auto w = dispatchWeapon(weapon.type, getWeaponIndex(weapon.id))) renderWeaponEsp(drawList, weapon, w->first, w->second); } else { renderWeaponEsp(drawList, weapon, config->weapons, config->weapons); } } for (const auto& entity : entities) { constexpr auto dispatchEntity = [](ClassId classId, bool flashbang) -> std::optional<std::tuple<const Shared&, const Shared&, const char*>> { switch (classId) { case ClassId::BaseCSGrenadeProjectile: if (flashbang) return { { config->projectiles[0], config->projectiles[1], "Flashbang" } }; else return { { config->projectiles[0], config->projectiles[2], "HE Grenade" } }; case ClassId::BreachChargeProjectile: return { { config->projectiles[0], config->projectiles[3], "Breach Charge" } }; case ClassId::BumpMineProjectile: return { { config->projectiles[0], config->projectiles[4], "Bump Mine" } }; case ClassId::DecoyProjectile: return { { config->projectiles[0], config->projectiles[5], "Decoy Grenade" } }; case ClassId::MolotovProjectile: return { { config->projectiles[0], config->projectiles[6], "Molotov" } }; case ClassId::SensorGrenadeProjectile: return { { config->projectiles[0], config->projectiles[7], "TA Grenade" } }; case ClassId::SmokeGrenadeProjectile: return { { config->projectiles[0], config->projectiles[8], "Smoke Grenade" } }; case ClassId::SnowballProjectile: return { { config->projectiles[0], config->projectiles[9], "Snowball" } }; case ClassId::EconEntity: return { { config->otherEntities[0], config->otherEntities[1], "Defuse Kit" } }; case ClassId::Chicken: return { { config->otherEntities[0], config->otherEntities[2], "Chicken" } }; case ClassId::PlantedC4: return { { config->otherEntities[0], config->otherEntities[3], "Planted C4" } }; default: return std::nullopt; } }; if (const auto e = dispatchEntity(entity.classId, entity.flashbang)) renderEntityEsp(drawList, entity, std::get<0>(*e), std::get<1>(*e), std::get<2>(*e)); } }
[ "danielkrupinski@outlook.com" ]
danielkrupinski@outlook.com
9f9fa3c8c17d7abfb6537f5c20073263a31ebe6f
f6e3e9dd43d13d069631339cc49cfc4455c0b984
/cryptonote/src/Logging/CommonLogger.cpp
8c7f561f2f3553ab53995c0e74947c140850acf5
[ "MIT" ]
permissive
gmin/safenetspace2
0076c9a08a8964f34f94e0b6bdc15784a9a8c483
869f53fb85c7c34cd45d9fea3a3658421ba58dda
refs/heads/master
2021-08-18T21:59:06.064389
2017-11-24T02:20:05
2017-11-24T02:20:05
102,718,693
0
0
null
2017-09-07T09:30:35
2017-09-07T09:30:35
null
UTF-8
C++
false
false
2,147
cpp
// Copyright (c) 2014-2016 XDN developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "CommonLogger.h" namespace Logging { namespace { std::string formatPattern(const std::string& pattern, const std::string& category, Level level, boost::posix_time::ptime time) { std::stringstream s; for (const char* p = pattern.c_str(); p && *p != 0; ++p) { if (*p == '%') { ++p; switch (*p) { case 0: break; case 'C': s << category; break; case 'D': s << time.date(); break; case 'T': s << time.time_of_day(); break; case 'L': s << ILogger::LEVEL_NAMES[level]; break; default: s << *p; } } else { s << *p; } } return s.str(); } } void CommonLogger::operator()(const std::string& category, Level level, boost::posix_time::ptime time, const std::string& body) { if (level <= logLevel && disabledCategories.count(category) == 0) { std::string body2 = body; if (!pattern.empty()) { size_t insertPos = 0; if (!body2.empty() && body2[0] == ILogger::COLOR_DELIMETER) { size_t delimPos = body2.find(ILogger::COLOR_DELIMETER, 1); if (delimPos != std::string::npos) { insertPos = delimPos + 1; } } body2.insert(insertPos, formatPattern(pattern, category, level, time)); } doLogString(body2); } } void CommonLogger::setPattern(const std::string& pattern) { this->pattern = pattern; } void CommonLogger::enableCategory(const std::string& category) { disabledCategories.erase(category); } void CommonLogger::disableCategory(const std::string& category) { disabledCategories.insert(category); } void CommonLogger::setMaxLevel(Level level) { logLevel = level; } CommonLogger::CommonLogger(Level level) : logLevel(level), pattern("%D %T %L [%C] ") { } void CommonLogger::doLogString(const std::string& message) { } }
[ "guom@bankledger.com" ]
guom@bankledger.com
05bf7a567edc0eac4993e0f87dbfc6973b599406
dff8a221638932704df714b30df53de003342571
/ch17/main.cpp
8468996992b1f32e3010d54213733a141217ce45
[]
no_license
DevinChang/cpp
1327da268cbbde4981c055c2e98301d63e9ca46b
f35ee6f7b2d9217bd2d40db55a697330aeffc7e8
refs/heads/master
2021-01-20T13:55:55.399888
2017-05-18T08:01:15
2017-05-18T08:01:15
90,538,499
3
0
null
null
null
null
UTF-8
C++
false
false
719
cpp
#include "ex17_4_5.h" #include <bitset> #include "ex17_11.h" int main2() { //ex17_10 std::cout << "ex17_10: " << std::endl; std::vector<int> iv{ 1, 2, 3, 5, 8, 13, 21 }; std::bitset<32> bit; for (auto p : iv) bit.set(p); std::cout << bit << std::endl; //ex17_11 std::cout << "ex17_11: " << std::endl; std::string str("1011001001"); Quiz<10> solution(str); std::string answer1("1000110110"), answer2("1111000011"); Quiz<10> stu1(answer1), stu2(answer2); std::cout << "the correct solution: " << solution.get_solusion() << std::endl; std::cout << "student1's grade: " << grade(stu1, solution) << std::endl << "student2's grade: " << grade(stu2, solution) << std::endl; system("pause"); return 0; }
[ "DevinChang@126.com" ]
DevinChang@126.com
1ff507492fa0cbd1ec924d3c904951b8fd6012d8
6fa0a0cfc80b08b11bdfcfa8ed6cf8cbae8b1c5d
/mlir/lib/ExecutionEngine/SparseTensor/NNZ.cpp
eb110def4402c9c7c02f154e52f6ad634e9f7bb0
[ "LLVM-exception", "Apache-2.0", "NCSA" ]
permissive
WangLuofan/llvm-project
2a9d10924d48e157f64c23a8e1320cc0b1c406ea
87549e61dae5c1cbb8ef590058aa93053ded481d
refs/heads/main
2022-11-22T22:26:22.368740
2022-10-21T14:22:26
2022-10-21T14:23:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,489
cpp
//===- NNZ.cpp - NNZ-statistics for direct sparse2sparse conversion -------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains method definitions for `SparseTensorNNZ`. // // This file is part of the lightweight runtime support library for sparse // tensor manipulations. The functionality of the support library is meant // to simplify benchmarking, testing, and debugging MLIR code operating on // sparse tensors. However, the provided functionality is **not** part of // core MLIR itself. // //===----------------------------------------------------------------------===// #include "mlir/ExecutionEngine/SparseTensor/Storage.h" using namespace mlir::sparse_tensor; //===----------------------------------------------------------------------===// /// Allocate the statistics structure for the desired sizes and /// sparsity (in the target tensor's storage-order). This constructor /// does not actually populate the statistics, however; for that see /// `initialize`. /// /// Precondition: `dimSizes` must not contain zeros. SparseTensorNNZ::SparseTensorNNZ(const std::vector<uint64_t> &dimSizes, const std::vector<DimLevelType> &sparsity) : dimSizes(dimSizes), dimTypes(sparsity), nnz(getRank()) { assert(dimSizes.size() == dimTypes.size() && "Rank mismatch"); bool alreadyCompressed = false; (void)alreadyCompressed; uint64_t sz = 1; // the product of all `dimSizes` strictly less than `r`. for (uint64_t rank = getRank(), r = 0; r < rank; r++) { const DimLevelType dlt = sparsity[r]; if (isCompressedDLT(dlt)) { if (alreadyCompressed) MLIR_SPARSETENSOR_FATAL( "Multiple compressed layers not currently supported"); alreadyCompressed = true; nnz[r].resize(sz, 0); // Both allocate and zero-initialize. } else if (isDenseDLT(dlt)) { if (alreadyCompressed) MLIR_SPARSETENSOR_FATAL( "Dense after compressed not currently supported"); } else if (isSingletonDLT(dlt)) { // Singleton after Compressed causes no problems for allocating // `nnz` nor for the yieldPos loop. This remains true even // when adding support for multiple compressed dimensions or // for dense-after-compressed. } else { MLIR_SPARSETENSOR_FATAL("unsupported dimension level type: %d\n", static_cast<uint8_t>(dlt)); } sz = detail::checkedMul(sz, dimSizes[r]); } } /// Lexicographically enumerates all indicies for dimensions strictly /// less than `stopDim`, and passes their nnz statistic to the callback. /// Since our use-case only requires the statistic not the coordinates /// themselves, we do not bother to construct those coordinates. void SparseTensorNNZ::forallIndices(uint64_t stopDim, SparseTensorNNZ::NNZConsumer yield) const { assert(stopDim < getRank() && "Dimension out of bounds"); assert(isCompressedDLT(dimTypes[stopDim]) && "Cannot look up non-compressed dimensions"); forallIndices(yield, stopDim, 0, 0); } /// Adds a new element (i.e., increment its statistics). We use /// a method rather than inlining into the lambda in `initialize`, /// to avoid spurious templating over `V`. And this method is private /// to avoid needing to re-assert validity of `ind` (which is guaranteed /// by `forallElements`). void SparseTensorNNZ::add(const std::vector<uint64_t> &ind) { uint64_t parentPos = 0; for (uint64_t rank = getRank(), r = 0; r < rank; ++r) { if (isCompressedDLT(dimTypes[r])) nnz[r][parentPos]++; parentPos = parentPos * dimSizes[r] + ind[r]; } } /// Recursive component of the public `forallIndices`. void SparseTensorNNZ::forallIndices(SparseTensorNNZ::NNZConsumer yield, uint64_t stopDim, uint64_t parentPos, uint64_t d) const { assert(d <= stopDim); if (d == stopDim) { assert(parentPos < nnz[d].size() && "Cursor is out of range"); yield(nnz[d][parentPos]); } else { const uint64_t sz = dimSizes[d]; const uint64_t pstart = parentPos * sz; for (uint64_t i = 0; i < sz; i++) forallIndices(yield, stopDim, pstart + i, d + 1); } }
[ "2998727+wrengr@users.noreply.github.com" ]
2998727+wrengr@users.noreply.github.com
1e6b9edf99e86af237dab3eb508f04f095dc387c
e1f82ab09d881b4bff7d77064b376c581becd3f5
/UNO/hc165/hc165.ino
b8eb8e3cf9e31705cce8100793a40b834bfd4437
[]
no_license
52manhua/mydruino
ee1195680ee649c477de93eae144043a068b8ae4
e9d4e4f2ced18fd39025d1ff02e3fd1c4265c556
refs/heads/master
2021-01-15T21:19:09.695558
2017-11-08T02:41:58
2017-11-08T02:41:58
99,858,803
0
0
null
null
null
null
UTF-8
C++
false
false
4,021
ino
/* * SN74HC165N_shift_reg * * Program to shift in the bit values from a SN74HC165N 8-bit * parallel-in/serial-out shift register. * * This sketch demonstrates reading in 16 digital states from a * pair of daisy-chained SN74HC165N shift registers while using * only 4 digital pins on the Arduino. * * You can daisy-chain these chips by connecting the serial-out * (Q7 pin) on one shift register to the serial-in (Ds pin) of * the other. * * Of course you can daisy chain as many as you like while still * using only 4 Arduino pins (though you would have to process * them 4 at a time into separate unsigned long variables). * */ /* How many shift register chips are daisy-chained. */ #define NUMBER_OF_SHIFT_CHIPS 1 /* Width of data (how many ext lines). */ #define DATA_WIDTH NUMBER_OF_SHIFT_CHIPS * 8 /* Width of pulse to trigger the shift register to read and latch. */ #define PULSE_WIDTH_USEC 5 /* Optional delay between shift register reads. */ #define POLL_DELAY_MSEC 1 /* You will need to change the "int" to "long" If the * NUMBER_OF_SHIFT_CHIPS is higher than 2. */ #define BYTES_VAL_T unsigned int int ploadPin = 8; // Connects to Parallel load pin the 165 int clockEnablePin = 9; // Connects to Clock Enable pin the 165 int dataPin = 11; // Connects to the Q7 pin the 165 int clockPin = 12; // Connects to the Clock pin the 165 BYTES_VAL_T pinValues; BYTES_VAL_T oldPinValues; /* *To play music */ #include "pitches.h" #define uint8_t byte // notes to play, corresponding to the 3 sensors: int notes[] = { NOTE_A4, NOTE_B4,NOTE_C3,NOTE_D3,NOTE_E3,NOTE_F3,NOTE_G3,NOTE_A2 }; /* This function is essentially a "shift-in" routine reading the * serial Data from the shift register chips and representing * the state of those pins in an unsigned integer (or long). */ BYTES_VAL_T read_shift_regs() { long bitVal; BYTES_VAL_T bytesVal = 0; /* Trigger a parallel Load to latch the state of the data lines, */ digitalWrite(clockEnablePin, HIGH); digitalWrite(ploadPin, LOW); delayMicroseconds(PULSE_WIDTH_USEC); digitalWrite(ploadPin, HIGH); digitalWrite(clockEnablePin, LOW); /* Loop to read each bit value from the serial out line * of the SN74HC165N. */ for(int i = 0; i < DATA_WIDTH; i++) { bitVal = digitalRead(dataPin); /* Set the corresponding bit in bytesVal. */ bytesVal |= (bitVal << ((DATA_WIDTH-1) - i)); /* Pulse the Clock (rising edge shifts the next bit). */ digitalWrite(clockPin, HIGH); delayMicroseconds(PULSE_WIDTH_USEC); digitalWrite(clockPin, LOW); } return(bytesVal); } /* Dump the list of zones along with their current status. */ void display_pin_values() { Serial.print("Pin States:\r\n"); for(int i = 0; i < DATA_WIDTH; i++) { Serial.print(" Pin-"); Serial.print(i); Serial.print(": "); if((pinValues >> i) & 1){ Serial.print("HIGH"); Serial.print(notes[i]); tone(5, notes[i], 500);} else{ Serial.print("LOW");} Serial.print("\r\n"); } Serial.print("\r\n"); } void setup() { Serial.begin(9600); /* Initialize our digital pins... */ pinMode(ploadPin, OUTPUT); pinMode(clockEnablePin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, INPUT); digitalWrite(clockPin, LOW); digitalWrite(ploadPin, HIGH); /* Read in and display the pin states at startup. */ pinValues = read_shift_regs(); display_pin_values(); oldPinValues = pinValues; } void loop() { /* Read the state of all zones. */ pinValues = read_shift_regs(); /* If there was a chage in state, display which ones changed. */ if(pinValues != oldPinValues) { Serial.print("*Pin value change detected*\r\n"); display_pin_values(); oldPinValues = pinValues; } delay(POLL_DELAY_MSEC); }
[ "top355@yopmail.com" ]
top355@yopmail.com
6d67601dc52fe62d48c9c6efc6a66b75c7574e3b
12246ea976ff53b4b947b8e51a1327fa0bf5081b
/Comparison/main.cpp
bb1af504995d3c46f8abf5a640ce2a9cd2624060
[]
no_license
Ligvest/Learning.STL
3abcfcf99c4ba505438f52387b5e24407944bddd
ed7634eec6bf1a7ac3ced46c0dd3adb5f88bc668
refs/heads/master
2020-03-27T23:31:28.692500
2018-09-04T09:57:47
2018-09-04T09:57:47
147,324,920
0
0
null
null
null
null
UTF-8
C++
false
false
337
cpp
#include <iostream> #include <array> int main() { std::array<int, 4> arr = { 1,56,18,7 }; std::array<int, 4> arr2 = { 1,55,190,8 }; bool result = (arr == arr2); std::cout << "(arr == arr2) = " << result << std::endl; result = (arr > arr2); std::cout << "(arr > arr2) = " << result << std::endl; system("pause"); return 0; }
[ "Dovzhik.Anatoly@gmail.com" ]
Dovzhik.Anatoly@gmail.com
924c387fbf97c71024ec7054f5694c33455a5b85
d1c817808f6b34875e3d3d15c881f257248596ca
/pbdata/alignment/CmpAlignment.hpp
056b142ab7e50b624bdb44f474c2ee7a797b15ae
[]
no_license
mchaisso/pbsamstream
09e0be7fa3300a2d47f0b5149c7036573d7ea978
44f22d2c9f33d976677682dd29ae39fcb1d1d17c
refs/heads/master
2021-09-16T15:24:09.208501
2018-06-21T20:36:53
2018-06-21T20:36:53
110,061,502
4
0
null
2018-05-18T14:34:17
2017-11-09T03:16:26
C++
UTF-8
C++
false
false
3,010
hpp
#ifndef DATASTRUCTURES_ALIGNMENT_CMP_ALIGNMENT_H_ #define DATASTRUCTURES_ALIGNMENT_CMP_ALIGNMENT_H_ #include <cassert> #include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> #include "../Enumerations.h" #include "../Types.h" class CmpAlignmentBase { public: // // For use in referencing alignment sets. TODO: subclass. // PlatformId platformId; int Z; unsigned int index, readGroupId, movieId, refSeqId; unsigned int expId, runId, panel; unsigned int x, y; unsigned int rcRefStrand; unsigned int holeNumber; unsigned int offsetBegin, offsetEnd; unsigned int setNumber, strobeNumber, mapQV, nBackRead, nReadOverlap; unsigned int subreadId; unsigned int nMatch, nMismatch, nIns, nDel; std::vector<unsigned char> alignmentArray; std::vector<unsigned int> alignmentIndex; static std::map<std::string, int> columnNameToIndex; static bool initializedColumnNameToIndex; std::map<std::string, std::vector<UChar> > fields; unsigned int *GetAlignmentIndex(); int GetAlignmentIndexSize(); unsigned int GetAlignedStrand(); unsigned int GetRCRefStrand(); // synonym unsigned int GetTStrand(); bool GetX(int &xp); unsigned int GetAlignmentId(); unsigned int GetX(); unsigned int GetY(); unsigned int GetMovieId(); unsigned int GetAlnGroupId(); unsigned int GetReadGroupId(); unsigned int LookupColumnValue(const char *columnName); void InitializeColumnNameToIndex(std::vector<std::string> &columnNames); unsigned int GetHoleNumber(); unsigned int GetRefGroupId(); unsigned int GetRefSeqId(); unsigned int GetOffsetBegin(); unsigned int GetOffsetEnd(); unsigned int GetQueryStart(); unsigned int GetQueryEnd(); unsigned int GetRefStart(); unsigned int GetRefEnd(); unsigned int GetNMatch(); unsigned int GetNMismatch(); unsigned int GetNInsertions(); unsigned int GetNDeletions(); unsigned int GetMapQV(); unsigned int GetSubreadId(); unsigned int GetStrobeNumber(); unsigned int GetSetNumber(); CmpAlignmentBase(PlatformId platformIdP = Springfield); void SetPlatformId(PlatformId platformIdP); }; class CmpAlignment : public CmpAlignmentBase { public: int qStrand, tStrand; DNALength qStart, qLength; DNALength tStart, tLength; // // Default constructor just calls the base constructor to initialize platoformType CmpAlignment(PlatformId pid = Springfield); void StoreAlignmentIndex(unsigned int *alignmentIndexPtr, DSLength alignmentIndexLength); void StoreAlignmentArray(unsigned char *alignmentArrayPtr, DSLength alignmentArrayLength); template <typename T_Field> void StoreField(std::string fieldName, T_Field *fieldValues, DSLength length); CmpAlignment &operator=(const CmpAlignment &rhs); int operator<(const CmpAlignment &rhs) const; }; #include "CmpAlignmentImpl.hpp" #endif
[ "mchaisso@usc.edu" ]
mchaisso@usc.edu
f919dc1a96f1ac8000cc3548ea84472e5206156f
97b629e9bd4ff54f65d6d9eb2e0f2db3d8b71129
/src/clientversion.h
d25e3ee7705aaeaa5c8da9d4fa0c5471d69cd85b
[ "MIT" ]
permissive
vencoin1/Vencoin
825bb990b39894fd79dd8170fdda688236ea7a36
d21154b5d8faf3d77421e1272974b27bc3094777
refs/heads/master
2020-05-01T04:03:37.080759
2019-03-23T08:27:06
2019-03-23T08:27:06
175,571,766
0
0
null
null
null
null
UTF-8
C++
false
false
2,064
h
// Copyright (c) 2009-2014 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CLIENTVERSION_H #define BITCOIN_CLIENTVERSION_H #if defined(HAVE_CONFIG_H) #include "config/venture-config.h" #else /** * client versioning and copyright year */ //! These need to be macros, as clientversion.cpp's and venture*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 1 #define CLIENT_VERSION_MINOR 0 #define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_BUILD 0 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true /** * Copyright year (2009-this) * Todo: update this when changing our copyright comments in the source */ #define COPYRIGHT_YEAR 2019 #endif //HAVE_CONFIG_H /** * Converts the parameter X to a string after macro replacement on X has been performed. * Don't merge these into one macro! */ #define STRINGIZE(X) DO_STRINGIZE(X) #define DO_STRINGIZE(X) #X //! Copyright string used in Windows .rc files #define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, 2017-" STRINGIZE(COPYRIGHT_YEAR) " The VENTURE Core Developers" /** * ventured-res.rc includes this file, but it cannot cope with real c++ code. * WINDRES_PREPROC is defined to indicate that its pre-processor is running. * Anything other than a define should be guarded below. */ #if !defined(WINDRES_PREPROC) #include <string> #include <vector> static const int CLIENT_VERSION = 1000000 * CLIENT_VERSION_MAJOR /// + 10000 * CLIENT_VERSION_MINOR /// + 100 * CLIENT_VERSION_REVISION /// + 1 * CLIENT_VERSION_BUILD; extern const std::string CLIENT_NAME; extern const std::string CLIENT_BUILD; extern const std::string CLIENT_DATE; std::string FormatFullVersion(); std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments); #endif // WINDRES_PREPROC #endif // BITCOIN_CLIENTVERSION_H
[ "vencoin@yandex.com" ]
vencoin@yandex.com
746f4b6c97c321a44e9d77f3211be8886b690d8b
9d86e3d3e2b9c9a56e7a73c632de6e2e52196800
/二叉树(前中后序非递归).cpp
f809abcf9e0b170ae0b3d0cf1d4819154387c663
[]
no_license
1904114835/DLUT_shujujiegou_datastructure
106da4cdfd8cfbac985e14a8b38f89c80975fb3b
c53559efe1bbc27152516ad0cde93d9f1d4edeb8
refs/heads/master
2022-01-13T12:00:30.391305
2019-06-09T12:50:30
2019-06-09T12:50:30
189,977,004
3
0
null
null
null
null
UTF-8
C++
false
false
1,728
cpp
#include<bits/stdc++.h> #define MAX 200 using namespace std; typedef struct Node{ int data; Node *lc,*rc; }Node,*Tree; struct Stack{ Tree data[MAX]; int point; }; struct Queue{ Tree data[MAX]; int f,r; }; typedef struct { struct { Tree d; int flag; }data[MAX]; int top; }SeqStack2; Tree creat(){ Tree T; int a; scanf("%d",&a); if(a!=0) { T=(Tree)malloc(sizeof(Node)); T->data=a; T->lc=creat(); T->rc=creat(); } else { T=NULL; } return T; } void xxbl(Tree T) { if(T!=NULL){ printf("%d",T->data); xxbl(T->lc); xxbl(T->rc); } else{return;} } void xxbl_No_digui(Tree root) { Tree T; T=root; Stack s; s.point=-1; while(T!=NULL||s.point!=-1) { while(T!=NULL) { cout<<T->data<<" "; s.data[++s.point]=T; T=T->lc; } if(s.point!=-1) { T=s.data[s.point--]; T=T->rc; } } } void zxbl_No_digui(Tree root) { Tree T=root; Stack s; s.point=-1; while(T!=NULL||s.point!=-1){ while(T!=NULL){ s.data[++s.point]=T; T=T->lc; } if(s.point!=-1){ T=s.data[s.point--]; cout<<T->data<<" "; T=T->rc; } } } void hxbl_No_digui(Tree root) { cout<<"后序遍历:"<<endl; SeqStack2 s; s.top=-1; Tree p=root; do { while(p!=NULL) { s.data[++s.top].d=p; s.data[s.top].flag=0; p=p->lc; } while((s.top>-1)&&(s.data[s.top].flag==1)) { p=s.data[s.top--].d; printf("%d ",p->data); } if(s.top>-1) { s.data[s.top].flag=1; p=s.data[s.top].d; p=p->rc; } }while(s.top>-1); } int main() { Tree T; printf("前序输入,以0结尾:\n"); T=creat(); xxbl(T); cout<<endl; xxbl_No_digui(T); cout<<endl; zxbl_No_digui(T); cout<<endl; hxbl_No_digui(T); return 0; } //1 2 4 0 0 5 0 0 3 6 0 0 7 0 0
[ "noreply@github.com" ]
noreply@github.com
66ea036778a4c3adfb42c0dad8cbc7c9e965f66d
3a6ad2aae6210dac61b2c8d058fe9b372f85b4ae
/scons/libs/processing/src/ControlScaler.cxx
f5db169bb709fe975d44db963fbe8f41eb422ee5
[]
no_license
millerthegorilla/clam
d6551afc56db62d293adce1c9b72e2828455b60d
5e0e95394b57260af75af0cc7a5bc800c46cf750
refs/heads/master
2020-12-25T14:48:19.716915
2016-09-03T14:03:59
2016-09-03T14:03:59
67,293,280
0
0
null
null
null
null
UTF-8
C++
false
false
1,342
cxx
#include "ControlScaler.hxx" #include "ProcessingFactory.hxx" namespace CLAM { namespace Hidden { static const char * metadata[] = { "key", "ControlScaler", "category", "Controls", "description", "ControlScaler", 0 }; static FactoryRegistrator<ProcessingFactory, ControlScaler> reg = metadata; } void ControlScalerConfig::DefaultInit() { AddAll(); UpdateData(); SetAmount( 1.0 ); } ControlScaler::ControlScaler() : mInControl( "Control In", this , &ControlScaler::InControlCallback ) , mGainControl( "Gain Amount", this , &ControlScaler::InControlCallback ) , mOutControl( "Control Out", this ) { Configure( mConfig ); } ControlScaler::ControlScaler( const ControlScalerConfig& cfg ) : mInControl( "Control In", this , &ControlScaler::InControlCallback ) , mGainControl( "Gain Amount", this , &ControlScaler::InControlCallback ) , mOutControl( "Control Out", this ) { Configure( cfg ); } bool ControlScaler::ConcreteConfigure( const ProcessingConfig& cfg ) { CopyAsConcreteConfig( mConfig, cfg ); mGainControl.DoControl(mConfig.GetAmount()); return true; } void ControlScaler::InControlCallback(const TControlData & value) { TControlData in = mInControl.GetLastValue(); TControlData gain = mGainControl.GetLastValue(); mOutControl.SendControl(in * gain); } bool ControlScaler::Do() { return true; } }
[ "jamesstewartmiller@gmail.com" ]
jamesstewartmiller@gmail.com
3898aaa7c09c4ec1c3f0ff604d384dc71206d169
3b6d96b48e881da0cb31a3fffbcefddfb89873cf
/src/TextureHandler.cpp
5bdee12687465c88f4aabf4fd496ebcb96d3e11e
[]
no_license
Hagartinger/Chess
c5d6435b4f9fd07b7584cd5fedc5e2250174ca53
27c99230470423f3be10643d4271435d1b8affa2
refs/heads/master
2021-09-20T01:12:34.210141
2018-08-02T05:43:17
2018-08-02T05:43:17
111,571,788
0
0
null
null
null
null
UTF-8
C++
false
false
841
cpp
#include <iostream> #include "TextureHandler.h" TextureHandler::TextureHandler(){ } TextureHandler::~TextureHandler(){ } SDL_Texture* TextureHandler::load(SDL_Renderer* renderer, std::string textureName) { if(textures[textureName] == 0) {//don't have such texture std::string filePath = "../resources/" + textureName + ".png"; SDL_Surface* tempSurface = 0; tempSurface = IMG_Load(filePath.c_str()); if (tempSurface == 0) { std::cerr<<"Couldn't open File from: "<<filePath<<std::endl; } else { SDL_Texture* newTexture = SDL_CreateTextureFromSurface(renderer, tempSurface); if(newTexture == 0) { std::cerr<<"Creation of Texture from surace went wrong"<<std::endl; } else { textures[textureName] = newTexture ; } SDL_FreeSurface(tempSurface); } } return textures[textureName]; }
[ "ArturDzabiev@gmail.com" ]
ArturDzabiev@gmail.com
025361a02604ebc29e74ca86c43f6e92ed0f585e
09ee4ec9a935b3c385700f3fe606c639fee1ac3e
/C++/Sum in array.cpp
fde20846cd1248fd02f663a32de4651f8bc53871
[ "MIT" ]
permissive
wahyudieko/Hello-world
f80b6be04a265755fddd95e7a3b729ebb4d3d5c7
36a9e8f6469e25c48c163705f8d130ad40323266
refs/heads/master
2020-03-30T20:34:06.471992
2018-10-28T04:28:15
2018-10-28T04:28:15
151,593,596
2
1
MIT
2018-10-28T04:28:15
2018-10-04T15:23:59
HTML
UTF-8
C++
false
false
219
cpp
#include <iostream> using namespace std; int main(){ int n,sum = 0; cin >> n; int o[n] = {}; for(int i =0;i < n;i++){ cin >> o[i]; } for(int i =0;i < n;i++){ sum = sum + o[i]; } cout << sum << endl; return 0; }
[ "sarthakmaggu5@gmail.com" ]
sarthakmaggu5@gmail.com
5a684ea28c533118e0e9b9cf5dada0630646a2f3
53c5c9965743e1f2d74fb06dd24b3a846ea9f2f9
/finTest/Q1b.cpp
a4940e16c8abbc2b17dd89fc4232308ee90ba403
[]
no_license
ctm6100/CCC-Lab
3f4c0cc4c8f691bca7865b8afc3d2e7dbbbbf4bd
b3aaf600684b11f3f21a1ab05df4fe9f2f265bd5
refs/heads/main
2023-01-30T11:38:05.606439
2020-12-08T03:35:02
2020-12-08T03:35:02
304,251,876
1
0
null
null
null
null
UTF-8
C++
false
false
4,336
cpp
#include <avr/io.h> #include "avr/interrupt.h" #include <ctype.h> //LED GPIO--------------------------------------------------------------------------- //LEDa1 -> PB0 (D8) //LEDa2 -> PB1 (D9) //LEDb1 -> PC4 (A4) //LEDb1 -> PC5 (A5) void LEDa1on(){ PORTB |= (1 << 0); } void LEDa1off(){ PORTB &= ~(1 << 0); } void LEDa1Toggle(){ PORTB ^= (1 << 0); } void LEDa2on(){ PORTB |= (1 << 1); } void LEDa2off(){ PORTB &= ~(1 << 1); } void LEDa2Toggle(){ PORTB ^= (1 << 1); } void LEDb1on(){ PORTC |= (1 << 4); } void LEDb1off(){ PORTC &= ~(1 << 4); } void LEDb1Toggle(){ PORTC ^= (1 << 4); } void LEDb2on(){ PORTC |= (1 << 5); } void LEDb2off(){ PORTC &= ~(1 << 5); } void LEDb2Toggle(){ PORTC ^= (1 << 5); } void LEDsetup(){ DDRC |= (1 << 4); DDRC |= (1 << 5); DDRB |= (1 << 0); DDRB |= (1 << 1); LEDa1on(); //LEDa2on(); LEDb1on(); //LEDb2on(); } //LED GPIO--------------------------------------------------------------------------- //Timer0----------------------------------------------------------------------------- //global Var for timer0 bool timer0Ready = false; int timer0Loop=0; //Timer0 Output Compare Match A Interrupt Enable void T0MatchInterruptEnable(){ TIMSK0 |= (1 << OCIE0A); sei();//use this OR set optimization level to NONE OR BOTH } //Timer0 Output Compare Match A Interrupt Disable void T0MatchInterruptDisable(){ TIMSK0 &= ~(1 << OCIE0A); } void timer0SetCTC(){ //TCCR0A = 0x02; //A:**** **10 B:**** 0***, 0 10 CTC mode TCCR0B &= ~(1 << WGM02); TCCR0A |= (1 << WGM01); TCCR0A &= ~(1 << WGM00); } void timer0SetPrescale1024(){ //**** *101 => Prescale1024, TCCR0B |= (1 << CS02); TCCR0B &= ~(1 << CS01); TCCR0B |= (1 << CS00); } void timer0SetRising(){ //**** *11! => Rising edge, TCCR0B |= (1 << CS02); TCCR0B |= (1 << CS01); TCCR0B |= (1 << CS00); } void timer0SetFalling(){ //**** *110 => falling edge, TCCR0B |= (1 << CS02); TCCR0B |= (1 << CS01); TCCR0B &= ~(1 << CS00); } void T0DelayInterrputSetup(){ //each CTC match = 8000us, for interupt OCR0A = 124;//125-1 timer0SetCTC(); timer0SetPrescale1024(); } void D02s(){ //8000us, loop 25times = 0.2s timer0Loop = 25; } void D1s(){ //8000us, loop 125times = 1s timer0Loop = 125; } //content for Timer0 Output Compare Match A Interrupt(ISR: TIMER0_COMPA_vect) ISR (TIMER0_COMPA_vect){ static int timer0State =0; if (timer0Loop > 0){// if > 0 than loop timer0Loop--; }else{ D1s(); //timer0Ready= true; if (timer0State == 0){//state X LEDb1on(); LEDb2on(); LEDa1off(); timer0State++; }else if (timer0State == 1){ LEDb1off(); LEDb2off(); LEDa1on(); timer0State++; }else{ LEDb1on(); LEDb2on(); LEDa1on(); timer0State=0; } //T0MatchInterruptDisable();// disable the on99 interrupt:( } } //End of Timer0----------------------------------------------------------------------------- int LEDState =0; //INT0----------------------------------------------------------------------------- int pressCount =0; int state =0; void INT0set(char inp){ switch(tolower(inp)){//case insensitive case 'r':{//rising edge EICRA |= (1 << ISC01); EICRA |= (1 << ISC00); break;} case 'f':{//falling edge EICRA |= (1 << ISC01); EICRA &= ~(1 << ISC00); break;} case 'a':{//any change EICRA &= ~(1 << ISC01); EICRA |= (1 << ISC00); break;} case 'l':{//any change EICRA &= ~(1 << ISC01); EICRA &= ~(1 << ISC00); break;} } } //IN0 Interrupt Enable void INT0MatchInterruptEnable(){ EIMSK |= (1 << INT0); //sei();//in case you forgot la :p } //IN0 Interrupt Disable void INT0MatchInterruptDisable(){ EIMSK &= ~(1 << INT0); } ISR(INT0_vect){ INT0MatchInterruptDisable(); //ISR content if (LEDState == 0){ LEDState =1; T0MatchInterruptDisable(); LEDb1off(); LEDb2off(); LEDa1off(); }else{ LEDState =0; T0MatchInterruptEnable(); } INT0MatchInterruptEnable(); //T2DelayInt(); //T2MatchInterruptEnable(); } //END of INT0 stuff----------------------------------------------------------------------------- int main(void) { LEDsetup(); /* Replace with your application code */ D1s(); T0DelayInterrputSetup(); T0MatchInterruptEnable(); INT0set('f'); INT0MatchInterruptEnable(); sei(); while (1) { //T2D1s(); //LEDa1Toggle(); //LEDa2Toggle(); //LEDb1Toggle(); //LEDb2Toggle(); } }
[ "noreply@github.com" ]
noreply@github.com
3c2c30b539c71d0e20b457c083af9b363bdaed6b
9a9529e92db9080eeac812b43f744372faea3aa3
/test/normalize_to_nfkc_058.cpp
aad3752ca4fb1f389d3bcebdfb473cd594a7ee37
[ "LicenseRef-scancode-unknown-license-reference", "BSL-1.0" ]
permissive
LonghronShen/text
b14c17215d8ec6ead0cf1e09fa795470fc009159
797da04625e66901390dea013a74c2638df80f21
refs/heads/master
2020-04-08T08:36:51.197496
2019-03-06T08:54:32
2019-03-06T08:54:32
159,185,388
0
0
BSL-1.0
2018-11-26T14:49:32
2018-11-26T14:49:31
null
UTF-8
C++
false
false
733,641
cpp
// Warning! This file is autogenerated. #include <boost/text/normalize_string.hpp> #include <boost/text/utility.hpp> #include <boost/text/string_utility.hpp> #include <gtest/gtest.h> #include <algorithm> TEST(normalization, nfkc_058_000) { // CFE0;CFE0;110F 116E;CFE0;110F 116E; // (쿠; 쿠; 쿠; 쿠; 쿠; ) HANGUL SYLLABLE KU { std::array<uint32_t, 1> const c1 = {{ 0xCFE0 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE0 }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x116E }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE0 }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x116E }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_001) { // CFE1;CFE1;110F 116E 11A8;CFE1;110F 116E 11A8; // (쿡; 쿡; 쿡; 쿡; 쿡; ) HANGUL SYLLABLE KUG { std::array<uint32_t, 1> const c1 = {{ 0xCFE1 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE1 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE1 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_002) { // CFE2;CFE2;110F 116E 11A9;CFE2;110F 116E 11A9; // (쿢; 쿢; 쿢; 쿢; 쿢; ) HANGUL SYLLABLE KUGG { std::array<uint32_t, 1> const c1 = {{ 0xCFE2 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE2 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE2 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_003) { // CFE3;CFE3;110F 116E 11AA;CFE3;110F 116E 11AA; // (쿣; 쿣; 쿣; 쿣; 쿣; ) HANGUL SYLLABLE KUGS { std::array<uint32_t, 1> const c1 = {{ 0xCFE3 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE3 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE3 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_004) { // CFE4;CFE4;110F 116E 11AB;CFE4;110F 116E 11AB; // (쿤; 쿤; 쿤; 쿤; 쿤; ) HANGUL SYLLABLE KUN { std::array<uint32_t, 1> const c1 = {{ 0xCFE4 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE4 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE4 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_005) { // CFE5;CFE5;110F 116E 11AC;CFE5;110F 116E 11AC; // (쿥; 쿥; 쿥; 쿥; 쿥; ) HANGUL SYLLABLE KUNJ { std::array<uint32_t, 1> const c1 = {{ 0xCFE5 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE5 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE5 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_006) { // CFE6;CFE6;110F 116E 11AD;CFE6;110F 116E 11AD; // (쿦; 쿦; 쿦; 쿦; 쿦; ) HANGUL SYLLABLE KUNH { std::array<uint32_t, 1> const c1 = {{ 0xCFE6 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE6 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE6 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_007) { // CFE7;CFE7;110F 116E 11AE;CFE7;110F 116E 11AE; // (쿧; 쿧; 쿧; 쿧; 쿧; ) HANGUL SYLLABLE KUD { std::array<uint32_t, 1> const c1 = {{ 0xCFE7 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE7 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE7 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_008) { // CFE8;CFE8;110F 116E 11AF;CFE8;110F 116E 11AF; // (쿨; 쿨; 쿨; 쿨; 쿨; ) HANGUL SYLLABLE KUL { std::array<uint32_t, 1> const c1 = {{ 0xCFE8 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE8 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE8 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_009) { // CFE9;CFE9;110F 116E 11B0;CFE9;110F 116E 11B0; // (쿩; 쿩; 쿩; 쿩; 쿩; ) HANGUL SYLLABLE KULG { std::array<uint32_t, 1> const c1 = {{ 0xCFE9 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFE9 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFE9 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_010) { // CFEA;CFEA;110F 116E 11B1;CFEA;110F 116E 11B1; // (쿪; 쿪; 쿪; 쿪; 쿪; ) HANGUL SYLLABLE KULM { std::array<uint32_t, 1> const c1 = {{ 0xCFEA }}; std::array<uint32_t, 1> const c2 = {{ 0xCFEA }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFEA }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_011) { // CFEB;CFEB;110F 116E 11B2;CFEB;110F 116E 11B2; // (쿫; 쿫; 쿫; 쿫; 쿫; ) HANGUL SYLLABLE KULB { std::array<uint32_t, 1> const c1 = {{ 0xCFEB }}; std::array<uint32_t, 1> const c2 = {{ 0xCFEB }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFEB }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_012) { // CFEC;CFEC;110F 116E 11B3;CFEC;110F 116E 11B3; // (쿬; 쿬; 쿬; 쿬; 쿬; ) HANGUL SYLLABLE KULS { std::array<uint32_t, 1> const c1 = {{ 0xCFEC }}; std::array<uint32_t, 1> const c2 = {{ 0xCFEC }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFEC }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_013) { // CFED;CFED;110F 116E 11B4;CFED;110F 116E 11B4; // (쿭; 쿭; 쿭; 쿭; 쿭; ) HANGUL SYLLABLE KULT { std::array<uint32_t, 1> const c1 = {{ 0xCFED }}; std::array<uint32_t, 1> const c2 = {{ 0xCFED }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFED }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_014) { // CFEE;CFEE;110F 116E 11B5;CFEE;110F 116E 11B5; // (쿮; 쿮; 쿮; 쿮; 쿮; ) HANGUL SYLLABLE KULP { std::array<uint32_t, 1> const c1 = {{ 0xCFEE }}; std::array<uint32_t, 1> const c2 = {{ 0xCFEE }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFEE }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_015) { // CFEF;CFEF;110F 116E 11B6;CFEF;110F 116E 11B6; // (쿯; 쿯; 쿯; 쿯; 쿯; ) HANGUL SYLLABLE KULH { std::array<uint32_t, 1> const c1 = {{ 0xCFEF }}; std::array<uint32_t, 1> const c2 = {{ 0xCFEF }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFEF }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_016) { // CFF0;CFF0;110F 116E 11B7;CFF0;110F 116E 11B7; // (쿰; 쿰; 쿰; 쿰; 쿰; ) HANGUL SYLLABLE KUM { std::array<uint32_t, 1> const c1 = {{ 0xCFF0 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF0 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF0 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_017) { // CFF1;CFF1;110F 116E 11B8;CFF1;110F 116E 11B8; // (쿱; 쿱; 쿱; 쿱; 쿱; ) HANGUL SYLLABLE KUB { std::array<uint32_t, 1> const c1 = {{ 0xCFF1 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF1 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF1 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_018) { // CFF2;CFF2;110F 116E 11B9;CFF2;110F 116E 11B9; // (쿲; 쿲; 쿲; 쿲; 쿲; ) HANGUL SYLLABLE KUBS { std::array<uint32_t, 1> const c1 = {{ 0xCFF2 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF2 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF2 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_019) { // CFF3;CFF3;110F 116E 11BA;CFF3;110F 116E 11BA; // (쿳; 쿳; 쿳; 쿳; 쿳; ) HANGUL SYLLABLE KUS { std::array<uint32_t, 1> const c1 = {{ 0xCFF3 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF3 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF3 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_020) { // CFF4;CFF4;110F 116E 11BB;CFF4;110F 116E 11BB; // (쿴; 쿴; 쿴; 쿴; 쿴; ) HANGUL SYLLABLE KUSS { std::array<uint32_t, 1> const c1 = {{ 0xCFF4 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF4 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF4 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_021) { // CFF5;CFF5;110F 116E 11BC;CFF5;110F 116E 11BC; // (쿵; 쿵; 쿵; 쿵; 쿵; ) HANGUL SYLLABLE KUNG { std::array<uint32_t, 1> const c1 = {{ 0xCFF5 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF5 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF5 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_022) { // CFF6;CFF6;110F 116E 11BD;CFF6;110F 116E 11BD; // (쿶; 쿶; 쿶; 쿶; 쿶; ) HANGUL SYLLABLE KUJ { std::array<uint32_t, 1> const c1 = {{ 0xCFF6 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF6 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF6 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_023) { // CFF7;CFF7;110F 116E 11BE;CFF7;110F 116E 11BE; // (쿷; 쿷; 쿷; 쿷; 쿷; ) HANGUL SYLLABLE KUC { std::array<uint32_t, 1> const c1 = {{ 0xCFF7 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF7 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF7 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_024) { // CFF8;CFF8;110F 116E 11BF;CFF8;110F 116E 11BF; // (쿸; 쿸; 쿸; 쿸; 쿸; ) HANGUL SYLLABLE KUK { std::array<uint32_t, 1> const c1 = {{ 0xCFF8 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF8 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF8 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_025) { // CFF9;CFF9;110F 116E 11C0;CFF9;110F 116E 11C0; // (쿹; 쿹; 쿹; 쿹; 쿹; ) HANGUL SYLLABLE KUT { std::array<uint32_t, 1> const c1 = {{ 0xCFF9 }}; std::array<uint32_t, 1> const c2 = {{ 0xCFF9 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFF9 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_026) { // CFFA;CFFA;110F 116E 11C1;CFFA;110F 116E 11C1; // (쿺; 쿺; 쿺; 쿺; 쿺; ) HANGUL SYLLABLE KUP { std::array<uint32_t, 1> const c1 = {{ 0xCFFA }}; std::array<uint32_t, 1> const c2 = {{ 0xCFFA }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFFA }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_027) { // CFFB;CFFB;110F 116E 11C2;CFFB;110F 116E 11C2; // (쿻; 쿻; 쿻; 쿻; 쿻; ) HANGUL SYLLABLE KUH { std::array<uint32_t, 1> const c1 = {{ 0xCFFB }}; std::array<uint32_t, 1> const c2 = {{ 0xCFFB }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116E, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFFB }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116E, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_028) { // CFFC;CFFC;110F 116F;CFFC;110F 116F; // (쿼; 쿼; 쿼; 쿼; 쿼; ) HANGUL SYLLABLE KWEO { std::array<uint32_t, 1> const c1 = {{ 0xCFFC }}; std::array<uint32_t, 1> const c2 = {{ 0xCFFC }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x116F }}; std::array<uint32_t, 1> const c4 = {{ 0xCFFC }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x116F }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_029) { // CFFD;CFFD;110F 116F 11A8;CFFD;110F 116F 11A8; // (쿽; 쿽; 쿽; 쿽; 쿽; ) HANGUL SYLLABLE KWEOG { std::array<uint32_t, 1> const c1 = {{ 0xCFFD }}; std::array<uint32_t, 1> const c2 = {{ 0xCFFD }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFFD }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_030) { // CFFE;CFFE;110F 116F 11A9;CFFE;110F 116F 11A9; // (쿾; 쿾; 쿾; 쿾; 쿾; ) HANGUL SYLLABLE KWEOGG { std::array<uint32_t, 1> const c1 = {{ 0xCFFE }}; std::array<uint32_t, 1> const c2 = {{ 0xCFFE }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xCFFE }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_031) { // CFFF;CFFF;110F 116F 11AA;CFFF;110F 116F 11AA; // (쿿; 쿿; 쿿; 쿿; 쿿; ) HANGUL SYLLABLE KWEOGS { std::array<uint32_t, 1> const c1 = {{ 0xCFFF }}; std::array<uint32_t, 1> const c2 = {{ 0xCFFF }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xCFFF }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_032) { // D000;D000;110F 116F 11AB;D000;110F 116F 11AB; // (퀀; 퀀; 퀀; 퀀; 퀀; ) HANGUL SYLLABLE KWEON { std::array<uint32_t, 1> const c1 = {{ 0xD000 }}; std::array<uint32_t, 1> const c2 = {{ 0xD000 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xD000 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_033) { // D001;D001;110F 116F 11AC;D001;110F 116F 11AC; // (퀁; 퀁; 퀁; 퀁; 퀁; ) HANGUL SYLLABLE KWEONJ { std::array<uint32_t, 1> const c1 = {{ 0xD001 }}; std::array<uint32_t, 1> const c2 = {{ 0xD001 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xD001 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_034) { // D002;D002;110F 116F 11AD;D002;110F 116F 11AD; // (퀂; 퀂; 퀂; 퀂; 퀂; ) HANGUL SYLLABLE KWEONH { std::array<uint32_t, 1> const c1 = {{ 0xD002 }}; std::array<uint32_t, 1> const c2 = {{ 0xD002 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xD002 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_035) { // D003;D003;110F 116F 11AE;D003;110F 116F 11AE; // (퀃; 퀃; 퀃; 퀃; 퀃; ) HANGUL SYLLABLE KWEOD { std::array<uint32_t, 1> const c1 = {{ 0xD003 }}; std::array<uint32_t, 1> const c2 = {{ 0xD003 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xD003 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_036) { // D004;D004;110F 116F 11AF;D004;110F 116F 11AF; // (퀄; 퀄; 퀄; 퀄; 퀄; ) HANGUL SYLLABLE KWEOL { std::array<uint32_t, 1> const c1 = {{ 0xD004 }}; std::array<uint32_t, 1> const c2 = {{ 0xD004 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xD004 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_037) { // D005;D005;110F 116F 11B0;D005;110F 116F 11B0; // (퀅; 퀅; 퀅; 퀅; 퀅; ) HANGUL SYLLABLE KWEOLG { std::array<uint32_t, 1> const c1 = {{ 0xD005 }}; std::array<uint32_t, 1> const c2 = {{ 0xD005 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD005 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_038) { // D006;D006;110F 116F 11B1;D006;110F 116F 11B1; // (퀆; 퀆; 퀆; 퀆; 퀆; ) HANGUL SYLLABLE KWEOLM { std::array<uint32_t, 1> const c1 = {{ 0xD006 }}; std::array<uint32_t, 1> const c2 = {{ 0xD006 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD006 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_039) { // D007;D007;110F 116F 11B2;D007;110F 116F 11B2; // (퀇; 퀇; 퀇; 퀇; 퀇; ) HANGUL SYLLABLE KWEOLB { std::array<uint32_t, 1> const c1 = {{ 0xD007 }}; std::array<uint32_t, 1> const c2 = {{ 0xD007 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD007 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_040) { // D008;D008;110F 116F 11B3;D008;110F 116F 11B3; // (퀈; 퀈; 퀈; 퀈; 퀈; ) HANGUL SYLLABLE KWEOLS { std::array<uint32_t, 1> const c1 = {{ 0xD008 }}; std::array<uint32_t, 1> const c2 = {{ 0xD008 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xD008 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_041) { // D009;D009;110F 116F 11B4;D009;110F 116F 11B4; // (퀉; 퀉; 퀉; 퀉; 퀉; ) HANGUL SYLLABLE KWEOLT { std::array<uint32_t, 1> const c1 = {{ 0xD009 }}; std::array<uint32_t, 1> const c2 = {{ 0xD009 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xD009 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_042) { // D00A;D00A;110F 116F 11B5;D00A;110F 116F 11B5; // (퀊; 퀊; 퀊; 퀊; 퀊; ) HANGUL SYLLABLE KWEOLP { std::array<uint32_t, 1> const c1 = {{ 0xD00A }}; std::array<uint32_t, 1> const c2 = {{ 0xD00A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xD00A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_043) { // D00B;D00B;110F 116F 11B6;D00B;110F 116F 11B6; // (퀋; 퀋; 퀋; 퀋; 퀋; ) HANGUL SYLLABLE KWEOLH { std::array<uint32_t, 1> const c1 = {{ 0xD00B }}; std::array<uint32_t, 1> const c2 = {{ 0xD00B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xD00B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_044) { // D00C;D00C;110F 116F 11B7;D00C;110F 116F 11B7; // (퀌; 퀌; 퀌; 퀌; 퀌; ) HANGUL SYLLABLE KWEOM { std::array<uint32_t, 1> const c1 = {{ 0xD00C }}; std::array<uint32_t, 1> const c2 = {{ 0xD00C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xD00C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_045) { // D00D;D00D;110F 116F 11B8;D00D;110F 116F 11B8; // (퀍; 퀍; 퀍; 퀍; 퀍; ) HANGUL SYLLABLE KWEOB { std::array<uint32_t, 1> const c1 = {{ 0xD00D }}; std::array<uint32_t, 1> const c2 = {{ 0xD00D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD00D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_046) { // D00E;D00E;110F 116F 11B9;D00E;110F 116F 11B9; // (퀎; 퀎; 퀎; 퀎; 퀎; ) HANGUL SYLLABLE KWEOBS { std::array<uint32_t, 1> const c1 = {{ 0xD00E }}; std::array<uint32_t, 1> const c2 = {{ 0xD00E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD00E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_047) { // D00F;D00F;110F 116F 11BA;D00F;110F 116F 11BA; // (퀏; 퀏; 퀏; 퀏; 퀏; ) HANGUL SYLLABLE KWEOS { std::array<uint32_t, 1> const c1 = {{ 0xD00F }}; std::array<uint32_t, 1> const c2 = {{ 0xD00F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xD00F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_048) { // D010;D010;110F 116F 11BB;D010;110F 116F 11BB; // (퀐; 퀐; 퀐; 퀐; 퀐; ) HANGUL SYLLABLE KWEOSS { std::array<uint32_t, 1> const c1 = {{ 0xD010 }}; std::array<uint32_t, 1> const c2 = {{ 0xD010 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xD010 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_049) { // D011;D011;110F 116F 11BC;D011;110F 116F 11BC; // (퀑; 퀑; 퀑; 퀑; 퀑; ) HANGUL SYLLABLE KWEONG { std::array<uint32_t, 1> const c1 = {{ 0xD011 }}; std::array<uint32_t, 1> const c2 = {{ 0xD011 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xD011 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_050) { // D012;D012;110F 116F 11BD;D012;110F 116F 11BD; // (퀒; 퀒; 퀒; 퀒; 퀒; ) HANGUL SYLLABLE KWEOJ { std::array<uint32_t, 1> const c1 = {{ 0xD012 }}; std::array<uint32_t, 1> const c2 = {{ 0xD012 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xD012 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_051) { // D013;D013;110F 116F 11BE;D013;110F 116F 11BE; // (퀓; 퀓; 퀓; 퀓; 퀓; ) HANGUL SYLLABLE KWEOC { std::array<uint32_t, 1> const c1 = {{ 0xD013 }}; std::array<uint32_t, 1> const c2 = {{ 0xD013 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xD013 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_052) { // D014;D014;110F 116F 11BF;D014;110F 116F 11BF; // (퀔; 퀔; 퀔; 퀔; 퀔; ) HANGUL SYLLABLE KWEOK { std::array<uint32_t, 1> const c1 = {{ 0xD014 }}; std::array<uint32_t, 1> const c2 = {{ 0xD014 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xD014 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_053) { // D015;D015;110F 116F 11C0;D015;110F 116F 11C0; // (퀕; 퀕; 퀕; 퀕; 퀕; ) HANGUL SYLLABLE KWEOT { std::array<uint32_t, 1> const c1 = {{ 0xD015 }}; std::array<uint32_t, 1> const c2 = {{ 0xD015 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD015 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_054) { // D016;D016;110F 116F 11C1;D016;110F 116F 11C1; // (퀖; 퀖; 퀖; 퀖; 퀖; ) HANGUL SYLLABLE KWEOP { std::array<uint32_t, 1> const c1 = {{ 0xD016 }}; std::array<uint32_t, 1> const c2 = {{ 0xD016 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD016 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_055) { // D017;D017;110F 116F 11C2;D017;110F 116F 11C2; // (퀗; 퀗; 퀗; 퀗; 퀗; ) HANGUL SYLLABLE KWEOH { std::array<uint32_t, 1> const c1 = {{ 0xD017 }}; std::array<uint32_t, 1> const c2 = {{ 0xD017 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x116F, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD017 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x116F, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_056) { // D018;D018;110F 1170;D018;110F 1170; // (퀘; 퀘; 퀘; 퀘; 퀘; ) HANGUL SYLLABLE KWE { std::array<uint32_t, 1> const c1 = {{ 0xD018 }}; std::array<uint32_t, 1> const c2 = {{ 0xD018 }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x1170 }}; std::array<uint32_t, 1> const c4 = {{ 0xD018 }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x1170 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_057) { // D019;D019;110F 1170 11A8;D019;110F 1170 11A8; // (퀙; 퀙; 퀙; 퀙; 퀙; ) HANGUL SYLLABLE KWEG { std::array<uint32_t, 1> const c1 = {{ 0xD019 }}; std::array<uint32_t, 1> const c2 = {{ 0xD019 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD019 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_058) { // D01A;D01A;110F 1170 11A9;D01A;110F 1170 11A9; // (퀚; 퀚; 퀚; 퀚; 퀚; ) HANGUL SYLLABLE KWEGG { std::array<uint32_t, 1> const c1 = {{ 0xD01A }}; std::array<uint32_t, 1> const c2 = {{ 0xD01A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD01A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_059) { // D01B;D01B;110F 1170 11AA;D01B;110F 1170 11AA; // (퀛; 퀛; 퀛; 퀛; 퀛; ) HANGUL SYLLABLE KWEGS { std::array<uint32_t, 1> const c1 = {{ 0xD01B }}; std::array<uint32_t, 1> const c2 = {{ 0xD01B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xD01B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_060) { // D01C;D01C;110F 1170 11AB;D01C;110F 1170 11AB; // (퀜; 퀜; 퀜; 퀜; 퀜; ) HANGUL SYLLABLE KWEN { std::array<uint32_t, 1> const c1 = {{ 0xD01C }}; std::array<uint32_t, 1> const c2 = {{ 0xD01C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xD01C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_061) { // D01D;D01D;110F 1170 11AC;D01D;110F 1170 11AC; // (퀝; 퀝; 퀝; 퀝; 퀝; ) HANGUL SYLLABLE KWENJ { std::array<uint32_t, 1> const c1 = {{ 0xD01D }}; std::array<uint32_t, 1> const c2 = {{ 0xD01D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xD01D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_062) { // D01E;D01E;110F 1170 11AD;D01E;110F 1170 11AD; // (퀞; 퀞; 퀞; 퀞; 퀞; ) HANGUL SYLLABLE KWENH { std::array<uint32_t, 1> const c1 = {{ 0xD01E }}; std::array<uint32_t, 1> const c2 = {{ 0xD01E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xD01E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_063) { // D01F;D01F;110F 1170 11AE;D01F;110F 1170 11AE; // (퀟; 퀟; 퀟; 퀟; 퀟; ) HANGUL SYLLABLE KWED { std::array<uint32_t, 1> const c1 = {{ 0xD01F }}; std::array<uint32_t, 1> const c2 = {{ 0xD01F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xD01F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_064) { // D020;D020;110F 1170 11AF;D020;110F 1170 11AF; // (퀠; 퀠; 퀠; 퀠; 퀠; ) HANGUL SYLLABLE KWEL { std::array<uint32_t, 1> const c1 = {{ 0xD020 }}; std::array<uint32_t, 1> const c2 = {{ 0xD020 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xD020 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_065) { // D021;D021;110F 1170 11B0;D021;110F 1170 11B0; // (퀡; 퀡; 퀡; 퀡; 퀡; ) HANGUL SYLLABLE KWELG { std::array<uint32_t, 1> const c1 = {{ 0xD021 }}; std::array<uint32_t, 1> const c2 = {{ 0xD021 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD021 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_066) { // D022;D022;110F 1170 11B1;D022;110F 1170 11B1; // (퀢; 퀢; 퀢; 퀢; 퀢; ) HANGUL SYLLABLE KWELM { std::array<uint32_t, 1> const c1 = {{ 0xD022 }}; std::array<uint32_t, 1> const c2 = {{ 0xD022 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD022 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_067) { // D023;D023;110F 1170 11B2;D023;110F 1170 11B2; // (퀣; 퀣; 퀣; 퀣; 퀣; ) HANGUL SYLLABLE KWELB { std::array<uint32_t, 1> const c1 = {{ 0xD023 }}; std::array<uint32_t, 1> const c2 = {{ 0xD023 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD023 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_068) { // D024;D024;110F 1170 11B3;D024;110F 1170 11B3; // (퀤; 퀤; 퀤; 퀤; 퀤; ) HANGUL SYLLABLE KWELS { std::array<uint32_t, 1> const c1 = {{ 0xD024 }}; std::array<uint32_t, 1> const c2 = {{ 0xD024 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xD024 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_069) { // D025;D025;110F 1170 11B4;D025;110F 1170 11B4; // (퀥; 퀥; 퀥; 퀥; 퀥; ) HANGUL SYLLABLE KWELT { std::array<uint32_t, 1> const c1 = {{ 0xD025 }}; std::array<uint32_t, 1> const c2 = {{ 0xD025 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xD025 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_070) { // D026;D026;110F 1170 11B5;D026;110F 1170 11B5; // (퀦; 퀦; 퀦; 퀦; 퀦; ) HANGUL SYLLABLE KWELP { std::array<uint32_t, 1> const c1 = {{ 0xD026 }}; std::array<uint32_t, 1> const c2 = {{ 0xD026 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xD026 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_071) { // D027;D027;110F 1170 11B6;D027;110F 1170 11B6; // (퀧; 퀧; 퀧; 퀧; 퀧; ) HANGUL SYLLABLE KWELH { std::array<uint32_t, 1> const c1 = {{ 0xD027 }}; std::array<uint32_t, 1> const c2 = {{ 0xD027 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xD027 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_072) { // D028;D028;110F 1170 11B7;D028;110F 1170 11B7; // (퀨; 퀨; 퀨; 퀨; 퀨; ) HANGUL SYLLABLE KWEM { std::array<uint32_t, 1> const c1 = {{ 0xD028 }}; std::array<uint32_t, 1> const c2 = {{ 0xD028 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xD028 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_073) { // D029;D029;110F 1170 11B8;D029;110F 1170 11B8; // (퀩; 퀩; 퀩; 퀩; 퀩; ) HANGUL SYLLABLE KWEB { std::array<uint32_t, 1> const c1 = {{ 0xD029 }}; std::array<uint32_t, 1> const c2 = {{ 0xD029 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD029 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_074) { // D02A;D02A;110F 1170 11B9;D02A;110F 1170 11B9; // (퀪; 퀪; 퀪; 퀪; 퀪; ) HANGUL SYLLABLE KWEBS { std::array<uint32_t, 1> const c1 = {{ 0xD02A }}; std::array<uint32_t, 1> const c2 = {{ 0xD02A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD02A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_075) { // D02B;D02B;110F 1170 11BA;D02B;110F 1170 11BA; // (퀫; 퀫; 퀫; 퀫; 퀫; ) HANGUL SYLLABLE KWES { std::array<uint32_t, 1> const c1 = {{ 0xD02B }}; std::array<uint32_t, 1> const c2 = {{ 0xD02B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xD02B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_076) { // D02C;D02C;110F 1170 11BB;D02C;110F 1170 11BB; // (퀬; 퀬; 퀬; 퀬; 퀬; ) HANGUL SYLLABLE KWESS { std::array<uint32_t, 1> const c1 = {{ 0xD02C }}; std::array<uint32_t, 1> const c2 = {{ 0xD02C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xD02C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_077) { // D02D;D02D;110F 1170 11BC;D02D;110F 1170 11BC; // (퀭; 퀭; 퀭; 퀭; 퀭; ) HANGUL SYLLABLE KWENG { std::array<uint32_t, 1> const c1 = {{ 0xD02D }}; std::array<uint32_t, 1> const c2 = {{ 0xD02D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xD02D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_078) { // D02E;D02E;110F 1170 11BD;D02E;110F 1170 11BD; // (퀮; 퀮; 퀮; 퀮; 퀮; ) HANGUL SYLLABLE KWEJ { std::array<uint32_t, 1> const c1 = {{ 0xD02E }}; std::array<uint32_t, 1> const c2 = {{ 0xD02E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xD02E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_079) { // D02F;D02F;110F 1170 11BE;D02F;110F 1170 11BE; // (퀯; 퀯; 퀯; 퀯; 퀯; ) HANGUL SYLLABLE KWEC { std::array<uint32_t, 1> const c1 = {{ 0xD02F }}; std::array<uint32_t, 1> const c2 = {{ 0xD02F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xD02F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_080) { // D030;D030;110F 1170 11BF;D030;110F 1170 11BF; // (퀰; 퀰; 퀰; 퀰; 퀰; ) HANGUL SYLLABLE KWEK { std::array<uint32_t, 1> const c1 = {{ 0xD030 }}; std::array<uint32_t, 1> const c2 = {{ 0xD030 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xD030 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_081) { // D031;D031;110F 1170 11C0;D031;110F 1170 11C0; // (퀱; 퀱; 퀱; 퀱; 퀱; ) HANGUL SYLLABLE KWET { std::array<uint32_t, 1> const c1 = {{ 0xD031 }}; std::array<uint32_t, 1> const c2 = {{ 0xD031 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD031 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_082) { // D032;D032;110F 1170 11C1;D032;110F 1170 11C1; // (퀲; 퀲; 퀲; 퀲; 퀲; ) HANGUL SYLLABLE KWEP { std::array<uint32_t, 1> const c1 = {{ 0xD032 }}; std::array<uint32_t, 1> const c2 = {{ 0xD032 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD032 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_083) { // D033;D033;110F 1170 11C2;D033;110F 1170 11C2; // (퀳; 퀳; 퀳; 퀳; 퀳; ) HANGUL SYLLABLE KWEH { std::array<uint32_t, 1> const c1 = {{ 0xD033 }}; std::array<uint32_t, 1> const c2 = {{ 0xD033 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1170, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD033 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1170, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_084) { // D034;D034;110F 1171;D034;110F 1171; // (퀴; 퀴; 퀴; 퀴; 퀴; ) HANGUL SYLLABLE KWI { std::array<uint32_t, 1> const c1 = {{ 0xD034 }}; std::array<uint32_t, 1> const c2 = {{ 0xD034 }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x1171 }}; std::array<uint32_t, 1> const c4 = {{ 0xD034 }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x1171 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_085) { // D035;D035;110F 1171 11A8;D035;110F 1171 11A8; // (퀵; 퀵; 퀵; 퀵; 퀵; ) HANGUL SYLLABLE KWIG { std::array<uint32_t, 1> const c1 = {{ 0xD035 }}; std::array<uint32_t, 1> const c2 = {{ 0xD035 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD035 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_086) { // D036;D036;110F 1171 11A9;D036;110F 1171 11A9; // (퀶; 퀶; 퀶; 퀶; 퀶; ) HANGUL SYLLABLE KWIGG { std::array<uint32_t, 1> const c1 = {{ 0xD036 }}; std::array<uint32_t, 1> const c2 = {{ 0xD036 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD036 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_087) { // D037;D037;110F 1171 11AA;D037;110F 1171 11AA; // (퀷; 퀷; 퀷; 퀷; 퀷; ) HANGUL SYLLABLE KWIGS { std::array<uint32_t, 1> const c1 = {{ 0xD037 }}; std::array<uint32_t, 1> const c2 = {{ 0xD037 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xD037 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_088) { // D038;D038;110F 1171 11AB;D038;110F 1171 11AB; // (퀸; 퀸; 퀸; 퀸; 퀸; ) HANGUL SYLLABLE KWIN { std::array<uint32_t, 1> const c1 = {{ 0xD038 }}; std::array<uint32_t, 1> const c2 = {{ 0xD038 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xD038 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_089) { // D039;D039;110F 1171 11AC;D039;110F 1171 11AC; // (퀹; 퀹; 퀹; 퀹; 퀹; ) HANGUL SYLLABLE KWINJ { std::array<uint32_t, 1> const c1 = {{ 0xD039 }}; std::array<uint32_t, 1> const c2 = {{ 0xD039 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xD039 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_090) { // D03A;D03A;110F 1171 11AD;D03A;110F 1171 11AD; // (퀺; 퀺; 퀺; 퀺; 퀺; ) HANGUL SYLLABLE KWINH { std::array<uint32_t, 1> const c1 = {{ 0xD03A }}; std::array<uint32_t, 1> const c2 = {{ 0xD03A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xD03A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_091) { // D03B;D03B;110F 1171 11AE;D03B;110F 1171 11AE; // (퀻; 퀻; 퀻; 퀻; 퀻; ) HANGUL SYLLABLE KWID { std::array<uint32_t, 1> const c1 = {{ 0xD03B }}; std::array<uint32_t, 1> const c2 = {{ 0xD03B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xD03B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_092) { // D03C;D03C;110F 1171 11AF;D03C;110F 1171 11AF; // (퀼; 퀼; 퀼; 퀼; 퀼; ) HANGUL SYLLABLE KWIL { std::array<uint32_t, 1> const c1 = {{ 0xD03C }}; std::array<uint32_t, 1> const c2 = {{ 0xD03C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xD03C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_093) { // D03D;D03D;110F 1171 11B0;D03D;110F 1171 11B0; // (퀽; 퀽; 퀽; 퀽; 퀽; ) HANGUL SYLLABLE KWILG { std::array<uint32_t, 1> const c1 = {{ 0xD03D }}; std::array<uint32_t, 1> const c2 = {{ 0xD03D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD03D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_094) { // D03E;D03E;110F 1171 11B1;D03E;110F 1171 11B1; // (퀾; 퀾; 퀾; 퀾; 퀾; ) HANGUL SYLLABLE KWILM { std::array<uint32_t, 1> const c1 = {{ 0xD03E }}; std::array<uint32_t, 1> const c2 = {{ 0xD03E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD03E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_095) { // D03F;D03F;110F 1171 11B2;D03F;110F 1171 11B2; // (퀿; 퀿; 퀿; 퀿; 퀿; ) HANGUL SYLLABLE KWILB { std::array<uint32_t, 1> const c1 = {{ 0xD03F }}; std::array<uint32_t, 1> const c2 = {{ 0xD03F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD03F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_096) { // D040;D040;110F 1171 11B3;D040;110F 1171 11B3; // (큀; 큀; 큀; 큀; 큀; ) HANGUL SYLLABLE KWILS { std::array<uint32_t, 1> const c1 = {{ 0xD040 }}; std::array<uint32_t, 1> const c2 = {{ 0xD040 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xD040 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_097) { // D041;D041;110F 1171 11B4;D041;110F 1171 11B4; // (큁; 큁; 큁; 큁; 큁; ) HANGUL SYLLABLE KWILT { std::array<uint32_t, 1> const c1 = {{ 0xD041 }}; std::array<uint32_t, 1> const c2 = {{ 0xD041 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xD041 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_098) { // D042;D042;110F 1171 11B5;D042;110F 1171 11B5; // (큂; 큂; 큂; 큂; 큂; ) HANGUL SYLLABLE KWILP { std::array<uint32_t, 1> const c1 = {{ 0xD042 }}; std::array<uint32_t, 1> const c2 = {{ 0xD042 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xD042 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_099) { // D043;D043;110F 1171 11B6;D043;110F 1171 11B6; // (큃; 큃; 큃; 큃; 큃; ) HANGUL SYLLABLE KWILH { std::array<uint32_t, 1> const c1 = {{ 0xD043 }}; std::array<uint32_t, 1> const c2 = {{ 0xD043 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xD043 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_100) { // D044;D044;110F 1171 11B7;D044;110F 1171 11B7; // (큄; 큄; 큄; 큄; 큄; ) HANGUL SYLLABLE KWIM { std::array<uint32_t, 1> const c1 = {{ 0xD044 }}; std::array<uint32_t, 1> const c2 = {{ 0xD044 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xD044 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_101) { // D045;D045;110F 1171 11B8;D045;110F 1171 11B8; // (큅; 큅; 큅; 큅; 큅; ) HANGUL SYLLABLE KWIB { std::array<uint32_t, 1> const c1 = {{ 0xD045 }}; std::array<uint32_t, 1> const c2 = {{ 0xD045 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD045 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_102) { // D046;D046;110F 1171 11B9;D046;110F 1171 11B9; // (큆; 큆; 큆; 큆; 큆; ) HANGUL SYLLABLE KWIBS { std::array<uint32_t, 1> const c1 = {{ 0xD046 }}; std::array<uint32_t, 1> const c2 = {{ 0xD046 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD046 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_103) { // D047;D047;110F 1171 11BA;D047;110F 1171 11BA; // (큇; 큇; 큇; 큇; 큇; ) HANGUL SYLLABLE KWIS { std::array<uint32_t, 1> const c1 = {{ 0xD047 }}; std::array<uint32_t, 1> const c2 = {{ 0xD047 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xD047 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_104) { // D048;D048;110F 1171 11BB;D048;110F 1171 11BB; // (큈; 큈; 큈; 큈; 큈; ) HANGUL SYLLABLE KWISS { std::array<uint32_t, 1> const c1 = {{ 0xD048 }}; std::array<uint32_t, 1> const c2 = {{ 0xD048 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xD048 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_105) { // D049;D049;110F 1171 11BC;D049;110F 1171 11BC; // (큉; 큉; 큉; 큉; 큉; ) HANGUL SYLLABLE KWING { std::array<uint32_t, 1> const c1 = {{ 0xD049 }}; std::array<uint32_t, 1> const c2 = {{ 0xD049 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xD049 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_106) { // D04A;D04A;110F 1171 11BD;D04A;110F 1171 11BD; // (큊; 큊; 큊; 큊; 큊; ) HANGUL SYLLABLE KWIJ { std::array<uint32_t, 1> const c1 = {{ 0xD04A }}; std::array<uint32_t, 1> const c2 = {{ 0xD04A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xD04A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_107) { // D04B;D04B;110F 1171 11BE;D04B;110F 1171 11BE; // (큋; 큋; 큋; 큋; 큋; ) HANGUL SYLLABLE KWIC { std::array<uint32_t, 1> const c1 = {{ 0xD04B }}; std::array<uint32_t, 1> const c2 = {{ 0xD04B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xD04B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_108) { // D04C;D04C;110F 1171 11BF;D04C;110F 1171 11BF; // (큌; 큌; 큌; 큌; 큌; ) HANGUL SYLLABLE KWIK { std::array<uint32_t, 1> const c1 = {{ 0xD04C }}; std::array<uint32_t, 1> const c2 = {{ 0xD04C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xD04C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_109) { // D04D;D04D;110F 1171 11C0;D04D;110F 1171 11C0; // (큍; 큍; 큍; 큍; 큍; ) HANGUL SYLLABLE KWIT { std::array<uint32_t, 1> const c1 = {{ 0xD04D }}; std::array<uint32_t, 1> const c2 = {{ 0xD04D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD04D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_110) { // D04E;D04E;110F 1171 11C1;D04E;110F 1171 11C1; // (큎; 큎; 큎; 큎; 큎; ) HANGUL SYLLABLE KWIP { std::array<uint32_t, 1> const c1 = {{ 0xD04E }}; std::array<uint32_t, 1> const c2 = {{ 0xD04E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD04E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_111) { // D04F;D04F;110F 1171 11C2;D04F;110F 1171 11C2; // (큏; 큏; 큏; 큏; 큏; ) HANGUL SYLLABLE KWIH { std::array<uint32_t, 1> const c1 = {{ 0xD04F }}; std::array<uint32_t, 1> const c2 = {{ 0xD04F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1171, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD04F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1171, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_112) { // D050;D050;110F 1172;D050;110F 1172; // (큐; 큐; 큐; 큐; 큐; ) HANGUL SYLLABLE KYU { std::array<uint32_t, 1> const c1 = {{ 0xD050 }}; std::array<uint32_t, 1> const c2 = {{ 0xD050 }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x1172 }}; std::array<uint32_t, 1> const c4 = {{ 0xD050 }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x1172 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_113) { // D051;D051;110F 1172 11A8;D051;110F 1172 11A8; // (큑; 큑; 큑; 큑; 큑; ) HANGUL SYLLABLE KYUG { std::array<uint32_t, 1> const c1 = {{ 0xD051 }}; std::array<uint32_t, 1> const c2 = {{ 0xD051 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD051 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_114) { // D052;D052;110F 1172 11A9;D052;110F 1172 11A9; // (큒; 큒; 큒; 큒; 큒; ) HANGUL SYLLABLE KYUGG { std::array<uint32_t, 1> const c1 = {{ 0xD052 }}; std::array<uint32_t, 1> const c2 = {{ 0xD052 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD052 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_115) { // D053;D053;110F 1172 11AA;D053;110F 1172 11AA; // (큓; 큓; 큓; 큓; 큓; ) HANGUL SYLLABLE KYUGS { std::array<uint32_t, 1> const c1 = {{ 0xD053 }}; std::array<uint32_t, 1> const c2 = {{ 0xD053 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xD053 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_116) { // D054;D054;110F 1172 11AB;D054;110F 1172 11AB; // (큔; 큔; 큔; 큔; 큔; ) HANGUL SYLLABLE KYUN { std::array<uint32_t, 1> const c1 = {{ 0xD054 }}; std::array<uint32_t, 1> const c2 = {{ 0xD054 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xD054 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_117) { // D055;D055;110F 1172 11AC;D055;110F 1172 11AC; // (큕; 큕; 큕; 큕; 큕; ) HANGUL SYLLABLE KYUNJ { std::array<uint32_t, 1> const c1 = {{ 0xD055 }}; std::array<uint32_t, 1> const c2 = {{ 0xD055 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xD055 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_118) { // D056;D056;110F 1172 11AD;D056;110F 1172 11AD; // (큖; 큖; 큖; 큖; 큖; ) HANGUL SYLLABLE KYUNH { std::array<uint32_t, 1> const c1 = {{ 0xD056 }}; std::array<uint32_t, 1> const c2 = {{ 0xD056 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xD056 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_119) { // D057;D057;110F 1172 11AE;D057;110F 1172 11AE; // (큗; 큗; 큗; 큗; 큗; ) HANGUL SYLLABLE KYUD { std::array<uint32_t, 1> const c1 = {{ 0xD057 }}; std::array<uint32_t, 1> const c2 = {{ 0xD057 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xD057 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_120) { // D058;D058;110F 1172 11AF;D058;110F 1172 11AF; // (큘; 큘; 큘; 큘; 큘; ) HANGUL SYLLABLE KYUL { std::array<uint32_t, 1> const c1 = {{ 0xD058 }}; std::array<uint32_t, 1> const c2 = {{ 0xD058 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xD058 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_121) { // D059;D059;110F 1172 11B0;D059;110F 1172 11B0; // (큙; 큙; 큙; 큙; 큙; ) HANGUL SYLLABLE KYULG { std::array<uint32_t, 1> const c1 = {{ 0xD059 }}; std::array<uint32_t, 1> const c2 = {{ 0xD059 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD059 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_122) { // D05A;D05A;110F 1172 11B1;D05A;110F 1172 11B1; // (큚; 큚; 큚; 큚; 큚; ) HANGUL SYLLABLE KYULM { std::array<uint32_t, 1> const c1 = {{ 0xD05A }}; std::array<uint32_t, 1> const c2 = {{ 0xD05A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD05A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_123) { // D05B;D05B;110F 1172 11B2;D05B;110F 1172 11B2; // (큛; 큛; 큛; 큛; 큛; ) HANGUL SYLLABLE KYULB { std::array<uint32_t, 1> const c1 = {{ 0xD05B }}; std::array<uint32_t, 1> const c2 = {{ 0xD05B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD05B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_124) { // D05C;D05C;110F 1172 11B3;D05C;110F 1172 11B3; // (큜; 큜; 큜; 큜; 큜; ) HANGUL SYLLABLE KYULS { std::array<uint32_t, 1> const c1 = {{ 0xD05C }}; std::array<uint32_t, 1> const c2 = {{ 0xD05C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xD05C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_125) { // D05D;D05D;110F 1172 11B4;D05D;110F 1172 11B4; // (큝; 큝; 큝; 큝; 큝; ) HANGUL SYLLABLE KYULT { std::array<uint32_t, 1> const c1 = {{ 0xD05D }}; std::array<uint32_t, 1> const c2 = {{ 0xD05D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xD05D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_126) { // D05E;D05E;110F 1172 11B5;D05E;110F 1172 11B5; // (큞; 큞; 큞; 큞; 큞; ) HANGUL SYLLABLE KYULP { std::array<uint32_t, 1> const c1 = {{ 0xD05E }}; std::array<uint32_t, 1> const c2 = {{ 0xD05E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xD05E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_127) { // D05F;D05F;110F 1172 11B6;D05F;110F 1172 11B6; // (큟; 큟; 큟; 큟; 큟; ) HANGUL SYLLABLE KYULH { std::array<uint32_t, 1> const c1 = {{ 0xD05F }}; std::array<uint32_t, 1> const c2 = {{ 0xD05F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xD05F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_128) { // D060;D060;110F 1172 11B7;D060;110F 1172 11B7; // (큠; 큠; 큠; 큠; 큠; ) HANGUL SYLLABLE KYUM { std::array<uint32_t, 1> const c1 = {{ 0xD060 }}; std::array<uint32_t, 1> const c2 = {{ 0xD060 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xD060 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_129) { // D061;D061;110F 1172 11B8;D061;110F 1172 11B8; // (큡; 큡; 큡; 큡; 큡; ) HANGUL SYLLABLE KYUB { std::array<uint32_t, 1> const c1 = {{ 0xD061 }}; std::array<uint32_t, 1> const c2 = {{ 0xD061 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD061 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_130) { // D062;D062;110F 1172 11B9;D062;110F 1172 11B9; // (큢; 큢; 큢; 큢; 큢; ) HANGUL SYLLABLE KYUBS { std::array<uint32_t, 1> const c1 = {{ 0xD062 }}; std::array<uint32_t, 1> const c2 = {{ 0xD062 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD062 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_131) { // D063;D063;110F 1172 11BA;D063;110F 1172 11BA; // (큣; 큣; 큣; 큣; 큣; ) HANGUL SYLLABLE KYUS { std::array<uint32_t, 1> const c1 = {{ 0xD063 }}; std::array<uint32_t, 1> const c2 = {{ 0xD063 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xD063 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_132) { // D064;D064;110F 1172 11BB;D064;110F 1172 11BB; // (큤; 큤; 큤; 큤; 큤; ) HANGUL SYLLABLE KYUSS { std::array<uint32_t, 1> const c1 = {{ 0xD064 }}; std::array<uint32_t, 1> const c2 = {{ 0xD064 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xD064 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_133) { // D065;D065;110F 1172 11BC;D065;110F 1172 11BC; // (큥; 큥; 큥; 큥; 큥; ) HANGUL SYLLABLE KYUNG { std::array<uint32_t, 1> const c1 = {{ 0xD065 }}; std::array<uint32_t, 1> const c2 = {{ 0xD065 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xD065 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_134) { // D066;D066;110F 1172 11BD;D066;110F 1172 11BD; // (큦; 큦; 큦; 큦; 큦; ) HANGUL SYLLABLE KYUJ { std::array<uint32_t, 1> const c1 = {{ 0xD066 }}; std::array<uint32_t, 1> const c2 = {{ 0xD066 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xD066 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_135) { // D067;D067;110F 1172 11BE;D067;110F 1172 11BE; // (큧; 큧; 큧; 큧; 큧; ) HANGUL SYLLABLE KYUC { std::array<uint32_t, 1> const c1 = {{ 0xD067 }}; std::array<uint32_t, 1> const c2 = {{ 0xD067 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xD067 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_136) { // D068;D068;110F 1172 11BF;D068;110F 1172 11BF; // (큨; 큨; 큨; 큨; 큨; ) HANGUL SYLLABLE KYUK { std::array<uint32_t, 1> const c1 = {{ 0xD068 }}; std::array<uint32_t, 1> const c2 = {{ 0xD068 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xD068 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_137) { // D069;D069;110F 1172 11C0;D069;110F 1172 11C0; // (큩; 큩; 큩; 큩; 큩; ) HANGUL SYLLABLE KYUT { std::array<uint32_t, 1> const c1 = {{ 0xD069 }}; std::array<uint32_t, 1> const c2 = {{ 0xD069 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD069 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_138) { // D06A;D06A;110F 1172 11C1;D06A;110F 1172 11C1; // (큪; 큪; 큪; 큪; 큪; ) HANGUL SYLLABLE KYUP { std::array<uint32_t, 1> const c1 = {{ 0xD06A }}; std::array<uint32_t, 1> const c2 = {{ 0xD06A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD06A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_139) { // D06B;D06B;110F 1172 11C2;D06B;110F 1172 11C2; // (큫; 큫; 큫; 큫; 큫; ) HANGUL SYLLABLE KYUH { std::array<uint32_t, 1> const c1 = {{ 0xD06B }}; std::array<uint32_t, 1> const c2 = {{ 0xD06B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1172, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD06B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1172, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_140) { // D06C;D06C;110F 1173;D06C;110F 1173; // (크; 크; 크; 크; 크; ) HANGUL SYLLABLE KEU { std::array<uint32_t, 1> const c1 = {{ 0xD06C }}; std::array<uint32_t, 1> const c2 = {{ 0xD06C }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x1173 }}; std::array<uint32_t, 1> const c4 = {{ 0xD06C }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x1173 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_141) { // D06D;D06D;110F 1173 11A8;D06D;110F 1173 11A8; // (큭; 큭; 큭; 큭; 큭; ) HANGUL SYLLABLE KEUG { std::array<uint32_t, 1> const c1 = {{ 0xD06D }}; std::array<uint32_t, 1> const c2 = {{ 0xD06D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD06D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_142) { // D06E;D06E;110F 1173 11A9;D06E;110F 1173 11A9; // (큮; 큮; 큮; 큮; 큮; ) HANGUL SYLLABLE KEUGG { std::array<uint32_t, 1> const c1 = {{ 0xD06E }}; std::array<uint32_t, 1> const c2 = {{ 0xD06E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD06E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_143) { // D06F;D06F;110F 1173 11AA;D06F;110F 1173 11AA; // (큯; 큯; 큯; 큯; 큯; ) HANGUL SYLLABLE KEUGS { std::array<uint32_t, 1> const c1 = {{ 0xD06F }}; std::array<uint32_t, 1> const c2 = {{ 0xD06F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xD06F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_144) { // D070;D070;110F 1173 11AB;D070;110F 1173 11AB; // (큰; 큰; 큰; 큰; 큰; ) HANGUL SYLLABLE KEUN { std::array<uint32_t, 1> const c1 = {{ 0xD070 }}; std::array<uint32_t, 1> const c2 = {{ 0xD070 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xD070 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_145) { // D071;D071;110F 1173 11AC;D071;110F 1173 11AC; // (큱; 큱; 큱; 큱; 큱; ) HANGUL SYLLABLE KEUNJ { std::array<uint32_t, 1> const c1 = {{ 0xD071 }}; std::array<uint32_t, 1> const c2 = {{ 0xD071 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xD071 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_146) { // D072;D072;110F 1173 11AD;D072;110F 1173 11AD; // (큲; 큲; 큲; 큲; 큲; ) HANGUL SYLLABLE KEUNH { std::array<uint32_t, 1> const c1 = {{ 0xD072 }}; std::array<uint32_t, 1> const c2 = {{ 0xD072 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xD072 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_147) { // D073;D073;110F 1173 11AE;D073;110F 1173 11AE; // (큳; 큳; 큳; 큳; 큳; ) HANGUL SYLLABLE KEUD { std::array<uint32_t, 1> const c1 = {{ 0xD073 }}; std::array<uint32_t, 1> const c2 = {{ 0xD073 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xD073 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_148) { // D074;D074;110F 1173 11AF;D074;110F 1173 11AF; // (클; 클; 클; 클; 클; ) HANGUL SYLLABLE KEUL { std::array<uint32_t, 1> const c1 = {{ 0xD074 }}; std::array<uint32_t, 1> const c2 = {{ 0xD074 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xD074 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_149) { // D075;D075;110F 1173 11B0;D075;110F 1173 11B0; // (큵; 큵; 큵; 큵; 큵; ) HANGUL SYLLABLE KEULG { std::array<uint32_t, 1> const c1 = {{ 0xD075 }}; std::array<uint32_t, 1> const c2 = {{ 0xD075 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD075 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_150) { // D076;D076;110F 1173 11B1;D076;110F 1173 11B1; // (큶; 큶; 큶; 큶; 큶; ) HANGUL SYLLABLE KEULM { std::array<uint32_t, 1> const c1 = {{ 0xD076 }}; std::array<uint32_t, 1> const c2 = {{ 0xD076 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD076 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_151) { // D077;D077;110F 1173 11B2;D077;110F 1173 11B2; // (큷; 큷; 큷; 큷; 큷; ) HANGUL SYLLABLE KEULB { std::array<uint32_t, 1> const c1 = {{ 0xD077 }}; std::array<uint32_t, 1> const c2 = {{ 0xD077 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD077 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_152) { // D078;D078;110F 1173 11B3;D078;110F 1173 11B3; // (큸; 큸; 큸; 큸; 큸; ) HANGUL SYLLABLE KEULS { std::array<uint32_t, 1> const c1 = {{ 0xD078 }}; std::array<uint32_t, 1> const c2 = {{ 0xD078 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xD078 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_153) { // D079;D079;110F 1173 11B4;D079;110F 1173 11B4; // (큹; 큹; 큹; 큹; 큹; ) HANGUL SYLLABLE KEULT { std::array<uint32_t, 1> const c1 = {{ 0xD079 }}; std::array<uint32_t, 1> const c2 = {{ 0xD079 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xD079 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_154) { // D07A;D07A;110F 1173 11B5;D07A;110F 1173 11B5; // (큺; 큺; 큺; 큺; 큺; ) HANGUL SYLLABLE KEULP { std::array<uint32_t, 1> const c1 = {{ 0xD07A }}; std::array<uint32_t, 1> const c2 = {{ 0xD07A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xD07A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_155) { // D07B;D07B;110F 1173 11B6;D07B;110F 1173 11B6; // (큻; 큻; 큻; 큻; 큻; ) HANGUL SYLLABLE KEULH { std::array<uint32_t, 1> const c1 = {{ 0xD07B }}; std::array<uint32_t, 1> const c2 = {{ 0xD07B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xD07B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_156) { // D07C;D07C;110F 1173 11B7;D07C;110F 1173 11B7; // (큼; 큼; 큼; 큼; 큼; ) HANGUL SYLLABLE KEUM { std::array<uint32_t, 1> const c1 = {{ 0xD07C }}; std::array<uint32_t, 1> const c2 = {{ 0xD07C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xD07C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_157) { // D07D;D07D;110F 1173 11B8;D07D;110F 1173 11B8; // (큽; 큽; 큽; 큽; 큽; ) HANGUL SYLLABLE KEUB { std::array<uint32_t, 1> const c1 = {{ 0xD07D }}; std::array<uint32_t, 1> const c2 = {{ 0xD07D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD07D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_158) { // D07E;D07E;110F 1173 11B9;D07E;110F 1173 11B9; // (큾; 큾; 큾; 큾; 큾; ) HANGUL SYLLABLE KEUBS { std::array<uint32_t, 1> const c1 = {{ 0xD07E }}; std::array<uint32_t, 1> const c2 = {{ 0xD07E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD07E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_159) { // D07F;D07F;110F 1173 11BA;D07F;110F 1173 11BA; // (큿; 큿; 큿; 큿; 큿; ) HANGUL SYLLABLE KEUS { std::array<uint32_t, 1> const c1 = {{ 0xD07F }}; std::array<uint32_t, 1> const c2 = {{ 0xD07F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xD07F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_160) { // D080;D080;110F 1173 11BB;D080;110F 1173 11BB; // (킀; 킀; 킀; 킀; 킀; ) HANGUL SYLLABLE KEUSS { std::array<uint32_t, 1> const c1 = {{ 0xD080 }}; std::array<uint32_t, 1> const c2 = {{ 0xD080 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xD080 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_161) { // D081;D081;110F 1173 11BC;D081;110F 1173 11BC; // (킁; 킁; 킁; 킁; 킁; ) HANGUL SYLLABLE KEUNG { std::array<uint32_t, 1> const c1 = {{ 0xD081 }}; std::array<uint32_t, 1> const c2 = {{ 0xD081 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xD081 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_162) { // D082;D082;110F 1173 11BD;D082;110F 1173 11BD; // (킂; 킂; 킂; 킂; 킂; ) HANGUL SYLLABLE KEUJ { std::array<uint32_t, 1> const c1 = {{ 0xD082 }}; std::array<uint32_t, 1> const c2 = {{ 0xD082 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xD082 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_163) { // D083;D083;110F 1173 11BE;D083;110F 1173 11BE; // (킃; 킃; 킃; 킃; 킃; ) HANGUL SYLLABLE KEUC { std::array<uint32_t, 1> const c1 = {{ 0xD083 }}; std::array<uint32_t, 1> const c2 = {{ 0xD083 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xD083 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_164) { // D084;D084;110F 1173 11BF;D084;110F 1173 11BF; // (킄; 킄; 킄; 킄; 킄; ) HANGUL SYLLABLE KEUK { std::array<uint32_t, 1> const c1 = {{ 0xD084 }}; std::array<uint32_t, 1> const c2 = {{ 0xD084 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xD084 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_165) { // D085;D085;110F 1173 11C0;D085;110F 1173 11C0; // (킅; 킅; 킅; 킅; 킅; ) HANGUL SYLLABLE KEUT { std::array<uint32_t, 1> const c1 = {{ 0xD085 }}; std::array<uint32_t, 1> const c2 = {{ 0xD085 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD085 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_166) { // D086;D086;110F 1173 11C1;D086;110F 1173 11C1; // (킆; 킆; 킆; 킆; 킆; ) HANGUL SYLLABLE KEUP { std::array<uint32_t, 1> const c1 = {{ 0xD086 }}; std::array<uint32_t, 1> const c2 = {{ 0xD086 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD086 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_167) { // D087;D087;110F 1173 11C2;D087;110F 1173 11C2; // (킇; 킇; 킇; 킇; 킇; ) HANGUL SYLLABLE KEUH { std::array<uint32_t, 1> const c1 = {{ 0xD087 }}; std::array<uint32_t, 1> const c2 = {{ 0xD087 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1173, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD087 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1173, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_168) { // D088;D088;110F 1174;D088;110F 1174; // (킈; 킈; 킈; 킈; 킈; ) HANGUL SYLLABLE KYI { std::array<uint32_t, 1> const c1 = {{ 0xD088 }}; std::array<uint32_t, 1> const c2 = {{ 0xD088 }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x1174 }}; std::array<uint32_t, 1> const c4 = {{ 0xD088 }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x1174 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_169) { // D089;D089;110F 1174 11A8;D089;110F 1174 11A8; // (킉; 킉; 킉; 킉; 킉; ) HANGUL SYLLABLE KYIG { std::array<uint32_t, 1> const c1 = {{ 0xD089 }}; std::array<uint32_t, 1> const c2 = {{ 0xD089 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD089 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_170) { // D08A;D08A;110F 1174 11A9;D08A;110F 1174 11A9; // (킊; 킊; 킊; 킊; 킊; ) HANGUL SYLLABLE KYIGG { std::array<uint32_t, 1> const c1 = {{ 0xD08A }}; std::array<uint32_t, 1> const c2 = {{ 0xD08A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD08A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_171) { // D08B;D08B;110F 1174 11AA;D08B;110F 1174 11AA; // (킋; 킋; 킋; 킋; 킋; ) HANGUL SYLLABLE KYIGS { std::array<uint32_t, 1> const c1 = {{ 0xD08B }}; std::array<uint32_t, 1> const c2 = {{ 0xD08B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xD08B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_172) { // D08C;D08C;110F 1174 11AB;D08C;110F 1174 11AB; // (킌; 킌; 킌; 킌; 킌; ) HANGUL SYLLABLE KYIN { std::array<uint32_t, 1> const c1 = {{ 0xD08C }}; std::array<uint32_t, 1> const c2 = {{ 0xD08C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11AB }}; std::array<uint32_t, 1> const c4 = {{ 0xD08C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11AB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_173) { // D08D;D08D;110F 1174 11AC;D08D;110F 1174 11AC; // (킍; 킍; 킍; 킍; 킍; ) HANGUL SYLLABLE KYINJ { std::array<uint32_t, 1> const c1 = {{ 0xD08D }}; std::array<uint32_t, 1> const c2 = {{ 0xD08D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11AC }}; std::array<uint32_t, 1> const c4 = {{ 0xD08D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11AC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_174) { // D08E;D08E;110F 1174 11AD;D08E;110F 1174 11AD; // (킎; 킎; 킎; 킎; 킎; ) HANGUL SYLLABLE KYINH { std::array<uint32_t, 1> const c1 = {{ 0xD08E }}; std::array<uint32_t, 1> const c2 = {{ 0xD08E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11AD }}; std::array<uint32_t, 1> const c4 = {{ 0xD08E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11AD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_175) { // D08F;D08F;110F 1174 11AE;D08F;110F 1174 11AE; // (킏; 킏; 킏; 킏; 킏; ) HANGUL SYLLABLE KYID { std::array<uint32_t, 1> const c1 = {{ 0xD08F }}; std::array<uint32_t, 1> const c2 = {{ 0xD08F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11AE }}; std::array<uint32_t, 1> const c4 = {{ 0xD08F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11AE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_176) { // D090;D090;110F 1174 11AF;D090;110F 1174 11AF; // (킐; 킐; 킐; 킐; 킐; ) HANGUL SYLLABLE KYIL { std::array<uint32_t, 1> const c1 = {{ 0xD090 }}; std::array<uint32_t, 1> const c2 = {{ 0xD090 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11AF }}; std::array<uint32_t, 1> const c4 = {{ 0xD090 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11AF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_177) { // D091;D091;110F 1174 11B0;D091;110F 1174 11B0; // (킑; 킑; 킑; 킑; 킑; ) HANGUL SYLLABLE KYILG { std::array<uint32_t, 1> const c1 = {{ 0xD091 }}; std::array<uint32_t, 1> const c2 = {{ 0xD091 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD091 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_178) { // D092;D092;110F 1174 11B1;D092;110F 1174 11B1; // (킒; 킒; 킒; 킒; 킒; ) HANGUL SYLLABLE KYILM { std::array<uint32_t, 1> const c1 = {{ 0xD092 }}; std::array<uint32_t, 1> const c2 = {{ 0xD092 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD092 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_179) { // D093;D093;110F 1174 11B2;D093;110F 1174 11B2; // (킓; 킓; 킓; 킓; 킓; ) HANGUL SYLLABLE KYILB { std::array<uint32_t, 1> const c1 = {{ 0xD093 }}; std::array<uint32_t, 1> const c2 = {{ 0xD093 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD093 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_180) { // D094;D094;110F 1174 11B3;D094;110F 1174 11B3; // (킔; 킔; 킔; 킔; 킔; ) HANGUL SYLLABLE KYILS { std::array<uint32_t, 1> const c1 = {{ 0xD094 }}; std::array<uint32_t, 1> const c2 = {{ 0xD094 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B3 }}; std::array<uint32_t, 1> const c4 = {{ 0xD094 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B3 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_181) { // D095;D095;110F 1174 11B4;D095;110F 1174 11B4; // (킕; 킕; 킕; 킕; 킕; ) HANGUL SYLLABLE KYILT { std::array<uint32_t, 1> const c1 = {{ 0xD095 }}; std::array<uint32_t, 1> const c2 = {{ 0xD095 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B4 }}; std::array<uint32_t, 1> const c4 = {{ 0xD095 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B4 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_182) { // D096;D096;110F 1174 11B5;D096;110F 1174 11B5; // (킖; 킖; 킖; 킖; 킖; ) HANGUL SYLLABLE KYILP { std::array<uint32_t, 1> const c1 = {{ 0xD096 }}; std::array<uint32_t, 1> const c2 = {{ 0xD096 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B5 }}; std::array<uint32_t, 1> const c4 = {{ 0xD096 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B5 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_183) { // D097;D097;110F 1174 11B6;D097;110F 1174 11B6; // (킗; 킗; 킗; 킗; 킗; ) HANGUL SYLLABLE KYILH { std::array<uint32_t, 1> const c1 = {{ 0xD097 }}; std::array<uint32_t, 1> const c2 = {{ 0xD097 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B6 }}; std::array<uint32_t, 1> const c4 = {{ 0xD097 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B6 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_184) { // D098;D098;110F 1174 11B7;D098;110F 1174 11B7; // (킘; 킘; 킘; 킘; 킘; ) HANGUL SYLLABLE KYIM { std::array<uint32_t, 1> const c1 = {{ 0xD098 }}; std::array<uint32_t, 1> const c2 = {{ 0xD098 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B7 }}; std::array<uint32_t, 1> const c4 = {{ 0xD098 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B7 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_185) { // D099;D099;110F 1174 11B8;D099;110F 1174 11B8; // (킙; 킙; 킙; 킙; 킙; ) HANGUL SYLLABLE KYIB { std::array<uint32_t, 1> const c1 = {{ 0xD099 }}; std::array<uint32_t, 1> const c2 = {{ 0xD099 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD099 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_186) { // D09A;D09A;110F 1174 11B9;D09A;110F 1174 11B9; // (킚; 킚; 킚; 킚; 킚; ) HANGUL SYLLABLE KYIBS { std::array<uint32_t, 1> const c1 = {{ 0xD09A }}; std::array<uint32_t, 1> const c2 = {{ 0xD09A }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11B9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD09A }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11B9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_187) { // D09B;D09B;110F 1174 11BA;D09B;110F 1174 11BA; // (킛; 킛; 킛; 킛; 킛; ) HANGUL SYLLABLE KYIS { std::array<uint32_t, 1> const c1 = {{ 0xD09B }}; std::array<uint32_t, 1> const c2 = {{ 0xD09B }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11BA }}; std::array<uint32_t, 1> const c4 = {{ 0xD09B }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11BA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_188) { // D09C;D09C;110F 1174 11BB;D09C;110F 1174 11BB; // (킜; 킜; 킜; 킜; 킜; ) HANGUL SYLLABLE KYISS { std::array<uint32_t, 1> const c1 = {{ 0xD09C }}; std::array<uint32_t, 1> const c2 = {{ 0xD09C }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11BB }}; std::array<uint32_t, 1> const c4 = {{ 0xD09C }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11BB }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_189) { // D09D;D09D;110F 1174 11BC;D09D;110F 1174 11BC; // (킝; 킝; 킝; 킝; 킝; ) HANGUL SYLLABLE KYING { std::array<uint32_t, 1> const c1 = {{ 0xD09D }}; std::array<uint32_t, 1> const c2 = {{ 0xD09D }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11BC }}; std::array<uint32_t, 1> const c4 = {{ 0xD09D }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11BC }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_190) { // D09E;D09E;110F 1174 11BD;D09E;110F 1174 11BD; // (킞; 킞; 킞; 킞; 킞; ) HANGUL SYLLABLE KYIJ { std::array<uint32_t, 1> const c1 = {{ 0xD09E }}; std::array<uint32_t, 1> const c2 = {{ 0xD09E }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11BD }}; std::array<uint32_t, 1> const c4 = {{ 0xD09E }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11BD }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_191) { // D09F;D09F;110F 1174 11BE;D09F;110F 1174 11BE; // (킟; 킟; 킟; 킟; 킟; ) HANGUL SYLLABLE KYIC { std::array<uint32_t, 1> const c1 = {{ 0xD09F }}; std::array<uint32_t, 1> const c2 = {{ 0xD09F }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11BE }}; std::array<uint32_t, 1> const c4 = {{ 0xD09F }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11BE }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_192) { // D0A0;D0A0;110F 1174 11BF;D0A0;110F 1174 11BF; // (킠; 킠; 킠; 킠; 킠; ) HANGUL SYLLABLE KYIK { std::array<uint32_t, 1> const c1 = {{ 0xD0A0 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A0 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11BF }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A0 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11BF }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_193) { // D0A1;D0A1;110F 1174 11C0;D0A1;110F 1174 11C0; // (킡; 킡; 킡; 킡; 킡; ) HANGUL SYLLABLE KYIT { std::array<uint32_t, 1> const c1 = {{ 0xD0A1 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A1 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11C0 }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A1 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11C0 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_194) { // D0A2;D0A2;110F 1174 11C1;D0A2;110F 1174 11C1; // (킢; 킢; 킢; 킢; 킢; ) HANGUL SYLLABLE KYIP { std::array<uint32_t, 1> const c1 = {{ 0xD0A2 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A2 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11C1 }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A2 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11C1 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_195) { // D0A3;D0A3;110F 1174 11C2;D0A3;110F 1174 11C2; // (킣; 킣; 킣; 킣; 킣; ) HANGUL SYLLABLE KYIH { std::array<uint32_t, 1> const c1 = {{ 0xD0A3 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A3 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1174, 0x11C2 }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A3 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1174, 0x11C2 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_196) { // D0A4;D0A4;110F 1175;D0A4;110F 1175; // (키; 키; 키; 키; 키; ) HANGUL SYLLABLE KI { std::array<uint32_t, 1> const c1 = {{ 0xD0A4 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A4 }}; std::array<uint32_t, 2> const c3 = {{ 0x110F, 0x1175 }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A4 }}; std::array<uint32_t, 2> const c5 = {{ 0x110F, 0x1175 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_197) { // D0A5;D0A5;110F 1175 11A8;D0A5;110F 1175 11A8; // (킥; 킥; 킥; 킥; 킥; ) HANGUL SYLLABLE KIG { std::array<uint32_t, 1> const c1 = {{ 0xD0A5 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A5 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1175, 0x11A8 }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A5 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1175, 0x11A8 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_198) { // D0A6;D0A6;110F 1175 11A9;D0A6;110F 1175 11A9; // (킦; 킦; 킦; 킦; 킦; ) HANGUL SYLLABLE KIGG { std::array<uint32_t, 1> const c1 = {{ 0xD0A6 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A6 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1175, 0x11A9 }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A6 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1175, 0x11A9 }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } } TEST(normalization, nfkc_058_199) { // D0A7;D0A7;110F 1175 11AA;D0A7;110F 1175 11AA; // (킧; 킧; 킧; 킧; 킧; ) HANGUL SYLLABLE KIGS { std::array<uint32_t, 1> const c1 = {{ 0xD0A7 }}; std::array<uint32_t, 1> const c2 = {{ 0xD0A7 }}; std::array<uint32_t, 3> const c3 = {{ 0x110F, 0x1175, 0x11AA }}; std::array<uint32_t, 1> const c4 = {{ 0xD0A7 }}; std::array<uint32_t, 3> const c5 = {{ 0x110F, 0x1175, 0x11AA }}; EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end())); EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end())); EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end())); EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end())); EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end())); { boost::text::string str = boost::text::to_string(c1.begin(), c1.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c2.begin(), c2.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c3.begin(), c3.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c4.begin(), c4.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } { boost::text::string str = boost::text::to_string(c5.begin(), c5.end()); boost::text::normalize_to_nfkc(str); boost::text::utf32_range utf32_range(str); EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size()); auto c4_it = c4.begin(); int i = 0; for (auto x : utf32_range) { EXPECT_EQ(x, *c4_it) << "iteration " << i; ++c4_it; ++i; } } } }
[ "whatwasthataddress@gmail.com" ]
whatwasthataddress@gmail.com
29411b02927f88dbce178d5d487e4c7e9005d001
81fea7e421f7a8dce11870ca64d4aed1d1c75e04
/c++03/build_example.ii.cpp
fe77af41463df98a2d4823b6e7d9be01cccce236
[]
no_license
petergottschling/dmc2
d88b258717faf75f2bc808233d1b6237cbe92712
cbb1df755cbfe244efa0f87ac064382d87a1f4d2
refs/heads/master
2020-03-26T14:34:26.143182
2018-08-16T14:00:58
2018-08-16T14:00:58
144,994,456
27
3
null
null
null
null
UTF-8
C++
false
false
461,716
cpp
# 1 "build_example.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "build_example.cpp" # 1 "/usr/include/c++/4.8/iostream" 1 3 # 36 "/usr/include/c++/4.8/iostream" 3 # 37 "/usr/include/c++/4.8/iostream" 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h" 1 3 # 184 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h" 3 namespace std { typedef long unsigned int size_t; typedef long int ptrdiff_t; } # 426 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h" 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/os_defines.h" 1 3 # 39 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/os_defines.h" 3 # 1 "/usr/include/features.h" 1 3 4 # 374 "/usr/include/features.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 # 385 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 386 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 # 375 "/usr/include/features.h" 2 3 4 # 398 "/usr/include/features.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 # 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 # 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 # 399 "/usr/include/features.h" 2 3 4 # 40 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/os_defines.h" 2 3 # 427 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h" 2 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/cpu_defines.h" 1 3 # 430 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h" 2 3 # 39 "/usr/include/c++/4.8/iostream" 2 3 # 1 "/usr/include/c++/4.8/ostream" 1 3 # 36 "/usr/include/c++/4.8/ostream" 3 # 37 "/usr/include/c++/4.8/ostream" 3 # 1 "/usr/include/c++/4.8/ios" 1 3 # 36 "/usr/include/c++/4.8/ios" 3 # 37 "/usr/include/c++/4.8/ios" 3 # 1 "/usr/include/c++/4.8/iosfwd" 1 3 # 36 "/usr/include/c++/4.8/iosfwd" 3 # 37 "/usr/include/c++/4.8/iosfwd" 3 # 1 "/usr/include/c++/4.8/bits/stringfwd.h" 1 3 # 37 "/usr/include/c++/4.8/bits/stringfwd.h" 3 # 38 "/usr/include/c++/4.8/bits/stringfwd.h" 3 # 1 "/usr/include/c++/4.8/bits/memoryfwd.h" 1 3 # 46 "/usr/include/c++/4.8/bits/memoryfwd.h" 3 # 47 "/usr/include/c++/4.8/bits/memoryfwd.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 63 "/usr/include/c++/4.8/bits/memoryfwd.h" 3 template<typename> class allocator; template<> class allocator<void>; template<typename, typename> struct uses_allocator; } # 41 "/usr/include/c++/4.8/bits/stringfwd.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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; # 86 "/usr/include/c++/4.8/bits/stringfwd.h" 3 } # 40 "/usr/include/c++/4.8/iosfwd" 2 3 # 1 "/usr/include/c++/4.8/bits/postypes.h" 1 3 # 38 "/usr/include/c++/4.8/bits/postypes.h" 3 # 39 "/usr/include/c++/4.8/bits/postypes.h" 3 # 1 "/usr/include/c++/4.8/cwchar" 1 3 # 39 "/usr/include/c++/4.8/cwchar" 3 # 40 "/usr/include/c++/4.8/cwchar" 3 # 1 "/usr/include/wchar.h" 1 3 4 # 36 "/usr/include/wchar.h" 3 4 # 1 "/usr/include/stdio.h" 1 3 4 # 44 "/usr/include/stdio.h" 3 4 struct _IO_FILE; typedef struct _IO_FILE FILE; # 64 "/usr/include/stdio.h" 3 4 typedef struct _IO_FILE __FILE; # 37 "/usr/include/wchar.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdarg.h" 1 3 4 # 40 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdarg.h" 3 4 typedef __builtin_va_list __gnuc_va_list; # 40 "/usr/include/wchar.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 # 42 "/usr/include/wchar.h" 2 3 4 # 51 "/usr/include/wchar.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h" 1 3 4 # 212 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h" 3 4 typedef long unsigned int size_t; # 353 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h" 3 4 typedef unsigned int wint_t; # 52 "/usr/include/wchar.h" 2 3 4 # 82 "/usr/include/wchar.h" 3 4 typedef struct { int __count; union { unsigned int __wch; char __wchb[4]; } __value; } __mbstate_t; # 104 "/usr/include/wchar.h" 3 4 typedef __mbstate_t mbstate_t; # 132 "/usr/include/wchar.h" 3 4 extern "C" { struct tm; extern wchar_t *wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src) throw (); extern wchar_t *wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) throw (); extern wchar_t *wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src) throw (); extern wchar_t *wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) throw (); extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2) throw () __attribute__ ((__pure__)); extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) throw () __attribute__ ((__pure__)); extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) throw (); extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) throw (); # 1 "/usr/include/xlocale.h" 1 3 4 # 27 "/usr/include/xlocale.h" 3 4 typedef struct __locale_struct { struct __locale_data *__locales[13]; const unsigned short int *__ctype_b; const int *__ctype_tolower; const int *__ctype_toupper; const char *__names[13]; } *__locale_t; typedef __locale_t locale_t; # 181 "/usr/include/wchar.h" 2 3 4 extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2, __locale_t __loc) throw (); extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2, size_t __n, __locale_t __loc) throw (); extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) throw (); extern size_t wcsxfrm (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n) throw (); extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2, __locale_t __loc) throw (); extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2, size_t __n, __locale_t __loc) throw (); extern wchar_t *wcsdup (const wchar_t *__s) throw () __attribute__ ((__malloc__)); extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc) throw () __asm ("wcschr") __attribute__ ((__pure__)); extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) throw () __asm ("wcschr") __attribute__ ((__pure__)); extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc) throw () __asm ("wcsrchr") __attribute__ ((__pure__)); extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) throw () __asm ("wcsrchr") __attribute__ ((__pure__)); extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc) throw () __attribute__ ((__pure__)); extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject) throw () __attribute__ ((__pure__)); extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept) throw () __attribute__ ((__pure__)); extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept) throw () __asm ("wcspbrk") __attribute__ ((__pure__)); extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept) throw () __asm ("wcspbrk") __attribute__ ((__pure__)); extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle) throw () __asm ("wcsstr") __attribute__ ((__pure__)); extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle) throw () __asm ("wcsstr") __attribute__ ((__pure__)); extern wchar_t *wcstok (wchar_t *__restrict __s, const wchar_t *__restrict __delim, wchar_t **__restrict __ptr) throw (); extern size_t wcslen (const wchar_t *__s) throw () __attribute__ ((__pure__)); extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle) throw () __asm ("wcswcs") __attribute__ ((__pure__)); extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle) throw () __asm ("wcswcs") __attribute__ ((__pure__)); # 306 "/usr/include/wchar.h" 3 4 extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen) throw () __attribute__ ((__pure__)); extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n) throw () __asm ("wmemchr") __attribute__ ((__pure__)); extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n) throw () __asm ("wmemchr") __attribute__ ((__pure__)); extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) throw () __attribute__ ((__pure__)); extern wchar_t *wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n) throw (); extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n) throw (); extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) throw (); extern wchar_t *wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n) throw (); extern wint_t btowc (int __c) throw (); extern int wctob (wint_t __c) throw (); extern int mbsinit (const mbstate_t *__ps) throw () __attribute__ ((__pure__)); extern size_t mbrtowc (wchar_t *__restrict __pwc, const char *__restrict __s, size_t __n, mbstate_t *__restrict __p) throw (); extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, mbstate_t *__restrict __ps) throw (); extern size_t __mbrlen (const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) throw (); extern size_t mbrlen (const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) throw (); # 405 "/usr/include/wchar.h" 3 4 extern size_t mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps) throw (); extern size_t wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps) throw (); extern size_t mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps) throw (); extern size_t wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps) throw (); extern int wcwidth (wchar_t __c) throw (); extern int wcswidth (const wchar_t *__s, size_t __n) throw (); extern double wcstod (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr) throw (); extern float wcstof (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr) throw (); extern long double wcstold (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr) throw (); extern long int wcstol (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) throw (); extern unsigned long int wcstoul (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) throw (); __extension__ extern long long int wcstoll (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) throw (); __extension__ extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) throw (); __extension__ extern long long int wcstoq (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) throw (); __extension__ extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) throw (); # 530 "/usr/include/wchar.h" 3 4 extern long int wcstol_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) throw (); extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) throw (); __extension__ extern long long int wcstoll_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) throw (); __extension__ extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) throw (); extern double wcstod_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) throw (); extern float wcstof_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) throw (); extern long double wcstold_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) throw (); extern wchar_t *wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src) throw (); extern wchar_t *wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) throw (); extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) throw (); extern int fwide (__FILE *__fp, int __mode) throw (); extern int fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...) ; extern int wprintf (const wchar_t *__restrict __format, ...) ; extern int swprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, ...) throw () ; extern int vfwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) ; extern int vwprintf (const wchar_t *__restrict __format, __gnuc_va_list __arg) ; extern int vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, __gnuc_va_list __arg) throw () ; extern int fwscanf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...) ; extern int wscanf (const wchar_t *__restrict __format, ...) ; extern int swscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, ...) throw () ; # 680 "/usr/include/wchar.h" 3 4 extern int vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) ; extern int vwscanf (const wchar_t *__restrict __format, __gnuc_va_list __arg) ; extern int vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) throw () ; # 736 "/usr/include/wchar.h" 3 4 extern wint_t fgetwc (__FILE *__stream); extern wint_t getwc (__FILE *__stream); extern wint_t getwchar (void); extern wint_t fputwc (wchar_t __wc, __FILE *__stream); extern wint_t putwc (wchar_t __wc, __FILE *__stream); extern wint_t putwchar (wchar_t __wc); extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, __FILE *__restrict __stream); extern int fputws (const wchar_t *__restrict __ws, __FILE *__restrict __stream); extern wint_t ungetwc (wint_t __wc, __FILE *__stream); # 801 "/usr/include/wchar.h" 3 4 extern wint_t getwc_unlocked (__FILE *__stream); extern wint_t getwchar_unlocked (void); extern wint_t fgetwc_unlocked (__FILE *__stream); extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); # 827 "/usr/include/wchar.h" 3 4 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); extern wint_t putwchar_unlocked (wchar_t __wc); # 837 "/usr/include/wchar.h" 3 4 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, __FILE *__restrict __stream); extern int fputws_unlocked (const wchar_t *__restrict __ws, __FILE *__restrict __stream); extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, const wchar_t *__restrict __format, const struct tm *__restrict __tp) throw (); extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, const wchar_t *__restrict __format, const struct tm *__restrict __tp, __locale_t __loc) throw (); # 891 "/usr/include/wchar.h" 3 4 } # 45 "/usr/include/c++/4.8/cwchar" 2 3 # 62 "/usr/include/c++/4.8/cwchar" 3 namespace std { using ::mbstate_t; } # 135 "/usr/include/c++/4.8/cwchar" 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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; # 232 "/usr/include/c++/4.8/cwchar" 3 } namespace __gnu_cxx { using ::wcstold; # 257 "/usr/include/c++/4.8/cwchar" 3 using ::wcstoll; using ::wcstoull; } namespace std { using ::__gnu_cxx::wcstold; using ::__gnu_cxx::wcstoll; using ::__gnu_cxx::wcstoull; } # 41 "/usr/include/c++/4.8/bits/postypes.h" 2 3 # 68 "/usr/include/c++/4.8/bits/postypes.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 88 "/usr/include/c++/4.8/bits/postypes.h" 3 typedef long streamoff; # 98 "/usr/include/c++/4.8/bits/postypes.h" 3 typedef ptrdiff_t streamsize; # 111 "/usr/include/c++/4.8/bits/postypes.h" 3 template<typename _StateT> class fpos { private: streamoff _M_off; _StateT _M_state; public: fpos() : _M_off(0), _M_state() { } # 133 "/usr/include/c++/4.8/bits/postypes.h" 3 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; # 239 "/usr/include/c++/4.8/bits/postypes.h" 3 } # 41 "/usr/include/c++/4.8/iosfwd" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 74 "/usr/include/c++/4.8/iosfwd" 3 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; } # 39 "/usr/include/c++/4.8/ios" 2 3 # 1 "/usr/include/c++/4.8/exception" 1 3 # 33 "/usr/include/c++/4.8/exception" 3 # 34 "/usr/include/c++/4.8/exception" 3 #pragma GCC visibility push(default) # 1 "/usr/include/c++/4.8/bits/atomic_lockfree_defines.h" 1 3 # 33 "/usr/include/c++/4.8/bits/atomic_lockfree_defines.h" 3 # 34 "/usr/include/c++/4.8/bits/atomic_lockfree_defines.h" 3 # 39 "/usr/include/c++/4.8/exception" 2 3 extern "C++" { namespace std { # 60 "/usr/include/c++/4.8/exception" 3 class exception { public: exception() throw() { } virtual ~exception() throw(); virtual const char* what() const throw(); }; class bad_exception : public exception { public: bad_exception() throw() { } virtual ~bad_exception() throw(); virtual const char* what() const throw(); }; typedef void (*terminate_handler) (); typedef void (*unexpected_handler) (); terminate_handler set_terminate(terminate_handler) throw(); void terminate() throw() __attribute__ ((__noreturn__)); unexpected_handler set_unexpected(unexpected_handler) throw(); void unexpected() __attribute__ ((__noreturn__)); # 117 "/usr/include/c++/4.8/exception" 3 bool uncaught_exception() throw() __attribute__ ((__pure__)); } namespace __gnu_cxx { # 142 "/usr/include/c++/4.8/exception" 3 void __verbose_terminate_handler(); } } #pragma GCC visibility pop # 40 "/usr/include/c++/4.8/ios" 2 3 # 1 "/usr/include/c++/4.8/bits/char_traits.h" 1 3 # 37 "/usr/include/c++/4.8/bits/char_traits.h" 3 # 38 "/usr/include/c++/4.8/bits/char_traits.h" 3 # 1 "/usr/include/c++/4.8/bits/stl_algobase.h" 1 3 # 60 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 # 1 "/usr/include/c++/4.8/bits/functexcept.h" 1 3 # 40 "/usr/include/c++/4.8/bits/functexcept.h" 3 # 1 "/usr/include/c++/4.8/bits/exception_defines.h" 1 3 # 41 "/usr/include/c++/4.8/bits/functexcept.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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__)); } # 61 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/bits/cpp_type_traits.h" 1 3 # 35 "/usr/include/c++/4.8/bits/cpp_type_traits.h" 3 # 36 "/usr/include/c++/4.8/bits/cpp_type_traits.h" 3 # 68 "/usr/include/c++/4.8/bits/cpp_type_traits.h" 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { template<typename _Iterator, typename _Container> class __normal_iterator; } namespace std __attribute__ ((__visibility__ ("default"))) { 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; }; # 198 "/usr/include/c++/4.8/bits/cpp_type_traits.h" 3 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; }; # 421 "/usr/include/c++/4.8/bits/cpp_type_traits.h" 3 } # 62 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/ext/type_traits.h" 1 3 # 32 "/usr/include/c++/4.8/ext/type_traits.h" 3 # 33 "/usr/include/c++/4.8/ext/type_traits.h" 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { 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> { }; template<> struct __promote<long double> { typedef long double __type; }; template<> struct __promote<double> { typedef double __type; }; template<> struct __promote<float> { typedef float __type; }; template<typename _Tp, typename _Up, typename _Tp2 = typename __promote<_Tp>::__type, typename _Up2 = typename __promote<_Up>::__type> struct __promote_2 { typedef __typeof__(_Tp2() + _Up2()) __type; }; template<typename _Tp, typename _Up, typename _Vp, typename _Tp2 = typename __promote<_Tp>::__type, typename _Up2 = typename __promote<_Up>::__type, typename _Vp2 = typename __promote<_Vp>::__type> struct __promote_3 { typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type; }; template<typename _Tp, typename _Up, typename _Vp, typename _Wp, typename _Tp2 = typename __promote<_Tp>::__type, typename _Up2 = typename __promote<_Up>::__type, typename _Vp2 = typename __promote<_Vp>::__type, typename _Wp2 = typename __promote<_Wp>::__type> struct __promote_4 { typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type; }; } # 63 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/ext/numeric_traits.h" 1 3 # 32 "/usr/include/c++/4.8/ext/numeric_traits.h" 3 # 33 "/usr/include/c++/4.8/ext/numeric_traits.h" 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { # 54 "/usr/include/c++/4.8/ext/numeric_traits.h" 3 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; # 99 "/usr/include/c++/4.8/ext/numeric_traits.h" 3 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 : 64) * 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 : 18); static const int __max_exponent10 = (std::__are_same<_Value, float>::__value ? 38 : std::__are_same<_Value, double>::__value ? 308 : 4932); }; 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 { }; } # 64 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/bits/stl_pair.h" 1 3 # 59 "/usr/include/c++/4.8/bits/stl_pair.h" 3 # 1 "/usr/include/c++/4.8/bits/move.h" 1 3 # 34 "/usr/include/c++/4.8/bits/move.h" 3 # 1 "/usr/include/c++/4.8/bits/concept_check.h" 1 3 # 33 "/usr/include/c++/4.8/bits/concept_check.h" 3 # 34 "/usr/include/c++/4.8/bits/concept_check.h" 3 # 35 "/usr/include/c++/4.8/bits/move.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _Tp> inline _Tp* __addressof(_Tp& __r) { return reinterpret_cast<_Tp*> (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r))); } } # 149 "/usr/include/c++/4.8/bits/move.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 164 "/usr/include/c++/4.8/bits/move.h" 3 template<typename _Tp> inline void swap(_Tp& __a, _Tp& __b) { _Tp __tmp = (__a); __a = (__b); __b = (__tmp); } template<typename _Tp, size_t _Nm> inline void swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) { for (size_t __n = 0; __n < _Nm; ++__n) swap(__a[__n], __b[__n]); } } # 60 "/usr/include/c++/4.8/bits/stl_pair.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 95 "/usr/include/c++/4.8/bits/stl_pair.h" 3 template<class _T1, class _T2> struct pair { typedef _T1 first_type; typedef _T2 second_type; _T1 first; _T2 second; pair() : first(), second() { } pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } template<class _U1, class _U2> pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) { } # 209 "/usr/include/c++/4.8/bits/stl_pair.h" 3 }; template<class _T1, class _T2> inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first == __y.first && __x.second == __y.second; } template<class _T1, class _T2> inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); } template<class _T1, class _T2> inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__x == __y); } template<class _T1, class _T2> inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __y < __x; } template<class _T1, class _T2> inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__y < __x); } template<class _T1, class _T2> inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__x < __y); } # 284 "/usr/include/c++/4.8/bits/stl_pair.h" 3 template<class _T1, class _T2> inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) { return pair<_T1, _T2>(__x, __y); } } # 65 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 1 3 # 62 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 3 # 63 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 89 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 3 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 { }; # 116 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 3 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; }; # 162 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 3 template<typename _Iterator> struct iterator_traits { 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 _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(); } }; # 232 "/usr/include/c++/4.8/bits/stl_iterator_base_types.h" 3 } # 66 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 1 3 # 62 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 3 # 63 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 3 # 1 "/usr/include/c++/4.8/debug/debug.h" 1 3 # 46 "/usr/include/c++/4.8/debug/debug.h" 3 namespace std { namespace __debug { } } namespace __gnu_debug { using namespace std::__debug; } # 66 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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; } # 112 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 3 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; } # 171 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 3 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)); } # 202 "/usr/include/c++/4.8/bits/stl_iterator_base_funcs.h" 3 } # 67 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 # 1 "/usr/include/c++/4.8/bits/stl_iterator.h" 1 3 # 67 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 95 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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; } # 159 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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); } }; # 289 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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 typename reverse_iterator<_IteratorL>::difference_type operator-(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __y.base() - __x.base(); } # 401 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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) { } # 428 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 back_insert_iterator& operator=(typename _Container::const_reference __value) { container->push_back(__value); return *this; } # 451 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 back_insert_iterator& operator*() { return *this; } back_insert_iterator& operator++() { return *this; } back_insert_iterator operator++(int) { return *this; } }; # 477 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 template<typename _Container> inline back_insert_iterator<_Container> back_inserter(_Container& __x) { return back_insert_iterator<_Container>(__x); } # 492 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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) { } # 518 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 front_insert_iterator& operator=(typename _Container::const_reference __value) { container->push_front(__value); return *this; } # 541 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 front_insert_iterator& operator*() { return *this; } front_insert_iterator& operator++() { return *this; } front_insert_iterator operator++(int) { return *this; } }; # 567 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 template<typename _Container> inline front_insert_iterator<_Container> front_inserter(_Container& __x) { return front_insert_iterator<_Container>(__x); } # 586 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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) {} # 629 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 insert_iterator& operator=(typename _Container::const_reference __value) { iter = container->insert(iter, __value); ++iter; return *this; } # 655 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 insert_iterator& operator*() { return *this; } insert_iterator& operator++() { return *this; } insert_iterator& operator++(int) { return *this; } }; # 681 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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 __attribute__ ((__visibility__ ("default"))) { # 705 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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; __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; } }; # 803 "/usr/include/c++/4.8/bits/stl_iterator.h" 3 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 typename __normal_iterator<_IteratorL, _Container>::difference_type operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { 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); } } # 68 "/usr/include/c++/4.8/bits/stl_algobase.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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 = (*__a); *__a = (*__b); *__b = (__tmp); } }; template<> struct __iter_swap<true> { template<typename _ForwardIterator1, typename _ForwardIterator2> static void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { swap(*__a, *__b); } }; # 117 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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); } # 163 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } # 191 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) { if (__b < __a) return __b; return __a; } # 214 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 template<typename _Tp> inline const _Tp& max(const _Tp& __a, const _Tp& __b) { if (__a < __b) return __b; return __a; } # 237 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } # 258 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } }; # 325 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } }; # 363 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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))); } # 448 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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)); } # 500 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } }; # 528 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } }; # 558 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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))); } # 617 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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)); } # 675 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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); } # 719 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } # 779 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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); } # 941 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 template<typename _ForwardIterator, typename _Tp> _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { 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; } inline int __lg(int __n) { return sizeof(int) * 8 - 1 - __builtin_clz(__n); } inline unsigned __lg(unsigned __n) { return sizeof(int) * 8 - 1 - __builtin_clz(__n); } inline long __lg(long __n) { return sizeof(long) * 8 - 1 - __builtin_clzl(__n); } inline unsigned long __lg(unsigned 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); } inline unsigned long long __lg(unsigned long long __n) { return sizeof(long long) * 8 - 1 - __builtin_clzll(__n); } # 1019 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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)); } # 1051 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } # 1082 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 template<typename _II1, typename _II2> inline bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { ; ; return std::__lexicographical_compare_aux(std::__niter_base(__first1), std::__niter_base(__last1), std::__niter_base(__first2), std::__niter_base(__last2)); } # 1118 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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; } # 1158 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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); } # 1195 "/usr/include/c++/4.8/bits/stl_algobase.h" 3 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); } } # 40 "/usr/include/c++/4.8/bits/char_traits.h" 2 3 # 1 "/usr/include/c++/4.8/cwchar" 1 3 # 39 "/usr/include/c++/4.8/cwchar" 3 # 40 "/usr/include/c++/4.8/cwchar" 3 # 1 "/usr/include/wchar.h" 1 3 4 # 45 "/usr/include/c++/4.8/cwchar" 2 3 # 42 "/usr/include/c++/4.8/bits/char_traits.h" 2 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { # 57 "/usr/include/c++/4.8/bits/char_traits.h" 3 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; }; # 82 "/usr/include/c++/4.8/bits/char_traits.h" 3 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 bool eq(const char_type& __c1, const char_type& __c2) { return __c1 == __c2; } static bool lt(const char_type& __c1, const char_type& __c2) { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, 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 char_type to_char_type(const int_type& __c) { return static_cast<char_type>(__c); } static int_type to_int_type(const char_type& __c) { return static_cast<int_type>(__c); } static bool eq_int_type(const int_type& __c1, const int_type& __c2) { return __c1 == __c2; } static int_type eof() { return static_cast<int_type>(-1); } static 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 __attribute__ ((__visibility__ ("default"))) { # 226 "/usr/include/c++/4.8/bits/char_traits.h" 3 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) { __c1 = __c2; } static bool eq(const char_type& __c1, const char_type& __c2) { return __c1 == __c2; } static bool lt(const char_type& __c1, const char_type& __c2) { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { 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 char_type to_char_type(const int_type& __c) { return static_cast<char_type>(__c); } static int_type to_int_type(const char_type& __c) { return static_cast<int_type>(static_cast<unsigned char>(__c)); } static bool eq_int_type(const int_type& __c1, const int_type& __c2) { return __c1 == __c2; } static int_type eof() { return static_cast<int_type>(-1); } static int_type not_eof(const int_type& __c) { 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) { __c1 = __c2; } static bool eq(const char_type& __c1, const char_type& __c2) { return __c1 == __c2; } static bool lt(const char_type& __c1, const char_type& __c2) { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { 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 char_type to_char_type(const int_type& __c) { return char_type(__c); } static int_type to_int_type(const char_type& __c) { return int_type(__c); } static bool eq_int_type(const int_type& __c1, const int_type& __c2) { return __c1 == __c2; } static int_type eof() { return static_cast<int_type>((0xffffffffu)); } static int_type not_eof(const int_type& __c) { return eq_int_type(__c, eof()) ? 0 : __c; } }; } # 41 "/usr/include/c++/4.8/ios" 2 3 # 1 "/usr/include/c++/4.8/bits/localefwd.h" 1 3 # 37 "/usr/include/c++/4.8/bits/localefwd.h" 3 # 38 "/usr/include/c++/4.8/bits/localefwd.h" 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h" 1 3 # 39 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h" 3 # 40 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h" 3 # 1 "/usr/include/c++/4.8/clocale" 1 3 # 39 "/usr/include/c++/4.8/clocale" 3 # 40 "/usr/include/c++/4.8/clocale" 3 # 1 "/usr/include/locale.h" 1 3 4 # 28 "/usr/include/locale.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h" 1 3 4 # 29 "/usr/include/locale.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/locale.h" 1 3 4 # 30 "/usr/include/locale.h" 2 3 4 extern "C" { # 50 "/usr/include/locale.h" 3 4 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 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; # 120 "/usr/include/locale.h" 3 4 }; extern char *setlocale (int __category, const char *__locale) throw (); extern struct lconv *localeconv (void) throw (); # 151 "/usr/include/locale.h" 3 4 extern __locale_t newlocale (int __category_mask, const char *__locale, __locale_t __base) throw (); # 186 "/usr/include/locale.h" 3 4 extern __locale_t duplocale (__locale_t __dataset) throw (); extern void freelocale (__locale_t __dataset) throw (); extern __locale_t uselocale (__locale_t __dataset) throw (); } # 43 "/usr/include/c++/4.8/clocale" 2 3 # 51 "/usr/include/c++/4.8/clocale" 3 namespace std { using ::lconv; using ::setlocale; using ::localeconv; } # 42 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h" 2 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { extern "C" __typeof(uselocale) __uselocale; } namespace std __attribute__ ((__visibility__ ("default"))) { typedef __locale_t __c_locale; inline int __convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)), char* __out, const int __size __attribute__ ((__unused__)), const char* __fmt, ...) { __c_locale __old = __gnu_cxx::__uselocale(__cloc); # 88 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++locale.h" 3 __builtin_va_list __args; __builtin_va_start(__args, __fmt); const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); __builtin_va_end(__args); __gnu_cxx::__uselocale(__old); return __ret; } } # 41 "/usr/include/c++/4.8/bits/localefwd.h" 2 3 # 1 "/usr/include/c++/4.8/cctype" 1 3 # 39 "/usr/include/c++/4.8/cctype" 3 # 40 "/usr/include/c++/4.8/cctype" 3 # 1 "/usr/include/ctype.h" 1 3 4 # 26 "/usr/include/ctype.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; typedef signed long int __int64_t; typedef unsigned long int __uint64_t; typedef long int __quad_t; typedef unsigned long int __u_quad_t; # 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 # 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 typedef unsigned long int __dev_t; typedef unsigned int __uid_t; typedef unsigned int __gid_t; typedef unsigned long int __ino_t; typedef unsigned long int __ino64_t; typedef unsigned int __mode_t; typedef unsigned long int __nlink_t; typedef long int __off_t; typedef long int __off64_t; typedef int __pid_t; typedef struct { int __val[2]; } __fsid_t; typedef long int __clock_t; typedef unsigned long int __rlim_t; typedef unsigned long int __rlim64_t; typedef unsigned int __id_t; typedef long int __time_t; typedef unsigned int __useconds_t; typedef long int __suseconds_t; typedef int __daddr_t; typedef int __key_t; typedef int __clockid_t; typedef void * __timer_t; typedef long int __blksize_t; typedef long int __blkcnt_t; typedef long int __blkcnt64_t; typedef unsigned long int __fsblkcnt_t; typedef unsigned long int __fsblkcnt64_t; typedef unsigned long int __fsfilcnt_t; typedef unsigned long int __fsfilcnt64_t; typedef long int __fsword_t; typedef long int __ssize_t; typedef long int __syscall_slong_t; typedef unsigned long int __syscall_ulong_t; typedef __off64_t __loff_t; typedef __quad_t *__qaddr_t; typedef char *__caddr_t; typedef long int __intptr_t; typedef unsigned int __socklen_t; # 27 "/usr/include/ctype.h" 2 3 4 extern "C" { # 39 "/usr/include/ctype.h" 3 4 # 1 "/usr/include/endian.h" 1 3 4 # 36 "/usr/include/endian.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 # 37 "/usr/include/endian.h" 2 3 4 # 60 "/usr/include/endian.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 # 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 # 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 static __inline unsigned int __bswap_32 (unsigned int __bsx) { return __builtin_bswap32 (__bsx); } # 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 static __inline __uint64_t __bswap_64 (__uint64_t __bsx) { return __builtin_bswap64 (__bsx); } # 61 "/usr/include/endian.h" 2 3 4 # 40 "/usr/include/ctype.h" 2 3 4 enum { _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) }; # 79 "/usr/include/ctype.h" 3 4 extern const unsigned short int **__ctype_b_loc (void) throw () __attribute__ ((__const__)); extern const __int32_t **__ctype_tolower_loc (void) throw () __attribute__ ((__const__)); extern const __int32_t **__ctype_toupper_loc (void) throw () __attribute__ ((__const__)); # 104 "/usr/include/ctype.h" 3 4 extern int isalnum (int) throw (); extern int isalpha (int) throw (); extern int iscntrl (int) throw (); extern int isdigit (int) throw (); extern int islower (int) throw (); extern int isgraph (int) throw (); extern int isprint (int) throw (); extern int ispunct (int) throw (); extern int isspace (int) throw (); extern int isupper (int) throw (); extern int isxdigit (int) throw (); extern int tolower (int __c) throw (); extern int toupper (int __c) throw (); extern int isblank (int) throw (); extern int isctype (int __c, int __mask) throw (); extern int isascii (int __c) throw (); extern int toascii (int __c) throw (); extern int _toupper (int) throw (); extern int _tolower (int) throw (); # 271 "/usr/include/ctype.h" 3 4 extern int isalnum_l (int, __locale_t) throw (); extern int isalpha_l (int, __locale_t) throw (); extern int iscntrl_l (int, __locale_t) throw (); extern int isdigit_l (int, __locale_t) throw (); extern int islower_l (int, __locale_t) throw (); extern int isgraph_l (int, __locale_t) throw (); extern int isprint_l (int, __locale_t) throw (); extern int ispunct_l (int, __locale_t) throw (); extern int isspace_l (int, __locale_t) throw (); extern int isupper_l (int, __locale_t) throw (); extern int isxdigit_l (int, __locale_t) throw (); extern int isblank_l (int, __locale_t) throw (); extern int __tolower_l (int __c, __locale_t __l) throw (); extern int tolower_l (int __c, __locale_t __l) throw (); extern int __toupper_l (int __c, __locale_t __l) throw (); extern int toupper_l (int __c, __locale_t __l) throw (); # 347 "/usr/include/ctype.h" 3 4 } # 43 "/usr/include/c++/4.8/cctype" 2 3 # 62 "/usr/include/c++/4.8/cctype" 3 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; } # 43 "/usr/include/c++/4.8/bits/localefwd.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 55 "/usr/include/c++/4.8/bits/localefwd.h" 3 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; } # 42 "/usr/include/c++/4.8/ios" 2 3 # 1 "/usr/include/c++/4.8/bits/ios_base.h" 1 3 # 37 "/usr/include/c++/4.8/bits/ios_base.h" 3 # 38 "/usr/include/c++/4.8/bits/ios_base.h" 3 # 1 "/usr/include/c++/4.8/ext/atomicity.h" 1 3 # 32 "/usr/include/c++/4.8/ext/atomicity.h" 3 # 33 "/usr/include/c++/4.8/ext/atomicity.h" 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr.h" 1 3 # 30 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr.h" 3 #pragma GCC visibility push(default) # 148 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr.h" 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 1 3 # 35 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 # 1 "/usr/include/pthread.h" 1 3 4 # 23 "/usr/include/pthread.h" 3 4 # 1 "/usr/include/sched.h" 1 3 4 # 28 "/usr/include/sched.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h" 1 3 4 # 29 "/usr/include/sched.h" 2 3 4 # 1 "/usr/include/time.h" 1 3 4 # 73 "/usr/include/time.h" 3 4 typedef __time_t time_t; # 120 "/usr/include/time.h" 3 4 struct timespec { __time_t tv_sec; __syscall_slong_t tv_nsec; }; # 33 "/usr/include/sched.h" 2 3 4 typedef __pid_t pid_t; # 1 "/usr/include/x86_64-linux-gnu/bits/sched.h" 1 3 4 # 72 "/usr/include/x86_64-linux-gnu/bits/sched.h" 3 4 struct sched_param { int __sched_priority; }; extern "C" { extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg, ...) throw (); extern int unshare (int __flags) throw (); extern int sched_getcpu (void) throw (); extern int setns (int __fd, int __nstype) throw (); } struct __sched_param { int __sched_priority; }; # 118 "/usr/include/x86_64-linux-gnu/bits/sched.h" 3 4 typedef unsigned long int __cpu_mask; typedef struct { __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))]; } cpu_set_t; # 201 "/usr/include/x86_64-linux-gnu/bits/sched.h" 3 4 extern "C" { extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) throw (); extern cpu_set_t *__sched_cpualloc (size_t __count) throw () ; extern void __sched_cpufree (cpu_set_t *__set) throw (); } # 42 "/usr/include/sched.h" 2 3 4 extern "C" { extern int sched_setparam (__pid_t __pid, const struct sched_param *__param) throw (); extern int sched_getparam (__pid_t __pid, struct sched_param *__param) throw (); extern int sched_setscheduler (__pid_t __pid, int __policy, const struct sched_param *__param) throw (); extern int sched_getscheduler (__pid_t __pid) throw (); extern int sched_yield (void) throw (); extern int sched_get_priority_max (int __algorithm) throw (); extern int sched_get_priority_min (int __algorithm) throw (); extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) throw (); # 116 "/usr/include/sched.h" 3 4 extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize, const cpu_set_t *__cpuset) throw (); extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize, cpu_set_t *__cpuset) throw (); } # 24 "/usr/include/pthread.h" 2 3 4 # 1 "/usr/include/time.h" 1 3 4 # 29 "/usr/include/time.h" 3 4 extern "C" { # 1 "/usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h" 1 3 4 # 38 "/usr/include/time.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 # 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; # 86 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/timex.h" 1 3 4 # 25 "/usr/include/x86_64-linux-gnu/bits/timex.h" 3 4 struct timex { unsigned int modes; __syscall_slong_t offset; __syscall_slong_t freq; __syscall_slong_t maxerror; __syscall_slong_t esterror; int status; __syscall_slong_t constant; __syscall_slong_t precision; __syscall_slong_t tolerance; struct timeval time; __syscall_slong_t tick; __syscall_slong_t ppsfreq; __syscall_slong_t jitter; int shift; __syscall_slong_t stabil; __syscall_slong_t jitcnt; __syscall_slong_t calcnt; __syscall_slong_t errcnt; __syscall_slong_t stbcnt; int tai; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; # 87 "/usr/include/x86_64-linux-gnu/bits/time.h" 2 3 4 extern "C" { extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) throw (); } # 42 "/usr/include/time.h" 2 3 4 # 57 "/usr/include/time.h" 3 4 typedef __clock_t clock_t; # 91 "/usr/include/time.h" 3 4 typedef __clockid_t clockid_t; # 103 "/usr/include/time.h" 3 4 typedef __timer_t timer_t; # 131 "/usr/include/time.h" 3 4 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; long int tm_gmtoff; const char *tm_zone; }; struct itimerspec { struct timespec it_interval; struct timespec it_value; }; struct sigevent; # 186 "/usr/include/time.h" 3 4 extern clock_t clock (void) throw (); extern time_t time (time_t *__timer) throw (); extern double difftime (time_t __time1, time_t __time0) throw () __attribute__ ((__const__)); extern time_t mktime (struct tm *__tp) throw (); extern size_t strftime (char *__restrict __s, size_t __maxsize, const char *__restrict __format, const struct tm *__restrict __tp) throw (); extern char *strptime (const char *__restrict __s, const char *__restrict __fmt, struct tm *__tp) throw (); extern size_t strftime_l (char *__restrict __s, size_t __maxsize, const char *__restrict __format, const struct tm *__restrict __tp, __locale_t __loc) throw (); extern char *strptime_l (const char *__restrict __s, const char *__restrict __fmt, struct tm *__tp, __locale_t __loc) throw (); extern struct tm *gmtime (const time_t *__timer) throw (); extern struct tm *localtime (const time_t *__timer) throw (); extern struct tm *gmtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) throw (); extern struct tm *localtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) throw (); extern char *asctime (const struct tm *__tp) throw (); extern char *ctime (const time_t *__timer) throw (); extern char *asctime_r (const struct tm *__restrict __tp, char *__restrict __buf) throw (); extern char *ctime_r (const time_t *__restrict __timer, char *__restrict __buf) throw (); extern char *__tzname[2]; extern int __daylight; extern long int __timezone; extern char *tzname[2]; extern void tzset (void) throw (); extern int daylight; extern long int timezone; extern int stime (const time_t *__when) throw (); # 319 "/usr/include/time.h" 3 4 extern time_t timegm (struct tm *__tp) throw (); extern time_t timelocal (struct tm *__tp) throw (); extern int dysize (int __year) throw () __attribute__ ((__const__)); # 334 "/usr/include/time.h" 3 4 extern int nanosleep (const struct timespec *__requested_time, struct timespec *__remaining); extern int clock_getres (clockid_t __clock_id, struct timespec *__res) throw (); extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) throw (); extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) throw (); extern int clock_nanosleep (clockid_t __clock_id, int __flags, const struct timespec *__req, struct timespec *__rem); extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) throw (); extern int timer_create (clockid_t __clock_id, struct sigevent *__restrict __evp, timer_t *__restrict __timerid) throw (); extern int timer_delete (timer_t __timerid) throw (); extern int timer_settime (timer_t __timerid, int __flags, const struct itimerspec *__restrict __value, struct itimerspec *__restrict __ovalue) throw (); extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) throw (); extern int timer_getoverrun (timer_t __timerid) throw (); extern int timespec_get (struct timespec *__ts, int __base) throw () __attribute__ ((__nonnull__ (1))); # 403 "/usr/include/time.h" 3 4 extern int getdate_err; # 412 "/usr/include/time.h" 3 4 extern struct tm *getdate (const char *__string); # 426 "/usr/include/time.h" 3 4 extern int getdate_r (const char *__restrict __string, struct tm *__restrict __resbufp); } # 25 "/usr/include/pthread.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 # 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 # 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 typedef unsigned long int pthread_t; union pthread_attr_t { char __size[56]; long int __align; }; typedef union pthread_attr_t pthread_attr_t; typedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __pthread_list_t; # 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 typedef union { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; __pthread_list_t __list; # 124 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 } __data; char __size[40]; long int __align; } pthread_mutex_t; typedef union { char __size[4]; int __align; } pthread_mutexattr_t; typedef union { struct { int __lock; unsigned int __futex; __extension__ unsigned long long int __total_seq; __extension__ unsigned long long int __wakeup_seq; __extension__ unsigned long long int __woken_seq; void *__mutex; unsigned int __nwaiters; unsigned int __broadcast_seq; } __data; char __size[48]; __extension__ long long int __align; } pthread_cond_t; typedef union { char __size[4]; int __align; } pthread_condattr_t; typedef unsigned int pthread_key_t; typedef int pthread_once_t; typedef union { struct { int __lock; unsigned int __nr_readers; unsigned int __readers_wakeup; unsigned int __writer_wakeup; unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; int __writer; int __shared; unsigned long int __pad1; unsigned long int __pad2; unsigned int __flags; } __data; # 211 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 char __size[56]; long int __align; } pthread_rwlock_t; typedef union { char __size[8]; long int __align; } pthread_rwlockattr_t; typedef volatile int pthread_spinlock_t; typedef union { char __size[32]; long int __align; } pthread_barrier_t; typedef union { char __size[4]; int __align; } pthread_barrierattr_t; # 27 "/usr/include/pthread.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/setjmp.h" 1 3 4 # 26 "/usr/include/x86_64-linux-gnu/bits/setjmp.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/setjmp.h" 2 3 4 typedef long int __jmp_buf[8]; # 28 "/usr/include/pthread.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 29 "/usr/include/pthread.h" 2 3 4 enum { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED }; enum { PTHREAD_MUTEX_TIMED_NP, PTHREAD_MUTEX_RECURSIVE_NP, PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_ADAPTIVE_NP , PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP }; enum { PTHREAD_MUTEX_STALLED, PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED, PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST }; enum { PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT }; # 125 "/usr/include/pthread.h" 3 4 enum { PTHREAD_RWLOCK_PREFER_READER_NP, PTHREAD_RWLOCK_PREFER_WRITER_NP, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP }; # 166 "/usr/include/pthread.h" 3 4 enum { PTHREAD_INHERIT_SCHED, PTHREAD_EXPLICIT_SCHED }; enum { PTHREAD_SCOPE_SYSTEM, PTHREAD_SCOPE_PROCESS }; enum { PTHREAD_PROCESS_PRIVATE, PTHREAD_PROCESS_SHARED }; # 201 "/usr/include/pthread.h" 3 4 struct _pthread_cleanup_buffer { void (*__routine) (void *); void *__arg; int __canceltype; struct _pthread_cleanup_buffer *__prev; }; enum { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE }; enum { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_ASYNCHRONOUS }; # 239 "/usr/include/pthread.h" 3 4 extern "C" { extern int pthread_create (pthread_t *__restrict __newthread, const pthread_attr_t *__restrict __attr, void *(*__start_routine) (void *), void *__restrict __arg) throw () __attribute__ ((__nonnull__ (1, 3))); extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); extern int pthread_join (pthread_t __th, void **__thread_return); extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) throw (); extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, const struct timespec *__abstime); extern int pthread_detach (pthread_t __th) throw (); extern pthread_t pthread_self (void) throw () __attribute__ ((__const__)); extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) throw () __attribute__ ((__const__)); extern int pthread_attr_init (pthread_attr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_destroy (pthread_attr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr, int *__detachstate) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, int __detachstate) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getguardsize (const pthread_attr_t *__attr, size_t *__guardsize) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr, struct sched_param *__restrict __param) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, const struct sched_param *__restrict __param) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict __attr, int *__restrict __policy) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr, int *__restrict __inherit) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, int __inherit) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr, int *__restrict __scope) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr) throw () __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__)); extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr) throw () __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)); extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr, size_t *__restrict __stacksize) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr, size_t *__restrict __stacksize) throw () __attribute__ ((__nonnull__ (1, 2, 3))); extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, size_t __stacksize) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, size_t __cpusetsize, const cpu_set_t *__cpuset) throw () __attribute__ ((__nonnull__ (1, 3))); extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, size_t __cpusetsize, cpu_set_t *__cpuset) throw () __attribute__ ((__nonnull__ (1, 3))); extern int pthread_getattr_default_np (pthread_attr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_setattr_default_np (const pthread_attr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) throw () __attribute__ ((__nonnull__ (2))); extern int pthread_setschedparam (pthread_t __target_thread, int __policy, const struct sched_param *__param) throw () __attribute__ ((__nonnull__ (3))); extern int pthread_getschedparam (pthread_t __target_thread, int *__restrict __policy, struct sched_param *__restrict __param) throw () __attribute__ ((__nonnull__ (2, 3))); extern int pthread_setschedprio (pthread_t __target_thread, int __prio) throw (); extern int pthread_getname_np (pthread_t __target_thread, char *__buf, size_t __buflen) throw () __attribute__ ((__nonnull__ (2))); extern int pthread_setname_np (pthread_t __target_thread, const char *__name) throw () __attribute__ ((__nonnull__ (2))); extern int pthread_getconcurrency (void) throw (); extern int pthread_setconcurrency (int __level) throw (); extern int pthread_yield (void) throw (); extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize, const cpu_set_t *__cpuset) throw () __attribute__ ((__nonnull__ (3))); extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, cpu_set_t *__cpuset) throw () __attribute__ ((__nonnull__ (3))); # 505 "/usr/include/pthread.h" 3 4 extern int pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2))); # 517 "/usr/include/pthread.h" 3 4 extern int pthread_setcancelstate (int __state, int *__oldstate); extern int pthread_setcanceltype (int __type, int *__oldtype); extern int pthread_cancel (pthread_t __th); extern void pthread_testcancel (void); typedef struct { struct { __jmp_buf __cancel_jmp_buf; int __mask_was_saved; } __cancel_jmp_buf[1]; void *__pad[4]; } __pthread_unwind_buf_t __attribute__ ((__aligned__)); # 551 "/usr/include/pthread.h" 3 4 struct __pthread_cleanup_frame { void (*__cancel_routine) (void *); void *__cancel_arg; int __do_it; int __cancel_type; }; class __pthread_cleanup_class { void (*__cancel_routine) (void *); void *__cancel_arg; int __do_it; int __cancel_type; public: __pthread_cleanup_class (void (*__fct) (void *), void *__arg) : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { } ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); } void __setdoit (int __newval) { __do_it = __newval; } void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &__cancel_type); } void __restore () const { pthread_setcanceltype (__cancel_type, 0); } }; # 753 "/usr/include/pthread.h" 3 4 struct __jmp_buf_tag; extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) throw (); extern int pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__mutexattr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutex_lock (pthread_mutex_t *__mutex) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutex_getprioceiling (const pthread_mutex_t * __restrict __mutex, int *__restrict __prioceiling) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, int __prioceiling, int *__restrict __old_ceiling) throw () __attribute__ ((__nonnull__ (1, 3))); extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) throw () __attribute__ ((__nonnull__ (1))); # 817 "/usr/include/pthread.h" 3 4 extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t * __restrict __attr, int *__restrict __pshared) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, int __pshared) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict __attr, int *__restrict __kind) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t * __restrict __attr, int *__restrict __protocol) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, int __protocol) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * __restrict __attr, int *__restrict __prioceiling) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, int __prioceiling) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, int *__robustness) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, int *__robustness) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, int __robustness) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, int __robustness) throw () __attribute__ ((__nonnull__ (1))); # 899 "/usr/include/pthread.h" 3 4 extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, const pthread_rwlockattr_t *__restrict __attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * __restrict __attr, int *__restrict __pshared) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, int __pshared) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t * __restrict __attr, int *__restrict __pref) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, int __pref) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_cond_init (pthread_cond_t *__restrict __cond, const pthread_condattr_t *__restrict __cond_attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_cond_destroy (pthread_cond_t *__cond) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_cond_signal (pthread_cond_t *__cond) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_cond_broadcast (pthread_cond_t *__cond) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex) __attribute__ ((__nonnull__ (1, 2))); # 1011 "/usr/include/pthread.h" 3 4 extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __attribute__ ((__nonnull__ (1, 2, 3))); extern int pthread_condattr_init (pthread_condattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_condattr_destroy (pthread_condattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_condattr_getpshared (const pthread_condattr_t * __restrict __attr, int *__restrict __pshared) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, int __pshared) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_condattr_getclock (const pthread_condattr_t * __restrict __attr, __clockid_t *__restrict __clock_id) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_condattr_setclock (pthread_condattr_t *__attr, __clockid_t __clock_id) throw () __attribute__ ((__nonnull__ (1))); # 1055 "/usr/include/pthread.h" 3 4 extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_spin_destroy (pthread_spinlock_t *__lock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_spin_lock (pthread_spinlock_t *__lock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_spin_trylock (pthread_spinlock_t *__lock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_spin_unlock (pthread_spinlock_t *__lock) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, const pthread_barrierattr_t *__restrict __attr, unsigned int __count) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_barrier_wait (pthread_barrier_t *__barrier) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t * __restrict __attr, int *__restrict __pshared) throw () __attribute__ ((__nonnull__ (1, 2))); extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, int __pshared) throw () __attribute__ ((__nonnull__ (1))); # 1122 "/usr/include/pthread.h" 3 4 extern int pthread_key_create (pthread_key_t *__key, void (*__destr_function) (void *)) throw () __attribute__ ((__nonnull__ (1))); extern int pthread_key_delete (pthread_key_t __key) throw (); extern void *pthread_getspecific (pthread_key_t __key) throw (); extern int pthread_setspecific (pthread_key_t __key, const void *__pointer) throw () ; extern int pthread_getcpuclockid (pthread_t __thread_id, __clockid_t *__clock_id) throw () __attribute__ ((__nonnull__ (2))); # 1156 "/usr/include/pthread.h" 3 4 extern int pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)) throw (); # 1170 "/usr/include/pthread.h" 3 4 } # 36 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 2 3 # 47 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 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; # 101 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 static __typeof(pthread_once) __gthrw_pthread_once __attribute__ ((__weakref__("pthread_once"))); static __typeof(pthread_getspecific) __gthrw_pthread_getspecific __attribute__ ((__weakref__("pthread_getspecific"))); static __typeof(pthread_setspecific) __gthrw_pthread_setspecific __attribute__ ((__weakref__("pthread_setspecific"))); static __typeof(pthread_create) __gthrw_pthread_create __attribute__ ((__weakref__("pthread_create"))); static __typeof(pthread_join) __gthrw_pthread_join __attribute__ ((__weakref__("pthread_join"))); static __typeof(pthread_equal) __gthrw_pthread_equal __attribute__ ((__weakref__("pthread_equal"))); static __typeof(pthread_self) __gthrw_pthread_self __attribute__ ((__weakref__("pthread_self"))); static __typeof(pthread_detach) __gthrw_pthread_detach __attribute__ ((__weakref__("pthread_detach"))); static __typeof(pthread_cancel) __gthrw_pthread_cancel __attribute__ ((__weakref__("pthread_cancel"))); static __typeof(sched_yield) __gthrw_sched_yield __attribute__ ((__weakref__("sched_yield"))); static __typeof(pthread_mutex_lock) __gthrw_pthread_mutex_lock __attribute__ ((__weakref__("pthread_mutex_lock"))); static __typeof(pthread_mutex_trylock) __gthrw_pthread_mutex_trylock __attribute__ ((__weakref__("pthread_mutex_trylock"))); static __typeof(pthread_mutex_timedlock) __gthrw_pthread_mutex_timedlock __attribute__ ((__weakref__("pthread_mutex_timedlock"))); static __typeof(pthread_mutex_unlock) __gthrw_pthread_mutex_unlock __attribute__ ((__weakref__("pthread_mutex_unlock"))); static __typeof(pthread_mutex_init) __gthrw_pthread_mutex_init __attribute__ ((__weakref__("pthread_mutex_init"))); static __typeof(pthread_mutex_destroy) __gthrw_pthread_mutex_destroy __attribute__ ((__weakref__("pthread_mutex_destroy"))); static __typeof(pthread_cond_init) __gthrw_pthread_cond_init __attribute__ ((__weakref__("pthread_cond_init"))); static __typeof(pthread_cond_broadcast) __gthrw_pthread_cond_broadcast __attribute__ ((__weakref__("pthread_cond_broadcast"))); static __typeof(pthread_cond_signal) __gthrw_pthread_cond_signal __attribute__ ((__weakref__("pthread_cond_signal"))); static __typeof(pthread_cond_wait) __gthrw_pthread_cond_wait __attribute__ ((__weakref__("pthread_cond_wait"))); static __typeof(pthread_cond_timedwait) __gthrw_pthread_cond_timedwait __attribute__ ((__weakref__("pthread_cond_timedwait"))); static __typeof(pthread_cond_destroy) __gthrw_pthread_cond_destroy __attribute__ ((__weakref__("pthread_cond_destroy"))); static __typeof(pthread_key_create) __gthrw_pthread_key_create __attribute__ ((__weakref__("pthread_key_create"))); static __typeof(pthread_key_delete) __gthrw_pthread_key_delete __attribute__ ((__weakref__("pthread_key_delete"))); static __typeof(pthread_mutexattr_init) __gthrw_pthread_mutexattr_init __attribute__ ((__weakref__("pthread_mutexattr_init"))); static __typeof(pthread_mutexattr_settype) __gthrw_pthread_mutexattr_settype __attribute__ ((__weakref__("pthread_mutexattr_settype"))); static __typeof(pthread_mutexattr_destroy) __gthrw_pthread_mutexattr_destroy __attribute__ ((__weakref__("pthread_mutexattr_destroy"))); # 236 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 static __typeof(pthread_key_create) __gthrw___pthread_key_create __attribute__ ((__weakref__("__pthread_key_create"))); # 246 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 static inline int __gthread_active_p (void) { static void *const __gthread_active_ptr = __extension__ (void *) &__gthrw___pthread_key_create; return __gthread_active_ptr != 0; } # 658 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return __gthrw_pthread_create (__threadid, __null, __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return __gthrw_pthread_join (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return __gthrw_pthread_detach (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return __gthrw_pthread_equal (__t1, __t2); } static inline __gthread_t __gthread_self (void) { return __gthrw_pthread_self (); } static inline int __gthread_yield (void) { return __gthrw_sched_yield (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return __gthrw_pthread_once (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return __gthrw_pthread_key_create (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return __gthrw_pthread_key_delete (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return __gthrw_pthread_getspecific (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return __gthrw_pthread_setspecific (__key, __ptr); } static inline void __gthread_mutex_init_function (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) __gthrw_pthread_mutex_init (__mutex, __null); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_pthread_mutex_destroy (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_pthread_mutex_lock (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_pthread_mutex_trylock (__mutex); else return 0; } static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return __gthrw_pthread_mutex_timedlock (__mutex, __abs_timeout); else return 0; } static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_pthread_mutex_unlock (__mutex); else return 0; } # 807 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 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_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } # 849 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr-default.h" 3 static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return __gthrw_pthread_cond_broadcast (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return __gthrw_pthread_cond_signal (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return __gthrw_pthread_cond_wait (__cond, __mutex); } static inline int __gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthrw_pthread_cond_timedwait (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_wait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) { return __gthread_cond_wait (__cond, __mutex); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return __gthrw_pthread_cond_destroy (__cond); } # 149 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/gthr.h" 2 3 #pragma GCC visibility pop # 36 "/usr/include/c++/4.8/ext/atomicity.h" 2 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/atomic_word.h" 1 3 # 32 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/atomic_word.h" 3 typedef int _Atomic_word; # 37 "/usr/include/c++/4.8/ext/atomicity.h" 2 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val) { return __atomic_fetch_add(__mem, __val, 4); } static inline void __atomic_add(volatile _Atomic_word* __mem, int __val) { __atomic_fetch_add(__mem, __val, 4); } # 64 "/usr/include/c++/4.8/ext/atomicity.h" 3 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); } } # 40 "/usr/include/c++/4.8/bits/ios_base.h" 2 3 # 1 "/usr/include/c++/4.8/bits/locale_classes.h" 1 3 # 37 "/usr/include/c++/4.8/bits/locale_classes.h" 3 # 38 "/usr/include/c++/4.8/bits/locale_classes.h" 3 # 1 "/usr/include/c++/4.8/string" 1 3 # 36 "/usr/include/c++/4.8/string" 3 # 37 "/usr/include/c++/4.8/string" 3 # 1 "/usr/include/c++/4.8/bits/allocator.h" 1 3 # 46 "/usr/include/c++/4.8/bits/allocator.h" 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++allocator.h" 1 3 # 33 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++allocator.h" 3 # 1 "/usr/include/c++/4.8/ext/new_allocator.h" 1 3 # 33 "/usr/include/c++/4.8/ext/new_allocator.h" 3 # 1 "/usr/include/c++/4.8/new" 1 3 # 37 "/usr/include/c++/4.8/new" 3 # 38 "/usr/include/c++/4.8/new" 3 #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(); } # 91 "/usr/include/c++/4.8/new" 3 void* operator new(std::size_t) throw(std::bad_alloc) __attribute__((__externally_visible__)); void* operator new[](std::size_t) throw(std::bad_alloc) __attribute__((__externally_visible__)); void operator delete(void*) throw() __attribute__((__externally_visible__)); void operator delete[](void*) throw() __attribute__((__externally_visible__)); void* operator new(std::size_t, const std::nothrow_t&) throw() __attribute__((__externally_visible__)); void* operator new[](std::size_t, const std::nothrow_t&) throw() __attribute__((__externally_visible__)); void operator delete(void*, const std::nothrow_t&) throw() __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) throw() __attribute__((__externally_visible__)); inline void* operator new(std::size_t, void* __p) throw() { return __p; } inline void* operator new[](std::size_t, void* __p) throw() { return __p; } inline void operator delete (void*, void*) throw() { } inline void operator delete[](void*, void*) throw() { } } #pragma GCC visibility pop # 34 "/usr/include/c++/4.8/ext/new_allocator.h" 2 3 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { using std::size_t; using std::ptrdiff_t; # 57 "/usr/include/c++/4.8/ext/new_allocator.h" 3 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() throw() { } new_allocator(const new_allocator&) throw() { } template<typename _Tp1> new_allocator(const new_allocator<_Tp1>&) throw() { } ~new_allocator() throw() { } pointer address(reference __x) const { return std::__addressof(__x); } const_pointer address(const_reference __x) const { 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 throw() { return size_t(-1) / sizeof(_Tp); } # 128 "/usr/include/c++/4.8/ext/new_allocator.h" 3 void construct(pointer __p, const _Tp& __val) { ::new((void *)__p) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } }; 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; } } # 34 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/c++allocator.h" 2 3 # 47 "/usr/include/c++/4.8/bits/allocator.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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; }; }; # 91 "/usr/include/c++/4.8/bits/allocator.h" 3 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>; 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; } }; # 218 "/usr/include/c++/4.8/bits/allocator.h" 3 } # 42 "/usr/include/c++/4.8/string" 2 3 # 1 "/usr/include/c++/4.8/bits/ostream_insert.h" 1 3 # 33 "/usr/include/c++/4.8/bits/ostream_insert.h" 3 # 34 "/usr/include/c++/4.8/bits/ostream_insert.h" 3 # 1 "/usr/include/c++/4.8/bits/cxxabi_forced.h" 1 3 # 34 "/usr/include/c++/4.8/bits/cxxabi_forced.h" 3 # 35 "/usr/include/c++/4.8/bits/cxxabi_forced.h" 3 #pragma GCC visibility push(default) namespace __cxxabiv1 { class __forced_unwind { virtual ~__forced_unwind() throw(); virtual void __pure_dummy() = 0; }; } #pragma GCC visibility pop # 37 "/usr/include/c++/4.8/bits/ostream_insert.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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); } # 45 "/usr/include/c++/4.8/string" 2 3 # 1 "/usr/include/c++/4.8/bits/stl_function.h" 1 3 # 59 "/usr/include/c++/4.8/bits/stl_function.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 100 "/usr/include/c++/4.8/bits/stl_function.h" 3 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; }; # 139 "/usr/include/c++/4.8/bits/stl_function.h" 3 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; } }; # 203 "/usr/include/c++/4.8/bits/stl_function.h" 3 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; } }; # 267 "/usr/include/c++/4.8/bits/stl_function.h" 3 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; } }; # 350 "/usr/include/c++/4.8/bits/stl_function.h" 3 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); } # 421 "/usr/include/c++/4.8/bits/stl_function.h" 3 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; } # 508 "/usr/include/c++/4.8/bits/stl_function.h" 3 }; 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; } }; # 541 "/usr/include/c++/4.8/bits/stl_function.h" 3 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); } } # 1 "/usr/include/c++/4.8/backward/binders.h" 1 3 # 59 "/usr/include/c++/4.8/backward/binders.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 103 "/usr/include/c++/4.8/backward/binders.h" 3 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); } } ; 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); } } ; 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)); } } # 732 "/usr/include/c++/4.8/bits/stl_function.h" 2 3 # 49 "/usr/include/c++/4.8/string" 2 3 # 1 "/usr/include/c++/4.8/bits/range_access.h" 1 3 # 33 "/usr/include/c++/4.8/bits/range_access.h" 3 # 34 "/usr/include/c++/4.8/bits/range_access.h" 3 # 52 "/usr/include/c++/4.8/string" 2 3 # 1 "/usr/include/c++/4.8/bits/basic_string.h" 1 3 # 37 "/usr/include/c++/4.8/bits/basic_string.h" 3 # 38 "/usr/include/c++/4.8/bits/basic_string.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 111 "/usr/include/c++/4.8/bits/basic_string.h" 3 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: # 148 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; # 173 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); # 483 "/usr/include/c++/4.8/bits/basic_string.h" 3 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()); # 531 "/usr/include/c++/4.8/bits/basic_string.h" 3 template<class _InputIterator> basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc()); ~basic_string() { _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); } # 564 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& operator=(_CharT __c) { this->assign(1, __c); return *this; } # 604 "/usr/include/c++/4.8/bits/basic_string.h" 3 iterator begin() { _M_leak(); return iterator(_M_data()); } const_iterator begin() const { return const_iterator(_M_data()); } iterator end() { _M_leak(); return iterator(_M_data() + this->size()); } const_iterator end() const { return const_iterator(_M_data() + this->size()); } reverse_iterator rbegin() { return reverse_iterator(this->end()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(this->end()); } reverse_iterator rend() { return reverse_iterator(this->begin()); } const_reverse_iterator rend() const { return const_reverse_iterator(this->begin()); } # 710 "/usr/include/c++/4.8/bits/basic_string.h" 3 public: size_type size() const { return _M_rep()->_M_length; } size_type length() const { return _M_rep()->_M_length; } size_type max_size() const { return _Rep::_S_max_size; } # 739 "/usr/include/c++/4.8/bits/basic_string.h" 3 void resize(size_type __n, _CharT __c); # 752 "/usr/include/c++/4.8/bits/basic_string.h" 3 void resize(size_type __n) { this->resize(__n, _CharT()); } # 775 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type capacity() const { return _M_rep()->_M_capacity; } # 796 "/usr/include/c++/4.8/bits/basic_string.h" 3 void reserve(size_type __res_arg = 0); void clear() { _M_mutate(0, this->size(), 0); } bool empty() const { return this->size() == 0; } # 825 "/usr/include/c++/4.8/bits/basic_string.h" 3 const_reference operator[] (size_type __pos) const { ; return _M_data()[__pos]; } # 842 "/usr/include/c++/4.8/bits/basic_string.h" 3 reference operator[](size_type __pos) { ; ; _M_leak(); return _M_data()[__pos]; } # 863 "/usr/include/c++/4.8/bits/basic_string.h" 3 const_reference at(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(("basic_string::at")); return _M_data()[__n]; } # 882 "/usr/include/c++/4.8/bits/basic_string.h" 3 reference at(size_type __n) { if (__n >= size()) __throw_out_of_range(("basic_string::at")); _M_leak(); return _M_data()[__n]; } # 931 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 972 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& append(const basic_string& __str); # 988 "/usr/include/c++/4.8/bits/basic_string.h" 3 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)); } # 1020 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& append(size_type __n, _CharT __c); # 1042 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); # 1099 "/usr/include/c++/4.8/bits/basic_string.h" 3 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)); } # 1115 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& assign(const _CharT* __s, size_type __n); # 1127 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& assign(const _CharT* __s) { ; return this->assign(__s, traits_type::length(__s)); } # 1143 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& assign(size_type __n, _CharT __c) { return _M_replace_aux(size_type(0), this->size(), __n, __c); } # 1155 "/usr/include/c++/4.8/bits/basic_string.h" 3 template<class _InputIterator> basic_string& assign(_InputIterator __first, _InputIterator __last) { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } # 1184 "/usr/include/c++/4.8/bits/basic_string.h" 3 void insert(iterator __p, size_type __n, _CharT __c) { this->replace(__p, __p, __n, __c); } # 1200 "/usr/include/c++/4.8/bits/basic_string.h" 3 template<class _InputIterator> void insert(iterator __p, _InputIterator __beg, _InputIterator __end) { this->replace(__p, __p, __beg, __end); } # 1232 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& insert(size_type __pos1, const basic_string& __str) { return this->insert(__pos1, __str, size_type(0), __str.size()); } # 1254 "/usr/include/c++/4.8/bits/basic_string.h" 3 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)); } # 1277 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& insert(size_type __pos, const _CharT* __s, size_type __n); # 1295 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& insert(size_type __pos, const _CharT* __s) { ; return this->insert(__pos, __s, traits_type::length(__s)); } # 1318 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 1336 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 1361 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 1377 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 1397 "/usr/include/c++/4.8/bits/basic_string.h" 3 iterator erase(iterator __first, iterator __last); # 1428 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(size_type __pos, size_type __n, const basic_string& __str) { return this->replace(__pos, __n, __str._M_data(), __str.size()); } # 1450 "/usr/include/c++/4.8/bits/basic_string.h" 3 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)); } # 1475 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2); # 1495 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s) { ; return this->replace(__pos, __n1, __s, traits_type::length(__s)); } # 1519 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 1537 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str) { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } # 1556 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { ; return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); } # 1577 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { ; return this->replace(__i1, __i2, __s, traits_type::length(__s)); } # 1598 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { ; return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); } # 1621 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 1697 "/usr/include/c++/4.8/bits/basic_string.h" 3 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: # 1779 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const; # 1789 "/usr/include/c++/4.8/bits/basic_string.h" 3 void swap(basic_string& __s); # 1799 "/usr/include/c++/4.8/bits/basic_string.h" 3 const _CharT* c_str() const { return _M_data(); } const _CharT* data() const { return _M_data(); } allocator_type get_allocator() const { return _M_dataplus; } # 1832 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find(const _CharT* __s, size_type __pos, size_type __n) const; # 1845 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find(const basic_string& __str, size_type __pos = 0) const { return this->find(__str.data(), __pos, __str.size()); } # 1860 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find(const _CharT* __s, size_type __pos = 0) const { ; return this->find(__s, __pos, traits_type::length(__s)); } # 1877 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find(_CharT __c, size_type __pos = 0) const ; # 1890 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type rfind(const basic_string& __str, size_type __pos = npos) const { return this->rfind(__str.data(), __pos, __str.size()); } # 1907 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; # 1920 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type rfind(const _CharT* __s, size_type __pos = npos) const { ; return this->rfind(__s, __pos, traits_type::length(__s)); } # 1937 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type rfind(_CharT __c, size_type __pos = npos) const ; # 1951 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_of(const basic_string& __str, size_type __pos = 0) const { return this->find_first_of(__str.data(), __pos, __str.size()); } # 1968 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; # 1981 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { ; return this->find_first_of(__s, __pos, traits_type::length(__s)); } # 2000 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_of(_CharT __c, size_type __pos = 0) const { return this->find(__c, __pos); } # 2015 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_of(const basic_string& __str, size_type __pos = npos) const { return this->find_last_of(__str.data(), __pos, __str.size()); } # 2032 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; # 2045 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { ; return this->find_last_of(__s, __pos, traits_type::length(__s)); } # 2064 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_of(_CharT __c, size_type __pos = npos) const { return this->rfind(__c, __pos); } # 2078 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const { return this->find_first_not_of(__str.data(), __pos, __str.size()); } # 2095 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const; # 2109 "/usr/include/c++/4.8/bits/basic_string.h" 3 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)); } # 2126 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_first_not_of(_CharT __c, size_type __pos = 0) const ; # 2141 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const { return this->find_last_not_of(__str.data(), __pos, __str.size()); } # 2158 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; # 2172 "/usr/include/c++/4.8/bits/basic_string.h" 3 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)); } # 2189 "/usr/include/c++/4.8/bits/basic_string.h" 3 size_type find_last_not_of(_CharT __c, size_type __pos = npos) const ; # 2205 "/usr/include/c++/4.8/bits/basic_string.h" 3 basic_string substr(size_type __pos = 0, size_type __n = npos) const { return basic_string(*this, _M_check(__pos, "basic_string::substr"), __n); } # 2224 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2256 "/usr/include/c++/4.8/bits/basic_string.h" 3 int compare(size_type __pos, size_type __n, const basic_string& __str) const; # 2282 "/usr/include/c++/4.8/bits/basic_string.h" 3 int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const; # 2300 "/usr/include/c++/4.8/bits/basic_string.h" 3 int compare(const _CharT* __s) const; # 2324 "/usr/include/c++/4.8/bits/basic_string.h" 3 int compare(size_type __pos, size_type __n1, const _CharT* __s) const; # 2351 "/usr/include/c++/4.8/bits/basic_string.h" 3 int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const; }; # 2363 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2484 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2530 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 2567 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2604 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2641 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2678 "/usr/include/c++/4.8/bits/basic_string.h" 3 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; } # 2715 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 2733 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); # 2751 "/usr/include/c++/4.8/bits/basic_string.h" 3 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()); } # 2774 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); # 2791 "/usr/include/c++/4.8/bits/basic_string.h" 3 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); } # 53 "/usr/include/c++/4.8/string" 2 3 # 1 "/usr/include/c++/4.8/bits/basic_string.tcc" 1 3 # 40 "/usr/include/c++/4.8/bits/basic_string.tcc" 3 # 41 "/usr/include/c++/4.8/bits/basic_string.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { 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) { } # 240 "/usr/include/c++/4.8/bits/basic_string.tcc" 3 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")); # 577 "/usr/include/c++/4.8/bits/basic_string.tcc" 3 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 { 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 { 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 { 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 { 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&); } # 54 "/usr/include/c++/4.8/string" 2 3 # 41 "/usr/include/c++/4.8/bits/locale_classes.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 62 "/usr/include/c++/4.8/bits/locale_classes.h" 3 class locale { public: typedef int category; class facet; class id; class _Impl; friend class facet; friend class _Impl; template<typename _Facet> friend bool has_facet(const locale&) throw(); template<typename _Facet> friend const _Facet& use_facet(const locale&); template<typename _Cache> friend struct __use_cache; # 98 "/usr/include/c++/4.8/bits/locale_classes.h" 3 static const category none = 0; static const category ctype = 1L << 0; static const category numeric = 1L << 1; static const category collate = 1L << 2; static const category time = 1L << 3; static const category monetary = 1L << 4; static const category messages = 1L << 5; static const category all = (ctype | numeric | collate | time | monetary | messages); # 117 "/usr/include/c++/4.8/bits/locale_classes.h" 3 locale() throw(); # 126 "/usr/include/c++/4.8/bits/locale_classes.h" 3 locale(const locale& __other) throw(); # 136 "/usr/include/c++/4.8/bits/locale_classes.h" 3 explicit locale(const char* __s); # 151 "/usr/include/c++/4.8/bits/locale_classes.h" 3 locale(const locale& __base, const char* __s, category __cat); # 164 "/usr/include/c++/4.8/bits/locale_classes.h" 3 locale(const locale& __base, const locale& __add, category __cat); # 177 "/usr/include/c++/4.8/bits/locale_classes.h" 3 template<typename _Facet> locale(const locale& __other, _Facet* __f); ~locale() throw(); # 191 "/usr/include/c++/4.8/bits/locale_classes.h" 3 const locale& operator=(const locale& __other) throw(); # 206 "/usr/include/c++/4.8/bits/locale_classes.h" 3 template<typename _Facet> locale combine(const locale& __other) const; string name() const; # 225 "/usr/include/c++/4.8/bits/locale_classes.h" 3 bool operator==(const locale& __other) const throw(); bool operator!=(const locale& __other) const throw() { return !(this->operator==(__other)); } # 253 "/usr/include/c++/4.8/bits/locale_classes.h" 3 template<typename _Char, typename _Traits, typename _Alloc> bool operator()(const basic_string<_Char, _Traits, _Alloc>& __s1, const basic_string<_Char, _Traits, _Alloc>& __s2) const; # 269 "/usr/include/c++/4.8/bits/locale_classes.h" 3 static locale global(const locale& __loc); static const locale& classic(); private: _Impl* _M_impl; static _Impl* _S_classic; static _Impl* _S_global; static const char* const* const _S_categories; # 304 "/usr/include/c++/4.8/bits/locale_classes.h" 3 enum { _S_categories_size = 6 + 6 }; static __gthread_once_t _S_once; explicit locale(_Impl*) throw(); static void _S_initialize(); static void _S_initialize_once() throw(); static category _S_normalize_category(category); void _M_coalesce(const locale& __base, const locale& __add, category __cat); }; # 338 "/usr/include/c++/4.8/bits/locale_classes.h" 3 class locale::facet { private: friend class locale; friend class locale::_Impl; mutable _Atomic_word _M_refcount; static __c_locale _S_c_locale; static const char _S_c_name[2]; static __gthread_once_t _S_once; static void _S_initialize_once(); protected: # 369 "/usr/include/c++/4.8/bits/locale_classes.h" 3 explicit facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0) { } virtual ~facet(); static void _S_create_c_locale(__c_locale& __cloc, const char* __s, __c_locale __old = 0); static __c_locale _S_clone_c_locale(__c_locale& __cloc) throw(); static void _S_destroy_c_locale(__c_locale& __cloc); static __c_locale _S_lc_ctype_c_locale(__c_locale __cloc, const char* __s); static __c_locale _S_get_c_locale(); __attribute__ ((__const__)) static const char* _S_get_c_name() throw(); private: void _M_add_reference() const throw() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } void _M_remove_reference() const throw() { ; if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) { ; try { delete this; } catch(...) { } } } facet(const facet&); facet& operator=(const facet&); }; # 436 "/usr/include/c++/4.8/bits/locale_classes.h" 3 class locale::id { private: friend class locale; friend class locale::_Impl; template<typename _Facet> friend const _Facet& use_facet(const locale&); template<typename _Facet> friend bool has_facet(const locale&) throw(); mutable size_t _M_index; static _Atomic_word _S_refcount; void operator=(const id&); id(const id&); public: id() { } size_t _M_id() const throw(); }; class locale::_Impl { public: friend class locale; friend class locale::facet; template<typename _Facet> friend bool has_facet(const locale&) throw(); template<typename _Facet> friend const _Facet& use_facet(const locale&); template<typename _Cache> friend struct __use_cache; private: _Atomic_word _M_refcount; const facet** _M_facets; size_t _M_facets_size; const facet** _M_caches; char** _M_names; static const locale::id* const _S_id_ctype[]; static const locale::id* const _S_id_numeric[]; static const locale::id* const _S_id_collate[]; static const locale::id* const _S_id_time[]; static const locale::id* const _S_id_monetary[]; static const locale::id* const _S_id_messages[]; static const locale::id* const* const _S_facet_categories[]; void _M_add_reference() throw() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } void _M_remove_reference() throw() { ; if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) { ; try { delete this; } catch(...) { } } } _Impl(const _Impl&, size_t); _Impl(const char*, size_t); _Impl(size_t) throw(); ~_Impl() throw(); _Impl(const _Impl&); void operator=(const _Impl&); bool _M_check_same_name() { bool __ret = true; if (_M_names[1]) for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i) __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0; return __ret; } void _M_replace_categories(const _Impl*, category); void _M_replace_category(const _Impl*, const locale::id* const*); void _M_replace_facet(const _Impl*, const locale::id*); void _M_install_facet(const locale::id*, const facet*); template<typename _Facet> void _M_init_facet(_Facet* __facet) { _M_install_facet(&_Facet::id, __facet); } void _M_install_cache(const facet*, size_t); }; # 583 "/usr/include/c++/4.8/bits/locale_classes.h" 3 template<typename _CharT> class collate : public locale::facet { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; protected: __c_locale _M_c_locale_collate; public: static locale::id id; # 610 "/usr/include/c++/4.8/bits/locale_classes.h" 3 explicit collate(size_t __refs = 0) : facet(__refs), _M_c_locale_collate(_S_get_c_locale()) { } # 624 "/usr/include/c++/4.8/bits/locale_classes.h" 3 explicit collate(__c_locale __cloc, size_t __refs = 0) : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc)) { } # 641 "/usr/include/c++/4.8/bits/locale_classes.h" 3 int compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } # 660 "/usr/include/c++/4.8/bits/locale_classes.h" 3 string_type transform(const _CharT* __lo, const _CharT* __hi) const { return this->do_transform(__lo, __hi); } # 674 "/usr/include/c++/4.8/bits/locale_classes.h" 3 long hash(const _CharT* __lo, const _CharT* __hi) const { return this->do_hash(__lo, __hi); } int _M_compare(const _CharT*, const _CharT*) const throw(); size_t _M_transform(_CharT*, const _CharT*, size_t) const throw(); protected: virtual ~collate() { _S_destroy_c_locale(_M_c_locale_collate); } # 703 "/usr/include/c++/4.8/bits/locale_classes.h" 3 virtual int do_compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const; # 717 "/usr/include/c++/4.8/bits/locale_classes.h" 3 virtual string_type do_transform(const _CharT* __lo, const _CharT* __hi) const; # 730 "/usr/include/c++/4.8/bits/locale_classes.h" 3 virtual long do_hash(const _CharT* __lo, const _CharT* __hi) const; }; template<typename _CharT> locale::id collate<_CharT>::id; template<> int collate<char>::_M_compare(const char*, const char*) const throw(); template<> size_t collate<char>::_M_transform(char*, const char*, size_t) const throw(); template<> int collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw(); template<> size_t collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw(); template<typename _CharT> class collate_byname : public collate<_CharT> { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; explicit collate_byname(const char* __s, size_t __refs = 0) : collate<_CharT>(__refs) { if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { this->_S_destroy_c_locale(this->_M_c_locale_collate); this->_S_create_c_locale(this->_M_c_locale_collate, __s); } } protected: virtual ~collate_byname() { } }; } # 1 "/usr/include/c++/4.8/bits/locale_classes.tcc" 1 3 # 37 "/usr/include/c++/4.8/bits/locale_classes.tcc" 3 # 38 "/usr/include/c++/4.8/bits/locale_classes.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _Facet> locale:: locale(const locale& __other, _Facet* __f) { _M_impl = new _Impl(*__other._M_impl, 1); try { _M_impl->_M_install_facet(&_Facet::id, __f); } catch(...) { _M_impl->_M_remove_reference(); throw; } delete [] _M_impl->_M_names[0]; _M_impl->_M_names[0] = 0; } template<typename _Facet> locale locale:: combine(const locale& __other) const { _Impl* __tmp = new _Impl(*_M_impl, 1); try { __tmp->_M_replace_facet(__other._M_impl, &_Facet::id); } catch(...) { __tmp->_M_remove_reference(); throw; } return locale(__tmp); } template<typename _CharT, typename _Traits, typename _Alloc> bool locale:: operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1, const basic_string<_CharT, _Traits, _Alloc>& __s2) const { typedef std::collate<_CharT> __collate_type; const __collate_type& __collate = use_facet<__collate_type>(*this); return (__collate.compare(__s1.data(), __s1.data() + __s1.length(), __s2.data(), __s2.data() + __s2.length()) < 0); } # 102 "/usr/include/c++/4.8/bits/locale_classes.tcc" 3 template<typename _Facet> bool has_facet(const locale& __loc) throw() { const size_t __i = _Facet::id._M_id(); const locale::facet** __facets = __loc._M_impl->_M_facets; return (__i < __loc._M_impl->_M_facets_size && dynamic_cast<const _Facet*>(__facets[__i])); } # 130 "/usr/include/c++/4.8/bits/locale_classes.tcc" 3 template<typename _Facet> const _Facet& use_facet(const locale& __loc) { const size_t __i = _Facet::id._M_id(); const locale::facet** __facets = __loc._M_impl->_M_facets; if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i]) __throw_bad_cast(); return dynamic_cast<const _Facet&>(*__facets[__i]); } template<typename _CharT> int collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const throw () { return 0; } template<typename _CharT> size_t collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const throw () { return 0; } template<typename _CharT> int collate<_CharT>:: do_compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const { const string_type __one(__lo1, __hi1); const string_type __two(__lo2, __hi2); const _CharT* __p = __one.c_str(); const _CharT* __pend = __one.data() + __one.length(); const _CharT* __q = __two.c_str(); const _CharT* __qend = __two.data() + __two.length(); for (;;) { const int __res = _M_compare(__p, __q); if (__res) return __res; __p += char_traits<_CharT>::length(__p); __q += char_traits<_CharT>::length(__q); if (__p == __pend && __q == __qend) return 0; else if (__p == __pend) return -1; else if (__q == __qend) return 1; __p++; __q++; } } template<typename _CharT> typename collate<_CharT>::string_type collate<_CharT>:: do_transform(const _CharT* __lo, const _CharT* __hi) const { string_type __ret; const string_type __str(__lo, __hi); const _CharT* __p = __str.c_str(); const _CharT* __pend = __str.data() + __str.length(); size_t __len = (__hi - __lo) * 2; _CharT* __c = new _CharT[__len]; try { for (;;) { size_t __res = _M_transform(__c, __p, __len); if (__res >= __len) { __len = __res + 1; delete [] __c, __c = 0; __c = new _CharT[__len]; __res = _M_transform(__c, __p, __len); } __ret.append(__c, __res); __p += char_traits<_CharT>::length(__p); if (__p == __pend) break; __p++; __ret.push_back(_CharT()); } } catch(...) { delete [] __c; throw; } delete [] __c; return __ret; } template<typename _CharT> long collate<_CharT>:: do_hash(const _CharT* __lo, const _CharT* __hi) const { unsigned long __val = 0; for (; __lo < __hi; ++__lo) __val = *__lo + ((__val << 7) | (__val >> (__gnu_cxx::__numeric_traits<unsigned long>:: __digits - 7))); return static_cast<long>(__val); } extern template class collate<char>; extern template class collate_byname<char>; extern template const collate<char>& use_facet<collate<char> >(const locale&); extern template bool has_facet<collate<char> >(const locale&); extern template class collate<wchar_t>; extern template class collate_byname<wchar_t>; extern template const collate<wchar_t>& use_facet<collate<wchar_t> >(const locale&); extern template bool has_facet<collate<wchar_t> >(const locale&); } # 788 "/usr/include/c++/4.8/bits/locale_classes.h" 2 3 # 42 "/usr/include/c++/4.8/bits/ios_base.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { enum _Ios_Fmtflags { _S_boolalpha = 1L << 0, _S_dec = 1L << 1, _S_fixed = 1L << 2, _S_hex = 1L << 3, _S_internal = 1L << 4, _S_left = 1L << 5, _S_oct = 1L << 6, _S_right = 1L << 7, _S_scientific = 1L << 8, _S_showbase = 1L << 9, _S_showpoint = 1L << 10, _S_showpos = 1L << 11, _S_skipws = 1L << 12, _S_unitbuf = 1L << 13, _S_uppercase = 1L << 14, _S_adjustfield = _S_left | _S_right | _S_internal, _S_basefield = _S_dec | _S_oct | _S_hex, _S_floatfield = _S_scientific | _S_fixed, _S_ios_fmtflags_end = 1L << 16 }; inline _Ios_Fmtflags operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); } inline _Ios_Fmtflags operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); } inline _Ios_Fmtflags operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); } inline _Ios_Fmtflags operator~(_Ios_Fmtflags __a) { return _Ios_Fmtflags(~static_cast<int>(__a)); } inline const _Ios_Fmtflags& operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) { return __a = __a | __b; } inline const _Ios_Fmtflags& operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) { return __a = __a & __b; } inline const _Ios_Fmtflags& operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) { return __a = __a ^ __b; } enum _Ios_Openmode { _S_app = 1L << 0, _S_ate = 1L << 1, _S_bin = 1L << 2, _S_in = 1L << 3, _S_out = 1L << 4, _S_trunc = 1L << 5, _S_ios_openmode_end = 1L << 16 }; inline _Ios_Openmode operator&(_Ios_Openmode __a, _Ios_Openmode __b) { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); } inline _Ios_Openmode operator|(_Ios_Openmode __a, _Ios_Openmode __b) { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); } inline _Ios_Openmode operator^(_Ios_Openmode __a, _Ios_Openmode __b) { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); } inline _Ios_Openmode operator~(_Ios_Openmode __a) { return _Ios_Openmode(~static_cast<int>(__a)); } inline const _Ios_Openmode& operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) { return __a = __a | __b; } inline const _Ios_Openmode& operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) { return __a = __a & __b; } inline const _Ios_Openmode& operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) { return __a = __a ^ __b; } enum _Ios_Iostate { _S_goodbit = 0, _S_badbit = 1L << 0, _S_eofbit = 1L << 1, _S_failbit = 1L << 2, _S_ios_iostate_end = 1L << 16 }; inline _Ios_Iostate operator&(_Ios_Iostate __a, _Ios_Iostate __b) { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); } inline _Ios_Iostate operator|(_Ios_Iostate __a, _Ios_Iostate __b) { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); } inline _Ios_Iostate operator^(_Ios_Iostate __a, _Ios_Iostate __b) { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); } inline _Ios_Iostate operator~(_Ios_Iostate __a) { return _Ios_Iostate(~static_cast<int>(__a)); } inline const _Ios_Iostate& operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) { return __a = __a | __b; } inline const _Ios_Iostate& operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) { return __a = __a & __b; } inline const _Ios_Iostate& operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) { return __a = __a ^ __b; } enum _Ios_Seekdir { _S_beg = 0, _S_cur = 1, _S_end = 2, _S_ios_seekdir_end = 1L << 16 }; # 199 "/usr/include/c++/4.8/bits/ios_base.h" 3 class ios_base { public: class failure : public exception { public: explicit failure(const string& __str) throw(); virtual ~failure() throw(); virtual const char* what() const throw(); private: string _M_msg; }; # 255 "/usr/include/c++/4.8/bits/ios_base.h" 3 typedef _Ios_Fmtflags fmtflags; static const fmtflags boolalpha = _S_boolalpha; static const fmtflags dec = _S_dec; static const fmtflags fixed = _S_fixed; static const fmtflags hex = _S_hex; static const fmtflags internal = _S_internal; static const fmtflags left = _S_left; static const fmtflags oct = _S_oct; static const fmtflags right = _S_right; static const fmtflags scientific = _S_scientific; static const fmtflags showbase = _S_showbase; static const fmtflags showpoint = _S_showpoint; static const fmtflags showpos = _S_showpos; static const fmtflags skipws = _S_skipws; static const fmtflags unitbuf = _S_unitbuf; static const fmtflags uppercase = _S_uppercase; static const fmtflags adjustfield = _S_adjustfield; static const fmtflags basefield = _S_basefield; static const fmtflags floatfield = _S_floatfield; # 330 "/usr/include/c++/4.8/bits/ios_base.h" 3 typedef _Ios_Iostate iostate; static const iostate badbit = _S_badbit; static const iostate eofbit = _S_eofbit; static const iostate failbit = _S_failbit; static const iostate goodbit = _S_goodbit; # 361 "/usr/include/c++/4.8/bits/ios_base.h" 3 typedef _Ios_Openmode openmode; static const openmode app = _S_app; static const openmode ate = _S_ate; static const openmode binary = _S_bin; static const openmode in = _S_in; static const openmode out = _S_out; static const openmode trunc = _S_trunc; # 393 "/usr/include/c++/4.8/bits/ios_base.h" 3 typedef _Ios_Seekdir seekdir; static const seekdir beg = _S_beg; static const seekdir cur = _S_cur; static const seekdir end = _S_end; typedef int io_state; typedef int open_mode; typedef int seek_dir; typedef std::streampos streampos; typedef std::streamoff streamoff; # 419 "/usr/include/c++/4.8/bits/ios_base.h" 3 enum event { erase_event, imbue_event, copyfmt_event }; # 436 "/usr/include/c++/4.8/bits/ios_base.h" 3 typedef void (*event_callback) (event __e, ios_base& __b, int __i); # 448 "/usr/include/c++/4.8/bits/ios_base.h" 3 void register_callback(event_callback __fn, int __index); protected: streamsize _M_precision; streamsize _M_width; fmtflags _M_flags; iostate _M_exception; iostate _M_streambuf_state; struct _Callback_list { _Callback_list* _M_next; ios_base::event_callback _M_fn; int _M_index; _Atomic_word _M_refcount; _Callback_list(ios_base::event_callback __fn, int __index, _Callback_list* __cb) : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } void _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } int _M_remove_reference() { ; int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); if (__res == 0) { ; } return __res; } }; _Callback_list* _M_callbacks; void _M_call_callbacks(event __ev) throw(); void _M_dispose_callbacks(void) throw(); struct _Words { void* _M_pword; long _M_iword; _Words() : _M_pword(0), _M_iword(0) { } }; _Words _M_word_zero; enum { _S_local_word_size = 8 }; _Words _M_local_word[_S_local_word_size]; int _M_word_size; _Words* _M_word; _Words& _M_grow_words(int __index, bool __iword); locale _M_ios_locale; void _M_init() throw(); public: class Init { friend class ios_base; public: Init(); ~Init(); private: static _Atomic_word _S_refcount; static bool _S_synced_with_stdio; }; fmtflags flags() const { return _M_flags; } # 561 "/usr/include/c++/4.8/bits/ios_base.h" 3 fmtflags flags(fmtflags __fmtfl) { fmtflags __old = _M_flags; _M_flags = __fmtfl; return __old; } # 577 "/usr/include/c++/4.8/bits/ios_base.h" 3 fmtflags setf(fmtflags __fmtfl) { fmtflags __old = _M_flags; _M_flags |= __fmtfl; return __old; } # 594 "/usr/include/c++/4.8/bits/ios_base.h" 3 fmtflags setf(fmtflags __fmtfl, fmtflags __mask) { fmtflags __old = _M_flags; _M_flags &= ~__mask; _M_flags |= (__fmtfl & __mask); return __old; } void unsetf(fmtflags __mask) { _M_flags &= ~__mask; } # 620 "/usr/include/c++/4.8/bits/ios_base.h" 3 streamsize precision() const { return _M_precision; } streamsize precision(streamsize __prec) { streamsize __old = _M_precision; _M_precision = __prec; return __old; } streamsize width() const { return _M_width; } streamsize width(streamsize __wide) { streamsize __old = _M_width; _M_width = __wide; return __old; } # 671 "/usr/include/c++/4.8/bits/ios_base.h" 3 static bool sync_with_stdio(bool __sync = true); # 683 "/usr/include/c++/4.8/bits/ios_base.h" 3 locale imbue(const locale& __loc) throw(); # 694 "/usr/include/c++/4.8/bits/ios_base.h" 3 locale getloc() const { return _M_ios_locale; } # 705 "/usr/include/c++/4.8/bits/ios_base.h" 3 const locale& _M_getloc() const { return _M_ios_locale; } # 724 "/usr/include/c++/4.8/bits/ios_base.h" 3 static int xalloc() throw(); # 740 "/usr/include/c++/4.8/bits/ios_base.h" 3 long& iword(int __ix) { _Words& __word = (__ix < _M_word_size) ? _M_word[__ix] : _M_grow_words(__ix, true); return __word._M_iword; } # 761 "/usr/include/c++/4.8/bits/ios_base.h" 3 void*& pword(int __ix) { _Words& __word = (__ix < _M_word_size) ? _M_word[__ix] : _M_grow_words(__ix, false); return __word._M_pword; } # 778 "/usr/include/c++/4.8/bits/ios_base.h" 3 virtual ~ios_base(); protected: ios_base() throw (); private: ios_base(const ios_base&); ios_base& operator=(const ios_base&); }; inline ios_base& boolalpha(ios_base& __base) { __base.setf(ios_base::boolalpha); return __base; } inline ios_base& noboolalpha(ios_base& __base) { __base.unsetf(ios_base::boolalpha); return __base; } inline ios_base& showbase(ios_base& __base) { __base.setf(ios_base::showbase); return __base; } inline ios_base& noshowbase(ios_base& __base) { __base.unsetf(ios_base::showbase); return __base; } inline ios_base& showpoint(ios_base& __base) { __base.setf(ios_base::showpoint); return __base; } inline ios_base& noshowpoint(ios_base& __base) { __base.unsetf(ios_base::showpoint); return __base; } inline ios_base& showpos(ios_base& __base) { __base.setf(ios_base::showpos); return __base; } inline ios_base& noshowpos(ios_base& __base) { __base.unsetf(ios_base::showpos); return __base; } inline ios_base& skipws(ios_base& __base) { __base.setf(ios_base::skipws); return __base; } inline ios_base& noskipws(ios_base& __base) { __base.unsetf(ios_base::skipws); return __base; } inline ios_base& uppercase(ios_base& __base) { __base.setf(ios_base::uppercase); return __base; } inline ios_base& nouppercase(ios_base& __base) { __base.unsetf(ios_base::uppercase); return __base; } inline ios_base& unitbuf(ios_base& __base) { __base.setf(ios_base::unitbuf); return __base; } inline ios_base& nounitbuf(ios_base& __base) { __base.unsetf(ios_base::unitbuf); return __base; } inline ios_base& internal(ios_base& __base) { __base.setf(ios_base::internal, ios_base::adjustfield); return __base; } inline ios_base& left(ios_base& __base) { __base.setf(ios_base::left, ios_base::adjustfield); return __base; } inline ios_base& right(ios_base& __base) { __base.setf(ios_base::right, ios_base::adjustfield); return __base; } inline ios_base& dec(ios_base& __base) { __base.setf(ios_base::dec, ios_base::basefield); return __base; } inline ios_base& hex(ios_base& __base) { __base.setf(ios_base::hex, ios_base::basefield); return __base; } inline ios_base& oct(ios_base& __base) { __base.setf(ios_base::oct, ios_base::basefield); return __base; } inline ios_base& fixed(ios_base& __base) { __base.setf(ios_base::fixed, ios_base::floatfield); return __base; } inline ios_base& scientific(ios_base& __base) { __base.setf(ios_base::scientific, ios_base::floatfield); return __base; } } # 43 "/usr/include/c++/4.8/ios" 2 3 # 1 "/usr/include/c++/4.8/streambuf" 1 3 # 36 "/usr/include/c++/4.8/streambuf" 3 # 37 "/usr/include/c++/4.8/streambuf" 3 # 45 "/usr/include/c++/4.8/streambuf" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _CharT, typename _Traits> streamsize __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*, basic_streambuf<_CharT, _Traits>*, bool&); # 119 "/usr/include/c++/4.8/streambuf" 3 template<typename _CharT, typename _Traits> class basic_streambuf { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef basic_streambuf<char_type, traits_type> __streambuf_type; friend class basic_ios<char_type, traits_type>; friend class basic_istream<char_type, traits_type>; friend class basic_ostream<char_type, traits_type>; friend class istreambuf_iterator<char_type, traits_type>; friend class ostreambuf_iterator<char_type, traits_type>; friend streamsize __copy_streambufs_eof<>(basic_streambuf*, basic_streambuf*, bool&); template<bool _IsMove, typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, _CharT2*>::__type __copy_move_a2(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, _CharT2*); template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, istreambuf_iterator<_CharT2> >::__type find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, const _CharT2&); template<typename _CharT2, typename _Traits2> friend basic_istream<_CharT2, _Traits2>& operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*); template<typename _CharT2, typename _Traits2, typename _Alloc> friend basic_istream<_CharT2, _Traits2>& operator>>(basic_istream<_CharT2, _Traits2>&, basic_string<_CharT2, _Traits2, _Alloc>&); template<typename _CharT2, typename _Traits2, typename _Alloc> friend basic_istream<_CharT2, _Traits2>& getline(basic_istream<_CharT2, _Traits2>&, basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2); protected: char_type* _M_in_beg; char_type* _M_in_cur; char_type* _M_in_end; char_type* _M_out_beg; char_type* _M_out_cur; char_type* _M_out_end; locale _M_buf_locale; public: virtual ~basic_streambuf() { } # 208 "/usr/include/c++/4.8/streambuf" 3 locale pubimbue(const locale& __loc) { locale __tmp(this->getloc()); this->imbue(__loc); _M_buf_locale = __loc; return __tmp; } # 225 "/usr/include/c++/4.8/streambuf" 3 locale getloc() const { return _M_buf_locale; } # 238 "/usr/include/c++/4.8/streambuf" 3 basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) { return this->setbuf(__s, __n); } # 250 "/usr/include/c++/4.8/streambuf" 3 pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode = ios_base::in | ios_base::out) { return this->seekoff(__off, __way, __mode); } # 262 "/usr/include/c++/4.8/streambuf" 3 pos_type pubseekpos(pos_type __sp, ios_base::openmode __mode = ios_base::in | ios_base::out) { return this->seekpos(__sp, __mode); } int pubsync() { return this->sync(); } # 283 "/usr/include/c++/4.8/streambuf" 3 streamsize in_avail() { const streamsize __ret = this->egptr() - this->gptr(); return __ret ? __ret : this->showmanyc(); } # 297 "/usr/include/c++/4.8/streambuf" 3 int_type snextc() { int_type __ret = traits_type::eof(); if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(), __ret), true)) __ret = this->sgetc(); return __ret; } # 315 "/usr/include/c++/4.8/streambuf" 3 int_type sbumpc() { int_type __ret; if (__builtin_expect(this->gptr() < this->egptr(), true)) { __ret = traits_type::to_int_type(*this->gptr()); this->gbump(1); } else __ret = this->uflow(); return __ret; } # 337 "/usr/include/c++/4.8/streambuf" 3 int_type sgetc() { int_type __ret; if (__builtin_expect(this->gptr() < this->egptr(), true)) __ret = traits_type::to_int_type(*this->gptr()); else __ret = this->underflow(); return __ret; } # 356 "/usr/include/c++/4.8/streambuf" 3 streamsize sgetn(char_type* __s, streamsize __n) { return this->xsgetn(__s, __n); } # 371 "/usr/include/c++/4.8/streambuf" 3 int_type sputbackc(char_type __c) { int_type __ret; const bool __testpos = this->eback() < this->gptr(); if (__builtin_expect(!__testpos || !traits_type::eq(__c, this->gptr()[-1]), false)) __ret = this->pbackfail(traits_type::to_int_type(__c)); else { this->gbump(-1); __ret = traits_type::to_int_type(*this->gptr()); } return __ret; } # 396 "/usr/include/c++/4.8/streambuf" 3 int_type sungetc() { int_type __ret; if (__builtin_expect(this->eback() < this->gptr(), true)) { this->gbump(-1); __ret = traits_type::to_int_type(*this->gptr()); } else __ret = this->pbackfail(); return __ret; } # 423 "/usr/include/c++/4.8/streambuf" 3 int_type sputc(char_type __c) { int_type __ret; if (__builtin_expect(this->pptr() < this->epptr(), true)) { *this->pptr() = __c; this->pbump(1); __ret = traits_type::to_int_type(__c); } else __ret = this->overflow(traits_type::to_int_type(__c)); return __ret; } # 449 "/usr/include/c++/4.8/streambuf" 3 streamsize sputn(const char_type* __s, streamsize __n) { return this->xsputn(__s, __n); } protected: # 463 "/usr/include/c++/4.8/streambuf" 3 basic_streambuf() : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), _M_out_beg(0), _M_out_cur(0), _M_out_end(0), _M_buf_locale(locale()) { } # 481 "/usr/include/c++/4.8/streambuf" 3 char_type* eback() const { return _M_in_beg; } char_type* gptr() const { return _M_in_cur; } char_type* egptr() const { return _M_in_end; } # 497 "/usr/include/c++/4.8/streambuf" 3 void gbump(int __n) { _M_in_cur += __n; } # 508 "/usr/include/c++/4.8/streambuf" 3 void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) { _M_in_beg = __gbeg; _M_in_cur = __gnext; _M_in_end = __gend; } # 528 "/usr/include/c++/4.8/streambuf" 3 char_type* pbase() const { return _M_out_beg; } char_type* pptr() const { return _M_out_cur; } char_type* epptr() const { return _M_out_end; } # 544 "/usr/include/c++/4.8/streambuf" 3 void pbump(int __n) { _M_out_cur += __n; } # 554 "/usr/include/c++/4.8/streambuf" 3 void setp(char_type* __pbeg, char_type* __pend) { _M_out_beg = _M_out_cur = __pbeg; _M_out_end = __pend; } # 575 "/usr/include/c++/4.8/streambuf" 3 virtual void imbue(const locale& __loc) { } # 590 "/usr/include/c++/4.8/streambuf" 3 virtual basic_streambuf<char_type,_Traits>* setbuf(char_type*, streamsize) { return this; } # 601 "/usr/include/c++/4.8/streambuf" 3 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out) { return pos_type(off_type(-1)); } # 613 "/usr/include/c++/4.8/streambuf" 3 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out) { return pos_type(off_type(-1)); } # 626 "/usr/include/c++/4.8/streambuf" 3 virtual int sync() { return 0; } # 648 "/usr/include/c++/4.8/streambuf" 3 virtual streamsize showmanyc() { return 0; } # 664 "/usr/include/c++/4.8/streambuf" 3 virtual streamsize xsgetn(char_type* __s, streamsize __n); # 686 "/usr/include/c++/4.8/streambuf" 3 virtual int_type underflow() { return traits_type::eof(); } # 699 "/usr/include/c++/4.8/streambuf" 3 virtual int_type uflow() { int_type __ret = traits_type::eof(); const bool __testeof = traits_type::eq_int_type(this->underflow(), __ret); if (!__testeof) { __ret = traits_type::to_int_type(*this->gptr()); this->gbump(1); } return __ret; } # 723 "/usr/include/c++/4.8/streambuf" 3 virtual int_type pbackfail(int_type __c = traits_type::eof()) { return traits_type::eof(); } # 741 "/usr/include/c++/4.8/streambuf" 3 virtual streamsize xsputn(const char_type* __s, streamsize __n); # 767 "/usr/include/c++/4.8/streambuf" 3 virtual int_type overflow(int_type __c = traits_type::eof()) { return traits_type::eof(); } public: # 782 "/usr/include/c++/4.8/streambuf" 3 void stossc() { if (this->gptr() < this->egptr()) this->gbump(1); else this->uflow(); } void __safe_gbump(streamsize __n) { _M_in_cur += __n; } void __safe_pbump(streamsize __n) { _M_out_cur += __n; } private: basic_streambuf(const basic_streambuf& __sb) : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur), _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg), _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur), _M_buf_locale(__sb._M_buf_locale) { } basic_streambuf& operator=(const basic_streambuf&) { return *this; }; }; template<> streamsize __copy_streambufs_eof(basic_streambuf<char>* __sbin, basic_streambuf<char>* __sbout, bool& __ineof); template<> streamsize __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin, basic_streambuf<wchar_t>* __sbout, bool& __ineof); } # 1 "/usr/include/c++/4.8/bits/streambuf.tcc" 1 3 # 37 "/usr/include/c++/4.8/bits/streambuf.tcc" 3 # 38 "/usr/include/c++/4.8/bits/streambuf.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _CharT, typename _Traits> streamsize basic_streambuf<_CharT, _Traits>:: xsgetn(char_type* __s, streamsize __n) { streamsize __ret = 0; while (__ret < __n) { const streamsize __buf_len = this->egptr() - this->gptr(); if (__buf_len) { const streamsize __remaining = __n - __ret; const streamsize __len = std::min(__buf_len, __remaining); traits_type::copy(__s, this->gptr(), __len); __ret += __len; __s += __len; this->__safe_gbump(__len); } if (__ret < __n) { const int_type __c = this->uflow(); if (!traits_type::eq_int_type(__c, traits_type::eof())) { traits_type::assign(*__s++, traits_type::to_char_type(__c)); ++__ret; } else break; } } return __ret; } template<typename _CharT, typename _Traits> streamsize basic_streambuf<_CharT, _Traits>:: xsputn(const char_type* __s, streamsize __n) { streamsize __ret = 0; while (__ret < __n) { const streamsize __buf_len = this->epptr() - this->pptr(); if (__buf_len) { const streamsize __remaining = __n - __ret; const streamsize __len = std::min(__buf_len, __remaining); traits_type::copy(this->pptr(), __s, __len); __ret += __len; __s += __len; this->__safe_pbump(__len); } if (__ret < __n) { int_type __c = this->overflow(traits_type::to_int_type(*__s)); if (!traits_type::eq_int_type(__c, traits_type::eof())) { ++__ret; ++__s; } else break; } } return __ret; } template<typename _CharT, typename _Traits> streamsize __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin, basic_streambuf<_CharT, _Traits>* __sbout, bool& __ineof) { streamsize __ret = 0; __ineof = true; typename _Traits::int_type __c = __sbin->sgetc(); while (!_Traits::eq_int_type(__c, _Traits::eof())) { __c = __sbout->sputc(_Traits::to_char_type(__c)); if (_Traits::eq_int_type(__c, _Traits::eof())) { __ineof = false; break; } ++__ret; __c = __sbin->snextc(); } return __ret; } template<typename _CharT, typename _Traits> inline streamsize __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin, basic_streambuf<_CharT, _Traits>* __sbout) { bool __ineof; return __copy_streambufs_eof(__sbin, __sbout, __ineof); } extern template class basic_streambuf<char>; extern template streamsize __copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*); extern template streamsize __copy_streambufs_eof(basic_streambuf<char>*, basic_streambuf<char>*, bool&); extern template class basic_streambuf<wchar_t>; extern template streamsize __copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*); extern template streamsize __copy_streambufs_eof(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*, bool&); } # 829 "/usr/include/c++/4.8/streambuf" 2 3 # 44 "/usr/include/c++/4.8/ios" 2 3 # 1 "/usr/include/c++/4.8/bits/basic_ios.h" 1 3 # 33 "/usr/include/c++/4.8/bits/basic_ios.h" 3 # 34 "/usr/include/c++/4.8/bits/basic_ios.h" 3 # 1 "/usr/include/c++/4.8/bits/locale_facets.h" 1 3 # 37 "/usr/include/c++/4.8/bits/locale_facets.h" 3 # 38 "/usr/include/c++/4.8/bits/locale_facets.h" 3 # 1 "/usr/include/c++/4.8/cwctype" 1 3 # 39 "/usr/include/c++/4.8/cwctype" 3 # 40 "/usr/include/c++/4.8/cwctype" 3 # 50 "/usr/include/c++/4.8/cwctype" 3 # 1 "/usr/include/wctype.h" 1 3 4 # 33 "/usr/include/wctype.h" 3 4 # 1 "/usr/include/wchar.h" 1 3 4 # 34 "/usr/include/wctype.h" 2 3 4 # 49 "/usr/include/wctype.h" 3 4 typedef unsigned long int wctype_t; # 71 "/usr/include/wctype.h" 3 4 enum { __ISwupper = 0, __ISwlower = 1, __ISwalpha = 2, __ISwdigit = 3, __ISwxdigit = 4, __ISwspace = 5, __ISwprint = 6, __ISwgraph = 7, __ISwblank = 8, __ISwcntrl = 9, __ISwpunct = 10, __ISwalnum = 11, _ISwupper = ((__ISwupper) < 8 ? (int) ((1UL << (__ISwupper)) << 24) : ((__ISwupper) < 16 ? (int) ((1UL << (__ISwupper)) << 8) : ((__ISwupper) < 24 ? (int) ((1UL << (__ISwupper)) >> 8) : (int) ((1UL << (__ISwupper)) >> 24)))), _ISwlower = ((__ISwlower) < 8 ? (int) ((1UL << (__ISwlower)) << 24) : ((__ISwlower) < 16 ? (int) ((1UL << (__ISwlower)) << 8) : ((__ISwlower) < 24 ? (int) ((1UL << (__ISwlower)) >> 8) : (int) ((1UL << (__ISwlower)) >> 24)))), _ISwalpha = ((__ISwalpha) < 8 ? (int) ((1UL << (__ISwalpha)) << 24) : ((__ISwalpha) < 16 ? (int) ((1UL << (__ISwalpha)) << 8) : ((__ISwalpha) < 24 ? (int) ((1UL << (__ISwalpha)) >> 8) : (int) ((1UL << (__ISwalpha)) >> 24)))), _ISwdigit = ((__ISwdigit) < 8 ? (int) ((1UL << (__ISwdigit)) << 24) : ((__ISwdigit) < 16 ? (int) ((1UL << (__ISwdigit)) << 8) : ((__ISwdigit) < 24 ? (int) ((1UL << (__ISwdigit)) >> 8) : (int) ((1UL << (__ISwdigit)) >> 24)))), _ISwxdigit = ((__ISwxdigit) < 8 ? (int) ((1UL << (__ISwxdigit)) << 24) : ((__ISwxdigit) < 16 ? (int) ((1UL << (__ISwxdigit)) << 8) : ((__ISwxdigit) < 24 ? (int) ((1UL << (__ISwxdigit)) >> 8) : (int) ((1UL << (__ISwxdigit)) >> 24)))), _ISwspace = ((__ISwspace) < 8 ? (int) ((1UL << (__ISwspace)) << 24) : ((__ISwspace) < 16 ? (int) ((1UL << (__ISwspace)) << 8) : ((__ISwspace) < 24 ? (int) ((1UL << (__ISwspace)) >> 8) : (int) ((1UL << (__ISwspace)) >> 24)))), _ISwprint = ((__ISwprint) < 8 ? (int) ((1UL << (__ISwprint)) << 24) : ((__ISwprint) < 16 ? (int) ((1UL << (__ISwprint)) << 8) : ((__ISwprint) < 24 ? (int) ((1UL << (__ISwprint)) >> 8) : (int) ((1UL << (__ISwprint)) >> 24)))), _ISwgraph = ((__ISwgraph) < 8 ? (int) ((1UL << (__ISwgraph)) << 24) : ((__ISwgraph) < 16 ? (int) ((1UL << (__ISwgraph)) << 8) : ((__ISwgraph) < 24 ? (int) ((1UL << (__ISwgraph)) >> 8) : (int) ((1UL << (__ISwgraph)) >> 24)))), _ISwblank = ((__ISwblank) < 8 ? (int) ((1UL << (__ISwblank)) << 24) : ((__ISwblank) < 16 ? (int) ((1UL << (__ISwblank)) << 8) : ((__ISwblank) < 24 ? (int) ((1UL << (__ISwblank)) >> 8) : (int) ((1UL << (__ISwblank)) >> 24)))), _ISwcntrl = ((__ISwcntrl) < 8 ? (int) ((1UL << (__ISwcntrl)) << 24) : ((__ISwcntrl) < 16 ? (int) ((1UL << (__ISwcntrl)) << 8) : ((__ISwcntrl) < 24 ? (int) ((1UL << (__ISwcntrl)) >> 8) : (int) ((1UL << (__ISwcntrl)) >> 24)))), _ISwpunct = ((__ISwpunct) < 8 ? (int) ((1UL << (__ISwpunct)) << 24) : ((__ISwpunct) < 16 ? (int) ((1UL << (__ISwpunct)) << 8) : ((__ISwpunct) < 24 ? (int) ((1UL << (__ISwpunct)) >> 8) : (int) ((1UL << (__ISwpunct)) >> 24)))), _ISwalnum = ((__ISwalnum) < 8 ? (int) ((1UL << (__ISwalnum)) << 24) : ((__ISwalnum) < 16 ? (int) ((1UL << (__ISwalnum)) << 8) : ((__ISwalnum) < 24 ? (int) ((1UL << (__ISwalnum)) >> 8) : (int) ((1UL << (__ISwalnum)) >> 24)))) }; extern "C" { extern int iswalnum (wint_t __wc) throw (); extern int iswalpha (wint_t __wc) throw (); extern int iswcntrl (wint_t __wc) throw (); extern int iswdigit (wint_t __wc) throw (); extern int iswgraph (wint_t __wc) throw (); extern int iswlower (wint_t __wc) throw (); extern int iswprint (wint_t __wc) throw (); extern int iswpunct (wint_t __wc) throw (); extern int iswspace (wint_t __wc) throw (); extern int iswupper (wint_t __wc) throw (); extern int iswxdigit (wint_t __wc) throw (); extern int iswblank (wint_t __wc) throw (); # 171 "/usr/include/wctype.h" 3 4 extern wctype_t wctype (const char *__property) throw (); extern int iswctype (wint_t __wc, wctype_t __desc) throw (); typedef const __int32_t *wctrans_t; extern wint_t towlower (wint_t __wc) throw (); extern wint_t towupper (wint_t __wc) throw (); } # 213 "/usr/include/wctype.h" 3 4 extern "C" { extern wctrans_t wctrans (const char *__property) throw (); extern wint_t towctrans (wint_t __wc, wctrans_t __desc) throw (); extern int iswalnum_l (wint_t __wc, __locale_t __locale) throw (); extern int iswalpha_l (wint_t __wc, __locale_t __locale) throw (); extern int iswcntrl_l (wint_t __wc, __locale_t __locale) throw (); extern int iswdigit_l (wint_t __wc, __locale_t __locale) throw (); extern int iswgraph_l (wint_t __wc, __locale_t __locale) throw (); extern int iswlower_l (wint_t __wc, __locale_t __locale) throw (); extern int iswprint_l (wint_t __wc, __locale_t __locale) throw (); extern int iswpunct_l (wint_t __wc, __locale_t __locale) throw (); extern int iswspace_l (wint_t __wc, __locale_t __locale) throw (); extern int iswupper_l (wint_t __wc, __locale_t __locale) throw (); extern int iswxdigit_l (wint_t __wc, __locale_t __locale) throw (); extern int iswblank_l (wint_t __wc, __locale_t __locale) throw (); extern wctype_t wctype_l (const char *__property, __locale_t __locale) throw (); extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) throw (); extern wint_t towlower_l (wint_t __wc, __locale_t __locale) throw (); extern wint_t towupper_l (wint_t __wc, __locale_t __locale) throw (); extern wctrans_t wctrans_l (const char *__property, __locale_t __locale) throw (); extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, __locale_t __locale) throw (); } # 51 "/usr/include/c++/4.8/cwctype" 2 3 # 80 "/usr/include/c++/4.8/cwctype" 3 namespace std { using ::wctrans_t; using ::wctype_t; using ::wint_t; using ::iswalnum; using ::iswalpha; using ::iswblank; using ::iswcntrl; using ::iswctype; using ::iswdigit; using ::iswgraph; using ::iswlower; using ::iswprint; using ::iswpunct; using ::iswspace; using ::iswupper; using ::iswxdigit; using ::towctrans; using ::towlower; using ::towupper; using ::wctrans; using ::wctype; } # 40 "/usr/include/c++/4.8/bits/locale_facets.h" 2 3 # 1 "/usr/include/c++/4.8/cctype" 1 3 # 39 "/usr/include/c++/4.8/cctype" 3 # 40 "/usr/include/c++/4.8/cctype" 3 # 41 "/usr/include/c++/4.8/bits/locale_facets.h" 2 3 # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/ctype_base.h" 1 3 # 36 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/ctype_base.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { struct ctype_base { typedef const int* __to_type; typedef unsigned short mask; static const mask upper = _ISupper; static const mask lower = _ISlower; static const mask alpha = _ISalpha; static const mask digit = _ISdigit; static const mask xdigit = _ISxdigit; static const mask space = _ISspace; static const mask print = _ISprint; static const mask graph = _ISalpha | _ISdigit | _ISpunct; static const mask cntrl = _IScntrl; static const mask punct = _ISpunct; static const mask alnum = _ISalpha | _ISdigit; }; } # 42 "/usr/include/c++/4.8/bits/locale_facets.h" 2 3 # 1 "/usr/include/c++/4.8/bits/streambuf_iterator.h" 1 3 # 33 "/usr/include/c++/4.8/bits/streambuf_iterator.h" 3 # 34 "/usr/include/c++/4.8/bits/streambuf_iterator.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 49 "/usr/include/c++/4.8/bits/streambuf_iterator.h" 3 template<typename _CharT, typename _Traits> class istreambuf_iterator : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT&> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename _Traits::int_type int_type; typedef basic_streambuf<_CharT, _Traits> streambuf_type; typedef basic_istream<_CharT, _Traits> istream_type; template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, ostreambuf_iterator<_CharT2> >::__type copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, ostreambuf_iterator<_CharT2>); template<bool _IsMove, typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, _CharT2*>::__type __copy_move_a2(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, _CharT2*); template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, istreambuf_iterator<_CharT2> >::__type find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, const _CharT2&); private: mutable streambuf_type* _M_sbuf; mutable int_type _M_c; public: istreambuf_iterator() throw() : _M_sbuf(0), _M_c(traits_type::eof()) { } # 112 "/usr/include/c++/4.8/bits/streambuf_iterator.h" 3 istreambuf_iterator(istream_type& __s) throw() : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { } istreambuf_iterator(streambuf_type* __s) throw() : _M_sbuf(__s), _M_c(traits_type::eof()) { } char_type operator*() const { return traits_type::to_char_type(_M_get()); } istreambuf_iterator& operator++() { ; if (_M_sbuf) { _M_sbuf->sbumpc(); _M_c = traits_type::eof(); } return *this; } istreambuf_iterator operator++(int) { ; istreambuf_iterator __old = *this; if (_M_sbuf) { __old._M_c = _M_sbuf->sbumpc(); _M_c = traits_type::eof(); } return __old; } bool equal(const istreambuf_iterator& __b) const { return _M_at_eof() == __b._M_at_eof(); } private: int_type _M_get() const { const int_type __eof = traits_type::eof(); int_type __ret = __eof; if (_M_sbuf) { if (!traits_type::eq_int_type(_M_c, __eof)) __ret = _M_c; else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()), __eof)) _M_c = __ret; else _M_sbuf = 0; } return __ret; } bool _M_at_eof() const { const int_type __eof = traits_type::eof(); return traits_type::eq_int_type(_M_get(), __eof); } }; template<typename _CharT, typename _Traits> inline bool operator==(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) { return __a.equal(__b); } template<typename _CharT, typename _Traits> inline bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) { return !__a.equal(__b); } template<typename _CharT, typename _Traits> class ostreambuf_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> streambuf_type; typedef basic_ostream<_CharT, _Traits> ostream_type; template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, ostreambuf_iterator<_CharT2> >::__type copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, ostreambuf_iterator<_CharT2>); private: streambuf_type* _M_sbuf; bool _M_failed; public: ostreambuf_iterator(ostream_type& __s) throw() : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { } ostreambuf_iterator(streambuf_type* __s) throw() : _M_sbuf(__s), _M_failed(!_M_sbuf) { } ostreambuf_iterator& operator=(_CharT __c) { if (!_M_failed && _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof())) _M_failed = true; return *this; } ostreambuf_iterator& operator*() { return *this; } ostreambuf_iterator& operator++(int) { return *this; } ostreambuf_iterator& operator++() { return *this; } bool failed() const throw() { return _M_failed; } ostreambuf_iterator& _M_put(const _CharT* __ws, streamsize __len) { if (__builtin_expect(!_M_failed, true) && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len, false)) _M_failed = true; return *this; } }; template<typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT> >::__type copy(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, ostreambuf_iterator<_CharT> __result) { if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed) { bool __ineof; __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof); if (!__ineof) __result._M_failed = true; } return __result; } template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT> >::__type __copy_move_a2(_CharT* __first, _CharT* __last, ostreambuf_iterator<_CharT> __result) { const streamsize __num = __last - __first; if (__num > 0) __result._M_put(__first, __num); return __result; } template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT> >::__type __copy_move_a2(const _CharT* __first, const _CharT* __last, ostreambuf_iterator<_CharT> __result) { const streamsize __num = __last - __first; if (__num > 0) __result._M_put(__first, __num); return __result; } template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, _CharT*>::__type __copy_move_a2(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, _CharT* __result) { typedef istreambuf_iterator<_CharT> __is_iterator_type; typedef typename __is_iterator_type::traits_type traits_type; typedef typename __is_iterator_type::streambuf_type streambuf_type; typedef typename traits_type::int_type int_type; if (__first._M_sbuf && !__last._M_sbuf) { streambuf_type* __sb = __first._M_sbuf; int_type __c = __sb->sgetc(); while (!traits_type::eq_int_type(__c, traits_type::eof())) { const streamsize __n = __sb->egptr() - __sb->gptr(); if (__n > 1) { traits_type::copy(__result, __sb->gptr(), __n); __sb->__safe_gbump(__n); __result += __n; __c = __sb->underflow(); } else { *__result++ = traits_type::to_char_type(__c); __c = __sb->snextc(); } } } return __result; } template<typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, istreambuf_iterator<_CharT> >::__type find(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, const _CharT& __val) { typedef istreambuf_iterator<_CharT> __is_iterator_type; typedef typename __is_iterator_type::traits_type traits_type; typedef typename __is_iterator_type::streambuf_type streambuf_type; typedef typename traits_type::int_type int_type; if (__first._M_sbuf && !__last._M_sbuf) { const int_type __ival = traits_type::to_int_type(__val); streambuf_type* __sb = __first._M_sbuf; int_type __c = __sb->sgetc(); while (!traits_type::eq_int_type(__c, traits_type::eof()) && !traits_type::eq_int_type(__c, __ival)) { streamsize __n = __sb->egptr() - __sb->gptr(); if (__n > 1) { const _CharT* __p = traits_type::find(__sb->gptr(), __n, __val); if (__p) __n = __p - __sb->gptr(); __sb->__safe_gbump(__n); __c = __sb->sgetc(); } else __c = __sb->snextc(); } if (!traits_type::eq_int_type(__c, traits_type::eof())) __first._M_c = __c; else __first._M_sbuf = 0; } return __first; } } # 49 "/usr/include/c++/4.8/bits/locale_facets.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 64 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<typename _Tp> void __convert_to_v(const char*, _Tp&, ios_base::iostate&, const __c_locale&) throw(); template<> void __convert_to_v(const char*, float&, ios_base::iostate&, const __c_locale&) throw(); template<> void __convert_to_v(const char*, double&, ios_base::iostate&, const __c_locale&) throw(); template<> void __convert_to_v(const char*, long double&, ios_base::iostate&, const __c_locale&) throw(); template<typename _CharT, typename _Traits> struct __pad { static void _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, const _CharT* __olds, streamsize __newlen, streamsize __oldlen); }; template<typename _CharT> _CharT* __add_grouping(_CharT* __s, _CharT __sep, const char* __gbeg, size_t __gsize, const _CharT* __first, const _CharT* __last); template<typename _CharT> inline ostreambuf_iterator<_CharT> __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len) { __s._M_put(__ws, __len); return __s; } template<typename _CharT, typename _OutIter> inline _OutIter __write(_OutIter __s, const _CharT* __ws, int __len) { for (int __j = 0; __j < __len; __j++, ++__s) *__s = __ws[__j]; return __s; } # 142 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<typename _CharT> class __ctype_abstract_base : public locale::facet, public ctype_base { public: typedef _CharT char_type; # 161 "/usr/include/c++/4.8/bits/locale_facets.h" 3 bool is(mask __m, char_type __c) const { return this->do_is(__m, __c); } # 178 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* is(const char_type *__lo, const char_type *__hi, mask *__vec) const { return this->do_is(__lo, __hi, __vec); } # 194 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* scan_is(mask __m, const char_type* __lo, const char_type* __hi) const { return this->do_scan_is(__m, __lo, __hi); } # 210 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* scan_not(mask __m, const char_type* __lo, const char_type* __hi) const { return this->do_scan_not(__m, __lo, __hi); } # 224 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type toupper(char_type __c) const { return this->do_toupper(__c); } # 239 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* toupper(char_type *__lo, const char_type* __hi) const { return this->do_toupper(__lo, __hi); } # 253 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type tolower(char_type __c) const { return this->do_tolower(__c); } # 268 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* tolower(char_type* __lo, const char_type* __hi) const { return this->do_tolower(__lo, __hi); } # 285 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type widen(char __c) const { return this->do_widen(__c); } # 304 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char* widen(const char* __lo, const char* __hi, char_type* __to) const { return this->do_widen(__lo, __hi, __to); } # 323 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char narrow(char_type __c, char __dfault) const { return this->do_narrow(__c, __dfault); } # 345 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const { return this->do_narrow(__lo, __hi, __dfault, __to); } protected: explicit __ctype_abstract_base(size_t __refs = 0): facet(__refs) { } virtual ~__ctype_abstract_base() { } # 370 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual bool do_is(mask __m, char_type __c) const = 0; # 389 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const = 0; # 408 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const = 0; # 427 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const = 0; # 445 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_toupper(char_type __c) const = 0; # 462 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const = 0; # 478 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_tolower(char_type __c) const = 0; # 495 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const = 0; # 514 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_widen(char __c) const = 0; # 535 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __to) const = 0; # 556 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char do_narrow(char_type __c, char __dfault) const = 0; # 581 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const = 0; }; # 604 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<typename _CharT> class ctype : public __ctype_abstract_base<_CharT> { public: typedef _CharT char_type; typedef typename __ctype_abstract_base<_CharT>::mask mask; static locale::id id; explicit ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { } protected: virtual ~ctype(); virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; virtual const char_type* do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const; virtual char_type do_toupper(char_type __c) const; virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const; virtual char_type do_tolower(char_type __c) const; virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const; virtual char_type do_widen(char __c) const; virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __dest) const; virtual char do_narrow(char_type, char __dfault) const; virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const; }; template<typename _CharT> locale::id ctype<_CharT>::id; # 673 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<> class ctype<char> : public locale::facet, public ctype_base { public: typedef char char_type; protected: __c_locale _M_c_locale_ctype; bool _M_del; __to_type _M_toupper; __to_type _M_tolower; const mask* _M_table; mutable char _M_widen_ok; mutable char _M_widen[1 + static_cast<unsigned char>(-1)]; mutable char _M_narrow[1 + static_cast<unsigned char>(-1)]; mutable char _M_narrow_ok; public: static locale::id id; static const size_t table_size = 1 + static_cast<unsigned char>(-1); # 710 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); # 723 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, size_t __refs = 0); # 736 "/usr/include/c++/4.8/bits/locale_facets.h" 3 inline bool is(mask __m, char __c) const; # 751 "/usr/include/c++/4.8/bits/locale_facets.h" 3 inline const char* is(const char* __lo, const char* __hi, mask* __vec) const; # 765 "/usr/include/c++/4.8/bits/locale_facets.h" 3 inline const char* scan_is(mask __m, const char* __lo, const char* __hi) const; # 779 "/usr/include/c++/4.8/bits/locale_facets.h" 3 inline const char* scan_not(mask __m, const char* __lo, const char* __hi) const; # 794 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type toupper(char_type __c) const { return this->do_toupper(__c); } # 811 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* toupper(char_type *__lo, const char_type* __hi) const { return this->do_toupper(__lo, __hi); } # 827 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type tolower(char_type __c) const { return this->do_tolower(__c); } # 844 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* tolower(char_type* __lo, const char_type* __hi) const { return this->do_tolower(__lo, __hi); } # 864 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type widen(char __c) const { if (_M_widen_ok) return _M_widen[static_cast<unsigned char>(__c)]; this->_M_widen_init(); return this->do_widen(__c); } # 891 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char* widen(const char* __lo, const char* __hi, char_type* __to) const { if (_M_widen_ok == 1) { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } if (!_M_widen_ok) _M_widen_init(); return this->do_widen(__lo, __hi, __to); } # 922 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char narrow(char_type __c, char __dfault) const { if (_M_narrow[static_cast<unsigned char>(__c)]) return _M_narrow[static_cast<unsigned char>(__c)]; const char __t = do_narrow(__c, __dfault); if (__t != __dfault) _M_narrow[static_cast<unsigned char>(__c)] = __t; return __t; } # 955 "/usr/include/c++/4.8/bits/locale_facets.h" 3 const char_type* narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const { if (__builtin_expect(_M_narrow_ok == 1, true)) { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } if (!_M_narrow_ok) _M_narrow_init(); return this->do_narrow(__lo, __hi, __dfault, __to); } const mask* table() const throw() { return _M_table; } static const mask* classic_table() throw(); protected: virtual ~ctype(); # 1004 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_toupper(char_type __c) const; # 1021 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const; # 1037 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_tolower(char_type __c) const; # 1054 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const; # 1074 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_widen(char __c) const { return __c; } # 1097 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __to) const { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } # 1123 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char do_narrow(char_type __c, char __dfault) const { return __c; } # 1149 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } private: void _M_narrow_init() const; void _M_widen_init() const; }; # 1174 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<> class ctype<wchar_t> : public __ctype_abstract_base<wchar_t> { public: typedef wchar_t char_type; typedef wctype_t __wmask_type; protected: __c_locale _M_c_locale_ctype; bool _M_narrow_ok; char _M_narrow[128]; wint_t _M_widen[1 + static_cast<unsigned char>(-1)]; mask _M_bit[16]; __wmask_type _M_wmask[16]; public: static locale::id id; # 1207 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit ctype(size_t __refs = 0); # 1218 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit ctype(__c_locale __cloc, size_t __refs = 0); protected: __wmask_type _M_convert_to_wmask(const mask __m) const throw(); virtual ~ctype(); # 1242 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual bool do_is(mask __m, char_type __c) const; # 1261 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; # 1279 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; # 1297 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const; # 1314 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_toupper(char_type __c) const; # 1331 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const; # 1347 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_tolower(char_type __c) const; # 1364 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const; # 1384 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_widen(char __c) const; # 1406 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __to) const; # 1429 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char do_narrow(char_type __c, char __dfault) const; # 1455 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const; void _M_initialize_ctype() throw(); }; template<typename _CharT> class ctype_byname : public ctype<_CharT> { public: typedef typename ctype<_CharT>::mask mask; explicit ctype_byname(const char* __s, size_t __refs = 0); protected: virtual ~ctype_byname() { }; }; template<> class ctype_byname<char> : public ctype<char> { public: explicit ctype_byname(const char* __s, size_t __refs = 0); protected: virtual ~ctype_byname(); }; template<> class ctype_byname<wchar_t> : public ctype<wchar_t> { public: explicit ctype_byname(const char* __s, size_t __refs = 0); protected: virtual ~ctype_byname(); }; } # 1 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/ctype_inline.h" 1 3 # 37 "/usr/include/x86_64-linux-gnu/c++/4.8/bits/ctype_inline.h" 3 namespace std __attribute__ ((__visibility__ ("default"))) { bool ctype<char>:: is(mask __m, char __c) const { return _M_table[static_cast<unsigned char>(__c)] & __m; } const char* ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { while (__low < __high) *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; return __high; } const char* ctype<char>:: scan_is(mask __m, const char* __low, const char* __high) const { while (__low < __high && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++__low; return __low; } const char* ctype<char>:: scan_not(mask __m, const char* __low, const char* __high) const { while (__low < __high && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++__low; return __low; } } # 1512 "/usr/include/c++/4.8/bits/locale_facets.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { class __num_base { public: enum { _S_ominus, _S_oplus, _S_ox, _S_oX, _S_odigits, _S_odigits_end = _S_odigits + 16, _S_oudigits = _S_odigits_end, _S_oudigits_end = _S_oudigits + 16, _S_oe = _S_odigits + 14, _S_oE = _S_oudigits + 14, _S_oend = _S_oudigits_end }; static const char* _S_atoms_out; static const char* _S_atoms_in; enum { _S_iminus, _S_iplus, _S_ix, _S_iX, _S_izero, _S_ie = _S_izero + 14, _S_iE = _S_izero + 20, _S_iend = 26 }; static void _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw(); }; template<typename _CharT> struct __numpunct_cache : public locale::facet { const char* _M_grouping; size_t _M_grouping_size; bool _M_use_grouping; const _CharT* _M_truename; size_t _M_truename_size; const _CharT* _M_falsename; size_t _M_falsename_size; _CharT _M_decimal_point; _CharT _M_thousands_sep; _CharT _M_atoms_out[__num_base::_S_oend]; _CharT _M_atoms_in[__num_base::_S_iend]; bool _M_allocated; __numpunct_cache(size_t __refs = 0) : facet(__refs), _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false), _M_truename(0), _M_truename_size(0), _M_falsename(0), _M_falsename_size(0), _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()), _M_allocated(false) { } ~__numpunct_cache(); void _M_cache(const locale& __loc); private: __numpunct_cache& operator=(const __numpunct_cache&); explicit __numpunct_cache(const __numpunct_cache&); }; template<typename _CharT> __numpunct_cache<_CharT>::~__numpunct_cache() { if (_M_allocated) { delete [] _M_grouping; delete [] _M_truename; delete [] _M_falsename; } } # 1640 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<typename _CharT> class numpunct : public locale::facet { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; typedef __numpunct_cache<_CharT> __cache_type; protected: __cache_type* _M_data; public: static locale::id id; explicit numpunct(size_t __refs = 0) : facet(__refs), _M_data(0) { _M_initialize_numpunct(); } # 1678 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit numpunct(__cache_type* __cache, size_t __refs = 0) : facet(__refs), _M_data(__cache) { _M_initialize_numpunct(); } # 1692 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit numpunct(__c_locale __cloc, size_t __refs = 0) : facet(__refs), _M_data(0) { _M_initialize_numpunct(__cloc); } # 1706 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type decimal_point() const { return this->do_decimal_point(); } # 1719 "/usr/include/c++/4.8/bits/locale_facets.h" 3 char_type thousands_sep() const { return this->do_thousands_sep(); } # 1750 "/usr/include/c++/4.8/bits/locale_facets.h" 3 string grouping() const { return this->do_grouping(); } # 1763 "/usr/include/c++/4.8/bits/locale_facets.h" 3 string_type truename() const { return this->do_truename(); } # 1776 "/usr/include/c++/4.8/bits/locale_facets.h" 3 string_type falsename() const { return this->do_falsename(); } protected: virtual ~numpunct(); # 1793 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_decimal_point() const { return _M_data->_M_decimal_point; } # 1805 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual char_type do_thousands_sep() const { return _M_data->_M_thousands_sep; } # 1818 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual string do_grouping() const { return _M_data->_M_grouping; } # 1831 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual string_type do_truename() const { return _M_data->_M_truename; } # 1844 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual string_type do_falsename() const { return _M_data->_M_falsename; } void _M_initialize_numpunct(__c_locale __cloc = 0); }; template<typename _CharT> locale::id numpunct<_CharT>::id; template<> numpunct<char>::~numpunct(); template<> void numpunct<char>::_M_initialize_numpunct(__c_locale __cloc); template<> numpunct<wchar_t>::~numpunct(); template<> void numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc); template<typename _CharT> class numpunct_byname : public numpunct<_CharT> { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; explicit numpunct_byname(const char* __s, size_t __refs = 0) : numpunct<_CharT>(__refs) { if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { __c_locale __tmp; this->_S_create_c_locale(__tmp, __s); this->_M_initialize_numpunct(__tmp); this->_S_destroy_c_locale(__tmp); } } protected: virtual ~numpunct_byname() { } }; # 1914 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<typename _CharT, typename _InIter> class num_get : public locale::facet { public: typedef _CharT char_type; typedef _InIter iter_type; static locale::id id; # 1935 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit num_get(size_t __refs = 0) : facet(__refs) { } # 1961 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, bool& __v) const { return this->do_get(__in, __end, __io, __err, __v); } # 1998 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned short& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned int& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } # 2058 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, float& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, double& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long double& __v) const { return this->do_get(__in, __end, __io, __err, __v); } # 2101 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, void*& __v) const { return this->do_get(__in, __end, __io, __err, __v); } protected: virtual ~num_get() { } iter_type _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, string&) const; template<typename _ValueT> iter_type _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, _ValueT&) const; template<typename _CharT2> typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type _M_find(const _CharT2*, size_t __len, _CharT2 __c) const { int __ret = -1; if (__len <= 10) { if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len)) __ret = __c - _CharT2('0'); } else { if (__c >= _CharT2('0') && __c <= _CharT2('9')) __ret = __c - _CharT2('0'); else if (__c >= _CharT2('a') && __c <= _CharT2('f')) __ret = 10 + (__c - _CharT2('a')); else if (__c >= _CharT2('A') && __c <= _CharT2('F')) __ret = 10 + (__c - _CharT2('A')); } return __ret; } template<typename _CharT2> typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value, int>::__type _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const { int __ret = -1; const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c); if (__q) { __ret = __q - __zero; if (__ret > 15) __ret -= 6; } return __ret; } # 2172 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned short& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned int& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, long long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, float&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, double&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long double&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const; # 2235 "/usr/include/c++/4.8/bits/locale_facets.h" 3 }; template<typename _CharT, typename _InIter> locale::id num_get<_CharT, _InIter>::id; # 2253 "/usr/include/c++/4.8/bits/locale_facets.h" 3 template<typename _CharT, typename _OutIter> class num_put : public locale::facet { public: typedef _CharT char_type; typedef _OutIter iter_type; static locale::id id; # 2274 "/usr/include/c++/4.8/bits/locale_facets.h" 3 explicit num_put(size_t __refs = 0) : facet(__refs) { } # 2292 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const { return this->do_put(__s, __io, __fill, __v); } # 2334 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type put(iter_type __s, ios_base& __io, char_type __fill, long __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, unsigned long __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, unsigned long long __v) const { return this->do_put(__s, __io, __fill, __v); } # 2397 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type put(iter_type __s, ios_base& __io, char_type __fill, double __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, long double __v) const { return this->do_put(__s, __io, __fill, __v); } # 2422 "/usr/include/c++/4.8/bits/locale_facets.h" 3 iter_type put(iter_type __s, ios_base& __io, char_type __fill, const void* __v) const { return this->do_put(__s, __io, __fill, __v); } protected: template<typename _ValueT> iter_type _M_insert_float(iter_type, ios_base& __io, char_type __fill, char __mod, _ValueT __v) const; void _M_group_float(const char* __grouping, size_t __grouping_size, char_type __sep, const char_type* __p, char_type* __new, char_type* __cs, int& __len) const; template<typename _ValueT> iter_type _M_insert_int(iter_type, ios_base& __io, char_type __fill, _ValueT __v) const; void _M_group_int(const char* __grouping, size_t __grouping_size, char_type __sep, ios_base& __io, char_type* __new, char_type* __cs, int& __len) const; void _M_pad(char_type __fill, streamsize __w, ios_base& __io, char_type* __new, const char_type* __cs, int& __len) const; virtual ~num_put() { }; # 2470 "/usr/include/c++/4.8/bits/locale_facets.h" 3 virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const; virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const { return _M_insert_int(__s, __io, __fill, __v); } virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, unsigned long __v) const { return _M_insert_int(__s, __io, __fill, __v); } virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const { return _M_insert_int(__s, __io, __fill, __v); } virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, unsigned long long __v) const { return _M_insert_int(__s, __io, __fill, __v); } virtual iter_type do_put(iter_type, ios_base&, char_type, double) const; virtual iter_type do_put(iter_type, ios_base&, char_type, long double) const; virtual iter_type do_put(iter_type, ios_base&, char_type, const void*) const; }; template <typename _CharT, typename _OutIter> locale::id num_put<_CharT, _OutIter>::id; template<typename _CharT> inline bool isspace(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); } template<typename _CharT> inline bool isprint(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); } template<typename _CharT> inline bool iscntrl(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); } template<typename _CharT> inline bool isupper(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); } template<typename _CharT> inline bool islower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); } template<typename _CharT> inline bool isalpha(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); } template<typename _CharT> inline bool isdigit(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); } template<typename _CharT> inline bool ispunct(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); } template<typename _CharT> inline bool isxdigit(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); } template<typename _CharT> inline bool isalnum(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); } template<typename _CharT> inline bool isgraph(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); } template<typename _CharT> inline _CharT toupper(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).toupper(__c); } template<typename _CharT> inline _CharT tolower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).tolower(__c); } } # 1 "/usr/include/c++/4.8/bits/locale_facets.tcc" 1 3 # 33 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 # 34 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _Facet> struct __use_cache { const _Facet* operator() (const locale& __loc) const; }; template<typename _CharT> struct __use_cache<__numpunct_cache<_CharT> > { const __numpunct_cache<_CharT>* operator() (const locale& __loc) const { const size_t __i = numpunct<_CharT>::id._M_id(); const locale::facet** __caches = __loc._M_impl->_M_caches; if (!__caches[__i]) { __numpunct_cache<_CharT>* __tmp = 0; try { __tmp = new __numpunct_cache<_CharT>; __tmp->_M_cache(__loc); } catch(...) { delete __tmp; throw; } __loc._M_impl->_M_install_cache(__tmp, __i); } return static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]); } }; template<typename _CharT> void __numpunct_cache<_CharT>::_M_cache(const locale& __loc) { _M_allocated = true; const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); char* __grouping = 0; _CharT* __truename = 0; _CharT* __falsename = 0; try { _M_grouping_size = __np.grouping().size(); __grouping = new char[_M_grouping_size]; __np.grouping().copy(__grouping, _M_grouping_size); _M_grouping = __grouping; _M_use_grouping = (_M_grouping_size && static_cast<signed char>(_M_grouping[0]) > 0 && (_M_grouping[0] != __gnu_cxx::__numeric_traits<char>::__max)); _M_truename_size = __np.truename().size(); __truename = new _CharT[_M_truename_size]; __np.truename().copy(__truename, _M_truename_size); _M_truename = __truename; _M_falsename_size = __np.falsename().size(); __falsename = new _CharT[_M_falsename_size]; __np.falsename().copy(__falsename, _M_falsename_size); _M_falsename = __falsename; _M_decimal_point = __np.decimal_point(); _M_thousands_sep = __np.thousands_sep(); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc); __ct.widen(__num_base::_S_atoms_out, __num_base::_S_atoms_out + __num_base::_S_oend, _M_atoms_out); __ct.widen(__num_base::_S_atoms_in, __num_base::_S_atoms_in + __num_base::_S_iend, _M_atoms_in); } catch(...) { delete [] __grouping; delete [] __truename; delete [] __falsename; throw; } } # 136 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 __attribute__ ((__pure__)) bool __verify_grouping(const char* __grouping, size_t __grouping_size, const string& __grouping_tmp) throw (); template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, string& __xtrc) const { typedef char_traits<_CharT> __traits_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __lit = __lc->_M_atoms_in; char_type __c = char_type(); bool __testeof = __beg == __end; if (!__testeof) { __c = *__beg; const bool __plus = __c == __lit[__num_base::_S_iplus]; if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) { __xtrc += __plus ? '+' : '-'; if (++__beg != __end) __c = *__beg; else __testeof = true; } } bool __found_mantissa = false; int __sep_pos = 0; while (!__testeof) { if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) || __c == __lc->_M_decimal_point) break; else if (__c == __lit[__num_base::_S_izero]) { if (!__found_mantissa) { __xtrc += '0'; __found_mantissa = true; } ++__sep_pos; if (++__beg != __end) __c = *__beg; else __testeof = true; } else break; } bool __found_dec = false; bool __found_sci = false; string __found_grouping; if (__lc->_M_use_grouping) __found_grouping.reserve(32); const char_type* __lit_zero = __lit + __num_base::_S_izero; if (!__lc->_M_allocated) while (!__testeof) { const int __digit = _M_find(__lit_zero, 10, __c); if (__digit != -1) { __xtrc += '0' + __digit; __found_mantissa = true; } else if (__c == __lc->_M_decimal_point && !__found_dec && !__found_sci) { __xtrc += '.'; __found_dec = true; } else if ((__c == __lit[__num_base::_S_ie] || __c == __lit[__num_base::_S_iE]) && !__found_sci && __found_mantissa) { __xtrc += 'e'; __found_sci = true; if (++__beg != __end) { __c = *__beg; const bool __plus = __c == __lit[__num_base::_S_iplus]; if (__plus || __c == __lit[__num_base::_S_iminus]) __xtrc += __plus ? '+' : '-'; else continue; } else { __testeof = true; break; } } else break; if (++__beg != __end) __c = *__beg; else __testeof = true; } else while (!__testeof) { if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) { if (!__found_dec && !__found_sci) { if (__sep_pos) { __found_grouping += static_cast<char>(__sep_pos); __sep_pos = 0; } else { __xtrc.clear(); break; } } else break; } else if (__c == __lc->_M_decimal_point) { if (!__found_dec && !__found_sci) { if (__found_grouping.size()) __found_grouping += static_cast<char>(__sep_pos); __xtrc += '.'; __found_dec = true; } else break; } else { const char_type* __q = __traits_type::find(__lit_zero, 10, __c); if (__q) { __xtrc += '0' + (__q - __lit_zero); __found_mantissa = true; ++__sep_pos; } else if ((__c == __lit[__num_base::_S_ie] || __c == __lit[__num_base::_S_iE]) && !__found_sci && __found_mantissa) { if (__found_grouping.size() && !__found_dec) __found_grouping += static_cast<char>(__sep_pos); __xtrc += 'e'; __found_sci = true; if (++__beg != __end) { __c = *__beg; const bool __plus = __c == __lit[__num_base::_S_iplus]; if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) __xtrc += __plus ? '+' : '-'; else continue; } else { __testeof = true; break; } } else break; } if (++__beg != __end) __c = *__beg; else __testeof = true; } if (__found_grouping.size()) { if (!__found_dec && !__found_sci) __found_grouping += static_cast<char>(__sep_pos); if (!std::__verify_grouping(__lc->_M_grouping, __lc->_M_grouping_size, __found_grouping)) __err = ios_base::failbit; } return __beg; } template<typename _CharT, typename _InIter> template<typename _ValueT> _InIter num_get<_CharT, _InIter>:: _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, _ValueT& __v) const { typedef char_traits<_CharT> __traits_type; using __gnu_cxx::__add_unsigned; typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __lit = __lc->_M_atoms_in; char_type __c = char_type(); const ios_base::fmtflags __basefield = __io.flags() & ios_base::basefield; const bool __oct = __basefield == ios_base::oct; int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10); bool __testeof = __beg == __end; bool __negative = false; if (!__testeof) { __c = *__beg; __negative = __c == __lit[__num_base::_S_iminus]; if ((__negative || __c == __lit[__num_base::_S_iplus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) { if (++__beg != __end) __c = *__beg; else __testeof = true; } } bool __found_zero = false; int __sep_pos = 0; while (!__testeof) { if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) || __c == __lc->_M_decimal_point) break; else if (__c == __lit[__num_base::_S_izero] && (!__found_zero || __base == 10)) { __found_zero = true; ++__sep_pos; if (__basefield == 0) __base = 8; if (__base == 8) __sep_pos = 0; } else if (__found_zero && (__c == __lit[__num_base::_S_ix] || __c == __lit[__num_base::_S_iX])) { if (__basefield == 0) __base = 16; if (__base == 16) { __found_zero = false; __sep_pos = 0; } else break; } else break; if (++__beg != __end) { __c = *__beg; if (!__found_zero) break; } else __testeof = true; } const size_t __len = (__base == 16 ? __num_base::_S_iend - __num_base::_S_izero : __base); string __found_grouping; if (__lc->_M_use_grouping) __found_grouping.reserve(32); bool __testfail = false; bool __testoverflow = false; const __unsigned_type __max = (__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) ? -__gnu_cxx::__numeric_traits<_ValueT>::__min : __gnu_cxx::__numeric_traits<_ValueT>::__max; const __unsigned_type __smax = __max / __base; __unsigned_type __result = 0; int __digit = 0; const char_type* __lit_zero = __lit + __num_base::_S_izero; if (!__lc->_M_allocated) while (!__testeof) { __digit = _M_find(__lit_zero, __len, __c); if (__digit == -1) break; if (__result > __smax) __testoverflow = true; else { __result *= __base; __testoverflow |= __result > __max - __digit; __result += __digit; ++__sep_pos; } if (++__beg != __end) __c = *__beg; else __testeof = true; } else while (!__testeof) { if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) { if (__sep_pos) { __found_grouping += static_cast<char>(__sep_pos); __sep_pos = 0; } else { __testfail = true; break; } } else if (__c == __lc->_M_decimal_point) break; else { const char_type* __q = __traits_type::find(__lit_zero, __len, __c); if (!__q) break; __digit = __q - __lit_zero; if (__digit > 15) __digit -= 6; if (__result > __smax) __testoverflow = true; else { __result *= __base; __testoverflow |= __result > __max - __digit; __result += __digit; ++__sep_pos; } } if (++__beg != __end) __c = *__beg; else __testeof = true; } if (__found_grouping.size()) { __found_grouping += static_cast<char>(__sep_pos); if (!std::__verify_grouping(__lc->_M_grouping, __lc->_M_grouping_size, __found_grouping)) __err = ios_base::failbit; } if ((!__sep_pos && !__found_zero && !__found_grouping.size()) || __testfail) { __v = 0; __err = ios_base::failbit; } else if (__testoverflow) { if (__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) __v = __gnu_cxx::__numeric_traits<_ValueT>::__min; else __v = __gnu_cxx::__numeric_traits<_ValueT>::__max; __err = ios_base::failbit; } else __v = __negative ? -__result : __result; if (__testeof) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, bool& __v) const { if (!(__io.flags() & ios_base::boolalpha)) { long __l = -1; __beg = _M_extract_int(__beg, __end, __io, __err, __l); if (__l == 0 || __l == 1) __v = bool(__l); else { __v = true; __err = ios_base::failbit; if (__beg == __end) __err |= ios_base::eofbit; } } else { typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); bool __testf = true; bool __testt = true; bool __donef = __lc->_M_falsename_size == 0; bool __donet = __lc->_M_truename_size == 0; bool __testeof = false; size_t __n = 0; while (!__donef || !__donet) { if (__beg == __end) { __testeof = true; break; } const char_type __c = *__beg; if (!__donef) __testf = __c == __lc->_M_falsename[__n]; if (!__testf && __donet) break; if (!__donet) __testt = __c == __lc->_M_truename[__n]; if (!__testt && __donef) break; if (!__testt && !__testf) break; ++__n; ++__beg; __donef = !__testf || __n >= __lc->_M_falsename_size; __donet = !__testt || __n >= __lc->_M_truename_size; } if (__testf && __n == __lc->_M_falsename_size && __n) { __v = false; if (__testt && __n == __lc->_M_truename_size) __err = ios_base::failbit; else __err = __testeof ? ios_base::eofbit : ios_base::goodbit; } else if (__testt && __n == __lc->_M_truename_size && __n) { __v = true; __err = __testeof ? ios_base::eofbit : ios_base::goodbit; } else { __v = false; __err = ios_base::failbit; if (__testeof) __err |= ios_base::eofbit; } } return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, float& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, double& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } # 730 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, long double& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, void*& __v) const { typedef ios_base::fmtflags fmtflags; const fmtflags __fmt = __io.flags(); __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex); typedef __gnu_cxx::__conditional_type<(sizeof(void*) <= sizeof(unsigned long)), unsigned long, unsigned long long>::__type _UIntPtrType; _UIntPtrType __ul; __beg = _M_extract_int(__beg, __end, __io, __err, __ul); __io.flags(__fmt); __v = reinterpret_cast<void*>(__ul); return __beg; } template<typename _CharT, typename _OutIter> void num_put<_CharT, _OutIter>:: _M_pad(_CharT __fill, streamsize __w, ios_base& __io, _CharT* __new, const _CharT* __cs, int& __len) const { __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new, __cs, __w, __len); __len = static_cast<int>(__w); } template<typename _CharT, typename _ValueT> int __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit, ios_base::fmtflags __flags, bool __dec) { _CharT* __buf = __bufend; if (__builtin_expect(__dec, true)) { do { *--__buf = __lit[(__v % 10) + __num_base::_S_odigits]; __v /= 10; } while (__v != 0); } else if ((__flags & ios_base::basefield) == ios_base::oct) { do { *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits]; __v >>= 3; } while (__v != 0); } else { const bool __uppercase = __flags & ios_base::uppercase; const int __case_offset = __uppercase ? __num_base::_S_oudigits : __num_base::_S_odigits; do { *--__buf = __lit[(__v & 0xf) + __case_offset]; __v >>= 4; } while (__v != 0); } return __bufend - __buf; } template<typename _CharT, typename _OutIter> void num_put<_CharT, _OutIter>:: _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep, ios_base&, _CharT* __new, _CharT* __cs, int& __len) const { _CharT* __p = std::__add_grouping(__new, __sep, __grouping, __grouping_size, __cs, __cs + __len); __len = __p - __new; } template<typename _CharT, typename _OutIter> template<typename _ValueT> _OutIter num_put<_CharT, _OutIter>:: _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill, _ValueT __v) const { using __gnu_cxx::__add_unsigned; typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __lit = __lc->_M_atoms_out; const ios_base::fmtflags __flags = __io.flags(); const int __ilen = 5 * sizeof(_ValueT); _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __ilen)); const ios_base::fmtflags __basefield = __flags & ios_base::basefield; const bool __dec = (__basefield != ios_base::oct && __basefield != ios_base::hex); const __unsigned_type __u = ((__v > 0 || !__dec) ? __unsigned_type(__v) : -__unsigned_type(__v)); int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec); __cs += __ilen - __len; if (__lc->_M_use_grouping) { _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * (__len + 1) * 2)); _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size, __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len); __cs = __cs2 + 2; } if (__builtin_expect(__dec, true)) { if (__v >= 0) { if (bool(__flags & ios_base::showpos) && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) *--__cs = __lit[__num_base::_S_oplus], ++__len; } else *--__cs = __lit[__num_base::_S_ominus], ++__len; } else if (bool(__flags & ios_base::showbase) && __v) { if (__basefield == ios_base::oct) *--__cs = __lit[__num_base::_S_odigits], ++__len; else { const bool __uppercase = __flags & ios_base::uppercase; *--__cs = __lit[__num_base::_S_ox + __uppercase]; *--__cs = __lit[__num_base::_S_odigits]; __len += 2; } } const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); _M_pad(__fill, __w, __io, __cs3, __cs, __len); __cs = __cs3; } __io.width(0); return std::__write(__s, __cs, __len); } template<typename _CharT, typename _OutIter> void num_put<_CharT, _OutIter>:: _M_group_float(const char* __grouping, size_t __grouping_size, _CharT __sep, const _CharT* __p, _CharT* __new, _CharT* __cs, int& __len) const { const int __declen = __p ? __p - __cs : __len; _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping, __grouping_size, __cs, __cs + __declen); int __newlen = __p2 - __new; if (__p) { char_traits<_CharT>::copy(__p2, __p, __len - __declen); __newlen += __len - __declen; } __len = __newlen; } # 966 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 template<typename _CharT, typename _OutIter> template<typename _ValueT> _OutIter num_put<_CharT, _OutIter>:: _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod, _ValueT __v) const { typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision(); const int __max_digits = __gnu_cxx::__numeric_traits<_ValueT>::__digits10; int __len; char __fbuf[16]; __num_base::_S_format_float(__io, __fbuf, __mod); int __cs_size = __max_digits * 3; char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf, __prec, __v); if (__len >= __cs_size) { __cs_size = __len + 1; __cs = static_cast<char*>(__builtin_alloca(__cs_size)); __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf, __prec, __v); } # 1027 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len)); __ctype.widen(__cs, __cs + __len, __ws); _CharT* __wp = 0; const char* __p = char_traits<char>::find(__cs, __len, '.'); if (__p) { __wp = __ws + (__p - __cs); *__wp = __lc->_M_decimal_point; } if (__lc->_M_use_grouping && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9' && __cs[1] >= '0' && __cs[2] >= '0'))) { _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len * 2)); streamsize __off = 0; if (__cs[0] == '-' || __cs[0] == '+') { __off = 1; __ws2[0] = __ws[0]; __len -= 1; } _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size, __lc->_M_thousands_sep, __wp, __ws2 + __off, __ws + __off, __len); __len += __off; __ws = __ws2; } const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); _M_pad(__fill, __w, __io, __ws3, __ws, __len); __ws = __ws3; } __io.width(0); return std::__write(__s, __ws, __len); } template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const { const ios_base::fmtflags __flags = __io.flags(); if ((__flags & ios_base::boolalpha) == 0) { const long __l = __v; __s = _M_insert_int(__s, __io, __fill, __l); } else { typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __name = __v ? __lc->_M_truename : __lc->_M_falsename; int __len = __v ? __lc->_M_truename_size : __lc->_M_falsename_size; const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { const streamsize __plen = __w - __len; _CharT* __ps = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __plen)); char_traits<_CharT>::assign(__ps, __plen, __fill); __io.width(0); if ((__flags & ios_base::adjustfield) == ios_base::left) { __s = std::__write(__s, __name, __len); __s = std::__write(__s, __ps, __plen); } else { __s = std::__write(__s, __ps, __plen); __s = std::__write(__s, __name, __len); } return __s; } __io.width(0); __s = std::__write(__s, __name, __len); } return __s; } template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const { return _M_insert_float(__s, __io, __fill, char(), __v); } # 1152 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, long double __v) const { return _M_insert_float(__s, __io, __fill, 'L', __v); } template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, const void* __v) const { const ios_base::fmtflags __flags = __io.flags(); const ios_base::fmtflags __fmt = ~(ios_base::basefield | ios_base::uppercase); __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase)); typedef __gnu_cxx::__conditional_type<(sizeof(const void*) <= sizeof(unsigned long)), unsigned long, unsigned long long>::__type _UIntPtrType; __s = _M_insert_int(__s, __io, __fill, reinterpret_cast<_UIntPtrType>(__v)); __io.flags(__flags); return __s; } # 1189 "/usr/include/c++/4.8/bits/locale_facets.tcc" 3 template<typename _CharT, typename _Traits> void __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill, _CharT* __news, const _CharT* __olds, streamsize __newlen, streamsize __oldlen) { const size_t __plen = static_cast<size_t>(__newlen - __oldlen); const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield; if (__adjust == ios_base::left) { _Traits::copy(__news, __olds, __oldlen); _Traits::assign(__news + __oldlen, __plen, __fill); return; } size_t __mod = 0; if (__adjust == ios_base::internal) { const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); if (__ctype.widen('-') == __olds[0] || __ctype.widen('+') == __olds[0]) { __news[0] = __olds[0]; __mod = 1; ++__news; } else if (__ctype.widen('0') == __olds[0] && __oldlen > 1 && (__ctype.widen('x') == __olds[1] || __ctype.widen('X') == __olds[1])) { __news[0] = __olds[0]; __news[1] = __olds[1]; __mod = 2; __news += 2; } } _Traits::assign(__news, __plen, __fill); _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod); } template<typename _CharT> _CharT* __add_grouping(_CharT* __s, _CharT __sep, const char* __gbeg, size_t __gsize, const _CharT* __first, const _CharT* __last) { size_t __idx = 0; size_t __ctr = 0; while (__last - __first > __gbeg[__idx] && static_cast<signed char>(__gbeg[__idx]) > 0 && __gbeg[__idx] != __gnu_cxx::__numeric_traits<char>::__max) { __last -= __gbeg[__idx]; __idx < __gsize - 1 ? ++__idx : ++__ctr; } while (__first != __last) *__s++ = *__first++; while (__ctr--) { *__s++ = __sep; for (char __i = __gbeg[__idx]; __i > 0; --__i) *__s++ = *__first++; } while (__idx--) { *__s++ = __sep; for (char __i = __gbeg[__idx]; __i > 0; --__i) *__s++ = *__first++; } return __s; } extern template class numpunct<char>; extern template class numpunct_byname<char>; extern template class num_get<char>; extern template class num_put<char>; extern template class ctype_byname<char>; extern template const ctype<char>& use_facet<ctype<char> >(const locale&); extern template const numpunct<char>& use_facet<numpunct<char> >(const locale&); extern template const num_put<char>& use_facet<num_put<char> >(const locale&); extern template const num_get<char>& use_facet<num_get<char> >(const locale&); extern template bool has_facet<ctype<char> >(const locale&); extern template bool has_facet<numpunct<char> >(const locale&); extern template bool has_facet<num_put<char> >(const locale&); extern template bool has_facet<num_get<char> >(const locale&); extern template class numpunct<wchar_t>; extern template class numpunct_byname<wchar_t>; extern template class num_get<wchar_t>; extern template class num_put<wchar_t>; extern template class ctype_byname<wchar_t>; extern template const ctype<wchar_t>& use_facet<ctype<wchar_t> >(const locale&); extern template const numpunct<wchar_t>& use_facet<numpunct<wchar_t> >(const locale&); extern template const num_put<wchar_t>& use_facet<num_put<wchar_t> >(const locale&); extern template const num_get<wchar_t>& use_facet<num_get<wchar_t> >(const locale&); extern template bool has_facet<ctype<wchar_t> >(const locale&); extern template bool has_facet<numpunct<wchar_t> >(const locale&); extern template bool has_facet<num_put<wchar_t> >(const locale&); extern template bool has_facet<num_get<wchar_t> >(const locale&); } # 2609 "/usr/include/c++/4.8/bits/locale_facets.h" 2 3 # 38 "/usr/include/c++/4.8/bits/basic_ios.h" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _Facet> inline const _Facet& __check_facet(const _Facet* __f) { if (!__f) __throw_bad_cast(); return *__f; } # 65 "/usr/include/c++/4.8/bits/basic_ios.h" 3 template<typename _CharT, typename _Traits> class basic_ios : public ios_base { public: typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; typedef ctype<_CharT> __ctype_type; typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > __num_put_type; typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > __num_get_type; protected: basic_ostream<_CharT, _Traits>* _M_tie; mutable char_type _M_fill; mutable bool _M_fill_init; basic_streambuf<_CharT, _Traits>* _M_streambuf; const __ctype_type* _M_ctype; const __num_put_type* _M_num_put; const __num_get_type* _M_num_get; public: operator void*() const { return this->fail() ? 0 : const_cast<basic_ios*>(this); } bool operator!() const { return this->fail(); } # 130 "/usr/include/c++/4.8/bits/basic_ios.h" 3 iostate rdstate() const { return _M_streambuf_state; } # 141 "/usr/include/c++/4.8/bits/basic_ios.h" 3 void clear(iostate __state = goodbit); void setstate(iostate __state) { this->clear(this->rdstate() | __state); } void _M_setstate(iostate __state) { _M_streambuf_state |= __state; if (this->exceptions() & __state) throw; } bool good() const { return this->rdstate() == 0; } bool eof() const { return (this->rdstate() & eofbit) != 0; } # 194 "/usr/include/c++/4.8/bits/basic_ios.h" 3 bool fail() const { return (this->rdstate() & (badbit | failbit)) != 0; } bool bad() const { return (this->rdstate() & badbit) != 0; } # 215 "/usr/include/c++/4.8/bits/basic_ios.h" 3 iostate exceptions() const { return _M_exception; } # 250 "/usr/include/c++/4.8/bits/basic_ios.h" 3 void exceptions(iostate __except) { _M_exception = __except; this->clear(_M_streambuf_state); } explicit basic_ios(basic_streambuf<_CharT, _Traits>* __sb) : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) { this->init(__sb); } virtual ~basic_ios() { } # 288 "/usr/include/c++/4.8/bits/basic_ios.h" 3 basic_ostream<_CharT, _Traits>* tie() const { return _M_tie; } # 300 "/usr/include/c++/4.8/bits/basic_ios.h" 3 basic_ostream<_CharT, _Traits>* tie(basic_ostream<_CharT, _Traits>* __tiestr) { basic_ostream<_CharT, _Traits>* __old = _M_tie; _M_tie = __tiestr; return __old; } basic_streambuf<_CharT, _Traits>* rdbuf() const { return _M_streambuf; } # 340 "/usr/include/c++/4.8/bits/basic_ios.h" 3 basic_streambuf<_CharT, _Traits>* rdbuf(basic_streambuf<_CharT, _Traits>* __sb); # 354 "/usr/include/c++/4.8/bits/basic_ios.h" 3 basic_ios& copyfmt(const basic_ios& __rhs); char_type fill() const { if (!_M_fill_init) { _M_fill = this->widen(' '); _M_fill_init = true; } return _M_fill; } # 383 "/usr/include/c++/4.8/bits/basic_ios.h" 3 char_type fill(char_type __ch) { char_type __old = this->fill(); _M_fill = __ch; return __old; } # 403 "/usr/include/c++/4.8/bits/basic_ios.h" 3 locale imbue(const locale& __loc); # 423 "/usr/include/c++/4.8/bits/basic_ios.h" 3 char narrow(char_type __c, char __dfault) const { return __check_facet(_M_ctype).narrow(__c, __dfault); } # 442 "/usr/include/c++/4.8/bits/basic_ios.h" 3 char_type widen(char __c) const { return __check_facet(_M_ctype).widen(__c); } protected: basic_ios() : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) { } void init(basic_streambuf<_CharT, _Traits>* __sb); void _M_cache_locale(const locale& __loc); }; } # 1 "/usr/include/c++/4.8/bits/basic_ios.tcc" 1 3 # 33 "/usr/include/c++/4.8/bits/basic_ios.tcc" 3 # 34 "/usr/include/c++/4.8/bits/basic_ios.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _CharT, typename _Traits> void basic_ios<_CharT, _Traits>::clear(iostate __state) { if (this->rdbuf()) _M_streambuf_state = __state; else _M_streambuf_state = __state | badbit; if (this->exceptions() & this->rdstate()) __throw_ios_failure(("basic_ios::clear")); } template<typename _CharT, typename _Traits> basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb) { basic_streambuf<_CharT, _Traits>* __old = _M_streambuf; _M_streambuf = __sb; this->clear(); return __old; } template<typename _CharT, typename _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) { if (this != &__rhs) { _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ? _M_local_word : new _Words[__rhs._M_word_size]; _Callback_list* __cb = __rhs._M_callbacks; if (__cb) __cb->_M_add_reference(); _M_call_callbacks(erase_event); if (_M_word != _M_local_word) { delete [] _M_word; _M_word = 0; } _M_dispose_callbacks(); _M_callbacks = __cb; for (int __i = 0; __i < __rhs._M_word_size; ++__i) __words[__i] = __rhs._M_word[__i]; _M_word = __words; _M_word_size = __rhs._M_word_size; this->flags(__rhs.flags()); this->width(__rhs.width()); this->precision(__rhs.precision()); this->tie(__rhs.tie()); this->fill(__rhs.fill()); _M_ios_locale = __rhs.getloc(); _M_cache_locale(_M_ios_locale); _M_call_callbacks(copyfmt_event); this->exceptions(__rhs.exceptions()); } return *this; } template<typename _CharT, typename _Traits> locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { locale __old(this->getloc()); ios_base::imbue(__loc); _M_cache_locale(__loc); if (this->rdbuf() != 0) this->rdbuf()->pubimbue(__loc); return __old; } template<typename _CharT, typename _Traits> void basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) { ios_base::_M_init(); _M_cache_locale(_M_ios_locale); # 146 "/usr/include/c++/4.8/bits/basic_ios.tcc" 3 _M_fill = _CharT(); _M_fill_init = false; _M_tie = 0; _M_exception = goodbit; _M_streambuf = __sb; _M_streambuf_state = __sb ? goodbit : badbit; } template<typename _CharT, typename _Traits> void basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc) { if (__builtin_expect(has_facet<__ctype_type>(__loc), true)) _M_ctype = &use_facet<__ctype_type>(__loc); else _M_ctype = 0; if (__builtin_expect(has_facet<__num_put_type>(__loc), true)) _M_num_put = &use_facet<__num_put_type>(__loc); else _M_num_put = 0; if (__builtin_expect(has_facet<__num_get_type>(__loc), true)) _M_num_get = &use_facet<__num_get_type>(__loc); else _M_num_get = 0; } extern template class basic_ios<char>; extern template class basic_ios<wchar_t>; } # 476 "/usr/include/c++/4.8/bits/basic_ios.h" 2 3 # 45 "/usr/include/c++/4.8/ios" 2 3 # 39 "/usr/include/c++/4.8/ostream" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 57 "/usr/include/c++/4.8/ostream" 3 template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> { public: typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef basic_ios<_CharT, _Traits> __ios_type; typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > __num_put_type; typedef ctype<_CharT> __ctype_type; # 83 "/usr/include/c++/4.8/ostream" 3 explicit basic_ostream(__streambuf_type* __sb) { this->init(__sb); } virtual ~basic_ostream() { } class sentry; friend class sentry; # 107 "/usr/include/c++/4.8/ostream" 3 __ostream_type& operator<<(__ostream_type& (*__pf)(__ostream_type&)) { return __pf(*this); } __ostream_type& operator<<(__ios_type& (*__pf)(__ios_type&)) { __pf(*this); return *this; } __ostream_type& operator<<(ios_base& (*__pf) (ios_base&)) { __pf(*this); return *this; } # 165 "/usr/include/c++/4.8/ostream" 3 __ostream_type& operator<<(long __n) { return _M_insert(__n); } __ostream_type& operator<<(unsigned long __n) { return _M_insert(__n); } __ostream_type& operator<<(bool __n) { return _M_insert(__n); } __ostream_type& operator<<(short __n); __ostream_type& operator<<(unsigned short __n) { return _M_insert(static_cast<unsigned long>(__n)); } __ostream_type& operator<<(int __n); __ostream_type& operator<<(unsigned int __n) { return _M_insert(static_cast<unsigned long>(__n)); } __ostream_type& operator<<(long long __n) { return _M_insert(__n); } __ostream_type& operator<<(unsigned long long __n) { return _M_insert(__n); } # 219 "/usr/include/c++/4.8/ostream" 3 __ostream_type& operator<<(double __f) { return _M_insert(__f); } __ostream_type& operator<<(float __f) { return _M_insert(static_cast<double>(__f)); } __ostream_type& operator<<(long double __f) { return _M_insert(__f); } # 244 "/usr/include/c++/4.8/ostream" 3 __ostream_type& operator<<(const void* __p) { return _M_insert(__p); } # 269 "/usr/include/c++/4.8/ostream" 3 __ostream_type& operator<<(__streambuf_type* __sb); # 302 "/usr/include/c++/4.8/ostream" 3 __ostream_type& put(char_type __c); void _M_write(const char_type* __s, streamsize __n) { const streamsize __put = this->rdbuf()->sputn(__s, __n); if (__put != __n) this->setstate(ios_base::badbit); } # 334 "/usr/include/c++/4.8/ostream" 3 __ostream_type& write(const char_type* __s, streamsize __n); # 347 "/usr/include/c++/4.8/ostream" 3 __ostream_type& flush(); # 357 "/usr/include/c++/4.8/ostream" 3 pos_type tellp(); # 368 "/usr/include/c++/4.8/ostream" 3 __ostream_type& seekp(pos_type); # 380 "/usr/include/c++/4.8/ostream" 3 __ostream_type& seekp(off_type, ios_base::seekdir); protected: basic_ostream() { this->init(0); } template<typename _ValueT> __ostream_type& _M_insert(_ValueT __v); }; # 399 "/usr/include/c++/4.8/ostream" 3 template <typename _CharT, typename _Traits> class basic_ostream<_CharT, _Traits>::sentry { bool _M_ok; basic_ostream<_CharT, _Traits>& _M_os; public: # 418 "/usr/include/c++/4.8/ostream" 3 explicit sentry(basic_ostream<_CharT, _Traits>& __os); # 428 "/usr/include/c++/4.8/ostream" 3 ~sentry() { if (bool(_M_os.flags() & ios_base::unitbuf) && !uncaught_exception()) { if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1) _M_os.setstate(ios_base::badbit); } } # 449 "/usr/include/c++/4.8/ostream" 3 operator bool() const { return _M_ok; } }; # 469 "/usr/include/c++/4.8/ostream" 3 template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) { return __ostream_insert(__out, &__c, 1); } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) { return (__out << __out.widen(__c)); } template <class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, char __c) { return __ostream_insert(__out, &__c, 1); } template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, signed char __c) { return (__out << static_cast<char>(__c)); } template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) { return (__out << static_cast<char>(__c)); } # 511 "/usr/include/c++/4.8/ostream" 3 template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) { if (!__s) __out.setstate(ios_base::badbit); else __ostream_insert(__out, __s, static_cast<streamsize>(_Traits::length(__s))); return __out; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits> & operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s); template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, const char* __s) { if (!__s) __out.setstate(ios_base::badbit); else __ostream_insert(__out, __s, static_cast<streamsize>(_Traits::length(__s))); return __out; } template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) { return (__out << reinterpret_cast<const char*>(__s)); } template<class _Traits> inline basic_ostream<char, _Traits> & operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) { return (__out << reinterpret_cast<const char*>(__s)); } # 562 "/usr/include/c++/4.8/ostream" 3 template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { return flush(__os.put(__os.widen('\n'))); } # 574 "/usr/include/c++/4.8/ostream" 3 template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) { return __os.put(_CharT()); } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) { return __os.flush(); } # 609 "/usr/include/c++/4.8/ostream" 3 } # 1 "/usr/include/c++/4.8/bits/ostream.tcc" 1 3 # 37 "/usr/include/c++/4.8/bits/ostream.tcc" 3 # 38 "/usr/include/c++/4.8/bits/ostream.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>::sentry:: sentry(basic_ostream<_CharT, _Traits>& __os) : _M_ok(false), _M_os(__os) { if (__os.tie() && __os.good()) __os.tie()->flush(); if (__os.good()) _M_ok = true; else __os.setstate(ios_base::failbit); } template<typename _CharT, typename _Traits> template<typename _ValueT> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: _M_insert(_ValueT __v) { sentry __cerb(*this); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const __num_put_type& __np = __check_facet(this->_M_num_put); if (__np.put(*this, *this, this->fill(), __v).failed()) __err |= ios_base::badbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: operator<<(short __n) { const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; if (__fmt == ios_base::oct || __fmt == ios_base::hex) return _M_insert(static_cast<long>(static_cast<unsigned short>(__n))); else return _M_insert(static_cast<long>(__n)); } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: operator<<(int __n) { const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; if (__fmt == ios_base::oct || __fmt == ios_base::hex) return _M_insert(static_cast<long>(static_cast<unsigned int>(__n))); else return _M_insert(static_cast<long>(__n)); } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: operator<<(__streambuf_type* __sbin) { ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this); if (__cerb && __sbin) { try { if (!__copy_streambufs(__sbin, this->rdbuf())) __err |= ios_base::failbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::failbit); } } else if (!__sbin) __err |= ios_base::badbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: put(char_type __c) { sentry __cerb(*this); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const int_type __put = this->rdbuf()->sputc(__c); if (traits_type::eq_int_type(__put, traits_type::eof())) __err |= ios_base::badbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: write(const _CharT* __s, streamsize __n) { sentry __cerb(*this); if (__cerb) { try { _M_write(__s, __n); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: flush() { ios_base::iostate __err = ios_base::goodbit; try { if (this->rdbuf() && this->rdbuf()->pubsync() == -1) __err |= ios_base::badbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>:: tellp() { pos_type __ret = pos_type(-1); try { if (!this->fail()) __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } return __ret; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: seekp(pos_type __pos) { ios_base::iostate __err = ios_base::goodbit; try { if (!this->fail()) { const pos_type __p = this->rdbuf()->pubseekpos(__pos, ios_base::out); if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: seekp(off_type __off, ios_base::seekdir __dir) { ios_base::iostate __err = ios_base::goodbit; try { if (!this->fail()) { const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, ios_base::out); if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) { if (!__s) __out.setstate(ios_base::badbit); else { const size_t __clen = char_traits<char>::length(__s); try { struct __ptr_guard { _CharT *__p; __ptr_guard (_CharT *__ip): __p(__ip) { } ~__ptr_guard() { delete[] __p; } _CharT* __get() { return __p; } } __pg (new _CharT[__clen]); _CharT *__ws = __pg.__get(); for (size_t __i = 0; __i < __clen; ++__i) __ws[__i] = __out.widen(__s[__i]); __ostream_insert(__out, __ws, __clen); } catch(__cxxabiv1::__forced_unwind&) { __out._M_setstate(ios_base::badbit); throw; } catch(...) { __out._M_setstate(ios_base::badbit); } } return __out; } extern template class basic_ostream<char>; extern template ostream& endl(ostream&); extern template ostream& ends(ostream&); extern template ostream& flush(ostream&); extern template ostream& operator<<(ostream&, char); extern template ostream& operator<<(ostream&, unsigned char); extern template ostream& operator<<(ostream&, signed char); extern template ostream& operator<<(ostream&, const char*); extern template ostream& operator<<(ostream&, const unsigned char*); extern template ostream& operator<<(ostream&, const signed char*); extern template ostream& ostream::_M_insert(long); extern template ostream& ostream::_M_insert(unsigned long); extern template ostream& ostream::_M_insert(bool); extern template ostream& ostream::_M_insert(long long); extern template ostream& ostream::_M_insert(unsigned long long); extern template ostream& ostream::_M_insert(double); extern template ostream& ostream::_M_insert(long double); extern template ostream& ostream::_M_insert(const void*); extern template class basic_ostream<wchar_t>; extern template wostream& endl(wostream&); extern template wostream& ends(wostream&); extern template wostream& flush(wostream&); extern template wostream& operator<<(wostream&, wchar_t); extern template wostream& operator<<(wostream&, char); extern template wostream& operator<<(wostream&, const wchar_t*); extern template wostream& operator<<(wostream&, const char*); extern template wostream& wostream::_M_insert(long); extern template wostream& wostream::_M_insert(unsigned long); extern template wostream& wostream::_M_insert(bool); extern template wostream& wostream::_M_insert(long long); extern template wostream& wostream::_M_insert(unsigned long long); extern template wostream& wostream::_M_insert(double); extern template wostream& wostream::_M_insert(long double); extern template wostream& wostream::_M_insert(const void*); } # 613 "/usr/include/c++/4.8/ostream" 2 3 # 40 "/usr/include/c++/4.8/iostream" 2 3 # 1 "/usr/include/c++/4.8/istream" 1 3 # 36 "/usr/include/c++/4.8/istream" 3 # 37 "/usr/include/c++/4.8/istream" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 57 "/usr/include/c++/4.8/istream" 3 template<typename _CharT, typename _Traits> class basic_istream : virtual public basic_ios<_CharT, _Traits> { public: typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef basic_ios<_CharT, _Traits> __ios_type; typedef basic_istream<_CharT, _Traits> __istream_type; typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > __num_get_type; typedef ctype<_CharT> __ctype_type; protected: streamsize _M_gcount; public: explicit basic_istream(__streambuf_type* __sb) : _M_gcount(streamsize(0)) { this->init(__sb); } virtual ~basic_istream() { _M_gcount = streamsize(0); } class sentry; friend class sentry; # 119 "/usr/include/c++/4.8/istream" 3 __istream_type& operator>>(__istream_type& (*__pf)(__istream_type&)) { return __pf(*this); } __istream_type& operator>>(__ios_type& (*__pf)(__ios_type&)) { __pf(*this); return *this; } __istream_type& operator>>(ios_base& (*__pf)(ios_base&)) { __pf(*this); return *this; } # 167 "/usr/include/c++/4.8/istream" 3 __istream_type& operator>>(bool& __n) { return _M_extract(__n); } __istream_type& operator>>(short& __n); __istream_type& operator>>(unsigned short& __n) { return _M_extract(__n); } __istream_type& operator>>(int& __n); __istream_type& operator>>(unsigned int& __n) { return _M_extract(__n); } __istream_type& operator>>(long& __n) { return _M_extract(__n); } __istream_type& operator>>(unsigned long& __n) { return _M_extract(__n); } __istream_type& operator>>(long long& __n) { return _M_extract(__n); } __istream_type& operator>>(unsigned long long& __n) { return _M_extract(__n); } # 213 "/usr/include/c++/4.8/istream" 3 __istream_type& operator>>(float& __f) { return _M_extract(__f); } __istream_type& operator>>(double& __f) { return _M_extract(__f); } __istream_type& operator>>(long double& __f) { return _M_extract(__f); } # 234 "/usr/include/c++/4.8/istream" 3 __istream_type& operator>>(void*& __p) { return _M_extract(__p); } # 258 "/usr/include/c++/4.8/istream" 3 __istream_type& operator>>(__streambuf_type* __sb); # 268 "/usr/include/c++/4.8/istream" 3 streamsize gcount() const { return _M_gcount; } # 301 "/usr/include/c++/4.8/istream" 3 int_type get(); # 315 "/usr/include/c++/4.8/istream" 3 __istream_type& get(char_type& __c); # 342 "/usr/include/c++/4.8/istream" 3 __istream_type& get(char_type* __s, streamsize __n, char_type __delim); # 353 "/usr/include/c++/4.8/istream" 3 __istream_type& get(char_type* __s, streamsize __n) { return this->get(__s, __n, this->widen('\n')); } # 376 "/usr/include/c++/4.8/istream" 3 __istream_type& get(__streambuf_type& __sb, char_type __delim); # 386 "/usr/include/c++/4.8/istream" 3 __istream_type& get(__streambuf_type& __sb) { return this->get(__sb, this->widen('\n')); } # 415 "/usr/include/c++/4.8/istream" 3 __istream_type& getline(char_type* __s, streamsize __n, char_type __delim); # 426 "/usr/include/c++/4.8/istream" 3 __istream_type& getline(char_type* __s, streamsize __n) { return this->getline(__s, __n, this->widen('\n')); } # 450 "/usr/include/c++/4.8/istream" 3 __istream_type& ignore(streamsize __n, int_type __delim); __istream_type& ignore(streamsize __n); __istream_type& ignore(); # 467 "/usr/include/c++/4.8/istream" 3 int_type peek(); # 485 "/usr/include/c++/4.8/istream" 3 __istream_type& read(char_type* __s, streamsize __n); # 504 "/usr/include/c++/4.8/istream" 3 streamsize readsome(char_type* __s, streamsize __n); # 521 "/usr/include/c++/4.8/istream" 3 __istream_type& putback(char_type __c); # 537 "/usr/include/c++/4.8/istream" 3 __istream_type& unget(); # 555 "/usr/include/c++/4.8/istream" 3 int sync(); # 570 "/usr/include/c++/4.8/istream" 3 pos_type tellg(); # 585 "/usr/include/c++/4.8/istream" 3 __istream_type& seekg(pos_type); # 601 "/usr/include/c++/4.8/istream" 3 __istream_type& seekg(off_type, ios_base::seekdir); protected: basic_istream() : _M_gcount(streamsize(0)) { this->init(0); } template<typename _ValueT> __istream_type& _M_extract(_ValueT& __v); }; template<> basic_istream<char>& basic_istream<char>:: getline(char_type* __s, streamsize __n, char_type __delim); template<> basic_istream<char>& basic_istream<char>:: ignore(streamsize __n); template<> basic_istream<char>& basic_istream<char>:: ignore(streamsize __n, int_type __delim); template<> basic_istream<wchar_t>& basic_istream<wchar_t>:: getline(char_type* __s, streamsize __n, char_type __delim); template<> basic_istream<wchar_t>& basic_istream<wchar_t>:: ignore(streamsize __n); template<> basic_istream<wchar_t>& basic_istream<wchar_t>:: ignore(streamsize __n, int_type __delim); # 656 "/usr/include/c++/4.8/istream" 3 template<typename _CharT, typename _Traits> class basic_istream<_CharT, _Traits>::sentry { bool _M_ok; public: typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::__ctype_type __ctype_type; typedef typename _Traits::int_type __int_type; # 692 "/usr/include/c++/4.8/istream" 3 explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); # 705 "/usr/include/c++/4.8/istream" 3 operator bool() const { return _M_ok; } }; # 721 "/usr/include/c++/4.8/istream" 3 template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c); template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) { return (__in >> reinterpret_cast<char&>(__c)); } template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, signed char& __c) { return (__in >> reinterpret_cast<char&>(__c)); } # 763 "/usr/include/c++/4.8/istream" 3 template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s); template<> basic_istream<char>& operator>>(basic_istream<char>& __in, char* __s); template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) { return (__in >> reinterpret_cast<char*>(__s)); } template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, signed char* __s) { return (__in >> reinterpret_cast<char*>(__s)); } # 794 "/usr/include/c++/4.8/istream" 3 template<typename _CharT, typename _Traits> class basic_iostream : public basic_istream<_CharT, _Traits>, public basic_ostream<_CharT, _Traits> { public: typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_ostream<_CharT, _Traits> __ostream_type; explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __sb) : __istream_type(__sb), __ostream_type(__sb) { } virtual ~basic_iostream() { } protected: basic_iostream() : __istream_type(), __ostream_type() { } }; # 854 "/usr/include/c++/4.8/istream" 3 template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __is); # 879 "/usr/include/c++/4.8/istream" 3 } # 1 "/usr/include/c++/4.8/bits/istream.tcc" 1 3 # 37 "/usr/include/c++/4.8/bits/istream.tcc" 3 # 38 "/usr/include/c++/4.8/bits/istream.tcc" 3 namespace std __attribute__ ((__visibility__ ("default"))) { template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>::sentry:: sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false) { ios_base::iostate __err = ios_base::goodbit; if (__in.good()) { if (__in.tie()) __in.tie()->flush(); if (!__noskip && bool(__in.flags() & ios_base::skipws)) { const __int_type __eof = traits_type::eof(); __streambuf_type* __sb = __in.rdbuf(); __int_type __c = __sb->sgetc(); const __ctype_type& __ct = __check_facet(__in._M_ctype); while (!traits_type::eq_int_type(__c, __eof) && __ct.is(ctype_base::space, traits_type::to_char_type(__c))) __c = __sb->snextc(); if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } } if (__in.good() && __err == ios_base::goodbit) _M_ok = true; else { __err |= ios_base::failbit; __in.setstate(__err); } } template<typename _CharT, typename _Traits> template<typename _ValueT> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: _M_extract(_ValueT& __v) { sentry __cerb(*this, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const __num_get_type& __ng = __check_facet(this->_M_num_get); __ng.get(*this, 0, *this, __err, __v); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: operator>>(short& __n) { sentry __cerb(*this, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { long __l; const __num_get_type& __ng = __check_facet(this->_M_num_get); __ng.get(*this, 0, *this, __err, __l); if (__l < __gnu_cxx::__numeric_traits<short>::__min) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<short>::__min; } else if (__l > __gnu_cxx::__numeric_traits<short>::__max) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<short>::__max; } else __n = short(__l); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: operator>>(int& __n) { sentry __cerb(*this, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { long __l; const __num_get_type& __ng = __check_facet(this->_M_num_get); __ng.get(*this, 0, *this, __err, __l); if (__l < __gnu_cxx::__numeric_traits<int>::__min) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<int>::__min; } else if (__l > __gnu_cxx::__numeric_traits<int>::__max) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<int>::__max; } else __n = int(__l); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: operator>>(__streambuf_type* __sbout) { ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, false); if (__cerb && __sbout) { try { bool __ineof; if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof)) __err |= ios_base::failbit; if (__ineof) __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::failbit); throw; } catch(...) { this->_M_setstate(ios_base::failbit); } } else if (!__sbout) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>:: get(void) { const int_type __eof = traits_type::eof(); int_type __c = __eof; _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { try { __c = this->rdbuf()->sbumpc(); if (!traits_type::eq_int_type(__c, __eof)) _M_gcount = 1; else __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return __c; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: get(char_type& __c) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { try { const int_type __cb = this->rdbuf()->sbumpc(); if (!traits_type::eq_int_type(__cb, traits_type::eof())) { _M_gcount = 1; __c = traits_type::to_char_type(__cb); } else __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: get(char_type* __s, streamsize __n, char_type __delim) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { try { const int_type __idelim = traits_type::to_int_type(__delim); const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); while (_M_gcount + 1 < __n && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __idelim)) { *__s++ = traits_type::to_char_type(__c); ++_M_gcount; __c = __sb->snextc(); } if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } if (__n > 0) *__s = char_type(); if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: get(__streambuf_type& __sb, char_type __delim) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { try { const int_type __idelim = traits_type::to_int_type(__delim); const int_type __eof = traits_type::eof(); __streambuf_type* __this_sb = this->rdbuf(); int_type __c = __this_sb->sgetc(); char_type __c2 = traits_type::to_char_type(__c); while (!traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __idelim) && !traits_type::eq_int_type(__sb.sputc(__c2), __eof)) { ++_M_gcount; __c = __this_sb->snextc(); __c2 = traits_type::to_char_type(__c); } if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: getline(char_type* __s, streamsize __n, char_type __delim) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { try { const int_type __idelim = traits_type::to_int_type(__delim); const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); while (_M_gcount + 1 < __n && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __idelim)) { *__s++ = traits_type::to_char_type(__c); __c = __sb->snextc(); ++_M_gcount; } if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; else { if (traits_type::eq_int_type(__c, __idelim)) { __sb->sbumpc(); ++_M_gcount; } else __err |= ios_base::failbit; } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } if (__n > 0) *__s = char_type(); if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: ignore(void) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); if (traits_type::eq_int_type(__sb->sbumpc(), __eof)) __err |= ios_base::eofbit; else _M_gcount = 1; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: ignore(streamsize __n) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb && __n > 0) { ios_base::iostate __err = ios_base::goodbit; try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); # 513 "/usr/include/c++/4.8/bits/istream.tcc" 3 bool __large_ignore = false; while (true) { while (_M_gcount < __n && !traits_type::eq_int_type(__c, __eof)) { ++_M_gcount; __c = __sb->snextc(); } if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof)) { _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else break; } if (__large_ignore) _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: ignore(streamsize __n, int_type __delim) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb && __n > 0) { ios_base::iostate __err = ios_base::goodbit; try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); bool __large_ignore = false; while (true) { while (_M_gcount < __n && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __delim)) { ++_M_gcount; __c = __sb->snextc(); } if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __delim)) { _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else break; } if (__large_ignore) _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; else if (traits_type::eq_int_type(__c, __delim)) { if (_M_gcount < __gnu_cxx::__numeric_traits<streamsize>::__max) ++_M_gcount; __sb->sbumpc(); } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>:: peek(void) { int_type __c = traits_type::eof(); _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { __c = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__c, traits_type::eof())) __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return __c; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: read(char_type* __s, streamsize __n) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { _M_gcount = this->rdbuf()->sgetn(__s, __n); if (_M_gcount != __n) __err |= (ios_base::eofbit | ios_base::failbit); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> streamsize basic_istream<_CharT, _Traits>:: readsome(char_type* __s, streamsize __n) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const streamsize __num = this->rdbuf()->in_avail(); if (__num > 0) _M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n)); else if (__num == -1) __err |= ios_base::eofbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return _M_gcount; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: putback(char_type __c) { _M_gcount = 0; this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); if (!__sb || traits_type::eq_int_type(__sb->sputbackc(__c), __eof)) __err |= ios_base::badbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: unget(void) { _M_gcount = 0; this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); if (!__sb || traits_type::eq_int_type(__sb->sungetc(), __eof)) __err |= ios_base::badbit; } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> int basic_istream<_CharT, _Traits>:: sync(void) { int __ret = -1; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { __streambuf_type* __sb = this->rdbuf(); if (__sb) { if (__sb->pubsync() == -1) __err |= ios_base::badbit; else __ret = 0; } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return __ret; } template<typename _CharT, typename _Traits> typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>:: tellg(void) { pos_type __ret = pos_type(-1); sentry __cerb(*this, true); if (__cerb) { try { if (!this->fail()) __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } } return __ret; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: seekg(pos_type __pos) { this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { if (!this->fail()) { const pos_type __p = this->rdbuf()->pubseekpos(__pos, ios_base::in); if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: seekg(off_type __off, ios_base::seekdir __dir) { this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { if (!this->fail()) { const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, ios_base::in); if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::int_type __int_type; typename __istream_type::sentry __cerb(__in, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; try { const __int_type __cb = __in.rdbuf()->sbumpc(); if (!_Traits::eq_int_type(__cb, _Traits::eof())) __c = _Traits::to_char_type(__cb); else __err |= (ios_base::eofbit | ios_base::failbit); } catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(ios_base::badbit); throw; } catch(...) { __in._M_setstate(ios_base::badbit); } if (__err) __in.setstate(__err); } return __in; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef typename _Traits::int_type int_type; typedef _CharT char_type; typedef ctype<_CharT> __ctype_type; streamsize __extracted = 0; ios_base::iostate __err = ios_base::goodbit; typename __istream_type::sentry __cerb(__in, false); if (__cerb) { try { streamsize __num = __in.width(); if (__num <= 0) __num = __gnu_cxx::__numeric_traits<streamsize>::__max; const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); const int_type __eof = _Traits::eof(); __streambuf_type* __sb = __in.rdbuf(); int_type __c = __sb->sgetc(); while (__extracted < __num - 1 && !_Traits::eq_int_type(__c, __eof) && !__ct.is(ctype_base::space, _Traits::to_char_type(__c))) { *__s++ = _Traits::to_char_type(__c); ++__extracted; __c = __sb->snextc(); } if (_Traits::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; *__s = char_type(); __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> basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __in) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef typename __istream_type::int_type __int_type; typedef ctype<_CharT> __ctype_type; const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); const __int_type __eof = _Traits::eof(); __streambuf_type* __sb = __in.rdbuf(); __int_type __c = __sb->sgetc(); while (!_Traits::eq_int_type(__c, __eof) && __ct.is(ctype_base::space, _Traits::to_char_type(__c))) __c = __sb->snextc(); if (_Traits::eq_int_type(__c, __eof)) __in.setstate(ios_base::eofbit); return __in; } extern template class basic_istream<char>; extern template istream& ws(istream&); extern template istream& operator>>(istream&, char&); extern template istream& operator>>(istream&, char*); extern template istream& operator>>(istream&, unsigned char&); extern template istream& operator>>(istream&, signed char&); extern template istream& operator>>(istream&, unsigned char*); extern template istream& operator>>(istream&, signed char*); extern template istream& istream::_M_extract(unsigned short&); extern template istream& istream::_M_extract(unsigned int&); extern template istream& istream::_M_extract(long&); extern template istream& istream::_M_extract(unsigned long&); extern template istream& istream::_M_extract(bool&); extern template istream& istream::_M_extract(long long&); extern template istream& istream::_M_extract(unsigned long long&); extern template istream& istream::_M_extract(float&); extern template istream& istream::_M_extract(double&); extern template istream& istream::_M_extract(long double&); extern template istream& istream::_M_extract(void*&); extern template class basic_iostream<char>; extern template class basic_istream<wchar_t>; extern template wistream& ws(wistream&); extern template wistream& operator>>(wistream&, wchar_t&); extern template wistream& operator>>(wistream&, wchar_t*); extern template wistream& wistream::_M_extract(unsigned short&); extern template wistream& wistream::_M_extract(unsigned int&); extern template wistream& wistream::_M_extract(long&); extern template wistream& wistream::_M_extract(unsigned long&); extern template wistream& wistream::_M_extract(bool&); extern template wistream& wistream::_M_extract(long long&); extern template wistream& wistream::_M_extract(unsigned long long&); extern template wistream& wistream::_M_extract(float&); extern template wistream& wistream::_M_extract(double&); extern template wistream& wistream::_M_extract(long double&); extern template wistream& wistream::_M_extract(void*&); extern template class basic_iostream<wchar_t>; } # 883 "/usr/include/c++/4.8/istream" 2 3 # 41 "/usr/include/c++/4.8/iostream" 2 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 60 "/usr/include/c++/4.8/iostream" 3 extern istream cin; extern ostream cout; extern ostream cerr; extern ostream clog; extern wistream wcin; extern wostream wcout; extern wostream wcerr; extern wostream wclog; static ios_base::Init __ioinit; } # 2 "build_example.cpp" 2 # 1 "/usr/include/c++/4.8/cmath" 1 3 # 39 "/usr/include/c++/4.8/cmath" 3 # 40 "/usr/include/c++/4.8/cmath" 3 # 1 "/usr/include/math.h" 1 3 4 # 28 "/usr/include/math.h" 3 4 extern "C" { # 1 "/usr/include/x86_64-linux-gnu/bits/huge_val.h" 1 3 4 # 33 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/huge_valf.h" 1 3 4 # 35 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/huge_vall.h" 1 3 4 # 36 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/inf.h" 1 3 4 # 39 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/nan.h" 1 3 4 # 42 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathdef.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/mathdef.h" 3 4 typedef float float_t; typedef double double_t; # 46 "/usr/include/math.h" 2 3 4 # 69 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 1 3 4 # 52 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double acos (double __x) throw (); extern double __acos (double __x) throw (); extern double asin (double __x) throw (); extern double __asin (double __x) throw (); extern double atan (double __x) throw (); extern double __atan (double __x) throw (); extern double atan2 (double __y, double __x) throw (); extern double __atan2 (double __y, double __x) throw (); extern double cos (double __x) throw (); extern double __cos (double __x) throw (); extern double sin (double __x) throw (); extern double __sin (double __x) throw (); extern double tan (double __x) throw (); extern double __tan (double __x) throw (); extern double cosh (double __x) throw (); extern double __cosh (double __x) throw (); extern double sinh (double __x) throw (); extern double __sinh (double __x) throw (); extern double tanh (double __x) throw (); extern double __tanh (double __x) throw (); extern void sincos (double __x, double *__sinx, double *__cosx) throw (); extern void __sincos (double __x, double *__sinx, double *__cosx) throw () ; extern double acosh (double __x) throw (); extern double __acosh (double __x) throw (); extern double asinh (double __x) throw (); extern double __asinh (double __x) throw (); extern double atanh (double __x) throw (); extern double __atanh (double __x) throw (); extern double exp (double __x) throw (); extern double __exp (double __x) throw (); extern double frexp (double __x, int *__exponent) throw (); extern double __frexp (double __x, int *__exponent) throw (); extern double ldexp (double __x, int __exponent) throw (); extern double __ldexp (double __x, int __exponent) throw (); extern double log (double __x) throw (); extern double __log (double __x) throw (); extern double log10 (double __x) throw (); extern double __log10 (double __x) throw (); extern double modf (double __x, double *__iptr) throw (); extern double __modf (double __x, double *__iptr) throw () __attribute__ ((__nonnull__ (2))); extern double exp10 (double __x) throw (); extern double __exp10 (double __x) throw (); extern double pow10 (double __x) throw (); extern double __pow10 (double __x) throw (); extern double expm1 (double __x) throw (); extern double __expm1 (double __x) throw (); extern double log1p (double __x) throw (); extern double __log1p (double __x) throw (); extern double logb (double __x) throw (); extern double __logb (double __x) throw (); extern double exp2 (double __x) throw (); extern double __exp2 (double __x) throw (); extern double log2 (double __x) throw (); extern double __log2 (double __x) throw (); extern double pow (double __x, double __y) throw (); extern double __pow (double __x, double __y) throw (); extern double sqrt (double __x) throw (); extern double __sqrt (double __x) throw (); extern double hypot (double __x, double __y) throw (); extern double __hypot (double __x, double __y) throw (); extern double cbrt (double __x) throw (); extern double __cbrt (double __x) throw (); extern double ceil (double __x) throw () __attribute__ ((__const__)); extern double __ceil (double __x) throw () __attribute__ ((__const__)); extern double fabs (double __x) throw () __attribute__ ((__const__)); extern double __fabs (double __x) throw () __attribute__ ((__const__)); extern double floor (double __x) throw () __attribute__ ((__const__)); extern double __floor (double __x) throw () __attribute__ ((__const__)); extern double fmod (double __x, double __y) throw (); extern double __fmod (double __x, double __y) throw (); extern int __isinf (double __value) throw () __attribute__ ((__const__)); extern int __finite (double __value) throw () __attribute__ ((__const__)); extern int isinf (double __value) throw () __attribute__ ((__const__)); extern int finite (double __value) throw () __attribute__ ((__const__)); extern double drem (double __x, double __y) throw (); extern double __drem (double __x, double __y) throw (); extern double significand (double __x) throw (); extern double __significand (double __x) throw (); extern double copysign (double __x, double __y) throw () __attribute__ ((__const__)); extern double __copysign (double __x, double __y) throw () __attribute__ ((__const__)); extern double nan (const char *__tagb) throw () __attribute__ ((__const__)); extern double __nan (const char *__tagb) throw () __attribute__ ((__const__)); extern int __isnan (double __value) throw () __attribute__ ((__const__)); extern int isnan (double __value) throw () __attribute__ ((__const__)); extern double j0 (double) throw (); extern double __j0 (double) throw (); extern double j1 (double) throw (); extern double __j1 (double) throw (); extern double jn (int, double) throw (); extern double __jn (int, double) throw (); extern double y0 (double) throw (); extern double __y0 (double) throw (); extern double y1 (double) throw (); extern double __y1 (double) throw (); extern double yn (int, double) throw (); extern double __yn (int, double) throw (); extern double erf (double) throw (); extern double __erf (double) throw (); extern double erfc (double) throw (); extern double __erfc (double) throw (); extern double lgamma (double) throw (); extern double __lgamma (double) throw (); extern double tgamma (double) throw (); extern double __tgamma (double) throw (); extern double gamma (double) throw (); extern double __gamma (double) throw (); extern double lgamma_r (double, int *__signgamp) throw (); extern double __lgamma_r (double, int *__signgamp) throw (); extern double rint (double __x) throw (); extern double __rint (double __x) throw (); extern double nextafter (double __x, double __y) throw () __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) throw () __attribute__ ((__const__)); extern double nexttoward (double __x, long double __y) throw () __attribute__ ((__const__)); extern double __nexttoward (double __x, long double __y) throw () __attribute__ ((__const__)); extern double remainder (double __x, double __y) throw (); extern double __remainder (double __x, double __y) throw (); extern double scalbn (double __x, int __n) throw (); extern double __scalbn (double __x, int __n) throw (); extern int ilogb (double __x) throw (); extern int __ilogb (double __x) throw (); extern double scalbln (double __x, long int __n) throw (); extern double __scalbln (double __x, long int __n) throw (); extern double nearbyint (double __x) throw (); extern double __nearbyint (double __x) throw (); extern double round (double __x) throw () __attribute__ ((__const__)); extern double __round (double __x) throw () __attribute__ ((__const__)); extern double trunc (double __x) throw () __attribute__ ((__const__)); extern double __trunc (double __x) throw () __attribute__ ((__const__)); extern double remquo (double __x, double __y, int *__quo) throw (); extern double __remquo (double __x, double __y, int *__quo) throw (); extern long int lrint (double __x) throw (); extern long int __lrint (double __x) throw (); __extension__ extern long long int llrint (double __x) throw (); extern long long int __llrint (double __x) throw (); extern long int lround (double __x) throw (); extern long int __lround (double __x) throw (); __extension__ extern long long int llround (double __x) throw (); extern long long int __llround (double __x) throw (); extern double fdim (double __x, double __y) throw (); extern double __fdim (double __x, double __y) throw (); extern double fmax (double __x, double __y) throw () __attribute__ ((__const__)); extern double __fmax (double __x, double __y) throw () __attribute__ ((__const__)); extern double fmin (double __x, double __y) throw () __attribute__ ((__const__)); extern double __fmin (double __x, double __y) throw () __attribute__ ((__const__)); extern int __fpclassify (double __value) throw () __attribute__ ((__const__)); extern int __signbit (double __value) throw () __attribute__ ((__const__)); extern double fma (double __x, double __y, double __z) throw (); extern double __fma (double __x, double __y, double __z) throw (); extern int __issignaling (double __value) throw () __attribute__ ((__const__)); extern double scalb (double __x, double __n) throw (); extern double __scalb (double __x, double __n) throw (); # 70 "/usr/include/math.h" 2 3 4 # 88 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 1 3 4 # 52 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float acosf (float __x) throw (); extern float __acosf (float __x) throw (); extern float asinf (float __x) throw (); extern float __asinf (float __x) throw (); extern float atanf (float __x) throw (); extern float __atanf (float __x) throw (); extern float atan2f (float __y, float __x) throw (); extern float __atan2f (float __y, float __x) throw (); extern float cosf (float __x) throw (); extern float __cosf (float __x) throw (); extern float sinf (float __x) throw (); extern float __sinf (float __x) throw (); extern float tanf (float __x) throw (); extern float __tanf (float __x) throw (); extern float coshf (float __x) throw (); extern float __coshf (float __x) throw (); extern float sinhf (float __x) throw (); extern float __sinhf (float __x) throw (); extern float tanhf (float __x) throw (); extern float __tanhf (float __x) throw (); extern void sincosf (float __x, float *__sinx, float *__cosx) throw (); extern void __sincosf (float __x, float *__sinx, float *__cosx) throw () ; extern float acoshf (float __x) throw (); extern float __acoshf (float __x) throw (); extern float asinhf (float __x) throw (); extern float __asinhf (float __x) throw (); extern float atanhf (float __x) throw (); extern float __atanhf (float __x) throw (); extern float expf (float __x) throw (); extern float __expf (float __x) throw (); extern float frexpf (float __x, int *__exponent) throw (); extern float __frexpf (float __x, int *__exponent) throw (); extern float ldexpf (float __x, int __exponent) throw (); extern float __ldexpf (float __x, int __exponent) throw (); extern float logf (float __x) throw (); extern float __logf (float __x) throw (); extern float log10f (float __x) throw (); extern float __log10f (float __x) throw (); extern float modff (float __x, float *__iptr) throw (); extern float __modff (float __x, float *__iptr) throw () __attribute__ ((__nonnull__ (2))); extern float exp10f (float __x) throw (); extern float __exp10f (float __x) throw (); extern float pow10f (float __x) throw (); extern float __pow10f (float __x) throw (); extern float expm1f (float __x) throw (); extern float __expm1f (float __x) throw (); extern float log1pf (float __x) throw (); extern float __log1pf (float __x) throw (); extern float logbf (float __x) throw (); extern float __logbf (float __x) throw (); extern float exp2f (float __x) throw (); extern float __exp2f (float __x) throw (); extern float log2f (float __x) throw (); extern float __log2f (float __x) throw (); extern float powf (float __x, float __y) throw (); extern float __powf (float __x, float __y) throw (); extern float sqrtf (float __x) throw (); extern float __sqrtf (float __x) throw (); extern float hypotf (float __x, float __y) throw (); extern float __hypotf (float __x, float __y) throw (); extern float cbrtf (float __x) throw (); extern float __cbrtf (float __x) throw (); extern float ceilf (float __x) throw () __attribute__ ((__const__)); extern float __ceilf (float __x) throw () __attribute__ ((__const__)); extern float fabsf (float __x) throw () __attribute__ ((__const__)); extern float __fabsf (float __x) throw () __attribute__ ((__const__)); extern float floorf (float __x) throw () __attribute__ ((__const__)); extern float __floorf (float __x) throw () __attribute__ ((__const__)); extern float fmodf (float __x, float __y) throw (); extern float __fmodf (float __x, float __y) throw (); extern int __isinff (float __value) throw () __attribute__ ((__const__)); extern int __finitef (float __value) throw () __attribute__ ((__const__)); extern int isinff (float __value) throw () __attribute__ ((__const__)); extern int finitef (float __value) throw () __attribute__ ((__const__)); extern float dremf (float __x, float __y) throw (); extern float __dremf (float __x, float __y) throw (); extern float significandf (float __x) throw (); extern float __significandf (float __x) throw (); extern float copysignf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) throw () __attribute__ ((__const__)); extern float nanf (const char *__tagb) throw () __attribute__ ((__const__)); extern float __nanf (const char *__tagb) throw () __attribute__ ((__const__)); extern int __isnanf (float __value) throw () __attribute__ ((__const__)); extern int isnanf (float __value) throw () __attribute__ ((__const__)); extern float j0f (float) throw (); extern float __j0f (float) throw (); extern float j1f (float) throw (); extern float __j1f (float) throw (); extern float jnf (int, float) throw (); extern float __jnf (int, float) throw (); extern float y0f (float) throw (); extern float __y0f (float) throw (); extern float y1f (float) throw (); extern float __y1f (float) throw (); extern float ynf (int, float) throw (); extern float __ynf (int, float) throw (); extern float erff (float) throw (); extern float __erff (float) throw (); extern float erfcf (float) throw (); extern float __erfcf (float) throw (); extern float lgammaf (float) throw (); extern float __lgammaf (float) throw (); extern float tgammaf (float) throw (); extern float __tgammaf (float) throw (); extern float gammaf (float) throw (); extern float __gammaf (float) throw (); extern float lgammaf_r (float, int *__signgamp) throw (); extern float __lgammaf_r (float, int *__signgamp) throw (); extern float rintf (float __x) throw (); extern float __rintf (float __x) throw (); extern float nextafterf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) throw () __attribute__ ((__const__)); extern float nexttowardf (float __x, long double __y) throw () __attribute__ ((__const__)); extern float __nexttowardf (float __x, long double __y) throw () __attribute__ ((__const__)); extern float remainderf (float __x, float __y) throw (); extern float __remainderf (float __x, float __y) throw (); extern float scalbnf (float __x, int __n) throw (); extern float __scalbnf (float __x, int __n) throw (); extern int ilogbf (float __x) throw (); extern int __ilogbf (float __x) throw (); extern float scalblnf (float __x, long int __n) throw (); extern float __scalblnf (float __x, long int __n) throw (); extern float nearbyintf (float __x) throw (); extern float __nearbyintf (float __x) throw (); extern float roundf (float __x) throw () __attribute__ ((__const__)); extern float __roundf (float __x) throw () __attribute__ ((__const__)); extern float truncf (float __x) throw () __attribute__ ((__const__)); extern float __truncf (float __x) throw () __attribute__ ((__const__)); extern float remquof (float __x, float __y, int *__quo) throw (); extern float __remquof (float __x, float __y, int *__quo) throw (); extern long int lrintf (float __x) throw (); extern long int __lrintf (float __x) throw (); __extension__ extern long long int llrintf (float __x) throw (); extern long long int __llrintf (float __x) throw (); extern long int lroundf (float __x) throw (); extern long int __lroundf (float __x) throw (); __extension__ extern long long int llroundf (float __x) throw (); extern long long int __llroundf (float __x) throw (); extern float fdimf (float __x, float __y) throw (); extern float __fdimf (float __x, float __y) throw (); extern float fmaxf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __fmaxf (float __x, float __y) throw () __attribute__ ((__const__)); extern float fminf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __fminf (float __x, float __y) throw () __attribute__ ((__const__)); extern int __fpclassifyf (float __value) throw () __attribute__ ((__const__)); extern int __signbitf (float __value) throw () __attribute__ ((__const__)); extern float fmaf (float __x, float __y, float __z) throw (); extern float __fmaf (float __x, float __y, float __z) throw (); extern int __issignalingf (float __value) throw () __attribute__ ((__const__)); extern float scalbf (float __x, float __n) throw (); extern float __scalbf (float __x, float __n) throw (); # 89 "/usr/include/math.h" 2 3 4 # 132 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 1 3 4 # 52 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double acosl (long double __x) throw (); extern long double __acosl (long double __x) throw (); extern long double asinl (long double __x) throw (); extern long double __asinl (long double __x) throw (); extern long double atanl (long double __x) throw (); extern long double __atanl (long double __x) throw (); extern long double atan2l (long double __y, long double __x) throw (); extern long double __atan2l (long double __y, long double __x) throw (); extern long double cosl (long double __x) throw (); extern long double __cosl (long double __x) throw (); extern long double sinl (long double __x) throw (); extern long double __sinl (long double __x) throw (); extern long double tanl (long double __x) throw (); extern long double __tanl (long double __x) throw (); extern long double coshl (long double __x) throw (); extern long double __coshl (long double __x) throw (); extern long double sinhl (long double __x) throw (); extern long double __sinhl (long double __x) throw (); extern long double tanhl (long double __x) throw (); extern long double __tanhl (long double __x) throw (); extern void sincosl (long double __x, long double *__sinx, long double *__cosx) throw (); extern void __sincosl (long double __x, long double *__sinx, long double *__cosx) throw () ; extern long double acoshl (long double __x) throw (); extern long double __acoshl (long double __x) throw (); extern long double asinhl (long double __x) throw (); extern long double __asinhl (long double __x) throw (); extern long double atanhl (long double __x) throw (); extern long double __atanhl (long double __x) throw (); extern long double expl (long double __x) throw (); extern long double __expl (long double __x) throw (); extern long double frexpl (long double __x, int *__exponent) throw (); extern long double __frexpl (long double __x, int *__exponent) throw (); extern long double ldexpl (long double __x, int __exponent) throw (); extern long double __ldexpl (long double __x, int __exponent) throw (); extern long double logl (long double __x) throw (); extern long double __logl (long double __x) throw (); extern long double log10l (long double __x) throw (); extern long double __log10l (long double __x) throw (); extern long double modfl (long double __x, long double *__iptr) throw (); extern long double __modfl (long double __x, long double *__iptr) throw () __attribute__ ((__nonnull__ (2))); extern long double exp10l (long double __x) throw (); extern long double __exp10l (long double __x) throw (); extern long double pow10l (long double __x) throw (); extern long double __pow10l (long double __x) throw (); extern long double expm1l (long double __x) throw (); extern long double __expm1l (long double __x) throw (); extern long double log1pl (long double __x) throw (); extern long double __log1pl (long double __x) throw (); extern long double logbl (long double __x) throw (); extern long double __logbl (long double __x) throw (); extern long double exp2l (long double __x) throw (); extern long double __exp2l (long double __x) throw (); extern long double log2l (long double __x) throw (); extern long double __log2l (long double __x) throw (); extern long double powl (long double __x, long double __y) throw (); extern long double __powl (long double __x, long double __y) throw (); extern long double sqrtl (long double __x) throw (); extern long double __sqrtl (long double __x) throw (); extern long double hypotl (long double __x, long double __y) throw (); extern long double __hypotl (long double __x, long double __y) throw (); extern long double cbrtl (long double __x) throw (); extern long double __cbrtl (long double __x) throw (); extern long double ceill (long double __x) throw () __attribute__ ((__const__)); extern long double __ceill (long double __x) throw () __attribute__ ((__const__)); extern long double fabsl (long double __x) throw () __attribute__ ((__const__)); extern long double __fabsl (long double __x) throw () __attribute__ ((__const__)); extern long double floorl (long double __x) throw () __attribute__ ((__const__)); extern long double __floorl (long double __x) throw () __attribute__ ((__const__)); extern long double fmodl (long double __x, long double __y) throw (); extern long double __fmodl (long double __x, long double __y) throw (); extern int __isinfl (long double __value) throw () __attribute__ ((__const__)); extern int __finitel (long double __value) throw () __attribute__ ((__const__)); extern int isinfl (long double __value) throw () __attribute__ ((__const__)); extern int finitel (long double __value) throw () __attribute__ ((__const__)); extern long double dreml (long double __x, long double __y) throw (); extern long double __dreml (long double __x, long double __y) throw (); extern long double significandl (long double __x) throw (); extern long double __significandl (long double __x) throw (); extern long double copysignl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double nanl (const char *__tagb) throw () __attribute__ ((__const__)); extern long double __nanl (const char *__tagb) throw () __attribute__ ((__const__)); extern int __isnanl (long double __value) throw () __attribute__ ((__const__)); extern int isnanl (long double __value) throw () __attribute__ ((__const__)); extern long double j0l (long double) throw (); extern long double __j0l (long double) throw (); extern long double j1l (long double) throw (); extern long double __j1l (long double) throw (); extern long double jnl (int, long double) throw (); extern long double __jnl (int, long double) throw (); extern long double y0l (long double) throw (); extern long double __y0l (long double) throw (); extern long double y1l (long double) throw (); extern long double __y1l (long double) throw (); extern long double ynl (int, long double) throw (); extern long double __ynl (int, long double) throw (); extern long double erfl (long double) throw (); extern long double __erfl (long double) throw (); extern long double erfcl (long double) throw (); extern long double __erfcl (long double) throw (); extern long double lgammal (long double) throw (); extern long double __lgammal (long double) throw (); extern long double tgammal (long double) throw (); extern long double __tgammal (long double) throw (); extern long double gammal (long double) throw (); extern long double __gammal (long double) throw (); extern long double lgammal_r (long double, int *__signgamp) throw (); extern long double __lgammal_r (long double, int *__signgamp) throw (); extern long double rintl (long double __x) throw (); extern long double __rintl (long double __x) throw (); extern long double nextafterl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __nextafterl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double nexttowardl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __nexttowardl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double remainderl (long double __x, long double __y) throw (); extern long double __remainderl (long double __x, long double __y) throw (); extern long double scalbnl (long double __x, int __n) throw (); extern long double __scalbnl (long double __x, int __n) throw (); extern int ilogbl (long double __x) throw (); extern int __ilogbl (long double __x) throw (); extern long double scalblnl (long double __x, long int __n) throw (); extern long double __scalblnl (long double __x, long int __n) throw (); extern long double nearbyintl (long double __x) throw (); extern long double __nearbyintl (long double __x) throw (); extern long double roundl (long double __x) throw () __attribute__ ((__const__)); extern long double __roundl (long double __x) throw () __attribute__ ((__const__)); extern long double truncl (long double __x) throw () __attribute__ ((__const__)); extern long double __truncl (long double __x) throw () __attribute__ ((__const__)); extern long double remquol (long double __x, long double __y, int *__quo) throw (); extern long double __remquol (long double __x, long double __y, int *__quo) throw (); extern long int lrintl (long double __x) throw (); extern long int __lrintl (long double __x) throw (); __extension__ extern long long int llrintl (long double __x) throw (); extern long long int __llrintl (long double __x) throw (); extern long int lroundl (long double __x) throw (); extern long int __lroundl (long double __x) throw (); __extension__ extern long long int llroundl (long double __x) throw (); extern long long int __llroundl (long double __x) throw (); extern long double fdiml (long double __x, long double __y) throw (); extern long double __fdiml (long double __x, long double __y) throw (); extern long double fmaxl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __fmaxl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double fminl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __fminl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern int __fpclassifyl (long double __value) throw () __attribute__ ((__const__)); extern int __signbitl (long double __value) throw () __attribute__ ((__const__)); extern long double fmal (long double __x, long double __y, long double __z) throw (); extern long double __fmal (long double __x, long double __y, long double __z) throw (); extern int __issignalingl (long double __value) throw () __attribute__ ((__const__)); extern long double scalbl (long double __x, long double __n) throw (); extern long double __scalbl (long double __x, long double __n) throw (); # 133 "/usr/include/math.h" 2 3 4 # 148 "/usr/include/math.h" 3 4 extern int signgam; # 189 "/usr/include/math.h" 3 4 enum { FP_NAN = 0, FP_INFINITE = 1, FP_ZERO = 2, FP_SUBNORMAL = 3, FP_NORMAL = 4 }; # 301 "/usr/include/math.h" 3 4 typedef enum { _IEEE_ = -1, _SVID_, _XOPEN_, _POSIX_, _ISOC_ } _LIB_VERSION_TYPE; extern _LIB_VERSION_TYPE _LIB_VERSION; # 324 "/usr/include/math.h" 3 4 struct __exception { int type; char *name; double arg1; double arg2; double retval; }; extern int matherr (struct __exception *__exc) throw (); # 488 "/usr/include/math.h" 3 4 } # 45 "/usr/include/c++/4.8/cmath" 2 3 # 75 "/usr/include/c++/4.8/cmath" 3 namespace std __attribute__ ((__visibility__ ("default"))) { inline double abs(double __x) { return __builtin_fabs(__x); } inline float abs(float __x) { return __builtin_fabsf(__x); } inline long double abs(long double __x) { return __builtin_fabsl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type abs(_Tp __x) { return __builtin_fabs(__x); } using ::acos; inline float acos(float __x) { return __builtin_acosf(__x); } inline long double acos(long double __x) { return __builtin_acosl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type acos(_Tp __x) { return __builtin_acos(__x); } using ::asin; inline float asin(float __x) { return __builtin_asinf(__x); } inline long double asin(long double __x) { return __builtin_asinl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type asin(_Tp __x) { return __builtin_asin(__x); } using ::atan; inline float atan(float __x) { return __builtin_atanf(__x); } inline long double atan(long double __x) { return __builtin_atanl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type atan(_Tp __x) { return __builtin_atan(__x); } using ::atan2; inline float atan2(float __y, float __x) { return __builtin_atan2f(__y, __x); } inline long double atan2(long double __y, long double __x) { return __builtin_atan2l(__y, __x); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type atan2(_Tp __y, _Up __x) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return atan2(__type(__y), __type(__x)); } using ::ceil; inline float ceil(float __x) { return __builtin_ceilf(__x); } inline long double ceil(long double __x) { return __builtin_ceill(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type ceil(_Tp __x) { return __builtin_ceil(__x); } using ::cos; inline float cos(float __x) { return __builtin_cosf(__x); } inline long double cos(long double __x) { return __builtin_cosl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type cos(_Tp __x) { return __builtin_cos(__x); } using ::cosh; inline float cosh(float __x) { return __builtin_coshf(__x); } inline long double cosh(long double __x) { return __builtin_coshl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type cosh(_Tp __x) { return __builtin_cosh(__x); } using ::exp; inline float exp(float __x) { return __builtin_expf(__x); } inline long double exp(long double __x) { return __builtin_expl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type exp(_Tp __x) { return __builtin_exp(__x); } using ::fabs; inline float fabs(float __x) { return __builtin_fabsf(__x); } inline long double fabs(long double __x) { return __builtin_fabsl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type fabs(_Tp __x) { return __builtin_fabs(__x); } using ::floor; inline float floor(float __x) { return __builtin_floorf(__x); } inline long double floor(long double __x) { return __builtin_floorl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type floor(_Tp __x) { return __builtin_floor(__x); } using ::fmod; inline float fmod(float __x, float __y) { return __builtin_fmodf(__x, __y); } inline long double fmod(long double __x, long double __y) { return __builtin_fmodl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fmod(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fmod(__type(__x), __type(__y)); } using ::frexp; inline float frexp(float __x, int* __exp) { return __builtin_frexpf(__x, __exp); } inline long double frexp(long double __x, int* __exp) { return __builtin_frexpl(__x, __exp); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type frexp(_Tp __x, int* __exp) { return __builtin_frexp(__x, __exp); } using ::ldexp; inline float ldexp(float __x, int __exp) { return __builtin_ldexpf(__x, __exp); } inline long double ldexp(long double __x, int __exp) { return __builtin_ldexpl(__x, __exp); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type ldexp(_Tp __x, int __exp) { return __builtin_ldexp(__x, __exp); } using ::log; inline float log(float __x) { return __builtin_logf(__x); } inline long double log(long double __x) { return __builtin_logl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log(_Tp __x) { return __builtin_log(__x); } using ::log10; inline float log10(float __x) { return __builtin_log10f(__x); } inline long double log10(long double __x) { return __builtin_log10l(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log10(_Tp __x) { return __builtin_log10(__x); } using ::modf; inline float modf(float __x, float* __iptr) { return __builtin_modff(__x, __iptr); } inline long double modf(long double __x, long double* __iptr) { return __builtin_modfl(__x, __iptr); } using ::pow; inline float pow(float __x, float __y) { return __builtin_powf(__x, __y); } inline long double pow(long double __x, long double __y) { return __builtin_powl(__x, __y); } inline double pow(double __x, int __i) { return __builtin_powi(__x, __i); } inline float pow(float __x, int __n) { return __builtin_powif(__x, __n); } inline long double pow(long double __x, int __n) { return __builtin_powil(__x, __n); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type pow(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return pow(__type(__x), __type(__y)); } using ::sin; inline float sin(float __x) { return __builtin_sinf(__x); } inline long double sin(long double __x) { return __builtin_sinl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type sin(_Tp __x) { return __builtin_sin(__x); } using ::sinh; inline float sinh(float __x) { return __builtin_sinhf(__x); } inline long double sinh(long double __x) { return __builtin_sinhl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type sinh(_Tp __x) { return __builtin_sinh(__x); } using ::sqrt; inline float sqrt(float __x) { return __builtin_sqrtf(__x); } inline long double sqrt(long double __x) { return __builtin_sqrtl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type sqrt(_Tp __x) { return __builtin_sqrt(__x); } using ::tan; inline float tan(float __x) { return __builtin_tanf(__x); } inline long double tan(long double __x) { return __builtin_tanl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type tan(_Tp __x) { return __builtin_tan(__x); } using ::tanh; inline float tanh(float __x) { return __builtin_tanhf(__x); } inline long double tanh(long double __x) { return __builtin_tanhl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type tanh(_Tp __x) { return __builtin_tanh(__x); } } # 555 "/usr/include/c++/4.8/cmath" 3 namespace std __attribute__ ((__visibility__ ("default"))) { # 805 "/usr/include/c++/4.8/cmath" 3 template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type fpclassify(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_fpclassify(0, 1, 4, 3, 2, __type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isfinite(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isfinite(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isinf(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isinf(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isnan(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isnan(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isnormal(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isnormal(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type signbit(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_signbit(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isgreater(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isgreater(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isgreaterequal(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isgreaterequal(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isless(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isless(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type islessequal(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_islessequal(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type islessgreater(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_islessgreater(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isunordered(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isunordered(__type(__f1), __type(__f2)); } } # 3 "build_example.cpp" 2 int main (int argc, char* argv[]) { std::cout << "sqrt(17) is " << sqrt(17) << '\n'; }
[ "peter.gottschling@simunova.com" ]
peter.gottschling@simunova.com
5629ec2aa7e4788f67c5cc815ad3377ecd3037d0
0cc7b2863488e8bc74c4e329ff528bd0f1990822
/voice/template_recur.cpp
a2f42fed9a53df0dcf5bcb3ccc1d306f737d9ed1
[]
no_license
cleverwyq/CPP11
66bf27316d48d630c937cf5282fd5f800b09b428
ae9e11da03b7b6afaf7a09c512f292b7e5007fee
refs/heads/master
2020-04-11T07:06:31.590727
2019-04-11T16:18:26
2019-04-11T16:18:26
161,601,334
0
0
null
null
null
null
UTF-8
C++
false
false
975
cpp
#include <iostream> using namespace std; template<int N> int Fibbo(); //error: template instantiation depth exceeds maximum of 900 //(use -ftemplate-depth= to increase the maximum) substituting //'template<int N> int Fibbo() [with int N = -1794]'| //My comments: N==1||N==2 is nothing during compile!!!! //template<int N> //int Fibbo() //{ // if (N == 1 || N == 2) // { // return 1; // } // else if ( N <= 0) // return 0; // // else // return Fibbo<N-2>() + Fibbo<N-1>(); // //} template<int N> int Fibbo() { return Fibbo<N-2>() + Fibbo<N-1>(); } template<> int Fibbo<1>() { return 1; } template<> int Fibbo<2>() { return 2; } int Fibbo2(int k) { if (k==1 || k == 2) return k; return Fibbo2(k-1) + Fibbo2(k-2); } int main() { cout << Fibbo<8>() <<endl; for (int k = 3; k <= 7; k++) cout << k<< ":" << Fibbo2(k) << endl; }
[ "you.wang@sap.com" ]
you.wang@sap.com
610770cd24300fb3934daf410524c98c5cd19959
97bd2bc90481e59da387772cd414f07516e6f2cd
/test/pastel/sys/test_view.cpp
3148c0375a5d07f836466b69b8b0b21a736e58ce
[]
no_license
kaba2/pastel
c0371639be222cfa00252420c54057a54a93a4a3
c7fb78fff3cbd977b884e54e21651f6346165ff5
refs/heads/master
2021-11-12T00:12:49.343600
2021-10-31T04:18:28
2021-10-31T04:18:28
231,507,632
3
2
null
null
null
null
UTF-8
C++
false
false
1,010
cpp
// Description: Testing for Views // DocumentationOf: view/view.h #include "test/test_init.h" #include "pastel/sys/array.h" #include "pastel/sys/view.h" namespace { class RowVisitor { public: template <typename Contained_View> void operator()( const Contained_View& view) const { } template <typename Left_View, typename Right_View> void operator()( const Left_View& left, const Right_View& right) const { } }; } TEST_CASE("RowVisit (View)") { Array<int> a(Vector2i(1000, 1000)); visitRows(constArrayView(a), 0, RowVisitor()); visitRows(arrayView(a), 0, RowVisitor()); visitRows(arrayView(a), arrayView(a), 0, RowVisitor()); visitRows(constArrayView(a), arrayView(a), 0, RowVisitor()); visitRows(constArrayView(a), constArrayView(a), 0, RowVisitor()); } TEST_CASE("Trivial (View)") { Array<int> a(Vector2i(1024, 1024)); Array<int> b(a); a = b; b.clear(); b = a; a.clear(); a.setExtent(Vector2i(53, 45), 15); }
[ "kaba@hilvi.org" ]
kaba@hilvi.org
f1699086a2394d111c03e721e712321df6813a29
9b64cc9ea87c3dc1792c45879594ec1fcf8905ce
/RerF-2.0.4/packedForest/src/forestTypes/basicForests/stratifiedInNodeClassIndices.h
561174a4f0e2c54b07d68aa90364d49c06697636
[]
no_license
QuasiLegendre/Home
cdf06c1ef09084a71a2e6a4b6bd44abac997a737
3872534792fd24dd70a3aad4c766168852c2287f
refs/heads/master
2020-07-23T03:38:57.817152
2019-09-10T01:21:06
2019-09-10T01:21:06
207,436,040
0
0
null
null
null
null
UTF-8
C++
false
false
5,716
h
#ifndef stratifiedInNodeClassIndices_h #define stratifiedInNodeClassIndices_h #include <iostream> #include <random> #include <vector> #include <algorithm> namespace fp{ class stratifiedInNodeClassIndices { private: std::vector<std::vector<int> > inSamples; std::vector<int> inSamps; std::vector<std::vector<int> > outSamples; std::vector<int> binSamples; int inSampleSize; int outSampleSize; //TODO: the following functions would benefit from Vitter's Sequential Random Sampling public: stratifiedInNodeClassIndices(): inSamples(fpSingleton::getSingleton().returnNumClasses()), outSamples(fpSingleton::getSingleton().returnNumClasses()), inSampleSize(0), outSampleSize(0){} stratifiedInNodeClassIndices(const int &numObservationsInDataSet): inSamples(fpSingleton::getSingleton().returnNumClasses()), outSamples(fpSingleton::getSingleton().returnNumClasses()), inSampleSize(0), outSampleSize(0){ createInAndOutSets(numObservationsInDataSet); for(auto inSamps : inSamples){ inSampleSize += inSamps.size(); } for(auto outSamps : outSamples){ outSampleSize += outSamples.size(); } } inline void createInAndOutSets(const int &numObs){ std::vector<int> potentialSamples(numObs); std::random_device rd; // obtain a random number from hardware std::mt19937 eng(rd()); // seed the generator std::uniform_int_distribution<> distr(0, numObs-1); for(int i=0; i < numObs; ++i){ potentialSamples[i] = i; } int numUnusedObs = numObs; int randomObsID; int tempMoveObs; for(int n=0; n<numObs; n++){ randomObsID = distr(eng); inSamples[fpSingleton::getSingleton().returnLabel(potentialSamples[randomObsID])].push_back(potentialSamples[randomObsID]); inSamps.push_back(potentialSamples[randomObsID]); if(randomObsID < numUnusedObs){ --numUnusedObs; tempMoveObs = potentialSamples[numUnusedObs]; potentialSamples[numUnusedObs] = potentialSamples[randomObsID]; potentialSamples[randomObsID] = tempMoveObs; } } for(int n=0; n<numUnusedObs; ++n){ outSamples[fpSingleton::getSingleton().returnLabel(potentialSamples[randomObsID])].push_back(potentialSamples[n]); } } inline double returnImpurity(){ if(false){ unsigned int sumClassTotalsSquared = 0; for(auto i : inSamples){ sumClassTotalsSquared+=i.size()*i.size(); } return 1-double(sumClassTotalsSquared)/(inSampleSize*inSampleSize); }else{ double impSum = 0; double classPercent; for(auto i : inSamples){ classPercent = double(i.size())/double(inSampleSize); impSum += double(i.size())*(1.0-classPercent); } return impSum; } } inline void printIndices(){ std::cout << "samples in bag\n"; for(unsigned int n = 0; n < inSamples.size(); ++n){ for(auto & i : inSamples[n]){ std::cout << i << "\n"; } } std::cout << "samples OOB\n"; for(unsigned int n = 0; n < outSamples.size(); ++n){ for(auto & i : outSamples[n]){ std::cout << i << "\n"; } } } inline int returnInSampleSize(){ return inSampleSize; } inline int returnOutSampleSize(){ return outSampleSize; } inline int returnInSample(const int numSample){ return inSamps[numSample]; //The commented out below reduces memory size but is slow. /* int totalViewed = 0; for(unsigned int i = 0; i < inSamples.size(); ++i){ if(numSample < (totalViewed+int(inSamples[i].size()))){ if((numSample-totalViewed)<0 || (numSample-totalViewed)>=int(inSamples[i].size())){ std::cout << numSample-totalViewed << " , " << inSamples[i].size() << "\n"; exit(1); } int retNum = inSamples[i][numSample-totalViewed]; return retNum ; } totalViewed += inSamples[i].size(); } std::cout << "it happened now\n"; exit(1); return -1; */ } inline int returnOutSample(const int numSample){ int totalViewed = 0; for(unsigned int i = 0; i < outSamples.size(); ++i){ if(numSample < totalViewed+int(outSamples[i].size())){ return outSamples[i][numSample-totalViewed]; } totalViewed += outSamples[i].size(); } return -1; } inline int returnBinSize(){ return fpSingleton::getSingleton().returnBinSize(); } inline int returnBinMin(){ return fpSingleton::getSingleton().returnBinMin(); } inline bool useBin(){ return fpSingleton::getSingleton().returnUseBinning() && (inSampleSize > returnBinMin()); } inline void initializeBinnedSamples(){ if(useBin()){ int numInClass; std::random_device random_device; std::mt19937 engine{random_device()}; for(unsigned int i = 0; i < inSamples.size(); ++i){ numInClass = int((returnBinSize()*inSamples[i].size())/inSampleSize); for(int n = 0; n < numInClass; ++n){ std::uniform_int_distribution<int> dist(0, inSamples[i].size() - 1); binSamples.push_back(inSamples[i][dist(engine)]); } } } } inline int returnBinnedSize(){ return binSamples.size(); } inline int returnBinnedInSample(const int numSample){ return binSamples[numSample]; } inline void addIndexToOutSamples(int index){ ++outSampleSize; outSamples[fpSingleton::getSingleton().returnLabel(index)].push_back(index); } inline void addIndexToInSamples(int index){ ++inSampleSize; inSamples[fpSingleton::getSingleton().returnLabel(index)].push_back(index); inSamps.push_back(index); } };//class stratifiedInNodeClassIndices }//namespace fp #endif //stratifiedInNodeClassIndices_h
[ "hjkl464646@gmail.com" ]
hjkl464646@gmail.com
bcbe1858231237dbc3198ee8e37b1a9884591fdb
44acfa7195d859771ad540dd2cc1f54e2c950f45
/src/main.cpp
703d68efa75a2b8bf6d99e0b368ac86772e538ca
[ "MIT" ]
permissive
RitoInc/resp4wn
4fa8497ffc7eb9e1e886dc86c8938532e59a3fb8
1bf725f8aeafecbbc801bc9654acfb087f0a9ab0
refs/heads/master
2020-04-06T07:32:16.615313
2018-08-12T22:18:54
2018-08-12T22:18:54
157,275,865
0
0
null
null
null
null
UTF-8
C++
false
false
277,235
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2017 The PIVX developers // Copyright (c) 2017 The Respawn developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" #include "accumulators.h" #include "addrman.h" #include "alert.h" #include "chainparams.h" #include "checkpoints.h" #include "checkqueue.h" #include "init.h" #include "kernel.h" #include "masternode-budget.h" #include "masternode-payments.h" #include "masternodeman.h" #include "merkleblock.h" #include "net.h" #include "obfuscation.h" #include "pow.h" #include "spork.h" #include "sporkdb.h" #include "swifttx.h" #include "txdb.h" #include "txmempool.h" #include "ui_interface.h" #include "util.h" #include "utilmoneystr.h" #include "primitives/zerocoin.h" #include "libzerocoin/Denominations.h" #include <sstream> #include <boost/algorithm/string/replace.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/lexical_cast.hpp> #include <boost/thread.hpp> using namespace boost; using namespace std; using namespace libzerocoin; #if defined(NDEBUG) #error "Respawn cannot be compiled without assertions." #endif // 6 comes from OPCODE (1) + vch.size() (1) + BIGNUM size (4) #define SCRIPT_OFFSET 6 // For Script size (BIGNUM/Uint256 size) #define BIGNUM_SIZE 4 /** * Global state */ CCriticalSection cs_main; BlockMap mapBlockIndex; map<uint256, uint256> mapProofOfStake; set<pair<COutPoint, unsigned int> > setStakeSeen; map<unsigned int, unsigned int> mapHashedBlocks; CChain chainActive; CBlockIndex* pindexBestHeader = NULL; int64_t nTimeBestReceived = 0; CWaitableCriticalSection csBestBlock; CConditionVariable cvBlockChange; int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; bool fTxIndex = true; bool fIsBareMultisigStd = true; bool fCheckBlockIndex = false; bool fVerifyingBlocks = false; unsigned int nCoinCacheSize = 5000; bool fAlerts = DEFAULT_ALERTS; unsigned int nStakeMinAge = 60 * 60; int64_t nReserveBalance = 0; /** Fees smaller than this (in duffs) are considered zero fee (for relaying and mining) * We are ~100 times smaller then bitcoin now (2015-06-23), set minRelayTxFee only 10 times higher * so it's still 10 times lower comparing to bitcoin. */ CFeeRate minRelayTxFee = CFeeRate(10000); CTxMemPool mempool(::minRelayTxFee); struct COrphanTx { CTransaction tx; NodeId fromPeer; }; map<uint256, COrphanTx> mapOrphanTransactions; map<uint256, set<uint256> > mapOrphanTransactionsByPrev; map<uint256, int64_t> mapRejectedBlocks; void EraseOrphansFor(NodeId peer); static void CheckBlockIndex(); /** Constant stuff for coinbase transactions we create: */ CScript COINBASE_FLAGS; const string strMessageMagic = "DarkNet Signed Message:\n"; // Internal stuff namespace { struct CBlockIndexWorkComparator { bool operator()(CBlockIndex* pa, CBlockIndex* pb) const { // First sort by most total work, ... if (pa->nChainWork > pb->nChainWork) return false; if (pa->nChainWork < pb->nChainWork) return true; // ... then by earliest time received, ... if (pa->nSequenceId < pb->nSequenceId) return false; if (pa->nSequenceId > pb->nSequenceId) return true; // Use pointer address as tie breaker (should only happen with blocks // loaded from disk, as those all have id 0). if (pa < pb) return false; if (pa > pb) return true; // Identical blocks. return false; } }; CBlockIndex* pindexBestInvalid; /** * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and * as good as our current tip or better. Entries may be failed, though. */ set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates; /** Number of nodes with fSyncStarted. */ int nSyncStarted = 0; /** All pairs A->B, where A (or one if its ancestors) misses transactions, but B has transactions. */ multimap<CBlockIndex*, CBlockIndex*> mapBlocksUnlinked; CCriticalSection cs_LastBlockFile; std::vector<CBlockFileInfo> vinfoBlockFile; int nLastBlockFile = 0; /** * Every received block is assigned a unique and increasing identifier, so we * know which one to give priority in case of a fork. */ CCriticalSection cs_nBlockSequenceId; /** Blocks loaded from disk are assigned id 0, so start the counter at 1. */ uint32_t nBlockSequenceId = 1; /** * Sources of received blocks, to be able to send them reject messages or ban * them, if processing happens afterwards. Protected by cs_main. */ map<uint256, NodeId> mapBlockSource; /** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ struct QueuedBlock { uint256 hash; CBlockIndex* pindex; //! Optional. int64_t nTime; //! Time of "getdata" request in microseconds. int nValidatedQueuedBefore; //! Number of blocks queued with validated headers (globally) at the time this one is requested. bool fValidatedHeaders; //! Whether this block has validated headers at the time of request. }; map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight; /** Number of blocks in flight with validated headers. */ int nQueuedValidatedHeaders = 0; /** Number of preferable block download peers. */ int nPreferredDownload = 0; /** Dirty block index entries. */ set<CBlockIndex*> setDirtyBlockIndex; /** Dirty block file entries. */ set<int> setDirtyFileInfo; } // anon namespace ////////////////////////////////////////////////////////////////////////////// // // dispatching functions // // These functions dispatch to one or all registered wallets namespace { struct CMainSignals { /** Notifies listeners of updated transaction data (transaction, and optionally the block it is found in. */ boost::signals2::signal<void(const CTransaction&, const CBlock*)> SyncTransaction; /** Notifies listeners of an erased transaction (currently disabled, requires transaction replacement). */ // XX42 boost::signals2::signal<void(const uint256&)> EraseTransaction; /** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */ boost::signals2::signal<void(const uint256&)> UpdatedTransaction; /** Notifies listeners of a new active block chain. */ boost::signals2::signal<void(const CBlockLocator&)> SetBestChain; /** Notifies listeners about an inventory item being seen on the network. */ boost::signals2::signal<void(const uint256&)> Inventory; /** Tells listeners to broadcast their data. */ boost::signals2::signal<void()> Broadcast; /** Notifies listeners of a block validation result */ boost::signals2::signal<void(const CBlock&, const CValidationState&)> BlockChecked; } g_signals; } // anon namespace void RegisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); // XX42 g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); g_signals.Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn)); g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); } void UnregisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn)); g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); // XX42 g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); } void UnregisterAllValidationInterfaces() { g_signals.BlockChecked.disconnect_all_slots(); g_signals.Broadcast.disconnect_all_slots(); g_signals.Inventory.disconnect_all_slots(); g_signals.SetBestChain.disconnect_all_slots(); g_signals.UpdatedTransaction.disconnect_all_slots(); // XX42 g_signals.EraseTransaction.disconnect_all_slots(); g_signals.SyncTransaction.disconnect_all_slots(); } void SyncWithWallets(const CTransaction& tx, const CBlock* pblock) { g_signals.SyncTransaction(tx, pblock); } ////////////////////////////////////////////////////////////////////////////// // // Registration of network node signals. // namespace { struct CBlockReject { unsigned char chRejectCode; string strRejectReason; uint256 hashBlock; }; /** * Maintain validation-specific state about nodes, protected by cs_main, instead * by CNode's own locks. This simplifies asynchronous operation, where * processing of incoming data is done after the ProcessMessage call returns, * and we're no longer holding the node's locks. */ struct CNodeState { //! The peer's address CService address; //! Whether we have a fully established connection. bool fCurrentlyConnected; //! Accumulated misbehaviour score for this peer. int nMisbehavior; //! Whether this peer should be disconnected and banned (unless whitelisted). bool fShouldBan; //! String name of this peer (debugging/logging purposes). std::string name; //! List of asynchronously-determined block rejections to notify this peer about. std::vector<CBlockReject> rejects; //! The best known block we know this peer has announced. CBlockIndex* pindexBestKnownBlock; //! The hash of the last unknown block this peer has announced. uint256 hashLastUnknownBlock; //! The last full block we both have. CBlockIndex* pindexLastCommonBlock; //! Whether we've started headers synchronization with this peer. bool fSyncStarted; //! Since when we're stalling block download progress (in microseconds), or 0. int64_t nStallingSince; list<QueuedBlock> vBlocksInFlight; int nBlocksInFlight; //! Whether we consider this a preferred download peer. bool fPreferredDownload; CNodeState() { fCurrentlyConnected = false; nMisbehavior = 0; fShouldBan = false; pindexBestKnownBlock = NULL; hashLastUnknownBlock = uint256(0); pindexLastCommonBlock = NULL; fSyncStarted = false; nStallingSince = 0; nBlocksInFlight = 0; fPreferredDownload = false; } }; /** Map maintaining per-node state. Requires cs_main. */ map<NodeId, CNodeState> mapNodeState; // Requires cs_main. CNodeState* State(NodeId pnode) { map<NodeId, CNodeState>::iterator it = mapNodeState.find(pnode); if (it == mapNodeState.end()) return NULL; return &it->second; } int GetHeight() { while (true) { TRY_LOCK(cs_main, lockMain); if (!lockMain) { MilliSleep(50); continue; } return chainActive.Height(); } } void UpdatePreferredDownload(CNode* node, CNodeState* state) { nPreferredDownload -= state->fPreferredDownload; // Whether this node should be marked as a preferred download node. state->fPreferredDownload = (!node->fInbound || node->fWhitelisted) && !node->fOneShot && !node->fClient; nPreferredDownload += state->fPreferredDownload; } void InitializeNode(NodeId nodeid, const CNode* pnode) { LOCK(cs_main); CNodeState& state = mapNodeState.insert(std::make_pair(nodeid, CNodeState())).first->second; state.name = pnode->addrName; state.address = pnode->addr; } void FinalizeNode(NodeId nodeid) { LOCK(cs_main); CNodeState* state = State(nodeid); if (state->fSyncStarted) nSyncStarted--; if (state->nMisbehavior == 0 && state->fCurrentlyConnected) { AddressCurrentlyConnected(state->address); } BOOST_FOREACH (const QueuedBlock& entry, state->vBlocksInFlight) mapBlocksInFlight.erase(entry.hash); EraseOrphansFor(nodeid); nPreferredDownload -= state->fPreferredDownload; mapNodeState.erase(nodeid); } // Requires cs_main. void MarkBlockAsReceived(const uint256& hash) { map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); if (itInFlight != mapBlocksInFlight.end()) { CNodeState* state = State(itInFlight->second.first); nQueuedValidatedHeaders -= itInFlight->second.second->fValidatedHeaders; state->vBlocksInFlight.erase(itInFlight->second.second); state->nBlocksInFlight--; state->nStallingSince = 0; mapBlocksInFlight.erase(itInFlight); } } // Requires cs_main. void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, CBlockIndex* pindex = NULL) { CNodeState* state = State(nodeid); assert(state != NULL); // Make sure it's not listed somewhere already. MarkBlockAsReceived(hash); QueuedBlock newentry = {hash, pindex, GetTimeMicros(), nQueuedValidatedHeaders, pindex != NULL}; nQueuedValidatedHeaders += newentry.fValidatedHeaders; list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry); state->nBlocksInFlight++; mapBlocksInFlight[hash] = std::make_pair(nodeid, it); } /** Check whether the last unknown block a peer advertized is not yet known. */ void ProcessBlockAvailability(NodeId nodeid) { CNodeState* state = State(nodeid); assert(state != NULL); if (state->hashLastUnknownBlock != 0) { BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock); if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) { if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = itOld->second; state->hashLastUnknownBlock = uint256(0); } } } /** Update tracking information about which blocks a peer is assumed to have. */ void UpdateBlockAvailability(NodeId nodeid, const uint256& hash) { CNodeState* state = State(nodeid); assert(state != NULL); ProcessBlockAvailability(nodeid); BlockMap::iterator it = mapBlockIndex.find(hash); if (it != mapBlockIndex.end() && it->second->nChainWork > 0) { // An actually better block was announced. if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = it->second; } else { // An unknown block was announced; just assume that the latest one is the best one. state->hashLastUnknownBlock = hash; } } /** Find the last common ancestor two blocks have. * Both pa and pb must be non-NULL. */ CBlockIndex* LastCommonAncestor(CBlockIndex* pa, CBlockIndex* pb) { if (pa->nHeight > pb->nHeight) { pa = pa->GetAncestor(pb->nHeight); } else if (pb->nHeight > pa->nHeight) { pb = pb->GetAncestor(pa->nHeight); } while (pa != pb && pa && pb) { pa = pa->pprev; pb = pb->pprev; } // Eventually all chain branches meet at the genesis block. assert(pa == pb); return pa; } /** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has * at most count entries. */ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<CBlockIndex*>& vBlocks, NodeId& nodeStaller) { if (count == 0) return; vBlocks.reserve(vBlocks.size() + count); CNodeState* state = State(nodeid); assert(state != NULL); // Make sure pindexBestKnownBlock is up to date, we'll need it. ProcessBlockAvailability(nodeid); if (state->pindexBestKnownBlock == NULL || state->pindexBestKnownBlock->nChainWork < chainActive.Tip()->nChainWork) { // This peer has nothing interesting. return; } if (state->pindexLastCommonBlock == NULL) { // Bootstrap quickly by guessing a parent of our best tip is the forking point. // Guessing wrong in either direction is not a problem. state->pindexLastCommonBlock = chainActive[std::min(state->pindexBestKnownBlock->nHeight, chainActive.Height())]; } // If the peer reorganized, our previous pindexLastCommonBlock may not be an ancestor // of their current tip anymore. Go back enough to fix that. state->pindexLastCommonBlock = LastCommonAncestor(state->pindexLastCommonBlock, state->pindexBestKnownBlock); if (state->pindexLastCommonBlock == state->pindexBestKnownBlock) return; std::vector<CBlockIndex*> vToFetch; CBlockIndex* pindexWalk = state->pindexLastCommonBlock; // Never fetch further than the best block we know the peer has, or more than BLOCK_DOWNLOAD_WINDOW + 1 beyond the last // linked block we have in common with this peer. The +1 is so we can detect stalling, namely if we would be able to // download that next block if the window were 1 larger. int nWindowEnd = state->pindexLastCommonBlock->nHeight + BLOCK_DOWNLOAD_WINDOW; int nMaxHeight = std::min<int>(state->pindexBestKnownBlock->nHeight, nWindowEnd + 1); NodeId waitingfor = -1; while (pindexWalk->nHeight < nMaxHeight) { // Read up to 128 (or more, if more blocks than that are needed) successors of pindexWalk (towards // pindexBestKnownBlock) into vToFetch. We fetch 128, because CBlockIndex::GetAncestor may be as expensive // as iterating over ~100 CBlockIndex* entries anyway. int nToFetch = std::min(nMaxHeight - pindexWalk->nHeight, std::max<int>(count - vBlocks.size(), 128)); vToFetch.resize(nToFetch); pindexWalk = state->pindexBestKnownBlock->GetAncestor(pindexWalk->nHeight + nToFetch); vToFetch[nToFetch - 1] = pindexWalk; for (unsigned int i = nToFetch - 1; i > 0; i--) { vToFetch[i - 1] = vToFetch[i]->pprev; } // Iterate over those blocks in vToFetch (in forward direction), adding the ones that // are not yet downloaded and not in flight to vBlocks. In the mean time, update // pindexLastCommonBlock as long as all ancestors are already downloaded. BOOST_FOREACH (CBlockIndex* pindex, vToFetch) { if (!pindex->IsValid(BLOCK_VALID_TREE)) { // We consider the chain that this peer is on invalid. return; } if (pindex->nStatus & BLOCK_HAVE_DATA) { if (pindex->nChainTx) state->pindexLastCommonBlock = pindex; } else if (mapBlocksInFlight.count(pindex->GetBlockHash()) == 0) { // The block is not already downloaded, and not yet in flight. if (pindex->nHeight > nWindowEnd) { // We reached the end of the window. if (vBlocks.size() == 0 && waitingfor != nodeid) { // We aren't able to fetch anything, but we would be if the download window was one larger. nodeStaller = waitingfor; } return; } vBlocks.push_back(pindex); if (vBlocks.size() == count) { return; } } else if (waitingfor == -1) { // This is the first already-in-flight block. waitingfor = mapBlocksInFlight[pindex->GetBlockHash()].first; } } } } } // anon namespace bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) { LOCK(cs_main); CNodeState* state = State(nodeid); if (state == NULL) return false; stats.nMisbehavior = state->nMisbehavior; stats.nSyncHeight = state->pindexBestKnownBlock ? state->pindexBestKnownBlock->nHeight : -1; stats.nCommonHeight = state->pindexLastCommonBlock ? state->pindexLastCommonBlock->nHeight : -1; BOOST_FOREACH (const QueuedBlock& queue, state->vBlocksInFlight) { if (queue.pindex) stats.vHeightInFlight.push_back(queue.pindex->nHeight); } return true; } void RegisterNodeSignals(CNodeSignals& nodeSignals) { nodeSignals.GetHeight.connect(&GetHeight); nodeSignals.ProcessMessages.connect(&ProcessMessages); nodeSignals.SendMessages.connect(&SendMessages); nodeSignals.InitializeNode.connect(&InitializeNode); nodeSignals.FinalizeNode.connect(&FinalizeNode); } void UnregisterNodeSignals(CNodeSignals& nodeSignals) { nodeSignals.GetHeight.disconnect(&GetHeight); nodeSignals.ProcessMessages.disconnect(&ProcessMessages); nodeSignals.SendMessages.disconnect(&SendMessages); nodeSignals.InitializeNode.disconnect(&InitializeNode); nodeSignals.FinalizeNode.disconnect(&FinalizeNode); } CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) { // Find the first block the caller has in the main chain BOOST_FOREACH (const uint256& hash, locator.vHave) { BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; if (chain.Contains(pindex)) return pindex; } } return chain.Genesis(); } CCoinsViewCache* pcoinsTip = NULL; CBlockTreeDB* pblocktree = NULL; CZerocoinDB* zerocoinDB = NULL; CSporkDB* pSporkDB = NULL; ////////////////////////////////////////////////////////////////////////////// // // mapOrphanTransactions // bool AddOrphanTx(const CTransaction& tx, NodeId peer) { uint256 hash = tx.GetHash(); if (mapOrphanTransactions.count(hash)) return false; // Ignore big transactions, to avoid a // send-big-orphans memory exhaustion attack. If a peer has a legitimate // large transaction with a missing parent then we assume // it will rebroadcast it later, after the parent transaction(s) // have been mined or received. // 10,000 orphans, each of which is at most 5,000 bytes big is // at most 500 megabytes of orphans: unsigned int sz = tx.GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); if (sz > 5000) { LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); return false; } mapOrphanTransactions[hash].tx = tx; mapOrphanTransactions[hash].fromPeer = peer; BOOST_FOREACH (const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); LogPrint("mempool", "stored orphan tx %s (mapsz %u prevsz %u)\n", hash.ToString(), mapOrphanTransactions.size(), mapOrphanTransactionsByPrev.size()); return true; } void static EraseOrphanTx(uint256 hash) { map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.find(hash); if (it == mapOrphanTransactions.end()) return; BOOST_FOREACH (const CTxIn& txin, it->second.tx.vin) { map<uint256, set<uint256> >::iterator itPrev = mapOrphanTransactionsByPrev.find(txin.prevout.hash); if (itPrev == mapOrphanTransactionsByPrev.end()) continue; itPrev->second.erase(hash); if (itPrev->second.empty()) mapOrphanTransactionsByPrev.erase(itPrev); } mapOrphanTransactions.erase(it); } void EraseOrphansFor(NodeId peer) { int nErased = 0; map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin(); while (iter != mapOrphanTransactions.end()) { map<uint256, COrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid if (maybeErase->second.fromPeer == peer) { EraseOrphanTx(maybeErase->second.tx.GetHash()); ++nErased; } } if (nErased > 0) LogPrint("mempool", "Erased %d orphan tx from peer %d\n", nErased, peer); } unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) { unsigned int nEvicted = 0; while (mapOrphanTransactions.size() > nMaxOrphans) { // Evict a random orphan: uint256 randomhash = GetRandHash(); map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.lower_bound(randomhash); if (it == mapOrphanTransactions.end()) it = mapOrphanTransactions.begin(); EraseOrphanTx(it->first); ++nEvicted; } return nEvicted; } bool IsStandardTx(const CTransaction& tx, string& reason) { AssertLockHeld(cs_main); if (tx.nVersion > CTransaction::CURRENT_VERSION || tx.nVersion < 1) { reason = "version"; return false; } // Treat non-final transactions as non-standard to prevent a specific type // of double-spend attack, as well as DoS attacks. (if the transaction // can't be mined, the attacker isn't expending resources broadcasting it) // Basically we don't want to propagate transactions that can't be included in // the next block. // // However, IsFinalTx() is confusing... Without arguments, it uses // chainActive.Height() to evaluate nLockTime; when a block is accepted, chainActive.Height() // is set to the value of nHeight in the block. However, when IsFinalTx() // is called within CBlock::AcceptBlock(), the height of the block *being* // evaluated is what is used. Thus if we want to know if a transaction can // be part of the *next* block, we need to call IsFinalTx() with one more // than chainActive.Height(). // // Timestamps on the other hand don't get any special treatment, because we // can't know what timestamp the next block will have, and there aren't // timestamp applications where it matters. if (!IsFinalTx(tx, chainActive.Height() + 1)) { reason = "non-final"; return false; } // Extremely large transactions with lots of inputs can cost the network // almost as much to process as they cost the sender in fees, because // computing signature hashes is O(ninputs*txsize). Limiting transactions // to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks. unsigned int sz = tx.GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); unsigned int nMaxSize = tx.ContainsZerocoins() ? MAX_ZEROCOIN_TX_SIZE : MAX_STANDARD_TX_SIZE; if (sz >= nMaxSize) { reason = "tx-size"; return false; } for (const CTxIn& txin : tx.vin) { if (txin.scriptSig.IsZerocoinSpend()) continue; // Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed // keys. (remember the 520 byte limit on redeemScript size) That works // out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627 // bytes of scriptSig, which we round off to 1650 bytes for some minor // future-proofing. That's also enough to spend a 20-of-20 // CHECKMULTISIG scriptPubKey, though such a scriptPubKey is not // considered standard) if (txin.scriptSig.size() > 1650) { reason = "scriptsig-size"; return false; } if (!txin.scriptSig.IsPushOnly()) { reason = "scriptsig-not-pushonly"; return false; } } unsigned int nDataOut = 0; txnouttype whichType; BOOST_FOREACH (const CTxOut& txout, tx.vout) { if (!::IsStandard(txout.scriptPubKey, whichType)) { reason = "scriptpubkey"; return false; } if (whichType == TX_NULL_DATA) nDataOut++; else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) { reason = "bare-multisig"; return false; } else if (txout.IsDust(::minRelayTxFee)) { reason = "dust"; return false; } } // only one OP_RETURN txout is permitted if (nDataOut > 1) { reason = "multi-op-return"; return false; } return true; } bool IsFinalTx(const CTransaction& tx, int nBlockHeight, int64_t nBlockTime) { AssertLockHeld(cs_main); // Time based nLockTime implemented in 0.1.6 if (tx.nLockTime == 0) return true; if (nBlockHeight == 0) nBlockHeight = chainActive.Height(); if (nBlockTime == 0) nBlockTime = GetAdjustedTime(); if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) return true; BOOST_FOREACH (const CTxIn& txin, tx.vin) if (!txin.IsFinal()) return false; return true; } /** * Check transaction inputs to mitigate two * potential denial-of-service attacks: * * 1. scriptSigs with extra data stuffed into them, * not consumed by scriptPubKey (or P2SH script) * 2. P2SH scripts with a crazy number of expensive * CHECKSIG/CHECKMULTISIG operations */ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) { if (tx.IsCoinBase() || tx.IsZerocoinSpend()) return true; // coinbase has no inputs and zerocoinspend has a special input //todo should there be a check for a 'standard' zerocoinspend here? for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxOut& prev = mapInputs.GetOutputFor(tx.vin[i]); vector<vector<unsigned char> > vSolutions; txnouttype whichType; // get the scriptPubKey corresponding to this input: const CScript& prevScript = prev.scriptPubKey; if (!Solver(prevScript, whichType, vSolutions)) return false; int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions); if (nArgsExpected < 0) return false; // Transactions with extra stuff in their scriptSigs are // non-standard. Note that this EvalScript() call will // be quick, because if there are any operations // beside "push data" in the scriptSig // IsStandard() will have already returned false // and this method isn't called. vector<vector<unsigned char> > stack; if (!EvalScript(stack, tx.vin[i].scriptSig, false, BaseSignatureChecker())) return false; if (whichType == TX_SCRIPTHASH) { if (stack.empty()) return false; CScript subscript(stack.back().begin(), stack.back().end()); vector<vector<unsigned char> > vSolutions2; txnouttype whichType2; if (Solver(subscript, whichType2, vSolutions2)) { int tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2); if (tmpExpected < 0) return false; nArgsExpected += tmpExpected; } else { // Any other Script with less than 15 sigops OK: unsigned int sigops = subscript.GetSigOpCount(true); // ... extra data left on the stack after execution is OK, too: return (sigops <= MAX_P2SH_SIGOPS); } } if (stack.size() != (unsigned int)nArgsExpected) return false; } return true; } unsigned int GetLegacySigOpCount(const CTransaction& tx) { unsigned int nSigOps = 0; BOOST_FOREACH (const CTxIn& txin, tx.vin) { nSigOps += txin.scriptSig.GetSigOpCount(false); } BOOST_FOREACH (const CTxOut& txout, tx.vout) { nSigOps += txout.scriptPubKey.GetSigOpCount(false); } return nSigOps; } unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs) { if (tx.IsCoinBase() || tx.IsZerocoinSpend()) return 0; unsigned int nSigOps = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxOut& prevout = inputs.GetOutputFor(tx.vin[i]); if (prevout.scriptPubKey.IsPayToScriptHash()) nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig); } return nSigOps; } int GetInputAge(CTxIn& vin) { CCoinsView viewDummy; CCoinsViewCache view(&viewDummy); { LOCK(mempool.cs); CCoinsViewMemPool viewMempool(pcoinsTip, mempool); view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view const CCoins* coins = view.AccessCoins(vin.prevout.hash); if (coins) { if (coins->nHeight < 0) return 0; return (chainActive.Tip()->nHeight + 1) - coins->nHeight; } else return -1; } } int GetInputAgeIX(uint256 nTXHash, CTxIn& vin) { int sigs = 0; int nResult = GetInputAge(vin); if (nResult < 0) nResult = 0; if (nResult < 6) { std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(nTXHash); if (i != mapTxLocks.end()) { sigs = (*i).second.CountSignatures(); } if (sigs >= SWIFTTX_SIGNATURES_REQUIRED) { return nSwiftTXDepth + nResult; } } return -1; } int GetIXConfirmations(uint256 nTXHash) { int sigs = 0; std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(nTXHash); if (i != mapTxLocks.end()) { sigs = (*i).second.CountSignatures(); } if (sigs >= SWIFTTX_SIGNATURES_REQUIRED) { return nSwiftTXDepth; } return 0; } // ppcoin: total coin age spent in transaction, in the unit of coin-days. // Only those coins meeting minimum age requirement counts. As those // transactions not in main chain are not currently indexed so we // might not find out about their coin age. Older transactions are // guaranteed to be in main chain by sync-checkpoint. This rule is // introduced to help nodes establish a consistent view of the coin // age (trust score) of competing branches. bool GetCoinAge(const CTransaction& tx, const unsigned int nTxTime, uint64_t& nCoinAge) { uint256 bnCentSecond = 0; // coin age in the unit of cent-seconds nCoinAge = 0; CBlockIndex* pindex = NULL; BOOST_FOREACH (const CTxIn& txin, tx.vin) { // First try finding the previous transaction in database CTransaction txPrev; uint256 hashBlockPrev; if (!GetTransaction(txin.prevout.hash, txPrev, hashBlockPrev, true)) { LogPrintf("GetCoinAge: failed to find vin transaction \n"); continue; // previous transaction not in main chain } BlockMap::iterator it = mapBlockIndex.find(hashBlockPrev); if (it != mapBlockIndex.end()) pindex = it->second; else { LogPrintf("GetCoinAge() failed to find block index \n"); continue; } // Read block header CBlockHeader prevblock = pindex->GetBlockHeader(); if (prevblock.nTime + nStakeMinAge > nTxTime) continue; // only count coins meeting min age requirement if (nTxTime < prevblock.nTime) { LogPrintf("GetCoinAge: Timestamp Violation: txtime less than txPrev.nTime"); return false; // Transaction timestamp violation } int64_t nValueIn = txPrev.vout[txin.prevout.n].nValue; bnCentSecond += uint256(nValueIn) * (nTxTime - prevblock.nTime); } uint256 bnCoinDay = bnCentSecond / COIN / (24 * 60 * 60); LogPrintf("coin age bnCoinDay=%s\n", bnCoinDay.ToString().c_str()); nCoinAge = bnCoinDay.GetCompact(); return true; } bool MoneyRange(CAmount nValueOut) { return nValueOut >= 0 && nValueOut <= Params().MaxMoneyOut(); } int GetZerocoinStartHeight() { return Params().Zerocoin_StartHeight(); } void FindMints(vector<CZerocoinMint> vMintsToFind, vector<CZerocoinMint>& vMintsToUpdate, vector<CZerocoinMint>& vMissingMints, bool fExtendedSearch) { // see which mints are in our public zerocoin database. The mint should be here if it exists, unless // something went wrong for (CZerocoinMint mint : vMintsToFind) { uint256 txHash; if (!zerocoinDB->ReadCoinMint(mint.GetValue(), txHash)) { vMissingMints.push_back(mint); continue; } // make sure the txhash and block height meta data are correct for this mint CTransaction tx; uint256 hashBlock; if (!GetTransaction(txHash, tx, hashBlock, true)) { LogPrintf("%s : cannot find tx %s\n", __func__, txHash.GetHex()); vMissingMints.push_back(mint); continue; } if (!mapBlockIndex.count(hashBlock)) { LogPrintf("%s : cannot find block %s\n", __func__, hashBlock.GetHex()); vMissingMints.push_back(mint); continue; } //see if this mint is spent uint256 hashTxSpend = 0; zerocoinDB->ReadCoinSpend(mint.GetSerialNumber(), hashTxSpend); bool fSpent = hashTxSpend != 0; //if marked as spent, check that it actually made it into the chain CTransaction txSpend; uint256 hashBlockSpend; if (fSpent && !GetTransaction(hashTxSpend, txSpend, hashBlockSpend, true)) { LogPrintf("%s : cannot find spend tx %s\n", __func__, hashTxSpend.GetHex()); zerocoinDB->EraseCoinSpend(mint.GetSerialNumber()); mint.SetUsed(false); vMintsToUpdate.push_back(mint); continue; } //The mint has been incorrectly labelled as spent in zerocoinDB and needs to be undone int nHeightTx = 0; if (fSpent && !IsSerialInBlockchain(mint.GetSerialNumber(), nHeightTx)) { LogPrintf("%s : cannot find block %s. Erasing coinspend from zerocoinDB.\n", __func__, hashBlockSpend.GetHex()); zerocoinDB->EraseCoinSpend(mint.GetSerialNumber()); mint.SetUsed(false); vMintsToUpdate.push_back(mint); continue; } // if meta data is correct, then no need to update if (mint.GetTxHash() == txHash && mint.GetHeight() == mapBlockIndex[hashBlock]->nHeight && mint.IsUsed() == fSpent) continue; //mark this mint for update mint.SetTxHash(txHash); mint.SetHeight(mapBlockIndex[hashBlock]->nHeight); mint.SetUsed(fSpent); vMintsToUpdate.push_back(mint); } if (fExtendedSearch) { // search the blockchain for the meta data on our missing mints int nZerocoinStartHeight = GetZerocoinStartHeight(); for (int i = nZerocoinStartHeight; i < chainActive.Height(); i++) { if(i % 1000 == 0) LogPrintf("%s : scanned %d blocks\n", __func__, i - nZerocoinStartHeight); if(chainActive[i]->vMintDenominationsInBlock.empty()) continue; CBlock block; if(!ReadBlockFromDisk(block, chainActive[i])) continue; list<CZerocoinMint> vMints; if(!BlockToZerocoinMintList(block, vMints)) continue; // search the blocks mints to see if it contains the mint that is requesting meta data updates for (CZerocoinMint mintBlockChain : vMints) { for (CZerocoinMint mintMissing : vMissingMints) { if (mintMissing.GetValue() == mintBlockChain.GetValue()) { LogPrintf("%s FOUND %s in block %d\n", __func__, mintMissing.GetValue().GetHex(), i); mintMissing.SetHeight(i); mintMissing.SetTxHash(mintBlockChain.GetTxHash()); vMintsToUpdate.push_back(mintMissing); } } } } } //remove any missing mints that were found for (CZerocoinMint mintMissing : vMissingMints) { for (CZerocoinMint mintFound : vMintsToUpdate) { if (mintMissing.GetValue() == mintFound.GetValue()) std::remove(vMissingMints.begin(), vMissingMints.end(), mintMissing); } } } bool GetZerocoinMint(const CBigNum& bnPubcoin, uint256& txHash) { txHash = 0; return zerocoinDB->ReadCoinMint(bnPubcoin, txHash); } bool IsSerialKnown(const CBigNum& bnSerial) { uint256 txHash = 0; return zerocoinDB->ReadCoinSpend(bnSerial, txHash); } bool IsSerialInBlockchain(const CBigNum& bnSerial, int& nHeightTx) { uint256 txHash = 0; // if not in zerocoinDB then its not in the blockchain if (!zerocoinDB->ReadCoinSpend(bnSerial, txHash)) return false; CTransaction tx; uint256 hashBlock; if (!GetTransaction(txHash, tx, hashBlock, true)) return false; bool inChain = mapBlockIndex.count(hashBlock) && chainActive.Contains(mapBlockIndex[hashBlock]); if (inChain) nHeightTx = mapBlockIndex.at(hashBlock)->nHeight; return inChain; } bool RemoveSerialFromDB(const CBigNum& bnSerial) { return zerocoinDB->EraseCoinSpend(bnSerial); } /** zerocoin transaction checks */ bool RecordMintToDB(PublicCoin publicZerocoin, const uint256& txHash) { //Check the pubCoinValue didn't already store in the zerocoin database. todo: pubcoin memory map? //write the zerocoinmint to db if we don't already have it //note that many of the mint parameters are not set here because those params are private to the minter CZerocoinMint pubCoinTx; uint256 hashFromDB; if (zerocoinDB->ReadCoinMint(publicZerocoin.getValue(), hashFromDB)) { if(hashFromDB == txHash) return true; LogPrintf("RecordMintToDB: failed, we already have this public coin recorded\n"); return false; } if (!zerocoinDB->WriteCoinMint(publicZerocoin, txHash)) { LogPrintf("RecordMintToDB: failed to record public coin to DB\n"); return false; } return true; } bool TxOutToPublicCoin(const CTxOut txout, PublicCoin& pubCoin, CValidationState& state) { CBigNum publicZerocoin; vector<unsigned char> vchZeroMint; vchZeroMint.insert(vchZeroMint.end(), txout.scriptPubKey.begin() + SCRIPT_OFFSET, txout.scriptPubKey.begin() + txout.scriptPubKey.size()); publicZerocoin.setvch(vchZeroMint); CoinDenomination denomination = AmountToZerocoinDenomination(txout.nValue); LogPrint("zero", "%s ZCPRINT denomination %d pubcoin %s\n", __func__, denomination, publicZerocoin.GetHex()); if (denomination == ZQ_ERROR) return state.DoS(100, error("TxOutToPublicCoin : txout.nValue is not correct")); PublicCoin checkPubCoin(Params().Zerocoin_Params(), publicZerocoin, denomination); pubCoin = checkPubCoin; return true; } bool BlockToPubcoinList(const CBlock& block, list<PublicCoin>& listPubcoins) { for (const CTransaction tx : block.vtx) { if(!tx.IsZerocoinMint()) continue; for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut txOut = tx.vout[i]; if(!txOut.scriptPubKey.IsZerocoinMint()) continue; CValidationState state; PublicCoin pubCoin(Params().Zerocoin_Params()); if(!TxOutToPublicCoin(txOut, pubCoin, state)) return false; listPubcoins.emplace_back(pubCoin); } } return true; } //return a list of zerocoin mints contained in a specific block bool BlockToZerocoinMintList(const CBlock& block, std::list<CZerocoinMint>& vMints) { for (const CTransaction tx : block.vtx) { if(!tx.IsZerocoinMint()) continue; for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut txOut = tx.vout[i]; if(!txOut.scriptPubKey.IsZerocoinMint()) continue; CValidationState state; PublicCoin pubCoin(Params().Zerocoin_Params()); if(!TxOutToPublicCoin(txOut, pubCoin, state)) return false; CZerocoinMint mint = CZerocoinMint(pubCoin.getDenomination(), pubCoin.getValue(), 0, 0, false); mint.SetTxHash(tx.GetHash()); vMints.push_back(mint); } } return true; } bool BlockToMintValueVector(const CBlock& block, const CoinDenomination denom, vector<CBigNum>& vValues) { for (const CTransaction tx : block.vtx) { if(!tx.IsZerocoinMint()) continue; for (const CTxOut txOut : tx.vout) { if(!txOut.scriptPubKey.IsZerocoinMint()) continue; CValidationState state; PublicCoin coin(Params().Zerocoin_Params()); if(!TxOutToPublicCoin(txOut, coin, state)) return false; if (coin.getDenomination() != denom) continue; vValues.push_back(coin.getValue()); } } return true; } //return a list of zerocoin spends contained in a specific block, list may have many denominations std::list<libzerocoin::CoinDenomination> ZerocoinSpendListFromBlock(const CBlock& block) { std::list<libzerocoin::CoinDenomination> vSpends; for (const CTransaction tx : block.vtx) { if (!tx.IsZerocoinSpend()) continue; for (const CTxIn txin : tx.vin) { if (!txin.scriptSig.IsZerocoinSpend()) continue; libzerocoin::CoinDenomination c = libzerocoin::IntToZerocoinDenomination(txin.nSequence); vSpends.push_back(c); } } return vSpends; } bool CheckZerocoinMint(const uint256& txHash, const CTxOut& txout, CValidationState& state, bool fCheckOnly) { PublicCoin pubCoin(Params().Zerocoin_Params()); if(!TxOutToPublicCoin(txout, pubCoin, state)) return state.DoS(100, error("CheckZerocoinMint(): TxOutToPublicCoin() failed")); if (!pubCoin.validate()) return state.DoS(100, error("CheckZerocoinMint() : PubCoin does not validate\n")); if(!fCheckOnly && !RecordMintToDB(pubCoin, txHash)) return state.DoS(100, error("CheckZerocoinMint(): RecordMintToDB() failed")); return true; } CoinSpend TxInToZerocoinSpend(const CTxIn& txin) { // Deserialize the CoinSpend intro a fresh object std::vector<char, zero_after_free_allocator<char> > dataTxIn; dataTxIn.insert(dataTxIn.end(), txin.scriptSig.begin() + BIGNUM_SIZE, txin.scriptSig.end()); CDataStream serializedCoinSpend(dataTxIn, SER_NETWORK, PROTOCOL_VERSION); return CoinSpend(Params().Zerocoin_Params(), serializedCoinSpend); } bool IsZerocoinSpendUnknown(CoinSpend coinSpend, uint256 hashTx, CValidationState& state) { uint256 hashTxFromDB; if(zerocoinDB->ReadCoinSpend(coinSpend.getCoinSerialNumber(), hashTxFromDB)) return hashTx == hashTxFromDB; if(!zerocoinDB->WriteCoinSpend(coinSpend.getCoinSerialNumber(), hashTx)) return state.DoS(100, error("CheckZerocoinSpend(): Failed to write zerocoin mint to database")); return true; } bool CheckZerocoinSpend(const CTransaction tx, bool fVerifySignature, CValidationState& state) { //max needed non-mint outputs should be 2 - one for redemption address and a possible 2nd for change if (tx.vout.size() > 2) { int outs = 0; for (const CTxOut out : tx.vout) { if (out.IsZerocoinMint()) continue; outs++; } if (outs > 2) return state.DoS(100, error("CheckZerocoinSpend(): over two non-mint outputs in a zerocoinspend transaction")); } //compute the txout hash that is used for the zerocoinspend signatures CMutableTransaction txTemp; for (const CTxOut out : tx.vout) { txTemp.vout.push_back(out); } uint256 hashTxOut = txTemp.GetHash(); bool fValidated = false; set<CBigNum> serials; list<CoinSpend> vSpends; CAmount nTotalRedeemed = 0; for (const CTxIn& txin : tx.vin) { //only check txin that is a zcspend if (!txin.scriptSig.IsZerocoinSpend()) continue; CoinSpend newSpend = TxInToZerocoinSpend(txin); vSpends.push_back(newSpend); //check that the denomination is valid if (newSpend.getDenomination() == ZQ_ERROR) return state.DoS(100, error("Zerocoinspend does not have the correct denomination")); //check that denomination is what it claims to be in nSequence if (newSpend.getDenomination() != txin.nSequence) return state.DoS(100, error("Zerocoinspend nSequence denomination does not match CoinSpend")); //make sure the txout has not changed if (newSpend.getTxOutHash() != hashTxOut) return state.DoS(100, error("Zerocoinspend does not use the same txout that was used in the SoK")); // Skip signature verification during initial block download if (fVerifySignature) { //see if we have record of the accumulator used in the spend tx CBigNum bnAccumulatorValue = 0; if(!zerocoinDB->ReadAccumulatorValue(newSpend.getAccumulatorChecksum(), bnAccumulatorValue)) return state.DoS(100, error("Zerocoinspend could not find accumulator associated with checksum")); Accumulator accumulator(Params().Zerocoin_Params(), newSpend.getDenomination(), bnAccumulatorValue); //Check that the coin is on the accumulator if(!newSpend.Verify(accumulator)) return state.DoS(100, error("CheckZerocoinSpend(): zerocoin spend did not verify")); } if (serials.count(newSpend.getCoinSerialNumber())) return state.DoS(100, error("Zerocoinspend serial is used twice in the same tx")); serials.insert(newSpend.getCoinSerialNumber()); //make sure that there is no over redemption of coins nTotalRedeemed += ZerocoinDenominationToAmount(newSpend.getDenomination()); fValidated = true; } if (nTotalRedeemed < tx.GetValueOut()) { LogPrintf("redeemed = %s , spend = %s \n", FormatMoney(nTotalRedeemed), FormatMoney(tx.GetValueOut())); return state.DoS(100, error("Transaction spend more than was redeemed in zerocoins")); } // Send signal to wallet if this is ours if (pwalletMain) { CWalletDB walletdb(pwalletMain->strWalletFile); list <CBigNum> listMySerials = walletdb.ListMintedCoinsSerial(); for (const auto& newSpend : vSpends) { list<CBigNum>::iterator it = find(listMySerials.begin(), listMySerials.end(), newSpend.getCoinSerialNumber()); if (it != listMySerials.end()) { LogPrintf("%s: %s detected spent zerocoin mint in transaction %s \n", __func__, it->GetHex(), tx.GetHash().GetHex()); pwalletMain->NotifyZerocoinChanged(pwalletMain, it->GetHex(), "Used", CT_UPDATED); } } } return fValidated; } bool CheckTransaction(const CTransaction& tx, bool fZerocoinActive, bool fRejectBadUTXO, CValidationState& state) { // Basic checks that don't depend on any context if (tx.vin.empty()) return state.DoS(10, error("CheckTransaction() : vin empty"), REJECT_INVALID, "bad-txns-vin-empty"); if (tx.vout.empty()) return state.DoS(10, error("CheckTransaction() : vout empty"), REJECT_INVALID, "bad-txns-vout-empty"); // Size limits unsigned int nMaxSize = MAX_ZEROCOIN_TX_SIZE; if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > nMaxSize) return state.DoS(100, error("CheckTransaction() : size limits failed"), REJECT_INVALID, "bad-txns-oversize"); // Check for negative or overflow output values CAmount nValueOut = 0; int nZCSpendCount = 0; BOOST_FOREACH (const CTxOut& txout, tx.vout) { if (txout.IsEmpty() && !tx.IsCoinBase() && !tx.IsCoinStake()) return state.DoS(100, error("CheckTransaction(): txout empty for user transaction")); if (txout.nValue < 0) return state.DoS(100, error("CheckTransaction() : txout.nValue negative"), REJECT_INVALID, "bad-txns-vout-negative"); if (txout.nValue > Params().MaxMoneyOut()) return state.DoS(100, error("CheckTransaction() : txout.nValue too high"), REJECT_INVALID, "bad-txns-vout-toolarge"); nValueOut += txout.nValue; if (!MoneyRange(nValueOut)) return state.DoS(100, error("CheckTransaction() : txout total out of range"), REJECT_INVALID, "bad-txns-txouttotal-toolarge"); if (fZerocoinActive && txout.IsZerocoinMint()) { if(!CheckZerocoinMint(tx.GetHash(), txout, state, false)) { if (fRejectBadUTXO) return state.DoS(100, error("CheckTransaction() : invalid zerocoin mint")); } } if (fZerocoinActive && txout.scriptPubKey.IsZerocoinSpend()) nZCSpendCount++; } if (fZerocoinActive) { if (nZCSpendCount > Params().Zerocoin_MaxSpendsPerTransaction()) return state.DoS(100, error("CheckTransaction() : there are more zerocoin spends than are allowed in one transaction")); if (tx.IsZerocoinSpend()) { //require that a zerocoinspend only has inputs that are zerocoins for (const CTxIn in : tx.vin) { if (!in.scriptSig.IsZerocoinSpend()) return state.DoS(100, error("CheckTransaction() : zerocoinspend contains inputs that are not zerocoins")); } // Do not require signature verification if this is initial sync and a block over 24 hours old bool fVerifySignature = !IsInitialBlockDownload() && (GetTime() - chainActive.Tip()->GetBlockTime() < (60*60*24)); if (!CheckZerocoinSpend(tx, fVerifySignature, state)) return state.DoS(100, error("CheckTransaction() : invalid zerocoin spend")); } } // Check for duplicate inputs set<COutPoint> vInOutPoints; set<CBigNum> vZerocoinSpendSerials; for (const CTxIn& txin : tx.vin) { if (vInOutPoints.count(txin.prevout)) return state.DoS(100, error("CheckTransaction() : duplicate inputs"), REJECT_INVALID, "bad-txns-inputs-duplicate"); //duplicate zcspend serials are checked in CheckZerocoinSpend() if (!txin.scriptSig.IsZerocoinSpend()) vInOutPoints.insert(txin.prevout); } if (tx.IsCoinBase()) { if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 150) return state.DoS(100, error("CheckTransaction() : coinbase script size=%d", tx.vin[0].scriptSig.size()), REJECT_INVALID, "bad-cb-length"); } else if (fZerocoinActive && tx.IsZerocoinSpend()) { if(tx.vin.size() < 1 || static_cast<int>(tx.vin.size()) > Params().Zerocoin_MaxSpendsPerTransaction()) return state.DoS(10, error("CheckTransaction() : Zerocoin Spend has more than allowed txin's"), REJECT_INVALID, "bad-zerocoinspend"); } else { BOOST_FOREACH (const CTxIn& txin, tx.vin) if (txin.prevout.IsNull() && (fZerocoinActive && !txin.scriptSig.IsZerocoinSpend())) return state.DoS(10, error("CheckTransaction() : prevout is null"), REJECT_INVALID, "bad-txns-prevout-null"); } return true; } bool CheckFinalTx(const CTransaction& tx, int flags) { AssertLockHeld(cs_main); // By convention a negative value for flags indicates that the // current network-enforced consensus rules should be used. In // a future soft-fork scenario that would mean checking which // rules would be enforced for the next block and setting the // appropriate flags. At the present time no soft-forks are // scheduled, so no flags are set. flags = std::max(flags, 0); // CheckFinalTx() uses chainActive.Height()+1 to evaluate // nLockTime because when IsFinalTx() is called within // CBlock::AcceptBlock(), the height of the block *being* // evaluated is what is used. Thus if we want to know if a // transaction can be part of the *next* block, we need to call // IsFinalTx() with one more than chainActive.Height(). const int nBlockHeight = chainActive.Height() + 1; // BIP113 will require that time-locked transactions have nLockTime set to // less than the median time of the previous block they're contained in. // When the next block is created its previous block will be the current // chain tip, so we use that to calculate the median time passed to // IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set. const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime(); return IsFinalTx(tx, nBlockHeight, nBlockTime); } CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree) { { LOCK(mempool.cs); uint256 hash = tx.GetHash(); double dPriorityDelta = 0; CAmount nFeeDelta = 0; mempool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta); if (dPriorityDelta > 0 || nFeeDelta > 0) return 0; } CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes); if (fAllowFree) { // There is a free transaction area in blocks created by most miners, // * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000 // to be considered to fall into this category. We don't want to encourage sending // multiple transactions instead of one big transaction to avoid fees. if (nBytes < (DEFAULT_BLOCK_PRIORITY_SIZE - 1000)) nMinFee = 0; } if (!MoneyRange(nMinFee)) nMinFee = Params().MaxMoneyOut(); return nMinFee; } bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransaction& tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee, bool ignoreFees) { AssertLockHeld(cs_main); if (pfMissingInputs) *pfMissingInputs = false; //Temporarily disable zerocoin for maintenance if (GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && tx.ContainsZerocoins()) return state.DoS(10, error("AcceptToMemoryPool : Zerocoin transactions are temporarily disabled for maintenance"), REJECT_INVALID, "bad-tx"); if (!CheckTransaction(tx, chainActive.Height() >= Params().Zerocoin_AccumulatorStartHeight(), true, state)) return state.DoS(100, error("AcceptToMemoryPool: : CheckTransaction failed"), REJECT_INVALID, "bad-tx"); // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) return state.DoS(100, error("AcceptToMemoryPool: : coinbase as individual tx"), REJECT_INVALID, "coinbase"); //Coinstake is also only valid in a block, not as a loose transaction if (tx.IsCoinStake()) return state.DoS(100, error("AcceptToMemoryPool: coinstake as individual tx"), REJECT_INVALID, "coinstake"); // Rather not work on nonstandard transactions (unless -testnet/-regtest) string reason; if (Params().RequireStandard() && !IsStandardTx(tx, reason)) return state.DoS(0, error("AcceptToMemoryPool : nonstandard transaction: %s", reason), REJECT_NONSTANDARD, reason); // is it already in the memory pool? uint256 hash = tx.GetHash(); if (pool.exists(hash)) { LogPrintf("%s tx already in mempool\n", __func__); return false; } // ----------- swiftTX transaction scanning ----------- BOOST_FOREACH (const CTxIn& in, tx.vin) { if (mapLockedInputs.count(in.prevout)) { if (mapLockedInputs[in.prevout] != tx.GetHash()) { return state.DoS(0, error("AcceptToMemoryPool : conflicts with existing transaction lock: %s", reason), REJECT_INVALID, "tx-lock-conflict"); } } } // Check for conflicts with in-memory transactions if (!tx.IsZerocoinSpend()) { LOCK(pool.cs); // protect pool.mapNextTx for (unsigned int i = 0; i < tx.vin.size(); i++) { COutPoint outpoint = tx.vin[i].prevout; if (pool.mapNextTx.count(outpoint)) { // Disable replacement feature for now return false; } } } { CCoinsView dummy; CCoinsViewCache view(&dummy); CAmount nValueIn = 0; if(tx.IsZerocoinSpend()){ nValueIn = tx.GetZerocoinSpent(); //Check that txid is not already in the chain int nHeightTx = 0; if (IsTransactionInChain(tx.GetHash(), nHeightTx)) return state.Invalid(error("AcceptToMemoryPool : zRsp spend tx %s already in block %d", tx.GetHash().GetHex(), nHeightTx), REJECT_DUPLICATE, "bad-txns-inputs-spent"); //Check for double spending of serial #'s for (const CTxIn& txIn : tx.vin) { if (!txIn.scriptSig.IsZerocoinSpend()) continue; CoinSpend spend = TxInToZerocoinSpend(txIn); int nHeightTx = 0; if (IsSerialInBlockchain(spend.getCoinSerialNumber(), nHeightTx)) return state.Invalid(error("%s : zRsp spend with serial %s is already in block %d\n", __func__, spend.getCoinSerialNumber().GetHex(), nHeightTx)); //Is serial in the acceptable range if (!spend.HasValidSerial(Params().Zerocoin_Params())) return state.Invalid(error("%s : zRsp spend with serial %s from tx %s is not in valid range\n", __func__, spend.getCoinSerialNumber().GetHex(), tx.GetHash().GetHex())); } } else { LOCK(pool.cs); CCoinsViewMemPool viewMemPool(pcoinsTip, pool); view.SetBackend(viewMemPool); // do we already have it? if (view.HaveCoins(hash)) return false; // do all inputs exist? // Note that this does not check for the presence of actual outputs (see the next check for that), // only helps filling in pfMissingInputs (to determine missing vs spent). for (const CTxIn txin : tx.vin) { if (!view.HaveCoins(txin.prevout.hash)) { if (pfMissingInputs) *pfMissingInputs = true; return false; } } // are the actual inputs available? if (!view.HaveInputs(tx)) return state.Invalid(error("AcceptToMemoryPool : inputs already spent"), REJECT_DUPLICATE, "bad-txns-inputs-spent"); // Bring the best block into scope view.GetBestBlock(); nValueIn = view.GetValueIn(tx); // we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool view.SetBackend(dummy); } // Check for non-standard pay-to-script-hash in inputs if (Params().RequireStandard() && !AreInputsStandard(tx, view)) return error("AcceptToMemoryPool: : nonstandard transaction input"); // Check that the transaction doesn't have an excessive number of // sigops, making it impossible to mine. Since the coinbase transaction // itself can contain sigops MAX_TX_SIGOPS is less than // MAX_BLOCK_SIGOPS; we still consider this an invalid rather than // merely non-standard transaction. if (!tx.IsZerocoinSpend()) { unsigned int nSigOps = GetLegacySigOpCount(tx); unsigned int nMaxSigOps = MAX_TX_SIGOPS_CURRENT; nSigOps += GetP2SHSigOpCount(tx, view); if(nSigOps > nMaxSigOps) return state.DoS(0, error("AcceptToMemoryPool : too many sigops %s, %d > %d", hash.ToString(), nSigOps, nMaxSigOps), REJECT_NONSTANDARD, "bad-txns-too-many-sigops"); } CAmount nValueOut = tx.GetValueOut(); CAmount nFees = nValueIn - nValueOut; double dPriority = 0; if (!tx.IsZerocoinSpend()) view.GetPriority(tx, chainActive.Height()); CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height()); unsigned int nSize = entry.GetTxSize(); // Don't accept it if it can't get into a block // but prioritise dstx and don't check fees for it if (mapObfuscationBroadcastTxes.count(hash)) { mempool.PrioritiseTransaction(hash, hash.ToString(), 1000, 0.1 * COIN); } else if (!ignoreFees) { CAmount txMinFee = GetMinRelayFee(tx, nSize, true); if (fLimitFree && nFees < txMinFee && !tx.IsZerocoinSpend()) return state.DoS(0, error("AcceptToMemoryPool : not enough fees %s, %d < %d", hash.ToString(), nFees, txMinFee), REJECT_INSUFFICIENTFEE, "insufficient fee"); // Require that free transactions have sufficient priority to be mined in the next block. if (tx.IsZerocoinMint()) { if(nFees < Params().Zerocoin_MintFee() * tx.GetZerocoinMintCount()) return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient fee for zerocoinmint"); } else if (!tx.IsZerocoinSpend() && GetBoolArg("-relaypriority", true) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))) { return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority"); } // Continuously rate-limit free (really, very-low-fee) transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make others' transactions take longer to confirm. if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsZerocoinSpend()) { static CCriticalSection csFreeLimiter; static double dFreeCount; static int64_t nLastTime; int64_t nNow = GetTime(); LOCK(csFreeLimiter); // Use an exponentially decaying ~10-minute window: dFreeCount *= pow(1.0 - 1.0 / 600.0, (double)(nNow - nLastTime)); nLastTime = nNow; // -limitfreerelay unit is thousand-bytes-per-minute // At default rate it would take over a month to fill 1GB if (dFreeCount >= GetArg("-limitfreerelay", 30) * 10 * 1000) return state.DoS(0, error("AcceptToMemoryPool : free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction"); LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount + nSize); dFreeCount += nSize; } } if (fRejectInsaneFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000) return error("AcceptToMemoryPool: : insane fees %s, %d > %d", hash.ToString(), nFees, ::minRelayTxFee.GetFee(nSize) * 10000); // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!CheckInputs(tx, state, view, true, STANDARD_SCRIPT_VERIFY_FLAGS, true)) { return error("AcceptToMemoryPool: : ConnectInputs failed %s", hash.ToString()); } // Check again against just the consensus-critical mandatory script // verification flags, in case of bugs in the standard flags that cause // transactions to pass as valid when they're actually invalid. For // instance the STRICTENC flag was incorrectly allowing certain // CHECKSIG NOT scripts to pass, even though they were invalid. // // There is a similar check in CreateNewBlock() to prevent creating // invalid blocks, however allowing such transactions into the mempool // can be exploited as a DoS attack. if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) { return error("AcceptToMemoryPool: : BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); } // Store transaction in memory pool.addUnchecked(hash, entry); } SyncWithWallets(tx, NULL); return true; } bool AcceptableInputs(CTxMemPool& pool, CValidationState& state, const CTransaction& tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee, bool isDSTX) { AssertLockHeld(cs_main); if (pfMissingInputs) *pfMissingInputs = false; if (!CheckTransaction(tx, chainActive.Height() >= Params().Zerocoin_AccumulatorStartHeight(), true, state)) return error("AcceptableInputs: : CheckTransaction failed"); // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) return state.DoS(100, error("AcceptableInputs: : coinbase as individual tx"), REJECT_INVALID, "coinbase"); // Rather not work on nonstandard transactions (unless -testnet/-regtest) string reason; // for any real tx this will be checked on AcceptToMemoryPool anyway // if (Params().RequireStandard() && !IsStandardTx(tx, reason)) // return state.DoS(0, // error("AcceptableInputs : nonstandard transaction: %s", reason), // REJECT_NONSTANDARD, reason); // is it already in the memory pool? uint256 hash = tx.GetHash(); if (pool.exists(hash)) return false; // ----------- swiftTX transaction scanning ----------- BOOST_FOREACH (const CTxIn& in, tx.vin) { if (mapLockedInputs.count(in.prevout)) { if (mapLockedInputs[in.prevout] != tx.GetHash()) { return state.DoS(0, error("AcceptableInputs : conflicts with existing transaction lock: %s", reason), REJECT_INVALID, "tx-lock-conflict"); } } } // Check for conflicts with in-memory transactions if (!tx.IsZerocoinSpend()) { LOCK(pool.cs); // protect pool.mapNextTx for (unsigned int i = 0; i < tx.vin.size(); i++) { COutPoint outpoint = tx.vin[i].prevout; if (pool.mapNextTx.count(outpoint)) { // Disable replacement feature for now return false; } } } { CCoinsView dummy; CCoinsViewCache view(&dummy); CAmount nValueIn = 0; { LOCK(pool.cs); CCoinsViewMemPool viewMemPool(pcoinsTip, pool); view.SetBackend(viewMemPool); // do we already have it? if (view.HaveCoins(hash)) return false; // do all inputs exist? // Note that this does not check for the presence of actual outputs (see the next check for that), // only helps filling in pfMissingInputs (to determine missing vs spent). for (const CTxIn txin : tx.vin) { if (!view.HaveCoins(txin.prevout.hash)) { if (pfMissingInputs) *pfMissingInputs = true; return false; } } // are the actual inputs available? if (!view.HaveInputs(tx)) return state.Invalid(error("AcceptableInputs : inputs already spent"), REJECT_DUPLICATE, "bad-txns-inputs-spent"); // Bring the best block into scope view.GetBestBlock(); nValueIn = view.GetValueIn(tx); // we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool view.SetBackend(dummy); } // Check for non-standard pay-to-script-hash in inputs // for any real tx this will be checked on AcceptToMemoryPool anyway // if (Params().RequireStandard() && !AreInputsStandard(tx, view)) // return error("AcceptableInputs: : nonstandard transaction input"); // Check that the transaction doesn't have an excessive number of // sigops, making it impossible to mine. Since the coinbase transaction // itself can contain sigops MAX_TX_SIGOPS is less than // MAX_BLOCK_SIGOPS; we still consider this an invalid rather than // merely non-standard transaction. unsigned int nSigOps = GetLegacySigOpCount(tx); unsigned int nMaxSigOps = MAX_TX_SIGOPS_CURRENT; nSigOps += GetP2SHSigOpCount(tx, view); if (nSigOps > nMaxSigOps) return state.DoS(0, error("AcceptableInputs : too many sigops %s, %d > %d", hash.ToString(), nSigOps, nMaxSigOps), REJECT_NONSTANDARD, "bad-txns-too-many-sigops"); CAmount nValueOut = tx.GetValueOut(); CAmount nFees = nValueIn - nValueOut; double dPriority = view.GetPriority(tx, chainActive.Height()); CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height()); unsigned int nSize = entry.GetTxSize(); // Don't accept it if it can't get into a block // but prioritise dstx and don't check fees for it if (isDSTX) { mempool.PrioritiseTransaction(hash, hash.ToString(), 1000, 0.1 * COIN); } else { // same as !ignoreFees for AcceptToMemoryPool CAmount txMinFee = GetMinRelayFee(tx, nSize, true); if (fLimitFree && nFees < txMinFee && !tx.IsZerocoinSpend()) return state.DoS(0, error("AcceptableInputs : not enough fees %s, %d < %d", hash.ToString(), nFees, txMinFee), REJECT_INSUFFICIENTFEE, "insufficient fee"); // Require that free transactions have sufficient priority to be mined in the next block. if (GetBoolArg("-relaypriority", true) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))) { return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority"); } // Continuously rate-limit free (really, very-low-fee) transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make others' transactions take longer to confirm. if (fLimitFree && nFees < ::minRelayTxFee.GetFee(nSize) && !tx.IsZerocoinSpend()) { static CCriticalSection csFreeLimiter; static double dFreeCount; static int64_t nLastTime; int64_t nNow = GetTime(); LOCK(csFreeLimiter); // Use an exponentially decaying ~10-minute window: dFreeCount *= pow(1.0 - 1.0 / 600.0, (double)(nNow - nLastTime)); nLastTime = nNow; // -limitfreerelay unit is thousand-bytes-per-minute // At default rate it would take over a month to fill 1GB if (dFreeCount >= GetArg("-limitfreerelay", 30) * 10 * 1000) return state.DoS(0, error("AcceptableInputs : free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction"); LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount + nSize); dFreeCount += nSize; } } if (fRejectInsaneFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000) return error("AcceptableInputs: : insane fees %s, %d > %d", hash.ToString(), nFees, ::minRelayTxFee.GetFee(nSize) * 10000); // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!CheckInputs(tx, state, view, false, STANDARD_SCRIPT_VERIFY_FLAGS, true)) { return error("AcceptableInputs: : ConnectInputs failed %s", hash.ToString()); } // Check again against just the consensus-critical mandatory script // verification flags, in case of bugs in the standard flags that cause // transactions to pass as valid when they're actually invalid. For // instance the STRICTENC flag was incorrectly allowing certain // CHECKSIG NOT scripts to pass, even though they were invalid. // // There is a similar check in CreateNewBlock() to prevent creating // invalid blocks, however allowing such transactions into the mempool // can be exploited as a DoS attack. // for any real tx this will be checked on AcceptToMemoryPool anyway // if (!CheckInputs(tx, state, view, false, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) // { // return error("AcceptableInputs: : BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); // } // Store transaction in memory // pool.addUnchecked(hash, entry); } // SyncWithWallets(tx, NULL); return true; } /** Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock */ bool GetTransaction(const uint256& hash, CTransaction& txOut, uint256& hashBlock, bool fAllowSlow) { CBlockIndex* pindexSlow = NULL; { LOCK(cs_main); { if (mempool.lookup(hash, txOut)) { return true; } } if (fTxIndex) { CDiskTxPos postx; if (pblocktree->ReadTxIndex(hash, postx)) { CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); if (file.IsNull()) return error("%s: OpenBlockFile failed", __func__); CBlockHeader header; try { file >> header; fseek(file.Get(), postx.nTxOffset, SEEK_CUR); file >> txOut; } catch (std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } hashBlock = header.GetHash(); if (txOut.GetHash() != hash) return error("%s : txid mismatch", __func__); return true; } } if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it int nHeight = -1; { CCoinsViewCache& view = *pcoinsTip; const CCoins* coins = view.AccessCoins(hash); if (coins) nHeight = coins->nHeight; } if (nHeight > 0) pindexSlow = chainActive[nHeight]; } } if (pindexSlow) { CBlock block; if (ReadBlockFromDisk(block, pindexSlow)) { BOOST_FOREACH (const CTransaction& tx, block.vtx) { if (tx.GetHash() == hash) { txOut = tx; hashBlock = pindexSlow->GetBlockHash(); return true; } } } } return false; } ////////////////////////////////////////////////////////////////////////////// // // CBlock and CBlockIndex // bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos) { // Open history file to append CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) return error("WriteBlockToDisk : OpenBlockFile failed"); // Write index header unsigned int nSize = fileout.GetSerializeSize(block); fileout << FLATDATA(Params().MessageStart()) << nSize; // Write block long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) return error("WriteBlockToDisk : ftell failed"); pos.nPos = (unsigned int)fileOutPos; fileout << block; return true; } bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos) { block.SetNull(); // Open history file to read CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) return error("ReadBlockFromDisk : OpenBlockFile failed"); // Read block try { filein >> block; } catch (std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } // Check the header if (block.IsProofOfWork()) { if (!CheckProofOfWork(block.GetHash(), block.nBits)) return error("ReadBlockFromDisk : Errors in block header"); } return true; } bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) { if (!ReadBlockFromDisk(block, pindex->GetBlockPos())) return false; if (block.GetHash() != pindex->GetBlockHash()) { LogPrintf("%s : block=%s index=%s\n", __func__, block.GetHash().ToString().c_str(), pindex->GetBlockHash().ToString().c_str()); return error("ReadBlockFromDisk(CBlock&, CBlockIndex*) : GetHash() doesn't match index"); } return true; } double ConvertBitsToDouble(unsigned int nBits) { int nShift = (nBits >> 24) & 0xff; double dDiff = (double)0x0000ffff / (double)(nBits & 0x00ffffff); while (nShift < 29) { dDiff *= 256.0; nShift++; } while (nShift > 29) { dDiff /= 256.0; nShift--; } return dDiff; } int64_t GetBlockValue(int nHeight) { int64_t nSubsidy = 0; if (Params().NetworkID() == CBaseChainParams::TESTNET) { if (nHeight < 200 && nHeight > 0) return 250000 * COIN; } if (nHeight == 0) { nSubsidy = 1350000 * COIN; } else if (nHeight < 60000 && nHeight > 0) { nSubsidy = 28 * COIN; } else if (nHeight <= 125000 && nHeight >= 60000) { nSubsidy = 20 * COIN; } else if (nHeight <= 350000 && nHeight >= 125000) { nSubsidy = 16 * COIN; } else if (nHeight <= 500000 && nHeight >= 350000) { nSubsidy = 12 * COIN; } else if (nHeight <= 775000 && nHeight >= 500000) { nSubsidy = 8 * COIN; } else if (nHeight <= 1025000 && nHeight >= 775000) { nSubsidy = 4 * COIN; } else if (nHeight <= 1500000 && nHeight >= 1025000) { nSubsidy = 2 * COIN; } else if (nHeight <= 2620119 && nHeight >= 1500000) { nSubsidy = 1 * COIN; } else if (nHeight >= 2620119) { nSubsidy = 1 * COIN; } else { nSubsidy = 1 * COIN; } return nSubsidy; } int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCount) { int64_t ret = 0; if (Params().NetworkID() == CBaseChainParams::TESTNET) { if (nHeight < 200) return 0; } // 90% for Masternodes if (nHeight == 0) { ret = blockValue / 100 * 0; } else if (nHeight > 1) { ret = blockValue / 100 * 90; } return ret; } bool IsInitialBlockDownload() { LOCK(cs_main); if (fImporting || fReindex || chainActive.Height() < Checkpoints::GetTotalBlocksEstimate()) return true; static bool lockIBDState = false; if (lockIBDState) return false; bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || pindexBestHeader->GetBlockTime() < GetTime() - 6 * 60 * 60); // ~144 blocks behind -> 2 x fork detection time if (!state) lockIBDState = true; return state; } bool fLargeWorkForkFound = false; bool fLargeWorkInvalidChainFound = false; CBlockIndex *pindexBestForkTip = NULL, *pindexBestForkBase = NULL; void CheckForkWarningConditions() { AssertLockHeld(cs_main); // Before we get past initial download, we cannot reliably alert about forks // (we assume we don't get stuck on a fork before the last checkpoint) if (IsInitialBlockDownload()) return; // If our best fork is no longer within 72 blocks (+/- 3 hours if no one mines it) // of our head, drop it if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->nHeight >= 72) pindexBestForkTip = NULL; if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (GetBlockProof(*chainActive.Tip()) * 6))) { if (!fLargeWorkForkFound && pindexBestForkBase) { if (pindexBestForkBase->phashBlock) { std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") + pindexBestForkBase->phashBlock->ToString() + std::string("'"); CAlert::Notify(warning, true); } } if (pindexBestForkTip && pindexBestForkBase) { if (pindexBestForkBase->phashBlock) { LogPrintf("CheckForkWarningConditions: Warning: Large valid fork found\n forking the chain at height %d (%s)\n lasting to height %d (%s).\nChain state database corruption likely.\n", pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString(), pindexBestForkTip->nHeight, pindexBestForkTip->phashBlock->ToString()); fLargeWorkForkFound = true; } } else { LogPrintf("CheckForkWarningConditions: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n"); fLargeWorkInvalidChainFound = true; } } else { fLargeWorkForkFound = false; fLargeWorkInvalidChainFound = false; } } void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) { AssertLockHeld(cs_main); // If we are on a fork that is sufficiently large, set a warning flag CBlockIndex* pfork = pindexNewForkTip; CBlockIndex* plonger = chainActive.Tip(); while (pfork && pfork != plonger) { while (plonger && plonger->nHeight > pfork->nHeight) plonger = plonger->pprev; if (pfork == plonger) break; pfork = pfork->pprev; } // We define a condition which we should warn the user about as a fork of at least 7 blocks // who's tip is within 72 blocks (+/- 3 hours if no one mines it) of ours // or a chain that is entirely longer than ours and invalid (note that this should be detected by both) // We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network // hash rate operating on the fork. // We define it this way because it allows us to only store the highest fork tip (+ base) which meets // the 7-block condition and from this always have the most-likely-to-cause-warning fork if (pfork && (!pindexBestForkTip || (pindexBestForkTip && pindexNewForkTip->nHeight > pindexBestForkTip->nHeight)) && pindexNewForkTip->nChainWork - pfork->nChainWork > (GetBlockProof(*pfork) * 7) && chainActive.Height() - pindexNewForkTip->nHeight < 72) { pindexBestForkTip = pindexNewForkTip; pindexBestForkBase = pfork; } CheckForkWarningConditions(); } // Requires cs_main. void Misbehaving(NodeId pnode, int howmuch) { if (howmuch == 0) return; CNodeState* state = State(pnode); if (state == NULL) return; state->nMisbehavior += howmuch; int banscore = GetArg("-banscore", 100); if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore) { LogPrintf("Misbehaving: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", state->name, state->nMisbehavior - howmuch, state->nMisbehavior); state->fShouldBan = true; } else LogPrintf("Misbehaving: %s (%d -> %d)\n", state->name, state->nMisbehavior - howmuch, state->nMisbehavior); } void static InvalidChainFound(CBlockIndex* pindexNew) { if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork) pindexBestInvalid = pindexNew; LogPrintf("InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s\n", pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, log(pindexNew->nChainWork.getdouble()) / log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexNew->GetBlockTime())); LogPrintf("InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s\n", chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble()) / log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime())); CheckForkWarningConditions(); } void static InvalidBlockFound(CBlockIndex* pindex, const CValidationState& state) { int nDoS = 0; if (state.IsInvalid(nDoS)) { std::map<uint256, NodeId>::iterator it = mapBlockSource.find(pindex->GetBlockHash()); if (it != mapBlockSource.end() && State(it->second)) { CBlockReject reject = {state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()}; State(it->second)->rejects.push_back(reject); if (nDoS > 0) Misbehaving(it->second, nDoS); } } if (!state.CorruptionPossible()) { pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); setBlockIndexCandidates.erase(pindex); InvalidChainFound(pindex); } } void UpdateCoins(const CTransaction& tx, CValidationState& state, CCoinsViewCache& inputs, CTxUndo& txundo, int nHeight) { // mark inputs spent if (!tx.IsCoinBase() && !tx.IsZerocoinSpend()) { txundo.vprevout.reserve(tx.vin.size()); BOOST_FOREACH (const CTxIn& txin, tx.vin) { txundo.vprevout.push_back(CTxInUndo()); bool ret = inputs.ModifyCoins(txin.prevout.hash)->Spend(txin.prevout, txundo.vprevout.back()); assert(ret); } } // add outputs inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight); } bool CScriptCheck::operator()() { const CScript& scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, nFlags, CachingTransactionSignatureChecker(ptxTo, nIn, cacheStore), &error)) { return ::error("CScriptCheck(): %s:%d VerifySignature failed: %s", ptxTo->GetHash().ToString(), nIn, ScriptErrorString(error)); } return true; } bool CheckInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, bool fScriptChecks, unsigned int flags, bool cacheStore, std::vector<CScriptCheck>* pvChecks) { if (!tx.IsCoinBase() && !tx.IsZerocoinSpend()) { if (pvChecks) pvChecks->reserve(tx.vin.size()); // This doesn't trigger the DoS code on purpose; if it did, it would make it easier // for an attacker to attempt to split the network. if (!inputs.HaveInputs(tx)) return state.Invalid(error("CheckInputs() : %s inputs unavailable", tx.GetHash().ToString())); // While checking, GetBestBlock() refers to the parent block. // This is also true for mempool checks. CBlockIndex* pindexPrev = mapBlockIndex.find(inputs.GetBestBlock())->second; int nSpendHeight = pindexPrev->nHeight + 1; CAmount nValueIn = 0; CAmount nFees = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint& prevout = tx.vin[i].prevout; const CCoins* coins = inputs.AccessCoins(prevout.hash); assert(coins); // If prev is coinbase, check that it's matured if (coins->IsCoinBase() || coins->IsCoinStake()) { if (nSpendHeight - coins->nHeight < Params().COINBASE_MATURITY()) return state.Invalid( error("CheckInputs() : tried to spend coinbase at depth %d, coinstake=%d", nSpendHeight - coins->nHeight, coins->IsCoinStake()), REJECT_INVALID, "bad-txns-premature-spend-of-coinbase"); } // Check for negative or overflow input values nValueIn += coins->vout[prevout.n].nValue; if (!MoneyRange(coins->vout[prevout.n].nValue) || !MoneyRange(nValueIn)) return state.DoS(100, error("CheckInputs() : txin values out of range"), REJECT_INVALID, "bad-txns-inputvalues-outofrange"); } if (!tx.IsCoinStake()) { if (nValueIn < tx.GetValueOut()) return state.DoS(100, error("CheckInputs() : %s value in (%s) < value out (%s)", tx.GetHash().ToString(), FormatMoney(nValueIn), FormatMoney(tx.GetValueOut())), REJECT_INVALID, "bad-txns-in-belowout"); // Tally transaction fees CAmount nTxFee = nValueIn - tx.GetValueOut(); if (nTxFee < 0) return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", tx.GetHash().ToString()), REJECT_INVALID, "bad-txns-fee-negative"); nFees += nTxFee; if (!MoneyRange(nFees)) return state.DoS(100, error("CheckInputs() : nFees out of range"), REJECT_INVALID, "bad-txns-fee-outofrange"); } // The first loop above does all the inexpensive checks. // Only if ALL inputs pass do we perform expensive ECDSA signature checks. // Helps prevent CPU exhaustion attacks. // Skip ECDSA signature verification when connecting blocks // before the last block chain checkpoint. This is safe because block merkle hashes are // still computed and checked, and any change will be caught at the next checkpoint. if (fScriptChecks) { for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint& prevout = tx.vin[i].prevout; const CCoins* coins = inputs.AccessCoins(prevout.hash); assert(coins); // Verify signature CScriptCheck check(*coins, tx, i, flags, cacheStore); if (pvChecks) { pvChecks->push_back(CScriptCheck()); check.swap(pvChecks->back()); } else if (!check()) { if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) { // Check whether the failure was caused by a // non-mandatory script verification check, such as // non-standard DER encodings or non-null dummy // arguments; if so, don't trigger DoS protection to // avoid splitting the network between upgraded and // non-upgraded nodes. CScriptCheck check(*coins, tx, i, flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, cacheStore); if (check()) return state.Invalid(false, REJECT_NONSTANDARD, strprintf("non-mandatory-script-verify-flag (%s)", ScriptErrorString(check.GetScriptError()))); } // Failures of other flags indicate a transaction that is // invalid in new blocks, e.g. a invalid P2SH. We DoS ban // such nodes as they are not following the protocol. That // said during an upgrade careful thought should be taken // as to the correct behavior - we may want to continue // peering with non-upgraded nodes even after a soft-fork // super-majority vote has passed. return state.DoS(100, false, REJECT_INVALID, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))); } } } } return true; } bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) { assert(pindex->GetBlockHash() == view.GetBestBlock()); if (pfClean) *pfClean = false; bool fClean = true; CBlockUndo blockUndo; CDiskBlockPos pos = pindex->GetUndoPos(); if (pos.IsNull()) return error("DisconnectBlock() : no undo data available"); if (!blockUndo.ReadFromDisk(pos, pindex->pprev->GetBlockHash())) return error("DisconnectBlock() : failure reading undo data"); if (blockUndo.vtxundo.size() + 1 != block.vtx.size()) return error("DisconnectBlock() : block and undo data inconsistent"); // undo transactions in reverse order for (int i = block.vtx.size() - 1; i >= 0; i--) { const CTransaction& tx = block.vtx[i]; /** UNDO ZEROCOIN DATABASING * note we only undo zerocoin databasing in the following statement, value to and from Respawn * addresses should still be handled by the typical bitcoin based undo code * */ if (tx.ContainsZerocoins()) { if (tx.IsZerocoinSpend()) { //erase all zerocoinspends in this transaction for (const CTxIn txin : tx.vin) { if (txin.scriptSig.IsZerocoinSpend()) { CoinSpend spend = TxInToZerocoinSpend(txin); if (!zerocoinDB->EraseCoinSpend(spend.getCoinSerialNumber())) return error("failed to erase spent zerocoin in block"); } } } if (tx.IsZerocoinMint()) { //erase all zerocoinmints in this transaction for (const CTxOut txout : tx.vout) { if (txout.scriptPubKey.empty() || !txout.scriptPubKey.IsZerocoinMint()) continue; PublicCoin pubCoin(Params().Zerocoin_Params()); if (!TxOutToPublicCoin(txout, pubCoin, state)) return error("DisconnectBlock(): TxOutToPublicCoin() failed"); if(!zerocoinDB->EraseCoinMint(pubCoin.getValue())) return error("DisconnectBlock(): Failed to erase coin mint"); } } } uint256 hash = tx.GetHash(); // Check that all outputs are available and match the outputs in the block itself // exactly. Note that transactions with only provably unspendable outputs won't // have outputs available even in the block itself, so we handle that case // specially with outsEmpty. { CCoins outsEmpty; CCoinsModifier outs = view.ModifyCoins(hash); outs->ClearUnspendable(); CCoins outsBlock(tx, pindex->nHeight); // The CCoins serialization does not serialize negative numbers. // No network rules currently depend on the version here, so an inconsistency is harmless // but it must be corrected before txout nversion ever influences a network rule. if (outsBlock.nVersion < 0) outs->nVersion = outsBlock.nVersion; if (*outs != outsBlock) fClean = fClean && error("DisconnectBlock() : added transaction mismatch? database corrupted"); // remove outputs outs->Clear(); } // restore inputs if (!tx.IsCoinBase() && !tx.IsZerocoinSpend()) { // not coinbases or zerocoinspend because they dont have traditional inputs const CTxUndo& txundo = blockUndo.vtxundo[i - 1]; if (txundo.vprevout.size() != tx.vin.size()) return error("DisconnectBlock() : transaction and undo data inconsistent - txundo.vprevout.siz=%d tx.vin.siz=%d", txundo.vprevout.size(), tx.vin.size()); for (unsigned int j = tx.vin.size(); j-- > 0;) { const COutPoint& out = tx.vin[j].prevout; const CTxInUndo& undo = txundo.vprevout[j]; CCoinsModifier coins = view.ModifyCoins(out.hash); if (undo.nHeight != 0) { // undo data contains height: this is the last output of the prevout tx being spent if (!coins->IsPruned()) fClean = fClean && error("DisconnectBlock() : undo data overwriting existing transaction"); coins->Clear(); coins->fCoinBase = undo.fCoinBase; coins->nHeight = undo.nHeight; coins->nVersion = undo.nVersion; } else { if (coins->IsPruned()) fClean = fClean && error("DisconnectBlock() : undo data adding output to missing transaction"); } if (coins->IsAvailable(out.n)) fClean = fClean && error("DisconnectBlock() : undo data overwriting existing output"); if (coins->vout.size() < out.n + 1) coins->vout.resize(out.n + 1); coins->vout[out.n] = undo.txout; } } } // move best block pointer to prevout block view.SetBestBlock(pindex->pprev->GetBlockHash()); if (!fVerifyingBlocks) { //if block is an accumulator checkpoint block, remove checkpoint and checksums from db uint256 nCheckpoint = pindex->nAccumulatorCheckpoint; if(nCheckpoint != pindex->pprev->nAccumulatorCheckpoint) { if(!EraseAccumulatorValues(nCheckpoint, pindex->pprev->nAccumulatorCheckpoint)) return error("DisconnectBlock(): failed to erase checkpoint"); } } if (pfClean) { *pfClean = fClean; return true; } else { return fClean; } } void static FlushBlockFile(bool fFinalize = false) { LOCK(cs_LastBlockFile); CDiskBlockPos posOld(nLastBlockFile, 0); FILE* fileOld = OpenBlockFile(posOld); if (fileOld) { if (fFinalize) TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nSize); FileCommit(fileOld); fclose(fileOld); } fileOld = OpenUndoFile(posOld); if (fileOld) { if (fFinalize) TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nUndoSize); FileCommit(fileOld); fclose(fileOld); } } bool FindUndoPos(CValidationState& state, int nFile, CDiskBlockPos& pos, unsigned int nAddSize); static CCheckQueue<CScriptCheck> scriptcheckqueue(128); void ThreadScriptCheck() { RenameThread("respawn-scriptch"); scriptcheckqueue.Thread(); } void RecalculateZRSPMinted() { CBlockIndex *pindex = chainActive[Params().Zerocoin_AccumulatorStartHeight()]; int nHeightEnd = chainActive.Height(); while (true) { if (pindex->nHeight % 1000 == 0) LogPrintf("%s : block %d...\n", __func__, pindex->nHeight); //overwrite possibly wrong vMintsInBlock data CBlock block; assert(ReadBlockFromDisk(block, pindex)); std::list<CZerocoinMint> listMints; BlockToZerocoinMintList(block, listMints); vector<libzerocoin::CoinDenomination> vDenomsBefore = pindex->vMintDenominationsInBlock; pindex->vMintDenominationsInBlock.clear(); for (auto mint : listMints) pindex->vMintDenominationsInBlock.emplace_back(mint.GetDenomination()); //Record mints to disk assert(pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex))); if (pindex->nHeight < nHeightEnd) pindex = chainActive.Next(pindex); else break; } pblocktree->Flush(); } void RecalculateZRSPSpent() { CBlockIndex* pindex = chainActive[Params().Zerocoin_AccumulatorStartHeight()]; while (true) { if (pindex->nHeight % 1000 == 0) LogPrintf("%s : block %d...\n", __func__, pindex->nHeight); //Rewrite zRSP supply CBlock block; assert(ReadBlockFromDisk(block, pindex)); list<libzerocoin::CoinDenomination> listDenomsSpent = ZerocoinSpendListFromBlock(block); //Reset the supply to previous block pindex->mapZerocoinSupply = pindex->pprev->mapZerocoinSupply; //Add mints to zRSP supply for (auto denom : libzerocoin::zerocoinDenomList) { long nDenomAdded = count(pindex->vMintDenominationsInBlock.begin(), pindex->vMintDenominationsInBlock.end(), denom); pindex->mapZerocoinSupply.at(denom) += nDenomAdded; } //Remove spends from zRSP supply for (auto denom : listDenomsSpent) pindex->mapZerocoinSupply.at(denom)--; //Rewrite money supply assert(pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex))); if (pindex->nHeight < chainActive.Height()) pindex = chainActive.Next(pindex); else break; } pblocktree->Flush(); } bool RecalculateRSPSupply(int nHeightStart) { if (nHeightStart > chainActive.Height()) return false; CBlockIndex* pindex = chainActive[nHeightStart]; CAmount nSupplyPrev = pindex->pprev->nMoneySupply; while (true) { if (pindex->nHeight % 1000 == 0) LogPrintf("%s : block %d...\n", __func__, pindex->nHeight); CBlock block; assert(ReadBlockFromDisk(block, pindex)); CAmount nValueIn = 0; CAmount nValueOut = 0; for (const CTransaction tx : block.vtx) { for (unsigned int i = 0; i < tx.vin.size(); i++) { if (tx.IsCoinBase()) break; if (tx.vin[i].scriptSig.IsZerocoinSpend()) { nValueIn += tx.vin[i].nSequence * COIN; continue; } COutPoint prevout = tx.vin[i].prevout; CTransaction txPrev; uint256 hashBlock; assert(GetTransaction(prevout.hash, txPrev, hashBlock, true)); nValueIn += txPrev.vout[prevout.n].nValue; } for (unsigned int i = 0; i < tx.vout.size(); i++) { if (i == 0 && tx.IsCoinStake()) continue; nValueOut += tx.vout[i].nValue; } } // Rewrite money supply pindex->nMoneySupply = nSupplyPrev + nValueOut - nValueIn; nSupplyPrev = pindex->nMoneySupply; assert(pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex))); if (pindex->nHeight < chainActive.Height()) pindex = chainActive.Next(pindex); else break; } pblocktree->Flush(); return true; } static int64_t nTimeVerify = 0; static int64_t nTimeConnect = 0; static int64_t nTimeIndex = 0; static int64_t nTimeCallbacks = 0; static int64_t nTimeTotal = 0; bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck, bool fAlreadyChecked) { AssertLockHeld(cs_main); // Check it again in case a previous version let a bad block in if (!fAlreadyChecked && !CheckBlock(block, state, !fJustCheck, !fJustCheck)) return false; // verify that the view's current state corresponds to the previous block uint256 hashPrevBlock = pindex->pprev == NULL ? uint256(0) : pindex->pprev->GetBlockHash(); if (hashPrevBlock != view.GetBestBlock()) LogPrintf("%s: hashPrev=%s view=%s\n", __func__, hashPrevBlock.ToString().c_str(), view.GetBestBlock().ToString().c_str()); assert(hashPrevBlock == view.GetBestBlock()); // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (block.GetHash() == Params().HashGenesisBlock()) { view.SetBestBlock(pindex->GetBlockHash()); return true; } if (pindex->nHeight <= Params().LAST_POW_BLOCK() && block.IsProofOfStake()) return state.DoS(100, error("ConnectBlock() : PoS period not active"), REJECT_INVALID, "PoS-early"); if (pindex->nHeight > Params().LAST_POW_BLOCK() && block.IsProofOfWork()) return state.DoS(100, error("ConnectBlock() : PoW period ended"), REJECT_INVALID, "PoW-ended"); bool fScriptChecks = pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate(); // Do not allow blocks that contain transactions which 'overwrite' older transactions, // unless those are already completely spent. // If such overwrites are allowed, coinbases and transactions depending upon those // can be duplicated to remove the ability to spend the first instance -- even after // being sent to another address. // See BIP30 and http://r6.ca/blog/20120206T005236Z.html for more information. // This logic is not necessary for memory pool transactions, as AcceptToMemoryPool // already refuses previously-known transaction ids entirely. // This rule was originally applied all blocks whose timestamp was after March 15, 2012, 0:00 UTC. // Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the // two in the chain that violate it. This prevents exploiting the issue against nodes in their // initial block download. bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash. !((pindex->nHeight == 91842 && pindex->GetBlockHash() == uint256("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) || (pindex->nHeight == 91880 && pindex->GetBlockHash() == uint256("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"))); if (fEnforceBIP30) { BOOST_FOREACH (const CTransaction& tx, block.vtx) { const CCoins* coins = view.AccessCoins(tx.GetHash()); if (coins && !coins->IsPruned()) return state.DoS(100, error("ConnectBlock() : tried to overwrite transaction"), REJECT_INVALID, "bad-txns-BIP30"); } } // BIP16 didn't become active until Apr 1 2012 int64_t nBIP16SwitchTime = 1333238400; bool fStrictPayToScriptHash = (pindex->GetBlockTime() >= nBIP16SwitchTime); unsigned int flags = fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE; // Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, when 75% of the network has upgraded: if (block.nVersion >= 3 && CBlockIndex::IsSuperMajority(3, pindex->pprev, Params().EnforceBlockUpgradeMajority())) { flags |= SCRIPT_VERIFY_DERSIG; } CBlockUndo blockundo; CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); int64_t nTimeStart = GetTimeMicros(); CAmount nFees = 0; int nInputs = 0; unsigned int nSigOps = 0; CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size())); std::vector<std::pair<uint256, CDiskTxPos> > vPos; vPos.reserve(block.vtx.size()); blockundo.vtxundo.reserve(block.vtx.size() - 1); CAmount nValueOut = 0; CAmount nValueIn = 0; unsigned int nMaxBlockSigOps = MAX_BLOCK_SIGOPS_CURRENT; for (unsigned int i = 0; i < block.vtx.size(); i++) { const CTransaction& tx = block.vtx[i]; nInputs += tx.vin.size(); nSigOps += GetLegacySigOpCount(tx); if (nSigOps > nMaxBlockSigOps) return state.DoS(100, error("ConnectBlock() : too many sigops"), REJECT_INVALID, "bad-blk-sigops"); //Temporarily disable zerocoin transactions for maintenance if (block.nTime > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && !IsInitialBlockDownload() && tx.ContainsZerocoins()) return state.DoS(100, error("ConnectBlock() : zerocoin transactions are currently in maintenance mode")); if (tx.IsZerocoinSpend()) { int nHeightTx = 0; if (IsTransactionInChain(tx.GetHash(), nHeightTx)) { //when verifying blocks on init, the blocks are scanned without being disconnected - prevent that from causing an error if (!fVerifyingBlocks || (fVerifyingBlocks && pindex->nHeight > nHeightTx)) return state.DoS(100, error("%s : txid %s already exists in block %d , trying to include it again in block %d", __func__, tx.GetHash().GetHex(), nHeightTx, pindex->nHeight), REJECT_INVALID, "bad-txns-inputs-missingorspent"); } //Check for double spending of serial #'s for (const CTxIn& txIn : tx.vin) { if (!txIn.scriptSig.IsZerocoinSpend()) continue; CoinSpend spend = TxInToZerocoinSpend(txIn); nValueIn += spend.getDenomination() * COIN; // Make sure that the serial number is in valid range if (!spend.HasValidSerial(Params().Zerocoin_Params())) { string strError = strprintf("%s : txid=%s in block %d contains invalid serial %s\n", __func__, tx.GetHash().GetHex(), pindex->nHeight, spend.getCoinSerialNumber()); if (pindex->nHeight >= Params().Zerocoin_Block_EnforceSerialRange()) return state.DoS(100, error(strError.c_str())); strError = "NOT ENFORCING : " + strError; LogPrintf(strError.c_str()); } //Is the serial already in the blockchain? uint256 hashTxFromDB; int nHeightTxSpend = 0; if (zerocoinDB->ReadCoinSpend(spend.getCoinSerialNumber(), hashTxFromDB)) { if(IsSerialInBlockchain(spend.getCoinSerialNumber(), nHeightTxSpend)) { if(!fVerifyingBlocks || (fVerifyingBlocks && pindex->nHeight > nHeightTxSpend)) return state.DoS(100, error("%s : zRsp with serial %s is already in the block %d\n", __func__, spend.getCoinSerialNumber().GetHex(), nHeightTxSpend)); } } //record spend to database if (!zerocoinDB->WriteCoinSpend(spend.getCoinSerialNumber(), tx.GetHash())) return error("%s : failed to record coin serial to database"); } } else if (!tx.IsCoinBase()) { if (!view.HaveInputs(tx)) return state.DoS(100, error("ConnectBlock() : inputs missing/spent"), REJECT_INVALID, "bad-txns-inputs-missingorspent"); if (fStrictPayToScriptHash) { // Add in sigops done by pay-to-script-hash inputs; // this is to prevent a "rogue miner" from creating // an incredibly-expensive-to-validate block. nSigOps += GetP2SHSigOpCount(tx, view); if (nSigOps > nMaxBlockSigOps) return state.DoS(100, error("ConnectBlock() : too many sigops"), REJECT_INVALID, "bad-blk-sigops"); } if (!tx.IsCoinStake()) nFees += view.GetValueIn(tx) - tx.GetValueOut(); nValueIn += view.GetValueIn(tx); std::vector<CScriptCheck> vChecks; if (!CheckInputs(tx, state, view, fScriptChecks, flags, false, nScriptCheckThreads ? &vChecks : NULL)) return false; control.Add(vChecks); } nValueOut += tx.GetValueOut(); CTxUndo undoDummy; if (i > 0) { blockundo.vtxundo.push_back(CTxUndo()); } UpdateCoins(tx, state, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight); vPos.push_back(std::make_pair(tx.GetHash(), pos)); pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); } std::list<CZerocoinMint> listMints; BlockToZerocoinMintList(block, listMints); std::list<libzerocoin::CoinDenomination> listSpends = ZerocoinSpendListFromBlock(block); if (!fVerifyingBlocks && pindex->nHeight == Params().Zerocoin_StartHeight() + 1) { RecalculateZRSPMinted(); RecalculateZRSPSpent(); RecalculateRSPSupply(1); } // Initialize zerocoin supply to the supply from previous block if (pindex->pprev && pindex->pprev->GetBlockHeader().nVersion > 3) { for (auto& denom : zerocoinDenomList) { pindex->mapZerocoinSupply.at(denom) = pindex->pprev->mapZerocoinSupply.at(denom); } } // Track zerocoin money supply CAmount nAmountZerocoinSpent = 0; pindex->vMintDenominationsInBlock.clear(); if (pindex->pprev) { for (auto& m : listMints) { libzerocoin::CoinDenomination denom = m.GetDenomination(); pindex->vMintDenominationsInBlock.push_back(m.GetDenomination()); pindex->mapZerocoinSupply.at(denom)++; } for (auto& denom : listSpends) { pindex->mapZerocoinSupply.at(denom)--; nAmountZerocoinSpent += libzerocoin::ZerocoinDenominationToAmount(denom); // zerocoin failsafe if (pindex->mapZerocoinSupply.at(denom) < 0) return state.DoS(100, error("Block contains zerocoins that spend more than are in the available supply to spend")); } } for (auto& denom : zerocoinDenomList) { LogPrint("zero" "%s coins for denomination %d pubcoin %s\n", __func__, pindex->mapZerocoinSupply.at(denom), denom); } // track money supply and mint amount info CAmount nMoneySupplyPrev = pindex->pprev ? pindex->pprev->nMoneySupply : 0; pindex->nMoneySupply = nMoneySupplyPrev + nValueOut - nValueIn; pindex->nMint = pindex->nMoneySupply - nMoneySupplyPrev + nFees; // LogPrintf("XX69----------> ConnectBlock(): nValueOut: %s, nValueIn: %s, nFees: %s, nMint: %s zRspSpent: %s\n", // FormatMoney(nValueOut), FormatMoney(nValueIn), // FormatMoney(nFees), FormatMoney(pindex->nMint), FormatMoney(nAmountZerocoinSpent)); if (!pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex))) return error("Connect() : WriteBlockIndex for pindex failed"); int64_t nTime1 = GetTimeMicros(); nTimeConnect += nTime1 - nTimeStart; LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime1 - nTimeStart) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart) / (nInputs - 1), nTimeConnect * 0.000001); //PoW phase redistributed fees to miner. PoS stage destroys fees. CAmount nExpectedMint = GetBlockValue(pindex->pprev->nHeight); if (block.IsProofOfWork()) nExpectedMint += nFees; if (!IsBlockValueValid(block, nExpectedMint, pindex->nMint)) { return state.DoS(100, error("ConnectBlock() : reward pays too much (actual=%s vs limit=%s)", FormatMoney(pindex->nMint), FormatMoney(nExpectedMint)), REJECT_INVALID, "bad-cb-amount"); } // zerocoin accumulator: if a new accumulator checkpoint was generated, check that it is the correct value if (!fVerifyingBlocks && pindex->nHeight >= Params().Zerocoin_StartHeight() && pindex->nHeight % 10 == 0) { uint256 nCheckpointCalculated = 0; if (!CalculateAccumulatorCheckpoint(pindex->nHeight, nCheckpointCalculated)) return state.DoS(100, error("ConnectBlock() : failed to calculate accumulator checkpoint")); if (nCheckpointCalculated != block.nAccumulatorCheckpoint) { LogPrintf("%s: block=%d calculated: %s\n block: %s\n", __func__, pindex->nHeight, nCheckpointCalculated.GetHex(), block.nAccumulatorCheckpoint.GetHex()); return state.DoS(100, error("ConnectBlock() : accumulator does not match calculated value")); } } else if (!fVerifyingBlocks) { if (block.nAccumulatorCheckpoint != pindex->pprev->nAccumulatorCheckpoint) { return state.DoS(100, error("ConnectBlock() : new accumulator checkpoint generated on a block that is not multiple of 10")); } } if (!control.Wait()) return state.DoS(100, false); int64_t nTime2 = GetTimeMicros(); nTimeVerify += nTime2 - nTimeStart; LogPrint("bench", " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n", nInputs - 1, 0.001 * (nTime2 - nTimeStart), nInputs <= 1 ? 0 : 0.001 * (nTime2 - nTimeStart) / (nInputs - 1), nTimeVerify * 0.000001); if (fJustCheck) return true; // Write undo information to disk if (pindex->GetUndoPos().IsNull() || !pindex->IsValid(BLOCK_VALID_SCRIPTS)) { if (pindex->GetUndoPos().IsNull()) { CDiskBlockPos pos; if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40)) return error("ConnectBlock() : FindUndoPos failed"); if (!blockundo.WriteToDisk(pos, pindex->pprev->GetBlockHash())) return state.Abort("Failed to write undo data"); // update nUndoPos in block index pindex->nUndoPos = pos.nPos; pindex->nStatus |= BLOCK_HAVE_UNDO; } pindex->RaiseValidity(BLOCK_VALID_SCRIPTS); setDirtyBlockIndex.insert(pindex); } if (fTxIndex) if (!pblocktree->WriteTxIndex(vPos)) return state.Abort("Failed to write transaction index"); // add this block to the view's block chain view.SetBestBlock(pindex->GetBlockHash()); int64_t nTime3 = GetTimeMicros(); nTimeIndex += nTime3 - nTime2; LogPrint("bench", " - Index writing: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeIndex * 0.000001); // Watch for changes to the previous coinbase transaction. static uint256 hashPrevBestCoinBase; g_signals.UpdatedTransaction(hashPrevBestCoinBase); hashPrevBestCoinBase = block.vtx[0].GetHash(); int64_t nTime4 = GetTimeMicros(); nTimeCallbacks += nTime4 - nTime3; LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeCallbacks * 0.000001); return true; } enum FlushStateMode { FLUSH_STATE_IF_NEEDED, FLUSH_STATE_PERIODIC, FLUSH_STATE_ALWAYS }; /** * Update the on-disk chain state. * The caches and indexes are flushed if either they're too large, forceWrite is set, or * fast is not set and it's been a while since the last write. */ bool static FlushStateToDisk(CValidationState& state, FlushStateMode mode) { LOCK(cs_main); static int64_t nLastWrite = 0; try { if ((mode == FLUSH_STATE_ALWAYS) || ((mode == FLUSH_STATE_PERIODIC || mode == FLUSH_STATE_IF_NEEDED) && pcoinsTip->GetCacheSize() > nCoinCacheSize) || (mode == FLUSH_STATE_PERIODIC && GetTimeMicros() > nLastWrite + DATABASE_WRITE_INTERVAL * 1000000)) { // Typical CCoins structures on disk are around 100 bytes in size. // Pushing a new one to the database can cause it to be written // twice (once in the log, and once in the tables). This is already // an overestimation, as most will delete an existing entry or // overwrite one. Still, use a conservative safety factor of 2. if (!CheckDiskSpace(100 * 2 * 2 * pcoinsTip->GetCacheSize())) return state.Error("out of disk space"); // First make sure all block and undo data is flushed to disk. FlushBlockFile(); // Then update all block file information (which may refer to block and undo files). bool fileschanged = false; for (set<int>::iterator it = setDirtyFileInfo.begin(); it != setDirtyFileInfo.end();) { if (!pblocktree->WriteBlockFileInfo(*it, vinfoBlockFile[*it])) { return state.Abort("Failed to write to block index"); } fileschanged = true; setDirtyFileInfo.erase(it++); } if (fileschanged && !pblocktree->WriteLastBlockFile(nLastBlockFile)) { return state.Abort("Failed to write to block index"); } for (set<CBlockIndex*>::iterator it = setDirtyBlockIndex.begin(); it != setDirtyBlockIndex.end();) { if (!pblocktree->WriteBlockIndex(CDiskBlockIndex(*it))) { return state.Abort("Failed to write to block index"); } setDirtyBlockIndex.erase(it++); } pblocktree->Sync(); // Finally flush the chainstate (which may refer to block index entries). if (!pcoinsTip->Flush()) return state.Abort("Failed to write to coin database"); // Update best block in wallet (so we can detect restored wallets). if (mode != FLUSH_STATE_IF_NEEDED) { g_signals.SetBestChain(chainActive.GetLocator()); } nLastWrite = GetTimeMicros(); } } catch (const std::runtime_error& e) { return state.Abort(std::string("System error while flushing: ") + e.what()); } return true; } void FlushStateToDisk() { CValidationState state; FlushStateToDisk(state, FLUSH_STATE_ALWAYS); } /** Update chainActive and related internal data structures. */ void static UpdateTip(CBlockIndex* pindexNew) { chainActive.SetTip(pindexNew); // If turned on AutoZeromint will automatically convert RSP to zRSP if (pwalletMain->isZeromintEnabled ()) pwalletMain->AutoZeromint (); // New best block nTimeBestReceived = GetTime(); mempool.AddTransactionsUpdated(1); LogPrintf("UpdateTip: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f cache=%u\n", chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble()) / log(2.0), (unsigned long)chainActive.Tip()->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), Checkpoints::GuessVerificationProgress(chainActive.Tip()), (unsigned int)pcoinsTip->GetCacheSize()); cvBlockChange.notify_all(); // Check the version of the last 100 blocks to see if we need to upgrade: static bool fWarned = false; if (!IsInitialBlockDownload() && !fWarned) { int nUpgraded = 0; const CBlockIndex* pindex = chainActive.Tip(); for (int i = 0; i < 100 && pindex != NULL; i++) { if (pindex->nVersion > CBlock::CURRENT_VERSION) ++nUpgraded; pindex = pindex->pprev; } if (nUpgraded > 0) LogPrintf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, (int)CBlock::CURRENT_VERSION); if (nUpgraded > 100 / 2) { // strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user: strMiscWarning = _("Warning: This version is obsolete, upgrade required!"); CAlert::Notify(strMiscWarning, true); fWarned = true; } } } /** Disconnect chainActive's tip. */ bool static DisconnectTip(CValidationState& state) { CBlockIndex* pindexDelete = chainActive.Tip(); assert(pindexDelete); mempool.check(pcoinsTip); // Read block from disk. CBlock block; if (!ReadBlockFromDisk(block, pindexDelete)) return state.Abort("Failed to read block"); // Apply the block atomically to the chain state. int64_t nStart = GetTimeMicros(); { CCoinsViewCache view(pcoinsTip); if (!DisconnectBlock(block, state, pindexDelete, view)) return error("DisconnectTip() : DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString()); assert(view.Flush()); } LogPrint("bench", "- Disconnect block: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); // Write the chain state to disk, if necessary. if (!FlushStateToDisk(state, FLUSH_STATE_ALWAYS)) return false; // Resurrect mempool transactions from the disconnected block. BOOST_FOREACH (const CTransaction& tx, block.vtx) { // ignore validation errors in resurrected transactions list<CTransaction> removed; CValidationState stateDummy; if (tx.IsCoinBase() || tx.IsCoinStake() || !AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL)) mempool.remove(tx, removed, true); } mempool.removeCoinbaseSpends(pcoinsTip, pindexDelete->nHeight); mempool.check(pcoinsTip); // Update chainActive and related variables. UpdateTip(pindexDelete->pprev); // Let wallets know transactions went from 1-confirmed to // 0-confirmed or conflicted: BOOST_FOREACH (const CTransaction& tx, block.vtx) { SyncWithWallets(tx, NULL); } return true; } static int64_t nTimeReadFromDisk = 0; static int64_t nTimeConnectTotal = 0; static int64_t nTimeFlush = 0; static int64_t nTimeChainState = 0; static int64_t nTimePostConnect = 0; /** * Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock * corresponding to pindexNew, to bypass loading it again from disk. */ bool static ConnectTip(CValidationState& state, CBlockIndex* pindexNew, CBlock* pblock, bool fAlreadyChecked) { assert(pindexNew->pprev == chainActive.Tip()); mempool.check(pcoinsTip); CCoinsViewCache view(pcoinsTip); if (pblock == NULL) fAlreadyChecked = false; // Read block from disk. int64_t nTime1 = GetTimeMicros(); CBlock block; if (!pblock) { if (!ReadBlockFromDisk(block, pindexNew)) return state.Abort("Failed to read block"); pblock = &block; } // Apply the block atomically to the chain state. int64_t nTime2 = GetTimeMicros(); nTimeReadFromDisk += nTime2 - nTime1; int64_t nTime3; LogPrint("bench", " - Load block from disk: %.2fms [%.2fs]\n", (nTime2 - nTime1) * 0.001, nTimeReadFromDisk * 0.000001); { CInv inv(MSG_BLOCK, pindexNew->GetBlockHash()); bool rv = ConnectBlock(*pblock, state, pindexNew, view, false, fAlreadyChecked); g_signals.BlockChecked(*pblock, state); if (!rv) { if (state.IsInvalid()) InvalidBlockFound(pindexNew, state); return error("ConnectTip() : ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); } mapBlockSource.erase(inv.hash); nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001); assert(view.Flush()); } int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3; LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001); // Write the chain state to disk, if necessary. Always write to disk if this is the first of a new file. FlushStateMode flushMode = FLUSH_STATE_IF_NEEDED; if (pindexNew->pprev && (pindexNew->GetBlockPos().nFile != pindexNew->pprev->GetBlockPos().nFile)) flushMode = FLUSH_STATE_ALWAYS; if (!FlushStateToDisk(state, flushMode)) return false; int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4; LogPrint("bench", " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001); // Remove conflicting transactions from the mempool. list<CTransaction> txConflicted; mempool.removeForBlock(pblock->vtx, pindexNew->nHeight, txConflicted); mempool.check(pcoinsTip); // Update chainActive & related variables. UpdateTip(pindexNew); // Tell wallet about transactions that went from mempool // to conflicted: BOOST_FOREACH (const CTransaction& tx, txConflicted) { SyncWithWallets(tx, NULL); } // ... and about transactions that got confirmed: BOOST_FOREACH (const CTransaction& tx, pblock->vtx) { SyncWithWallets(tx, pblock); } int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1; LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); return true; } bool DisconnectBlocksAndReprocess(int blocks) { LOCK(cs_main); CValidationState state; LogPrintf("DisconnectBlocksAndReprocess: Got command to replay %d blocks\n", blocks); for (int i = 0; i <= blocks; i++) DisconnectTip(state); return true; } /* DisconnectBlockAndInputs Remove conflicting blocks for successful SwiftX transaction locks This should be very rare (Probably will never happen) */ // ***TODO*** clean up here bool DisconnectBlockAndInputs(CValidationState& state, CTransaction txLock) { // All modifications to the coin state will be done in this cache. // Only when all have succeeded, we push it to pcoinsTip. // CCoinsViewCache view(*pcoinsTip, true); CBlockIndex* BlockReading = chainActive.Tip(); CBlockIndex* pindexNew = NULL; bool foundConflictingTx = false; //remove anything conflicting in the memory pool list<CTransaction> txConflicted; mempool.removeConflicts(txLock, txConflicted); // List of what to disconnect (typically nothing) vector<CBlockIndex*> vDisconnect; for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0 && !foundConflictingTx && i < 6; i++) { vDisconnect.push_back(BlockReading); pindexNew = BlockReading->pprev; //new best block CBlock block; if (!ReadBlockFromDisk(block, BlockReading)) return state.Abort(_("Failed to read block")); // Queue memory transactions to resurrect. // We only do this for blocks after the last checkpoint (reorganisation before that // point should only happen with -reindex/-loadblock, or a misbehaving peer. BOOST_FOREACH (const CTransaction& tx, block.vtx) { if (!tx.IsCoinBase()) { BOOST_FOREACH (const CTxIn& in1, txLock.vin) { BOOST_FOREACH (const CTxIn& in2, tx.vin) { if (in1.prevout == in2.prevout) foundConflictingTx = true; } } } } if (BlockReading->pprev == NULL) { assert(BlockReading); break; } BlockReading = BlockReading->pprev; } if (!foundConflictingTx) { LogPrintf("DisconnectBlockAndInputs: Can't find a conflicting transaction to inputs\n"); return false; } if (vDisconnect.size() > 0) { LogPrintf("REORGANIZE: Disconnect Conflicting Blocks %lli blocks; %s..\n", vDisconnect.size(), pindexNew->GetBlockHash().ToString()); BOOST_FOREACH (CBlockIndex* pindex, vDisconnect) { LogPrintf(" -- disconnect %s\n", pindex->GetBlockHash().ToString()); DisconnectTip(state); } } return true; } /** * Return the tip of the chain with the most work in it, that isn't * known to be invalid (it's however far from certain to be valid). */ static CBlockIndex* FindMostWorkChain() { do { CBlockIndex* pindexNew = NULL; // Find the best candidate header. { std::set<CBlockIndex*, CBlockIndexWorkComparator>::reverse_iterator it = setBlockIndexCandidates.rbegin(); if (it == setBlockIndexCandidates.rend()) return NULL; pindexNew = *it; } // Check whether all blocks on the path between the currently active chain and the candidate are valid. // Just going until the active chain is an optimization, as we know all blocks in it are valid already. CBlockIndex* pindexTest = pindexNew; bool fInvalidAncestor = false; while (pindexTest && !chainActive.Contains(pindexTest)) { assert(pindexTest->nChainTx || pindexTest->nHeight == 0); // Pruned nodes may have entries in setBlockIndexCandidates for // which block files have been deleted. Remove those as candidates // for the most work chain if we come across them; we can't switch // to a chain unless we have all the non-active-chain parent blocks. bool fFailedChain = pindexTest->nStatus & BLOCK_FAILED_MASK; bool fMissingData = !(pindexTest->nStatus & BLOCK_HAVE_DATA); if (fFailedChain || fMissingData) { // Candidate chain is not usable (either invalid or missing data) if (fFailedChain && (pindexBestInvalid == NULL || pindexNew->nChainWork > pindexBestInvalid->nChainWork)) pindexBestInvalid = pindexNew; CBlockIndex* pindexFailed = pindexNew; // Remove the entire chain from the set. while (pindexTest != pindexFailed) { if (fFailedChain) { pindexFailed->nStatus |= BLOCK_FAILED_CHILD; } else if (fMissingData) { // If we're missing data, then add back to mapBlocksUnlinked, // so that if the block arrives in the future we can try adding // to setBlockIndexCandidates again. mapBlocksUnlinked.insert(std::make_pair(pindexFailed->pprev, pindexFailed)); } setBlockIndexCandidates.erase(pindexFailed); pindexFailed = pindexFailed->pprev; } setBlockIndexCandidates.erase(pindexTest); fInvalidAncestor = true; break; } pindexTest = pindexTest->pprev; } if (!fInvalidAncestor) return pindexNew; } while (true); } /** Delete all entries in setBlockIndexCandidates that are worse than the current tip. */ static void PruneBlockIndexCandidates() { // Note that we can't delete the current block itself, as we may need to return to it later in case a // reorganization to a better block fails. std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndexCandidates.begin(); while (it != setBlockIndexCandidates.end() && setBlockIndexCandidates.value_comp()(*it, chainActive.Tip())) { setBlockIndexCandidates.erase(it++); } // Either the current tip or a successor of it we're working towards is left in setBlockIndexCandidates. assert(!setBlockIndexCandidates.empty()); } /** * Try to make some progress towards making pindexMostWork the active block. * pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. */ static bool ActivateBestChainStep(CValidationState& state, CBlockIndex* pindexMostWork, CBlock* pblock, bool fAlreadyChecked) { AssertLockHeld(cs_main); if (pblock == NULL) fAlreadyChecked = false; bool fInvalidFound = false; const CBlockIndex* pindexOldTip = chainActive.Tip(); const CBlockIndex* pindexFork = chainActive.FindFork(pindexMostWork); // Disconnect active blocks which are no longer in the best chain. while (chainActive.Tip() && chainActive.Tip() != pindexFork) { if (!DisconnectTip(state)) return false; } // Build list of new blocks to connect. std::vector<CBlockIndex*> vpindexToConnect; bool fContinue = true; int nHeight = pindexFork ? pindexFork->nHeight : -1; while (fContinue && nHeight != pindexMostWork->nHeight) { // Don't iterate the entire list of potential improvements toward the best tip, as we likely only need // a few blocks along the way. int nTargetHeight = std::min(nHeight + 32, pindexMostWork->nHeight); vpindexToConnect.clear(); vpindexToConnect.reserve(nTargetHeight - nHeight); CBlockIndex* pindexIter = pindexMostWork->GetAncestor(nTargetHeight); while (pindexIter && pindexIter->nHeight != nHeight) { vpindexToConnect.push_back(pindexIter); pindexIter = pindexIter->pprev; } nHeight = nTargetHeight; // Connect new blocks. BOOST_REVERSE_FOREACH (CBlockIndex* pindexConnect, vpindexToConnect) { if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL, fAlreadyChecked)) { if (state.IsInvalid()) { // The block violates a consensus rule. if (!state.CorruptionPossible()) InvalidChainFound(vpindexToConnect.back()); state = CValidationState(); fInvalidFound = true; fContinue = false; break; } else { // A system error occurred (disk space, database error, ...). return false; } } else { PruneBlockIndexCandidates(); if (!pindexOldTip || chainActive.Tip()->nChainWork > pindexOldTip->nChainWork) { // We're in a better position than we were. Return temporarily to release the lock. fContinue = false; break; } } } } // Callbacks/notifications for a new best chain. if (fInvalidFound) CheckForkWarningConditionsOnNewFork(vpindexToConnect.back()); else CheckForkWarningConditions(); return true; } /** * Make the best chain active, in multiple steps. The result is either failure * or an activated best chain. pblock is either NULL or a pointer to a block * that is already loaded (to avoid loading it again from disk). */ bool ActivateBestChain(CValidationState& state, CBlock* pblock, bool fAlreadyChecked) { CBlockIndex* pindexNewTip = NULL; CBlockIndex* pindexMostWork = NULL; do { boost::this_thread::interruption_point(); bool fInitialDownload; while (true) { TRY_LOCK(cs_main, lockMain); if (!lockMain) { MilliSleep(50); continue; } pindexMostWork = FindMostWorkChain(); // Whether we have anything to do at all. if (pindexMostWork == NULL || pindexMostWork == chainActive.Tip()) return true; if (!ActivateBestChainStep(state, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL, fAlreadyChecked)) return false; pindexNewTip = chainActive.Tip(); fInitialDownload = IsInitialBlockDownload(); break; } // When we reach this point, we switched to a new tip (stored in pindexNewTip). // Notifications/callbacks that can run without cs_main if (!fInitialDownload) { uint256 hashNewTip = pindexNewTip->GetBlockHash(); // Relay inventory, but don't relay old inventory during initial block download. int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate(); { LOCK(cs_vNodes); BOOST_FOREACH (CNode* pnode, vNodes) if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate)) pnode->PushInventory(CInv(MSG_BLOCK, hashNewTip)); } // Notify external listeners about the new tip. uiInterface.NotifyBlockTip(hashNewTip); } } while (pindexMostWork != chainActive.Tip()); CheckBlockIndex(); // Write changes periodically to disk, after relay. if (!FlushStateToDisk(state, FLUSH_STATE_PERIODIC)) { return false; } return true; } bool InvalidateBlock(CValidationState& state, CBlockIndex* pindex) { AssertLockHeld(cs_main); // Mark the block itself as invalid. pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); setBlockIndexCandidates.erase(pindex); while (chainActive.Contains(pindex)) { CBlockIndex* pindexWalk = chainActive.Tip(); pindexWalk->nStatus |= BLOCK_FAILED_CHILD; setDirtyBlockIndex.insert(pindexWalk); setBlockIndexCandidates.erase(pindexWalk); // ActivateBestChain considers blocks already in chainActive // unconditionally valid already, so force disconnect away from it. if (!DisconnectTip(state)) { return false; } } // The resulting new best tip may not be in setBlockIndexCandidates anymore, so // add them again. BlockMap::iterator it = mapBlockIndex.begin(); while (it != mapBlockIndex.end()) { if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->nChainTx && !setBlockIndexCandidates.value_comp()(it->second, chainActive.Tip())) { setBlockIndexCandidates.insert(it->second); } it++; } InvalidChainFound(pindex); return true; } bool ReconsiderBlock(CValidationState& state, CBlockIndex* pindex) { AssertLockHeld(cs_main); int nHeight = pindex->nHeight; // Remove the invalidity flag from this block and all its descendants. BlockMap::iterator it = mapBlockIndex.begin(); while (it != mapBlockIndex.end()) { if (!it->second->IsValid() && it->second->GetAncestor(nHeight) == pindex) { it->second->nStatus &= ~BLOCK_FAILED_MASK; setDirtyBlockIndex.insert(it->second); if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->nChainTx && setBlockIndexCandidates.value_comp()(chainActive.Tip(), it->second)) { setBlockIndexCandidates.insert(it->second); } if (it->second == pindexBestInvalid) { // Reset invalid block marker if it was pointing to one of those. pindexBestInvalid = NULL; } } it++; } // Remove the invalidity flag from all ancestors too. while (pindex != NULL) { if (pindex->nStatus & BLOCK_FAILED_MASK) { pindex->nStatus &= ~BLOCK_FAILED_MASK; setDirtyBlockIndex.insert(pindex); } pindex = pindex->pprev; } return true; } CBlockIndex* AddToBlockIndex(const CBlock& block) { // Check for duplicate uint256 hash = block.GetHash(); BlockMap::iterator it = mapBlockIndex.find(hash); if (it != mapBlockIndex.end()) return it->second; // Construct new block index object CBlockIndex* pindexNew = new CBlockIndex(block); assert(pindexNew); // We assign the sequence id to blocks only when the full data is available, // to avoid miners withholding blocks but broadcasting headers, to get a // competitive advantage. pindexNew->nSequenceId = 0; BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; //mark as PoS seen if (pindexNew->IsProofOfStake()) setStakeSeen.insert(make_pair(pindexNew->prevoutStake, pindexNew->nStakeTime)); pindexNew->phashBlock = &((*mi).first); BlockMap::iterator miPrev = mapBlockIndex.find(block.hashPrevBlock); if (miPrev != mapBlockIndex.end()) { pindexNew->pprev = (*miPrev).second; pindexNew->nHeight = pindexNew->pprev->nHeight + 1; pindexNew->BuildSkip(); //update previous block pointer pindexNew->pprev->pnext = pindexNew; // ppcoin: compute chain trust score pindexNew->bnChainTrust = (pindexNew->pprev ? pindexNew->pprev->bnChainTrust : 0) + pindexNew->GetBlockTrust(); // ppcoin: compute stake entropy bit for stake modifier if (!pindexNew->SetStakeEntropyBit(pindexNew->GetStakeEntropyBit())) LogPrintf("AddToBlockIndex() : SetStakeEntropyBit() failed \n"); // ppcoin: record proof-of-stake hash value if (pindexNew->IsProofOfStake()) { if (!mapProofOfStake.count(hash)) LogPrintf("AddToBlockIndex() : hashProofOfStake not found in map \n"); pindexNew->hashProofOfStake = mapProofOfStake[hash]; } // ppcoin: compute stake modifier uint64_t nStakeModifier = 0; bool fGeneratedStakeModifier = false; if (!ComputeNextStakeModifier(pindexNew->pprev, nStakeModifier, fGeneratedStakeModifier)) LogPrintf("AddToBlockIndex() : ComputeNextStakeModifier() failed \n"); pindexNew->SetStakeModifier(nStakeModifier, fGeneratedStakeModifier); pindexNew->nStakeModifierChecksum = GetStakeModifierChecksum(pindexNew); if (!CheckStakeModifierCheckpoints(pindexNew->nHeight, pindexNew->nStakeModifierChecksum)) LogPrintf("AddToBlockIndex() : Rejected by stake modifier checkpoint height=%d, modifier=%s \n", pindexNew->nHeight, boost::lexical_cast<std::string>(nStakeModifier)); } pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + GetBlockProof(*pindexNew); pindexNew->RaiseValidity(BLOCK_VALID_TREE); if (pindexBestHeader == NULL || pindexBestHeader->nChainWork < pindexNew->nChainWork) pindexBestHeader = pindexNew; //update previous block pointer if (pindexNew->nHeight) pindexNew->pprev->pnext = pindexNew; setDirtyBlockIndex.insert(pindexNew); return pindexNew; } /** Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */ bool ReceivedBlockTransactions(const CBlock& block, CValidationState& state, CBlockIndex* pindexNew, const CDiskBlockPos& pos) { if (block.IsProofOfStake()) pindexNew->SetProofOfStake(); pindexNew->nTx = block.vtx.size(); pindexNew->nChainTx = 0; pindexNew->nFile = pos.nFile; pindexNew->nDataPos = pos.nPos; pindexNew->nUndoPos = 0; pindexNew->nStatus |= BLOCK_HAVE_DATA; pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS); setDirtyBlockIndex.insert(pindexNew); if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) { // If pindexNew is the genesis block or all parents are BLOCK_VALID_TRANSACTIONS. deque<CBlockIndex*> queue; queue.push_back(pindexNew); // Recursively process any descendant blocks that now may be eligible to be connected. while (!queue.empty()) { CBlockIndex* pindex = queue.front(); queue.pop_front(); pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx; { LOCK(cs_nBlockSequenceId); pindex->nSequenceId = nBlockSequenceId++; } if (chainActive.Tip() == NULL || !setBlockIndexCandidates.value_comp()(pindex, chainActive.Tip())) { setBlockIndexCandidates.insert(pindex); } std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex); while (range.first != range.second) { std::multimap<CBlockIndex*, CBlockIndex*>::iterator it = range.first; queue.push_back(it->second); range.first++; mapBlocksUnlinked.erase(it); } } } else { if (pindexNew->pprev && pindexNew->pprev->IsValid(BLOCK_VALID_TREE)) { mapBlocksUnlinked.insert(std::make_pair(pindexNew->pprev, pindexNew)); } } return true; } bool FindBlockPos(CValidationState& state, CDiskBlockPos& pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false) { LOCK(cs_LastBlockFile); unsigned int nFile = fKnown ? pos.nFile : nLastBlockFile; if (vinfoBlockFile.size() <= nFile) { vinfoBlockFile.resize(nFile + 1); } if (!fKnown) { while (vinfoBlockFile[nFile].nSize + nAddSize >= MAX_BLOCKFILE_SIZE) { LogPrintf("Leaving block file %i: %s\n", nFile, vinfoBlockFile[nFile].ToString()); FlushBlockFile(true); nFile++; if (vinfoBlockFile.size() <= nFile) { vinfoBlockFile.resize(nFile + 1); } } pos.nFile = nFile; pos.nPos = vinfoBlockFile[nFile].nSize; } nLastBlockFile = nFile; vinfoBlockFile[nFile].AddBlock(nHeight, nTime); if (fKnown) vinfoBlockFile[nFile].nSize = std::max(pos.nPos + nAddSize, vinfoBlockFile[nFile].nSize); else vinfoBlockFile[nFile].nSize += nAddSize; if (!fKnown) { unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; unsigned int nNewChunks = (vinfoBlockFile[nFile].nSize + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { if (CheckDiskSpace(nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos)) { FILE* file = OpenBlockFile(pos); if (file) { LogPrintf("Pre-allocating up to position 0x%x in blk%05u.dat\n", nNewChunks * BLOCKFILE_CHUNK_SIZE, pos.nFile); AllocateFileRange(file, pos.nPos, nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos); fclose(file); } } else return state.Error("out of disk space"); } } setDirtyFileInfo.insert(nFile); return true; } bool FindUndoPos(CValidationState& state, int nFile, CDiskBlockPos& pos, unsigned int nAddSize) { pos.nFile = nFile; LOCK(cs_LastBlockFile); unsigned int nNewSize; pos.nPos = vinfoBlockFile[nFile].nUndoSize; nNewSize = vinfoBlockFile[nFile].nUndoSize += nAddSize; setDirtyFileInfo.insert(nFile); unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; unsigned int nNewChunks = (nNewSize + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { if (CheckDiskSpace(nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos)) { FILE* file = OpenUndoFile(pos); if (file) { LogPrintf("Pre-allocating up to position 0x%x in rev%05u.dat\n", nNewChunks * UNDOFILE_CHUNK_SIZE, pos.nFile); AllocateFileRange(file, pos.nPos, nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos); fclose(file); } } else return state.Error("out of disk space"); } return true; } bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW) { // Check proof of work matches claimed amount if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits)) return state.DoS(50, error("CheckBlockHeader() : proof of work failed"), REJECT_INVALID, "high-hash"); return true; } bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) { // These are checks that are independent of context. // Check that the header is valid (particularly PoW). This is mostly // redundant with the call in AcceptBlockHeader. if (!CheckBlockHeader(block, state, fCheckPOW)) return state.DoS(100, error("CheckBlock() : CheckBlockHeader failed"), REJECT_INVALID, "bad-header", true); // Check timestamp LogPrint("debug", "%s: block=%s is proof of stake=%d\n", __func__, block.GetHash().ToString().c_str(), block.IsProofOfStake()); if (block.GetBlockTime() > GetAdjustedTime() + (block.IsProofOfStake() ? 180 : 7200)) // 3 minute future drift for PoS return state.Invalid(error("CheckBlock() : block timestamp too far in the future"), REJECT_INVALID, "time-too-new"); // Check the merkle root. if (fCheckMerkleRoot) { bool mutated; uint256 hashMerkleRoot2 = block.BuildMerkleTree(&mutated); if (block.hashMerkleRoot != hashMerkleRoot2) return state.DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"), REJECT_INVALID, "bad-txnmrklroot", true); // Check for merkle tree malleability (CVE-2012-2459): repeating sequences // of transactions in a block without affecting the merkle root of a block, // while still invalidating it. if (mutated) return state.DoS(100, error("CheckBlock() : duplicate transaction"), REJECT_INVALID, "bad-txns-duplicate", true); } // All potential-corruption validation must be done before we do any // transaction validation, as otherwise we may mark the header as invalid // because we receive the wrong transactions for it. // Size limits unsigned int nMaxBlockSize = MAX_BLOCK_SIZE_CURRENT; if (block.vtx.empty() || block.vtx.size() > nMaxBlockSize || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > nMaxBlockSize) return state.DoS(100, error("CheckBlock() : size limits failed"), REJECT_INVALID, "bad-blk-length"); // First transaction must be coinbase, the rest must not be if (block.vtx.empty() || !block.vtx[0].IsCoinBase()) return state.DoS(100, error("CheckBlock() : first tx is not coinbase"), REJECT_INVALID, "bad-cb-missing"); for (unsigned int i = 1; i < block.vtx.size(); i++) if (block.vtx[i].IsCoinBase()) return state.DoS(100, error("CheckBlock() : more than one coinbase"), REJECT_INVALID, "bad-cb-multiple"); if (block.IsProofOfStake()) { // Coinbase output should be empty if proof-of-stake block if (block.vtx[0].vout.size() != 1 || !block.vtx[0].vout[0].IsEmpty()) return state.DoS(100, error("CheckBlock() : coinbase output not empty for proof-of-stake block")); // Second transaction must be coinstake, the rest must not be if (block.vtx.empty() || !block.vtx[1].IsCoinStake()) return state.DoS(100, error("CheckBlock() : second tx is not coinstake")); for (unsigned int i = 2; i < block.vtx.size(); i++) if (block.vtx[i].IsCoinStake()) return state.DoS(100, error("CheckBlock() : more than one coinstake")); } // ----------- swiftTX transaction scanning ----------- if (IsSporkActive(SPORK_3_SWIFTTX_BLOCK_FILTERING)) { BOOST_FOREACH (const CTransaction& tx, block.vtx) { if (!tx.IsCoinBase()) { //only reject blocks when it's based on complete consensus BOOST_FOREACH (const CTxIn& in, tx.vin) { if (mapLockedInputs.count(in.prevout)) { if (mapLockedInputs[in.prevout] != tx.GetHash()) { mapRejectedBlocks.insert(make_pair(block.GetHash(), GetTime())); LogPrintf("CheckBlock() : found conflicting transaction with transaction lock %s %s\n", mapLockedInputs[in.prevout].ToString(), tx.GetHash().ToString()); return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"), REJECT_INVALID, "conflicting-tx-ix"); } } } } } } else { LogPrintf("CheckBlock() : skipping transaction locking checks\n"); } // masternode payments / budgets and zerocoin check CBlockIndex* pindexPrev = chainActive.Tip(); int nHeight = 0; if (pindexPrev != NULL) { if (pindexPrev->GetBlockHash() == block.hashPrevBlock) { nHeight = pindexPrev->nHeight + 1; } else { //out of order BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock); if (mi != mapBlockIndex.end() && (*mi).second) nHeight = (*mi).second->nHeight + 1; } // Version 4 header must be used after Params().Zerocoin_StartHeight(). And never before. if (nHeight > Params().Zerocoin_StartHeight()) { if(block.nVersion < Params().Zerocoin_HeaderVersion()) return state.DoS(50, error("CheckBlockHeader() : block version must be above 4 after ZerocoinStartHeight"), REJECT_INVALID, "block-version"); } // Respawn // It is entierly possible that we don't have enough data and this could fail // (i.e. the block could indeed be valid). Store the block for later consideration // but issue an initial reject message. // The case also exists that the sending peer could not have enough data to see // that this block is invalid, so don't issue an outright ban. if (nHeight != 0 && !IsInitialBlockDownload()) { if (!IsBlockPayeeValid(block, nHeight)) { mapRejectedBlocks.insert(make_pair(block.GetHash(), GetTime())); return state.DoS(0, error("CheckBlock() : Couldn't find masternode/budget payment"), REJECT_INVALID, "bad-cb-payee"); } } else { if (fDebug) LogPrintf("CheckBlock(): Masternode payment check skipped on sync - skipping IsBlockPayeeValid()\n"); } } // Check transactions bool fZerocoinActive = true; vector<CBigNum> vBlockSerials; for (const CTransaction& tx : block.vtx) { if (!CheckTransaction(tx, fZerocoinActive, chainActive.Height() + 1 >= Params().Zerocoin_StartHeight(), state)) return error("CheckBlock() : CheckTransaction failed"); // double check that there are no double spent zRsp spends in this block if (tx.IsZerocoinSpend()) { for (const CTxIn txIn : tx.vin) { if (txIn.scriptSig.IsZerocoinSpend()) { libzerocoin::CoinSpend spend = TxInToZerocoinSpend(txIn); if (count(vBlockSerials.begin(), vBlockSerials.end(), spend.getCoinSerialNumber())) return state.DoS(100, error("%s : Double spending of zRsp serial %s in block\n Block: %s", __func__, spend.getCoinSerialNumber().GetHex(), block.ToString())); vBlockSerials.emplace_back(spend.getCoinSerialNumber()); } } } } unsigned int nSigOps = 0; BOOST_FOREACH (const CTransaction& tx, block.vtx) { nSigOps += GetLegacySigOpCount(tx); } unsigned int nMaxBlockSigOps = fZerocoinActive ? MAX_BLOCK_SIGOPS_CURRENT : MAX_BLOCK_SIGOPS_LEGACY; if (nSigOps > nMaxBlockSigOps) return state.DoS(100, error("CheckBlock() : out-of-bounds SigOpCount"), REJECT_INVALID, "bad-blk-sigops", true); return true; } bool CheckWork(const CBlock block, CBlockIndex* const pindexPrev) { if (pindexPrev == NULL) return error("%s : null pindexPrev for block %s", __func__, block.GetHash().ToString().c_str()); unsigned int nBitsRequired = GetNextWorkRequired(pindexPrev, &block); if (block.IsProofOfWork() && (pindexPrev->nHeight + 1 <= 68589)) { double n1 = ConvertBitsToDouble(block.nBits); double n2 = ConvertBitsToDouble(nBitsRequired); if (abs(n1 - n2) > n1 * 0.5) return error("%s : incorrect proof of work (DGW pre-fork) - %f %f %f at %d", __func__, abs(n1 - n2), n1, n2, pindexPrev->nHeight + 1); return true; } if (block.nBits != nBitsRequired) return error("%s : incorrect proof of work at %d", __func__, pindexPrev->nHeight + 1); if (block.IsProofOfStake()) { uint256 hashProofOfStake; uint256 hash = block.GetHash(); if(!CheckProofOfStake(block, hashProofOfStake)) { LogPrintf("WARNING: ProcessBlock(): check proof-of-stake failed for block %s\n", hash.ToString().c_str()); return false; } if(!mapProofOfStake.count(hash)) // add to mapProofOfStake mapProofOfStake.insert(make_pair(hash, hashProofOfStake)); } return true; } bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex* const pindexPrev) { uint256 hash = block.GetHash(); if (hash == Params().HashGenesisBlock()) return true; assert(pindexPrev); int nHeight = pindexPrev->nHeight + 1; //If this is a reorg, check that it is not too deep int nMaxReorgDepth = GetArg("-maxreorg", Params().MaxReorganizationDepth()); if (chainActive.Height() - nHeight >= nMaxReorgDepth) return state.DoS(1, error("%s: forked chain older than max reorganization depth (height %d)", __func__, nHeight)); // Check timestamp against prev if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) { LogPrintf("Block time = %d , GetMedianTimePast = %d \n", block.GetBlockTime(), pindexPrev->GetMedianTimePast()); return state.Invalid(error("%s : block's timestamp is too early", __func__), REJECT_INVALID, "time-too-old"); } // Check that the block chain matches the known block chain up to a checkpoint if (!Checkpoints::CheckBlock(nHeight, hash)) return state.DoS(100, error("%s : rejected by checkpoint lock-in at %d", __func__, nHeight), REJECT_CHECKPOINT, "checkpoint mismatch"); // Don't accept any forks from the main chain prior to last checkpoint CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(); if (pcheckpoint && nHeight < pcheckpoint->nHeight) return state.DoS(0, error("%s : forked chain older than last checkpoint (height %d)", __func__, nHeight)); return true; } bool IsBlockHashInChain(const uint256& hashBlock) { if (hashBlock == 0 || !mapBlockIndex.count(hashBlock)) return false; return chainActive.Contains(mapBlockIndex[hashBlock]); } bool IsTransactionInChain(uint256 txId, int& nHeightTx) { uint256 hashBlock; CTransaction tx; GetTransaction(txId, tx, hashBlock, true); if (!IsBlockHashInChain(hashBlock)) return false; nHeightTx = mapBlockIndex.at(hashBlock)->nHeight; return true; } bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex* const pindexPrev) { const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1; // Check that all transactions are finalized BOOST_FOREACH (const CTransaction& tx, block.vtx) if (!IsFinalTx(tx, nHeight, block.GetBlockTime())) { return state.DoS(10, error("%s : contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } return true; } bool AcceptBlockHeader(const CBlock& block, CValidationState& state, CBlockIndex** ppindex) { AssertLockHeld(cs_main); // Check for duplicate uint256 hash = block.GetHash(); BlockMap::iterator miSelf = mapBlockIndex.find(hash); CBlockIndex* pindex = NULL; // TODO : ENABLE BLOCK CACHE IN SPECIFIC CASES if (miSelf != mapBlockIndex.end()) { // Block header is already known. pindex = miSelf->second; if (ppindex) *ppindex = pindex; if (pindex->nStatus & BLOCK_FAILED_MASK) return state.Invalid(error("%s : block is marked invalid", __func__), 0, "duplicate"); return true; } if (!CheckBlockHeader(block, state, false)) { LogPrintf("AcceptBlockHeader(): CheckBlockHeader failed \n"); return false; } // Get prev block index CBlockIndex* pindexPrev = NULL; if (hash != Params().HashGenesisBlock()) { BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock); if (mi == mapBlockIndex.end()) return state.DoS(0, error("%s : prev block %s not found", __func__, block.hashPrevBlock.ToString().c_str()), 0, "bad-prevblk"); pindexPrev = (*mi).second; if (pindexPrev->nStatus & BLOCK_FAILED_MASK) return state.DoS(100, error("%s : prev block %s is invalid, unable to add block %s", __func__, block.hashPrevBlock.GetHex(), block.GetHash().GetHex()), REJECT_INVALID, "bad-prevblk"); } if (!ContextualCheckBlockHeader(block, state, pindexPrev)) return false; if (pindex == NULL) pindex = AddToBlockIndex(block); if (ppindex) *ppindex = pindex; return true; } bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex, CDiskBlockPos* dbp, bool fAlreadyCheckedBlock) { AssertLockHeld(cs_main); CBlockIndex*& pindex = *ppindex; // Get prev block index CBlockIndex* pindexPrev = NULL; if (block.GetHash() != Params().HashGenesisBlock()) { BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock); if (mi == mapBlockIndex.end()) return state.DoS(0, error("%s : prev block %s not found", __func__, block.hashPrevBlock.ToString().c_str()), 0, "bad-prevblk"); pindexPrev = (*mi).second; if (pindexPrev->nStatus & BLOCK_FAILED_MASK) return state.DoS(100, error("%s : prev block %s is invalid, unable to add block %s", __func__, block.hashPrevBlock.GetHex(), block.GetHash().GetHex()), REJECT_INVALID, "bad-prevblk"); } if (block.GetHash() != Params().HashGenesisBlock() && !CheckWork(block, pindexPrev)) return false; if (!AcceptBlockHeader(block, state, &pindex)) return false; if (pindex->nStatus & BLOCK_HAVE_DATA) { // TODO: deal better with duplicate blocks. // return state.DoS(20, error("AcceptBlock() : already have block %d %s", pindex->nHeight, pindex->GetBlockHash().ToString()), REJECT_DUPLICATE, "duplicate"); return true; } if ((!fAlreadyCheckedBlock && !CheckBlock(block, state)) || !ContextualCheckBlock(block, state, pindex->pprev)) { if (state.IsInvalid() && !state.CorruptionPossible()) { pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); } return false; } int nHeight = pindex->nHeight; // Write block to history file try { unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); CDiskBlockPos blockPos; if (dbp != NULL) blockPos = *dbp; if (!FindBlockPos(state, blockPos, nBlockSize + 8, nHeight, block.GetBlockTime(), dbp != NULL)) return error("AcceptBlock() : FindBlockPos failed"); if (dbp == NULL) if (!WriteBlockToDisk(block, blockPos)) return state.Abort("Failed to write block"); if (!ReceivedBlockTransactions(block, state, pindex, blockPos)) return error("AcceptBlock() : ReceivedBlockTransactions failed"); } catch (std::runtime_error& e) { return state.Abort(std::string("System error: ") + e.what()); } return true; } bool CBlockIndex::IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned int nRequired) { unsigned int nToCheck = Params().ToCheckBlockUpgradeMajority(); unsigned int nFound = 0; for (unsigned int i = 0; i < nToCheck && nFound < nRequired && pstart != NULL; i++) { if (pstart->nVersion >= minVersion) ++nFound; pstart = pstart->pprev; } return (nFound >= nRequired); } /** Turn the lowest '1' bit in the binary representation of a number into a '0'. */ int static inline InvertLowestOne(int n) { return n & (n - 1); } /** Compute what height to jump back to with the CBlockIndex::pskip pointer. */ int static inline GetSkipHeight(int height) { if (height < 2) return 0; // Determine which height to jump back to. Any number strictly lower than height is acceptable, // but the following expression seems to perform well in simulations (max 110 steps to go back // up to 2**18 blocks). return (height & 1) ? InvertLowestOne(InvertLowestOne(height - 1)) + 1 : InvertLowestOne(height); } CBlockIndex* CBlockIndex::GetAncestor(int height) { if (height > nHeight || height < 0) return NULL; CBlockIndex* pindexWalk = this; int heightWalk = nHeight; while (heightWalk > height) { int heightSkip = GetSkipHeight(heightWalk); int heightSkipPrev = GetSkipHeight(heightWalk - 1); if (heightSkip == height || (heightSkip > height && !(heightSkipPrev < heightSkip - 2 && heightSkipPrev >= height))) { // Only follow pskip if pprev->pskip isn't better than pskip->pprev. pindexWalk = pindexWalk->pskip; heightWalk = heightSkip; } else { pindexWalk = pindexWalk->pprev; heightWalk--; } } return pindexWalk; } const CBlockIndex* CBlockIndex::GetAncestor(int height) const { return const_cast<CBlockIndex*>(this)->GetAncestor(height); } void CBlockIndex::BuildSkip() { if (pprev) pskip = pprev->GetAncestor(GetSkipHeight(nHeight)); } bool ProcessNewBlock(CValidationState& state, CNode* pfrom, CBlock* pblock, CDiskBlockPos* dbp) { // Preliminary checks int64_t nStartTime = GetTimeMillis(); bool checked = CheckBlock(*pblock, state); int nMints = 0; int nSpends = 0; for (const CTransaction tx : pblock->vtx) { if (tx.ContainsZerocoins()) { for (const CTxIn in : tx.vin) { if (in.scriptSig.IsZerocoinSpend()) nSpends++; } for (const CTxOut out : tx.vout) { if (out.IsZerocoinMint()) nMints++; } } } if (nMints || nSpends) LogPrintf("%s : block contains %d zRsp mints and %d zRsp spends\n", __func__, nMints, nSpends); // ppcoin: check proof-of-stake // Limited duplicity on stake: prevents block flood attack // Duplicate stake allowed only when there is orphan child block //if (pblock->IsProofOfStake() && setStakeSeen.count(pblock->GetProofOfStake())/* && !mapOrphanBlocksByPrev.count(hash)*/) // return error("ProcessNewBlock() : duplicate proof-of-stake (%s, %d) for block %s", pblock->GetProofOfStake().first.ToString().c_str(), pblock->GetProofOfStake().second, pblock->GetHash().ToString().c_str()); // NovaCoin: check proof-of-stake block signature if (!pblock->CheckBlockSignature()) return error("ProcessNewBlock() : bad proof-of-stake block signature"); if (pblock->GetHash() != Params().HashGenesisBlock() && pfrom != NULL) { //if we get this far, check if the prev block is our prev block, if not then request sync and return false BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock); if (mi == mapBlockIndex.end()) { pfrom->PushMessage("getblocks", chainActive.GetLocator(), uint256(0)); return false; } } { LOCK(cs_main); // Replaces the former TRY_LOCK loop because busy waiting wastes too much resources MarkBlockAsReceived (pblock->GetHash ()); if (!checked) { return error ("%s : CheckBlock FAILED for block %s", __func__, pblock->GetHash().GetHex()); } // Store to disk CBlockIndex* pindex = NULL; bool ret = AcceptBlock (*pblock, state, &pindex, dbp, checked); if (pindex && pfrom) { mapBlockSource[pindex->GetBlockHash ()] = pfrom->GetId (); } CheckBlockIndex (); if (!ret) return error ("%s : AcceptBlock FAILED", __func__); } if (!ActivateBestChain(state, pblock, checked)) return error("%s : ActivateBestChain failed", __func__); if (!fLiteMode) { if (masternodeSync.RequestedMasternodeAssets > MASTERNODE_SYNC_LIST) { obfuScationPool.NewBlock(); masternodePayments.ProcessBlock(GetHeight() + 10); budget.NewBlock(); } } if (pwalletMain) { // If turned on MultiSend will send a transaction (or more) on the after maturity of a stake if (pwalletMain->isMultiSendEnabled()) pwalletMain->MultiSend(); // If turned on Auto Combine will scan wallet for dust to combine if (pwalletMain->fCombineDust) pwalletMain->AutoCombineDust(); } LogPrintf("%s : ACCEPTED in %ld milliseconds with size=%d\n", __func__, GetTimeMillis() - nStartTime, pblock->GetSerializeSize(SER_DISK, CLIENT_VERSION)); return true; } bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex* const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot) { AssertLockHeld(cs_main); assert(pindexPrev == chainActive.Tip()); CCoinsViewCache viewNew(pcoinsTip); CBlockIndex indexDummy(block); indexDummy.pprev = pindexPrev; indexDummy.nHeight = pindexPrev->nHeight + 1; // NOTE: CheckBlockHeader is called by CheckBlock if (!ContextualCheckBlockHeader(block, state, pindexPrev)) return false; if (!CheckBlock(block, state, fCheckPOW, fCheckMerkleRoot)) return false; if (!ContextualCheckBlock(block, state, pindexPrev)) return false; if (!ConnectBlock(block, state, &indexDummy, viewNew, true)) return false; assert(state.IsValid()); return true; } bool AbortNode(const std::string& strMessage, const std::string& userMessage) { strMiscWarning = strMessage; LogPrintf("*** %s\n", strMessage); uiInterface.ThreadSafeMessageBox( userMessage.empty() ? _("Error: A fatal internal error occured, see debug.log for details") : userMessage, "", CClientUIInterface::MSG_ERROR); StartShutdown(); return false; } bool CheckDiskSpace(uint64_t nAdditionalBytes) { uint64_t nFreeBytesAvailable = filesystem::space(GetDataDir()).available; // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) return AbortNode("Disk space is low!", _("Error: Disk space is low!")); return true; } FILE* OpenDiskFile(const CDiskBlockPos& pos, const char* prefix, bool fReadOnly) { if (pos.IsNull()) return NULL; boost::filesystem::path path = GetBlockPosFilename(pos, prefix); boost::filesystem::create_directories(path.parent_path()); FILE* file = fopen(path.string().c_str(), "rb+"); if (!file && !fReadOnly) file = fopen(path.string().c_str(), "wb+"); if (!file) { LogPrintf("Unable to open file %s\n", path.string()); return NULL; } if (pos.nPos) { if (fseek(file, pos.nPos, SEEK_SET)) { LogPrintf("Unable to seek to position %u of %s\n", pos.nPos, path.string()); fclose(file); return NULL; } } return file; } FILE* OpenBlockFile(const CDiskBlockPos& pos, bool fReadOnly) { return OpenDiskFile(pos, "blk", fReadOnly); } FILE* OpenUndoFile(const CDiskBlockPos& pos, bool fReadOnly) { return OpenDiskFile(pos, "rev", fReadOnly); } boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos& pos, const char* prefix) { return GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile); } CBlockIndex* InsertBlockIndex(uint256 hash) { if (hash == 0) return NULL; // Return existing BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) return (*mi).second; // Create new CBlockIndex* pindexNew = new CBlockIndex(); if (!pindexNew) throw runtime_error("LoadBlockIndex() : new CBlockIndex failed"); mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; //mark as PoS seen if (pindexNew->IsProofOfStake()) setStakeSeen.insert(make_pair(pindexNew->prevoutStake, pindexNew->nStakeTime)); pindexNew->phashBlock = &((*mi).first); return pindexNew; } bool static LoadBlockIndexDB() { if (!pblocktree->LoadBlockIndexGuts()) return false; boost::this_thread::interruption_point(); // Calculate nChainWork vector<pair<int, CBlockIndex*> > vSortedByHeight; vSortedByHeight.reserve(mapBlockIndex.size()); BOOST_FOREACH (const PAIRTYPE(uint256, CBlockIndex*) & item, mapBlockIndex) { CBlockIndex* pindex = item.second; vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex)); } sort(vSortedByHeight.begin(), vSortedByHeight.end()); BOOST_FOREACH (const PAIRTYPE(int, CBlockIndex*) & item, vSortedByHeight) { CBlockIndex* pindex = item.second; pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex); if (pindex->nStatus & BLOCK_HAVE_DATA) { if (pindex->pprev) { if (pindex->pprev->nChainTx) { pindex->nChainTx = pindex->pprev->nChainTx + pindex->nTx; } else { pindex->nChainTx = 0; mapBlocksUnlinked.insert(std::make_pair(pindex->pprev, pindex)); } } else { pindex->nChainTx = pindex->nTx; } } if (pindex->IsValid(BLOCK_VALID_TRANSACTIONS) && (pindex->nChainTx || pindex->pprev == NULL)) setBlockIndexCandidates.insert(pindex); if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork)) pindexBestInvalid = pindex; if (pindex->pprev) pindex->BuildSkip(); if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == NULL || CBlockIndexWorkComparator()(pindexBestHeader, pindex))) pindexBestHeader = pindex; } // Load block file info pblocktree->ReadLastBlockFile(nLastBlockFile); vinfoBlockFile.resize(nLastBlockFile + 1); LogPrintf("%s: last block file = %i\n", __func__, nLastBlockFile); for (int nFile = 0; nFile <= nLastBlockFile; nFile++) { pblocktree->ReadBlockFileInfo(nFile, vinfoBlockFile[nFile]); } LogPrintf("%s: last block file info: %s\n", __func__, vinfoBlockFile[nLastBlockFile].ToString()); for (int nFile = nLastBlockFile + 1; true; nFile++) { CBlockFileInfo info; if (pblocktree->ReadBlockFileInfo(nFile, info)) { vinfoBlockFile.push_back(info); } else { break; } } // Check presence of blk files LogPrintf("Checking all blk files are present...\n"); set<int> setBlkDataFiles; BOOST_FOREACH (const PAIRTYPE(uint256, CBlockIndex*) & item, mapBlockIndex) { CBlockIndex* pindex = item.second; if (pindex->nStatus & BLOCK_HAVE_DATA) { setBlkDataFiles.insert(pindex->nFile); } } for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++) { CDiskBlockPos pos(*it, 0); if (CAutoFile(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION).IsNull()) { return false; } } //Check if the shutdown procedure was followed on last client exit bool fLastShutdownWasPrepared = true; pblocktree->ReadFlag("shutdown", fLastShutdownWasPrepared); LogPrintf("%s: Last shutdown was prepared: %s\n", __func__, fLastShutdownWasPrepared); //Check for inconsistency with block file info and internal state if (!fLastShutdownWasPrepared && !GetBoolArg("-forcestart", false) && !GetBoolArg("-reindex", false) && (vSortedByHeight.size() != vinfoBlockFile[nLastBlockFile].nHeightLast + 1) && (vinfoBlockFile[nLastBlockFile].nHeightLast != 0)) { //The database is in a state where a block has been accepted and written to disk, but not //all of the block has perculated through the code. The block and the index should both be //intact (although assertions are added if they are not), and the block will be reprocessed //to ensure all data will be accounted for. LogPrintf("%s: Inconsistent State Detected mapBlockIndex.size()=%d blockFileBlocks=%d\n", __func__, vSortedByHeight.size(), vinfoBlockFile[nLastBlockFile].nHeightLast + 1); LogPrintf("%s: lastIndexPos=%d blockFileSize=%d\n", __func__, vSortedByHeight[vSortedByHeight.size() - 1].second->GetBlockPos().nPos, vinfoBlockFile[nLastBlockFile].nSize); //try reading the block from the last index we have bool isFixed = true; string strError = ""; LogPrintf("%s: Attempting to re-add last block that was recorded to disk\n", __func__); //get the last block that was properly recorded to the block info file CBlockIndex* pindexLastMeta = vSortedByHeight[vinfoBlockFile[nLastBlockFile].nHeightLast + 1].second; //fix Assertion `hashPrevBlock == view.GetBestBlock()' failed. By adjusting height to the last recorded by coinsview CBlockIndex* pindexCoinsView = mapBlockIndex[pcoinsTip->GetBestBlock()]; for(unsigned int i = vinfoBlockFile[nLastBlockFile].nHeightLast + 1; i < vSortedByHeight.size(); i++) { pindexLastMeta = vSortedByHeight[i].second; if(pindexLastMeta->nHeight > pindexCoinsView->nHeight) break; } LogPrintf("%s: Last block properly recorded: #%d %s\n", __func__, pindexLastMeta->nHeight, pindexLastMeta->GetBlockHash().ToString().c_str()); CBlock lastMetaBlock; if (!ReadBlockFromDisk(lastMetaBlock, pindexLastMeta)) { isFixed = false; strError = strprintf("failed to read block %d from disk", pindexLastMeta->nHeight); } //set the chain to the block before lastMeta so that the meta block will be seen as new chainActive.SetTip(pindexLastMeta->pprev); //Process the lastMetaBlock again, using the known location on disk CDiskBlockPos blockPos = pindexLastMeta->GetBlockPos(); CValidationState state; ProcessNewBlock(state, NULL, &lastMetaBlock, &blockPos); //ensure that everything is as it should be if (pcoinsTip->GetBestBlock() != vSortedByHeight[vSortedByHeight.size() - 1].second->GetBlockHash()) { isFixed = false; strError = "pcoinsTip best block is not correct"; } //properly account for all of the blocks that were not in the meta data. If this is not done the file //positioning will be wrong and blocks will be overwritten and later cause serialization errors CBlockIndex *pindexLast = vSortedByHeight[vSortedByHeight.size() - 1].second; CBlock lastBlock; if (!ReadBlockFromDisk(lastBlock, pindexLast)) { isFixed = false; strError = strprintf("failed to read block %d from disk", pindexLast->nHeight); } vinfoBlockFile[nLastBlockFile].nHeightLast = pindexLast->nHeight; vinfoBlockFile[nLastBlockFile].nSize = pindexLast->GetBlockPos().nPos + ::GetSerializeSize(lastBlock, SER_DISK, CLIENT_VERSION);; setDirtyFileInfo.insert(nLastBlockFile); FlushStateToDisk(state, FLUSH_STATE_ALWAYS); //Print out file info again pblocktree->ReadLastBlockFile(nLastBlockFile); vinfoBlockFile.resize(nLastBlockFile + 1); LogPrintf("%s: last block file = %i\n", __func__, nLastBlockFile); for (int nFile = 0; nFile <= nLastBlockFile; nFile++) { pblocktree->ReadBlockFileInfo(nFile, vinfoBlockFile[nFile]); } LogPrintf("%s: last block file info: %s\n", __func__, vinfoBlockFile[nLastBlockFile].ToString()); if (!isFixed) { strError = "Failed reading from database. " + strError + ". The block database is in an inconsistent state and may cause issues in the future." "To force start use -forcestart"; uiInterface.ThreadSafeMessageBox(strError, "", CClientUIInterface::MSG_ERROR); abort(); } LogPrintf("Passed corruption fix\n"); } // Check whether we need to continue reindexing bool fReindexing = false; pblocktree->ReadReindexing(fReindexing); fReindex |= fReindexing; // Check whether we have a transaction index pblocktree->ReadFlag("txindex", fTxIndex); LogPrintf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled"); // If this is written true before the next client init, then we know the shutdown process failed pblocktree->WriteFlag("shutdown", false); // Load pointer to end of best chain BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); if (it == mapBlockIndex.end()) return true; chainActive.SetTip(it->second); PruneBlockIndexCandidates(); LogPrintf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s progress=%f\n", chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), Checkpoints::GuessVerificationProgress(chainActive.Tip())); return true; } CVerifyDB::CVerifyDB() { uiInterface.ShowProgress(_("Verifying blocks..."), 0); } CVerifyDB::~CVerifyDB() { uiInterface.ShowProgress("", 100); } bool CVerifyDB::VerifyDB(CCoinsView* coinsview, int nCheckLevel, int nCheckDepth) { LOCK(cs_main); if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL) return true; // Verify blocks in the best chain if (nCheckDepth <= 0) nCheckDepth = 1000000000; // suffices until the year 19000 if (nCheckDepth > chainActive.Height()) nCheckDepth = chainActive.Height(); nCheckLevel = std::max(0, std::min(4, nCheckLevel)); LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel); CCoinsViewCache coins(coinsview); CBlockIndex* pindexState = chainActive.Tip(); CBlockIndex* pindexFailure = NULL; int nGoodTransactions = 0; CValidationState state; for (CBlockIndex* pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev) { boost::this_thread::interruption_point(); uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))))); if (pindex->nHeight < chainActive.Height() - nCheckDepth) break; CBlock block; // check level 0: read from disk if (!ReadBlockFromDisk(block, pindex)) return error("VerifyDB() : *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); // check level 1: verify block validity if (nCheckLevel >= 1 && !CheckBlock(block, state)) return error("VerifyDB() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); // check level 2: verify undo validity if (nCheckLevel >= 2 && pindex) { CBlockUndo undo; CDiskBlockPos pos = pindex->GetUndoPos(); if (!pos.IsNull()) { if (!undo.ReadFromDisk(pos, pindex->pprev->GetBlockHash())) return error("VerifyDB() : *** found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); } } // check level 3: check for inconsistencies during memory-only disconnect of tip blocks if (nCheckLevel >= 3 && pindex == pindexState && (coins.GetCacheSize() + pcoinsTip->GetCacheSize()) <= nCoinCacheSize) { bool fClean = true; if (!DisconnectBlock(block, state, pindex, coins, &fClean)) return error("VerifyDB() : *** irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); pindexState = pindex->pprev; if (!fClean) { nGoodTransactions = 0; pindexFailure = pindex; } else nGoodTransactions += block.vtx.size(); } if (ShutdownRequested()) return true; } if (pindexFailure) return error("VerifyDB() : *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainActive.Height() - pindexFailure->nHeight + 1, nGoodTransactions); // check level 4: try reconnecting blocks if (nCheckLevel >= 4) { CBlockIndex* pindex = pindexState; while (pindex != chainActive.Tip()) { boost::this_thread::interruption_point(); uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)))); pindex = chainActive.Next(pindex); CBlock block; if (!ReadBlockFromDisk(block, pindex)) return error("VerifyDB() : *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); if (!ConnectBlock(block, state, pindex, coins, false)) return error("VerifyDB() : *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); } } LogPrintf("No coin database inconsistencies in last %i blocks (%i transactions)\n", chainActive.Height() - pindexState->nHeight, nGoodTransactions); return true; } void UnloadBlockIndex() { mapBlockIndex.clear(); setBlockIndexCandidates.clear(); chainActive.SetTip(NULL); pindexBestInvalid = NULL; } bool LoadBlockIndex() { // Load block index from databases if (!fReindex && !LoadBlockIndexDB()) return false; return true; } bool InitBlockIndex() { LOCK(cs_main); // Check whether we're already initialized if (chainActive.Genesis() != NULL) return true; // Use the provided setting for -txindex in the new database fTxIndex = GetBoolArg("-txindex", true); pblocktree->WriteFlag("txindex", fTxIndex); LogPrintf("Initializing databases...\n"); // Only add the genesis block if not reindexing (in which case we reuse the one already on disk) if (!fReindex) { try { CBlock& block = const_cast<CBlock&>(Params().GenesisBlock()); // Start new block file unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); CDiskBlockPos blockPos; CValidationState state; if (!FindBlockPos(state, blockPos, nBlockSize + 8, 0, block.GetBlockTime())) return error("LoadBlockIndex() : FindBlockPos failed"); if (!WriteBlockToDisk(block, blockPos)) return error("LoadBlockIndex() : writing genesis block to disk failed"); CBlockIndex* pindex = AddToBlockIndex(block); if (!ReceivedBlockTransactions(block, state, pindex, blockPos)) return error("LoadBlockIndex() : genesis block not accepted"); if (!ActivateBestChain(state, &block)) return error("LoadBlockIndex() : genesis block cannot be activated"); // Force a chainstate write so that when we VerifyDB in a moment, it doesnt check stale data return FlushStateToDisk(state, FLUSH_STATE_ALWAYS); } catch (std::runtime_error& e) { return error("LoadBlockIndex() : failed to initialize block database: %s", e.what()); } } return true; } bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos* dbp) { // Map of disk positions for blocks with unknown parent (only used for reindex) static std::multimap<uint256, CDiskBlockPos> mapBlocksUnknownParent; int64_t nStart = GetTimeMillis(); int nLoaded = 0; try { // This takes over fileIn and calls fclose() on it in the CBufferedFile destructor CBufferedFile blkdat(fileIn, 2 * MAX_BLOCK_SIZE_CURRENT, MAX_BLOCK_SIZE_CURRENT + 8, SER_DISK, CLIENT_VERSION); uint64_t nRewind = blkdat.GetPos(); while (!blkdat.eof()) { boost::this_thread::interruption_point(); blkdat.SetPos(nRewind); nRewind++; // start one byte further next time, in case of failure blkdat.SetLimit(); // remove former limit unsigned int nSize = 0; try { // locate a header unsigned char buf[MESSAGE_START_SIZE]; blkdat.FindByte(Params().MessageStart()[0]); nRewind = blkdat.GetPos() + 1; blkdat >> FLATDATA(buf); if (memcmp(buf, Params().MessageStart(), MESSAGE_START_SIZE)) continue; // read size blkdat >> nSize; if (nSize < 80 || nSize > MAX_BLOCK_SIZE_CURRENT) continue; } catch (const std::exception&) { // no valid block header found; don't complain break; } try { // read block uint64_t nBlockPos = blkdat.GetPos(); if (dbp) dbp->nPos = nBlockPos; blkdat.SetLimit(nBlockPos + nSize); blkdat.SetPos(nBlockPos); CBlock block; blkdat >> block; nRewind = blkdat.GetPos(); // detect out of order blocks, and store them for later uint256 hash = block.GetHash(); if (hash != Params().HashGenesisBlock() && mapBlockIndex.find(block.hashPrevBlock) == mapBlockIndex.end()) { LogPrint("reindex", "%s: Out of order block %s, parent %s not known\n", __func__, hash.ToString(), block.hashPrevBlock.ToString()); if (dbp) mapBlocksUnknownParent.insert(std::make_pair(block.hashPrevBlock, *dbp)); continue; } // process in case the block isn't known yet if (mapBlockIndex.count(hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0) { CValidationState state; if (ProcessNewBlock(state, NULL, &block, dbp)) nLoaded++; if (state.IsError()) break; } else if (hash != Params().HashGenesisBlock() && mapBlockIndex[hash]->nHeight % 1000 == 0) { LogPrintf("Block Import: already had block %s at height %d\n", hash.ToString(), mapBlockIndex[hash]->nHeight); } // Recursively process earlier encountered successors of this block deque<uint256> queue; queue.push_back(hash); while (!queue.empty()) { uint256 head = queue.front(); queue.pop_front(); std::pair<std::multimap<uint256, CDiskBlockPos>::iterator, std::multimap<uint256, CDiskBlockPos>::iterator> range = mapBlocksUnknownParent.equal_range(head); while (range.first != range.second) { std::multimap<uint256, CDiskBlockPos>::iterator it = range.first; if (ReadBlockFromDisk(block, it->second)) { LogPrintf("%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(), head.ToString()); CValidationState dummy; if (ProcessNewBlock(dummy, NULL, &block, &it->second)) { nLoaded++; queue.push_back(block.GetHash()); } } range.first++; mapBlocksUnknownParent.erase(it); } } } catch (std::exception& e) { LogPrintf("%s : Deserialize or I/O error - %s", __func__, e.what()); } } } catch (std::runtime_error& e) { AbortNode(std::string("System error: ") + e.what()); } if (nLoaded > 0) LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, GetTimeMillis() - nStart); return nLoaded > 0; } void static CheckBlockIndex() { if (!fCheckBlockIndex) { return; } LOCK(cs_main); // During a reindex, we read the genesis block and call CheckBlockIndex before ActivateBestChain, // so we have the genesis block in mapBlockIndex but no active chain. (A few of the tests when // iterating the block tree require that chainActive has been initialized.) if (chainActive.Height() < 0) { assert(mapBlockIndex.size() <= 1); return; } // Build forward-pointing map of the entire block tree. std::multimap<CBlockIndex*, CBlockIndex*> forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { forward.insert(std::make_pair(it->second->pprev, it->second)); } assert(forward.size() == mapBlockIndex.size()); std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> rangeGenesis = forward.equal_range(NULL); CBlockIndex* pindex = rangeGenesis.first->second; rangeGenesis.first++; assert(rangeGenesis.first == rangeGenesis.second); // There is only one index entry with parent NULL. // Iterate over the entire block tree, using depth-first search. // Along the way, remember whether there are blocks on the path from genesis // block being explored which are the first to have certain properties. size_t nNodes = 0; int nHeight = 0; CBlockIndex* pindexFirstInvalid = NULL; // Oldest ancestor of pindex which is invalid. CBlockIndex* pindexFirstMissing = NULL; // Oldest ancestor of pindex which does not have BLOCK_HAVE_DATA. CBlockIndex* pindexFirstNotTreeValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_TREE (regardless of being valid or not). CBlockIndex* pindexFirstNotChainValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_CHAIN (regardless of being valid or not). CBlockIndex* pindexFirstNotScriptsValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_SCRIPTS (regardless of being valid or not). while (pindex != NULL) { nNodes++; if (pindexFirstInvalid == NULL && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex; if (pindexFirstMissing == NULL && !(pindex->nStatus & BLOCK_HAVE_DATA)) pindexFirstMissing = pindex; if (pindex->pprev != NULL && pindexFirstNotTreeValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TREE) pindexFirstNotTreeValid = pindex; if (pindex->pprev != NULL && pindexFirstNotChainValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_CHAIN) pindexFirstNotChainValid = pindex; if (pindex->pprev != NULL && pindexFirstNotScriptsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS) pindexFirstNotScriptsValid = pindex; // Begin: actual consistency checks. if (pindex->pprev == NULL) { // Genesis block checks. assert(pindex->GetBlockHash() == Params().HashGenesisBlock()); // Genesis block's hash must match. assert(pindex == chainActive.Genesis()); // The current active chain's genesis block must be this block. } // HAVE_DATA is equivalent to VALID_TRANSACTIONS and equivalent to nTx > 0 (we stored the number of transactions in the block) assert(!(pindex->nStatus & BLOCK_HAVE_DATA) == (pindex->nTx == 0)); assert(((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS) == (pindex->nTx > 0)); if (pindex->nChainTx == 0) assert(pindex->nSequenceId == 0); // nSequenceId can't be set for blocks that aren't linked // All parents having data is equivalent to all parents being VALID_TRANSACTIONS, which is equivalent to nChainTx being set. assert((pindexFirstMissing != NULL) == (pindex->nChainTx == 0)); // nChainTx == 0 is used to signal that all parent block's transaction data is available. assert(pindex->nHeight == nHeight); // nHeight must be consistent. assert(pindex->pprev == NULL || pindex->nChainWork >= pindex->pprev->nChainWork); // For every block except the genesis block, the chainwork must be larger than the parent's. assert(nHeight < 2 || (pindex->pskip && (pindex->pskip->nHeight < nHeight))); // The pskip pointer must point back for all but the first 2 blocks. assert(pindexFirstNotTreeValid == NULL); // All mapBlockIndex entries must at least be TREE valid if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TREE) assert(pindexFirstNotTreeValid == NULL); // TREE valid implies all parents are TREE valid if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_CHAIN) assert(pindexFirstNotChainValid == NULL); // CHAIN valid implies all parents are CHAIN valid if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_SCRIPTS) assert(pindexFirstNotScriptsValid == NULL); // SCRIPTS valid implies all parents are SCRIPTS valid if (pindexFirstInvalid == NULL) { // Checks for not-invalid blocks. assert((pindex->nStatus & BLOCK_FAILED_MASK) == 0); // The failed mask cannot be set for blocks without invalid parents. } if (!CBlockIndexWorkComparator()(pindex, chainActive.Tip()) && pindexFirstMissing == NULL) { if (pindexFirstInvalid == NULL) { // If this block sorts at least as good as the current tip and is valid, it must be in setBlockIndexCandidates. assert(setBlockIndexCandidates.count(pindex)); } } else { // If this block sorts worse than the current tip, it cannot be in setBlockIndexCandidates. assert(setBlockIndexCandidates.count(pindex) == 0); } // Check whether this block is in mapBlocksUnlinked. std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> rangeUnlinked = mapBlocksUnlinked.equal_range(pindex->pprev); bool foundInUnlinked = false; while (rangeUnlinked.first != rangeUnlinked.second) { assert(rangeUnlinked.first->first == pindex->pprev); if (rangeUnlinked.first->second == pindex) { foundInUnlinked = true; break; } rangeUnlinked.first++; } if (pindex->pprev && pindex->nStatus & BLOCK_HAVE_DATA && pindexFirstMissing != NULL) { if (pindexFirstInvalid == NULL) { // If this block has block data available, some parent doesn't, and has no invalid parents, it must be in mapBlocksUnlinked. assert(foundInUnlinked); } } else { // If this block does not have block data available, or all parents do, it cannot be in mapBlocksUnlinked. assert(!foundInUnlinked); } // assert(pindex->GetBlockHash() == pindex->GetBlockHeader().GetHash()); // Perhaps too slow // End: actual consistency checks. // Try descending into the first subnode. std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = forward.equal_range(pindex); if (range.first != range.second) { // A subnode was found. pindex = range.first->second; nHeight++; continue; } // This is a leaf node. // Move upwards until we reach a node of which we have not yet visited the last child. while (pindex) { // We are going to either move to a parent or a sibling of pindex. // If pindex was the first with a certain property, unset the corresponding variable. if (pindex == pindexFirstInvalid) pindexFirstInvalid = NULL; if (pindex == pindexFirstMissing) pindexFirstMissing = NULL; if (pindex == pindexFirstNotTreeValid) pindexFirstNotTreeValid = NULL; if (pindex == pindexFirstNotChainValid) pindexFirstNotChainValid = NULL; if (pindex == pindexFirstNotScriptsValid) pindexFirstNotScriptsValid = NULL; // Find our parent. CBlockIndex* pindexPar = pindex->pprev; // Find which child we just visited. std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> rangePar = forward.equal_range(pindexPar); while (rangePar.first->second != pindex) { assert(rangePar.first != rangePar.second); // Our parent must have at least the node we're coming from as child. rangePar.first++; } // Proceed to the next one. rangePar.first++; if (rangePar.first != rangePar.second) { // Move to the sibling. pindex = rangePar.first->second; break; } else { // Move up further. pindex = pindexPar; nHeight--; continue; } } } // Check that we actually traversed the entire map. assert(nNodes == forward.size()); } ////////////////////////////////////////////////////////////////////////////// // // CAlert // string GetWarnings(string strFor) { int nPriority = 0; string strStatusBar; string strRPC; if (!CLIENT_VERSION_IS_RELEASE) strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for staking or merchant applications!"); if (GetBoolArg("-testsafemode", false)) strStatusBar = strRPC = "testsafemode enabled"; // Misc warnings like out of disk space and clock is wrong if (strMiscWarning != "") { nPriority = 1000; strStatusBar = strMiscWarning; } if (fLargeWorkForkFound) { nPriority = 2000; strStatusBar = strRPC = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."); } else if (fLargeWorkInvalidChainFound) { nPriority = 2000; strStatusBar = strRPC = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."); } // Alerts { LOCK(cs_mapAlerts); BOOST_FOREACH (PAIRTYPE(const uint256, CAlert) & item, mapAlerts) { const CAlert& alert = item.second; if (alert.AppliesToMe() && alert.nPriority > nPriority) { nPriority = alert.nPriority; strStatusBar = alert.strStatusBar; } } } if (strFor == "statusbar") return strStatusBar; else if (strFor == "rpc") return strRPC; assert(!"GetWarnings() : invalid parameter"); return "error"; } ////////////////////////////////////////////////////////////////////////////// // // Messages // bool static AlreadyHave(const CInv& inv) { switch (inv.type) { case MSG_TX: { bool txInMap = false; txInMap = mempool.exists(inv.hash); return txInMap || mapOrphanTransactions.count(inv.hash) || pcoinsTip->HaveCoins(inv.hash); } case MSG_DSTX: return mapObfuscationBroadcastTxes.count(inv.hash); case MSG_BLOCK: return mapBlockIndex.count(inv.hash); case MSG_TXLOCK_REQUEST: return mapTxLockReq.count(inv.hash) || mapTxLockReqRejected.count(inv.hash); case MSG_TXLOCK_VOTE: return mapTxLockVote.count(inv.hash); case MSG_SPORK: return mapSporks.count(inv.hash); case MSG_MASTERNODE_WINNER: if (masternodePayments.mapMasternodePayeeVotes.count(inv.hash)) { masternodeSync.AddedMasternodeWinner(inv.hash); return true; } return false; case MSG_BUDGET_VOTE: if (budget.mapSeenMasternodeBudgetVotes.count(inv.hash)) { masternodeSync.AddedBudgetItem(inv.hash); return true; } return false; case MSG_BUDGET_PROPOSAL: if (budget.mapSeenMasternodeBudgetProposals.count(inv.hash)) { masternodeSync.AddedBudgetItem(inv.hash); return true; } return false; case MSG_BUDGET_FINALIZED_VOTE: if (budget.mapSeenFinalizedBudgetVotes.count(inv.hash)) { masternodeSync.AddedBudgetItem(inv.hash); return true; } return false; case MSG_BUDGET_FINALIZED: if (budget.mapSeenFinalizedBudgets.count(inv.hash)) { masternodeSync.AddedBudgetItem(inv.hash); return true; } return false; case MSG_MASTERNODE_ANNOUNCE: if (mnodeman.mapSeenMasternodeBroadcast.count(inv.hash)) { masternodeSync.AddedMasternodeList(inv.hash); return true; } return false; case MSG_MASTERNODE_PING: return mnodeman.mapSeenMasternodePing.count(inv.hash); } // Don't know what it is, just say we already got one return true; } void static ProcessGetData(CNode* pfrom) { std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin(); vector<CInv> vNotFound; LOCK(cs_main); while (it != pfrom->vRecvGetData.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; const CInv& inv = *it; { boost::this_thread::interruption_point(); it++; if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) { bool send = false; BlockMap::iterator mi = mapBlockIndex.find(inv.hash); if (mi != mapBlockIndex.end()) { if (chainActive.Contains(mi->second)) { send = true; } else { // To prevent fingerprinting attacks, only send blocks outside of the active // chain if they are valid, and no more than a max reorg depth than the best header // chain we know about. send = mi->second->IsValid(BLOCK_VALID_SCRIPTS) && (pindexBestHeader != NULL) && (chainActive.Height() - mi->second->nHeight < Params().MaxReorganizationDepth()); if (!send) { LogPrintf("ProcessGetData(): ignoring request from peer=%i for old block that isn't in the main chain\n", pfrom->GetId()); } } } // Don't send not-validated blocks if (send && (mi->second->nStatus & BLOCK_HAVE_DATA)) { // Send block from disk CBlock block; if (!ReadBlockFromDisk(block, (*mi).second)) assert(!"cannot load block from disk"); if (inv.type == MSG_BLOCK) pfrom->PushMessage("block", block); else // MSG_FILTERED_BLOCK) { LOCK(pfrom->cs_filter); if (pfrom->pfilter) { CMerkleBlock merkleBlock(block, *pfrom->pfilter); pfrom->PushMessage("merkleblock", merkleBlock); // CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see // This avoids hurting performance by pointlessly requiring a round-trip // Note that there is currently no way for a node to request any single transactions we didnt send here - // they must either disconnect and retry or request the full block. // Thus, the protocol spec specified allows for us to provide duplicate txn here, // however we MUST always provide at least what the remote peer needs typedef std::pair<unsigned int, uint256> PairType; BOOST_FOREACH (PairType& pair, merkleBlock.vMatchedTxn) if (!pfrom->setInventoryKnown.count(CInv(MSG_TX, pair.second))) pfrom->PushMessage("tx", block.vtx[pair.first]); } // else // no response } // Trigger them to send a getblocks request for the next batch of inventory if (inv.hash == pfrom->hashContinue) { // Bypass PushInventory, this must send even if redundant, // and we want it right after the last block so they don't // wait for other stuff first. vector<CInv> vInv; vInv.push_back(CInv(MSG_BLOCK, chainActive.Tip()->GetBlockHash())); pfrom->PushMessage("inv", vInv); pfrom->hashContinue = 0; } } } else if (inv.IsKnownType()) { // Send stream from relay memory bool pushed = false; { LOCK(cs_mapRelay); map<CInv, CDataStream>::iterator mi = mapRelay.find(inv); if (mi != mapRelay.end()) { pfrom->PushMessage(inv.GetCommand(), (*mi).second); pushed = true; } } if (!pushed && inv.type == MSG_TX) { CTransaction tx; if (mempool.lookup(inv.hash, tx)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << tx; pfrom->PushMessage("tx", ss); pushed = true; } } if (!pushed && inv.type == MSG_TXLOCK_VOTE) { if (mapTxLockVote.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << mapTxLockVote[inv.hash]; pfrom->PushMessage("txlvote", ss); pushed = true; } } if (!pushed && inv.type == MSG_TXLOCK_REQUEST) { if (mapTxLockReq.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << mapTxLockReq[inv.hash]; pfrom->PushMessage("ix", ss); pushed = true; } } if (!pushed && inv.type == MSG_SPORK) { if (mapSporks.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << mapSporks[inv.hash]; pfrom->PushMessage("spork", ss); pushed = true; } } if (!pushed && inv.type == MSG_MASTERNODE_WINNER) { if (masternodePayments.mapMasternodePayeeVotes.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << masternodePayments.mapMasternodePayeeVotes[inv.hash]; pfrom->PushMessage("mnw", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_VOTE) { if (budget.mapSeenMasternodeBudgetVotes.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << budget.mapSeenMasternodeBudgetVotes[inv.hash]; pfrom->PushMessage("mvote", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_PROPOSAL) { if (budget.mapSeenMasternodeBudgetProposals.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << budget.mapSeenMasternodeBudgetProposals[inv.hash]; pfrom->PushMessage("mprop", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_FINALIZED_VOTE) { if (budget.mapSeenFinalizedBudgetVotes.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << budget.mapSeenFinalizedBudgetVotes[inv.hash]; pfrom->PushMessage("fbvote", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_FINALIZED) { if (budget.mapSeenFinalizedBudgets.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << budget.mapSeenFinalizedBudgets[inv.hash]; pfrom->PushMessage("fbs", ss); pushed = true; } } if (!pushed && inv.type == MSG_MASTERNODE_ANNOUNCE) { if (mnodeman.mapSeenMasternodeBroadcast.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << mnodeman.mapSeenMasternodeBroadcast[inv.hash]; pfrom->PushMessage("mnb", ss); pushed = true; } } if (!pushed && inv.type == MSG_MASTERNODE_PING) { if (mnodeman.mapSeenMasternodePing.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << mnodeman.mapSeenMasternodePing[inv.hash]; pfrom->PushMessage("mnp", ss); pushed = true; } } if (!pushed && inv.type == MSG_DSTX) { if (mapObfuscationBroadcastTxes.count(inv.hash)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << mapObfuscationBroadcastTxes[inv.hash].tx << mapObfuscationBroadcastTxes[inv.hash].vin << mapObfuscationBroadcastTxes[inv.hash].vchSig << mapObfuscationBroadcastTxes[inv.hash].sigTime; pfrom->PushMessage("dstx", ss); pushed = true; } } if (!pushed) { vNotFound.push_back(inv); } } // Track requests for our stuff. g_signals.Inventory(inv.hash); if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) break; } } pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it); if (!vNotFound.empty()) { // Let the peer know that we didn't find what it asked for, so it doesn't // have to wait around forever. Currently only SPV clients actually care // about this message: it's needed when they are recursively walking the // dependencies of relevant unconfirmed transactions. SPV clients want to // do that because they want to know about (and store and rebroadcast and // risk analyze) the dependencies of transactions relevant to them, without // having to download the entire memory pool. pfrom->PushMessage("notfound", vNotFound); } } bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived) { RandAddSeedPerfmon(); if (fDebug) LogPrintf("received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id); if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) { LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n"); return true; } if (strCommand == "version") { // Each connection can only send one version message if (pfrom->nVersion != 0) { pfrom->PushMessage("reject", strCommand, REJECT_DUPLICATE, string("Duplicate version message")); Misbehaving(pfrom->GetId(), 1); return false; } // Respawn: We use certain sporks during IBD, so check to see if they are // available. If not, ask the first peer connected for them. if (!pSporkDB->SporkExists(SPORK_14_NEW_PROTOCOL_ENFORCEMENT) && !pSporkDB->SporkExists(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2) && !pSporkDB->SporkExists(SPORK_11_LOCK_INVALID_UTXO) && !pSporkDB->SporkExists(SPORK_16_ZEROCOIN_MAINTENANCE_MODE)) { LogPrintf("Required sporks not found, asking peer to send them\n"); pfrom->PushMessage("getsporks"); } int64_t nTime; CAddress addrMe; CAddress addrFrom; uint64_t nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; if (pfrom->DisconnectOldProtocol(ActiveProtocol(), strCommand)) return false; if (pfrom->nVersion == 10300) pfrom->nVersion = 300; if (!vRecv.empty()) vRecv >> addrFrom >> nNonce; if (!vRecv.empty()) { vRecv >> LIMITED_STRING(pfrom->strSubVer, 256); pfrom->cleanSubVer = SanitizeString(pfrom->strSubVer); } if (!vRecv.empty()) vRecv >> pfrom->nStartingHeight; if (!vRecv.empty()) vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message else pfrom->fRelayTxes = true; // Disconnect if we connected to ourself if (nNonce == nLocalHostNonce && nNonce > 1) { LogPrintf("connected to self at %s, disconnecting\n", pfrom->addr.ToString()); pfrom->fDisconnect = true; return true; } pfrom->addrLocal = addrMe; if (pfrom->fInbound && addrMe.IsRoutable()) { SeenLocal(addrMe); } // Be shy and don't send version until we hear if (pfrom->fInbound) pfrom->PushVersion(); pfrom->fClient = !(pfrom->nServices & NODE_NETWORK); // Potentially mark this peer as a preferred download peer. UpdatePreferredDownload(pfrom, State(pfrom->GetId())); // Change version pfrom->PushMessage("verack"); pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); if (!pfrom->fInbound) { // Advertise our address if (fListen && !IsInitialBlockDownload()) { CAddress addr = GetLocalAddress(&pfrom->addr); if (addr.IsRoutable()) { LogPrintf("ProcessMessages: advertizing address %s\n", addr.ToString()); pfrom->PushAddress(addr); } else if (IsPeerAddrLocalGood(pfrom)) { addr.SetIP(pfrom->addrLocal); LogPrintf("ProcessMessages: advertizing address %s\n", addr.ToString()); pfrom->PushAddress(addr); } } // Get recent addresses if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || addrman.size() < 1000) { pfrom->PushMessage("getaddr"); pfrom->fGetAddr = true; } addrman.Good(pfrom->addr); } else { if (((CNetAddr)pfrom->addr) == (CNetAddr)addrFrom) { addrman.Add(addrFrom, addrFrom); addrman.Good(addrFrom); } } // Relay alerts { LOCK(cs_mapAlerts); BOOST_FOREACH (PAIRTYPE(const uint256, CAlert) & item, mapAlerts) item.second.RelayTo(pfrom); } pfrom->fSuccessfullyConnected = true; string remoteAddr; if (fLogIPs) remoteAddr = ", peeraddr=" + pfrom->addr.ToString(); LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n", pfrom->cleanSubVer, pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString(), pfrom->id, remoteAddr); AddTimeData(pfrom->addr, nTime); } else if (pfrom->nVersion == 0) { // Must have a version message before anything else Misbehaving(pfrom->GetId(), 1); return false; } else if (strCommand == "verack") { pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); // Mark this node as currently connected, so we update its timestamp later. if (pfrom->fNetworkNode) { LOCK(cs_main); State(pfrom->GetId())->fCurrentlyConnected = true; } } else if (strCommand == "addr") { vector<CAddress> vAddr; vRecv >> vAddr; // Don't want addr from older versions unless seeding if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000) return true; if (vAddr.size() > 1000) { Misbehaving(pfrom->GetId(), 20); return error("message addr size() = %u", vAddr.size()); } // Store the new addresses vector<CAddress> vAddrOk; int64_t nNow = GetAdjustedTime(); int64_t nSince = nNow - 10 * 60; BOOST_FOREACH (CAddress& addr, vAddr) { boost::this_thread::interruption_point(); if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) addr.nTime = nNow - 5 * 24 * 60 * 60; pfrom->AddAddressKnown(addr); bool fReachable = IsReachable(addr); if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable()) { // Relay to a limited number of other nodes { LOCK(cs_vNodes); // Use deterministic randomness to send to the same nodes for 24 hours // at a time so the setAddrKnowns of the chosen nodes prevent repeats static uint256 hashSalt; if (hashSalt == 0) hashSalt = GetRandHash(); uint64_t hashAddr = addr.GetHash(); uint256 hashRand = hashSalt ^ (hashAddr << 32) ^ ((GetTime() + hashAddr) / (24 * 60 * 60)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); multimap<uint256, CNode*> mapMix; BOOST_FOREACH (CNode* pnode, vNodes) { if (pnode->nVersion < CADDR_TIME_VERSION) continue; unsigned int nPointer; memcpy(&nPointer, &pnode, sizeof(nPointer)); uint256 hashKey = hashRand ^ nPointer; hashKey = Hash(BEGIN(hashKey), END(hashKey)); mapMix.insert(make_pair(hashKey, pnode)); } int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s) for (multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi) ((*mi).second)->PushAddress(addr); } } // Do not store addresses outside our network if (fReachable) vAddrOk.push_back(addr); } addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60); if (vAddr.size() < 1000) pfrom->fGetAddr = false; if (pfrom->fOneShot) pfrom->fDisconnect = true; } else if (strCommand == "inv") { vector<CInv> vInv; vRecv >> vInv; if (vInv.size() > MAX_INV_SZ) { Misbehaving(pfrom->GetId(), 20); return error("message inv size() = %u", vInv.size()); } LOCK(cs_main); std::vector<CInv> vToFetch; for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) { const CInv& inv = vInv[nInv]; boost::this_thread::interruption_point(); pfrom->AddInventoryKnown(inv); bool fAlreadyHave = AlreadyHave(inv); LogPrint("net", "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->id); if (!fAlreadyHave && !fImporting && !fReindex && inv.type != MSG_BLOCK) pfrom->AskFor(inv); if (inv.type == MSG_BLOCK) { UpdateBlockAvailability(pfrom->GetId(), inv.hash); if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) { // Add this to the list of blocks to request vToFetch.push_back(inv); LogPrint("net", "getblocks (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id); } } // Track requests for our stuff g_signals.Inventory(inv.hash); if (pfrom->nSendSize > (SendBufferSize() * 2)) { Misbehaving(pfrom->GetId(), 50); return error("send buffer size() = %u", pfrom->nSendSize); } } if (!vToFetch.empty()) pfrom->PushMessage("getdata", vToFetch); } else if (strCommand == "getdata") { vector<CInv> vInv; vRecv >> vInv; if (vInv.size() > MAX_INV_SZ) { Misbehaving(pfrom->GetId(), 20); return error("message getdata size() = %u", vInv.size()); } if (fDebug || (vInv.size() != 1)) LogPrint("net", "received getdata (%u invsz) peer=%d\n", vInv.size(), pfrom->id); if ((fDebug && vInv.size() > 0) || (vInv.size() == 1)) LogPrint("net", "received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->id); pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end()); ProcessGetData(pfrom); } else if (strCommand == "getblocks" || strCommand == "getheaders") { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; LOCK(cs_main); // Find the last block the caller has in the main chain CBlockIndex* pindex = FindForkInGlobalIndex(chainActive, locator); // Send the rest of the chain if (pindex) pindex = chainActive.Next(pindex); int nLimit = 500; LogPrint("net", "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop == uint256(0) ? "end" : hashStop.ToString(), nLimit, pfrom->id); for (; pindex; pindex = chainActive.Next(pindex)) { if (pindex->GetBlockHash() == hashStop) { LogPrint("net", " getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); break; } pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); if (--nLimit <= 0) { // When this block is requested, we'll send an inv that'll make them // getblocks the next batch of inventory. LogPrint("net", " getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); pfrom->hashContinue = pindex->GetBlockHash(); break; } } } else if (strCommand == "headers" && Params().HeadersFirstSyncingActive()) { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; LOCK(cs_main); if (IsInitialBlockDownload()) return true; CBlockIndex* pindex = NULL; if (locator.IsNull()) { // If locator is null, return the hashStop block BlockMap::iterator mi = mapBlockIndex.find(hashStop); if (mi == mapBlockIndex.end()) return true; pindex = (*mi).second; } else { // Find the last block the caller has in the main chain pindex = FindForkInGlobalIndex(chainActive, locator); if (pindex) pindex = chainActive.Next(pindex); } // we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end vector<CBlock> vHeaders; int nLimit = MAX_HEADERS_RESULTS; if (fDebug) LogPrintf("getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id); for (; pindex; pindex = chainActive.Next(pindex)) { vHeaders.push_back(pindex->GetBlockHeader()); if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop) break; } pfrom->PushMessage("headers", vHeaders); } else if (strCommand == "tx" || strCommand == "dstx") { vector<uint256> vWorkQueue; vector<uint256> vEraseQueue; CTransaction tx; //masternode signed transaction bool ignoreFees = false; CTxIn vin; vector<unsigned char> vchSig; int64_t sigTime; if (strCommand == "tx") { vRecv >> tx; } else if (strCommand == "dstx") { //these allow masternodes to publish a limited amount of free transactions vRecv >> tx >> vin >> vchSig >> sigTime; CMasternode* pmn = mnodeman.Find(vin); if (pmn != NULL) { if (!pmn->allowFreeTx) { //multiple peers can send us a valid masternode transaction if (fDebug) LogPrintf("dstx: Masternode sending too many transactions %s\n", tx.GetHash().ToString()); return true; } std::string strMessage = tx.GetHash().ToString() + boost::lexical_cast<std::string>(sigTime); std::string errorMessage = ""; if (!obfuScationSigner.VerifyMessage(pmn->pubKeyMasternode, vchSig, strMessage, errorMessage)) { LogPrintf("dstx: Got bad masternode address signature %s \n", vin.ToString()); //pfrom->Misbehaving(20); return false; } LogPrintf("dstx: Got Masternode transaction %s\n", tx.GetHash().ToString()); ignoreFees = true; pmn->allowFreeTx = false; if (!mapObfuscationBroadcastTxes.count(tx.GetHash())) { CObfuscationBroadcastTx dstx; dstx.tx = tx; dstx.vin = vin; dstx.vchSig = vchSig; dstx.sigTime = sigTime; mapObfuscationBroadcastTxes.insert(make_pair(tx.GetHash(), dstx)); } } } CInv inv(MSG_TX, tx.GetHash()); pfrom->AddInventoryKnown(inv); LOCK(cs_main); bool fMissingInputs = false; bool fMissingZerocoinInputs = false; CValidationState state; mapAlreadyAskedFor.erase(inv); if (!tx.IsZerocoinSpend() && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs, false, ignoreFees)) { mempool.check(pcoinsTip); RelayTransaction(tx); vWorkQueue.push_back(inv.hash); LogPrint("mempool", "AcceptToMemoryPool: peer=%d %s : accepted %s (poolsz %u)\n", pfrom->id, pfrom->cleanSubVer, tx.GetHash().ToString(), mempool.mapTx.size()); // Recursively process any orphan transactions that depended on this one set<NodeId> setMisbehaving; for(unsigned int i = 0; i < vWorkQueue.size(); i++) { map<uint256, set<uint256> >::iterator itByPrev = mapOrphanTransactionsByPrev.find(vWorkQueue[i]); if(itByPrev == mapOrphanTransactionsByPrev.end()) continue; for(set<uint256>::iterator mi = itByPrev->second.begin(); mi != itByPrev->second.end(); ++mi) { const uint256 &orphanHash = *mi; const CTransaction &orphanTx = mapOrphanTransactions[orphanHash].tx; NodeId fromPeer = mapOrphanTransactions[orphanHash].fromPeer; bool fMissingInputs2 = false; // Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan // resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get // anyone relaying LegitTxX banned) CValidationState stateDummy; if(setMisbehaving.count(fromPeer)) continue; if(AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2)) { LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); RelayTransaction(orphanTx); vWorkQueue.push_back(orphanHash); vEraseQueue.push_back(orphanHash); } else if(!fMissingInputs2) { int nDos = 0; if(stateDummy.IsInvalid(nDos) && nDos > 0) { // Punish peer that gave us an invalid orphan tx Misbehaving(fromPeer, nDos); setMisbehaving.insert(fromPeer); LogPrint("mempool", " invalid orphan tx %s\n", orphanHash.ToString()); } // Has inputs but not accepted to mempool // Probably non-standard or insufficient fee/priority LogPrint("mempool", " removed orphan tx %s\n", orphanHash.ToString()); vEraseQueue.push_back(orphanHash); } mempool.check(pcoinsTip); } } BOOST_FOREACH (uint256 hash, vEraseQueue)EraseOrphanTx(hash); } else if (tx.IsZerocoinSpend() && AcceptToMemoryPool(mempool, state, tx, true, &fMissingZerocoinInputs, false, ignoreFees)) { //Presstab: ZCoin has a bunch of code commented out here. Is this something that should have more going on? //Also there is nothing that handles fMissingZerocoinInputs. Does there need to be? RelayTransaction(tx); LogPrint("mempool", "AcceptToMemoryPool: Zerocoinspend peer=%d %s : accepted %s (poolsz %u)\n", pfrom->id, pfrom->cleanSubVer, tx.GetHash().ToString(), mempool.mapTx.size()); } else if (fMissingInputs) { AddOrphanTx(tx, pfrom->GetId()); // DoS prevention: do not allow mapOrphanTransactions to grow unbounded unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS)); unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx); if (nEvicted > 0) LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", nEvicted); } else if (pfrom->fWhitelisted) { // Always relay transactions received from whitelisted peers, even // if they are already in the mempool (allowing the node to function // as a gateway for nodes hidden behind it). RelayTransaction(tx); } if (strCommand == "dstx") { CInv inv(MSG_DSTX, tx.GetHash()); RelayInv(inv); } int nDoS = 0; if (state.IsInvalid(nDoS)) { LogPrint("mempool", "%s from peer=%d %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(), pfrom->id, pfrom->cleanSubVer, state.GetRejectReason()); pfrom->PushMessage("reject", strCommand, state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash); if (nDoS > 0) Misbehaving(pfrom->GetId(), nDoS); } } else if (strCommand == "headers" && Params().HeadersFirstSyncingActive() && !fImporting && !fReindex) // Ignore headers received while importing { std::vector<CBlockHeader> headers; // Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks. unsigned int nCount = ReadCompactSize(vRecv); if (nCount > MAX_HEADERS_RESULTS) { Misbehaving(pfrom->GetId(), 20); return error("headers message size = %u", nCount); } headers.resize(nCount); for (unsigned int n = 0; n < nCount; n++) { vRecv >> headers[n]; ReadCompactSize(vRecv); // ignore tx count; assume it is 0. } LOCK(cs_main); if (nCount == 0) { // Nothing interesting. Stop asking this peers for more headers. return true; } CBlockIndex* pindexLast = NULL; BOOST_FOREACH (const CBlockHeader& header, headers) { CValidationState state; if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) { Misbehaving(pfrom->GetId(), 20); return error("non-continuous headers sequence"); } /*TODO: this has a CBlock cast on it so that it will compile. There should be a solution for this * before headers are reimplemented on mainnet */ if (!AcceptBlockHeader((CBlock)header, state, &pindexLast)) { int nDoS; if (state.IsInvalid(nDoS)) { if (nDoS > 0) Misbehaving(pfrom->GetId(), nDoS); std::string strError = "invalid header received " + header.GetHash().ToString(); return error(strError.c_str()); } } } if (pindexLast) UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash()); if (nCount == MAX_HEADERS_RESULTS && pindexLast) { // Headers message had its maximum size; the peer may have more headers. // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // from there instead. LogPrintf("more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256(0)); } CheckBlockIndex(); } else if (strCommand == "block" && !fImporting && !fReindex) // Ignore blocks received while importing { CBlock block; vRecv >> block; uint256 hashBlock = block.GetHash(); CInv inv(MSG_BLOCK, hashBlock); LogPrint("net", "received block %s peer=%d\n", inv.hash.ToString(), pfrom->id); //sometimes we will be sent their most recent block and its not the one we want, in that case tell where we are if (!mapBlockIndex.count(block.hashPrevBlock)) { if (find(pfrom->vBlockRequested.begin(), pfrom->vBlockRequested.end(), hashBlock) != pfrom->vBlockRequested.end()) { //we already asked for this block, so lets work backwards and ask for the previous block pfrom->PushMessage("getblocks", chainActive.GetLocator(), block.hashPrevBlock); pfrom->vBlockRequested.push_back(block.hashPrevBlock); } else { //ask to sync to this block pfrom->PushMessage("getblocks", chainActive.GetLocator(), hashBlock); pfrom->vBlockRequested.push_back(hashBlock); } } else { pfrom->AddInventoryKnown(inv); CValidationState state; if (!mapBlockIndex.count(block.GetHash())) { ProcessNewBlock(state, pfrom, &block); int nDoS; if(state.IsInvalid(nDoS)) { pfrom->PushMessage("reject", strCommand, state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash); if(nDoS > 0) { TRY_LOCK(cs_main, lockMain); if(lockMain) Misbehaving(pfrom->GetId(), nDoS); } } //disconnect this node if its old protocol version pfrom->DisconnectOldProtocol(ActiveProtocol(), strCommand); } else { LogPrint("net", "%s : Already processed block %s, skipping ProcessNewBlock()\n", __func__, block.GetHash().GetHex()); } } } // This asymmetric behavior for inbound and outbound connections was introduced // to prevent a fingerprinting attack: an attacker can send specific fake addresses // to users' AddrMan and later request them by sending getaddr messages. // Making users (which are behind NAT and can only make outgoing connections) ignore // getaddr message mitigates the attack. else if ((strCommand == "getaddr") && (pfrom->fInbound)) { pfrom->vAddrToSend.clear(); vector<CAddress> vAddr = addrman.GetAddr(); BOOST_FOREACH (const CAddress& addr, vAddr) pfrom->PushAddress(addr); } else if (strCommand == "mempool") { LOCK2(cs_main, pfrom->cs_filter); std::vector<uint256> vtxid; mempool.queryHashes(vtxid); vector<CInv> vInv; BOOST_FOREACH (uint256& hash, vtxid) { CInv inv(MSG_TX, hash); CTransaction tx; bool fInMemPool = mempool.lookup(hash, tx); if (!fInMemPool) continue; // another thread removed since queryHashes, maybe... if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(tx)) || (!pfrom->pfilter)) vInv.push_back(inv); if (vInv.size() == MAX_INV_SZ) { pfrom->PushMessage("inv", vInv); vInv.clear(); } } if (vInv.size() > 0) pfrom->PushMessage("inv", vInv); } else if (strCommand == "ping") { if (pfrom->nVersion > BIP0031_VERSION) { uint64_t nonce = 0; vRecv >> nonce; // Echo the message back with the nonce. This allows for two useful features: // // 1) A remote node can quickly check if the connection is operational // 2) Remote nodes can measure the latency of the network thread. If this node // is overloaded it won't respond to pings quickly and the remote node can // avoid sending us more work, like chain download requests. // // The nonce stops the remote getting confused between different pings: without // it, if the remote node sends a ping once per second and this node takes 5 // seconds to respond to each, the 5th ping the remote sends would appear to // return very quickly. pfrom->PushMessage("pong", nonce); } } else if (strCommand == "pong") { int64_t pingUsecEnd = nTimeReceived; uint64_t nonce = 0; size_t nAvail = vRecv.in_avail(); bool bPingFinished = false; std::string sProblem; if (nAvail >= sizeof(nonce)) { vRecv >> nonce; // Only process pong message if there is an outstanding ping (old ping without nonce should never pong) if (pfrom->nPingNonceSent != 0) { if (nonce == pfrom->nPingNonceSent) { // Matching pong received, this ping is no longer outstanding bPingFinished = true; int64_t pingUsecTime = pingUsecEnd - pfrom->nPingUsecStart; if (pingUsecTime > 0) { // Successful ping time measurement, replace previous pfrom->nPingUsecTime = pingUsecTime; } else { // This should never happen sProblem = "Timing mishap"; } } else { // Nonce mismatches are normal when pings are overlapping sProblem = "Nonce mismatch"; if (nonce == 0) { // This is most likely a bug in another implementation somewhere, cancel this ping bPingFinished = true; sProblem = "Nonce zero"; } } } else { sProblem = "Unsolicited pong without ping"; } } else { // This is most likely a bug in another implementation somewhere, cancel this ping bPingFinished = true; sProblem = "Short payload"; } if (!(sProblem.empty())) { LogPrint("net", "pong peer=%d %s: %s, %x expected, %x received, %u bytes\n", pfrom->id, pfrom->cleanSubVer, sProblem, pfrom->nPingNonceSent, nonce, nAvail); } if (bPingFinished) { pfrom->nPingNonceSent = 0; } } else if (fAlerts && strCommand == "alert") { CAlert alert; vRecv >> alert; uint256 alertHash = alert.GetHash(); if (pfrom->setKnown.count(alertHash) == 0) { if (alert.ProcessAlert()) { // Relay pfrom->setKnown.insert(alertHash); { LOCK(cs_vNodes); BOOST_FOREACH (CNode* pnode, vNodes) alert.RelayTo(pnode); } } else { // Small DoS penalty so peers that send us lots of // duplicate/expired/invalid-signature/whatever alerts // eventually get banned. // This isn't a Misbehaving(100) (immediate ban) because the // peer might be an older or different implementation with // a different signature key, etc. Misbehaving(pfrom->GetId(), 10); } } } else if (!(nLocalServices & NODE_BLOOM) && (strCommand == "filterload" || strCommand == "filteradd" || strCommand == "filterclear")) { LogPrintf("bloom message=%s\n", strCommand); Misbehaving(pfrom->GetId(), 100); } else if (strCommand == "filterload") { CBloomFilter filter; vRecv >> filter; if (!filter.IsWithinSizeConstraints()) // There is no excuse for sending a too-large filter Misbehaving(pfrom->GetId(), 100); else { LOCK(pfrom->cs_filter); delete pfrom->pfilter; pfrom->pfilter = new CBloomFilter(filter); pfrom->pfilter->UpdateEmptyFull(); } pfrom->fRelayTxes = true; } else if (strCommand == "filteradd") { vector<unsigned char> vData; vRecv >> vData; // Nodes must NEVER send a data item > 520 bytes (the max size for a script data object, // and thus, the maximum size any matched object can have) in a filteradd message if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) { Misbehaving(pfrom->GetId(), 100); } else { LOCK(pfrom->cs_filter); if (pfrom->pfilter) pfrom->pfilter->insert(vData); else Misbehaving(pfrom->GetId(), 100); } } else if (strCommand == "filterclear") { LOCK(pfrom->cs_filter); delete pfrom->pfilter; pfrom->pfilter = new CBloomFilter(); pfrom->fRelayTxes = true; } else if (strCommand == "reject") { if (fDebug) { try { string strMsg; unsigned char ccode; string strReason; vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, MAX_REJECT_MESSAGE_LENGTH); ostringstream ss; ss << strMsg << " code " << itostr(ccode) << ": " << strReason; if (strMsg == "block" || strMsg == "tx") { uint256 hash; vRecv >> hash; ss << ": hash " << hash.ToString(); } LogPrint("net", "Reject %s\n", SanitizeString(ss.str())); } catch (std::ios_base::failure& e) { // Avoid feedback loops by preventing reject messages from triggering a new reject message. LogPrint("net", "Unparseable reject message received\n"); } } } else { //probably one the extensions obfuScationPool.ProcessMessageObfuscation(pfrom, strCommand, vRecv); mnodeman.ProcessMessage(pfrom, strCommand, vRecv); budget.ProcessMessage(pfrom, strCommand, vRecv); masternodePayments.ProcessMessageMasternodePayments(pfrom, strCommand, vRecv); ProcessMessageSwiftTX(pfrom, strCommand, vRecv); ProcessSpork(pfrom, strCommand, vRecv); masternodeSync.ProcessMessage(pfrom, strCommand, vRecv); } return true; } // Note: whenever a protocol update is needed toggle between both implementations (comment out the formerly active one) // so we can leave the existing clients untouched (old SPORK will stay on so they don't see even older clients). // Those old clients won't react to the changes of the other (new) SPORK because at the time of their implementation // it was the one which was commented out int ActiveProtocol() { // SPORK_14 was used for 70910. Leave it 'ON' so they don't see > 70910 nodes. They won't react to SPORK_15 // messages because it's not in their code /* if (IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; */ // SPORK_15 is used for 70911. Nodes < 70911 don't see it and still get their protocol version via SPORK_14 and their // own ModifierUpgradeBlock() if (IsSporkActive(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; } // requires LOCK(cs_vRecvMsg) bool ProcessMessages(CNode* pfrom) { //if (fDebug) // LogPrintf("ProcessMessages(%u messages)\n", pfrom->vRecvMsg.size()); // // Message format // (4) message start // (12) command // (4) size // (4) checksum // (x) data // bool fOk = true; if (!pfrom->vRecvGetData.empty()) ProcessGetData(pfrom); // this maintains the order of responses if (!pfrom->vRecvGetData.empty()) return fOk; std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin(); while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; // get next message CNetMessage& msg = *it; //if (fDebug) // LogPrintf("ProcessMessages(message %u msgsz, %u bytes, complete:%s)\n", // msg.hdr.nMessageSize, msg.vRecv.size(), // msg.complete() ? "Y" : "N"); // end, if an incomplete message is found if (!msg.complete()) break; // at this point, any failure means we can delete the current message it++; // Scan for message start if (memcmp(msg.hdr.pchMessageStart, Params().MessageStart(), MESSAGE_START_SIZE) != 0) { LogPrintf("PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.hdr.GetCommand()), pfrom->id); fOk = false; break; } // Read header CMessageHeader& hdr = msg.hdr; if (!hdr.IsValid()) { LogPrintf("PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n", SanitizeString(hdr.GetCommand()), pfrom->id); continue; } string strCommand = hdr.GetCommand(); // Message size unsigned int nMessageSize = hdr.nMessageSize; // Checksum CDataStream& vRecv = msg.vRecv; uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize); unsigned int nChecksum = 0; memcpy(&nChecksum, &hash, sizeof(nChecksum)); if (nChecksum != hdr.nChecksum) { LogPrintf("ProcessMessages(%s, %u bytes): CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n", SanitizeString(strCommand), nMessageSize, nChecksum, hdr.nChecksum); continue; } // Process message bool fRet = false; try { fRet = ProcessMessage(pfrom, strCommand, vRecv, msg.nTime); boost::this_thread::interruption_point(); } catch (std::ios_base::failure& e) { pfrom->PushMessage("reject", strCommand, REJECT_MALFORMED, string("error parsing message")); if (strstr(e.what(), "end of data")) { // Allow exceptions from under-length message on vRecv LogPrintf("ProcessMessages(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", SanitizeString(strCommand), nMessageSize, e.what()); } else if (strstr(e.what(), "size too large")) { // Allow exceptions from over-long size LogPrintf("ProcessMessages(%s, %u bytes): Exception '%s' caught\n", SanitizeString(strCommand), nMessageSize, e.what()); } else { PrintExceptionContinue(&e, "ProcessMessages()"); } } catch (boost::thread_interrupted) { throw; } catch (std::exception& e) { PrintExceptionContinue(&e, "ProcessMessages()"); } catch (...) { PrintExceptionContinue(NULL, "ProcessMessages()"); } if (!fRet) LogPrintf("ProcessMessage(%s, %u bytes) FAILED peer=%d\n", SanitizeString(strCommand), nMessageSize, pfrom->id); break; } // In case the connection got shut down, its receive buffer was wiped if (!pfrom->fDisconnect) pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin(), it); return fOk; } bool SendMessages(CNode* pto, bool fSendTrickle) { { // Don't send anything until we get their version message if (pto->nVersion == 0) return true; // // Message: ping // bool pingSend = false; if (pto->fPingQueued) { // RPC ping request by user pingSend = true; } if (pto->nPingNonceSent == 0 && pto->nPingUsecStart + PING_INTERVAL * 1000000 < GetTimeMicros()) { // Ping automatically sent as a latency probe & keepalive. pingSend = true; } if (pingSend) { uint64_t nonce = 0; while (nonce == 0) { GetRandBytes((unsigned char*)&nonce, sizeof(nonce)); } pto->fPingQueued = false; pto->nPingUsecStart = GetTimeMicros(); if (pto->nVersion > BIP0031_VERSION) { pto->nPingNonceSent = nonce; pto->PushMessage("ping", nonce); } else { // Peer is too old to support ping command with nonce, pong will never arrive. pto->nPingNonceSent = 0; pto->PushMessage("ping"); } } TRY_LOCK(cs_main, lockMain); // Acquire cs_main for IsInitialBlockDownload() and CNodeState() if (!lockMain) return true; // Address refresh broadcast static int64_t nLastRebroadcast; if (!IsInitialBlockDownload() && (GetTime() - nLastRebroadcast > 24 * 60 * 60)) { LOCK(cs_vNodes); BOOST_FOREACH (CNode* pnode, vNodes) { // Periodically clear setAddrKnown to allow refresh broadcasts if (nLastRebroadcast) pnode->setAddrKnown.clear(); // Rebroadcast our address AdvertizeLocal(pnode); } if (!vNodes.empty()) nLastRebroadcast = GetTime(); } // // Message: addr // if (fSendTrickle) { vector<CAddress> vAddr; vAddr.reserve(pto->vAddrToSend.size()); BOOST_FOREACH (const CAddress& addr, pto->vAddrToSend) { // returns true if wasn't already contained in the set if (pto->setAddrKnown.insert(addr).second) { vAddr.push_back(addr); // receiver rejects addr messages larger than 1000 if (vAddr.size() >= 1000) { pto->PushMessage("addr", vAddr); vAddr.clear(); } } } pto->vAddrToSend.clear(); if (!vAddr.empty()) pto->PushMessage("addr", vAddr); } CNodeState& state = *State(pto->GetId()); if (state.fShouldBan) { if (pto->fWhitelisted) LogPrintf("Warning: not punishing whitelisted peer %s!\n", pto->addr.ToString()); else { pto->fDisconnect = true; if (pto->addr.IsLocal()) LogPrintf("Warning: not banning local peer %s!\n", pto->addr.ToString()); else { CNode::Ban(pto->addr); } } state.fShouldBan = false; } BOOST_FOREACH (const CBlockReject& reject, state.rejects) pto->PushMessage("reject", (string) "block", reject.chRejectCode, reject.strRejectReason, reject.hashBlock); state.rejects.clear(); // Start block sync if (pindexBestHeader == NULL) pindexBestHeader = chainActive.Tip(); bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do. if (!state.fSyncStarted && !pto->fClient && fFetch /*&& !fImporting*/ && !fReindex) { // Only actively request headers from a single peer, unless we're close to end of initial download. if (nSyncStarted == 0 || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 6 * 60 * 60) { // NOTE: was "close to today" and 24h in Bitcoin state.fSyncStarted = true; nSyncStarted++; //CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader; //LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->id, pto->nStartingHeight); //pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256(0)); pto->PushMessage("getblocks", chainActive.GetLocator(chainActive.Tip()), uint256(0)); } } // Resend wallet transactions that haven't gotten in a block yet // Except during reindex, importing and IBD, when old wallet // transactions become unconfirmed and spams other nodes. if (!fReindex /*&& !fImporting && !IsInitialBlockDownload()*/) { g_signals.Broadcast(); } // // Message: inventory // vector<CInv> vInv; vector<CInv> vInvWait; { LOCK(pto->cs_inventory); vInv.reserve(pto->vInventoryToSend.size()); vInvWait.reserve(pto->vInventoryToSend.size()); BOOST_FOREACH (const CInv& inv, pto->vInventoryToSend) { if (pto->setInventoryKnown.count(inv)) continue; // trickle out tx inv to protect privacy if (inv.type == MSG_TX && !fSendTrickle) { // 1/4 of tx invs blast to all immediately static uint256 hashSalt; if (hashSalt == 0) hashSalt = GetRandHash(); uint256 hashRand = inv.hash ^ hashSalt; hashRand = Hash(BEGIN(hashRand), END(hashRand)); bool fTrickleWait = ((hashRand & 3) != 0); if (fTrickleWait) { vInvWait.push_back(inv); continue; } } // returns true if wasn't already contained in the set if (pto->setInventoryKnown.insert(inv).second) { vInv.push_back(inv); if (vInv.size() >= 1000) { pto->PushMessage("inv", vInv); vInv.clear(); } } } pto->vInventoryToSend = vInvWait; } if (!vInv.empty()) pto->PushMessage("inv", vInv); // Detect whether we're stalling int64_t nNow = GetTimeMicros(); if (!pto->fDisconnect && state.nStallingSince && state.nStallingSince < nNow - 1000000 * BLOCK_STALLING_TIMEOUT) { // Stalling only triggers when the block download window cannot move. During normal steady state, // the download window should be much larger than the to-be-downloaded set of blocks, so disconnection // should only happen during initial block download. LogPrintf("Peer=%d is stalling block download, disconnecting\n", pto->id); pto->fDisconnect = true; } // In case there is a block that has been in flight from this peer for (2 + 0.5 * N) times the block interval // (with N the number of validated blocks that were in flight at the time it was requested), disconnect due to // timeout. We compensate for in-flight blocks to prevent killing off peers due to our own downstream link // being saturated. We only count validated in-flight blocks so peers can't advertize nonexisting block hashes // to unreasonably increase our timeout. if (!pto->fDisconnect && state.vBlocksInFlight.size() > 0 && state.vBlocksInFlight.front().nTime < nNow - 500000 * Params().TargetSpacing() * (4 + state.vBlocksInFlight.front().nValidatedQueuedBefore)) { LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", state.vBlocksInFlight.front().hash.ToString(), pto->id); pto->fDisconnect = true; } // // Message: getdata (blocks) // vector<CInv> vGetData; if (!pto->fDisconnect && !pto->fClient && fFetch && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { vector<CBlockIndex*> vToDownload; NodeId staller = -1; FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state.nBlocksInFlight, vToDownload, staller); BOOST_FOREACH (CBlockIndex* pindex, vToDownload) { vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash())); MarkBlockAsInFlight(pto->GetId(), pindex->GetBlockHash(), pindex); LogPrintf("Requesting block %s (%d) peer=%d\n", pindex->GetBlockHash().ToString(), pindex->nHeight, pto->id); } if (state.nBlocksInFlight == 0 && staller != -1) { if (State(staller)->nStallingSince == 0) { State(staller)->nStallingSince = nNow; LogPrint("net", "Stall started peer=%d\n", staller); } } } // // Message: getdata (non-blocks) // while (!pto->fDisconnect && !pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) { const CInv& inv = (*pto->mapAskFor.begin()).second; if (!AlreadyHave(inv)) { if (fDebug) LogPrint("net", "Requesting %s peer=%d\n", inv.ToString(), pto->id); vGetData.push_back(inv); if (vGetData.size() >= 1000) { pto->PushMessage("getdata", vGetData); vGetData.clear(); } } pto->mapAskFor.erase(pto->mapAskFor.begin()); } if (!vGetData.empty()) pto->PushMessage("getdata", vGetData); } return true; } bool CBlockUndo::WriteToDisk(CDiskBlockPos& pos, const uint256& hashBlock) { // Open history file to append CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) return error("CBlockUndo::WriteToDisk : OpenUndoFile failed"); // Write index header unsigned int nSize = fileout.GetSerializeSize(*this); fileout << FLATDATA(Params().MessageStart()) << nSize; // Write undo data long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) return error("CBlockUndo::WriteToDisk : ftell failed"); pos.nPos = (unsigned int)fileOutPos; fileout << *this; // calculate & write checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; hasher << *this; fileout << hasher.GetHash(); return true; } bool CBlockUndo::ReadFromDisk(const CDiskBlockPos& pos, const uint256& hashBlock) { // Open history file to read CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) return error("CBlockUndo::ReadFromDisk : OpenBlockFile failed"); // Read block uint256 hashChecksum; try { filein >> *this; filein >> hashChecksum; } catch (std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } // Verify checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; hasher << *this; if (hashChecksum != hasher.GetHash()) return error("CBlockUndo::ReadFromDisk : Checksum mismatch"); return true; } std::string CBlockFileInfo::ToString() const { return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst), DateTimeStrFormat("%Y-%m-%d", nTimeLast)); } class CMainCleanup { public: CMainCleanup() {} ~CMainCleanup() { // block headers BlockMap::iterator it1 = mapBlockIndex.begin(); for (; it1 != mapBlockIndex.end(); it1++) delete (*it1).second; mapBlockIndex.clear(); // orphan transactions mapOrphanTransactions.clear(); mapOrphanTransactionsByPrev.clear(); } } instance_of_cmaincleanup;
[ "42325974+RespawnCoin@users.noreply.github.com" ]
42325974+RespawnCoin@users.noreply.github.com
43cd6128e8a0519dccfd5d3d3ce3635fb2e3767d
d6b4bdf418ae6ab89b721a79f198de812311c783
/mdl/include/tencentcloud/mdl/v20200326/model/QueryDispatchInputInfo.h
7cb5009f7fd0015c7ef6b8b2cda7c016a37294ef
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-cpp-intl-en
d0781d461e84eb81775c2145bacae13084561c15
d403a6b1cf3456322bbdfb462b63e77b1e71f3dc
refs/heads/master
2023-08-21T12:29:54.125071
2023-08-21T01:12:39
2023-08-21T01:12:39
277,769,407
2
0
null
null
null
null
UTF-8
C++
false
false
5,719
h
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TENCENTCLOUD_MDL_V20200326_MODEL_QUERYDISPATCHINPUTINFO_H_ #define TENCENTCLOUD_MDL_V20200326_MODEL_QUERYDISPATCHINPUTINFO_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/mdl/v20200326/model/InputStreamInfo.h> namespace TencentCloud { namespace Mdl { namespace V20200326 { namespace Model { /** * The stream status of the queried input. */ class QueryDispatchInputInfo : public AbstractModel { public: QueryDispatchInputInfo(); ~QueryDispatchInputInfo() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取The input ID. * @return InputID The input ID. * */ std::string GetInputID() const; /** * 设置The input ID. * @param _inputID The input ID. * */ void SetInputID(const std::string& _inputID); /** * 判断参数 InputID 是否已赋值 * @return InputID 是否已赋值 * */ bool InputIDHasBeenSet() const; /** * 获取The input name. * @return InputName The input name. * */ std::string GetInputName() const; /** * 设置The input name. * @param _inputName The input name. * */ void SetInputName(const std::string& _inputName); /** * 判断参数 InputName 是否已赋值 * @return InputName 是否已赋值 * */ bool InputNameHasBeenSet() const; /** * 获取The input protocol. * @return Protocol The input protocol. * */ std::string GetProtocol() const; /** * 设置The input protocol. * @param _protocol The input protocol. * */ void SetProtocol(const std::string& _protocol); /** * 判断参数 Protocol 是否已赋值 * @return Protocol 是否已赋值 * */ bool ProtocolHasBeenSet() const; /** * 获取The stream status of the input. * @return InputStreamInfoList The stream status of the input. * */ std::vector<InputStreamInfo> GetInputStreamInfoList() const; /** * 设置The stream status of the input. * @param _inputStreamInfoList The stream status of the input. * */ void SetInputStreamInfoList(const std::vector<InputStreamInfo>& _inputStreamInfoList); /** * 判断参数 InputStreamInfoList 是否已赋值 * @return InputStreamInfoList 是否已赋值 * */ bool InputStreamInfoListHasBeenSet() const; private: /** * The input ID. */ std::string m_inputID; bool m_inputIDHasBeenSet; /** * The input name. */ std::string m_inputName; bool m_inputNameHasBeenSet; /** * The input protocol. */ std::string m_protocol; bool m_protocolHasBeenSet; /** * The stream status of the input. */ std::vector<InputStreamInfo> m_inputStreamInfoList; bool m_inputStreamInfoListHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_MDL_V20200326_MODEL_QUERYDISPATCHINPUTINFO_H_
[ "tencentcloudapi@tencent.com" ]
tencentcloudapi@tencent.com
7934d5c0864ecf429f3c86119acabf5ae5a4367d
ee3785eb0205893a3c5a0946119f59482bd8edc6
/contrib/IECoreArnold/include/IECoreArnold/ParameterAlgo.h
512046f5af48f21332065bbace0af18c8618d3b7
[ "MIT" ]
permissive
mottosso/cortex
46f80d093a80bfe1926fd8f6b73d915dcd87f1dd
e2600cef60d380e4fd5e06b8f2fe18c9b52f5afd
refs/heads/master
2021-01-22T21:27:52.079668
2016-08-24T06:52:48
2016-08-24T06:52:48
66,432,611
0
0
null
2016-08-24T05:22:41
2016-08-24T05:22:40
null
UTF-8
C++
false
false
3,536
h
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2016, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of Image Engine Design nor the names of any // other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #ifndef IECOREARNOLD_PARAMETERALGO_H #define IECOREARNOLD_PARAMETERALGO_H #include "ai.h" #include "IECoreArnold/TypeIds.h" #include "IECoreArnold/Export.h" #include "IECore/CompoundData.h" namespace IECoreArnold { namespace ParameterAlgo { IECOREARNOLD_API void setParameter( AtNode *node, const AtParamEntry *parameter, const IECore::Data *value ); IECOREARNOLD_API void setParameter( AtNode *node, const char *name, const IECore::Data *value ); IECOREARNOLD_API void setParameters( AtNode *node, const IECore::CompoundDataMap &values ); IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, const AtParamEntry *parameter ); IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, const AtUserParamEntry *parameter ); IECOREARNOLD_API IECore::DataPtr getParameter( AtNode *node, const char *name ); IECOREARNOLD_API void getParameters( AtNode *node, IECore::CompoundDataMap &values ); /// Returns the Arnold parameter type (AI_TYPE_INT etc) suitable for /// storing Cortex data of the specified type, setting array to true /// or false depending on whether or not the Arnold type will be an /// array. Returns AI_TYPE_NONE if there is no suitable Arnold type. IECOREARNOLD_API int parameterType( IECore::TypeId dataType, bool &array ); /// If the equivalent Arnold type for the data is already known, then it may be passed directly. /// If not it will be inferred using parameterType(). IECOREARNOLD_API AtArray *dataToArray( const IECore::Data *data, int aiType = AI_TYPE_NONE ); IECOREARNOLD_API AtArray *dataToArray( const std::vector<const IECore::Data *> &samples, int aiType = AI_TYPE_NONE ); } // namespace ParameterAlgo } // namespace IECoreArnold #endif // IECOREARNOLD_PARAMETERALGO_H
[ "thehaddonyoof@gmail.com" ]
thehaddonyoof@gmail.com
3a0f44f90ddc27662b89bd0b490d434b978ed3e6
e433c43197677f02a41686ad2b9a715c251b2b00
/winhistory.cpp
207b23bc694589cb2e28437a7f0cdc5cb41cb3ed
[]
no_license
tcp-software/spgrab
503dca7cb9430c2fa18a41fabb6c81d98f801697
d129da8d05bb34f0f7242e8e926c029f30f1a355
refs/heads/master
2022-05-05T00:33:14.586951
2013-11-13T15:31:51
2013-11-13T15:31:51
14,367,648
0
0
null
2022-04-22T16:13:05
2013-11-13T15:20:18
C++
UTF-8
C++
false
false
4,214
cpp
#include "winhistory.h" #include "ui_winhistory.h" #include "window.h" #include "config.h" #include <QMainWindow> #include <QSettings> #include <QWidget> #include <QLineEdit> #include <QDebug> #include <QMessageBox> #include <QUrl> #include <QDesktopServices> #include <QDebug> #include <QClipboard> #include <QFile> QString cImg; QUrl url2; QDesktopServices *dServ2; winHistory::winHistory(QWidget *parent) : QMainWindow(parent), ui(new Ui::winHistory){ qDebug() << config::getWPath(); ui->setupUi(this); hide(); strSearchBy = "title"; refreshList(); } void winHistory::hideEvent(QHideEvent *eve){ config::winHistoryVisible = false; } void winHistory::hotkeyPressed(){ QMessageBox::information(this, "Good", "Hot key triggered", "yes", "no"); } winHistory::~winHistory(){ delete ui; } void winHistory::resizeEvent(QResizeEvent *){ ui->centralwidget->resize(this->width(),this->height()); ui->tblHistory->resize(this->width(),this->height()-100); } void winHistory::refreshList(){ QSettings settings( config::getWPath() + "/history.ini", QSettings::IniFormat); settings.beginGroup("history"); int size = settings.value("itemscount").toInt(); settings.endGroup(); ui->tblHistory->clearContents(); ui->tblHistory->setRowCount(size); int i = 0; int b = 0; bool filtering = true; while(filtering){ QString headd = "uploaded" + QString::number(b); b++; settings.beginGroup(headd); if( ui->txtSearch->text().trimmed().length() == 0 ){ ui->tblHistory->setItem( i, 0, new QTableWidgetItem( settings.value("title").toString( ) ) ); ui->tblHistory->setItem( i, 1, new QTableWidgetItem( settings.value("desc").toString() ) ); ui->tblHistory->setItem( i, 2, new QTableWidgetItem( settings.value("date").toString() ) ); ui->tblHistory->setItem( i, 3, new QTableWidgetItem( settings.value("url").toString() ) ); if( b <= size){ i++; } } else { if( settings.value(strSearchBy).toString().toLower().indexOf( ui->txtSearch->text().toLower(), 0 ) >= 0 ) { ui->tblHistory->setItem( i, 0, new QTableWidgetItem( settings.value("title").toString( ) ) ); ui->tblHistory->setItem( i, 1, new QTableWidgetItem( settings.value("desc").toString() ) ); ui->tblHistory->setItem( i, 2, new QTableWidgetItem( settings.value("date").toString() ) ); ui->tblHistory->setItem( i, 3, new QTableWidgetItem( settings.value("url").toString() ) ); i++; } } settings.endGroup(); if( b > size){ filtering = false; } } ui->tblHistory->setRowCount(i); i = 0; } void winHistory::on_txtSearch_textChanged(const QString &arg1){ refreshList(); } void winHistory::on_tblHistory_cellClicked(int row, int column){ intSearchBy = column; ui->txtUrl->setText( ui->tblHistory->item( row, 3 )->text() ); switch (column) { case 0: strSearchBy = "title"; break; case 1: strSearchBy = "desc"; break; case 2: strSearchBy = "date"; break; case 3: cImg = ui->tblHistory->item(row,column)->text(); url2 = QUrl( cImg ); dServ2->openUrl(url2); break; default: strSearchBy = "title"; break; } } void winHistory::on_btnClearAll_clicked(){ if( QMessageBox::question(this, "Delete all history...","Are You sure?", QMessageBox::Yes | QMessageBox::Abort ) == QMessageBox::Yes ){ QFile tmp(config::getWPath() + "/history.ini"); tmp.close(); tmp.remove(); refreshList(); } } void winHistory::on_tblHistory_activated(const QModelIndex &index){ } void winHistory::on_btnToClipboard_clicked(){ QClipboard *cb = QApplication::clipboard(); cb->setText( ui->txtUrl->text(), QClipboard::Clipboard ); }
[ "dvsoftware@gmail.com" ]
dvsoftware@gmail.com
cb74a8e3ed8b57bf5a19d97e5bed02e1be5e4fe0
0fcf29112861b79cf28f5da53f6c91b9b44a295d
/nnt/string_defs.h
c0f3ca47773188e13cdc251e280b45b628059b00
[]
no_license
gezhuang0717/NucnetLight
7b0d6250d00a6a3ac50b8833200a5f38e5457e45
77f7baa73b3497a2d8562f33fee00e61ac42f133
refs/heads/master
2020-12-07T13:37:53.618100
2017-06-27T18:18:42
2017-06-27T18:18:42
95,587,966
0
0
null
null
null
null
UTF-8
C++
false
false
10,080
h
// Copyright (c) 2011-2015 Clemson University. // // This file was originally written by Bradley S. Meyer. // // This is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA // //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //! //! \file //! \brief A header file to define NucNet Tools strings. //! //////////////////////////////////////////////////////////////////////////////// #ifndef NNT_STRING_DEFS_H #define NNT_STRING_DEFS_H namespace nnt { const char s_ANTI_NEUTRINO_E[] = "anti-neutrino_e"; const char s_ARROW[] = "Arrow"; const char s_ARROW_WIDTH[] = "Arrow width"; const char s_AVERAGE_ENERGY_NU_E[] = "av nu_e energy"; const char s_AVERAGE_ENERGY_NUBAR_E[] = "av nubar_e energy"; const char s_BARYON[] = "baryon"; const char s_BARYON_ENTROPY[] = "s_b"; const char s_BETA_MINUS_XPATH[] = \ "[product = 'electron' and product = 'anti-neutrino_e']"; const char s_BETA_PLUS_XPATH[] = \ "[product = 'positron' and product = 'neutrino_e']"; const char s_CLUSTER[] = "cluster"; const char s_CLUSTER_XPATH[] = "cluster_xpath"; const char s_CLUSTER_CONSTRAINT[] = "cluster_constraint"; const char s_CLUSTER_CHEMICAL_POTENTIAL[] = "muh_kT"; const char s_DMUEKTDT[] = "d_dmuekT_dT"; const char s_DPDT[] = "dPdT"; const char s_DTIME[] = "dt"; const char s_DTMIN[] = "dtmin"; const char s_DTMAX[] = "dtmax"; const char s_DT_SAFE[] = "dt safe"; const char s_ELECTRON[] = "electron"; const char s_ELECTRON_CAPTURE_XPATH[] = \ "[reactant = 'electron' and product = 'neutrino_e']"; const char s_ELECTRON_ENTROPY[] = "s_e"; const char s_ENTROPY_PER_NUCLEON[] = "entropy per nucleon"; const char s_EQUIL_ONLY[] = "only equilibrium"; const char s_EXPOSURE[] = "exposure"; const char s_FINAL_ABUNDANCE[] = "final abundance"; const char s_FLOW_CURRENT[] = "flow current"; const char s_FORWARD_FLOW[] = "foward"; const char s_GSL[] = "Gsl"; const char s_HI_T9_EQUIL[] = "high t9 for equilibrium"; const char s_ILU_DELTA[] = "ilu delta"; const char s_ILU_DROP_TOL[] = "ilu drop tolerance"; const char s_INITIAL_ABUNDANCE[] = "initial abundance"; const char s_INTERNAL_ENERGY_DENSITY[] = "internal energy density"; const char s_ITER_SOLVER[] = "iterative solver method"; const char \ s_ITER_SOLVER_CONVERGENCE_METHOD[] = \ "iterative solver convergence method"; const char s_ITER_SOLVER_DEBUG[] = "iterative solver debug"; const char s_ITER_SOLVER_MAX_ITERATIONS[] = \ "iterative solver maximum iterations"; const char s_ITER_SOLVER_REL_TOL[] = \ "iterative solver relative tolerance"; const char s_ITER_SOLVER_ABS_TOL[] = \ "iterative solver absolute tolerance"; const char s_ITER_SOLVER_T9[] = "t9 for iterative solver"; const char s_LAB_RATE[] = "lab rate"; const char s_LAB_RATE_T9_CUTOFF[] = "lab rate t9 cutoff"; const char s_LAB_RATE_T9_CUTOFF_FACTOR[] = \ "lab rate t9 cutoff factor"; const char s_LARGE_NEG_ABUND_THRESHOLD[] = \ "large negative abundances threshold"; const char s_LOG10_FT[] = "log10_ft"; const char s_LOG10_RATE[] = "log10_rate"; const char s_LOG10_RHOE[] = "log10_rhoe"; const char s_LOW_T_NETWORK_T9[] = "low T network T9"; const char s_LOW_T_NETWORK_REAC_XPATH[] = "low T network reaction xpath"; const char s_MACH[] = "mach number"; const char s_MODIFIED_NET_FLOW[] = "modified net flow"; const char s_MUEKT[] = "muekT"; const char s_MUPKT[] = "mupkT"; const char s_MUNKT[] = "munkT"; const char s_MU_NUE_KT[] = "munuekT"; const char s_MY_ENTROPY_DENSITY[] = "my_total_entropy_density"; const char s_MY_FLOW_MIN[] = "my minimum net flow"; const char s_NET_FLOW[] = "net"; const char s_NEUTRINO_E[] = "neutrino_e"; const char s_NEUTRINO_REACTION_XPATH[] = \ "[reactant[contains(.,'neutrino')]]"; const char s_NEWTON_RAPHSON_ABUNDANCE[] = \ "Newton-Raphson abundance minimum"; const char s_NEWTON_RAPHSON_CONVERGE[] = \ "Newton-Raphson convergence minimum"; const char s_NUC_ENERGY[] = "nuc energy"; const char s_NUMBER_CLUSTERS[] = "clusters"; const char s_OLD_T9[] = "old t9"; const char s_OLD_RHO[] = "old rho"; const char s_OLD_ZONE[] = "old_zone"; const char s_PHOTON[] = "photon"; const char s_PHOTON_ENTROPY[] = "s_p"; const char s_POSITRON[] = "positron"; const char s_POSITRON_CAPTURE_XPATH[] = \ "[reactant = 'positron' and product = 'anti-neutrino_e']"; const char s_PRESSURE[] = "pressure"; const char s_RADIOACTIVE_MASS_FRACTION[] = "radioactive mass"; const char s_RADIUS_0[] = "radius_0"; const char s_RADIUS[] = "radius"; const char s_RATE_MODIFICATION_VIEW[] = "rate modification view"; const char s_RATE_MODIFICATION_FACTOR[] = "factor"; const char s_RATE_MODIFICATION_NUC_XPATH[] = "nuclide xpath"; const char s_RATE_MODIFICATION_REAC_XPATH[] = "reaction xpath"; const char s_RATE_THRESHOLD[] = "rate threshold"; const char s_REVERSE_FLOW[] = "reverse"; const char s_RHO[] = "rho"; const char s_RHO_0[] = "rho_0"; const char s_RHO1[] = "cell density"; const char s_SDOT[] = "sdot"; const char s_SOLVER[] = "solver"; const char s_SHOCK_SPEED[] = "shock speed"; const char s_SMALL_ABUNDANCES_THRESHOLD[] = "small abundances threshold"; const char s_SMALL_RATES_THRESHOLD[] = "small rates threshold"; const char s_SOUND_SPEED[] = "sound speed"; const char s_SPECIFIC_ABUNDANCE[] = "specific abundance"; const char s_SPECIFIC_HEAT_PER_NUCLEON[] = "cv"; const char s_SPECIFIC_HEAT_PER_NUCLEON_AT_CONSTANT_PRESSURE[] \ = "cp"; const char s_SPECIES_REMOVAL_NUC_XPATH[] = "species removal nuclide xpath"; const char s_SPECIES_REMOVAL_REAC_XPATH[] =\ "species removal reaction xpath"; const char s_SPECIFIC_SPECIES[] = "specific species"; const char s_STEPS[] = "steps"; const char s_T1[] = "cell temperature"; const char s_TEND[] = "tend"; const char s_TAU[] = "tau"; const char s_TAU_LUM_NEUTRINO[] = "tau for neutrino luminosity"; const char s_THERMO_NUC_VIEW[] = "thermo nuc view"; const char s_TIME[] = "time"; const char s_TOTAL[] = "total"; const char s_TWO_D_WEAK_RATES[] = "two-d weak rates"; const char s_TWO_D_WEAK_RATES_LOG10_FT[] = "two-d weak rates log10 ft"; const char s_TWO_D_WEAK_XPATH [] = \ "[user_rate/@key = 'two-d weak rates log10 ft' or \ user_rate/@key = 'two-d weak rates']"; const char s_T9[] = "t9"; const char s_T9_0[] = "t9_0"; const char s_USE_HI_T_EQUIL[] = \ "use high temperature equilibrium"; const char s_USE_SCREENING[] = "use screening"; const char s_USE_APPROXIMATE_WEAK_RATES[] = "use approximate weak rates"; const char s_USE_WEAK_DETAILED_BALANCE[] = "use weak detailed balance"; const char s_WEAK_VIEW_FOR_LAB_RATE_TRANSITION[] = \ "weak view for lab rate transition"; const char s_WEAK_XPATH[] = \ "[reactant = 'electron' or product = 'electron' or \ reactant = 'positron' or product = 'positron']"; const char s_YC[] = "Yc"; const char s_YCDOT[] = "Ycdot"; const char s_YE[] = "Ye"; const char s_YEDOT[] = "Yedot"; const char s_YEDOT_BM[] = "Yedot_bm"; const char s_YEDOT_EC[] = "Yedot_ec"; const char s_YEDOT_PC[] = "Yedot_pc"; const char s_YEDOT_BP[] = "Yedot_bp"; const char s_ZONE_LABEL[] = "zone label"; const char s_ZONE_MASS[] = "zone mass"; const char s_ZONE_MASS_CHANGE[] = "zone mass change"; } // namespace nnt #endif /* NNT_STRING_DEFS_H */
[ "zhuang.ge@riken.jp" ]
zhuang.ge@riken.jp
829ad3df5cf66df6784c3fa7d53aa04dff3f0156
2f6acc2dfac585975d475e4cf84f92ac75f46430
/UVaoj/10534.cpp
e0b3dd5e94643386f965546ba40aeaa6544af8ae
[]
no_license
NextApp/ACM
1925f47c93e03fccce4943ca1e135b05db8b83cb
fb3013ea631d17b49968e6a8ff93566f4578e36b
refs/heads/master
2021-05-09T02:53:22.190254
2018-01-28T03:48:14
2018-01-28T03:48:14
119,224,427
0
0
null
null
null
null
UTF-8
C++
false
false
1,415
cpp
#include<iostream> #include<cstdio> #include<cstring> #define N 10050 using namespace std; int n,d[N],l[N],e[N]; struct T { int a,p; } c[N]; int binary_search(int m,int num) { int a=1,b=m; while(a<=b) { int k=(a+b)/2,s=(k==m||c[k+1].a>num); if(c[k].a<num&&s)return c[k].p; else if(s)b=k-1; else a=k+1; } return -1; } int main() { // freopen("1.txt","r",stdin); while(cin>>n) { for(int i=0; i<n; i++) { cin>>l[i]; d[i]=e[i]=1; } c[1].a=l[0],c[1].p=0; int dn=1; for(int i=1; i<n; i++) { int t=1; int k=binary_search(dn,l[i]); if(k>=0)t=d[i]=d[k]+1; if(t>dn||l[i]<c[t].a) { c[t].a=l[i]; c[t].p=i; dn=max(dn,t); } } c[1].a=l[n-1],c[1].p=n-1; dn=1; for(int i=n-2; i>=0; i--) { int t=1; int k=binary_search(dn,l[i]); if(k>=0)t=e[i]=e[k]+1; if(t>dn||l[i]<c[t].a) { c[t].a=l[i]; c[t].p=i; dn=max(dn,t); } } int t=0,s; for(int i=0; i<n; i++) { s=min(d[i],e[i]); t=max(t,s); } cout<<2*t-1<<endl; } return 0; }
[ "yupeng@tuya.com" ]
yupeng@tuya.com
6218e6be04f99663f4f30c7a0a1ffbae279ea26c
dc2346931b96d30e3b0d554b2d8e6f627abd2e12
/mfc-example/webtest/webtest/webtestView.cpp
7f708f5e0f31ba15aab4e9e991b3be8183b11058
[]
no_license
tt-16/practice-code
941961098a89eff22dc6396b2411b2dc76eb0a14
9bd3825d87dc13c957d0b3582a743e7afc4c1841
refs/heads/master
2021-01-12T16:42:06.535781
2017-05-19T05:28:57
2017-05-19T05:28:57
71,430,182
0
0
null
null
null
null
GB18030
C++
false
false
1,396
cpp
// webtestView.cpp : CwebtestView 类的实现 // #include "stdafx.h" #include "webtest.h" #include "webtestDoc.h" #include "webtestView.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CwebtestView IMPLEMENT_DYNCREATE(CwebtestView, CHtmlView) BEGIN_MESSAGE_MAP(CwebtestView, CHtmlView) // 标准打印命令 ON_COMMAND(ID_FILE_PRINT, &CHtmlView::OnFilePrint) END_MESSAGE_MAP() // CwebtestView 构造/析构 CwebtestView::CwebtestView() { // TODO: 在此处添加构造代码 } CwebtestView::~CwebtestView() { } BOOL CwebtestView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: 在此处通过修改 // CREATESTRUCT cs 来修改窗口类或样式 return CHtmlView::PreCreateWindow(cs); } void CwebtestView::OnInitialUpdate() { CHtmlView::OnInitialUpdate(); //Navigate2(_T("http://www.msdn.microsoft.com/visualc/"),NULL,NULL); Navigate2(_T("D:/WORKS/GitRepository/practice-code/mfc-example/webtest/Debug/power.html"),NULL,NULL); } // CwebtestView 打印 // CwebtestView 诊断 #ifdef _DEBUG void CwebtestView::AssertValid() const { CHtmlView::AssertValid(); } void CwebtestView::Dump(CDumpContext& dc) const { CHtmlView::Dump(dc); } CwebtestDoc* CwebtestView::GetDocument() const // 非调试版本是内联的 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CwebtestDoc))); return (CwebtestDoc*)m_pDocument; } #endif //_DEBUG // CwebtestView 消息处理程序
[ "fantian_0033@163.com" ]
fantian_0033@163.com
8c80b7b492d891b49d4a184765d279aa556bf068
4afc9826c4f153d465405410851a67ba20c41bc7
/PokerObjects/PSuit.h
094a8a0c1f99b0fdcffb53329448e47f88d34d40
[]
no_license
aliakbarRashidi/2003RTOnlinePokerStats
3755656b73b830ed8f7d3fb36a28fd2764f1c7a4
1132eff688ae4b00269583b6efa84272dbe3d8b4
refs/heads/master
2020-05-09T21:08:42.386148
2016-09-29T11:49:49
2016-09-29T11:49:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,121
h
// PSuit.h: interface for the PSuit class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_PSUIT_H__ED62888F_1579_445D_ADD3_4FDA488BA44F__INCLUDED_) #define AFX_PSUIT_H__ED62888F_1579_445D_ADD3_4FDA488BA44F__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class PSuit { public: enum SUIT { SUIT_NO_SUIT = 0, SUIT_CLUBS, SUIT_DIAMONDS, SUIT_HEARTS, SUIT_SPADES, SUIT_NUM_SUITS }; public: CString asString() const; PSuit(int iHashValue); int getHashValue() const; PSuit(SUIT eSuit); virtual ~PSuit(); static PSuit charToSuit(unsigned char chSuit); static PSuit stringToSuit(const CString& strSuit); bool operator!=(const PSuit& sSuit) const; bool operator==(const PSuit& sSuit) const; bool operator<(const PSuit& sSuit) const; bool operator<=(const PSuit& sSuit) const; bool operator>(const PSuit& sSuit) const; bool operator>=(const PSuit& sSuit) const; PSuit& operator=(const PSuit& sSuit); void DUMP() const; private: SUIT m_eSuit; }; #endif // !defined(AFX_PSUIT_H__ED62888F_1579_445D_ADD3_4FDA488BA44F__INCLUDED_)
[ "piers.shepperson@btinternet.com" ]
piers.shepperson@btinternet.com
f6e53afb4f96a39d47d75f35141dee7b789c75b3
cea89f2cf20c5767ad168fe795cc9bf4019c0189
/405/Coordinate.cpp
580dd9feee725f420e10a98323d4e815c607294a
[]
no_license
hanzg2014/IMOOC
b9fb6cd98645927dde5a6a919b4a13f69777c857
3c87c4b8bcdc754873303a993e5529972e95bcdc
refs/heads/master
2021-01-22T04:32:53.219460
2017-02-10T09:46:49
2017-02-10T09:46:49
81,550,744
0
0
null
null
null
null
UTF-8
C++
false
false
181
cpp
#include <iostream> #include "Coordinate.h" using namespace std; Coordinate::Coordinate() { cout<<"Coordinate"<<endl; } Coordinate::~Coordinate() { cout<<"~Coordinate"<<endl; }
[ "hanzg@gmail.com" ]
hanzg@gmail.com
83388816085a24e8e26bd5def1d305edbb9f8b58
6f2b6e9d77fc4dd5e1dae8ba6e5a66eb7c7ae849
/sstd_boost/sstd/libs/fusion/test/sequence/tree.hpp
7d127c8a1f617410c93792ecea81ee016dca7974
[ "BSL-1.0" ]
permissive
KqSMea8/sstd_library
9e4e622e1b01bed5de7322c2682539400d13dd58
0fcb815f50d538517e70a788914da7fbbe786ce1
refs/heads/master
2020-05-03T21:07:01.650034
2019-04-01T00:10:47
2019-04-01T00:10:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,181
hpp
/*============================================================================= Copyright (c) 2006 Eric Niebler Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #ifndef FUSION_BINARY_TREE_EAN_05032006_1027 #define FUSION_BINARY_TREE_EAN_05032006_1027 #include <sstd/boost/mpl/if.hpp> #include <sstd/boost/type_traits/is_const.hpp> #include <sstd/boost/type_traits/add_const.hpp> #include <sstd/boost/type_traits/add_reference.hpp> #include <sstd/boost/fusion/support/is_sequence.hpp> #include <sstd/boost/fusion/sequence/intrinsic/at.hpp> #include <sstd/boost/fusion/view/single_view.hpp> #include <sstd/boost/fusion/container/list/cons.hpp> // for nil #include <sstd/boost/fusion/container/vector/vector10.hpp> #include <sstd/boost/fusion/support/sequence_base.hpp> #include <sstd/boost/fusion/support/category_of.hpp> #include <sstd/boost/fusion/support/is_segmented.hpp> #include <sstd/boost/fusion/sequence/intrinsic/segments.hpp> namespace boost { namespace fusion { struct tree_tag; template <typename Data, typename Left = nil, typename Right = nil> struct tree : sequence_base<tree<Data, Left, Right> > { typedef Data data_type; typedef Left left_type; typedef Right right_type; typedef tree_tag fusion_tag; typedef forward_traversal_tag category; typedef mpl::false_ is_view; typedef typename mpl::if_< traits::is_sequence<Data> , Data , single_view<Data> >::type data_view; explicit tree( typename fusion::detail::call_param<Data>::type data_ , typename fusion::detail::call_param<Left>::type left_ = Left() , typename fusion::detail::call_param<Right>::type right_ = Right() ) : segments(left_, data_view(data_), right_) {} typedef vector3<Left, data_view, Right> segments_type; segments_type segments; }; template <typename Data> tree<Data> make_tree(Data const &data) { return tree<Data>(data); } template <typename Data, typename Left, typename Right> tree<Data, Left, Right> make_tree(Data const &data, Left const &left, Right const &right) { return tree<Data, Left, Right>(data, left, right); } namespace extension { template <> struct is_segmented_impl<tree_tag> { template <typename Sequence> struct apply : mpl::true_ {}; }; template <> struct segments_impl<tree_tag> { template <typename Sequence> struct apply { typedef typename mpl::if_< is_const<Sequence> , typename Sequence::segments_type const & , typename Sequence::segments_type & >::type type; static type call(Sequence &seq) { return seq.segments; } }; }; } }} #endif
[ "zhaixueqiang@hotmail.com" ]
zhaixueqiang@hotmail.com
0f283b16bcb7bb540e7514528939568609467ba3
4dc3bead007549c03ad14e589a5ebe7157ac4da0
/src/myOptCont4.cc
6c6985e710b6f89542f704fe293a361a9e076eaf
[]
no_license
skiptoniam/ecomix
428615e5a7fc4af8f834f129b79b3279bb9d132d
73f167135380f73b886ab8ce1ead2b0a4fe29e74
refs/heads/master
2023-04-08T18:52:49.673475
2022-05-27T01:49:47
2022-05-27T01:49:47
80,573,432
5
2
null
2021-01-09T05:29:32
2017-01-31T23:36:08
R
UTF-8
C++
false
false
420
cc
#include"rcp4.h" myOptContr::myOptContr(){}; myOptContr::~myOptContr(){}; void myOptContr::setVals( const SEXP &Rmaxit, const SEXP &Rtrace, const SEXP &RnReport, const SEXP &Rabstol, const SEXP &Rreltol, SEXP &Rconv) { maxitQN = *(INTEGER( Rmaxit)); traceQN = *(INTEGER(Rtrace)); nReport = *(INTEGER(RnReport)); abstol = *(REAL(Rabstol)); reltol = *(REAL(Rreltol)); conv = INTEGER( Rconv); denomEps = 1e-5; }
[ "skiptoniam@gmail.com" ]
skiptoniam@gmail.com
573cb8c4060c36a8274f11727b03d808ed2a4598
a8aa1fc7d0eb8baa38dfceb8dfb47f8d5ca64986
/Basic/randomTrial.cpp
c5c0bcea0302ac02c6a25f4a11dd6bdb5c3718d1
[]
no_license
Deadshot96/Cpp-code
986cc9cb15da62a944babb9e9837c8d19cd4bad7
3504d0b4de8b293eb807dcb078638ed365bf8e6c
refs/heads/master
2023-07-12T07:11:56.584373
2021-08-17T12:30:56
2021-08-17T12:30:56
307,159,788
0
0
null
null
null
null
UTF-8
C++
false
false
330
cpp
# include <iostream> # include <stdlib.h> # include <time.h> using namespace std; int main(int argc, char const *argv[]) { /* code */ srand(time(0)); cout << time(0) << endl; for (short i = 0; i < 10; i++) { /* code */ cout << "Random Number: " << rand() << endl; } return 0; }
[ "bhushan1810patil@gmail.com" ]
bhushan1810patil@gmail.com
a2cc014e6b87ef0c447f1aafb20ba44bf738c1f3
4a61ce1d9a69f1befd0b5aecbc86b10c22580b2f
/src/CueReaderMultiplexer.cpp
63e59bd4e2e14d221a2c99868c98085cd6e1ae5f
[ "BSD-2-Clause" ]
permissive
fernandotcl/btag
521c18316ac6af0b7d8f122d95f81867e15ad005
6b5754a122bad3190662263f034425d6cdabde47
refs/heads/master
2023-08-02T14:26:06.943635
2019-04-04T18:42:55
2019-04-04T18:44:36
825,476
7
2
BSD-2-Clause
2020-12-05T20:11:07
2010-08-09T00:04:30
C++
UTF-8
C++
false
false
1,818
cpp
/* * This file is part of btag. * * © 2015 Fernando Tarlá Cardoso Lemos * * Refer to the LICENSE file for licensing information. * */ #include <boost/foreach.hpp> #include "CueReaderMultiplexer.h" CueReaderMultiplexer::CueReaderMultiplexer(const std::list<std::string> &filenames, const std::string &encoding) { BOOST_FOREACH(const std::string &filename, filenames) m_cue_readers.push_back(boost::shared_ptr<CueReader>(new CueReader(filename, encoding))); } boost::shared_ptr<CueReader> CueReaderMultiplexer::cue_reader_for_track(int track, int &offset) { int accumulated_tracks = 0; BOOST_FOREACH(boost::shared_ptr<CueReader> reader, m_cue_readers) { int number_of_tracks = reader->number_of_tracks(); accumulated_tracks += number_of_tracks; if (accumulated_tracks >= track) { offset = number_of_tracks - accumulated_tracks; return reader; } } return boost::shared_ptr<CueReader>(); } boost::optional<std::wstring> CueReaderMultiplexer::artist_for_track(int track) { int offset; boost::shared_ptr<CueReader> reader = cue_reader_for_track(track, offset); return reader ? reader->artist_for_track(track + offset) : boost::none; } boost::optional<std::wstring> CueReaderMultiplexer::title_for_track(int track) { int offset; boost::shared_ptr<CueReader> reader = cue_reader_for_track(track, offset); return reader ? reader->title_for_track(track + offset) : boost::none; } boost::optional<std::wstring> CueReaderMultiplexer::album() { return m_cue_readers.empty() ? boost::none : m_cue_readers.front()->album(); } boost::optional<int> CueReaderMultiplexer::year() { return m_cue_readers.empty() ? boost::none : m_cue_readers.front()->year(); }
[ "fernandotcl@gmail.com" ]
fernandotcl@gmail.com
28ea4abd5273038a3f70344044717a3f5d92be83
39df74a3f6caed9b7e43e4259895281edc639e91
/GAME.CPP
da0c343c017858e873644ed25de5847979bceebf
[]
no_license
Prof-Calculus/Arcade-Games
d346bc8efc47dee25358e986cacbc8ddc72e281f
e3b9ede030769cc0de8e9e600c3348cb0af6bcd3
refs/heads/master
2016-09-10T19:03:19.630233
2014-12-18T15:44:21
2014-12-18T15:44:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
29,091
cpp
#include <iostream.h> #include <graphics.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <conio.h> #include <alloc.h> #include <fstream.h> #include <dos.h> #include <iomanip.h> const int Breadth = 1*2,NumElements = 10; int choice; struct datas { char name[23]; int score; }score_data; void textgraph(char string1[15] ,char string2[15] ,int no); void textgraph(char string1[15] ,char string2[15] ,int no) { clearviewport(); int length1,length2,height1,height2,i; length1=textwidth(string1); length2=textwidth(string2); height1=textheight(string1); height2=textheight(string2); settextstyle(0,0,0); i=0; if(no==1) { while(length1+100<getmaxy()) { settextstyle(0,1,i); outtextxy(getmaxx()/2,(getmaxy()/2)-(length1/2),string1); delay(150); clearviewport(); settextstyle(0,0,i); outtextxy((getmaxx()/2)-(length1/2),getmaxy()/2,string1); delay(150); clearviewport(); ++i; length1=textwidth(string1); } } if(no==2) { settextstyle(0,0,4); while(i<=getmaxx()-200) { clearviewport(); outtextxy(getmaxx()-i-length1,(getmaxy()/2)-(height1),string1); outtextxy(+i,(getmaxy()/2)-(height2),string2); delay(150); i+=10; } } } class cubefield { public: int x,y,mx,my,sizec,count,countlev,cubex,cubey,maxy; int minx,miny,midx,score; int cube_positions[NumElements][Breadth]; int cubes_in_a_line[3]; int initposn[NumElements][Breadth]; int pausetime, size; int wait; int maxwait; int cubesize; long int deviation; int changecolor; //changes color of trees char num[10],level[10]; //for converting level & scores to string char c; void intialise() { maxwait=17; //apparent width of a one minx=200; //top left of road miny=300; //top left of road mx=getmaxx()-minx; //top right of road my=miny+maxwait*NumElements; //bottom point of road cubesize=10; x=(mx-minx)/2+minx; //initial x cordinate of cursor y=miny+(maxwait*(NumElements-2)); midx=(mx-minx)/2+minx; score=0; pausetime=100; countlev=1; maxy=getmaxy(); wait=1; //variable to move cubes in a band called maxwait deviation=0; //changecolor=1; cubex=cubey=10; for(int i=0;i<NumElements;++i) for(int j=0;j<Breadth;j=j+2) { cube_positions[i][j]=(-2); initposn[i][j]=(-2); if(i==0) cubes_in_a_line[j]=(-2); // initializing this only once } } int downward() { setbkcolor(BLACK); setcolor(WHITE); setlinestyle(0,0,0); score=0; //intialvalue of score is zero int m,n; m=200; n=300; int slowdown=0; void *saucer; clearviewport();//to remove cout triangle(x,y); drawpic(); setfillstyle(SOLID_FILL,getbkcolor()); bar(getmaxx()-100,0,getmaxx(),10); outtextxy(getmaxx()-100,0,"score "); setfillstyle(SOLID_FILL,getbkcolor()); bar(0,0,100,10); outtextxy(0,0,"level "); putlevel(); do { slowdown=slowdown+1; if(slowdown==6) { n=n+30; //drawing trees on either side m=minx-((n-miny)*1); if(n>=300 && n<359) { drawtree(m,n,1); drawtree(getmaxx()-m,n,1); } if(n>=359 && n<418) { drawtree(m,n,2); drawtree(getmaxx()-m,n,2); } if(n>=418 && n<477) { drawtree(m,n,3); drawtree(getmaxx()-m,n,3); } } if(slowdown==7) //reduces the speed of moving trees slowdown=0; if(n>=477) { n=miny; ++changecolor; } for(int j=NumElements-1;j>=0;--j) { for(int i=0;i<Breadth;i=i+2) { if(cube_positions[j][i]>0) { cubex=cube_positions[j][i]; //cubex ,cubey takes the present position of cube cubey=cube_positions[j][i+1]; size = imagesize(cubex,cubey-4,cubex+cubesize+4,cubey+cubesize); //stores the image in memory saucer =malloc( size ); getimage(cubex,cubey-4,cubex+cubesize+4,cubey+cubesize,saucer); putimage(cubex,cubey-4,saucer,XOR_PUT); //removes the present image of cube free(saucer); cubey=cubey+1; //the differential movement in vertical direction is 1 if(initposn[j][i]>=minx && initposn[j][i]<=26+minx) //the following 'if' statements sets the deviation of cubes in horizontal direction, based on the place from wher they orginated cubex=cubex+2; else if(initposn[j][i]>=26+minx && initposn[j][i]<=26*2+minx) cubex=cubex+2; else if(initposn[j][i]>=26*2+minx && initposn[j][i]<=26*3+minx) cubex=cubex+1; else if(initposn[j][i]>=26*3+minx && initposn[j][i]<=26*4+minx) cubex=cubex+1; else if(initposn[j][i]>=26*4+minx && initposn[j][i]<=26*5+minx) cubex=cubex+0; else if(initposn[j][i]>=26*5+minx && initposn[j][i]<=26*6+minx) cubex=cubex-1; else if(initposn[j][i]>=26*6+minx && initposn[j][i]<=26*7+minx) cubex=cubex-1; else if(initposn[j][i]>=26*7+minx && initposn[j][i]<=26*8+minx) cubex=cubex-2; else if(initposn[j][i]>=26*8+minx && initposn[j][i]<=26*9+minx) cubex=cubex-2; else cubex=cubex+0; if(wait<maxwait) //if the cube(or cube position ) is in a particular element then it is stored in the same element { cube_positions[j][i]=cubex; cube_positions[j][i+1]=cubey; } if(j!=NumElements-1) { if(wait==maxwait) { cube_positions[j+1][i]=cubex; cube_positions[j+1][i+1]=cubey; initposn[j][i]=initposn[j-1][i]; } putimage(cubex,cubey-4,saucer,1);//puting } }//closes if condition }//2nd for loop }//1st for loop for(int k=0;k<Breadth;k+=2) { if(wait==maxwait) { do { cubes_in_a_line[k]=random(mx); //creates new cubes position }while(cubes_in_a_line[k]<minx); setfillstyle(SOLID_FILL ,YELLOW); //creates new cubes bar3d(cubes_in_a_line[k],miny,cubes_in_a_line[k]+cubesize,miny+cubesize,4,1); cube_positions[0][k]=cubes_in_a_line[k]; cube_positions[0][k+1]=miny; initposn[0][k]=cubes_in_a_line[k]; } } delay (35-(countlev*5)); //increases the level ++wait; if(wait>maxwait) wait=1; c='/0'; if(kbhit()) c=getch(); if(c=='o') exit(1); side(); ++score; putscore(); if(score>=(countlev*500)) { if(countlev<=9) { ++countlev; putlevel(); } } }while( check() ); clearviewport(); setbkcolor(RED); textgraph("! OUT !"," ",1); setbkcolor(getbkcolor()); return score; } void drawpic() { setfillstyle(SOLID_FILL,CGA_WHITE); bar(0,0,getmaxx(),miny-6); setfillstyle(SOLID_FILL,WHITE); pieslice(100,100,0,360,20); pieslice(120,100,0,360,20); pieslice(140,120,0,360,30); pieslice(500,120,0,360,20); pieslice(520,100,0,360,20); pieslice(540,120,0,360,30); int *poly=new int[8]; poly[0] = 0; poly[1] =miny-6 ; poly[2] = minx; poly[3] = miny-6; poly[4] = 0; poly[5] = getmaxy(); poly[7] = 0; poly[8] =miny-6 ; setfillstyle(SOLID_FILL,GREEN); fillpoly(3, poly); poly[0] = mx; poly[1] =miny-6 ; poly[2] = getmaxx(); poly[3] = miny-6; poly[4] = getmaxx(); poly[5] = getmaxy(); poly[7] = 0; poly[8] =miny-6 ; setfillstyle(SOLID_FILL,EGA_GREEN); fillpoly(3, poly); delete[] poly; } void drawtree(int bottomx,int bottomy,int big) { setfillstyle(SOLID_FILL,BROWN); bar( bottomx-10, bottomy-(15*( big+1)), bottomx, bottomy); if(changecolor%2==0) { setfillstyle(SOLID_FILL,GREEN); pieslice( bottomx-10, bottomy-(15*( big+1)), 0, 360,5*( big+1)); } else { setfillstyle(SOLID_FILL,LIGHTGREEN); pieslice( bottomx-10, bottomy-(15*( big+1)), 0, 360,5*( big+1)); } } void triangle(int l,int m) { line(l,m,l-10,m+10); line(l,m,l+10,m+10); line(l-cubesize,m+10,l+cubesize,m+10); } void movecursor(int m) { setcolor(getbkcolor()); triangle(x,y); //ersases old cursor x=x+m; setcolor(WHITE); triangle(x,y); //draws new cursor } void side() { switch(c) //movement using cursor keys { case 77:{if(x>=mx)movecursor(0);else movecursor(2);}break; case 75:{if(x<=minx)movecursor(0);else movecursor(-2);}break; case 'p':{pause();} } } void pause() { //for passing during the game char inp='/0'; while(inp!='p') { delay(50); inp=getch(); } } int check() //checks cursor & cube meets or not { for(int i=0;i<Breadth;i=i+2) { if( cube_positions[NumElements-3][i+1]+cubesize>=y) { if(cube_positions[NumElements][i]+cubesize>=x && cube_positions[NumElements][i]+cubesize<=x-cubesize) {return 0;} if( cube_positions[NumElements-3][i]>=x-cubesize && cube_positions[NumElements-3][i]<=x+cubesize ) {return 0;} } if( cube_positions[NumElements-2][i]==x+cubesize || cube_positions[NumElements-3][i]+cubesize==x-cubesize ) {return 0;} } return 1; } void putscore() //puts the score { setfillstyle(SOLID_FILL,getbkcolor()); bar(getmaxx()-40,0,getmaxx(),10); itoa(score,num,10); outtextxy(getmaxx()-40,0,num); } void putlevel() //put the level { setfillstyle(SOLID_FILL,getbkcolor()); bar(60,0,100,10); itoa(countlev,level,10); outtextxy(60,0,level); } }; class run { int b,l,x,y,result,count; float i; char c; public: run() { x=getmaxx()/2; y=getmaxy()/2; l=x*2; b=y*2; count=0; randomize(); i=1; clearviewport(); } int move1() // lest means 1. right na 2. both sides na 0. { randomize(); do { int poly[8]; int p=random(3); y=getmaxy()/2; int rand,posn; rand=random(5); do { setfillstyle(0, 1); bar(0,0,getmaxx(),getmaxy()); char s[25]; itoa(count,s,10); outtextxy((getmaxx()-50),15,s); setlinestyle(3,4,3); line(x,2*y,x,y); draw(p); poly[0] = int(x-i);/* 1st vertex */ poly[1] = y; poly[2] = int(x+i); /* 2nd */ poly[3] = y; poly[4] = x+150; /* 3rd */ poly[5] = 2*y; poly[6] = x-150; poly[7] = 2*y; setfillstyle(8, 8); fillpoly(4, poly); y=y+2; if( y<(b-45) ) //just to ensure that the input is there only when the bar is near the end. he input anywhere if(kbhit()) result=0; i=i+0.65; }while(y<(b-10)); if(!kbhit()) { result=0; } else { c=getch(); result=input(p,c); } count++; i=1; }while(result); return count; } void draw(int g) { if(g==0) { setlinestyle(3,4,3); line(0,y,2*x,y); line(0,y,2*x,y); line(0,int(y+(i/2)) ,2*x,int(y+(i/2)) ); setfillstyle(8, 8); bar(0,int(y),2*x,int(y+(i/2)));//use i for zooming effect } else if(g==1) { setlinestyle(3,4,3); line(0,y,x,y); line(0,y,int(x+i),y); line(0,int(y+(i/2)) ,int(x+i),int(y+(i/2)) ); setfillstyle(8, 8); bar(0,int(y),int(x+i),int(y+(i/2))); } else if(g==2) { setlinestyle(3,4,3); line(x,y,2*x,y); line(int(x-i),y,2*x,y); line(int(x-i),int(y+(i/2)) ,2*x,int(y+(i/2)) ); setfillstyle(8, 8); bar(int(x-i),int(y),2*x,int(y+(i/2))); } } void turn(int a) { int m; if(a==2) m=getmaxx(); else m=0; //m is maxx int n=getmaxy(); int x=getmaxx()/2; int y=n/2; while((doit(m-1))) //adding one would have occurred in the loop. im checking for nxt loop only { setfillstyle(0, 1); bar(0,0,getmaxx(),getmaxy()); if(a==2) { line((m),(n)-2,x,(2*y)-2); int poly[8]; setlinestyle(3,4,3); poly[0] = x-10;/* 1st vertex */ poly[1] = 2*y; poly[2] = m-5; /* 2nd */ poly[3] = n-2; poly[4] = m+15; /* 3rd */ poly[5] = n-2; poly[6] = x+10; poly[7] = 2*y-5; setfillstyle(8, 8); fillpoly(4, poly); if(kbhit()) delay(50); m=m-15; } else if(a==1) { line(m,(n)-2,x,(2*y)-2); int poly[8]; poly[0] = x-10;/* 1st vertex */ poly[1] = 2*y; poly[2] = m+5; /* 2nd */ poly[3] = n-2; poly[4] = m+15; /* 3rd */ poly[5] = n-2; poly[6] = x+10; poly[7] = 2*y-5; setfillstyle(8, 8); fillpoly(4, poly); if(kbhit()) delay(50); m=m+15; } n=n-5; } } int doit (int m) //only for turning { if(m<x-5||m>x+5) return 1; else return 0; } int input(int a,char b) { if(b=='a') //turning check { if(a==1||a==0) { turn(1); return 1; } else { return 0; } } else if(b=='d') { if((a==2||a==0)) { turn(2); return 1; } else { return 0; } } else { return 0; } } }; class scores : public cubefield , public run { public: char filename[10],game; char playername[23]; int score; int midx,midy; int txtht; int back; //char msg[]; scores() { txtht=8; midx=getmaxx()/2; midy=getmaxy()/2; strcpy(playername,"check "); back=0; // CODES : 1-cubefield.2-templerun } int menu() { int option; int option1=0;//create or open account int option3=0;//exist is made false for profile to be shown int exit=0; while(exit==0) { clearviewport(); option=select_game(); slide2(); clearviewport(); do { option1=aboutaccount();//either to open or create account clearviewport(); account_selection(option1); clearviewport(); }while(back); //profile while(option3!=1)//option3 ==1 to quit { option3 = game_menu(); if(option3==3){output_scores();option3=0;clearviewport();} else if(option3==4){option3=1;clearviewport();}//if back is pressed profile will not show else if(option3==2) { if(::choice==1) { clearviewport(); intialise(); score=downward(); update_scores(score); option3=0;//return back to profile clearviewport(); } else if(::choice==2) { clearviewport(); score=move1(); update_scores(score); option3=0;//return back to profile clearviewport(); } cin.get(); } } option3=0;//making show profile true } } int game_menu() { setbkcolor(LIGHTGREEN); char c5='a';//some random charecter clearviewport(); border(); setcolor(RED); settextstyle(0,0,3); outtextxy(midx-textwidth("MENU")/2,100,"MENU"); settextstyle(0,0,3); outtextxy(midx-textwidth("WELCOME")/2,45-textheight(playername)/2,"WELCOME "); outtextxy(midx-textwidth(playername)/2,50,playername); setlinestyle(0,0,0); settextstyle(0,0,0); char msg1[]="START GAME "; char msg2[]="DISPLAY SCORE"; char msg3[]="BACK"; int c12=1; char as; int minypos=midy-50; int maxypos=midy+50; int ypos=midy-60; int xpos=midx-textwidth(msg2)+30; outtextxy(midx-textwidth(msg1)/2,midy-50,msg1); outtextxy(midx-textwidth(msg2)/2,midy,msg2); outtextxy(midx-textwidth(msg3)/2,midy+50,msg3); setcolor(WHITE); rectangle(xpos,ypos,xpos+150,ypos+20); as=getch(); while(as!=13) { switch(as) //movement using cursor keys { case 72:{ if(ypos>=minypos) {moverect(xpos,ypos,-50);--c12;} }break; case 80:{ if(ypos+11<=maxypos) {moverect(xpos,ypos,50);++c12;} }break; } as=getch(); } clearviewport(); sound(2);sound(2);delay(110); settextstyle(0,0,0); setcolor(WHITE); sound(2); setbkcolor(BLACK); if(c12==1)//'' return 2; else if(c12==2) return 3; else if(c12==3) return 4; } int select_game() { setbkcolor(LIGHTRED); //Ist slide //1-cubefield. 2 run char c1='\0'; // c is charecter input in slide_1 circle(100,200,10); setlinestyle(0,0,7); line(97,210,110,280);//body line(100,229,70,221);//hands line(100,229,68,240); line(110,278,82,303);//I line(110,278,125,307);//II line(83,303,88,326);//III line(125,308,144,322);//IV setlinestyle(3,4,5);//sledge line(112,327,68,327); setlinestyle(3,8,2);//handle line(68,240,68,330); setlinestyle(2,10,1);//wheels circle(73,335,5); circle(110,335,5); line(73,330,73,340); line(110,330,110,340); setfillstyle(1,0);//first set bgrnd colour bar(115,308,151,336); line(125,308,144-2,322-1); delay(10); setcolor(BLUE); settextstyle(0,0,0); setlinestyle(0,0,0); border(); char msg4[]="ARCADE GAMES"; char msg1[]="CUBE FIELD"; char msg2[]="ROAD RUNNER"; char msg3[]="EXIT"; int c12=1; char as; int minypos=midy-50; int maxypos=midy+50; int ypos=midy-60; int xpos=midx-textwidth(msg2)+20; setcolor(WHITE); settextstyle(0,0,2); outtextxy(midx-textwidth(msg4)/2,50,msg4); settextstyle(0,0,0); setcolor(BLUE); outtextxy(midx-textwidth(msg1)/2,midy-50,msg1); outtextxy(midx-textwidth(msg2)/2,midy,msg2); outtextxy(midx-textwidth(msg3)/2,midy+50,msg3); setcolor(WHITE); rectangle(xpos,ypos,xpos+150,ypos+20); as=getch(); while(as!=13) { switch(as) //movement using cursor keys { case 72:{ if(ypos>=minypos) {moverect(xpos,ypos,-50);--c12;} }break; case 80:{ if(ypos+11<=maxypos) {moverect(xpos,ypos,50);++c12;} }break; } as=getch(); } clearviewport(); sound(2);sound(2); if(c12==1)//'' { ::choice=1;} else if(c12==2) { ::choice=2;} else if(c12==3) exit(1); setbkcolor(BLACK); if (::choice==1) strcpy(filename,"cube.dat"); else if(::choice==2) strcpy(filename,"run.dat"); return 0; } void moverect(int xp,int &yp,int m) { setcolor(getbkcolor()); rectangle(xp,yp,xp+150,yp+20); yp=yp+m; setcolor(WHITE); rectangle(xp,yp,xp+150,yp+20); } void blinke(int x,int y,char string[30]) { settextstyle(0,0,0); while(!kbhit()) { setcolor(WHITE); outtextxy(x,y,string); delay(50); setcolor(getbkcolor()); outtextxy(x,y,string); delay(50); } setcolor(WHITE); } void border() { rectangle(10,10,getmaxx()-10,getmaxy()-10); } void slide2() { clearviewport(); border(); setbkcolor(BLUE); settextstyle(0,0,0); if(::choice==1) { textgraph("CUBE ","FIELD",2); border(); delay(100); setcolor(WHITE); settextstyle(0,0,0); rectangle(160,10,600,100); outtextxy(170,20,"Captain Tsubasa's is on a mission in planet Ranklop."); outtextxy(170,30,"When his space ship was sighted by the enemies"); outtextxy(170,40,"Tsubasa abandoned his spaceship and jumped down."); outtextxy(170,50,"As the pilot you are caught in the spaceship."); outtextxy(170,60,"Guide the through the field. to land safely."); outtextxy(170,70,"BEWARE the enemies are building blocks at you"); outtextxy(170,80,"Try to move safely"); } else { textgraph("ROAD","RUNNER",2); border(); delay(100); settextstyle(0,0,0); setlinestyle(0,0,0); setcolor(WHITE); rectangle(160,10,600,100); outtextxy(170,20,"Captain Tsubasa's is on a mission in planet Ranklop."); outtextxy(170,30,"When his space ship was sighted by the enemies,"); outtextxy(170,40,"Tsubasa abandoned his spaceship and took his scooty."); outtextxy(170,50,"But his hand was shot. Quickly as his associate,you got"); outtextxy(170,60,"control of the scooty. Drive it to safety.mind you"); outtextxy(170,70,"cannot control the speed. Try to be on track."); outtextxy(170,80,"Death awaits on either side"); } settextstyle(0,0,0); blinke(getmaxx()/2-100,getmaxy()-50,"Press any key to continue"); clearviewport(); } void account_selection(int ans) { border(); char c5; char c=' '; int i=0; setbkcolor(BLUE); char temp[23]=" "; char msg1[]="ENTER NAME <minimum 4 characters>"; char msg2[]="THIS NAME EXISTS ALREADY "; char msg3[]="SUCCESFULLY WRITTEN"; char msg4[]="THIS NAME DOES NOT EXIST"; char msg5[]=" < press r to re-enter the name, press 'n' to go back> "; setcolor(LIGHTGRAY); do//this is common to both open and create account this is accepting the name for first time { clearviewport(); border(); settextstyle(0,0,2); if(ans==1) outtextxy(midx-textwidth("\n\n\n\WELCOME BACK\n\n\n ")/2,textheight("\n\n\n\WELCOME BACK\n\n\n ")/2,"\n\n\n\WELCOME BACK\n\n\n "); settextstyle(0,0,0); outtextxy(midx-textwidth(msg1)/2,midy,msg1); c=getch(); while(c!=13 && i<=22) { temp[i]=c; ++i; temp[i+1]='\0'; setcolor(BLUE); bar(midx-textwidth(temp),midy-12,midx,midy); setcolor(LIGHTGRAY); outtextxy(midx-textwidth(temp),midy-12,temp); c=getch(); } temp[i+1]='\0'; strcpy(playername,temp); }while(!validname()); //CODE 1-open account 2-create account if(ans ==2) { while(!validacc() && (!back))//this will proceed only if such a name doesnot exist { do { clearviewport(); border(); settextstyle(0,0,0); outtextxy(midx-textwidth(msg2)/2,midy,msg2); outtextxy(midx-textwidth(msg5)/2,midy-10,msg5); settextstyle(0,0,0); c5=getch(); if(c5=='r') { clearviewport(); border(); settextstyle(0,0,0); outtextxy(midx-textwidth(msg1)/2,midy,msg1); c=getch(); while(c!=13 && i<=22) { temp[i]=c; ++i; temp[i+1]='\0'; setcolor(BLUE); bar(midx-textwidth(temp),midy-12,midx,midy); setcolor(LIGHTGRAY); outtextxy(midx-textwidth(temp),midy-12,temp); c=getch(); } temp[i+1]='\0'; strcpy(playername,temp); } else if(c5=='n') back=1;//he will go to open account ,create account slide*/ }while(!validname() && (!back)); } //creating account fstream file(filename,ios::binary|ios::out|ios::app); if(!file) { cerr<<"error in creating account"; cin.get(); } score_data.score=0; strcpy(score_data.name,playername); file.seekp(0,ios::end); file.write((char*)&score_data,sizeof(score_data)); clearviewport(); outtextxy(midx-textwidth(msg3),midy,msg3); file.close(); } if(ans==1) { while(validacc() && (!back) ) //this will proceed only if such a name exists { do { clearviewport(); border(); settextstyle(0,0,0); outtextxy(midx-textwidth(msg4)/2,midy,msg4); outtextxy(midx-textwidth(msg5)/2,midy-10,msg5); c5=getch(); if(c5=='r') { clearviewport(); settextstyle(0,0,0); outtextxy(midx-textwidth(msg1),midy,msg1); c=getch(); while(c!=13 && i<=22) { temp[i]=c; ++i; temp[i+1]='\0'; setcolor(BLUE); bar(midx-textwidth(temp),midy-12,midx,midy); setcolor(LIGHTGRAY); outtextxy(midx-textwidth(temp),midy-12,temp); c=getch(); } temp[i+1]='\0'; strcpy(playername,temp); } else if(c5=='n') back=1;//he will go to open account ,create account slide }while(!validname() && (!back)); } } return ; } int aboutaccount() { //SLIDE II back=0; int selection=0; setbkcolor(BLUE); char msg1[]="OPEN ACCOUNT"; char msg2[]="CREATE ACCOUNT"; char msg4[]="ACCOUNT TYPE"; int c12=1; char as;// as is charecter input in slide_2 int minypos=midy-50; int maxypos=midy+50; int ypos=midy-60; int xpos=midx-textwidth("CREATE ACCOUNT")/2-20; setcolor(WHITE); border(); settextstyle(0,0,0); outtextxy(getmaxx()-350,50,msg4); outtextxy(midx-textwidth(msg1)/2,midy-50,msg1); outtextxy(midx-textwidth(msg2)/2,midy+50,msg2); rectangle(xpos,ypos,xpos+150,ypos+20); as=getch(); while(as!=13) { switch(as) //movement using cursor keys { case 72:{ if(ypos>=minypos) {moverect(xpos,ypos,-100);--c12;} }break; case 80:{ if(ypos+11<=maxypos) {moverect(xpos,ypos,100);++c12;} }break; } as=getch(); } clearviewport(); sound(2);sound(2); if(c12==1)//'' selection=1; else if(c12==2) selection=2; return selection; } int validacc() { //checking validity int validaccount=1; fstream fi(filename,ios::binary|ios::in|ios::app); if(!fi) { cerr<<"error: in file in valid account"; cin.get(); exit(1); } do { fi.read((char*)&score_data,sizeof(score_data)); if(!(strcmp(score_data.name,playername))) { validaccount=0; } }while(!fi.eof()) ; fi.close(); if(validaccount==0) return 0; else return 1; } int validname() { return (strlen(playername)>=4)?1:0; } int update_scores(int points) { clearviewport(); border(); long reckpos=0; char temp[20]=" "; int highscore=0; itoa(points,temp,20); outtextxy(midx,midy,temp); int gamemax=0;//if it is 1 then score is high score if it is 0 then not a high score fstream file(filename,ios::binary|ios::out|ios::in); if(!file) {cerr<<"error in updating scores"; exit(0);} reckpos=file.tellg(); file.read((char*)&score_data,sizeof(score_data)); while(!file.eof()) { if(score_data.score>highscore) highscore=score_data.score; if(!strcmp(score_data.name,playername)) { if(score_data.score<points) { gamemax=1; file.seekp(reckpos,ios::beg); score_data.score=points; file.write((char*)&score_data,sizeof(score_data)); file.close(); return 0; } } reckpos=file.tellg(); file.read((char*)&score_data,sizeof(score_data)); } file.close(); if(points>=highscore) {blinke(midx,midy-12,"GRAND HIGH SCORE"); gamemax=0;} if(gamemax==1) blinke(midx,midy-12,"YOUR HIGH SCORE"); cin.get(); return 0; } int output_scores() { settextstyle(0,0,0); int tempsc=0; int change=0; //changes y cordinate during output char strscore[10]; strcpy(strscore," "); clearviewport(); setbkcolor(BLUE); setcolor(WHITE); border(); fstream fi(filename,ios::binary|ios::in|ios::app); if(!fi) { cerr<<"error: in file in output scores"; cin.get(); exit(1); } if(::choice==1) outtextxy(midx,10,"CUBEFIELD SCORES"); else if(::choice==2) outtextxy(midx,10,"ROAD RUNNER SCORES"); outtextxy(midx-50,30,"NAME"); outtextxy(midx+50,30,"SCORE"); fi.read((char*)&score_data,sizeof(score_data)); while(!fi.eof()) { settextstyle(0,0,0); change+=10; outtextxy(midx-50,40+change,score_data.name); tempsc=score_data.score; itoa(tempsc,strscore,10); outtextxy(midx+50,40+change,strscore); fi.read((char*)&score_data,sizeof(score_data)); } fi.close(); cin.get(); clearviewport(); return 0; } }; int main() { // request auto detection int gdriver = DETECT, gmode, errorcode; // initialize graphics and local variables initgraph(&gdriver, &gmode, "..\\bgi"); // read result of initialization errorcode = graphresult(); if (errorcode != grOk) // an error occurred { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); // terminate with an error code } scores s; cubefield c; run t; s.menu(); cout<<"Thank you for playing"; cin.get(); return 0; }
[ "srinivasan1995@gmail.com" ]
srinivasan1995@gmail.com
90dbd6d8502b3c0d49cbdd552f3a82e59630084c
33a52c90e59d8d2ffffd3e174bb0d01426e48b4e
/uva/10400-/10473.cc
2aa8003003226e0c996fc5c69e4520d3085e8fcf
[]
no_license
Hachimori/onlinejudge
eae388bc39bc852c8d9b791b198fc4e1f540da6e
5446bd648d057051d5fdcd1ed9e17e7f217c2a41
refs/heads/master
2021-01-10T17:42:37.213612
2016-05-09T13:00:21
2016-05-09T13:00:21
52,657,557
0
0
null
null
null
null
UTF-8
C++
false
false
1,247
cc
// 10473 #include<iostream> #include<string> #include<cctype> #include<cstdlib> #define MAX_SIZE 60 using namespace std; string source; bool read(){ cin >> source; if(source[0]=='-') return false; return true; } void work(){ long long digit=0; if(source.length()>2 && source[0]=='0' && source[1]=='x'){ long long p=1; for(int i=source.length()-1;i>=2;p*=16,i--){ if(isalpha(source[i])) digit+=p*(source[i]-'A'+10); else digit+=p*(source[i]-'0'); } cout << digit << endl; } else { long long p=1; for(int i=source.length()-1;i>=0;p*=10,i--){ digit+=p*(source[i]-'0'); } int hexDigit[MAX_SIZE]; for(int i=0;i<MAX_SIZE;i++) hexDigit[i] = 0; for(int i=0;digit>0;digit/=16,i++) hexDigit[i] = digit%16; cout << "0x"; int cursor=MAX_SIZE-1; while(cursor>=0 && hexDigit[cursor]==0) cursor--; if(cursor==-1){ cout << 0 << endl; return; } for(;cursor>=0;cursor--){ if(hexDigit[cursor]>=10){ cout << (char)(hexDigit[cursor]-10+'A'); } else cout << hexDigit[cursor]; } cout << endl; } } int main(){ while(read()) work(); return 0; }
[ "ben.shooter2@gmail.com" ]
ben.shooter2@gmail.com
3a316fd1daebcbe6468064928fbd866446d6ca13
4da7de4ce2fffd74596e20c6df7a92a3173fca4d
/src/rpcwallet.cpp
029429e2ade280362c2e760ab2769edb583e978a
[ "MIT" ]
permissive
lastcoin/lastcoin
74c0dce437bc253ef30258735f3dec786a47f1d9
cec7b6ea66d336c1d3ee151f5601039241d99b43
refs/heads/master
2016-09-06T03:35:00.792939
2014-06-16T04:29:49
2014-06-16T04:29:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
54,847
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <boost/assign/list_of.hpp> #include "wallet.h" #include "walletdb.h" #include "bitcoinrpc.h" #include "init.h" #include "base58.h" using namespace std; using namespace boost; using namespace boost::assign; using namespace json_spirit; int64 nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime; std::string HelpRequiringPassphrase() { return pwalletMain && pwalletMain->IsCrypted() ? "\nrequires wallet passphrase to be set with walletpassphrase first" : ""; } void EnsureWalletIsUnlocked() { if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); } void WalletTxToJSON(const CWalletTx& wtx, Object& entry) { int confirms = wtx.GetDepthInMainChain(); entry.push_back(Pair("confirmations", confirms)); if (wtx.IsCoinBase()) entry.push_back(Pair("generated", true)); if (confirms) { entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); entry.push_back(Pair("blockindex", wtx.nIndex)); entry.push_back(Pair("blocktime", (boost::int64_t)(mapBlockIndex[wtx.hashBlock]->nTime))); } entry.push_back(Pair("txid", wtx.GetHash().GetHex())); entry.push_back(Pair("time", (boost::int64_t)wtx.GetTxTime())); entry.push_back(Pair("timereceived", (boost::int64_t)wtx.nTimeReceived)); BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue) entry.push_back(Pair(item.first, item.second)); } string AccountFromValue(const Value& value) { string strAccount = value.get_str(); if (strAccount == "*") throw JSONRPCError(RPC_WALLET_INVALID_ACCOUNT_NAME, "Invalid account name"); return strAccount; } Value getinfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getinfo\n" "Returns an object containing various state info."); proxyType proxy; GetProxy(NET_IPV4, proxy); Object obj; obj.push_back(Pair("version", (int)CLIENT_VERSION)); obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION)); if (pwalletMain) { obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); } obj.push_back(Pair("blocks", (int)nBestHeight)); obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset())); obj.push_back(Pair("connections", (int)vNodes.size())); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string()))); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("testnet", fTestNet)); if (pwalletMain) { obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); } obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); obj.push_back(Pair("mininput", ValueFromAmount(nMinimumInputValue))); if (pwalletMain && pwalletMain->IsCrypted()) obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("errors", GetWarnings("statusbar"))); return obj; } Value getnewaddress(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getnewaddress [account]\n" "Returns a new lastcoin address for receiving payments. " "If [account] is specified (recommended), it is added to the address book " "so payments received with the address will be credited to [account]."); // Parse the account first so we don't generate a key if there's an error string strAccount; if (params.size() > 0) strAccount = AccountFromValue(params[0]); if (!pwalletMain->IsLocked()) pwalletMain->TopUpKeyPool(); // Generate a new key that is added to wallet CPubKey newKey; if (!pwalletMain->GetKeyFromPool(newKey, false)) throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); CKeyID keyID = newKey.GetID(); pwalletMain->SetAddressBookName(keyID, strAccount); return CBitcoinAddress(keyID).ToString(); } CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) { CWalletDB walletdb(pwalletMain->strWalletFile); CAccount account; walletdb.ReadAccount(strAccount, account); bool bKeyUsed = false; // Check if the current key has been used if (account.vchPubKey.IsValid()) { CScript scriptPubKey; scriptPubKey.SetDestination(account.vchPubKey.GetID()); for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end() && account.vchPubKey.IsValid(); ++it) { const CWalletTx& wtx = (*it).second; BOOST_FOREACH(const CTxOut& txout, wtx.vout) if (txout.scriptPubKey == scriptPubKey) bKeyUsed = true; } } // Generate a new key if (!account.vchPubKey.IsValid() || bForceNew || bKeyUsed) { if (!pwalletMain->GetKeyFromPool(account.vchPubKey, false)) throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); pwalletMain->SetAddressBookName(account.vchPubKey.GetID(), strAccount); walletdb.WriteAccount(strAccount, account); } return CBitcoinAddress(account.vchPubKey.GetID()); } Value getaccountaddress(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getaccountaddress <account>\n" "Returns the current lastcoin address for receiving payments to this account."); // Parse the account first so we don't generate a key if there's an error string strAccount = AccountFromValue(params[0]); Value ret; ret = GetAccountAddress(strAccount).ToString(); return ret; } Value setaccount(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "setaccount <lastcoinaddress> <account>\n" "Sets the account associated with the given address."); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid lastcoin address"); string strAccount; if (params.size() > 1) strAccount = AccountFromValue(params[1]); // Detect when changing the account of an address that is the 'unused current key' of another account: if (pwalletMain->mapAddressBook.count(address.Get())) { string strOldAccount = pwalletMain->mapAddressBook[address.Get()]; if (address == GetAccountAddress(strOldAccount)) GetAccountAddress(strOldAccount, true); } pwalletMain->SetAddressBookName(address.Get(), strAccount); return Value::null; } Value getaccount(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getaccount <lastcoinaddress>\n" "Returns the account associated with the given address."); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid lastcoin address"); string strAccount; map<CTxDestination, string>::iterator mi = pwalletMain->mapAddressBook.find(address.Get()); if (mi != pwalletMain->mapAddressBook.end() && !(*mi).second.empty()) strAccount = (*mi).second; return strAccount; } Value getaddressesbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getaddressesbyaccount <account>\n" "Returns the list of addresses for the given account."); string strAccount = AccountFromValue(params[0]); // Find all addresses that have the given account Array ret; BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, string)& item, pwalletMain->mapAddressBook) { const CBitcoinAddress& address = item.first; const string& strName = item.second; if (strName == strAccount) ret.push_back(address.ToString()); } return ret; } Value setmininput(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1) throw runtime_error( "setmininput <amount>\n" "<amount> is a real and is rounded to the nearest 0.00000001"); // Amount int64 nAmount = 0; if (params[0].get_real() != 0.0) nAmount = AmountFromValue(params[0]); // rejects 0.0 amounts nMinimumInputValue = nAmount; return true; } Value sendtoaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 4) throw runtime_error( "sendtoaddress <lastcoinaddress> <amount> [comment] [comment-to]\n" "<amount> is a real and is rounded to the nearest 0.00000001" + HelpRequiringPassphrase()); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid lastcoin address"); // Amount int64 nAmount = AmountFromValue(params[1]); // Wallet comments CWalletTx wtx; if (params.size() > 2 && params[2].type() != null_type && !params[2].get_str().empty()) wtx.mapValue["comment"] = params[2].get_str(); if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty()) wtx.mapValue["to"] = params[3].get_str(); if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx); if (strError != "") throw JSONRPCError(RPC_WALLET_ERROR, strError); return wtx.GetHash().GetHex(); } Value listaddressgroupings(const Array& params, bool fHelp) { if (fHelp) throw runtime_error( "listaddressgroupings\n" "Lists groups of addresses which have had their common ownership\n" "made public by common use as inputs or as the resulting change\n" "in past transactions"); Array jsonGroupings; map<CTxDestination, int64> balances = pwalletMain->GetAddressBalances(); BOOST_FOREACH(set<CTxDestination> grouping, pwalletMain->GetAddressGroupings()) { Array jsonGrouping; BOOST_FOREACH(CTxDestination address, grouping) { Array addressInfo; addressInfo.push_back(CBitcoinAddress(address).ToString()); addressInfo.push_back(ValueFromAmount(balances[address])); { LOCK(pwalletMain->cs_wallet); if (pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get()) != pwalletMain->mapAddressBook.end()) addressInfo.push_back(pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get())->second); } jsonGrouping.push_back(addressInfo); } jsonGroupings.push_back(jsonGrouping); } return jsonGroupings; } Value signmessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) throw runtime_error( "signmessage <lastcoinaddress> <message>\n" "Sign a message with the private key of an address"); EnsureWalletIsUnlocked(); string strAddress = params[0].get_str(); string strMessage = params[1].get_str(); CBitcoinAddress addr(strAddress); if (!addr.IsValid()) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); CKeyID keyID; if (!addr.GetKeyID(keyID)) throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key"); CKey key; if (!pwalletMain->GetKey(keyID, key)) throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available"); CHashWriter ss(SER_GETHASH, 0); ss << strMessageMagic; ss << strMessage; vector<unsigned char> vchSig; if (!key.SignCompact(ss.GetHash(), vchSig)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed"); return EncodeBase64(&vchSig[0], vchSig.size()); } Value verifymessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 3) throw runtime_error( "verifymessage <lastcoinaddress> <signature> <message>\n" "Verify a signed message"); string strAddress = params[0].get_str(); string strSign = params[1].get_str(); string strMessage = params[2].get_str(); CBitcoinAddress addr(strAddress); if (!addr.IsValid()) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); CKeyID keyID; if (!addr.GetKeyID(keyID)) throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key"); bool fInvalid = false; vector<unsigned char> vchSig = DecodeBase64(strSign.c_str(), &fInvalid); if (fInvalid) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding"); CHashWriter ss(SER_GETHASH, 0); ss << strMessageMagic; ss << strMessage; CPubKey pubkey; if (!pubkey.RecoverCompact(ss.GetHash(), vchSig)) return false; return (pubkey.GetID() == keyID); } Value getreceivedbyaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getreceivedbyaddress <lastcoinaddress> [minconf=1]\n" "Returns the total amount received by <lastcoinaddress> in transactions with at least [minconf] confirmations."); // Bitcoin address CBitcoinAddress address = CBitcoinAddress(params[0].get_str()); CScript scriptPubKey; if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid lastcoin address"); scriptPubKey.SetDestination(address.Get()); if (!IsMine(*pwalletMain,scriptPubKey)) return (double)0.0; // Minimum confirmations int nMinDepth = 1; if (params.size() > 1) nMinDepth = params[1].get_int(); // Tally int64 nAmount = 0; for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !wtx.IsFinal()) continue; BOOST_FOREACH(const CTxOut& txout, wtx.vout) if (txout.scriptPubKey == scriptPubKey) if (wtx.GetDepthInMainChain() >= nMinDepth) nAmount += txout.nValue; } return ValueFromAmount(nAmount); } void GetAccountAddresses(string strAccount, set<CTxDestination>& setAddress) { BOOST_FOREACH(const PAIRTYPE(CTxDestination, string)& item, pwalletMain->mapAddressBook) { const CTxDestination& address = item.first; const string& strName = item.second; if (strName == strAccount) setAddress.insert(address); } } Value getreceivedbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getreceivedbyaccount <account> [minconf=1]\n" "Returns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations."); // Minimum confirmations int nMinDepth = 1; if (params.size() > 1) nMinDepth = params[1].get_int(); // Get the set of pub keys assigned to account string strAccount = AccountFromValue(params[0]); set<CTxDestination> setAddress; GetAccountAddresses(strAccount, setAddress); // Tally int64 nAmount = 0; for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !wtx.IsFinal()) continue; BOOST_FOREACH(const CTxOut& txout, wtx.vout) { CTxDestination address; if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*pwalletMain, address) && setAddress.count(address)) if (wtx.GetDepthInMainChain() >= nMinDepth) nAmount += txout.nValue; } } return (double)nAmount / (double)COIN; } int64 GetAccountBalance(CWalletDB& walletdb, const string& strAccount, int nMinDepth) { int64 nBalance = 0; // Tally wallet transactions for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (!wtx.IsFinal()) continue; int64 nReceived, nSent, nFee; wtx.GetAccountAmounts(strAccount, nReceived, nSent, nFee); if (nReceived != 0 && wtx.GetDepthInMainChain() >= nMinDepth) nBalance += nReceived; nBalance -= nSent + nFee; } // Tally internal accounting entries nBalance += walletdb.GetAccountCreditDebit(strAccount); return nBalance; } int64 GetAccountBalance(const string& strAccount, int nMinDepth) { CWalletDB walletdb(pwalletMain->strWalletFile); return GetAccountBalance(walletdb, strAccount, nMinDepth); } Value getbalance(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "getbalance [account] [minconf=1]\n" "If [account] is not specified, returns the server's total available balance.\n" "If [account] is specified, returns the balance in the account."); if (params.size() == 0) return ValueFromAmount(pwalletMain->GetBalance()); int nMinDepth = 1; if (params.size() > 1) nMinDepth = params[1].get_int(); if (params[0].get_str() == "*") { // Calculate total balance a different way from GetBalance() // (GetBalance() sums up all unspent TxOuts) // getbalance and getbalance '*' 0 should return the same number int64 nBalance = 0; for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (!wtx.IsConfirmed()) continue; int64 allFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; wtx.GetAmounts(listReceived, listSent, allFee, strSentAccount); if (wtx.GetDepthInMainChain() >= nMinDepth) { BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listReceived) nBalance += r.second; } BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listSent) nBalance -= r.second; nBalance -= allFee; } return ValueFromAmount(nBalance); } string strAccount = AccountFromValue(params[0]); int64 nBalance = GetAccountBalance(strAccount, nMinDepth); return ValueFromAmount(nBalance); } Value movecmd(const Array& params, bool fHelp) { if (fHelp || params.size() < 3 || params.size() > 5) throw runtime_error( "move <fromaccount> <toaccount> <amount> [minconf=1] [comment]\n" "Move from one account in your wallet to another."); string strFrom = AccountFromValue(params[0]); string strTo = AccountFromValue(params[1]); int64 nAmount = AmountFromValue(params[2]); if (params.size() > 3) // unused parameter, used to be nMinDepth, keep type-checking it though (void)params[3].get_int(); string strComment; if (params.size() > 4) strComment = params[4].get_str(); CWalletDB walletdb(pwalletMain->strWalletFile); if (!walletdb.TxnBegin()) throw JSONRPCError(RPC_DATABASE_ERROR, "database error"); int64 nNow = GetAdjustedTime(); // Debit CAccountingEntry debit; debit.nOrderPos = pwalletMain->IncOrderPosNext(&walletdb); debit.strAccount = strFrom; debit.nCreditDebit = -nAmount; debit.nTime = nNow; debit.strOtherAccount = strTo; debit.strComment = strComment; walletdb.WriteAccountingEntry(debit); // Credit CAccountingEntry credit; credit.nOrderPos = pwalletMain->IncOrderPosNext(&walletdb); credit.strAccount = strTo; credit.nCreditDebit = nAmount; credit.nTime = nNow; credit.strOtherAccount = strFrom; credit.strComment = strComment; walletdb.WriteAccountingEntry(credit); if (!walletdb.TxnCommit()) throw JSONRPCError(RPC_DATABASE_ERROR, "database error"); return true; } Value sendfrom(const Array& params, bool fHelp) { if (fHelp || params.size() < 3 || params.size() > 6) throw runtime_error( "sendfrom <fromaccount> <tolastcoinaddress> <amount> [minconf=1] [comment] [comment-to]\n" "<amount> is a real and is rounded to the nearest 0.00000001" + HelpRequiringPassphrase()); string strAccount = AccountFromValue(params[0]); CBitcoinAddress address(params[1].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid lastcoin address"); int64 nAmount = AmountFromValue(params[2]); int nMinDepth = 1; if (params.size() > 3) nMinDepth = params[3].get_int(); CWalletTx wtx; wtx.strFromAccount = strAccount; if (params.size() > 4 && params[4].type() != null_type && !params[4].get_str().empty()) wtx.mapValue["comment"] = params[4].get_str(); if (params.size() > 5 && params[5].type() != null_type && !params[5].get_str().empty()) wtx.mapValue["to"] = params[5].get_str(); EnsureWalletIsUnlocked(); // Check funds int64 nBalance = GetAccountBalance(strAccount, nMinDepth); if (nAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); // Send string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx); if (strError != "") throw JSONRPCError(RPC_WALLET_ERROR, strError); return wtx.GetHash().GetHex(); } Value sendmany(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 4) throw runtime_error( "sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]\n" "amounts are double-precision floating point numbers" + HelpRequiringPassphrase()); string strAccount = AccountFromValue(params[0]); Object sendTo = params[1].get_obj(); int nMinDepth = 1; if (params.size() > 2) nMinDepth = params[2].get_int(); CWalletTx wtx; wtx.strFromAccount = strAccount; if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty()) wtx.mapValue["comment"] = params[3].get_str(); set<CBitcoinAddress> setAddress; vector<pair<CScript, int64> > vecSend; int64 totalAmount = 0; BOOST_FOREACH(const Pair& s, sendTo) { CBitcoinAddress address(s.name_); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid lastcoin address: ")+s.name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); setAddress.insert(address); CScript scriptPubKey; scriptPubKey.SetDestination(address.Get()); int64 nAmount = AmountFromValue(s.value_); totalAmount += nAmount; vecSend.push_back(make_pair(scriptPubKey, nAmount)); } EnsureWalletIsUnlocked(); // Check funds int64 nBalance = GetAccountBalance(strAccount, nMinDepth); if (totalAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); // Send CReserveKey keyChange(pwalletMain); int64 nFeeRequired = 0; string strFailReason; bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, strFailReason); if (!fCreated) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); if (!pwalletMain->CommitTransaction(wtx, keyChange)) throw JSONRPCError(RPC_WALLET_ERROR, "Transaction commit failed"); return wtx.GetHash().GetHex(); } // // Used by addmultisigaddress / createmultisig: // static CScript _createmultisig(const Array& params) { int nRequired = params[0].get_int(); const Array& keys = params[1].get_array(); // Gather public keys if (nRequired < 1) throw runtime_error("a multisignature address must require at least one key to redeem"); if ((int)keys.size() < nRequired) throw runtime_error( strprintf("not enough keys supplied " "(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired)); std::vector<CPubKey> pubkeys; pubkeys.resize(keys.size()); for (unsigned int i = 0; i < keys.size(); i++) { const std::string& ks = keys[i].get_str(); // Case 1: lastcoin address and we have full public key: CBitcoinAddress address(ks); if (pwalletMain && address.IsValid()) { CKeyID keyID; if (!address.GetKeyID(keyID)) throw runtime_error( strprintf("%s does not refer to a key",ks.c_str())); CPubKey vchPubKey; if (!pwalletMain->GetPubKey(keyID, vchPubKey)) throw runtime_error( strprintf("no full public key for address %s",ks.c_str())); if (!vchPubKey.IsFullyValid()) throw runtime_error(" Invalid public key: "+ks); pubkeys[i] = vchPubKey; } // Case 2: hex public key else if (IsHex(ks)) { CPubKey vchPubKey(ParseHex(ks)); if (!vchPubKey.IsFullyValid()) throw runtime_error(" Invalid public key: "+ks); pubkeys[i] = vchPubKey; } else { throw runtime_error(" Invalid public key: "+ks); } } CScript result; result.SetMultisig(nRequired, pubkeys); return result; } Value addmultisigaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 3) { string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n" "Add a nrequired-to-sign multisignature address to the wallet\"\n" "each key is a lastcoin address or hex-encoded public key\n" "If [account] is specified, assign address to [account]."; throw runtime_error(msg); } string strAccount; if (params.size() > 2) strAccount = AccountFromValue(params[2]); // Construct using pay-to-script-hash: CScript inner = _createmultisig(params); CScriptID innerID = inner.GetID(); pwalletMain->AddCScript(inner); pwalletMain->SetAddressBookName(innerID, strAccount); return CBitcoinAddress(innerID).ToString(); } Value createmultisig(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 2) { string msg = "createmultisig <nrequired> <'[\"key\",\"key\"]'>\n" "Creates a multi-signature address and returns a json object\n" "with keys:\n" "address : lastcoin address\n" "redeemScript : hex-encoded redemption script"; throw runtime_error(msg); } // Construct using pay-to-script-hash: CScript inner = _createmultisig(params); CScriptID innerID = inner.GetID(); CBitcoinAddress address(innerID); Object result; result.push_back(Pair("address", address.ToString())); result.push_back(Pair("redeemScript", HexStr(inner.begin(), inner.end()))); return result; } struct tallyitem { int64 nAmount; int nConf; vector<uint256> txids; tallyitem() { nAmount = 0; nConf = std::numeric_limits<int>::max(); } }; Value ListReceived(const Array& params, bool fByAccounts) { // Minimum confirmations int nMinDepth = 1; if (params.size() > 0) nMinDepth = params[0].get_int(); // Whether to include empty accounts bool fIncludeEmpty = false; if (params.size() > 1) fIncludeEmpty = params[1].get_bool(); // Tally map<CBitcoinAddress, tallyitem> mapTally; for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !wtx.IsFinal()) continue; int nDepth = wtx.GetDepthInMainChain(); if (nDepth < nMinDepth) continue; BOOST_FOREACH(const CTxOut& txout, wtx.vout) { CTxDestination address; if (!ExtractDestination(txout.scriptPubKey, address) || !IsMine(*pwalletMain, address)) continue; tallyitem& item = mapTally[address]; item.nAmount += txout.nValue; item.nConf = min(item.nConf, nDepth); item.txids.push_back(wtx.GetHash()); } } // Reply Array ret; map<string, tallyitem> mapAccountTally; BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, string)& item, pwalletMain->mapAddressBook) { const CBitcoinAddress& address = item.first; const string& strAccount = item.second; map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address); if (it == mapTally.end() && !fIncludeEmpty) continue; int64 nAmount = 0; int nConf = std::numeric_limits<int>::max(); if (it != mapTally.end()) { nAmount = (*it).second.nAmount; nConf = (*it).second.nConf; } if (fByAccounts) { tallyitem& item = mapAccountTally[strAccount]; item.nAmount += nAmount; item.nConf = min(item.nConf, nConf); } else { Object obj; obj.push_back(Pair("address", address.ToString())); obj.push_back(Pair("account", strAccount)); obj.push_back(Pair("amount", ValueFromAmount(nAmount))); obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); Array transactions; if (it != mapTally.end()) { BOOST_FOREACH(const uint256& item, (*it).second.txids) { transactions.push_back(item.GetHex()); } } obj.push_back(Pair("txids", transactions)); ret.push_back(obj); } } if (fByAccounts) { for (map<string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it) { int64 nAmount = (*it).second.nAmount; int nConf = (*it).second.nConf; Object obj; obj.push_back(Pair("account", (*it).first)); obj.push_back(Pair("amount", ValueFromAmount(nAmount))); obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); ret.push_back(obj); } } return ret; } Value listreceivedbyaddress(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "listreceivedbyaddress [minconf=1] [includeempty=false]\n" "[minconf] is the minimum number of confirmations before payments are included.\n" "[includeempty] whether to include addresses that haven't received any payments.\n" "Returns an array of objects containing:\n" " \"address\" : receiving address\n" " \"account\" : the account of the receiving address\n" " \"amount\" : total amount received by the address\n" " \"confirmations\" : number of confirmations of the most recent transaction included\n" " \"txids\" : list of transactions with outputs to the address\n"); return ListReceived(params, false); } Value listreceivedbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "listreceivedbyaccount [minconf=1] [includeempty=false]\n" "[minconf] is the minimum number of confirmations before payments are included.\n" "[includeempty] whether to include accounts that haven't received any payments.\n" "Returns an array of objects containing:\n" " \"account\" : the account of the receiving addresses\n" " \"amount\" : total amount received by addresses with this account\n" " \"confirmations\" : number of confirmations of the most recent transaction included"); return ListReceived(params, true); } void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, Array& ret) { int64 nFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount); bool fAllAccounts = (strAccount == string("*")); // Sent if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount)) { BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent) { Object entry; entry.push_back(Pair("account", strSentAccount)); entry.push_back(Pair("address", CBitcoinAddress(s.first).ToString())); entry.push_back(Pair("category", "send")); entry.push_back(Pair("amount", ValueFromAmount(-s.second))); entry.push_back(Pair("fee", ValueFromAmount(-nFee))); if (fLong) WalletTxToJSON(wtx, entry); ret.push_back(entry); } } // Received if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth) { BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& r, listReceived) { string account; if (pwalletMain->mapAddressBook.count(r.first)) account = pwalletMain->mapAddressBook[r.first]; if (fAllAccounts || (account == strAccount)) { Object entry; entry.push_back(Pair("account", account)); entry.push_back(Pair("address", CBitcoinAddress(r.first).ToString())); if (wtx.IsCoinBase()) { if (wtx.GetDepthInMainChain() < 1) entry.push_back(Pair("category", "orphan")); else if (wtx.GetBlocksToMaturity() > 0) entry.push_back(Pair("category", "immature")); else entry.push_back(Pair("category", "generate")); } else entry.push_back(Pair("category", "receive")); entry.push_back(Pair("amount", ValueFromAmount(r.second))); if (fLong) WalletTxToJSON(wtx, entry); ret.push_back(entry); } } } } void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Array& ret) { bool fAllAccounts = (strAccount == string("*")); if (fAllAccounts || acentry.strAccount == strAccount) { Object entry; entry.push_back(Pair("account", acentry.strAccount)); entry.push_back(Pair("category", "move")); entry.push_back(Pair("time", (boost::int64_t)acentry.nTime)); entry.push_back(Pair("amount", ValueFromAmount(acentry.nCreditDebit))); entry.push_back(Pair("otheraccount", acentry.strOtherAccount)); entry.push_back(Pair("comment", acentry.strComment)); ret.push_back(entry); } } Value listtransactions(const Array& params, bool fHelp) { if (fHelp || params.size() > 3) throw runtime_error( "listtransactions [account] [count=10] [from=0]\n" "Returns up to [count] most recent transactions skipping the first [from] transactions for account [account]."); string strAccount = "*"; if (params.size() > 0) strAccount = params[0].get_str(); int nCount = 10; if (params.size() > 1) nCount = params[1].get_int(); int nFrom = 0; if (params.size() > 2) nFrom = params[2].get_int(); if (nCount < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative count"); if (nFrom < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative from"); Array ret; std::list<CAccountingEntry> acentries; CWallet::TxItems txOrdered = pwalletMain->OrderedTxItems(acentries, strAccount); // iterate backwards until we have nCount items to return: for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { CWalletTx *const pwtx = (*it).second.first; if (pwtx != 0) ListTransactions(*pwtx, strAccount, 0, true, ret); CAccountingEntry *const pacentry = (*it).second.second; if (pacentry != 0) AcentryToJSON(*pacentry, strAccount, ret); if ((int)ret.size() >= (nCount+nFrom)) break; } // ret is newest to oldest if (nFrom > (int)ret.size()) nFrom = ret.size(); if ((nFrom + nCount) > (int)ret.size()) nCount = ret.size() - nFrom; Array::iterator first = ret.begin(); std::advance(first, nFrom); Array::iterator last = ret.begin(); std::advance(last, nFrom+nCount); if (last != ret.end()) ret.erase(last, ret.end()); if (first != ret.begin()) ret.erase(ret.begin(), first); std::reverse(ret.begin(), ret.end()); // Return oldest to newest return ret; } Value listaccounts(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "listaccounts [minconf=1]\n" "Returns Object that has account names as keys, account balances as values."); int nMinDepth = 1; if (params.size() > 0) nMinDepth = params[0].get_int(); map<string, int64> mapAccountBalances; BOOST_FOREACH(const PAIRTYPE(CTxDestination, string)& entry, pwalletMain->mapAddressBook) { if (IsMine(*pwalletMain, entry.first)) // This address belongs to me mapAccountBalances[entry.second] = 0; } for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; int64 nFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount); mapAccountBalances[strSentAccount] -= nFee; BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent) mapAccountBalances[strSentAccount] -= s.second; if (wtx.GetDepthInMainChain() >= nMinDepth) { BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& r, listReceived) if (pwalletMain->mapAddressBook.count(r.first)) mapAccountBalances[pwalletMain->mapAddressBook[r.first]] += r.second; else mapAccountBalances[""] += r.second; } } list<CAccountingEntry> acentries; CWalletDB(pwalletMain->strWalletFile).ListAccountCreditDebit("*", acentries); BOOST_FOREACH(const CAccountingEntry& entry, acentries) mapAccountBalances[entry.strAccount] += entry.nCreditDebit; Object ret; BOOST_FOREACH(const PAIRTYPE(string, int64)& accountBalance, mapAccountBalances) { ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); } return ret; } Value listsinceblock(const Array& params, bool fHelp) { if (fHelp) throw runtime_error( "listsinceblock [blockhash] [target-confirmations]\n" "Get all transactions in blocks since block [blockhash], or all transactions if omitted"); CBlockIndex *pindex = NULL; int target_confirms = 1; if (params.size() > 0) { uint256 blockId = 0; blockId.SetHex(params[0].get_str()); pindex = CBlockLocator(blockId).GetBlockIndex(); } if (params.size() > 1) { target_confirms = params[1].get_int(); if (target_confirms < 1) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter"); } int depth = pindex ? (1 + nBestHeight - pindex->nHeight) : -1; Array transactions; for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); it++) { CWalletTx tx = (*it).second; if (depth == -1 || tx.GetDepthInMainChain() < depth) ListTransactions(tx, "*", 0, true, transactions); } uint256 lastblock; if (target_confirms == 1) { lastblock = hashBestChain; } else { int target_height = pindexBest->nHeight + 1 - target_confirms; CBlockIndex *block; for (block = pindexBest; block && block->nHeight > target_height; block = block->pprev) { } lastblock = block ? block->GetBlockHash() : 0; } Object ret; ret.push_back(Pair("transactions", transactions)); ret.push_back(Pair("lastblock", lastblock.GetHex())); return ret; } Value gettransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "gettransaction <txid>\n" "Get detailed information about in-wallet transaction <txid>"); uint256 hash; hash.SetHex(params[0].get_str()); Object entry; if (!pwalletMain->mapWallet.count(hash)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet transaction id"); const CWalletTx& wtx = pwalletMain->mapWallet[hash]; int64 nCredit = wtx.GetCredit(); int64 nDebit = wtx.GetDebit(); int64 nNet = nCredit - nDebit; int64 nFee = (wtx.IsFromMe() ? wtx.GetValueOut() - nDebit : 0); entry.push_back(Pair("amount", ValueFromAmount(nNet - nFee))); if (wtx.IsFromMe()) entry.push_back(Pair("fee", ValueFromAmount(nFee))); WalletTxToJSON(wtx, entry); Array details; ListTransactions(wtx, "*", 0, false, details); entry.push_back(Pair("details", details)); return entry; } Value backupwallet(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "backupwallet <destination>\n" "Safely copies wallet.dat to destination, which can be a directory or a path with filename."); string strDest = params[0].get_str(); if (!BackupWallet(*pwalletMain, strDest)) throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!"); return Value::null; } Value keypoolrefill(const Array& params, bool fHelp) { if (fHelp || params.size() > 0) throw runtime_error( "keypoolrefill\n" "Fills the keypool." + HelpRequiringPassphrase()); EnsureWalletIsUnlocked(); pwalletMain->TopUpKeyPool(); if (pwalletMain->GetKeyPoolSize() < GetArg("-keypool", 100)) throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool."); return Value::null; } void ThreadTopUpKeyPool(void* parg) { // Make this thread recognisable as the key-topping-up thread RenameThread("bitcoin-key-top"); pwalletMain->TopUpKeyPool(); } void ThreadCleanWalletPassphrase(void* parg) { // Make this thread recognisable as the wallet relocking thread RenameThread("bitcoin-lock-wa"); int64 nMyWakeTime = GetTimeMillis() + *((int64*)parg) * 1000; ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); if (nWalletUnlockTime == 0) { nWalletUnlockTime = nMyWakeTime; do { if (nWalletUnlockTime==0) break; int64 nToSleep = nWalletUnlockTime - GetTimeMillis(); if (nToSleep <= 0) break; LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime); MilliSleep(nToSleep); ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); } while(1); if (nWalletUnlockTime) { nWalletUnlockTime = 0; pwalletMain->Lock(); } } else { if (nWalletUnlockTime < nMyWakeTime) nWalletUnlockTime = nMyWakeTime; } LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime); delete (int64*)parg; } Value walletpassphrase(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2)) throw runtime_error( "walletpassphrase <passphrase> <timeout>\n" "Stores the wallet decryption key in memory for <timeout> seconds."); if (fHelp) return true; if (!pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrase was called."); if (!pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_ALREADY_UNLOCKED, "Error: Wallet is already unlocked."); // Note that the walletpassphrase is stored in params[0] which is not mlock()ed SecureString strWalletPass; strWalletPass.reserve(100); // TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string) // Alternately, find a way to make params[0] mlock()'d to begin with. strWalletPass = params[0].get_str().c_str(); if (strWalletPass.length() > 0) { if (!pwalletMain->Unlock(strWalletPass)) throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect."); } else throw runtime_error( "walletpassphrase <passphrase> <timeout>\n" "Stores the wallet decryption key in memory for <timeout> seconds."); NewThread(ThreadTopUpKeyPool, NULL); int64* pnSleepTime = new int64(params[1].get_int64()); NewThread(ThreadCleanWalletPassphrase, pnSleepTime); return Value::null; } Value walletpassphrasechange(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2)) throw runtime_error( "walletpassphrasechange <oldpassphrase> <newpassphrase>\n" "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>."); if (fHelp) return true; if (!pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrasechange was called."); // TODO: get rid of these .c_str() calls by implementing SecureString::operator=(std::string) // Alternately, find a way to make params[0] mlock()'d to begin with. SecureString strOldWalletPass; strOldWalletPass.reserve(100); strOldWalletPass = params[0].get_str().c_str(); SecureString strNewWalletPass; strNewWalletPass.reserve(100); strNewWalletPass = params[1].get_str().c_str(); if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1) throw runtime_error( "walletpassphrasechange <oldpassphrase> <newpassphrase>\n" "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>."); if (!pwalletMain->ChangeWalletPassphrase(strOldWalletPass, strNewWalletPass)) throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect."); return Value::null; } Value walletlock(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() != 0)) throw runtime_error( "walletlock\n" "Removes the wallet encryption key from memory, locking the wallet.\n" "After calling this method, you will need to call walletpassphrase again\n" "before being able to call any methods which require the wallet to be unlocked."); if (fHelp) return true; if (!pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletlock was called."); { LOCK(cs_nWalletUnlockTime); pwalletMain->Lock(); nWalletUnlockTime = 0; } return Value::null; } Value encryptwallet(const Array& params, bool fHelp) { if (!pwalletMain->IsCrypted() && (fHelp || params.size() != 1)) throw runtime_error( "encryptwallet <passphrase>\n" "Encrypts the wallet with <passphrase>."); if (fHelp) return true; if (pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called."); // TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string) // Alternately, find a way to make params[0] mlock()'d to begin with. SecureString strWalletPass; strWalletPass.reserve(100); strWalletPass = params[0].get_str().c_str(); if (strWalletPass.length() < 1) throw runtime_error( "encryptwallet <passphrase>\n" "Encrypts the wallet with <passphrase>."); if (!pwalletMain->EncryptWallet(strWalletPass)) throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet."); // BDB seems to have a bad habit of writing old data into // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: StartShutdown(); return "wallet encrypted; lastcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; } class DescribeAddressVisitor : public boost::static_visitor<Object> { public: Object operator()(const CNoDestination &dest) const { return Object(); } Object operator()(const CKeyID &keyID) const { Object obj; CPubKey vchPubKey; pwalletMain->GetPubKey(keyID, vchPubKey); obj.push_back(Pair("isscript", false)); obj.push_back(Pair("pubkey", HexStr(vchPubKey))); obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed())); return obj; } Object operator()(const CScriptID &scriptID) const { Object obj; obj.push_back(Pair("isscript", true)); CScript subscript; pwalletMain->GetCScript(scriptID, subscript); std::vector<CTxDestination> addresses; txnouttype whichType; int nRequired; ExtractDestinations(subscript, whichType, addresses, nRequired); obj.push_back(Pair("script", GetTxnOutputType(whichType))); Array a; BOOST_FOREACH(const CTxDestination& addr, addresses) a.push_back(CBitcoinAddress(addr).ToString()); obj.push_back(Pair("addresses", a)); if (whichType == TX_MULTISIG) obj.push_back(Pair("sigsrequired", nRequired)); return obj; } }; Value validateaddress(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "validateaddress <lastcoinaddress>\n" "Return information about <lastcoinaddress>."); CBitcoinAddress address(params[0].get_str()); bool isValid = address.IsValid(); Object ret; ret.push_back(Pair("isvalid", isValid)); if (isValid) { CTxDestination dest = address.Get(); string currentAddress = address.ToString(); ret.push_back(Pair("address", currentAddress)); bool fMine = pwalletMain ? IsMine(*pwalletMain, dest) : false; ret.push_back(Pair("ismine", fMine)); if (fMine) { Object detail = boost::apply_visitor(DescribeAddressVisitor(), dest); ret.insert(ret.end(), detail.begin(), detail.end()); } if (pwalletMain && pwalletMain->mapAddressBook.count(dest)) ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest])); } return ret; } Value lockunspent(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "lockunspent unlock? [array-of-Objects]\n" "Updates list of temporarily unspendable outputs."); if (params.size() == 1) RPCTypeCheck(params, list_of(bool_type)); else RPCTypeCheck(params, list_of(bool_type)(array_type)); bool fUnlock = params[0].get_bool(); if (params.size() == 1) { if (fUnlock) pwalletMain->UnlockAllCoins(); return true; } Array outputs = params[1].get_array(); BOOST_FOREACH(Value& output, outputs) { if (output.type() != obj_type) throw JSONRPCError(-8, "Invalid parameter, expected object"); const Object& o = output.get_obj(); RPCTypeCheck(o, map_list_of("txid", str_type)("vout", int_type)); string txid = find_value(o, "txid").get_str(); if (!IsHex(txid)) throw JSONRPCError(-8, "Invalid parameter, expected hex txid"); int nOutput = find_value(o, "vout").get_int(); if (nOutput < 0) throw JSONRPCError(-8, "Invalid parameter, vout must be positive"); COutPoint outpt(uint256(txid), nOutput); if (fUnlock) pwalletMain->UnlockCoin(outpt); else pwalletMain->LockCoin(outpt); } return true; } Value listlockunspent(const Array& params, bool fHelp) { if (fHelp || params.size() > 0) throw runtime_error( "listlockunspent\n" "Returns list of temporarily unspendable outputs."); vector<COutPoint> vOutpts; pwalletMain->ListLockedCoins(vOutpts); Array ret; BOOST_FOREACH(COutPoint &outpt, vOutpts) { Object o; o.push_back(Pair("txid", outpt.hash.GetHex())); o.push_back(Pair("vout", (int)outpt.n)); ret.push_back(o); } return ret; }
[ "lastcoinproject@gmail.com" ]
lastcoinproject@gmail.com
4be271f4cc8a04ecc82248cc7b0dd33bec315100
8f6d35c5c3f5bf77991f3f66554d88fa7fcdc9cd
/Mayflower/MayflowerWindow.h
2764d4634f08e672f66635a779ab6f1959590d66
[]
no_license
AndrewReisdorph/Mayflower-Gameboy-Emulator
6730107ab66ed4ba70a29fda1fa396b29f4d5168
1fcad1d0817017015a18407cae91ab0b60a39430
refs/heads/master
2018-08-25T10:02:22.292007
2018-07-03T06:04:20
2018-07-03T06:04:20
103,408,029
0
0
null
null
null
null
UTF-8
C++
false
false
1,166
h
#pragma once #include <wx/wx.h> #include "MemoryViewListCtrl.h" #include "EmulatorEngine.h" #include "GameboyScreenPanel.h" #include "RamAssemblyList.h" #include "RegisterView.h" #include "MemoryViewListCtrl.h" #include "DebugToolbar.h" #include "IOMap.h" class GameboyScreenPanel; class EmulatorEngine; class RamAssemblyList; class RegisterView; class MemoryViewListCtrl; class DebugToolbar; class IOMap; class MayflowerWindow : public wxFrame { private: wxMenuBar *m_MenuBar; wxMenu *m_FileMenu; wxMenu *m_HelpMenu; wxMenu *m_DebugMenu; wxMenu *m_WindowMenu; EmulatorEngine *m_Emulator; GameboyScreenPanel *m_ScreenPanel; RamAssemblyList *m_RamAssemblyList; MemoryViewListCtrl *m_MemoryViewListCtrl; RegisterView *m_RegisterView; DebugToolbar *m_DebugControl; IOMap *m_IOMapWindow; void InitUI(); void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event); public: void OpenSaveState(); void ShowIOMap(); void RefreshGameboyScreen(); void RefreshScreenPanel(); MayflowerWindow(); ~MayflowerWindow(); void OpenROM(wxCommandEvent& event); void OnCloseWindow(wxCloseEvent& event); void RefreshDebugger(); DECLARE_EVENT_TABLE() };
[ "AndrewReisdorph@gmail.com" ]
AndrewReisdorph@gmail.com
27099c58e02b53f0ebdbe3053278e6be3cc25fa8
161fa261303342543f22a9dfe007ce0dab662606
/devel/include/move_base_msgs/MoveBaseActionGoal.h
1767e0d2a652d59c9cf017ca6b4063056e90b702
[]
no_license
HaoYejia/MyCar
81fac51ccecfcd5b86dbabbc63d33053c1632618
b7b20e6cafeb6a7312e876ff9ad59f72118e364e
refs/heads/master
2020-06-24T01:11:36.119110
2019-07-25T10:02:12
2019-07-25T10:02:12
198,803,669
0
0
null
null
null
null
UTF-8
C++
false
false
8,703
h
// Generated by gencpp from file move_base_msgs/MoveBaseActionGoal.msg // DO NOT EDIT! #ifndef MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONGOAL_H #define MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONGOAL_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> #include <std_msgs/Header.h> #include <actionlib_msgs/GoalID.h> #include <move_base_msgs/MoveBaseGoal.h> namespace move_base_msgs { template <class ContainerAllocator> struct MoveBaseActionGoal_ { typedef MoveBaseActionGoal_<ContainerAllocator> Type; MoveBaseActionGoal_() : header() , goal_id() , goal() { } MoveBaseActionGoal_(const ContainerAllocator& _alloc) : header(_alloc) , goal_id(_alloc) , goal(_alloc) { (void)_alloc; } typedef ::std_msgs::Header_<ContainerAllocator> _header_type; _header_type header; typedef ::actionlib_msgs::GoalID_<ContainerAllocator> _goal_id_type; _goal_id_type goal_id; typedef ::move_base_msgs::MoveBaseGoal_<ContainerAllocator> _goal_type; _goal_type goal; typedef boost::shared_ptr< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> const> ConstPtr; }; // struct MoveBaseActionGoal_ typedef ::move_base_msgs::MoveBaseActionGoal_<std::allocator<void> > MoveBaseActionGoal; typedef boost::shared_ptr< ::move_base_msgs::MoveBaseActionGoal > MoveBaseActionGoalPtr; typedef boost::shared_ptr< ::move_base_msgs::MoveBaseActionGoal const> MoveBaseActionGoalConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> & v) { ros::message_operations::Printer< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace move_base_msgs namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True} // {'move_base_msgs': ['/home/tianbot/tianbot_ws/devel/share/move_base_msgs/msg'], 'std_msgs': ['/opt/ros/melodic/share/std_msgs/cmake/../msg'], 'actionlib_msgs': ['/opt/ros/melodic/share/actionlib_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/melodic/share/geometry_msgs/cmake/../msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct IsFixedSize< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> const> : FalseType { }; template <class ContainerAllocator> struct IsMessage< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> const> : TrueType { }; template<class ContainerAllocator> struct MD5Sum< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > { static const char* value() { return "660d6895a1b9a16dce51fbdd9a64a56b"; } static const char* value(const ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x660d6895a1b9a16dULL; static const uint64_t static_value2 = 0xce51fbdd9a64a56bULL; }; template<class ContainerAllocator> struct DataType< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > { static const char* value() { return "move_base_msgs/MoveBaseActionGoal"; } static const char* value(const ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > { static const char* value() { return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" "\n" "Header header\n" "actionlib_msgs/GoalID goal_id\n" "MoveBaseGoal goal\n" "\n" "================================================================================\n" "MSG: std_msgs/Header\n" "# Standard metadata for higher-level stamped data types.\n" "# This is generally used to communicate timestamped data \n" "# in a particular coordinate frame.\n" "# \n" "# sequence ID: consecutively increasing ID \n" "uint32 seq\n" "#Two-integer timestamp that is expressed as:\n" "# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n" "# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n" "# time-handling sugar is provided by the client library\n" "time stamp\n" "#Frame this data is associated with\n" "string frame_id\n" "\n" "================================================================================\n" "MSG: actionlib_msgs/GoalID\n" "# The stamp should store the time at which this goal was requested.\n" "# It is used by an action server when it tries to preempt all\n" "# goals that were requested before a certain time\n" "time stamp\n" "\n" "# The id provides a way to associate feedback and\n" "# result message with specific goal requests. The id\n" "# specified must be unique.\n" "string id\n" "\n" "\n" "================================================================================\n" "MSG: move_base_msgs/MoveBaseGoal\n" "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" "geometry_msgs/PoseStamped target_pose\n" "\n" "================================================================================\n" "MSG: geometry_msgs/PoseStamped\n" "# A Pose with reference coordinate frame and timestamp\n" "Header header\n" "Pose pose\n" "\n" "================================================================================\n" "MSG: geometry_msgs/Pose\n" "# A representation of pose in free space, composed of position and orientation. \n" "Point position\n" "Quaternion orientation\n" "\n" "================================================================================\n" "MSG: geometry_msgs/Point\n" "# This contains the position of a point in free space\n" "float64 x\n" "float64 y\n" "float64 z\n" "\n" "================================================================================\n" "MSG: geometry_msgs/Quaternion\n" "# This represents an orientation in free space in quaternion form.\n" "\n" "float64 x\n" "float64 y\n" "float64 z\n" "float64 w\n" ; } static const char* value(const ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.header); stream.next(m.goal_id); stream.next(m.goal); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct MoveBaseActionGoal_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::move_base_msgs::MoveBaseActionGoal_<ContainerAllocator>& v) { s << indent << "header: "; s << std::endl; Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header); s << indent << "goal_id: "; s << std::endl; Printer< ::actionlib_msgs::GoalID_<ContainerAllocator> >::stream(s, indent + " ", v.goal_id); s << indent << "goal: "; s << std::endl; Printer< ::move_base_msgs::MoveBaseGoal_<ContainerAllocator> >::stream(s, indent + " ", v.goal); } }; } // namespace message_operations } // namespace ros #endif // MOVE_BASE_MSGS_MESSAGE_MOVEBASEACTIONGOAL_H
[ "haoyejia@outlook.com" ]
haoyejia@outlook.com
0b62d72d293184a1934f3b2992f69410093d4aad
73ee941896043f9b3e2ab40028d24ddd202f695f
/external/chromium_org/ash/system/date/date_view.h
98bc45fb7bb026ab17a4d127a7fed12d8fd2c2ca
[ "BSD-3-Clause" ]
permissive
CyFI-Lab-Public/RetroScope
d441ea28b33aceeb9888c330a54b033cd7d48b05
276b5b03d63f49235db74f2c501057abb9e79d89
refs/heads/master
2022-04-08T23:11:44.482107
2016-09-22T20:15:43
2016-09-22T20:15:43
58,890,600
5
3
null
null
null
null
UTF-8
C++
false
false
3,814
h
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_SYSTEM_DATE_DATE_VIEW_H_ #define ASH_SYSTEM_DATE_DATE_VIEW_H_ #include "ash/system/date/tray_date.h" #include "ash/system/tray/actionable_view.h" #include "base/i18n/time_formatting.h" #include "base/timer/timer.h" #include "ui/views/view.h" namespace views { class Label; } namespace ash { namespace internal { namespace tray { // Abstract base class containing common updating and layout code for the // DateView popup and the TimeView tray icon. class BaseDateTimeView : public ActionableView { public: virtual ~BaseDateTimeView(); // Updates the displayed text for the current time and calls SetTimer(). void UpdateText(); protected: BaseDateTimeView(); private: // Starts |timer_| to schedule the next update. void SetTimer(const base::Time& now); // Updates labels to display the current time. virtual void UpdateTextInternal(const base::Time& now) = 0; // Overridden from views::View. virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; virtual void OnLocaleChanged() OVERRIDE; // Invokes UpdateText() when the displayed time should change. base::OneShotTimer<BaseDateTimeView> timer_; DISALLOW_COPY_AND_ASSIGN(BaseDateTimeView); }; // Popup view used to display the date and day of week. class DateView : public BaseDateTimeView { public: DateView(); virtual ~DateView(); // Sets whether the view is actionable. An actionable date view gives visual // feedback on hover, can be focused by keyboard, and clicking/pressing space // or enter on the view shows date-related settings. void SetActionable(bool actionable); private: // Overridden from BaseDateTimeView. virtual void UpdateTextInternal(const base::Time& now) OVERRIDE; // Overridden from ActionableView. virtual bool PerformAction(const ui::Event& event) OVERRIDE; // Overridden from views::View. virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; views::Label* date_label_; bool actionable_; DISALLOW_COPY_AND_ASSIGN(DateView); }; // Tray view used to display the current time. class TimeView : public BaseDateTimeView { public: TimeView(TrayDate::ClockLayout clock_layout); virtual ~TimeView(); views::Label* label() const { return label_.get(); } views::Label* label_hour_left() const { return label_hour_left_.get(); } views::Label* label_hour_right() const { return label_hour_right_.get(); } views::Label* label_minute_left() const { return label_minute_left_.get(); } views::Label* label_minute_right() const { return label_minute_right_.get(); } // Updates the format of the displayed time. void UpdateTimeFormat(); // Updates clock layout. void UpdateClockLayout(TrayDate::ClockLayout clock_layout); private: // Overridden from BaseDateTimeView. virtual void UpdateTextInternal(const base::Time& now) OVERRIDE; // Overridden from ActionableView. virtual bool PerformAction(const ui::Event& event) OVERRIDE; // Overridden from views::View. virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; void SetBorder(TrayDate::ClockLayout clock_layout); void SetupLabels(); void SetupLabel(views::Label* label); scoped_ptr<views::Label> label_; scoped_ptr<views::Label> label_hour_left_; scoped_ptr<views::Label> label_hour_right_; scoped_ptr<views::Label> label_minute_left_; scoped_ptr<views::Label> label_minute_right_; base::HourClockType hour_type_; DISALLOW_COPY_AND_ASSIGN(TimeView); }; } // namespace tray } // namespace internal } // namespace ash #endif // ASH_SYSTEM_DATE_DATE_VIEW_H_
[ "ProjectRetroScope@gmail.com" ]
ProjectRetroScope@gmail.com
e04d7da716bd51ca772b7560d954357a5da37480
b45612ec940592562765f940e934897120e012ef
/EDU_codeforces/2.Segment_tree_part_1/step_1/2.Segment_tree_for_the_minimum.cpp
42b75c5bdc914301f5075785207ad921bbe907f5
[]
no_license
ShubhamAgrawal-13/CSES-Problem-Set
9697a52edce59394db6103fd4371c79fa8ccad8e
c67f4c8ab80e11602f77db8b6572dfd7c774ea32
refs/heads/master
2022-12-18T13:17:59.146810
2020-08-12T19:39:11
2020-08-12T19:39:11
272,518,178
1
0
null
null
null
null
UTF-8
C++
false
false
1,860
cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define deb(x) cout << #x << "=" << x << "\n" #define ar array #define all(v) v.begin(),v.end() #define clr(x,v) memset(x,v,sizeof(x)) class SegTree{ public: int size; vector<ll> values; void init(int n){ size=1; while(size<n) size*=2; values.assign(2*size, 0ll); } void build(vector<int> &a, int x, int lx, int rx){ if(rx-lx==1){ if(lx<(int)a.size()){ values[x]=a[lx]; } return; } int m = (lx+rx)/2; build(a,2*x+1,lx,m); build(a,2*x+2,m,rx); values[x] = min(values[2*x+1], values[2*x+2]); } void build(vector<int> &a){ build(a,0,0,size); } void set(int i, int v, int x, int lx, int rx){ if(rx-lx==1){ values[x]=v; return; } int m = (lx+rx)/2; if(i<m){ set(i, v, 2*x+1, lx, m); } else{ set(i, v, 2*x+2, m, rx); } values[x] = min(values[2*x+1], values[2*x+2]); } void set(int i, int v){ set(i,v,0,0,size); } ll calculate(int l, int r, int x, int lx, int rx){ if(lx>=r || l>=rx) return INT_MAX; // very Important if(l<=lx && rx<=r) return values[x]; int m = (lx+rx)/2; ll s1 = calculate(l, r, 2*x+1, lx, m); ll s2 = calculate(l, r, 2*x+2, m, rx); return min(s1, s2); } ll calculate(int l, int r){ return calculate(l, r, 0, 0, size); } }; void solve(){ int n,m; cin>>n>>m; vector<int> a(n, 0); for(int i=0;i<n;i++){ cin>>a[i]; } SegTree seg; seg.init(n); seg.build(a); while(m-- > 0){ int op; cin>>op; if(op==1){ //set int i, v; cin>>i>>v; seg.set(i, v); } else if(op==2){ //query calculate int l, r; cin>>l>>r; cout<<seg.calculate(l, r)<<"\n"; } } } int main(int argc, char const *argv[]){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); solve(); return 0; }
[ "shubham.agrawal@students.iiit.ac.in" ]
shubham.agrawal@students.iiit.ac.in
4b53e65f6b0c87465c93213a3bbd003ffc7222bd
6d630f23b88eb53903d493a82d302ac3ca57f65f
/codeforces/round_713_div3/b/cfmain.cpp
bf923d59131965b90be463797527ab77c2c48d89
[]
no_license
wangjiewen/algorithm_practice
dba2b1d9740792de340a91fbae41b0f7ca3039e2
80d8e7c96cff47a67ecb3522f026410e5f7be045
refs/heads/master
2022-08-17T19:58:00.568316
2022-07-18T14:04:35
2022-07-18T14:04:35
164,859,178
0
0
null
null
null
null
UTF-8
C++
false
false
811
cpp
#include <bits/stdc++.h> using namespace std; string sq[405]; void solve() { int n; int x[2] = {0}, y[2] = {0}; int num = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> sq[i]; for (int j = 0; j < n; j++) { if (sq[i][j] == '*') { x[num] = i; y[num] = j; num++; } } } int tx, ty; if (x[0] == x[1]) { tx = (x[0] + 1) % n; sq[tx][y[0]] = '*'; sq[tx][y[1]] = '*'; goto out; } if (y[0] == y[1]) { ty = (y[0] + 1) % n; sq[x[0]][ty] = '*'; sq[x[1]][ty] = '*'; goto out; } sq[x[0]][y[1]] = '*'; sq[x[1]][y[0]] = '*'; out: for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cout << sq[i][j]; } cout << endl; } } int main(void) { freopen("in", "r", stdin); int loop; scanf("%d", &loop); while (loop--) { solve(); } return 0; }
[ "issinfonia@gmail.com" ]
issinfonia@gmail.com
bfc38b26697fc43f64be8cb8f9b8a89baab055f0
910b053d9be793cc9a88279b59f305f82f5adfb6
/ObjC-Swift-Interop/ObjCConsoleProject/ObjCConsoleProject/main.hpp
63635dbfde25f55d085da416ef2674fd5293fbb6
[]
no_license
m039/XLIS
d2a108daf61ed6bd712f7d3d0f1bdeff6786d1ed
61db01b4c2e281bd141bf3ee8c2a5d74e0925aaf
refs/heads/master
2021-06-14T19:39:38.806980
2017-03-04T11:56:31
2017-03-04T11:56:31
81,931,151
9
2
null
null
null
null
UTF-8
C++
false
false
338
hpp
// // Testik.hpp // ObjCConsoleProject // // Created by Dmitry Mozgin on 18/02/2017. // Copyright © 2017 BTG. All rights reserved. // #ifndef Testik_hpp #define Testik_hpp #include <stdio.h> #ifdef __cplusplus extern "C" { #endif void testBar(); void testFoo(); #ifdef __cplusplus } #endif #endif /* Testik_hpp */
[ "m0391n@gmail.com" ]
m0391n@gmail.com
a2d7f9fea17f8fe94d174085c001a08591a604fa
61661b067743f4e7d54710402017639bba89d9e7
/Moisture/PumpControl.h
2a40c435b2160413e3f6cefbeebefd1c5fadd967
[]
no_license
nlurkin/watering
83af75f849b5f8700906161cbfda98caf97fc721
071a09226d5858c7fd2ffbf0c200749d5d37a052
refs/heads/master
2023-04-14T06:05:30.758511
2023-04-06T12:09:17
2023-04-06T12:09:17
194,562,694
1
0
null
2021-03-25T20:09:54
2019-06-30T21:24:30
C++
UTF-8
C++
false
false
2,153
h
/* * PumpControl.h * * Created on: 4 Nov 2017 * Author: Nicolas Lurkin */ #ifndef PUMPCONTROL_H_ #define PUMPCONTROL_H_ #include <Arduino.h> /** * \brief This is the class controlling the pump. * * It is simply running the pump for a defined amount of time. * A running period is always followed by a dead time during which * the pump is OFF and will not accept any order. * This is to prevent the pump from continuously running due to fault * with the sensor or empty water tank. */ class PumpControl { public: enum state {IDLE, RUNNING, DEAD}; /** enum providing the list of possible states for the pump: IDLE and RUNNING are self explanatory, DEAD means dead time */ PumpControl(uint8_t pin); virtual ~PumpControl(); void tick(); void run(bool state); void Enable() { _enable = true; } void Disable() { _enable = false; run(false); } void setPin (uint8_t pin ); void setDeadTime (unsigned int deadTime ) { _deadTime = deadTime; } void setRunningTime (unsigned int runningTime ) { _runningTime = runningTime; } void setTickInterval(unsigned int tickInterval) { _tickInterval = tickInterval; } bool isEnabled() const { return _enable; } uint8_t getPin() const { return _pin; } unsigned int getDeadTime() const { return _deadTime; } unsigned int getRunningTime() const { return _runningTime; } unsigned int getTickInterval() const { return _tickInterval; } state getStatus() const { return _on; } private: bool _enable; /** Enable/Disable pump */ uint8_t _pin; /** Digital pin on which the pump is connected */ unsigned int _deadTime; /** Length of the dead time */ unsigned int _runningTime; /** Length of the running time */ unsigned int _tickInterval; /** Length of a tick */ unsigned int _currentCounter; /** Counter of ticks */ state _on; /** Current state of the pump */ }; #endif /* PUMPCONTROL_H_ */
[ "nicolas.lurkin@cern.ch" ]
nicolas.lurkin@cern.ch
1ad359ff2fe11dc0373e3a1bbc91227c305bdaf7
ad4a16f08dfdcdd6d6f4cb476a35a8f70bfc069c
/source/bsys/wave/wave.h
8385f6092d875bfceb55381c65cdc3ff6d69b011
[ "OpenSSL", "MIT" ]
permissive
bluebackblue/brownie
fad5c4a013291e0232ab0c566bee22970d18bd58
917fcc71e5b0a807c0a8dab22a9ca7f3b0d60917
refs/heads/master
2021-01-20T04:47:08.775947
2018-11-20T19:38:42
2018-11-20T19:38:42
89,730,769
0
0
MIT
2017-12-31T13:44:33
2017-04-28T17:48:23
C++
UTF-8
C++
false
false
1,562
h
#pragma once /** * Copyright (c) blueback * Released under the MIT License * https://github.com/bluebackblue/brownie/blob/master/LICENSE.txt * http://bbbproject.sakura.ne.jp/wordpress/mitlicense * @brief WAVE。 */ /** include */ #pragma warning(push) #pragma warning(disable:4464) #include "../types/types.h" #pragma warning(pop) /** include */ #include "./wave_stream.h" #include "./wave_wav.h" #include "./wave_ogg.h" /** NBsys::NWave */ #if(BSYS_WAVE_ENABLE) namespace NBsys{namespace NWave { /** WaveType */ struct WaveType { enum Id { None = 0, Mono_8_44100, Mono_16_44100, Stereo_8_44100, Stereo_16_44100, }; }; /** Wave */ class Wave { private: /** sample */ sharedptr<u8> sample; /** sample_size */ s32 sample_size; /** wavetype */ WaveType::Id wavetype; /** name */ STLWString name; /** countof_sample */ s32 countof_sample; public: /** constructor */ Wave(const sharedptr<u8>& a_sample,s32 a_sample_size,s32 a_countof_sample,WaveType::Id a_wavetype,const STLWString& a_name); /** destructor */ nonvirtual ~Wave(); public: /** GetSample */ sharedptr<u8> GetSample(); /** GetSampleSize */ s32 GetSampleSize() const; /** GetSample */ const sharedptr<u8> GetSample() const; /** GetWaveType */ WaveType::Id GetWaveType() const; /** GetCountOfSample */ s32 GetCountOfSample() const; }; }} #endif
[ "blueback28@gmail.com" ]
blueback28@gmail.com
ac3b56965bac2eea9f1c0fc34ce32eb2a78fd140
f607fca5b5257eac90a8e615a4cee39d90a2523e
/AntiDupl.NET-2.3.9/src/3rd/tinyxml/tinyxml.h
d0f1ea5b7817738d733de1ab57b03250859c7ba0
[]
no_license
fengxing666/CV_Resource
65d63e323dabf046d113734b121ed8e508f6afec
ca7277da68a71bbfc240028c0375799d4d867e96
refs/heads/main
2023-09-03T18:00:43.457819
2021-10-17T14:14:53
2021-10-17T14:14:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
66,663
h
/* www.sourceforge.net/projects/tinyxml Original code by Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef TINYXML_INCLUDED #define TINYXML_INCLUDED #ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 4530 ) #pragma warning( disable : 4786 ) #endif #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> // Help out windows: #if defined( _DEBUG ) && !defined( DEBUG ) #define DEBUG #endif #ifdef TIXML_USE_STL #include <string> #include <iostream> #include <sstream> #define TIXML_STRING std::string #else #include "tinystr.h" #define TIXML_STRING TiXmlString #endif // Deprecated library function hell. Compilers want to use the // new safe versions. This probably doesn't fully address the problem, // but it gets closer. There are too many compilers for me to fully // test. If you get compilation troubles, undefine TIXML_SAFE #define TIXML_SAFE #ifdef TIXML_SAFE #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) // Microsoft visual studio, version 2005 and higher. #define TIXML_SNPRINTF _snprintf_s #define TIXML_SSCANF sscanf_s #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) // Microsoft visual studio, version 6 and higher. //#pragma message( "Using _sn* functions." ) #define TIXML_SNPRINTF _snprintf #define TIXML_SSCANF sscanf #elif defined(__GNUC__) && (__GNUC__ >= 3 ) // GCC version 3 and higher.s //#warning( "Using sn* functions." ) #define TIXML_SNPRINTF snprintf #define TIXML_SSCANF sscanf #else #define TIXML_SNPRINTF snprintf #define TIXML_SSCANF sscanf #endif #endif class TiXmlDocument; class TiXmlElement; class TiXmlComment; class TiXmlUnknown; class TiXmlAttribute; class TiXmlText; class TiXmlDeclaration; class TiXmlParsingData; const int TIXML_MAJOR_VERSION = 2; const int TIXML_MINOR_VERSION = 6; const int TIXML_PATCH_VERSION = 2; /* Internal structure for tracking location of items in the XML file. */ struct TiXmlCursor { TiXmlCursor() { Clear(); } void Clear() { row = col = -1; } int row; // 0 based. int col; // 0 based. }; /** Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept() method, it requires being passed a TiXmlVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves are simply called with Visit(). If you return 'true' from a Visit method, recursive parsing will continue. If you return false, <b>no children of this node or its sibilings</b> will be Visited. All flavors of Visit methods have a default implementation that returns 'true' (continue visiting). You need to only override methods that are interesting to you. Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. You should never change the document from a callback. @sa TiXmlNode::Accept() */ class TiXmlVisitor { public: virtual ~TiXmlVisitor() {} /// Visit a document. virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } /// Visit a document. virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } /// Visit an element. virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } /// Visit an element. virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } /// Visit a declaration virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } /// Visit a text node virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } /// Visit a comment node virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } /// Visit an unknown node virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } }; // Only used by Attribute::Query functions enum { TIXML_SUCCESS, TIXML_NO_ATTRIBUTE, TIXML_WRONG_TYPE }; // Used by the parsing routines. enum TiXmlEncoding { TIXML_ENCODING_UNKNOWN, TIXML_ENCODING_UTF8, TIXML_ENCODING_LEGACY }; const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; /** TiXmlBase is a base class for every class in TinyXml. It does little except to establish that TinyXml classes can be printed and provide some utility functions. In XML, the document and elements can contain other elements and other types of nodes. @verbatim A Document can contain: Element (container or leaf) Comment (leaf) Unknown (leaf) Declaration( leaf ) An Element can contain: Element (container or leaf) Text (leaf) Attributes (not on tree) Comment (leaf) Unknown (leaf) A Decleration contains: Attributes (not on tree) @endverbatim */ class TiXmlBase { friend class TiXmlNode; friend class TiXmlElement; friend class TiXmlDocument; public: TiXmlBase() : userData(0) {} virtual ~TiXmlBase() {} /** All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode.) Either or both cfile and str can be null. This is a formatted print, and will insert tabs and newlines. (For an unformatted stream, use the << operator.) */ virtual void Print( FILE* cfile, int depth ) const = 0; /** The world does not agree on whether white space should be kept or not. In order to make everyone happy, these global, static functions are provided to set whether or not TinyXml will condense all white space into a single space or not. The default is to condense. Note changing this value is not thread safe. */ static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } /// Return the current white space setting. static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } /** Return the position, in the original source file, of this node or attribute. The row and column are 1-based. (That is the first row and first column is 1,1). If the returns values are 0 or less, then the parser does not have a row and column value. Generally, the row and column value will be set when the TiXmlDocument::Load(), TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set when the DOM was created from operator>>. The values reflect the initial load. Once the DOM is modified programmatically (by adding or changing nodes and attributes) the new values will NOT update to reflect changes in the document. There is a minor performance cost to computing the row and column. Computation can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. @sa TiXmlDocument::SetTabSize() */ int Row() const { return location.row + 1; } int Column() const { return location.col + 1; } ///< See Row() void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. // Table that returs, for a given lead byte, the total number of bytes // in the UTF-8 sequence. static const int utf8ByteTable[256]; virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, or they will be transformed into entities! */ static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); enum { TIXML_NO_ERROR = 0, TIXML_ERROR, TIXML_ERROR_OPENING_FILE, TIXML_ERROR_PARSING_ELEMENT, TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, TIXML_ERROR_READING_ELEMENT_VALUE, TIXML_ERROR_READING_ATTRIBUTES, TIXML_ERROR_PARSING_EMPTY, TIXML_ERROR_READING_END_TAG, TIXML_ERROR_PARSING_UNKNOWN, TIXML_ERROR_PARSING_COMMENT, TIXML_ERROR_PARSING_DECLARATION, TIXML_ERROR_DOCUMENT_EMPTY, TIXML_ERROR_EMBEDDED_NULL, TIXML_ERROR_PARSING_CDATA, TIXML_ERROR_DOCUMENT_TOP_ONLY, TIXML_ERROR_STRING_COUNT }; protected: static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); inline static bool IsWhiteSpace( char c ) { return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); } inline static bool IsWhiteSpace( int c ) { if ( c < 256 ) return IsWhiteSpace( (char) c ); return false; // Again, only truly correct for English/Latin...but usually works. } #ifdef TIXML_USE_STL static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); #endif /* Reads an XML name into the string provided. Returns a pointer just past the last character of the name, or 0 if the function has an error. */ static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); /* Reads text. Returns a pointer past the given end tag. Wickedly complex options, but it keeps the (sensitive) code in one place. */ static const char* ReadText( const char* in, // where to start TIXML_STRING* text, // the string read bool ignoreWhiteSpace, // whether to keep the white space const char* endTag, // what ends this text bool ignoreCase, // whether to ignore case in the end tag TiXmlEncoding encoding ); // the current encoding // If an entity has been found, transform it into a character. static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); // Get a character, while interpreting entities. // The length can be from 0 to 4 bytes. inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) { assert( p ); if ( encoding == TIXML_ENCODING_UTF8 ) { *length = utf8ByteTable[ *((const unsigned char*)p) ]; assert( *length >= 0 && *length < 5 ); } else { *length = 1; } if ( *length == 1 ) { if ( *p == '&' ) return GetEntity( p, _value, length, encoding ); *_value = *p; return p+1; } else if ( *length ) { //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), // and the null terminator isn't needed for( int i=0; p[i] && i<*length; ++i ) { _value[i] = p[i]; } return p + (*length); } else { // Not valid text. return 0; } } // Return true if the next characters in the stream are any of the endTag sequences. // Ignore case only works for english, and should only be relied on when comparing // to English words: StringEqual( p, "version", true ) is fine. static bool StringEqual( const char* p, const char* endTag, bool ignoreCase, TiXmlEncoding encoding ); static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; TiXmlCursor location; /// Field containing a generic user pointer void* userData; // None of these methods are reliable for any language except English. // Good for approximation, not great for accuracy. static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); inline static int ToLower( int v, TiXmlEncoding encoding ) { if ( encoding == TIXML_ENCODING_UTF8 ) { if ( v < 128 ) return tolower( v ); return v; } else { return tolower( v ); } } static void ConvertUTF32ToUTF8( unsigned long inputs, char* outputs, int* length ); private: TiXmlBase( const TiXmlBase& ); // not implemented. void operator=( const TiXmlBase& base ); // not allowed. struct Entity { const char* str; unsigned int strLength; char chr; }; enum { NUM_ENTITY = 5, MAX_ENTITY_LENGTH = 6 }; static Entity entity[ NUM_ENTITY ]; static bool condenseWhiteSpace; }; /** The parent class for everything in the Document Object Model. (Except for attributes). Nodes have siblings, a parent, and children. A node can be in a document, or stand on its own. The type of a TiXmlNode can be queried, and it can be cast to its more defined type. */ class TiXmlNode : public TiXmlBase { friend class TiXmlDocument; friend class TiXmlElement; public: #ifdef TIXML_USE_STL /** An inputs stream operator, for every class. Tolerant of newlines and formatting, but doesn't expect them. */ friend std::istream& operator >> (std::istream& in, TiXmlNode& base); /** An outputs stream operator, for every class. Note that this outputs without any newlines or formatting, as opposed to Print(), which includes tabs and new lines. The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of outputs, without any extra whitespace or newlines. But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an inputs stream, the text needs to define an element or junk will result. This is true of all inputs streams, but it's worth keeping in mind. A TiXmlDocument will read nodes until it reads a root element, and all the children of that root element. */ friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); /// Appends the XML node or attribute to a std::string. friend std::string& operator<< (std::string& out, const TiXmlNode& base ); #endif /** The types of XML nodes supported by TinyXml. (All the unsupported types are picked up by UNKNOWN.) */ enum NodeType { TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, TINYXML_UNKNOWN, TINYXML_TEXT, TINYXML_DECLARATION, TINYXML_TYPECOUNT }; virtual ~TiXmlNode(); /** The meaning of 'value' changes for the specific type of TiXmlNode. @verbatim Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string @endverbatim The subclasses will wrap this function. */ const char *Value() const { return value.c_str (); } #ifdef TIXML_USE_STL /** Return Value() as a std::string. If you only use STL, this is more efficient than calling Value(). Only available in STL mode. */ const std::string& ValueStr() const { return value; } #endif const TIXML_STRING& ValueTStr() const { return value; } /** Changes the value of the node. Defined as: @verbatim Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string @endverbatim */ void SetValue(const char * _value) { value = _value;} #ifdef TIXML_USE_STL /// STL std::string form. void SetValue( const std::string& _value ) { value = _value; } #endif /// Delete all the children of this node. Does not affect 'this'. void Clear(); /// One step up the DOM. TiXmlNode* Parent() { return parent; } const TiXmlNode* Parent() const { return parent; } const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. TiXmlNode* FirstChild() { return firstChild; } const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. /// The first child of this node with the matching 'value'. Will be null if none found. TiXmlNode* FirstChild( const char * _value ) { // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) // call the method, cast the return back to non-const. return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); } const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. TiXmlNode* LastChild() { return lastChild; } const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. TiXmlNode* LastChild( const char * _value ) { return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); } #ifdef TIXML_USE_STL const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. #endif /** An alternate way to walk the children of a node. One way to iterate over nodes is: @verbatim for( child = parent->FirstChild(); child; child = child->NextSibling() ) @endverbatim IterateChildren does the same thing with the syntax: @verbatim child = 0; while( child = parent->IterateChildren( child ) ) @endverbatim IterateChildren takes the previous child as inputs and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done. */ const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; TiXmlNode* IterateChildren( const TiXmlNode* previous ) { return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); } /// This flavor of IterateChildren searches for children with a particular 'value' const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); } #ifdef TIXML_USE_STL const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. #endif /** Add a new node related to this. Adds a child past the LastChild. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); /** Add a new node related to this. Adds a child past the LastChild. NOTE: the node to be added is passed by pointer, and will be henceforth owned (and deleted) by tinyXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions. @sa InsertEndChild */ TiXmlNode* LinkEndChild( TiXmlNode* addThis ); /** Add a new node related to this. Adds a child before the specified child. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); /** Add a new node related to this. Adds a child after the specified child. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); /** Replace a child of this node. Returns a pointer to the new object or NULL if an error occured. */ TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); /// Delete a child of this node. bool RemoveChild( TiXmlNode* removeThis ); /// Navigate to a sibling node. const TiXmlNode* PreviousSibling() const { return prev; } TiXmlNode* PreviousSibling() { return prev; } /// Navigate to a sibling node. const TiXmlNode* PreviousSibling( const char * ) const; TiXmlNode* PreviousSibling( const char *_prev ) { return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); } #ifdef TIXML_USE_STL const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. #endif /// Navigate to a sibling node. const TiXmlNode* NextSibling() const { return next; } TiXmlNode* NextSibling() { return next; } /// Navigate to a sibling node with the given 'value'. const TiXmlNode* NextSibling( const char * ) const; TiXmlNode* NextSibling( const char* _next ) { return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); } /** Convenience function to get through elements. Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element. */ const TiXmlElement* NextSiblingElement() const; TiXmlElement* NextSiblingElement() { return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); } /** Convenience function to get through elements. Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element. */ const TiXmlElement* NextSiblingElement( const char * ) const; TiXmlElement* NextSiblingElement( const char *_next ) { return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); } #ifdef TIXML_USE_STL const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. #endif /// Convenience function to get through elements. const TiXmlElement* FirstChildElement() const; TiXmlElement* FirstChildElement() { return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); } /// Convenience function to get through elements. const TiXmlElement* FirstChildElement( const char * _value ) const; TiXmlElement* FirstChildElement( const char * _value ) { return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); } #ifdef TIXML_USE_STL const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. #endif /** Query the type (as an enumerated value, above) of this node. The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. */ int Type() const { return type; } /** Return a pointer to the Document this node lives in. Returns null if not in a document. */ const TiXmlDocument* GetDocument() const; TiXmlDocument* GetDocument() { return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); } /// Returns true if this node has no children. bool NoChildren() const { return !firstChild; } virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. /** Create an exact duplicate of this node and return it. The memory must be deleted by the caller. */ virtual TiXmlNode* Clone() const = 0; /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the TiXmlVisitor interface. This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML is unchanged by using this interface versus any other.) The interface has been based on ideas from: - http://www.saxproject.org/ - http://c2.com/cgi/wiki?HierarchicalVisitorPattern Which are both good references for "visiting". An example of using Accept(): @verbatim TiXmlPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr(); @endverbatim */ virtual bool Accept( TiXmlVisitor* visitor ) const = 0; protected: TiXmlNode( NodeType _type ); // Copy to the allocated object. Shared functionality between Clone, Copy constructor, // and the assignment operator. void CopyTo( TiXmlNode* targets ) const; #ifdef TIXML_USE_STL // The real work of the inputs operator. virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; #endif // Figure out what is at *p, and parse it. Returns null if it is not an xml node. TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); TiXmlNode* parent; NodeType type; TiXmlNode* firstChild; TiXmlNode* lastChild; TIXML_STRING value; TiXmlNode* prev; TiXmlNode* next; private: TiXmlNode( const TiXmlNode& ); // not implemented. void operator=( const TiXmlNode& base ); // not allowed. }; /** An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name. @note The attributes are not TiXmlNodes, since they are not part of the tinyXML document object model. There are other suggested ways to look at this problem. */ class TiXmlAttribute : public TiXmlBase { friend class TiXmlAttributeSet; public: /// Construct an empty attribute. TiXmlAttribute() : TiXmlBase() { document = 0; prev = next = 0; } #ifdef TIXML_USE_STL /// std::string constructor. TiXmlAttribute( const std::string& _name, const std::string& _value ) { name = _name; value = _value; document = 0; prev = next = 0; } #endif /// Construct an attribute with a name and value. TiXmlAttribute( const char * _name, const char * _value ) { name = _name; value = _value; document = 0; prev = next = 0; } const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. #ifdef TIXML_USE_STL const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. #endif int IntValue() const; ///< Return the value of this attribute, converted to an integer. double DoubleValue() const; ///< Return the value of this attribute, converted to a double. // Get the tinyxml string representation const TIXML_STRING& NameTStr() const { return name; } /** QueryIntValue examines the value string. It is an alternative to the IntValue() method with richer error checking. If the value is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. A specialized but useful call. Note that for success it returns 0, which is the opposite of almost all other TinyXml calls. */ int QueryIntValue( int* _value ) const; /// QueryDoubleValue examines the value string. See QueryIntValue(). int QueryDoubleValue( double* _value ) const; void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. void SetValue( const char* _value ) { value = _value; } ///< Set the value. void SetIntValue( int _value ); ///< Set the value from an integer. void SetDoubleValue( double _value ); ///< Set the value from a double. #ifdef TIXML_USE_STL /// STL std::string form. void SetName( const std::string& _name ) { name = _name; } /// STL std::string form. void SetValue( const std::string& _value ) { value = _value; } #endif /// Get the next sibling attribute in the DOM. Returns null at end. const TiXmlAttribute* Next() const; TiXmlAttribute* Next() { return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); } /// Get the previous sibling attribute in the DOM. Returns null at beginning. const TiXmlAttribute* Previous() const; TiXmlAttribute* Previous() { return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); } bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } /* Attribute parsing starts: first letter of the name returns: the next char after the value end quote */ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); // Prints this Attribute to a FILE stream. virtual void Print( FILE* cfile, int depth ) const { Print( cfile, depth, 0 ); } void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; // [internal use] // Set the document pointer so the attribute can report errors. void SetDocument( TiXmlDocument* doc ) { document = doc; } private: TiXmlAttribute( const TiXmlAttribute& ); // not implemented. void operator=( const TiXmlAttribute& base ); // not allowed. TiXmlDocument* document; // A pointer back to a document, for error reporting. TIXML_STRING name; TIXML_STRING value; TiXmlAttribute* prev; TiXmlAttribute* next; }; /* A class used to manage a group of attributes. It is only used internally, both by the ELEMENT and the DECLARATION. The set can be changed transparent to the Element and Declaration classes that use it, but NOT transparent to the Attribute which has to implement a next() and previous() method. Which makes it a bit problematic and prevents the use of STL. This version is implemented with circular lists because: - I like circular lists - it demonstrates some independence from the (typical) doubly linked list. */ class TiXmlAttributeSet { public: TiXmlAttributeSet(); ~TiXmlAttributeSet(); void Add( TiXmlAttribute* attribute ); void Remove( TiXmlAttribute* attribute ); const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } TiXmlAttribute* Find( const char* _name ) const; TiXmlAttribute* FindOrCreate( const char* _name ); # ifdef TIXML_USE_STL TiXmlAttribute* Find( const std::string& _name ) const; TiXmlAttribute* FindOrCreate( const std::string& _name ); # endif private: //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), //*ME: this class must be also use a hidden/disabled copy-constructor !!! TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) TiXmlAttribute sentinel; }; /** The element is a container class. It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes. */ class TiXmlElement : public TiXmlNode { public: /// Construct an element. TiXmlElement (const char * in_value); #ifdef TIXML_USE_STL /// std::string constructor. TiXmlElement( const std::string& _value ); #endif TiXmlElement( const TiXmlElement& ); TiXmlElement& operator=( const TiXmlElement& base ); virtual ~TiXmlElement(); /** Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. */ const char* Attribute( const char* name ) const; /** Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. If the attribute exists and can be converted to an integer, the integer value will be put in the return 'i', if 'i' is non-null. */ const char* Attribute( const char* name, int* i ) const; /** Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. If the attribute exists and can be converted to an double, the double value will be put in the return 'd', if 'd' is non-null. */ const char* Attribute( const char* name, double* d ) const; /** QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer error checking. If the attribute is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. If the attribute does not exist, then TIXML_NO_ATTRIBUTE is returned. */ int QueryIntAttribute( const char* name, int* _value ) const; /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). Note that '1', 'true', or 'yes' are considered true, while '0', 'false' and 'no' are considered false. */ int QueryBoolAttribute( const char* name, bool* _value ) const; /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). int QueryDoubleAttribute( const char* name, double* _value ) const; /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). int QueryFloatAttribute( const char* name, float* _value ) const { double d; int result = QueryDoubleAttribute( name, &d ); if ( result == TIXML_SUCCESS ) { *_value = (float)d; } return result; } #ifdef TIXML_USE_STL /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). int QueryStringAttribute( const char* name, std::string* _value ) const { const char* cstr = Attribute( name ); if ( cstr ) { *_value = std::string( cstr ); return TIXML_SUCCESS; } return TIXML_NO_ATTRIBUTE; } /** Template form of the attribute query which will try to read the attribute into the specified type. Very easy, very powerful, but be careful to make sure to call this with the correct type. NOTE: This method doesn't work correctly for 'string' types that contain spaces. @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE */ template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const { const TiXmlAttribute* node = attributeSet.Find( name ); if ( !node ) return TIXML_NO_ATTRIBUTE; std::stringstream sstream( node->ValueStr() ); sstream >> *outValue; if ( !sstream.fail() ) return TIXML_SUCCESS; return TIXML_WRONG_TYPE; } int QueryValueAttribute( const std::string& name, std::string* outValue ) const { const TiXmlAttribute* node = attributeSet.Find( name ); if ( !node ) return TIXML_NO_ATTRIBUTE; *outValue = node->ValueStr(); return TIXML_SUCCESS; } #endif /** Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does. */ void SetAttribute( const char* name, const char * _value ); #ifdef TIXML_USE_STL const std::string* Attribute( const std::string& name ) const; const std::string* Attribute( const std::string& name, int* i ) const; const std::string* Attribute( const std::string& name, double* d ) const; int QueryIntAttribute( const std::string& name, int* _value ) const; int QueryDoubleAttribute( const std::string& name, double* _value ) const; /// STL std::string form. void SetAttribute( const std::string& name, const std::string& _value ); ///< STL std::string form. void SetAttribute( const std::string& name, int _value ); ///< STL std::string form. void SetDoubleAttribute( const std::string& name, double value ); #endif /** Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does. */ void SetAttribute( const char * name, int value ); /** Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does. */ void SetDoubleAttribute( const char * name, double value ); /** Deletes an attribute with the given name. */ void RemoveAttribute( const char * name ); #ifdef TIXML_USE_STL void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. #endif const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } /** Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the TiXmlText child and accessing it directly. If the first child of 'this' is a TiXmlText, the GetText() returns the character string of the Text node, else null is returned. This is a convenient method for getting the text of simple contained text: @verbatim <foo>This is text</foo> const char* str = fooElement->GetText(); @endverbatim 'str' will be a pointer to "This is text". Note that this function can be misleading. If the element foo was created from this XML: @verbatim <foo><b>This is text</b></foo> @endverbatim then the value of str would be null. The first child node isn't a text node, it is another element. From this XML: @verbatim <foo>This is <b>text</b></foo> @endverbatim GetText() will return "This is ". WARNING: GetText() accesses a child node - don't become confused with the similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are safe type casts on the referenced node. */ const char* GetText() const; /// Creates a new Element and returns it - the returned element is a copy. virtual TiXmlNode* Clone() const; // Print the Element to a FILE stream. virtual void Print( FILE* cfile, int depth ) const; /* Attribtue parsing starts: next char past '<' returns: next char past '>' */ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* visitor ) const; protected: void CopyTo( TiXmlElement* targets ) const; void ClearThis(); // like clear, but initializes 'this' object as well // Used to be public [internal use] #ifdef TIXML_USE_STL virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); #endif /* [internal use] Reads the "value" of the element -- another element, or text. This should terminate with the current end tag. */ const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); private: TiXmlAttributeSet attributeSet; }; /** An XML comment. */ class TiXmlComment : public TiXmlNode { public: /// Constructs an empty comment. TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} /// Construct a comment from text. TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { SetValue( _value ); } TiXmlComment( const TiXmlComment& ); TiXmlComment& operator=( const TiXmlComment& base ); virtual ~TiXmlComment() {} /// Returns a copy of this Comment. virtual TiXmlNode* Clone() const; // Write this Comment to a FILE stream. virtual void Print( FILE* cfile, int depth ) const; /* Attribtue parsing starts: at the ! of the !-- returns: next char past '>' */ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* visitor ) const; protected: void CopyTo( TiXmlComment* targets ) const; // used to be public #ifdef TIXML_USE_STL virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); #endif // virtual void StreamOut( TIXML_OSTREAM * out ) const; private: }; /** XML text. A text node can have 2 ways to outputs the next. "normal" outputs and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the outputs mode with SetCDATA() and query it with CDATA(). */ class TiXmlText : public TiXmlNode { friend class TiXmlElement; public: /** Constructor for text element. By default, it is treated as normal, encoded text. If you want it be outputs as a CDATA text element, set the parameter _cdata to 'true' */ TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) { SetValue( initValue ); cdata = false; } virtual ~TiXmlText() {} #ifdef TIXML_USE_STL /// Constructor. TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) { SetValue( initValue ); cdata = false; } #endif TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; } // Write this text object to a FILE stream. virtual void Print( FILE* cfile, int depth ) const; /// Queries whether this represents text using a CDATA section. bool CDATA() const { return cdata; } /// Turns on or off a CDATA representation of text. void SetCDATA( bool _cdata ) { cdata = _cdata; } virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* content ) const; protected : /// [internal use] Creates a new Element and returns it. virtual TiXmlNode* Clone() const; void CopyTo( TiXmlText* targets ) const; bool Blank() const; // returns true if all white space and new lines // [internal use] #ifdef TIXML_USE_STL virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); #endif private: bool cdata; // true if this should be inputs and outputs as a CDATA style text element }; /** In correct XML the declaration is the first entry in the file. @verbatim <?xml version="1.0" standalone="yes"?> @endverbatim TinyXml will happily read or write files without a declaration, however. There are 3 possible attributes to the declaration: version, encoding, and standalone. Note: In this version of the code, the attributes are handled as special cases, not generic attributes, simply because there can only be at most 3 and they are always the same. */ class TiXmlDeclaration : public TiXmlNode { public: /// Construct an empty declaration. TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} #ifdef TIXML_USE_STL /// Constructor. TiXmlDeclaration( const std::string& _version, const std::string& _encoding, const std::string& _standalone ); #endif /// Construct. TiXmlDeclaration( const char* _version, const char* _encoding, const char* _standalone ); TiXmlDeclaration( const TiXmlDeclaration& copy ); TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); virtual ~TiXmlDeclaration() {} /// Version. Will return an empty string if none was found. const char *Version() const { return version.c_str (); } /// Encoding. Will return an empty string if none was found. const char *Encoding() const { return encoding.c_str (); } /// Is this a standalone document? const char *Standalone() const { return standalone.c_str (); } /// Creates a copy of this Declaration and returns it. virtual TiXmlNode* Clone() const; // Print this declaration to a FILE stream. virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; virtual void Print( FILE* cfile, int depth ) const { Print( cfile, depth, 0 ); } virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* visitor ) const; protected: void CopyTo( TiXmlDeclaration* targets ) const; // used to be public #ifdef TIXML_USE_STL virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); #endif private: TIXML_STRING version; TIXML_STRING encoding; TIXML_STRING standalone; }; /** Any tag that tinyXml doesn't recognize is saved as an unknown. It is a tag of text, but should not be modified. It will be written back to the XML, unchanged, when the file is saved. DTD tags get thrown into TiXmlUnknowns. */ class TiXmlUnknown : public TiXmlNode { public: TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} virtual ~TiXmlUnknown() {} TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; } /// Creates a copy of this Unknown and returns it. virtual TiXmlNode* Clone() const; // Print this Unknown to a FILE stream. virtual void Print( FILE* cfile, int depth ) const; virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* content ) const; protected: void CopyTo( TiXmlUnknown* targets ) const; #ifdef TIXML_USE_STL virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); #endif private: }; /** Always the top level node. A document binds together all the XML pieces. It can be saved, loaded, and printed to the screen. The 'value' of a document node is the xml file name. */ class TiXmlDocument : public TiXmlNode { public: /// Create an empty document, that has no name. TiXmlDocument(); /// Create a document with a name. The name of the document is also the filename of the xml. TiXmlDocument( const char * documentName ); #ifdef TIXML_USE_STL /// Constructor. TiXmlDocument( const std::string& documentName ); #endif TiXmlDocument( const TiXmlDocument& copy ); TiXmlDocument& operator=( const TiXmlDocument& copy ); virtual ~TiXmlDocument() {} /** Load a file using the current document value. Returns true if successful. Will delete any existing document data before loading. */ bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); /// Save a file using the current document value. Returns true if successful. bool SaveFile() const; /// Load a file using the given filename. Returns true if successful. bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); /// Save a file using the given filename. Returns true if successful. bool SaveFile( const char * filename ) const; /** Load a file using the given FILE*. Returns true if successful. Note that this method doesn't stream - the entire object pointed at by the FILE* will be interpreted as an XML file. TinyXML doesn't stream in XML from the current file location. Streaming may be added in the future. */ bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); /// Save a file using the given FILE*. Returns true if successful. bool SaveFile( FILE* ) const; #ifdef TIXML_USE_STL bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. { return LoadFile( filename.c_str(), encoding ); } bool SaveFile( const std::string& filename ) const ///< STL std::string version. { return SaveFile( filename.c_str() ); } #endif /** Parse the given null terminated block of xml data. Passing in an encoding to this method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml to use that encoding, regardless of what TinyXml might otherwise try to detect. */ virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); /** Get the root element -- the only top level element -- of the document. In well formed XML, there should only be one. TinyXml is tolerant of multiple elements at the document level. */ const TiXmlElement* RootElement() const { return FirstChildElement(); } TiXmlElement* RootElement() { return FirstChildElement(); } /** If an error occurs, Error will be set to true. Also, - The ErrorId() will contain the integer identifier of the error (not generally useful) - The ErrorDesc() method will return the name of the error. (very useful) - The ErrorRow() and ErrorCol() will return the location of the error (if known) */ bool Error() const { return error; } /// Contains a textual (english) description of the error if one occurs. const char * ErrorDesc() const { return errorDesc.c_str (); } /** Generally, you probably want the error string ( ErrorDesc() ). But if you prefer the ErrorId, this function will fetch it. */ int ErrorId() const { return errorId; } /** Returns the location (if known) of the error. The first column is column 1, and the first row is row 1. A value of 0 means the row and column wasn't applicable (memory errors, for example, have no row/column) or the parser lost the error. (An error in the error reporting, in that case.) @sa SetTabSize, Row, Column */ int ErrorRow() const { return errorLocation.row+1; } int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct values for row and column. It does not change the outputs or inputs in any way. By calling this method, with a tab size greater than 0, the row and column of each node and attribute is stored when the file is loaded. Very useful for tracking the DOM back in to the source file. The tab size is required for calculating the location of nodes. If not set, the default of 4 is used. The tabsize is set per document. Setting the tabsize to 0 disables row/column tracking. Note that row and column tracking is not supported when using operator>>. The tab size needs to be enabled before the parse or load. Correct usage: @verbatim TiXmlDocument doc; doc.SetTabSize( 8 ); doc.Load( "myfile.xml" ); @endverbatim @sa Row, Column */ void SetTabSize( int _tabsize ) { tabsize = _tabsize; } int TabSize() const { return tabsize; } /** If you have handled the error, it can be reset with this call. The error state is automatically cleared if you Parse a new XML block. */ void ClearError() { error = false; errorId = 0; errorDesc = ""; errorLocation.row = errorLocation.col = 0; //errorLocation.last = 0; } /** Write the document to standard out using formatted printing ("pretty print"). */ void Print() const { Print( stdout, 0 ); } /* Write the document to a string using formatted printing ("pretty print"). This will allocate a character array (new char[]) and return it as a pointer. The calling code pust call delete[] on the return char* to avoid a memory leak. */ //char* PrintToMemory() const; /// Print this Document to a FILE stream. virtual void Print( FILE* cfile, int depth = 0 ) const; // [internal use] void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. /** Walk the XML tree visiting this node and all of its children. */ virtual bool Accept( TiXmlVisitor* content ) const; protected : // [internal use] virtual TiXmlNode* Clone() const; #ifdef TIXML_USE_STL virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); #endif private: void CopyTo( TiXmlDocument* targets ) const; bool error; int errorId; TIXML_STRING errorDesc; int tabsize; TiXmlCursor errorLocation; bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. }; /** A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml DOM structure. It is a separate utility class. Take an example: @verbatim <Document> <Element attributeA = "valueA"> <Child attributeB = "value1" /> <Child attributeB = "value2" /> </Element> <Document> @endverbatim Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a *lot* of code that looks like: @verbatim TiXmlElement* root = document.FirstChildElement( "Document" ); if ( root ) { TiXmlElement* element = root->FirstChildElement( "Element" ); if ( element ) { TiXmlElement* child = element->FirstChildElement( "Child" ); if ( child ) { TiXmlElement* child2 = child->NextSiblingElement( "Child" ); if ( child2 ) { // Finally do something useful. @endverbatim And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity of such code. A TiXmlHandle checks for null pointers so it is perfectly safe and correct to use: @verbatim TiXmlHandle docHandle( &document ); TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); if ( child2 ) { // do something useful @endverbatim Which is MUCH more concise and useful. It is also safe to copy handles - internally they are nothing more than node pointers. @verbatim TiXmlHandle handleCopy = handle; @endverbatim What they should not be used for is iteration: @verbatim int i=0; while ( true ) { TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); if ( !child ) break; // do something ++i; } @endverbatim It seems reasonable, but it is in fact two embedded while loops. The Child method is a linear walk to find the element, so this code would iterate much more than it needs to. Instead, prefer: @verbatim TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); for( child; child; child=child->NextSiblingElement() ) { // do something } @endverbatim */ class TiXmlHandle { public: /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } /// Copy constructor TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } /// Return a handle to the first child node. TiXmlHandle FirstChild() const; /// Return a handle to the first child node with the given name. TiXmlHandle FirstChild( const char * value ) const; /// Return a handle to the first child element. TiXmlHandle FirstChildElement() const; /// Return a handle to the first child element with the given name. TiXmlHandle FirstChildElement( const char * value ) const; /** Return a handle to the "index" child with the given name. The first child is 0, the second 1, etc. */ TiXmlHandle Child( const char* value, int index ) const; /** Return a handle to the "index" child. The first child is 0, the second 1, etc. */ TiXmlHandle Child( int index ) const; /** Return a handle to the "index" child element with the given name. The first child element is 0, the second 1, etc. Note that only TiXmlElements are indexed: other types are not counted. */ TiXmlHandle ChildElement( const char* value, int index ) const; /** Return a handle to the "index" child element. The first child element is 0, the second 1, etc. Note that only TiXmlElements are indexed: other types are not counted. */ TiXmlHandle ChildElement( int index ) const; #ifdef TIXML_USE_STL TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } #endif /** Return the handle as a TiXmlNode. This may return null. */ TiXmlNode* ToNode() const { return node; } /** Return the handle as a TiXmlElement. This may return null. */ TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } /** Return the handle as a TiXmlText. This may return null. */ TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } /** Return the handle as a TiXmlUnknown. This may return null. */ TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } /** @deprecated use ToNode. Return the handle as a TiXmlNode. This may return null. */ TiXmlNode* Node() const { return ToNode(); } /** @deprecated use ToElement. Return the handle as a TiXmlElement. This may return null. */ TiXmlElement* Element() const { return ToElement(); } /** @deprecated use ToText() Return the handle as a TiXmlText. This may return null. */ TiXmlText* Text() const { return ToText(); } /** @deprecated use ToUnknown() Return the handle as a TiXmlUnknown. This may return null. */ TiXmlUnknown* Unknown() const { return ToUnknown(); } private: TiXmlNode* node; }; /** Print to memory functionality. The TiXmlPrinter is useful when you need to: -# Print to memory (especially in non-STL mode) -# Control formatting (line endings, etc.) When constructed, the TiXmlPrinter is in its default "pretty printing" mode. Before calling Accept() you can call methods to control the printing of the XML document. After TiXmlNode::Accept() is called, the printed document can be accessed via the CStr(), Str(), and Size() methods. TiXmlPrinter uses the Visitor API. @verbatim TiXmlPrinter printer; printer.SetIndent( "\t" ); doc.Accept( &printer ); fprintf( stdout, "%s", printer.CStr() ); @endverbatim */ class TiXmlPrinter : public TiXmlVisitor { public: TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), buffer(), indent( " " ), lineBreak( "\n" ) {} virtual bool VisitEnter( const TiXmlDocument& doc ); virtual bool VisitExit( const TiXmlDocument& doc ); virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); virtual bool VisitExit( const TiXmlElement& element ); virtual bool Visit( const TiXmlDeclaration& declaration ); virtual bool Visit( const TiXmlText& text ); virtual bool Visit( const TiXmlComment& comment ); virtual bool Visit( const TiXmlUnknown& unknown ); /** Set the indent characters for printing. By default 4 spaces but tab (\t) is also useful, or null/empty string for no indentation. */ void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } /// Query the indention string. const char* Indent() { return indent.c_str(); } /** Set the line breaking string. By default set to newline (\n). Some operating systems prefer other characters, or can be set to the null/empty string for no indenation. */ void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } /// Query the current line breaking string. const char* LineBreak() { return lineBreak.c_str(); } /** Switch over to "stream printing" which is the most dense formatting without linebreaks. Common when the XML is needed for network transmission. */ void SetStreamPrinting() { indent = ""; lineBreak = ""; } /// Return the result. const char* CStr() { return buffer.c_str(); } /// Return the length of the result string. size_t Size() { return buffer.size(); } #ifdef TIXML_USE_STL /// Return the result. const std::string& Str() { return buffer; } #endif private: void DoIndent() { for( int i=0; i<depth; ++i ) buffer += indent; } void DoLineBreak() { buffer += lineBreak; } int depth; bool simpleTextPrint; TIXML_STRING buffer; TIXML_STRING indent; TIXML_STRING lineBreak; }; #ifdef _MSC_VER #pragma warning( pop ) #endif #endif
[ "payu.chen0422@gmail.com" ]
payu.chen0422@gmail.com
64897cc3b2dc87878517f8bee7f2fd892340ac6d
565eb4616f6ee6884fa9aab36d8b1e33bbc437be
/src/glad.cpp
24ec388ea887afc07b9516e4e458f5811e220b48
[]
no_license
czyzlukasz/OpenGL
73600f9438f30dca0405429c7dc4e8a7c0141429
738edc197169a3598fc4dd9230991c9c3c6f172f
refs/heads/master
2023-04-28T09:32:22.377842
2018-08-13T14:31:25
2018-08-13T14:31:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
144,936
cpp
/* OpenGL loader generated by glad 0.1.20a0 on Wed May 9 14:14:25 2018. Language/Generator: C/C++ Specification: gl APIs: gl=4.6 Profile: compatibility Extensions: Loader: True Local files: False Omit khrplatform: False Commandline: --profile="compatibility" --api="gl=4.6" --generator="c" --spec="gl" --extensions="" Online: http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.6 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <glad.h> static void* get_proc(const char *namez); #if defined(_WIN32) || defined(__CYGWIN__) #include <windows.h> static HMODULE libGL; typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*); static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #ifdef _MSC_VER #ifdef __has_include #if __has_include(<winapifamily.h>) #define HAVE_WINAPIFAMILY 1 #endif #elif _MSC_VER >= 1700 && !_USING_V110_SDK71_ #define HAVE_WINAPIFAMILY 1 #endif #endif #ifdef HAVE_WINAPIFAMILY #include <winapifamily.h> #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #define IS_UWP 1 #endif #endif static int open_gl(void) { #ifndef IS_UWP libGL = LoadLibraryW(L"opengl32.dll"); if(libGL != NULL) { gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress( libGL, "wglGetProcAddress"); return gladGetProcAddressPtr != NULL; } #endif return 0; } static void close_gl(void) { if(libGL != NULL) { FreeLibrary((HMODULE) libGL); libGL = NULL; } } #else #include <dlfcn.h> static void* libGL; #ifndef __APPLE__ typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #endif static int open_gl(void) { #ifdef __APPLE__ static const char *NAMES[] = { "../Frameworks/OpenGL.framework/OpenGL", "/Library/Frameworks/OpenGL.framework/OpenGL", "/System/Library/Frameworks/OpenGL.framework/OpenGL", "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" }; #else static const char *NAMES[] = {"libGL.so.1", "libGL.so"}; #endif unsigned int index = 0; for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) { libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); if(libGL != NULL) { #ifdef __APPLE__ return 1; #else gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, "glXGetProcAddressARB"); return gladGetProcAddressPtr != NULL; #endif } } return 0; } static void close_gl(void) { if(libGL != NULL) { dlclose(libGL); libGL = NULL; } } #endif static void* get_proc(const char *namez) { void* result = NULL; if(libGL == NULL) return NULL; #ifndef __APPLE__ if(gladGetProcAddressPtr != NULL) { result = gladGetProcAddressPtr(namez); } #endif if(result == NULL) { #if defined(_WIN32) || defined(__CYGWIN__) result = (void*)GetProcAddress((HMODULE) libGL, namez); #else result = dlsym(libGL, namez); #endif } return result; } int gladLoadGL(void) { int status = 0; if(open_gl()) { status = gladLoadGLLoader(&get_proc); close_gl(); } return status; } struct gladGLversionStruct GLVersion; #if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) #define _GLAD_IS_SOME_NEW_VERSION 1 #endif static int max_loaded_major; static int max_loaded_minor; static const char *exts = NULL; static int num_exts_i = 0; static const char **exts_i = NULL; static int get_exts(void) { #ifdef _GLAD_IS_SOME_NEW_VERSION if(max_loaded_major < 3) { #endif exts = (const char *)glGetString(GL_EXTENSIONS); #ifdef _GLAD_IS_SOME_NEW_VERSION } else { unsigned int index; num_exts_i = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); if (num_exts_i > 0) { exts_i = (const char **)realloc((void *)exts_i, (size_t)num_exts_i * (sizeof *exts_i)); } if (exts_i == NULL) { return 0; } for(index = 0; index < (unsigned)num_exts_i; index++) { const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); size_t len = strlen(gl_str_tmp); char *local_str = (char*)malloc((len+1) * sizeof(char)); if(local_str != NULL) { #if _MSC_VER >= 1400 strncpy_s(local_str, len+1, gl_str_tmp, len); #else strncpy(local_str, gl_str_tmp, len+1); #endif } exts_i[index] = local_str; } } #endif return 1; } static void free_exts(void) { if (exts_i != NULL) { int index; for(index = 0; index < num_exts_i; index++) { free((char *)exts_i[index]); } free((void *)exts_i); exts_i = NULL; } } static int has_ext(const char *ext) { #ifdef _GLAD_IS_SOME_NEW_VERSION if(max_loaded_major < 3) { #endif const char *extensions; const char *loc; const char *terminator; extensions = exts; if(extensions == NULL || ext == NULL) { return 0; } while(1) { loc = strstr(extensions, ext); if(loc == NULL) { return 0; } terminator = loc + strlen(ext); if((loc == extensions || *(loc - 1) == ' ') && (*terminator == ' ' || *terminator == '\0')) { return 1; } extensions = terminator; } #ifdef _GLAD_IS_SOME_NEW_VERSION } else { int index; if(exts_i == NULL) return 0; for(index = 0; index < num_exts_i; index++) { const char *e = exts_i[index]; if(exts_i[index] != NULL && strcmp(e, ext) == 0) { return 1; } } } #endif return 0; } int GLAD_GL_VERSION_1_0; int GLAD_GL_VERSION_1_1; int GLAD_GL_VERSION_1_2; int GLAD_GL_VERSION_1_3; int GLAD_GL_VERSION_1_4; int GLAD_GL_VERSION_1_5; int GLAD_GL_VERSION_2_0; int GLAD_GL_VERSION_2_1; int GLAD_GL_VERSION_3_0; int GLAD_GL_VERSION_3_1; int GLAD_GL_VERSION_3_2; int GLAD_GL_VERSION_3_3; int GLAD_GL_VERSION_4_0; int GLAD_GL_VERSION_4_1; int GLAD_GL_VERSION_4_2; int GLAD_GL_VERSION_4_3; int GLAD_GL_VERSION_4_4; int GLAD_GL_VERSION_4_5; int GLAD_GL_VERSION_4_6; PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; PFNGLTEXTUREPARAMETERFPROC glad_glTextureParameterf; PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; PFNGLVERTEXARRAYELEMENTBUFFERPROC glad_glVertexArrayElementBuffer; PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC glad_glTextureStorage3DMultisample; PFNGLTEXTUREPARAMETERFVPROC glad_glTextureParameterfv; PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; PFNGLVERTEX2FVPROC glad_glVertex2fv; PFNGLINDEXIPROC glad_glIndexi; PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv; PFNGLRECTDVPROC glad_glRectdv; PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; PFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v; PFNGLINDEXDPROC glad_glIndexd; PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; PFNGLINDEXFPROC glad_glIndexf; PFNGLBINDSAMPLERPROC glad_glBindSampler; PFNGLLINEWIDTHPROC glad_glLineWidth; PFNGLCOLORP3UIVPROC glad_glColorP3uiv; PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; PFNGLGETMAPFVPROC glad_glGetMapfv; PFNGLINDEXSPROC glad_glIndexs; PFNGLCOMPILESHADERPROC glad_glCompileShader; PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glad_glDrawTransformFeedbackStreamInstanced; PFNGLINDEXFVPROC glad_glIndexfv; PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glad_glGetCompressedTextureImage; PFNGLGETNMAPFVPROC glad_glGetnMapfv; PFNGLFOGIVPROC glad_glFogiv; PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; PFNGLLIGHTMODELIVPROC glad_glLightModeliv; PFNGLDEPTHRANGEFPROC glad_glDepthRangef; PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC glad_glMultiDrawElementsIndirectCount; PFNGLCOLOR4UIPROC glad_glColor4ui; PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; PFNGLMEMORYBARRIERBYREGIONPROC glad_glMemoryBarrierByRegion; PFNGLGETNAMEDBUFFERPARAMETERIVPROC glad_glGetNamedBufferParameteriv; PFNGLFOGFVPROC glad_glFogfv; PFNGLVERTEXP4UIPROC glad_glVertexP4ui; PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glad_glDrawElementsInstancedBaseInstance; PFNGLENABLEIPROC glad_glEnablei; PFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv; PFNGLVERTEX4IVPROC glad_glVertex4iv; PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; PFNGLCREATESHADERPROC glad_glCreateShader; PFNGLISBUFFERPROC glad_glIsBuffer; PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; PFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv; PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; PFNGLVERTEX4FVPROC glad_glVertex4fv; PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading; PFNGLCLEARNAMEDFRAMEBUFFERFIPROC glad_glClearNamedFramebufferfi; PFNGLGETQUERYBUFFEROBJECTUIVPROC glad_glGetQueryBufferObjectuiv; PFNGLBINDTEXTUREPROC glad_glBindTexture; PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; PFNGLSAMPLEMASKIPROC glad_glSampleMaski; PFNGLVERTEXP2UIPROC glad_glVertexP2ui; PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl; PFNGLPOINTSIZEPROC glad_glPointSize; PFNGLBINDTEXTUREUNITPROC glad_glBindTextureUnit; PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; PFNGLCOLOR4BVPROC glad_glColor4bv; PFNGLRASTERPOS2FPROC glad_glRasterPos2f; PFNGLRASTERPOS2DPROC glad_glRasterPos2d; PFNGLLOADIDENTITYPROC glad_glLoadIdentity; PFNGLRASTERPOS2IPROC glad_glRasterPos2i; PFNGLMULTIDRAWARRAYSINDIRECTPROC glad_glMultiDrawArraysIndirect; PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; PFNGLCOLOR3BPROC glad_glColor3b; PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; PFNGLEDGEFLAGPROC glad_glEdgeFlag; PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; PFNGLVERTEX3DPROC glad_glVertex3d; PFNGLVERTEX3FPROC glad_glVertex3f; PFNGLGETNMAPIVPROC glad_glGetnMapiv; PFNGLVERTEX3IPROC glad_glVertex3i; PFNGLCOLOR3IPROC glad_glColor3i; PFNGLUNIFORM3DPROC glad_glUniform3d; PFNGLUNIFORM3FPROC glad_glUniform3f; PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; PFNGLCOLOR3SPROC glad_glColor3s; PFNGLVERTEX3SPROC glad_glVertex3s; PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; PFNGLCOLORMASKIPROC glad_glColorMaski; PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect; PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback; PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv; PFNGLCOPYNAMEDBUFFERSUBDATAPROC glad_glCopyNamedBufferSubData; PFNGLNAMEDFRAMEBUFFERTEXTUREPROC glad_glNamedFramebufferTexture; PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv; PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; PFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d; PFNGLBINDIMAGETEXTUREPROC glad_glBindImageTexture; PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; PFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv; PFNGLVERTEX2IVPROC glad_glVertex2iv; PFNGLGETQUERYBUFFEROBJECTI64VPROC glad_glGetQueryBufferObjecti64v; PFNGLCOLOR3SVPROC glad_glColor3sv; PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; PFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram; PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv; PFNGLNORMALPOINTERPROC glad_glNormalPointer; PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; PFNGLVERTEX4SVPROC glad_glVertex4sv; PFNGLVERTEXARRAYATTRIBLFORMATPROC glad_glVertexArrayAttribLFormat; PFNGLINVALIDATEBUFFERSUBDATAPROC glad_glInvalidateBufferSubData; PFNGLPASSTHROUGHPROC glad_glPassThrough; PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; PFNGLFOGIPROC glad_glFogi; PFNGLBEGINPROC glad_glBegin; PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; PFNGLCOLOR3UBVPROC glad_glColor3ubv; PFNGLVERTEXPOINTERPROC glad_glVertexPointer; PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; PFNGLDRAWARRAYSPROC glad_glDrawArrays; PFNGLUNIFORM1UIPROC glad_glUniform1ui; PFNGLGETTRANSFORMFEEDBACKIVPROC glad_glGetTransformFeedbackiv; PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri; PFNGLLIGHTFVPROC glad_glLightfv; PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; PFNGLCLEARPROC glad_glClear; PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; PFNGLMEMORYBARRIERPROC glad_glMemoryBarrier; PFNGLGETGRAPHICSRESETSTATUSPROC glad_glGetGraphicsResetStatus; PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; PFNGLISENABLEDPROC glad_glIsEnabled; PFNGLSTENCILOPPROC glad_glStencilOp; PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; PFNGLTRANSLATEFPROC glad_glTranslatef; PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; PFNGLTRANSLATEDPROC glad_glTranslated; PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; PFNGLGETTEXTUREPARAMETERIIVPROC glad_glGetTextureParameterIiv; PFNGLTEXIMAGE1DPROC glad_glTexImage1D; PFNGLCOPYTEXTURESUBIMAGE3DPROC glad_glCopyTextureSubImage3D; PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; PFNGLVERTEXARRAYATTRIBIFORMATPROC glad_glVertexArrayAttribIFormat; PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; PFNGLGETTEXIMAGEPROC glad_glGetTexImage; PFNGLFOGCOORDFVPROC glad_glFogCoordfv; PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; PFNGLCREATETEXTURESPROC glad_glCreateTextures; PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glad_glTransformFeedbackBufferBase; PFNGLINDEXSVPROC glad_glIndexsv; PFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage; PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv; PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; PFNGLVERTEX3IVPROC glad_glVertex3iv; PFNGLBITMAPPROC glad_glBitmap; PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog; PFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv; PFNGLMATERIALIPROC glad_glMateriali; PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; PFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv; PFNGLGETQUERYIVPROC glad_glGetQueryiv; PFNGLTEXCOORD4FPROC glad_glTexCoord4f; PFNGLBLITNAMEDFRAMEBUFFERPROC glad_glBlitNamedFramebuffer; PFNGLTEXCOORD4DPROC glad_glTexCoord4d; PFNGLCREATEQUERIESPROC glad_glCreateQueries; PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; PFNGLTEXCOORD4IPROC glad_glTexCoord4i; PFNGLSHADERSTORAGEBLOCKBINDINGPROC glad_glShaderStorageBlockBinding; PFNGLMATERIALFPROC glad_glMaterialf; PFNGLTEXCOORD4SPROC glad_glTexCoord4s; PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv; PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; PFNGLISSHADERPROC glad_glIsShader; PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; PFNGLVERTEX3DVPROC glad_glVertex3dv; PFNGLGETINTEGER64VPROC glad_glGetInteger64v; PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; PFNGLGETNMINMAXPROC glad_glGetnMinmax; PFNGLENABLEPROC glad_glEnable; PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; PFNGLCOLOR4FVPROC glad_glColor4fv; PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; PFNGLVERTEXARRAYATTRIBBINDINGPROC glad_glVertexArrayAttribBinding; PFNGLTEXTURESTORAGE1DPROC glad_glTextureStorage1D; PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup; PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi; PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; PFNGLGETPROGRAMINTERFACEIVPROC glad_glGetProgramInterfaceiv; PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; PFNGLTEXGENFPROC glad_glTexGenf; PFNGLMAPNAMEDBUFFERPROC glad_glMapNamedBuffer; PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; PFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv; PFNGLTEXTUREBUFFERRANGEPROC glad_glTextureBufferRange; PFNGLGETNUNIFORMDVPROC glad_glGetnUniformdv; PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; PFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui; PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glad_glTransformFeedbackBufferRange; PFNGLGETPOINTERVPROC glad_glGetPointerv; PFNGLVERTEXBINDINGDIVISORPROC glad_glVertexBindingDivisor; PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; PFNGLNORMAL3FVPROC glad_glNormal3fv; PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glad_glNamedFramebufferDrawBuffers; PFNGLDEPTHRANGEPROC glad_glDepthRange; PFNGLFRUSTUMPROC glad_glFrustum; PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; PFNGLVERTEXARRAYBINDINGDIVISORPROC glad_glVertexArrayBindingDivisor; PFNGLDRAWBUFFERPROC glad_glDrawBuffer; PFNGLPUSHMATRIXPROC glad_glPushMatrix; PFNGLGETNPIXELMAPUSVPROC glad_glGetnPixelMapusv; PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; PFNGLORTHOPROC glad_glOrtho; PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; PFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv; PFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i; PFNGLUNIFORM2DVPROC glad_glUniform2dv; PFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d; PFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f; PFNGLCLEARINDEXPROC glad_glClearIndex; PFNGLMAP1DPROC glad_glMap1d; PFNGLMAP1FPROC glad_glMap1f; PFNGLFLUSHPROC glad_glFlush; PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed; PFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv; PFNGLINDEXIVPROC glad_glIndexiv; PFNGLNAMEDRENDERBUFFERSTORAGEPROC glad_glNamedRenderbufferStorage; PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; PFNGLPIXELZOOMPROC glad_glPixelZoom; PFNGLPOLYGONOFFSETCLAMPPROC glad_glPolygonOffsetClamp; PFNGLFENCESYNCPROC glad_glFenceSync; PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; PFNGLCOLORP3UIPROC glad_glColorP3ui; PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance; PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC glad_glTextureStorage2DMultisample; PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup; PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; PFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline; PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; PFNGLLIGHTIPROC glad_glLighti; PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; PFNGLVERTEXARRAYVERTEXBUFFERPROC glad_glVertexArrayVertexBuffer; PFNGLLIGHTFPROC glad_glLightf; PFNGLBINDVERTEXBUFFERSPROC glad_glBindVertexBuffers; PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; PFNGLTEXSTORAGE3DMULTISAMPLEPROC glad_glTexStorage3DMultisample; PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; PFNGLDISABLEVERTEXARRAYATTRIBPROC glad_glDisableVertexArrayAttrib; PFNGLGENSAMPLERSPROC glad_glGenSamplers; PFNGLCLAMPCOLORPROC glad_glClampColor; PFNGLUNIFORM4IVPROC glad_glUniform4iv; PFNGLCLEARSTENCILPROC glad_glClearStencil; PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glad_glGetNamedRenderbufferParameteriv; PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glad_glDrawTransformFeedbackInstanced; PFNGLSPECIALIZESHADERPROC glad_glSpecializeShader; PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; PFNGLGENTEXTURESPROC glad_glGenTextures; PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback; PFNGLUNIFORM1DVPROC glad_glUniform1dv; PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; PFNGLGETTRANSFORMFEEDBACKI_VPROC glad_glGetTransformFeedbacki_v; PFNGLINDEXPOINTERPROC glad_glIndexPointer; PFNGLGETNPOLYGONSTIPPLEPROC glad_glGetnPolygonStipple; PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glad_glClearNamedFramebufferuiv; PFNGLGETVERTEXARRAYINDEXEDIVPROC glad_glGetVertexArrayIndexediv; PFNGLISSYNCPROC glad_glIsSync; PFNGLVERTEX2FPROC glad_glVertex2f; PFNGLVERTEX2DPROC glad_glVertex2d; PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; PFNGLUNIFORM2IPROC glad_glUniform2i; PFNGLMAPGRID2DPROC glad_glMapGrid2d; PFNGLMAPGRID2FPROC glad_glMapGrid2f; PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; PFNGLVERTEX2IPROC glad_glVertex2i; PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; PFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui; PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; PFNGLVERTEX2SPROC glad_glVertex2s; PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel; PFNGLTEXTUREPARAMETERIPROC glad_glTextureParameteri; PFNGLNORMAL3BVPROC glad_glNormal3bv; PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; PFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv; PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv; PFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv; PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv; PFNGLDISPATCHCOMPUTEPROC glad_glDispatchCompute; PFNGLVERTEX3SVPROC glad_glVertex3sv; PFNGLGENQUERIESPROC glad_glGenQueries; PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; PFNGLTEXENVFPROC glad_glTexEnvf; PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; PFNGLFOGCOORDDPROC glad_glFogCoordd; PFNGLFOGCOORDFPROC glad_glFogCoordf; PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; PFNGLTEXENVIPROC glad_glTexEnvi; PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; PFNGLISENABLEDIPROC glad_glIsEnabledi; PFNGLBINDBUFFERSRANGEPROC glad_glBindBuffersRange; PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; PFNGLCOPYIMAGESUBDATAPROC glad_glCopyImageSubData; PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; PFNGLUNIFORM2IVPROC glad_glUniform2iv; PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ; PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; PFNGLMATRIXMODEPROC glad_glMatrixMode; PFNGLGETTEXTUREIMAGEPROC glad_glGetTextureImage; PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; PFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv; PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed; PFNGLGETMAPIVPROC glad_glGetMapiv; PFNGLTEXTURESUBIMAGE3DPROC glad_glTextureSubImage3D; PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; PFNGLUNIFORM4DPROC glad_glUniform4d; PFNGLGETSHADERIVPROC glad_glGetShaderiv; PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; PFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv; PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel; PFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer; PFNGLBINDTEXTURESPROC glad_glBindTextures; PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; PFNGLNAMEDBUFFERSTORAGEPROC glad_glNamedBufferStorage; PFNGLSCISSORARRAYVPROC glad_glScissorArrayv; PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; PFNGLCALLLISTPROC glad_glCallList; PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv; PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; PFNGLGETDOUBLEVPROC glad_glGetDoublev; PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; PFNGLUNIFORM4DVPROC glad_glUniform4dv; PFNGLLIGHTMODELFPROC glad_glLightModelf; PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; PFNGLINVALIDATEBUFFERDATAPROC glad_glInvalidateBufferData; PFNGLVERTEX2SVPROC glad_glVertex2sv; PFNGLVERTEXARRAYVERTEXBUFFERSPROC glad_glVertexArrayVertexBuffers; PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glad_glCompressedTextureSubImage1D; PFNGLLIGHTMODELIPROC glad_glLightModeli; PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; PFNGLUNIFORM3FVPROC glad_glUniform3fv; PFNGLPIXELSTOREIPROC glad_glPixelStorei; PFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog; PFNGLCALLLISTSPROC glad_glCallLists; PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv; PFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer; PFNGLMAPBUFFERPROC glad_glMapBuffer; PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; PFNGLTEXCOORD3IPROC glad_glTexCoord3i; PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; PFNGLRASTERPOS3IPROC glad_glRasterPos3i; PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; PFNGLRASTERPOS3DPROC glad_glRasterPos3d; PFNGLRASTERPOS3FPROC glad_glRasterPos3f; PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; PFNGLTEXCOORD3FPROC glad_glTexCoord3f; PFNGLDELETESYNCPROC glad_glDeleteSync; PFNGLTEXCOORD3DPROC glad_glTexCoord3d; PFNGLGETTRANSFORMFEEDBACKI64_VPROC glad_glGetTransformFeedbacki64_v; PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv; PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv; PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; PFNGLTEXCOORD3SPROC glad_glTexCoord3s; PFNGLUNIFORM3IVPROC glad_glUniform3iv; PFNGLRASTERPOS3SPROC glad_glRasterPos3s; PFNGLPOLYGONMODEPROC glad_glPolygonMode; PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; PFNGLGETNHISTOGRAMPROC glad_glGetnHistogram; PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; PFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d; PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv; PFNGLISLISTPROC glad_glIsList; PFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv; PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; PFNGLCOLOR4SPROC glad_glColor4s; PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary; PFNGLUSEPROGRAMPROC glad_glUseProgram; PFNGLLINESTIPPLEPROC glad_glLineStipple; PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; PFNGLCLEARTEXIMAGEPROC glad_glClearTexImage; PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; PFNGLCOLOR4BPROC glad_glColor4b; PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; PFNGLCOLOR4FPROC glad_glColor4f; PFNGLCOLOR4DPROC glad_glColor4d; PFNGLCOLOR4IPROC glad_glColor4i; PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; PFNGLVERTEXATTRIBLFORMATPROC glad_glVertexAttribLFormat; PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; PFNGLTEXTURESTORAGE2DPROC glad_glTextureStorage2D; PFNGLGENERATETEXTUREMIPMAPPROC glad_glGenerateTextureMipmap; PFNGLVERTEX2DVPROC glad_glVertex2dv; PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; PFNGLFINISHPROC glad_glFinish; PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed; PFNGLGETBOOLEANVPROC glad_glGetBooleanv; PFNGLDELETESHADERPROC glad_glDeleteShader; PFNGLDRAWELEMENTSPROC glad_glDrawElements; PFNGLGETINTERNALFORMATI64VPROC glad_glGetInternalformati64v; PFNGLRASTERPOS2SPROC glad_glRasterPos2s; PFNGLCOPYTEXTURESUBIMAGE1DPROC glad_glCopyTextureSubImage1D; PFNGLGETMAPDVPROC glad_glGetMapdv; PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; PFNGLMATERIALFVPROC glad_glMaterialfv; PFNGLTEXTUREPARAMETERIUIVPROC glad_glTextureParameterIuiv; PFNGLVIEWPORTPROC glad_glViewport; PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; PFNGLINDEXDVPROC glad_glIndexdv; PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback; PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; PFNGLINVALIDATETEXIMAGEPROC glad_glInvalidateTexImage; PFNGLVERTEXATTRIBFORMATPROC glad_glVertexAttribFormat; PFNGLCLEARDEPTHPROC glad_glClearDepth; PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; PFNGLTEXPARAMETERFPROC glad_glTexParameterf; PFNGLVERTEXATTRIBBINDINGPROC glad_glVertexAttribBinding; PFNGLTEXPARAMETERIPROC glad_glTexParameteri; PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv; PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; PFNGLCREATETRANSFORMFEEDBACKSPROC glad_glCreateTransformFeedbacks; PFNGLGETNTEXIMAGEPROC glad_glGetnTexImage; PFNGLTEXBUFFERPROC glad_glTexBuffer; PFNGLPOPNAMEPROC glad_glPopName; PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; PFNGLPIXELSTOREFPROC glad_glPixelStoref; PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; PFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf; PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; PFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines; PFNGLRECTIPROC glad_glRecti; PFNGLCOLOR4UBPROC glad_glColor4ub; PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; PFNGLRECTFPROC glad_glRectf; PFNGLRECTDPROC glad_glRectd; PFNGLNORMAL3SVPROC glad_glNormal3sv; PFNGLNEWLISTPROC glad_glNewList; PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv; PFNGLCOLOR4USPROC glad_glColor4us; PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; PFNGLLINKPROGRAMPROC glad_glLinkProgram; PFNGLHINTPROC glad_glHint; PFNGLRECTSPROC glad_glRects; PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel; PFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f; PFNGLGETSTRINGPROC glad_glGetString; PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; PFNGLDETACHSHADERPROC glad_glDetachShader; PFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i; PFNGLSCALEFPROC glad_glScalef; PFNGLENDQUERYPROC glad_glEndQuery; PFNGLSCALEDPROC glad_glScaled; PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; PFNGLFRAMEBUFFERPARAMETERIPROC glad_glFramebufferParameteri; PFNGLGETPROGRAMRESOURCENAMEPROC glad_glGetProgramResourceName; PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv; PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv; PFNGLCOPYPIXELSPROC glad_glCopyPixels; PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; PFNGLGETPROGRAMRESOURCELOCATIONPROC glad_glGetProgramResourceLocation; PFNGLPOPATTRIBPROC glad_glPopAttrib; PFNGLDELETETEXTURESPROC glad_glDeleteTextures; PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glad_glGetActiveAtomicCounterBufferiv; PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; PFNGLGETTEXTUREPARAMETERIVPROC glad_glGetTextureParameteriv; PFNGLDELETEQUERIESPROC glad_glDeleteQueries; PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; PFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv; PFNGLINITNAMESPROC glad_glInitNames; PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; PFNGLCOLOR3DVPROC glad_glColor3dv; PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; PFNGLWAITSYNCPROC glad_glWaitSync; PFNGLCREATEVERTEXARRAYSPROC glad_glCreateVertexArrays; PFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv; PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; PFNGLCOLORMATERIALPROC glad_glColorMaterial; PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; PFNGLCLEARBUFFERSUBDATAPROC glad_glClearBufferSubData; PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; PFNGLTEXSTORAGE1DPROC glad_glTexStorage1D; PFNGLUNIFORM1FPROC glad_glUniform1f; PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; PFNGLUNIFORM1DPROC glad_glUniform1d; PFNGLRENDERMODEPROC glad_glRenderMode; PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; PFNGLGETNCOMPRESSEDTEXIMAGEPROC glad_glGetnCompressedTexImage; PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; PFNGLUNIFORM1IPROC glad_glUniform1i; PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; PFNGLUNIFORM3IPROC glad_glUniform3i; PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; PFNGLDISABLEPROC glad_glDisable; PFNGLLOGICOPPROC glad_glLogicOp; PFNGLEVALPOINT2PROC glad_glEvalPoint2; PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC glad_glMultiDrawArraysIndirectCount; PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; PFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv; PFNGLUNIFORM4UIPROC glad_glUniform4ui; PFNGLCOLOR3FPROC glad_glColor3f; PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glad_glNamedFramebufferReadBuffer; PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; PFNGLRECTFVPROC glad_glRectfv; PFNGLCULLFACEPROC glad_glCullFace; PFNGLGETLIGHTFVPROC glad_glGetLightfv; PFNGLGETNUNIFORMIVPROC glad_glGetnUniformiv; PFNGLCOLOR3DPROC glad_glColor3d; PFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i; PFNGLTEXGENDPROC glad_glTexGend; PFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f; PFNGLTEXGENIPROC glad_glTexGeni; PFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d; PFNGLTEXTUREPARAMETERIIVPROC glad_glTextureParameterIiv; PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; PFNGLGETSTRINGIPROC glad_glGetStringi; PFNGLGETTEXTUREPARAMETERFVPROC glad_glGetTextureParameterfv; PFNGLTEXTURESUBIMAGE2DPROC glad_glTextureSubImage2D; PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream; PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; PFNGLATTACHSHADERPROC glad_glAttachShader; PFNGLFOGCOORDDVPROC glad_glFogCoorddv; PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; PFNGLQUERYCOUNTERPROC glad_glQueryCounter; PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; PFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv; PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; PFNGLSHADERBINARYPROC glad_glShaderBinary; PFNGLUNMAPNAMEDBUFFERPROC glad_glUnmapNamedBuffer; PFNGLGETNCOLORTABLEPROC glad_glGetnColorTable; PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; PFNGLTEXGENIVPROC glad_glTexGeniv; PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glNamedRenderbufferStorageMultisample; PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; PFNGLCLEARNAMEDBUFFERDATAPROC glad_glClearNamedBufferData; PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; PFNGLNORMALP3UIPROC glad_glNormalP3ui; PFNGLTEXENVFVPROC glad_glTexEnvfv; PFNGLREADBUFFERPROC glad_glReadBuffer; PFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv; PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glad_glCompressedTextureSubImage2D; PFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv; PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv; PFNGLLIGHTMODELFVPROC glad_glLightModelfv; PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; PFNGLDELETELISTSPROC glad_glDeleteLists; PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; PFNGLVERTEX4DVPROC glad_glVertex4dv; PFNGLTEXCOORD2DPROC glad_glTexCoord2d; PFNGLPOPMATRIXPROC glad_glPopMatrix; PFNGLTEXCOORD2FPROC glad_glTexCoord2f; PFNGLCOLOR4IVPROC glad_glColor4iv; PFNGLINDEXUBVPROC glad_glIndexubv; PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glad_glCheckNamedFramebufferStatus; PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; PFNGLTEXCOORD2IPROC glad_glTexCoord2i; PFNGLRASTERPOS4DPROC glad_glRasterPos4d; PFNGLRASTERPOS4FPROC glad_glRasterPos4f; PFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv; PFNGLGETVERTEXARRAYIVPROC glad_glGetVertexArrayiv; PFNGLCOPYTEXTURESUBIMAGE2DPROC glad_glCopyTextureSubImage2D; PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; PFNGLTEXCOORD2SPROC glad_glTexCoord2s; PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; PFNGLVERTEX3FVPROC glad_glVertex3fv; PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; PFNGLMATERIALIVPROC glad_glMaterialiv; PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv; PFNGLISPROGRAMPROC glad_glIsProgram; PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; PFNGLVERTEX4SPROC glad_glVertex4s; PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv; PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; PFNGLNORMAL3DVPROC glad_glNormal3dv; PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback; PFNGLUNIFORM4IPROC glad_glUniform4i; PFNGLACTIVETEXTUREPROC glad_glActiveTexture; PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; PFNGLROTATEDPROC glad_glRotated; PFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline; PFNGLROTATEFPROC glad_glRotatef; PFNGLVERTEX4IPROC glad_glVertex4i; PFNGLREADPIXELSPROC glad_glReadPixels; PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; PFNGLLOADNAMEPROC glad_glLoadName; PFNGLUNIFORM4FPROC glad_glUniform4f; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; PFNGLCREATEPROGRAMPIPELINESPROC glad_glCreateProgramPipelines; PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; PFNGLSHADEMODELPROC glad_glShadeModel; PFNGLMAPGRID1DPROC glad_glMapGrid1d; PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; PFNGLMAPGRID1FPROC glad_glMapGrid1f; PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; PFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer; PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; PFNGLGETNUNIFORMFVPROC glad_glGetnUniformfv; PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; PFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv; PFNGLMULTIDRAWELEMENTSINDIRECTPROC glad_glMultiDrawElementsIndirect; PFNGLENABLEVERTEXARRAYATTRIBPROC glad_glEnableVertexArrayAttrib; PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; PFNGLALPHAFUNCPROC glad_glAlphaFunc; PFNGLUNIFORM1IVPROC glad_glUniform1iv; PFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv; PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName; PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; PFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d; PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; PFNGLSTENCILFUNCPROC glad_glStencilFunc; PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glad_glInvalidateNamedFramebufferData; PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; PFNGLCOLOR4UIVPROC glad_glColor4uiv; PFNGLRECTIVPROC glad_glRectiv; PFNGLCOLORP4UIPROC glad_glColorP4ui; PFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages; PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; PFNGLEVALMESH2PROC glad_glEvalMesh2; PFNGLEVALMESH1PROC glad_glEvalMesh1; PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; PFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f; PFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d; PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; PFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv; PFNGLTEXSTORAGE3DPROC glad_glTexStorage3D; PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glad_glNamedFramebufferDrawBuffer; PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv; PFNGLCOLOR4UBVPROC glad_glColor4ubv; PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; PFNGLTEXTUREPARAMETERIVPROC glad_glTextureParameteriv; PFNGLOBJECTLABELPROC glad_glObjectLabel; PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; PFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv; PFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv; PFNGLGETQUERYBUFFEROBJECTIVPROC glad_glGetQueryBufferObjectiv; PFNGLTEXENVIVPROC glad_glTexEnviv; PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; PFNGLGENBUFFERSPROC glad_glGenBuffers; PFNGLSELECTBUFFERPROC glad_glSelectBuffer; PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex; PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; PFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv; PFNGLPUSHATTRIBPROC glad_glPushAttrib; PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; PFNGLBLENDFUNCPROC glad_glBlendFunc; PFNGLCREATEPROGRAMPROC glad_glCreateProgram; PFNGLNAMEDBUFFERSUBDATAPROC glad_glNamedBufferSubData; PFNGLTEXIMAGE3DPROC glad_glTexImage3D; PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; PFNGLCLEARNAMEDFRAMEBUFFERFVPROC glad_glClearNamedFramebufferfv; PFNGLLIGHTIVPROC glad_glLightiv; PFNGLGETNAMEDBUFFERSUBDATAPROC glad_glGetNamedBufferSubData; PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glad_glCompressedTextureSubImage3D; PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glad_glFlushMappedNamedBufferRange; PFNGLINVALIDATETEXSUBIMAGEPROC glad_glInvalidateTexSubImage; PFNGLTEXGENFVPROC glad_glTexGenfv; PFNGLGETTEXTUREPARAMETERIUIVPROC glad_glGetTextureParameterIuiv; PFNGLGETNCONVOLUTIONFILTERPROC glad_glGetnConvolutionFilter; PFNGLBINDIMAGETEXTURESPROC glad_glBindImageTextures; PFNGLENDPROC glad_glEnd; PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; PFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline; PFNGLSCISSORPROC glad_glScissor; PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; PFNGLCLIPPLANEPROC glad_glClipPlane; PFNGLPUSHNAMEPROC glad_glPushName; PFNGLTEXGENDVPROC glad_glTexGendv; PFNGLINDEXUBPROC glad_glIndexub; PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetNamedFramebufferAttachmentParameteriv; PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glad_glNamedFramebufferRenderbuffer; PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; PFNGLRASTERPOS4IPROC glad_glRasterPos4i; PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; PFNGLCLEARCOLORPROC glad_glClearColor; PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; PFNGLNORMAL3SPROC glad_glNormal3s; PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv; PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; PFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv; PFNGLCOLORP4UIVPROC glad_glColorP4uiv; PFNGLBLENDCOLORPROC glad_glBlendColor; PFNGLGETNPIXELMAPUIVPROC glad_glGetnPixelMapuiv; PFNGLGETTEXTURELEVELPARAMETERIVPROC glad_glGetTextureLevelParameteriv; PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; PFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv; PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glad_glGetNamedFramebufferParameteriv; PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; PFNGLUNIFORM3UIPROC glad_glUniform3ui; PFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv; PFNGLCOLOR4DVPROC glad_glColor4dv; PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback; PFNGLUNIFORM2FVPROC glad_glUniform2fv; PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName; PFNGLGETPROGRAMRESOURCEINDEXPROC glad_glGetProgramResourceIndex; PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect; PFNGLGETTEXTURELEVELPARAMETERFVPROC glad_glGetTextureLevelParameterfv; PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; PFNGLGETNAMEDBUFFERPOINTERVPROC glad_glGetNamedBufferPointerv; PFNGLDISPATCHCOMPUTEINDIRECTPROC glad_glDispatchComputeIndirect; PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glad_glInvalidateNamedFramebufferSubData; PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; PFNGLNORMAL3IVPROC glad_glNormal3iv; PFNGLTEXTURESUBIMAGE1DPROC glad_glTextureSubImage1D; PFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv; PFNGLGETUNIFORMDVPROC glad_glGetUniformdv; PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; PFNGLCLEARDEPTHFPROC glad_glClearDepthf; PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; PFNGLGETTEXTURESUBIMAGEPROC glad_glGetTextureSubImage; PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks; PFNGLCOLOR3USPROC glad_glColor3us; PFNGLCOLOR3UIVPROC glad_glColor3uiv; PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; PFNGLGETLIGHTIVPROC glad_glGetLightiv; PFNGLDEPTHFUNCPROC glad_glDepthFunc; PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; PFNGLLISTBASEPROC glad_glListBase; PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; PFNGLCOLOR3UBPROC glad_glColor3ub; PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei; PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; PFNGLCOLOR3UIPROC glad_glColor3ui; PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glad_glGetProgramResourceLocationIndex; PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; PFNGLBUFFERSTORAGEPROC glad_glBufferStorage; PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; PFNGLGETFLOATI_VPROC glad_glGetFloati_v; PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; PFNGLCOLORMASKPROC glad_glColorMask; PFNGLTEXTUREBUFFERPROC glad_glTextureBuffer; PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; PFNGLBLENDEQUATIONPROC glad_glBlendEquation; PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; PFNGLVERTEXARRAYATTRIBFORMATPROC glad_glVertexArrayAttribFormat; PFNGLREADNPIXELSPROC glad_glReadnPixels; PFNGLRASTERPOS4SPROC glad_glRasterPos4s; PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv; PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; PFNGLBINDVERTEXBUFFERPROC glad_glBindVertexBuffer; PFNGLCOLOR4SVPROC glad_glColor4sv; PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert; PFNGLCREATESAMPLERSPROC glad_glCreateSamplers; PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; PFNGLCLEARBUFFERDATAPROC glad_glClearBufferData; PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; PFNGLFOGFPROC glad_glFogf; PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; PFNGLPROGRAMBINARYPROC glad_glProgramBinary; PFNGLISSAMPLERPROC glad_glIsSampler; PFNGLVERTEXP3UIPROC glad_glVertexP3ui; PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; PFNGLBINDSAMPLERSPROC glad_glBindSamplers; PFNGLCOLOR3IVPROC glad_glColor3iv; PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks; PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; PFNGLTEXCOORD1IPROC glad_glTexCoord1i; PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; PFNGLTEXCOORD1DPROC glad_glTexCoord1d; PFNGLTEXCOORD1FPROC glad_glTexCoord1f; PFNGLTEXTURESTORAGE3DPROC glad_glTextureStorage3D; PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv; PFNGLBLENDFUNCIPROC glad_glBlendFunci; PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; PFNGLTEXCOORD1SPROC glad_glTexCoord1s; PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; PFNGLGENLISTSPROC glad_glGenLists; PFNGLCOLOR3BVPROC glad_glColor3bv; PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei; PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv; PFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d; PFNGLGETTEXGENDVPROC glad_glGetTexGendv; PFNGLCLEARNAMEDFRAMEBUFFERIVPROC glad_glClearNamedFramebufferiv; PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; PFNGLENDLISTPROC glad_glEndList; PFNGLSCISSORINDEXEDPROC glad_glScissorIndexed; PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; PFNGLUNIFORM2UIPROC glad_glUniform2ui; PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; PFNGLGETNMAPDVPROC glad_glGetnMapdv; PFNGLCOLOR3USVPROC glad_glColor3usv; PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; PFNGLTEXTUREVIEWPROC glad_glTextureView; PFNGLDISABLEIPROC glad_glDisablei; PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv; PFNGLCREATERENDERBUFFERSPROC glad_glCreateRenderbuffers; PFNGLINDEXMASKPROC glad_glIndexMask; PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; PFNGLSHADERSOURCEPROC glad_glShaderSource; PFNGLGETNSEPARABLEFILTERPROC glad_glGetnSeparableFilter; PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; PFNGLVERTEXATTRIBIFORMATPROC glad_glVertexAttribIFormat; PFNGLCREATEFRAMEBUFFERSPROC glad_glCreateFramebuffers; PFNGLCLEARACCUMPROC glad_glClearAccum; PFNGLGETSYNCIVPROC glad_glGetSynciv; PFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv; PFNGLGETNPIXELMAPFVPROC glad_glGetnPixelMapfv; PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri; PFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i; PFNGLUNIFORM2FPROC glad_glUniform2f; PFNGLGETNAMEDBUFFERPARAMETERI64VPROC glad_glGetNamedBufferParameteri64v; PFNGLBEGINQUERYPROC glad_glBeginQuery; PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; PFNGLBINDBUFFERPROC glad_glBindBuffer; PFNGLMAP2DPROC glad_glMap2d; PFNGLMAP2FPROC glad_glMap2f; PFNGLTEXSTORAGE2DMULTISAMPLEPROC glad_glTexStorage2DMultisample; PFNGLUNIFORM2DPROC glad_glUniform2d; PFNGLVERTEX4DPROC glad_glVertex4d; PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; PFNGLBUFFERDATAPROC glad_glBufferData; PFNGLEVALPOINT1PROC glad_glEvalPoint1; PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; PFNGLGETQUERYBUFFEROBJECTUI64VPROC glad_glGetQueryBufferObjectui64v; PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; PFNGLGETERRORPROC glad_glGetError; PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; PFNGLGETFLOATVPROC glad_glGetFloatv; PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv; PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; PFNGLPIXELMAPFVPROC glad_glPixelMapfv; PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; PFNGLGETINTEGERVPROC glad_glGetIntegerv; PFNGLACCUMPROC glad_glAccum; PFNGLGETVERTEXARRAYINDEXED64IVPROC glad_glGetVertexArrayIndexed64iv; PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; PFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv; PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; PFNGLTEXTUREBARRIERPROC glad_glTextureBarrier; PFNGLISQUERYPROC glad_glIsQuery; PFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui; PFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui; PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; PFNGLTEXIMAGE2DPROC glad_glTexImage2D; PFNGLSTENCILMASKPROC glad_glStencilMask; PFNGLDRAWPIXELSPROC glad_glDrawPixels; PFNGLMULTMATRIXDPROC glad_glMultMatrixd; PFNGLMULTMATRIXFPROC glad_glMultMatrixf; PFNGLISTEXTUREPROC glad_glIsTexture; PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; PFNGLNAMEDBUFFERDATAPROC glad_glNamedBufferData; PFNGLUNIFORM1FVPROC glad_glUniform1fv; PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; PFNGLTEXSTORAGE2DPROC glad_glTexStorage2D; PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; PFNGLCLEARNAMEDBUFFERSUBDATAPROC glad_glClearNamedBufferSubData; PFNGLMAPNAMEDBUFFERRANGEPROC glad_glMapNamedBufferRange; PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glad_glNamedFramebufferTextureLayer; PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; PFNGLVERTEX4FPROC glad_glVertex4f; PFNGLRECTSVPROC glad_glRectsv; PFNGLCOLOR4USVPROC glad_glColor4usv; PFNGLUNIFORM3DVPROC glad_glUniform3dv; PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv; PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; PFNGLBINDBUFFERSBASEPROC glad_glBindBuffersBase; PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation; PFNGLNORMAL3IPROC glad_glNormal3i; PFNGLNORMAL3FPROC glad_glNormal3f; PFNGLNORMAL3DPROC glad_glNormal3d; PFNGLNORMAL3BPROC glad_glNormal3b; PFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_glGetFramebufferParameteriv; PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; PFNGLARRAYELEMENTPROC glad_glArrayElement; PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glad_glGetCompressedTextureSubImage; PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback; PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; PFNGLDEPTHMASKPROC glad_glDepthMask; PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; PFNGLCOLOR3FVPROC glad_glColor3fv; PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; PFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv; PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; PFNGLUNIFORM4FVPROC glad_glUniform4fv; PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; PFNGLCOLORPOINTERPROC glad_glColorPointer; PFNGLFRONTFACEPROC glad_glFrontFace; PFNGLTEXBUFFERRANGEPROC glad_glTexBufferRange; PFNGLCREATEBUFFERSPROC glad_glCreateBuffers; PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glad_glNamedFramebufferParameteri; PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glad_glDrawArraysInstancedBaseInstance; PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; PFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d; PFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines; PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; PFNGLCLIPCONTROLPROC glad_glClipControl; PFNGLGETPROGRAMRESOURCEIVPROC glad_glGetProgramResourceiv; static void load_GL_VERSION_1_0(GLADloadproc load) { if(!GLAD_GL_VERSION_1_0) return; glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); glad_glHint = (PFNGLHINTPROC)load("glHint"); glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); glad_glClear = (PFNGLCLEARPROC)load("glClear"); glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); glad_glNewList = (PFNGLNEWLISTPROC)load("glNewList"); glad_glEndList = (PFNGLENDLISTPROC)load("glEndList"); glad_glCallList = (PFNGLCALLLISTPROC)load("glCallList"); glad_glCallLists = (PFNGLCALLLISTSPROC)load("glCallLists"); glad_glDeleteLists = (PFNGLDELETELISTSPROC)load("glDeleteLists"); glad_glGenLists = (PFNGLGENLISTSPROC)load("glGenLists"); glad_glListBase = (PFNGLLISTBASEPROC)load("glListBase"); glad_glBegin = (PFNGLBEGINPROC)load("glBegin"); glad_glBitmap = (PFNGLBITMAPPROC)load("glBitmap"); glad_glColor3b = (PFNGLCOLOR3BPROC)load("glColor3b"); glad_glColor3bv = (PFNGLCOLOR3BVPROC)load("glColor3bv"); glad_glColor3d = (PFNGLCOLOR3DPROC)load("glColor3d"); glad_glColor3dv = (PFNGLCOLOR3DVPROC)load("glColor3dv"); glad_glColor3f = (PFNGLCOLOR3FPROC)load("glColor3f"); glad_glColor3fv = (PFNGLCOLOR3FVPROC)load("glColor3fv"); glad_glColor3i = (PFNGLCOLOR3IPROC)load("glColor3i"); glad_glColor3iv = (PFNGLCOLOR3IVPROC)load("glColor3iv"); glad_glColor3s = (PFNGLCOLOR3SPROC)load("glColor3s"); glad_glColor3sv = (PFNGLCOLOR3SVPROC)load("glColor3sv"); glad_glColor3ub = (PFNGLCOLOR3UBPROC)load("glColor3ub"); glad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load("glColor3ubv"); glad_glColor3ui = (PFNGLCOLOR3UIPROC)load("glColor3ui"); glad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load("glColor3uiv"); glad_glColor3us = (PFNGLCOLOR3USPROC)load("glColor3us"); glad_glColor3usv = (PFNGLCOLOR3USVPROC)load("glColor3usv"); glad_glColor4b = (PFNGLCOLOR4BPROC)load("glColor4b"); glad_glColor4bv = (PFNGLCOLOR4BVPROC)load("glColor4bv"); glad_glColor4d = (PFNGLCOLOR4DPROC)load("glColor4d"); glad_glColor4dv = (PFNGLCOLOR4DVPROC)load("glColor4dv"); glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); glad_glColor4fv = (PFNGLCOLOR4FVPROC)load("glColor4fv"); glad_glColor4i = (PFNGLCOLOR4IPROC)load("glColor4i"); glad_glColor4iv = (PFNGLCOLOR4IVPROC)load("glColor4iv"); glad_glColor4s = (PFNGLCOLOR4SPROC)load("glColor4s"); glad_glColor4sv = (PFNGLCOLOR4SVPROC)load("glColor4sv"); glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); glad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load("glColor4ubv"); glad_glColor4ui = (PFNGLCOLOR4UIPROC)load("glColor4ui"); glad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load("glColor4uiv"); glad_glColor4us = (PFNGLCOLOR4USPROC)load("glColor4us"); glad_glColor4usv = (PFNGLCOLOR4USVPROC)load("glColor4usv"); glad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load("glEdgeFlag"); glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load("glEdgeFlagv"); glad_glEnd = (PFNGLENDPROC)load("glEnd"); glad_glIndexd = (PFNGLINDEXDPROC)load("glIndexd"); glad_glIndexdv = (PFNGLINDEXDVPROC)load("glIndexdv"); glad_glIndexf = (PFNGLINDEXFPROC)load("glIndexf"); glad_glIndexfv = (PFNGLINDEXFVPROC)load("glIndexfv"); glad_glIndexi = (PFNGLINDEXIPROC)load("glIndexi"); glad_glIndexiv = (PFNGLINDEXIVPROC)load("glIndexiv"); glad_glIndexs = (PFNGLINDEXSPROC)load("glIndexs"); glad_glIndexsv = (PFNGLINDEXSVPROC)load("glIndexsv"); glad_glNormal3b = (PFNGLNORMAL3BPROC)load("glNormal3b"); glad_glNormal3bv = (PFNGLNORMAL3BVPROC)load("glNormal3bv"); glad_glNormal3d = (PFNGLNORMAL3DPROC)load("glNormal3d"); glad_glNormal3dv = (PFNGLNORMAL3DVPROC)load("glNormal3dv"); glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); glad_glNormal3fv = (PFNGLNORMAL3FVPROC)load("glNormal3fv"); glad_glNormal3i = (PFNGLNORMAL3IPROC)load("glNormal3i"); glad_glNormal3iv = (PFNGLNORMAL3IVPROC)load("glNormal3iv"); glad_glNormal3s = (PFNGLNORMAL3SPROC)load("glNormal3s"); glad_glNormal3sv = (PFNGLNORMAL3SVPROC)load("glNormal3sv"); glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load("glRasterPos2d"); glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load("glRasterPos2dv"); glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load("glRasterPos2f"); glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load("glRasterPos2fv"); glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load("glRasterPos2i"); glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load("glRasterPos2iv"); glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load("glRasterPos2s"); glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load("glRasterPos2sv"); glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load("glRasterPos3d"); glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load("glRasterPos3dv"); glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load("glRasterPos3f"); glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load("glRasterPos3fv"); glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load("glRasterPos3i"); glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load("glRasterPos3iv"); glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load("glRasterPos3s"); glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load("glRasterPos3sv"); glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load("glRasterPos4d"); glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load("glRasterPos4dv"); glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load("glRasterPos4f"); glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load("glRasterPos4fv"); glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load("glRasterPos4i"); glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load("glRasterPos4iv"); glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load("glRasterPos4s"); glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load("glRasterPos4sv"); glad_glRectd = (PFNGLRECTDPROC)load("glRectd"); glad_glRectdv = (PFNGLRECTDVPROC)load("glRectdv"); glad_glRectf = (PFNGLRECTFPROC)load("glRectf"); glad_glRectfv = (PFNGLRECTFVPROC)load("glRectfv"); glad_glRecti = (PFNGLRECTIPROC)load("glRecti"); glad_glRectiv = (PFNGLRECTIVPROC)load("glRectiv"); glad_glRects = (PFNGLRECTSPROC)load("glRects"); glad_glRectsv = (PFNGLRECTSVPROC)load("glRectsv"); glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load("glTexCoord1d"); glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load("glTexCoord1dv"); glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load("glTexCoord1f"); glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load("glTexCoord1fv"); glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load("glTexCoord1i"); glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load("glTexCoord1iv"); glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load("glTexCoord1s"); glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load("glTexCoord1sv"); glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load("glTexCoord2d"); glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load("glTexCoord2dv"); glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load("glTexCoord2f"); glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load("glTexCoord2fv"); glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load("glTexCoord2i"); glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load("glTexCoord2iv"); glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load("glTexCoord2s"); glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load("glTexCoord2sv"); glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load("glTexCoord3d"); glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load("glTexCoord3dv"); glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load("glTexCoord3f"); glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load("glTexCoord3fv"); glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load("glTexCoord3i"); glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load("glTexCoord3iv"); glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load("glTexCoord3s"); glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load("glTexCoord3sv"); glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load("glTexCoord4d"); glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load("glTexCoord4dv"); glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load("glTexCoord4f"); glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load("glTexCoord4fv"); glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load("glTexCoord4i"); glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load("glTexCoord4iv"); glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load("glTexCoord4s"); glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load("glTexCoord4sv"); glad_glVertex2d = (PFNGLVERTEX2DPROC)load("glVertex2d"); glad_glVertex2dv = (PFNGLVERTEX2DVPROC)load("glVertex2dv"); glad_glVertex2f = (PFNGLVERTEX2FPROC)load("glVertex2f"); glad_glVertex2fv = (PFNGLVERTEX2FVPROC)load("glVertex2fv"); glad_glVertex2i = (PFNGLVERTEX2IPROC)load("glVertex2i"); glad_glVertex2iv = (PFNGLVERTEX2IVPROC)load("glVertex2iv"); glad_glVertex2s = (PFNGLVERTEX2SPROC)load("glVertex2s"); glad_glVertex2sv = (PFNGLVERTEX2SVPROC)load("glVertex2sv"); glad_glVertex3d = (PFNGLVERTEX3DPROC)load("glVertex3d"); glad_glVertex3dv = (PFNGLVERTEX3DVPROC)load("glVertex3dv"); glad_glVertex3f = (PFNGLVERTEX3FPROC)load("glVertex3f"); glad_glVertex3fv = (PFNGLVERTEX3FVPROC)load("glVertex3fv"); glad_glVertex3i = (PFNGLVERTEX3IPROC)load("glVertex3i"); glad_glVertex3iv = (PFNGLVERTEX3IVPROC)load("glVertex3iv"); glad_glVertex3s = (PFNGLVERTEX3SPROC)load("glVertex3s"); glad_glVertex3sv = (PFNGLVERTEX3SVPROC)load("glVertex3sv"); glad_glVertex4d = (PFNGLVERTEX4DPROC)load("glVertex4d"); glad_glVertex4dv = (PFNGLVERTEX4DVPROC)load("glVertex4dv"); glad_glVertex4f = (PFNGLVERTEX4FPROC)load("glVertex4f"); glad_glVertex4fv = (PFNGLVERTEX4FVPROC)load("glVertex4fv"); glad_glVertex4i = (PFNGLVERTEX4IPROC)load("glVertex4i"); glad_glVertex4iv = (PFNGLVERTEX4IVPROC)load("glVertex4iv"); glad_glVertex4s = (PFNGLVERTEX4SPROC)load("glVertex4s"); glad_glVertex4sv = (PFNGLVERTEX4SVPROC)load("glVertex4sv"); glad_glClipPlane = (PFNGLCLIPPLANEPROC)load("glClipPlane"); glad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load("glColorMaterial"); glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); glad_glFogi = (PFNGLFOGIPROC)load("glFogi"); glad_glFogiv = (PFNGLFOGIVPROC)load("glFogiv"); glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); glad_glLighti = (PFNGLLIGHTIPROC)load("glLighti"); glad_glLightiv = (PFNGLLIGHTIVPROC)load("glLightiv"); glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); glad_glLightModeli = (PFNGLLIGHTMODELIPROC)load("glLightModeli"); glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load("glLightModeliv"); glad_glLineStipple = (PFNGLLINESTIPPLEPROC)load("glLineStipple"); glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); glad_glMateriali = (PFNGLMATERIALIPROC)load("glMateriali"); glad_glMaterialiv = (PFNGLMATERIALIVPROC)load("glMaterialiv"); glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load("glPolygonStipple"); glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); glad_glTexGend = (PFNGLTEXGENDPROC)load("glTexGend"); glad_glTexGendv = (PFNGLTEXGENDVPROC)load("glTexGendv"); glad_glTexGenf = (PFNGLTEXGENFPROC)load("glTexGenf"); glad_glTexGenfv = (PFNGLTEXGENFVPROC)load("glTexGenfv"); glad_glTexGeni = (PFNGLTEXGENIPROC)load("glTexGeni"); glad_glTexGeniv = (PFNGLTEXGENIVPROC)load("glTexGeniv"); glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load("glFeedbackBuffer"); glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load("glSelectBuffer"); glad_glRenderMode = (PFNGLRENDERMODEPROC)load("glRenderMode"); glad_glInitNames = (PFNGLINITNAMESPROC)load("glInitNames"); glad_glLoadName = (PFNGLLOADNAMEPROC)load("glLoadName"); glad_glPassThrough = (PFNGLPASSTHROUGHPROC)load("glPassThrough"); glad_glPopName = (PFNGLPOPNAMEPROC)load("glPopName"); glad_glPushName = (PFNGLPUSHNAMEPROC)load("glPushName"); glad_glClearAccum = (PFNGLCLEARACCUMPROC)load("glClearAccum"); glad_glClearIndex = (PFNGLCLEARINDEXPROC)load("glClearIndex"); glad_glIndexMask = (PFNGLINDEXMASKPROC)load("glIndexMask"); glad_glAccum = (PFNGLACCUMPROC)load("glAccum"); glad_glPopAttrib = (PFNGLPOPATTRIBPROC)load("glPopAttrib"); glad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load("glPushAttrib"); glad_glMap1d = (PFNGLMAP1DPROC)load("glMap1d"); glad_glMap1f = (PFNGLMAP1FPROC)load("glMap1f"); glad_glMap2d = (PFNGLMAP2DPROC)load("glMap2d"); glad_glMap2f = (PFNGLMAP2FPROC)load("glMap2f"); glad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load("glMapGrid1d"); glad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load("glMapGrid1f"); glad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load("glMapGrid2d"); glad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load("glMapGrid2f"); glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load("glEvalCoord1d"); glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load("glEvalCoord1dv"); glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load("glEvalCoord1f"); glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load("glEvalCoord1fv"); glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load("glEvalCoord2d"); glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load("glEvalCoord2dv"); glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load("glEvalCoord2f"); glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load("glEvalCoord2fv"); glad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load("glEvalMesh1"); glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load("glEvalPoint1"); glad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load("glEvalMesh2"); glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load("glEvalPoint2"); glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); glad_glPixelZoom = (PFNGLPIXELZOOMPROC)load("glPixelZoom"); glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load("glPixelTransferf"); glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load("glPixelTransferi"); glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load("glPixelMapfv"); glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load("glPixelMapuiv"); glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load("glPixelMapusv"); glad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load("glCopyPixels"); glad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load("glDrawPixels"); glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load("glGetClipPlane"); glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); glad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load("glGetLightiv"); glad_glGetMapdv = (PFNGLGETMAPDVPROC)load("glGetMapdv"); glad_glGetMapfv = (PFNGLGETMAPFVPROC)load("glGetMapfv"); glad_glGetMapiv = (PFNGLGETMAPIVPROC)load("glGetMapiv"); glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load("glGetMaterialiv"); glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load("glGetPixelMapfv"); glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load("glGetPixelMapuiv"); glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load("glGetPixelMapusv"); glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load("glGetPolygonStipple"); glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load("glGetTexGendv"); glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load("glGetTexGenfv"); glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load("glGetTexGeniv"); glad_glIsList = (PFNGLISLISTPROC)load("glIsList"); glad_glFrustum = (PFNGLFRUSTUMPROC)load("glFrustum"); glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load("glLoadMatrixd"); glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load("glMultMatrixd"); glad_glOrtho = (PFNGLORTHOPROC)load("glOrtho"); glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); glad_glRotated = (PFNGLROTATEDPROC)load("glRotated"); glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); glad_glScaled = (PFNGLSCALEDPROC)load("glScaled"); glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); glad_glTranslated = (PFNGLTRANSLATEDPROC)load("glTranslated"); glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); } static void load_GL_VERSION_1_1(GLADloadproc load) { if(!GLAD_GL_VERSION_1_1) return; glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); glad_glArrayElement = (PFNGLARRAYELEMENTPROC)load("glArrayElement"); glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load("glEdgeFlagPointer"); glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); glad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load("glIndexPointer"); glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load("glInterleavedArrays"); glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load("glAreTexturesResident"); glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load("glPrioritizeTextures"); glad_glIndexub = (PFNGLINDEXUBPROC)load("glIndexub"); glad_glIndexubv = (PFNGLINDEXUBVPROC)load("glIndexubv"); glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load("glPopClientAttrib"); glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load("glPushClientAttrib"); } static void load_GL_VERSION_1_2(GLADloadproc load) { if(!GLAD_GL_VERSION_1_2) return; glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); } static void load_GL_VERSION_1_3(GLADloadproc load) { if(!GLAD_GL_VERSION_1_3) return; glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load("glMultiTexCoord1d"); glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load("glMultiTexCoord1dv"); glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load("glMultiTexCoord1f"); glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load("glMultiTexCoord1fv"); glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load("glMultiTexCoord1i"); glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load("glMultiTexCoord1iv"); glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load("glMultiTexCoord1s"); glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load("glMultiTexCoord1sv"); glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load("glMultiTexCoord2d"); glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load("glMultiTexCoord2dv"); glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load("glMultiTexCoord2f"); glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load("glMultiTexCoord2fv"); glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load("glMultiTexCoord2i"); glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load("glMultiTexCoord2iv"); glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load("glMultiTexCoord2s"); glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load("glMultiTexCoord2sv"); glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load("glMultiTexCoord3d"); glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load("glMultiTexCoord3dv"); glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load("glMultiTexCoord3f"); glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load("glMultiTexCoord3fv"); glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load("glMultiTexCoord3i"); glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load("glMultiTexCoord3iv"); glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load("glMultiTexCoord3s"); glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load("glMultiTexCoord3sv"); glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load("glMultiTexCoord4d"); glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load("glMultiTexCoord4dv"); glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load("glMultiTexCoord4fv"); glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load("glMultiTexCoord4i"); glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load("glMultiTexCoord4iv"); glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load("glMultiTexCoord4s"); glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load("glMultiTexCoord4sv"); glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load("glLoadTransposeMatrixf"); glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load("glLoadTransposeMatrixd"); glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load("glMultTransposeMatrixf"); glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load("glMultTransposeMatrixd"); } static void load_GL_VERSION_1_4(GLADloadproc load) { if(!GLAD_GL_VERSION_1_4) return; glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); glad_glFogCoordf = (PFNGLFOGCOORDFPROC)load("glFogCoordf"); glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load("glFogCoordfv"); glad_glFogCoordd = (PFNGLFOGCOORDDPROC)load("glFogCoordd"); glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load("glFogCoorddv"); glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load("glFogCoordPointer"); glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load("glSecondaryColor3b"); glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load("glSecondaryColor3bv"); glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load("glSecondaryColor3d"); glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load("glSecondaryColor3dv"); glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load("glSecondaryColor3f"); glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load("glSecondaryColor3fv"); glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load("glSecondaryColor3i"); glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load("glSecondaryColor3iv"); glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load("glSecondaryColor3s"); glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load("glSecondaryColor3sv"); glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load("glSecondaryColor3ub"); glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load("glSecondaryColor3ubv"); glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load("glSecondaryColor3ui"); glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load("glSecondaryColor3uiv"); glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load("glSecondaryColor3us"); glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load("glSecondaryColor3usv"); glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load("glSecondaryColorPointer"); glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load("glWindowPos2d"); glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load("glWindowPos2dv"); glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load("glWindowPos2f"); glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load("glWindowPos2fv"); glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load("glWindowPos2i"); glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load("glWindowPos2iv"); glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load("glWindowPos2s"); glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load("glWindowPos2sv"); glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load("glWindowPos3d"); glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load("glWindowPos3dv"); glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load("glWindowPos3f"); glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load("glWindowPos3fv"); glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load("glWindowPos3i"); glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load("glWindowPos3iv"); glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load("glWindowPos3s"); glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load("glWindowPos3sv"); glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); } static void load_GL_VERSION_1_5(GLADloadproc load) { if(!GLAD_GL_VERSION_1_5) return; glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); } static void load_GL_VERSION_2_0(GLADloadproc load) { if(!GLAD_GL_VERSION_2_0) return; glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); } static void load_GL_VERSION_2_1(GLADloadproc load) { if(!GLAD_GL_VERSION_2_1) return; glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); } static void load_GL_VERSION_3_0(GLADloadproc load) { if(!GLAD_GL_VERSION_3_0) return; glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski"); glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v"); glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei"); glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei"); glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi"); glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor"); glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender"); glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender"); glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i"); glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i"); glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i"); glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui"); glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui"); glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui"); glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv"); glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv"); glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv"); glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv"); glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv"); glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv"); glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv"); glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv"); glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv"); glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv"); glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation"); glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv"); glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv"); glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv"); glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv"); glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D"); glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D"); glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); } static void load_GL_VERSION_3_1(GLADloadproc load) { if(!GLAD_GL_VERSION_3_1) return; glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer"); glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex"); glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName"); glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); } static void load_GL_VERSION_3_2(GLADloadproc load) { if(!GLAD_GL_VERSION_3_2) return; glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex"); glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex"); glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex"); glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex"); glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex"); glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture"); glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample"); glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample"); glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv"); glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski"); } static void load_GL_VERSION_3_3(GLADloadproc load) { if(!GLAD_GL_VERSION_3_3) return; glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed"); glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex"); glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers"); glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers"); glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler"); glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler"); glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri"); glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv"); glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf"); glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv"); glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)load("glSamplerParameterIiv"); glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)load("glSamplerParameterIuiv"); glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv"); glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)load("glGetSamplerParameterIiv"); glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv"); glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)load("glGetSamplerParameterIuiv"); glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load("glQueryCounter"); glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load("glGetQueryObjecti64v"); glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load("glGetQueryObjectui64v"); glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor"); glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)load("glVertexAttribP1ui"); glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)load("glVertexAttribP1uiv"); glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)load("glVertexAttribP2ui"); glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)load("glVertexAttribP2uiv"); glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)load("glVertexAttribP3ui"); glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)load("glVertexAttribP3uiv"); glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)load("glVertexAttribP4ui"); glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)load("glVertexAttribP4uiv"); glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC)load("glVertexP2ui"); glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)load("glVertexP2uiv"); glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC)load("glVertexP3ui"); glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)load("glVertexP3uiv"); glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC)load("glVertexP4ui"); glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)load("glVertexP4uiv"); glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)load("glTexCoordP1ui"); glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)load("glTexCoordP1uiv"); glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)load("glTexCoordP2ui"); glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)load("glTexCoordP2uiv"); glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)load("glTexCoordP3ui"); glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)load("glTexCoordP3uiv"); glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)load("glTexCoordP4ui"); glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)load("glTexCoordP4uiv"); glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)load("glMultiTexCoordP1ui"); glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)load("glMultiTexCoordP1uiv"); glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)load("glMultiTexCoordP2ui"); glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)load("glMultiTexCoordP2uiv"); glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)load("glMultiTexCoordP3ui"); glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)load("glMultiTexCoordP3uiv"); glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)load("glMultiTexCoordP4ui"); glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)load("glMultiTexCoordP4uiv"); glad_glNormalP3ui = (PFNGLNORMALP3UIPROC)load("glNormalP3ui"); glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC)load("glNormalP3uiv"); glad_glColorP3ui = (PFNGLCOLORP3UIPROC)load("glColorP3ui"); glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC)load("glColorP3uiv"); glad_glColorP4ui = (PFNGLCOLORP4UIPROC)load("glColorP4ui"); glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC)load("glColorP4uiv"); glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui"); glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv"); } static void load_GL_VERSION_4_0(GLADloadproc load) { if(!GLAD_GL_VERSION_4_0) return; glad_glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)load("glMinSampleShading"); glad_glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)load("glBlendEquationi"); glad_glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)load("glBlendEquationSeparatei"); glad_glBlendFunci = (PFNGLBLENDFUNCIPROC)load("glBlendFunci"); glad_glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)load("glBlendFuncSeparatei"); glad_glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)load("glDrawArraysIndirect"); glad_glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)load("glDrawElementsIndirect"); glad_glUniform1d = (PFNGLUNIFORM1DPROC)load("glUniform1d"); glad_glUniform2d = (PFNGLUNIFORM2DPROC)load("glUniform2d"); glad_glUniform3d = (PFNGLUNIFORM3DPROC)load("glUniform3d"); glad_glUniform4d = (PFNGLUNIFORM4DPROC)load("glUniform4d"); glad_glUniform1dv = (PFNGLUNIFORM1DVPROC)load("glUniform1dv"); glad_glUniform2dv = (PFNGLUNIFORM2DVPROC)load("glUniform2dv"); glad_glUniform3dv = (PFNGLUNIFORM3DVPROC)load("glUniform3dv"); glad_glUniform4dv = (PFNGLUNIFORM4DVPROC)load("glUniform4dv"); glad_glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)load("glUniformMatrix2dv"); glad_glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)load("glUniformMatrix3dv"); glad_glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)load("glUniformMatrix4dv"); glad_glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)load("glUniformMatrix2x3dv"); glad_glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)load("glUniformMatrix2x4dv"); glad_glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)load("glUniformMatrix3x2dv"); glad_glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)load("glUniformMatrix3x4dv"); glad_glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)load("glUniformMatrix4x2dv"); glad_glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)load("glUniformMatrix4x3dv"); glad_glGetUniformdv = (PFNGLGETUNIFORMDVPROC)load("glGetUniformdv"); glad_glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)load("glGetSubroutineUniformLocation"); glad_glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)load("glGetSubroutineIndex"); glad_glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)load("glGetActiveSubroutineUniformiv"); glad_glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)load("glGetActiveSubroutineUniformName"); glad_glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)load("glGetActiveSubroutineName"); glad_glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)load("glUniformSubroutinesuiv"); glad_glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)load("glGetUniformSubroutineuiv"); glad_glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)load("glGetProgramStageiv"); glad_glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)load("glPatchParameteri"); glad_glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)load("glPatchParameterfv"); glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)load("glBindTransformFeedback"); glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)load("glDeleteTransformFeedbacks"); glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)load("glGenTransformFeedbacks"); glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)load("glIsTransformFeedback"); glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)load("glPauseTransformFeedback"); glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)load("glResumeTransformFeedback"); glad_glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)load("glDrawTransformFeedback"); glad_glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)load("glDrawTransformFeedbackStream"); glad_glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)load("glBeginQueryIndexed"); glad_glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)load("glEndQueryIndexed"); glad_glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)load("glGetQueryIndexediv"); } static void load_GL_VERSION_4_1(GLADloadproc load) { if(!GLAD_GL_VERSION_4_1) return; glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)load("glReleaseShaderCompiler"); glad_glShaderBinary = (PFNGLSHADERBINARYPROC)load("glShaderBinary"); glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)load("glGetShaderPrecisionFormat"); glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); glad_glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)load("glGetProgramBinary"); glad_glProgramBinary = (PFNGLPROGRAMBINARYPROC)load("glProgramBinary"); glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); glad_glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)load("glUseProgramStages"); glad_glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)load("glActiveShaderProgram"); glad_glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)load("glCreateShaderProgramv"); glad_glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)load("glBindProgramPipeline"); glad_glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)load("glDeleteProgramPipelines"); glad_glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)load("glGenProgramPipelines"); glad_glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)load("glIsProgramPipeline"); glad_glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)load("glGetProgramPipelineiv"); glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); glad_glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)load("glProgramUniform1i"); glad_glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)load("glProgramUniform1iv"); glad_glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)load("glProgramUniform1f"); glad_glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)load("glProgramUniform1fv"); glad_glProgramUniform1d = (PFNGLPROGRAMUNIFORM1DPROC)load("glProgramUniform1d"); glad_glProgramUniform1dv = (PFNGLPROGRAMUNIFORM1DVPROC)load("glProgramUniform1dv"); glad_glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)load("glProgramUniform1ui"); glad_glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)load("glProgramUniform1uiv"); glad_glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)load("glProgramUniform2i"); glad_glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)load("glProgramUniform2iv"); glad_glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)load("glProgramUniform2f"); glad_glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)load("glProgramUniform2fv"); glad_glProgramUniform2d = (PFNGLPROGRAMUNIFORM2DPROC)load("glProgramUniform2d"); glad_glProgramUniform2dv = (PFNGLPROGRAMUNIFORM2DVPROC)load("glProgramUniform2dv"); glad_glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)load("glProgramUniform2ui"); glad_glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)load("glProgramUniform2uiv"); glad_glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)load("glProgramUniform3i"); glad_glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)load("glProgramUniform3iv"); glad_glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)load("glProgramUniform3f"); glad_glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)load("glProgramUniform3fv"); glad_glProgramUniform3d = (PFNGLPROGRAMUNIFORM3DPROC)load("glProgramUniform3d"); glad_glProgramUniform3dv = (PFNGLPROGRAMUNIFORM3DVPROC)load("glProgramUniform3dv"); glad_glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)load("glProgramUniform3ui"); glad_glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)load("glProgramUniform3uiv"); glad_glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)load("glProgramUniform4i"); glad_glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)load("glProgramUniform4iv"); glad_glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)load("glProgramUniform4f"); glad_glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)load("glProgramUniform4fv"); glad_glProgramUniform4d = (PFNGLPROGRAMUNIFORM4DPROC)load("glProgramUniform4d"); glad_glProgramUniform4dv = (PFNGLPROGRAMUNIFORM4DVPROC)load("glProgramUniform4dv"); glad_glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)load("glProgramUniform4ui"); glad_glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)load("glProgramUniform4uiv"); glad_glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)load("glProgramUniformMatrix2fv"); glad_glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)load("glProgramUniformMatrix3fv"); glad_glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)load("glProgramUniformMatrix4fv"); glad_glProgramUniformMatrix2dv = (PFNGLPROGRAMUNIFORMMATRIX2DVPROC)load("glProgramUniformMatrix2dv"); glad_glProgramUniformMatrix3dv = (PFNGLPROGRAMUNIFORMMATRIX3DVPROC)load("glProgramUniformMatrix3dv"); glad_glProgramUniformMatrix4dv = (PFNGLPROGRAMUNIFORMMATRIX4DVPROC)load("glProgramUniformMatrix4dv"); glad_glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)load("glProgramUniformMatrix2x3fv"); glad_glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)load("glProgramUniformMatrix3x2fv"); glad_glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)load("glProgramUniformMatrix2x4fv"); glad_glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)load("glProgramUniformMatrix4x2fv"); glad_glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)load("glProgramUniformMatrix3x4fv"); glad_glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)load("glProgramUniformMatrix4x3fv"); glad_glProgramUniformMatrix2x3dv = (PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)load("glProgramUniformMatrix2x3dv"); glad_glProgramUniformMatrix3x2dv = (PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)load("glProgramUniformMatrix3x2dv"); glad_glProgramUniformMatrix2x4dv = (PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)load("glProgramUniformMatrix2x4dv"); glad_glProgramUniformMatrix4x2dv = (PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)load("glProgramUniformMatrix4x2dv"); glad_glProgramUniformMatrix3x4dv = (PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)load("glProgramUniformMatrix3x4dv"); glad_glProgramUniformMatrix4x3dv = (PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)load("glProgramUniformMatrix4x3dv"); glad_glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)load("glValidateProgramPipeline"); glad_glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)load("glGetProgramPipelineInfoLog"); glad_glVertexAttribL1d = (PFNGLVERTEXATTRIBL1DPROC)load("glVertexAttribL1d"); glad_glVertexAttribL2d = (PFNGLVERTEXATTRIBL2DPROC)load("glVertexAttribL2d"); glad_glVertexAttribL3d = (PFNGLVERTEXATTRIBL3DPROC)load("glVertexAttribL3d"); glad_glVertexAttribL4d = (PFNGLVERTEXATTRIBL4DPROC)load("glVertexAttribL4d"); glad_glVertexAttribL1dv = (PFNGLVERTEXATTRIBL1DVPROC)load("glVertexAttribL1dv"); glad_glVertexAttribL2dv = (PFNGLVERTEXATTRIBL2DVPROC)load("glVertexAttribL2dv"); glad_glVertexAttribL3dv = (PFNGLVERTEXATTRIBL3DVPROC)load("glVertexAttribL3dv"); glad_glVertexAttribL4dv = (PFNGLVERTEXATTRIBL4DVPROC)load("glVertexAttribL4dv"); glad_glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC)load("glVertexAttribLPointer"); glad_glGetVertexAttribLdv = (PFNGLGETVERTEXATTRIBLDVPROC)load("glGetVertexAttribLdv"); glad_glViewportArrayv = (PFNGLVIEWPORTARRAYVPROC)load("glViewportArrayv"); glad_glViewportIndexedf = (PFNGLVIEWPORTINDEXEDFPROC)load("glViewportIndexedf"); glad_glViewportIndexedfv = (PFNGLVIEWPORTINDEXEDFVPROC)load("glViewportIndexedfv"); glad_glScissorArrayv = (PFNGLSCISSORARRAYVPROC)load("glScissorArrayv"); glad_glScissorIndexed = (PFNGLSCISSORINDEXEDPROC)load("glScissorIndexed"); glad_glScissorIndexedv = (PFNGLSCISSORINDEXEDVPROC)load("glScissorIndexedv"); glad_glDepthRangeArrayv = (PFNGLDEPTHRANGEARRAYVPROC)load("glDepthRangeArrayv"); glad_glDepthRangeIndexed = (PFNGLDEPTHRANGEINDEXEDPROC)load("glDepthRangeIndexed"); glad_glGetFloati_v = (PFNGLGETFLOATI_VPROC)load("glGetFloati_v"); glad_glGetDoublei_v = (PFNGLGETDOUBLEI_VPROC)load("glGetDoublei_v"); } static void load_GL_VERSION_4_2(GLADloadproc load) { if(!GLAD_GL_VERSION_4_2) return; glad_glDrawArraysInstancedBaseInstance = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)load("glDrawArraysInstancedBaseInstance"); glad_glDrawElementsInstancedBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)load("glDrawElementsInstancedBaseInstance"); glad_glDrawElementsInstancedBaseVertexBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)load("glDrawElementsInstancedBaseVertexBaseInstance"); glad_glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)load("glGetInternalformativ"); glad_glGetActiveAtomicCounterBufferiv = (PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)load("glGetActiveAtomicCounterBufferiv"); glad_glBindImageTexture = (PFNGLBINDIMAGETEXTUREPROC)load("glBindImageTexture"); glad_glMemoryBarrier = (PFNGLMEMORYBARRIERPROC)load("glMemoryBarrier"); glad_glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)load("glTexStorage1D"); glad_glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)load("glTexStorage2D"); glad_glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)load("glTexStorage3D"); glad_glDrawTransformFeedbackInstanced = (PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)load("glDrawTransformFeedbackInstanced"); glad_glDrawTransformFeedbackStreamInstanced = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)load("glDrawTransformFeedbackStreamInstanced"); } static void load_GL_VERSION_4_3(GLADloadproc load) { if(!GLAD_GL_VERSION_4_3) return; glad_glClearBufferData = (PFNGLCLEARBUFFERDATAPROC)load("glClearBufferData"); glad_glClearBufferSubData = (PFNGLCLEARBUFFERSUBDATAPROC)load("glClearBufferSubData"); glad_glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)load("glDispatchCompute"); glad_glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)load("glDispatchComputeIndirect"); glad_glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)load("glCopyImageSubData"); glad_glFramebufferParameteri = (PFNGLFRAMEBUFFERPARAMETERIPROC)load("glFramebufferParameteri"); glad_glGetFramebufferParameteriv = (PFNGLGETFRAMEBUFFERPARAMETERIVPROC)load("glGetFramebufferParameteriv"); glad_glGetInternalformati64v = (PFNGLGETINTERNALFORMATI64VPROC)load("glGetInternalformati64v"); glad_glInvalidateTexSubImage = (PFNGLINVALIDATETEXSUBIMAGEPROC)load("glInvalidateTexSubImage"); glad_glInvalidateTexImage = (PFNGLINVALIDATETEXIMAGEPROC)load("glInvalidateTexImage"); glad_glInvalidateBufferSubData = (PFNGLINVALIDATEBUFFERSUBDATAPROC)load("glInvalidateBufferSubData"); glad_glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)load("glInvalidateBufferData"); glad_glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)load("glInvalidateFramebuffer"); glad_glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)load("glInvalidateSubFramebuffer"); glad_glMultiDrawArraysIndirect = (PFNGLMULTIDRAWARRAYSINDIRECTPROC)load("glMultiDrawArraysIndirect"); glad_glMultiDrawElementsIndirect = (PFNGLMULTIDRAWELEMENTSINDIRECTPROC)load("glMultiDrawElementsIndirect"); glad_glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC)load("glGetProgramInterfaceiv"); glad_glGetProgramResourceIndex = (PFNGLGETPROGRAMRESOURCEINDEXPROC)load("glGetProgramResourceIndex"); glad_glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC)load("glGetProgramResourceName"); glad_glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC)load("glGetProgramResourceiv"); glad_glGetProgramResourceLocation = (PFNGLGETPROGRAMRESOURCELOCATIONPROC)load("glGetProgramResourceLocation"); glad_glGetProgramResourceLocationIndex = (PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)load("glGetProgramResourceLocationIndex"); glad_glShaderStorageBlockBinding = (PFNGLSHADERSTORAGEBLOCKBINDINGPROC)load("glShaderStorageBlockBinding"); glad_glTexBufferRange = (PFNGLTEXBUFFERRANGEPROC)load("glTexBufferRange"); glad_glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)load("glTexStorage2DMultisample"); glad_glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)load("glTexStorage3DMultisample"); glad_glTextureView = (PFNGLTEXTUREVIEWPROC)load("glTextureView"); glad_glBindVertexBuffer = (PFNGLBINDVERTEXBUFFERPROC)load("glBindVertexBuffer"); glad_glVertexAttribFormat = (PFNGLVERTEXATTRIBFORMATPROC)load("glVertexAttribFormat"); glad_glVertexAttribIFormat = (PFNGLVERTEXATTRIBIFORMATPROC)load("glVertexAttribIFormat"); glad_glVertexAttribLFormat = (PFNGLVERTEXATTRIBLFORMATPROC)load("glVertexAttribLFormat"); glad_glVertexAttribBinding = (PFNGLVERTEXATTRIBBINDINGPROC)load("glVertexAttribBinding"); glad_glVertexBindingDivisor = (PFNGLVERTEXBINDINGDIVISORPROC)load("glVertexBindingDivisor"); glad_glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)load("glDebugMessageControl"); glad_glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)load("glDebugMessageInsert"); glad_glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)load("glDebugMessageCallback"); glad_glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)load("glGetDebugMessageLog"); glad_glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)load("glPushDebugGroup"); glad_glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC)load("glPopDebugGroup"); glad_glObjectLabel = (PFNGLOBJECTLABELPROC)load("glObjectLabel"); glad_glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)load("glGetObjectLabel"); glad_glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)load("glObjectPtrLabel"); glad_glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)load("glGetObjectPtrLabel"); glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); } static void load_GL_VERSION_4_4(GLADloadproc load) { if(!GLAD_GL_VERSION_4_4) return; glad_glBufferStorage = (PFNGLBUFFERSTORAGEPROC)load("glBufferStorage"); glad_glClearTexImage = (PFNGLCLEARTEXIMAGEPROC)load("glClearTexImage"); glad_glClearTexSubImage = (PFNGLCLEARTEXSUBIMAGEPROC)load("glClearTexSubImage"); glad_glBindBuffersBase = (PFNGLBINDBUFFERSBASEPROC)load("glBindBuffersBase"); glad_glBindBuffersRange = (PFNGLBINDBUFFERSRANGEPROC)load("glBindBuffersRange"); glad_glBindTextures = (PFNGLBINDTEXTURESPROC)load("glBindTextures"); glad_glBindSamplers = (PFNGLBINDSAMPLERSPROC)load("glBindSamplers"); glad_glBindImageTextures = (PFNGLBINDIMAGETEXTURESPROC)load("glBindImageTextures"); glad_glBindVertexBuffers = (PFNGLBINDVERTEXBUFFERSPROC)load("glBindVertexBuffers"); } static void load_GL_VERSION_4_5(GLADloadproc load) { if(!GLAD_GL_VERSION_4_5) return; glad_glClipControl = (PFNGLCLIPCONTROLPROC)load("glClipControl"); glad_glCreateTransformFeedbacks = (PFNGLCREATETRANSFORMFEEDBACKSPROC)load("glCreateTransformFeedbacks"); glad_glTransformFeedbackBufferBase = (PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC)load("glTransformFeedbackBufferBase"); glad_glTransformFeedbackBufferRange = (PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC)load("glTransformFeedbackBufferRange"); glad_glGetTransformFeedbackiv = (PFNGLGETTRANSFORMFEEDBACKIVPROC)load("glGetTransformFeedbackiv"); glad_glGetTransformFeedbacki_v = (PFNGLGETTRANSFORMFEEDBACKI_VPROC)load("glGetTransformFeedbacki_v"); glad_glGetTransformFeedbacki64_v = (PFNGLGETTRANSFORMFEEDBACKI64_VPROC)load("glGetTransformFeedbacki64_v"); glad_glCreateBuffers = (PFNGLCREATEBUFFERSPROC)load("glCreateBuffers"); glad_glNamedBufferStorage = (PFNGLNAMEDBUFFERSTORAGEPROC)load("glNamedBufferStorage"); glad_glNamedBufferData = (PFNGLNAMEDBUFFERDATAPROC)load("glNamedBufferData"); glad_glNamedBufferSubData = (PFNGLNAMEDBUFFERSUBDATAPROC)load("glNamedBufferSubData"); glad_glCopyNamedBufferSubData = (PFNGLCOPYNAMEDBUFFERSUBDATAPROC)load("glCopyNamedBufferSubData"); glad_glClearNamedBufferData = (PFNGLCLEARNAMEDBUFFERDATAPROC)load("glClearNamedBufferData"); glad_glClearNamedBufferSubData = (PFNGLCLEARNAMEDBUFFERSUBDATAPROC)load("glClearNamedBufferSubData"); glad_glMapNamedBuffer = (PFNGLMAPNAMEDBUFFERPROC)load("glMapNamedBuffer"); glad_glMapNamedBufferRange = (PFNGLMAPNAMEDBUFFERRANGEPROC)load("glMapNamedBufferRange"); glad_glUnmapNamedBuffer = (PFNGLUNMAPNAMEDBUFFERPROC)load("glUnmapNamedBuffer"); glad_glFlushMappedNamedBufferRange = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC)load("glFlushMappedNamedBufferRange"); glad_glGetNamedBufferParameteriv = (PFNGLGETNAMEDBUFFERPARAMETERIVPROC)load("glGetNamedBufferParameteriv"); glad_glGetNamedBufferParameteri64v = (PFNGLGETNAMEDBUFFERPARAMETERI64VPROC)load("glGetNamedBufferParameteri64v"); glad_glGetNamedBufferPointerv = (PFNGLGETNAMEDBUFFERPOINTERVPROC)load("glGetNamedBufferPointerv"); glad_glGetNamedBufferSubData = (PFNGLGETNAMEDBUFFERSUBDATAPROC)load("glGetNamedBufferSubData"); glad_glCreateFramebuffers = (PFNGLCREATEFRAMEBUFFERSPROC)load("glCreateFramebuffers"); glad_glNamedFramebufferRenderbuffer = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC)load("glNamedFramebufferRenderbuffer"); glad_glNamedFramebufferParameteri = (PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC)load("glNamedFramebufferParameteri"); glad_glNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC)load("glNamedFramebufferTexture"); glad_glNamedFramebufferTextureLayer = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC)load("glNamedFramebufferTextureLayer"); glad_glNamedFramebufferDrawBuffer = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC)load("glNamedFramebufferDrawBuffer"); glad_glNamedFramebufferDrawBuffers = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC)load("glNamedFramebufferDrawBuffers"); glad_glNamedFramebufferReadBuffer = (PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC)load("glNamedFramebufferReadBuffer"); glad_glInvalidateNamedFramebufferData = (PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC)load("glInvalidateNamedFramebufferData"); glad_glInvalidateNamedFramebufferSubData = (PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC)load("glInvalidateNamedFramebufferSubData"); glad_glClearNamedFramebufferiv = (PFNGLCLEARNAMEDFRAMEBUFFERIVPROC)load("glClearNamedFramebufferiv"); glad_glClearNamedFramebufferuiv = (PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC)load("glClearNamedFramebufferuiv"); glad_glClearNamedFramebufferfv = (PFNGLCLEARNAMEDFRAMEBUFFERFVPROC)load("glClearNamedFramebufferfv"); glad_glClearNamedFramebufferfi = (PFNGLCLEARNAMEDFRAMEBUFFERFIPROC)load("glClearNamedFramebufferfi"); glad_glBlitNamedFramebuffer = (PFNGLBLITNAMEDFRAMEBUFFERPROC)load("glBlitNamedFramebuffer"); glad_glCheckNamedFramebufferStatus = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC)load("glCheckNamedFramebufferStatus"); glad_glGetNamedFramebufferParameteriv = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC)load("glGetNamedFramebufferParameteriv"); glad_glGetNamedFramebufferAttachmentParameteriv = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetNamedFramebufferAttachmentParameteriv"); glad_glCreateRenderbuffers = (PFNGLCREATERENDERBUFFERSPROC)load("glCreateRenderbuffers"); glad_glNamedRenderbufferStorage = (PFNGLNAMEDRENDERBUFFERSTORAGEPROC)load("glNamedRenderbufferStorage"); glad_glNamedRenderbufferStorageMultisample = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glNamedRenderbufferStorageMultisample"); glad_glGetNamedRenderbufferParameteriv = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC)load("glGetNamedRenderbufferParameteriv"); glad_glCreateTextures = (PFNGLCREATETEXTURESPROC)load("glCreateTextures"); glad_glTextureBuffer = (PFNGLTEXTUREBUFFERPROC)load("glTextureBuffer"); glad_glTextureBufferRange = (PFNGLTEXTUREBUFFERRANGEPROC)load("glTextureBufferRange"); glad_glTextureStorage1D = (PFNGLTEXTURESTORAGE1DPROC)load("glTextureStorage1D"); glad_glTextureStorage2D = (PFNGLTEXTURESTORAGE2DPROC)load("glTextureStorage2D"); glad_glTextureStorage3D = (PFNGLTEXTURESTORAGE3DPROC)load("glTextureStorage3D"); glad_glTextureStorage2DMultisample = (PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC)load("glTextureStorage2DMultisample"); glad_glTextureStorage3DMultisample = (PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC)load("glTextureStorage3DMultisample"); glad_glTextureSubImage1D = (PFNGLTEXTURESUBIMAGE1DPROC)load("glTextureSubImage1D"); glad_glTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)load("glTextureSubImage2D"); glad_glTextureSubImage3D = (PFNGLTEXTURESUBIMAGE3DPROC)load("glTextureSubImage3D"); glad_glCompressedTextureSubImage1D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC)load("glCompressedTextureSubImage1D"); glad_glCompressedTextureSubImage2D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC)load("glCompressedTextureSubImage2D"); glad_glCompressedTextureSubImage3D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC)load("glCompressedTextureSubImage3D"); glad_glCopyTextureSubImage1D = (PFNGLCOPYTEXTURESUBIMAGE1DPROC)load("glCopyTextureSubImage1D"); glad_glCopyTextureSubImage2D = (PFNGLCOPYTEXTURESUBIMAGE2DPROC)load("glCopyTextureSubImage2D"); glad_glCopyTextureSubImage3D = (PFNGLCOPYTEXTURESUBIMAGE3DPROC)load("glCopyTextureSubImage3D"); glad_glTextureParameterf = (PFNGLTEXTUREPARAMETERFPROC)load("glTextureParameterf"); glad_glTextureParameterfv = (PFNGLTEXTUREPARAMETERFVPROC)load("glTextureParameterfv"); glad_glTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC)load("glTextureParameteri"); glad_glTextureParameterIiv = (PFNGLTEXTUREPARAMETERIIVPROC)load("glTextureParameterIiv"); glad_glTextureParameterIuiv = (PFNGLTEXTUREPARAMETERIUIVPROC)load("glTextureParameterIuiv"); glad_glTextureParameteriv = (PFNGLTEXTUREPARAMETERIVPROC)load("glTextureParameteriv"); glad_glGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC)load("glGenerateTextureMipmap"); glad_glBindTextureUnit = (PFNGLBINDTEXTUREUNITPROC)load("glBindTextureUnit"); glad_glGetTextureImage = (PFNGLGETTEXTUREIMAGEPROC)load("glGetTextureImage"); glad_glGetCompressedTextureImage = (PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC)load("glGetCompressedTextureImage"); glad_glGetTextureLevelParameterfv = (PFNGLGETTEXTURELEVELPARAMETERFVPROC)load("glGetTextureLevelParameterfv"); glad_glGetTextureLevelParameteriv = (PFNGLGETTEXTURELEVELPARAMETERIVPROC)load("glGetTextureLevelParameteriv"); glad_glGetTextureParameterfv = (PFNGLGETTEXTUREPARAMETERFVPROC)load("glGetTextureParameterfv"); glad_glGetTextureParameterIiv = (PFNGLGETTEXTUREPARAMETERIIVPROC)load("glGetTextureParameterIiv"); glad_glGetTextureParameterIuiv = (PFNGLGETTEXTUREPARAMETERIUIVPROC)load("glGetTextureParameterIuiv"); glad_glGetTextureParameteriv = (PFNGLGETTEXTUREPARAMETERIVPROC)load("glGetTextureParameteriv"); glad_glCreateVertexArrays = (PFNGLCREATEVERTEXARRAYSPROC)load("glCreateVertexArrays"); glad_glDisableVertexArrayAttrib = (PFNGLDISABLEVERTEXARRAYATTRIBPROC)load("glDisableVertexArrayAttrib"); glad_glEnableVertexArrayAttrib = (PFNGLENABLEVERTEXARRAYATTRIBPROC)load("glEnableVertexArrayAttrib"); glad_glVertexArrayElementBuffer = (PFNGLVERTEXARRAYELEMENTBUFFERPROC)load("glVertexArrayElementBuffer"); glad_glVertexArrayVertexBuffer = (PFNGLVERTEXARRAYVERTEXBUFFERPROC)load("glVertexArrayVertexBuffer"); glad_glVertexArrayVertexBuffers = (PFNGLVERTEXARRAYVERTEXBUFFERSPROC)load("glVertexArrayVertexBuffers"); glad_glVertexArrayAttribBinding = (PFNGLVERTEXARRAYATTRIBBINDINGPROC)load("glVertexArrayAttribBinding"); glad_glVertexArrayAttribFormat = (PFNGLVERTEXARRAYATTRIBFORMATPROC)load("glVertexArrayAttribFormat"); glad_glVertexArrayAttribIFormat = (PFNGLVERTEXARRAYATTRIBIFORMATPROC)load("glVertexArrayAttribIFormat"); glad_glVertexArrayAttribLFormat = (PFNGLVERTEXARRAYATTRIBLFORMATPROC)load("glVertexArrayAttribLFormat"); glad_glVertexArrayBindingDivisor = (PFNGLVERTEXARRAYBINDINGDIVISORPROC)load("glVertexArrayBindingDivisor"); glad_glGetVertexArrayiv = (PFNGLGETVERTEXARRAYIVPROC)load("glGetVertexArrayiv"); glad_glGetVertexArrayIndexediv = (PFNGLGETVERTEXARRAYINDEXEDIVPROC)load("glGetVertexArrayIndexediv"); glad_glGetVertexArrayIndexed64iv = (PFNGLGETVERTEXARRAYINDEXED64IVPROC)load("glGetVertexArrayIndexed64iv"); glad_glCreateSamplers = (PFNGLCREATESAMPLERSPROC)load("glCreateSamplers"); glad_glCreateProgramPipelines = (PFNGLCREATEPROGRAMPIPELINESPROC)load("glCreateProgramPipelines"); glad_glCreateQueries = (PFNGLCREATEQUERIESPROC)load("glCreateQueries"); glad_glGetQueryBufferObjecti64v = (PFNGLGETQUERYBUFFEROBJECTI64VPROC)load("glGetQueryBufferObjecti64v"); glad_glGetQueryBufferObjectiv = (PFNGLGETQUERYBUFFEROBJECTIVPROC)load("glGetQueryBufferObjectiv"); glad_glGetQueryBufferObjectui64v = (PFNGLGETQUERYBUFFEROBJECTUI64VPROC)load("glGetQueryBufferObjectui64v"); glad_glGetQueryBufferObjectuiv = (PFNGLGETQUERYBUFFEROBJECTUIVPROC)load("glGetQueryBufferObjectuiv"); glad_glMemoryBarrierByRegion = (PFNGLMEMORYBARRIERBYREGIONPROC)load("glMemoryBarrierByRegion"); glad_glGetTextureSubImage = (PFNGLGETTEXTURESUBIMAGEPROC)load("glGetTextureSubImage"); glad_glGetCompressedTextureSubImage = (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)load("glGetCompressedTextureSubImage"); glad_glGetGraphicsResetStatus = (PFNGLGETGRAPHICSRESETSTATUSPROC)load("glGetGraphicsResetStatus"); glad_glGetnCompressedTexImage = (PFNGLGETNCOMPRESSEDTEXIMAGEPROC)load("glGetnCompressedTexImage"); glad_glGetnTexImage = (PFNGLGETNTEXIMAGEPROC)load("glGetnTexImage"); glad_glGetnUniformdv = (PFNGLGETNUNIFORMDVPROC)load("glGetnUniformdv"); glad_glGetnUniformfv = (PFNGLGETNUNIFORMFVPROC)load("glGetnUniformfv"); glad_glGetnUniformiv = (PFNGLGETNUNIFORMIVPROC)load("glGetnUniformiv"); glad_glGetnUniformuiv = (PFNGLGETNUNIFORMUIVPROC)load("glGetnUniformuiv"); glad_glReadnPixels = (PFNGLREADNPIXELSPROC)load("glReadnPixels"); glad_glGetnMapdv = (PFNGLGETNMAPDVPROC)load("glGetnMapdv"); glad_glGetnMapfv = (PFNGLGETNMAPFVPROC)load("glGetnMapfv"); glad_glGetnMapiv = (PFNGLGETNMAPIVPROC)load("glGetnMapiv"); glad_glGetnPixelMapfv = (PFNGLGETNPIXELMAPFVPROC)load("glGetnPixelMapfv"); glad_glGetnPixelMapuiv = (PFNGLGETNPIXELMAPUIVPROC)load("glGetnPixelMapuiv"); glad_glGetnPixelMapusv = (PFNGLGETNPIXELMAPUSVPROC)load("glGetnPixelMapusv"); glad_glGetnPolygonStipple = (PFNGLGETNPOLYGONSTIPPLEPROC)load("glGetnPolygonStipple"); glad_glGetnColorTable = (PFNGLGETNCOLORTABLEPROC)load("glGetnColorTable"); glad_glGetnConvolutionFilter = (PFNGLGETNCONVOLUTIONFILTERPROC)load("glGetnConvolutionFilter"); glad_glGetnSeparableFilter = (PFNGLGETNSEPARABLEFILTERPROC)load("glGetnSeparableFilter"); glad_glGetnHistogram = (PFNGLGETNHISTOGRAMPROC)load("glGetnHistogram"); glad_glGetnMinmax = (PFNGLGETNMINMAXPROC)load("glGetnMinmax"); glad_glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)load("glTextureBarrier"); } static void load_GL_VERSION_4_6(GLADloadproc load) { if(!GLAD_GL_VERSION_4_6) return; glad_glSpecializeShader = (PFNGLSPECIALIZESHADERPROC)load("glSpecializeShader"); glad_glMultiDrawArraysIndirectCount = (PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC)load("glMultiDrawArraysIndirectCount"); glad_glMultiDrawElementsIndirectCount = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC)load("glMultiDrawElementsIndirectCount"); glad_glPolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC)load("glPolygonOffsetClamp"); } static int find_extensionsGL(void) { if (!get_exts()) return 0; (void)&has_ext; free_exts(); return 1; } static void find_coreGL(void) { /* Thank you @elmindreda * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 * https://github.com/glfw/glfw/blob/master/src/context.c#L36 */ int i, major, minor; const char* version; const char* prefixes[] = { "OpenGL ES-CM ", "OpenGL ES-CL ", "OpenGL ES ", NULL }; version = (const char*) glGetString(GL_VERSION); if (!version) return; for (i = 0; prefixes[i]; i++) { const size_t length = strlen(prefixes[i]); if (strncmp(version, prefixes[i], length) == 0) { version += length; break; } } /* PR #18 */ #ifdef _MSC_VER sscanf_s(version, "%d.%d", &major, &minor); #else sscanf(version, "%d.%d", &major, &minor); #endif GLVersion.major = major; GLVersion.minor = minor; max_loaded_major = major; max_loaded_minor = minor; GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3; GLAD_GL_VERSION_4_0 = (major == 4 && minor >= 0) || major > 4; GLAD_GL_VERSION_4_1 = (major == 4 && minor >= 1) || major > 4; GLAD_GL_VERSION_4_2 = (major == 4 && minor >= 2) || major > 4; GLAD_GL_VERSION_4_3 = (major == 4 && minor >= 3) || major > 4; GLAD_GL_VERSION_4_4 = (major == 4 && minor >= 4) || major > 4; GLAD_GL_VERSION_4_5 = (major == 4 && minor >= 5) || major > 4; GLAD_GL_VERSION_4_6 = (major == 4 && minor >= 6) || major > 4; if (GLVersion.major > 4 || (GLVersion.major >= 4 && GLVersion.minor >= 6)) { max_loaded_major = 4; max_loaded_minor = 6; } } int gladLoadGLLoader(GLADloadproc load) { GLVersion.major = 0; GLVersion.minor = 0; glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); if(glGetString == NULL) return 0; if(glGetString(GL_VERSION) == NULL) return 0; find_coreGL(); load_GL_VERSION_1_0(load); load_GL_VERSION_1_1(load); load_GL_VERSION_1_2(load); load_GL_VERSION_1_3(load); load_GL_VERSION_1_4(load); load_GL_VERSION_1_5(load); load_GL_VERSION_2_0(load); load_GL_VERSION_2_1(load); load_GL_VERSION_3_0(load); load_GL_VERSION_3_1(load); load_GL_VERSION_3_2(load); load_GL_VERSION_3_3(load); load_GL_VERSION_4_0(load); load_GL_VERSION_4_1(load); load_GL_VERSION_4_2(load); load_GL_VERSION_4_3(load); load_GL_VERSION_4_4(load); load_GL_VERSION_4_5(load); load_GL_VERSION_4_6(load); if (!find_extensionsGL()) return 0; return GLVersion.major != 0 || GLVersion.minor != 0; }
[ "krawacik3@gmail.com" ]
krawacik3@gmail.com
0ed2e7b39d737c1370e20df07fb8109e2f7b9f63
c7399b29b6222afd03cfd9b14ad21b81bc446779
/Practica 1/VisualDataRay/Light.h
fe64dd004b2e59b7150e4cf1dbaaee001bc2f31a
[]
no_license
polsafont/GraficsUB
ee0fdc0662239ec9f492963fa50f8b847c2ff46f
06fc211a90b0110982a51dfcc62874f1e3ab85ee
refs/heads/master
2021-05-21T21:31:22.048959
2019-12-01T12:38:40
2019-12-01T12:38:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
330
h
#ifndef LIGHT_H #define LIGHT_H #include "Ray.h" class Light { public: Light(vec3 point); virtual ~Light(){} vec3 position; vec3 diffuse; vec3 specular; vec3 ambient; float a; float b; float c; float atenuation; private: double const EPSILON = 0.0000000000001; }; #endif // LIGHT_H
[ "johnnynuca14@gmail.com" ]
johnnynuca14@gmail.com
db57bd63ad4250d852f25ab3ce803093b3b79524
20683c00ba6acdcf0933233156d7a173472c61af
/src/test/versionbits_tests.cpp
43d7ba734795e94568c33c54f2632133f2e6cf94
[ "MIT" ]
permissive
AddmoreMining2020/Addmore
1b0576d39d0a6789ee18dc8610d6b037cbd8e909
f0b0df156959774b6c2ecb518ce8b16a706bfa12
refs/heads/master
2021-01-07T18:25:16.546967
2020-02-20T03:11:08
2020-02-20T03:11:08
241,781,590
0
1
null
null
null
null
UTF-8
C++
false
false
15,272
cpp
// Copyright (c) 2014-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chain.h" #include "random.h" #include "versionbits.h" #include "test/test_addmore.h" #include "chainparams.h" #include "validation.h" #include "consensus/params.h" #include <boost/test/unit_test.hpp> /* Define a virtual block time, one block per 10 minutes after Nov 14 2014, 0:55:36am */ int32_t TestTime(int nHeight) { return 1415926536 + 600 * nHeight; } static const Consensus::Params paramsDummy = Consensus::Params(); class TestConditionChecker : public AbstractThresholdConditionChecker { private: mutable ThresholdConditionCache cache; public: int64_t BeginTime(const Consensus::Params& params) const { return TestTime(10000); } int64_t EndTime(const Consensus::Params& params) const { return TestTime(20000); } int Period(const Consensus::Params& params) const { return 1000; } int Threshold(const Consensus::Params& params) const { return 900; } bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const { return (pindex->nVersion & 0x100); } ThresholdState GetStateFor(const CBlockIndex* pindexPrev) const { return AbstractThresholdConditionChecker::GetStateFor(pindexPrev, paramsDummy, cache); } }; #define CHECKERS 6 class VersionBitsTester { // A fake blockchain std::vector<CBlockIndex*> vpblock; // 6 independent checkers for the same bit. // The first one performs all checks, the second only 50%, the third only 25%, etc... // This is to test whether lack of cached information leads to the same results. TestConditionChecker checker[CHECKERS]; // Test counter (to identify failures) int num; public: VersionBitsTester() : num(0) {} VersionBitsTester& Reset() { for (unsigned int i = 0; i < vpblock.size(); i++) { delete vpblock[i]; } for (unsigned int i = 0; i < CHECKERS; i++) { checker[i] = TestConditionChecker(); } vpblock.clear(); return *this; } ~VersionBitsTester() { Reset(); } VersionBitsTester& Mine(unsigned int height, int32_t nTime, int32_t nVersion) { while (vpblock.size() < height) { CBlockIndex* pindex = new CBlockIndex(); pindex->nHeight = vpblock.size(); pindex->pprev = vpblock.size() > 0 ? vpblock.back() : NULL; pindex->nTime = nTime; pindex->nVersion = nVersion; pindex->BuildSkip(); vpblock.push_back(pindex); } return *this; } VersionBitsTester& TestDefined() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_DEFINED, strprintf("Test %i for DEFINED", num)); } } num++; return *this; } VersionBitsTester& TestStarted() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_STARTED, strprintf("Test %i for STARTED", num)); } } num++; return *this; } VersionBitsTester& TestLockedIn() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_LOCKED_IN, strprintf("Test %i for LOCKED_IN", num)); } } num++; return *this; } VersionBitsTester& TestActive() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_ACTIVE, strprintf("Test %i for ACTIVE", num)); } } num++; return *this; } VersionBitsTester& TestFailed() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_FAILED, strprintf("Test %i for FAILED", num)); } } num++; return *this; } CBlockIndex * Tip() { return vpblock.size() ? vpblock.back() : NULL; } }; BOOST_FIXTURE_TEST_SUITE(versionbits_tests, TestingSetup) BOOST_AUTO_TEST_CASE(versionbits_test) { for (int i = 0; i < 64; i++) { BOOST_TEST_MESSAGE("versionbits_test " << i); // DEFINED -> FAILED VersionBitsTester().TestDefined() .Mine(1, TestTime(1), 0x100).TestDefined() .Mine(11, TestTime(11), 0x100).TestDefined() .Mine(989, TestTime(989), 0x100).TestDefined() .Mine(999, TestTime(20000), 0x100).TestDefined() .Mine(1000, TestTime(20000), 0x100).TestFailed() .Mine(1999, TestTime(30001), 0x100).TestFailed() .Mine(2000, TestTime(30002), 0x100).TestFailed() .Mine(2001, TestTime(30003), 0x100).TestFailed() .Mine(2999, TestTime(30004), 0x100).TestFailed() .Mine(3000, TestTime(30005), 0x100).TestFailed() // DEFINED -> STARTED -> FAILED .Reset().TestDefined() .Mine(1, TestTime(1), 0).TestDefined() .Mine(1000, TestTime(10000) - 1, 0x100).TestDefined() // One second more and it would be defined .Mine(2000, TestTime(10000), 0x100).TestStarted() // So that's what happens the next period .Mine(2051, TestTime(10010), 0).TestStarted() // 51 old blocks .Mine(2950, TestTime(10020), 0x100).TestStarted() // 899 new blocks .Mine(3000, TestTime(20000), 0).TestFailed() // 50 old blocks (so 899 out of the past 1000) .Mine(4000, TestTime(20010), 0x100).TestFailed() // DEFINED -> STARTED -> FAILED while threshold reached .Reset().TestDefined() .Mine(1, TestTime(1), 0).TestDefined() .Mine(1000, TestTime(10000) - 1, 0x101).TestDefined() // One second more and it would be defined .Mine(2000, TestTime(10000), 0x101).TestStarted() // So that's what happens the next period .Mine(2999, TestTime(30000), 0x100).TestStarted() // 999 new blocks .Mine(3000, TestTime(30000), 0x100).TestFailed() // 1 new block (so 1000 out of the past 1000 are new) .Mine(3999, TestTime(30001), 0).TestFailed() .Mine(4000, TestTime(30002), 0).TestFailed() .Mine(14333, TestTime(30003), 0).TestFailed() .Mine(24000, TestTime(40000), 0).TestFailed() // DEFINED -> STARTED -> LOCKEDIN at the last minute -> ACTIVE .Reset().TestDefined() .Mine(1, TestTime(1), 0).TestDefined() .Mine(1000, TestTime(10000) - 1, 0x101).TestDefined() // One second more and it would be defined .Mine(2000, TestTime(10000), 0x101).TestStarted() // So that's what happens the next period .Mine(2050, TestTime(10010), 0x200).TestStarted() // 50 old blocks .Mine(2950, TestTime(10020), 0x100).TestStarted() // 900 new blocks .Mine(2999, TestTime(19999), 0x200).TestStarted() // 49 old blocks .Mine(3000, TestTime(29999), 0x200).TestLockedIn() // 1 old block (so 900 out of the past 1000) .Mine(3999, TestTime(30001), 0).TestLockedIn() .Mine(4000, TestTime(30002), 0).TestActive() .Mine(14333, TestTime(30003), 0).TestActive() .Mine(24000, TestTime(40000), 0).TestActive(); } // Sanity checks of version bit deployments const Consensus::Params &mainnetParams = Params(CBaseChainParams::MAIN).GetConsensus(); for (int i=0; i<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) { uint32_t bitmask = VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)i); // Make sure that no deployment tries to set an invalid bit. BOOST_CHECK_EQUAL(bitmask & ~(uint32_t)VERSIONBITS_TOP_MASK, bitmask); // Verify that the deployment windows of different deployment using the // same bit are disjoint. // This test may need modification at such time as a new deployment // is proposed that reuses the bit of an activated soft fork, before the // end time of that soft fork. (Alternatively, the end time of that // activated soft fork could be later changed to be earlier to avoid // overlap.) for (int j=i+1; j<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; j++) { if (VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)j) == bitmask) { BOOST_CHECK(mainnetParams.vDeployments[j].nStartTime > mainnetParams.vDeployments[i].nTimeout || mainnetParams.vDeployments[i].nStartTime > mainnetParams.vDeployments[j].nTimeout); } } } } BOOST_AUTO_TEST_CASE(versionbits_computeblockversion) { // Check that ComputeBlockVersion will set the appropriate bit correctly // on mainnet. const Consensus::Params &mainnetParams = Params(CBaseChainParams::MAIN).GetConsensus(); // Use the TESTDUMMY deployment for testing purposes. int64_t bit = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit; int64_t nStartTime = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime; int64_t nTimeout = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout; assert(nStartTime < nTimeout); // In the first chain, test that the bit is set by CBV until it has failed. // In the second chain, test the bit is set by CBV while STARTED and // LOCKED-IN, and then no longer set while ACTIVE. VersionBitsTester firstChain, secondChain; // Start generating blocks before nStartTime int64_t nTime = nStartTime - 1; // Before MedianTimePast of the chain has crossed nStartTime, the bit // should not be set. CBlockIndex *lastBlock = NULL; lastBlock = firstChain.Mine(2016, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); // Mine 2011 more blocks at the old time, and check that CBV isn't setting the bit yet. for (int i=1; i<2012; i++) { lastBlock = firstChain.Mine(2016+i, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); // This works because VERSIONBITS_LAST_OLD_BLOCK_VERSION happens // to be 4, and the bit we're testing happens to be bit 28. BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); } // Now mine 5 more blocks at the start time -- MTP should not have passed yet, so // CBV should still not yet set the bit. nTime = nStartTime; for (int i=2012; i<=2016; i++) { lastBlock = firstChain.Mine(2016+i, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); } // Advance to the next period and transition to STARTED, lastBlock = firstChain.Mine(6048, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); // so ComputeBlockVersion should now set the bit, BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); // and should also be using the VERSIONBITS_TOP_BITS. BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); // Check that ComputeBlockVersion will set the bit until nTimeout nTime += 600; int blocksToMine = 4032; // test blocks for up to 2 time periods int nHeight = 6048; // These blocks are all before nTimeout is reached. while (nTime < nTimeout && blocksToMine > 0) { lastBlock = firstChain.Mine(nHeight+1, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); blocksToMine--; nTime += 600; nHeight += 1; }; nTime = nTimeout; // FAILED is only triggered at the end of a period, so CBV should be setting // the bit until the period transition. for (int i=0; i<2015; i++) { lastBlock = firstChain.Mine(nHeight+1, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); nHeight += 1; } // The next block should trigger no longer setting the bit. lastBlock = firstChain.Mine(nHeight+1, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); // On a new chain: // verify that the bit will be set after lock-in, and then stop being set // after activation. nTime = nStartTime; // Mine one period worth of blocks, and check that the bit will be on for the // next period. lastBlock = secondChain.Mine(2016, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); // Mine another period worth of blocks, signaling the new bit. lastBlock = secondChain.Mine(4032, nStartTime, VERSIONBITS_TOP_BITS | (1<<bit)).Tip(); // After one period of setting the bit on each block, it should have locked in. // We keep setting the bit for one more period though, until activation. BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); // Now check that we keep mining the block until the end of this period, and // then stop at the beginning of the next period. lastBlock = secondChain.Mine(6047, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); lastBlock = secondChain.Mine(6048, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); // Finally, verify that after a soft fork has activated, CBV no longer uses // VERSIONBITS_LAST_OLD_BLOCK_VERSION. //BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); } BOOST_AUTO_TEST_SUITE_END()
[ "60209727+AddmoreMining2020@users.noreply.github.com" ]
60209727+AddmoreMining2020@users.noreply.github.com
49be0f9361943bb88f26bbde79bf8f5403b5787c
eb667f1737a67feb07bf2d1298ff6757526ee8fb
/930 Binary Subarrays With Sum/Binary Subarrays With Sum.cpp
47c6cf83b3783d72676046793a6551cd5c1205ea
[]
no_license
yukeyi/LeetCode
bb3313a868e9aedada3fe157c6307b00d32a09c9
79d37be2aefd674e885a5bdc6dac0a5adf02f91c
refs/heads/master
2021-04-18T22:18:26.085485
2019-06-09T06:25:29
2019-06-09T06:25:29
126,930,413
0
1
null
null
null
null
UTF-8
C++
false
false
412
cpp
class Solution { public: int numSubarraysWithSum(vector<int>& A, int S) { unordered_map<int,int> M; M[0] = 1; int sum = 0; int res = 0; for(int i = 0;i<A.size();i++) { sum += A[i]; res += M[sum-S]; if(M.count(sum) == 0) M[sum] = 1; else M[sum] += 1; } return res; } };
[ "yukeyi@Keyis-MBP.fios-router.home" ]
yukeyi@Keyis-MBP.fios-router.home
9ec247e12bd7a4726ab48ab1818ac024833ec8a6
99530b1b878569e1d7ba4c9c0858e68e4dca81d1
/Plugins/AdCollection/Source/AdCollection/Private/PlayRewardVideoCallbackProxy.cpp
4f7d62f8335136d860baab1f4f752179507ea8a2
[]
no_license
Mikesdav/Defend
34185ffeb35139ddba0b1c62200f9b621af8b625
4332c8841206d09c1b616f48fb226512da4f545e
refs/heads/master
2021-05-01T03:16:10.564230
2018-05-11T20:07:36
2018-05-11T20:07:36
121,188,125
0
0
null
null
null
null
UTF-8
C++
false
false
1,895
cpp
/* * EZ-Mobile-Ads - unreal engine 4 ads plugin * * Copyright (C) 2017 feiwu <feixuwu@outlook.com> All Rights Reserved. */ #include "PlayRewardVideoCallbackProxy.h" #include "Engine.h" #include "AdCollection.h" UPlayRewardVideoCallbackProxy::UPlayRewardVideoCallbackProxy() : Delegate(FPlayRewardCompleteDelegate::CreateUObject(this, &ThisClass::OnComplete)) { } UPlayRewardVideoCallbackProxy* UPlayRewardVideoCallbackProxy::PlayRewardedVideo(EAdType AdType) { IAdModuleInterface* Module = FindAdsModule(AdType); if (Module != NULL) { UPlayRewardVideoCallbackProxy* Proxy = NewObject<UPlayRewardVideoCallbackProxy>(); Proxy->AdType = AdType; return Proxy; } return nullptr; } IAdModuleInterface* UPlayRewardVideoCallbackProxy::FindAdsModule(EAdType adType) { const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, TEXT("EAdType"), true); if (!EnumPtr) { return nullptr; } FString EnumName = EnumPtr->GetNameByValue((int64)adType).ToString(); FName adPlatformName; int32 ScopeIndex = EnumName.Find(TEXT("::"), ESearchCase::CaseSensitive); if (ScopeIndex != INDEX_NONE) { adPlatformName = FName(*EnumName.Mid(ScopeIndex + 2)); } else { adPlatformName = FName(*EnumName); } IAdModuleInterface * Module = FModuleManager::Get().LoadModulePtr<IAdModuleInterface>(adPlatformName); return Module; } void UPlayRewardVideoCallbackProxy::OnComplete(FRewardedStatus Status) { IAdModuleInterface* Module = FindAdsModule(AdType); if (Module == nullptr) { return; } OnSuccess.Broadcast(Status); Module->ClearPlayRewardCompleteDelegate_Handle(DelegateHandle); } void UPlayRewardVideoCallbackProxy::Activate() { IAdModuleInterface* Module = FindAdsModule(AdType); if (Module != NULL) { Module->ClearAllPlayRewardCompleteDelegate_Handle(); DelegateHandle = Module->AddPlayRewardCompleteDelegate_Handle(Delegate); Module->PlayRewardedVideo(); } }
[ "davidmikesel@gmail.com" ]
davidmikesel@gmail.com
35b1eef4f3d94f410812158170e16090425d8171
f36cbd7ca5bf2c753d6d1a306bf79ecfb908483e
/earth_enterprise/src/fusion/rasterfuse/geraster2kml.cpp
94928769befe6a8f8fa3e102bde4756a93259d80
[ "Apache-2.0" ]
permissive
doc22940/earthenterprise
edda8cab2e616ed4bb08fd7cbe47436d0ac9ac59
475faea9cc9232c9603419f5f9ea241b24a4d546
refs/heads/master
2021-05-27T12:02:18.880594
2020-04-07T21:47:29
2020-04-07T21:47:29
254,266,057
1
0
Apache-2.0
2020-04-09T03:54:21
2020-04-09T03:54:20
null
UTF-8
C++
false
false
31,672
cpp
// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include <stdlib.h> #include <iostream> #include <iomanip> #include <sstream> #include <bitset> #include <khraster/ProductLevelReaderCache.h> #include <khraster/khRasterProduct.h> #include <khraster/Interleave.h> #include <khraster/CachedRasterInsetReaderImpl.h> #include <khTileAddr.h> #include <notify.h> #include <khGetopt.h> #include <khstl.h> #include <common/khConstants.h> #include <khFileUtils.h> #include <khGeomUtils.h> #include <compressor.h> #include <khProgressMeter.h> #include <autoingest/AssetVersion.h> static const std::string kKMLHeader( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<kml xmlns=\"http://earth.google.com/kml/2.1\">\n"); void usage(const std::string& progn, const char *msg = 0, ...) { if (msg) { va_list ap; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); fprintf(stderr, "\n"); } /* * Usage intentionally excludes a few options because they shouldn't ever * be needed by end users and will only make the tool more complicated: * --min_lod Specify the minLodPixels value, default is .5 * tilesize * --max_lod Specify the maxLodPixels value, default is 4 * tilesize * --break_imgdir Break-up imagery path to reduce filecount, default is 5 chars */ fprintf(stderr, "\nusage: %s [options] {--assetref <assetref> | --kip <raster.kip>" " --kmp <mask.kmp>}\n" " Supported options are:\n" " --asset <assetref> Specify the imagery asset\n" " --kip <imagery product> Specify the imagery product *.kip\n" " --kmp <mask product> Specify the mask product *.kmp\n" " --url <url root> All links have this URL root\n" " --output <dirname> Use dirname for output\n" " --layer_name <name> Layer name to use in client\n" " --tile_size <size> Output tilesize (256, 512 or 1024)\n" " --kml_only Generate KML files only (no imagery)\n" " --no_kmz Don't use KMZ, only KML\n" " --jpg_quality <qual> Set quality for jpg compression\n" " --drawOrder <offset> Constant added to the computed <drawOrder>\n" " --debug Add debug geometry\n" " --north_boundary <double> Crop to north_boundary" " (latitude in decimal deg)\n" " --south_boundary <double> Crop to south_boundary" " (latitude in decimal deg)\n" " --east_boundary <double> Crop to east_boundary" " (longitude in decimal deg)\n" " --west_boundary <double> Crop to west_boundary" " (longitude in decimal deg)\n" " --help | -?: Display this usage message\n", progn.c_str()); exit(1); } typedef std::map<std::string, khExtents<double> > ImageExtentsMap; typedef ImageExtentsMap::iterator ImageExtentsMapIterator; // The format for time stamp is YYYY-MM-DD which is same as that of // khRasterProduct::GetAcquisitionDate bool OutputIndex(const khExtents<double>& extents, const std::string& url_root, const std::string& time_stamp); bool DrillDown(const std::string& name, const khTileAddr& addr, khProgressMeter* progress); void AddChild(std::ostringstream* os, const std::string& name, const khTileAddr& addr); void InsertRegion(std::ostringstream* os, int indent, const khExtents<double>& extents, int min_lod, int max_lod); void InsertRegionNoLodCalc(std::ostringstream* os, int indent, const khExtents<double>& extents, int min_lod, int max_lod); void AddDebugGeometry(std::ostringstream* os, const khExtents<double>& extents, const std::string& image_name, int draw_order); void ExtractImageryTile(const std::string& name, const khTileAddr& addr, khOpacityMask::OpacityType *opacity, ImageExtentsMap* images); /* * collect statistics of output tiles */ class TileStats { public: int opacity[4]; int total; int jpg_uncompressed; int jpg_compressed; int jpg_total; int png_uncompressed; int png_compressed; int png_total; int total_tiles; TileStats() { memset(opacity, 0, 4); jpg_uncompressed = 0; jpg_compressed = 0; jpg_total = 0; png_uncompressed = 0; png_compressed = 0; png_total = 0; } void Dump(int total_tiles) { for (int o = 0; o < 4; ++o) printf("%s : %d (%f)\n", khOpacityMask::toString((khOpacityMask::OpacityType)o).c_str(), opacity[o], (float)opacity[o] / (float)total); printf("total: %d\n\n", total); printf("JPG Tiles: %d ", jpg_total); if (jpg_total) { printf("avg tile sz: %f, compression ratio: %f\n", (float)jpg_compressed / (float)jpg_total, (float)jpg_compressed / (float)jpg_uncompressed); } else { printf("\n"); } printf("PNG Tiles: %d ", png_total); if (png_total) { printf("avg tile sz: %f, compression ratio: %f\n", (float)png_compressed / (float)png_total, (float)png_compressed / (float)png_uncompressed); } else { printf("\n"); } printf("Transparent tiles discarded: %d\n", total_tiles - jpg_total - png_total); } void AddOpacity(khOpacityMask::OpacityType type) { ++opacity[type]; ++total; } void AddJPG(int uncompressed, int compressed) { jpg_uncompressed += uncompressed; jpg_compressed += compressed; ++jpg_total; } void AddPNG(int uncompressed, int compressed) { png_uncompressed += uncompressed; png_compressed += compressed; ++png_total; } }; /* * Global variables are used here because various subroutines * need to access them. * * This cpp file is a self-contained application so a containing * class is overkill. */ namespace { TileStats tile_stats; khDeleteGuard<khRasterProduct> rp_rgb; khDeleteGuard<khRasterProduct> rp_alpha; std::string out_dir; std::string layer_name("Fusion generated KML Super-overlay"); bool kml_only = false; bool no_kmz = false; std::string file_ext; bool debug = false; int min_lod = INT_MIN; int max_lod = INT_MIN; int tile_size = 256; int draw_order_offset = 0; uint image_dir_break = 5; CachingProductTileReader_Alpha inset_alpha_reader(100, 15); Compressor* jpg_compressor = NULL; int jpg_quality = 80; Compressor* png_compressor = NULL; AlphaProductTile alpha_tile; uchar interleave_buffer[RasterProductTileResolution * RasterProductTileResolution * 4]; } // unnamed namespace int main(int argc, char *argv[]) { std::string progname = argv[0]; // process commandline options int argn; bool help = false; std::string url_root; std::string mask_product; std::string imagery_product; std::string assetref; double north_boundary = 90.0; double south_boundary = -90.0; double east_boundary = 180.0; double west_boundary = -180.0; khGetopt options; options.flagOpt("help", help); options.flagOpt("?", help); options.flagOpt("kml_only", kml_only); options.flagOpt("no_kmz", no_kmz); options.flagOpt("debug", debug); options.opt("kip", imagery_product); options.opt("kmp", mask_product); options.opt("assetref", assetref); options.opt("output", out_dir); options.opt("url", url_root); options.opt("jpg_quality", jpg_quality); options.opt("tile_size", tile_size); options.opt("layer_name", layer_name); options.opt("drawOrder", draw_order_offset); options.opt("north_boundary", north_boundary); options.opt("south_boundary", south_boundary); options.opt("east_boundary", east_boundary); options.opt("west_boundary", west_boundary); // unadvertised options options.opt("min_lod", min_lod); options.opt("max_lod", max_lod); options.opt("break_imgdir", image_dir_break); if (!options.processAll(argc, argv, argn)) usage(progname); if (help) usage(progname); if (argn != argc) // nothing can fall usage(progname); if (RasterProductTileResolution % tile_size != 0) notify(NFY_FATAL, "Tile size %d is invalid!", tile_size); // reasonable defaults that are probably good enough // though admittedly much more testing is needed if (min_lod == INT_MIN) min_lod = tile_size >> 1; if (max_lod == INT_MIN) max_lod = tile_size << 2; file_ext = no_kmz ? ".kml" : ".kmz"; if (!assetref.empty()) { if (!imagery_product.empty() || !mask_product.empty()) { notify(NFY_FATAL, "--assetref or --kip/--kmp must be specified"); } std::string ref; try { ref = AssetDefs::GuessAssetVersionRef(assetref, std::string()); } catch (const std::exception &e) { notify(NFY_FATAL, "%s", e.what()); } catch (...) { notify(NFY_FATAL, "Unknown error"); } AssetVersion asset_version(ref); if (!asset_version) { notify(NFY_FATAL, "Failed to open asset %s", assetref.c_str()); } std::vector<std::string> outfnames; asset_version->GetOutputFilenames(outfnames); if (outfnames.size() < 1) { notify(NFY_FATAL, "Failed to open asset %s", assetref.c_str()); } imagery_product = outfnames[0]; if (outfnames.size() >= 2) mask_product = outfnames[1]; } // open imagery product (rgb) if (imagery_product.empty() || !khHasExtension(imagery_product, ".kip")) notify(NFY_FATAL, "You must specify a valid imagery product (*.kip)"); rp_rgb = khRasterProduct::Open(imagery_product); if (!rp_rgb || rp_rgb->type() != khRasterProduct::Imagery) notify(NFY_FATAL, "Failed to open imagery product %s", imagery_product.c_str()); north_boundary = std::min(north_boundary, rp_rgb->degOrMeterNorth()); south_boundary = std::max(south_boundary, rp_rgb->degOrMeterSouth()); east_boundary = std::min(east_boundary, rp_rgb->degOrMeterEast()); west_boundary = std::max(west_boundary, rp_rgb->degOrMeterWest()); if (north_boundary <= south_boundary || east_boundary <= west_boundary) { notify(NFY_FATAL, "The chosen boundaries and kip result in zero area.\n"); } khCutExtent::cut_extent = khExtents<double>( NSEWOrder, north_boundary, south_boundary, east_boundary, west_boundary); // open mask product (alpha) if available if (mask_product.empty() || !khHasExtension(mask_product, ".kmp")) { notify(NFY_WARN, "You didn't specify a valid mask product (*.kmp)"); } else { rp_alpha = khRasterProduct::Open(mask_product); if (!rp_alpha || rp_alpha->type() != khRasterProduct::AlphaMask) notify(NFY_FATAL, "Failed to open mask product %s", mask_product.c_str()); } notify(NFY_DEBUG, "extents n=%lf s=%lf e=%lf w=%lf", north_boundary, south_boundary, east_boundary, west_boundary); notify(NFY_DEBUG, "min level=%d, max level=%d", rp_rgb->minLevel(), rp_rgb->maxLevel()); jpg_compressor = new JPEGCompressor(tile_size, tile_size, 3, jpg_quality); png_compressor = NewPNGCompressor(tile_size, tile_size, 4); // find the last 1x1 level and call it zero uint32 zero_level = UINT_MAX; for (uint32 l = rp_rgb->minLevel(); l <= rp_rgb->maxLevel(); ++l) { if (rp_rgb->level(l).tileExtents().numRows() == 1 && rp_rgb->level(l).tileExtents().numCols() == 1) { zero_level = l; } else { break; } } if (zero_level == UINT_MAX) notify(NFY_FATAL, "Unable to find a suitable zero level"); int total_tiles = 0; for (uint32 lev = zero_level; lev <= rp_rgb->maxLevel(); ++lev) { total_tiles += (rp_rgb->level(lev).tileExtents().numRows() * rp_rgb->level(lev).tileExtents().numCols()); } total_tiles = total_tiles * (RasterProductTileResolution / tile_size) * (RasterProductTileResolution / tile_size); notify(NFY_NOTICE, "Begin KML super-overlay extraction..."); if (!url_root.empty() && !EndsWith(url_root, "/")) url_root += "/"; OutputIndex(khCutExtent::cut_extent, url_root, rp_rgb->GetAcquisitionDate()); khProgressMeter progress(total_tiles, "Image Tiles"); // begin recursive descent DrillDown("0", khTileAddr(zero_level, rp_rgb->level(zero_level).tileExtents().beginRow(), rp_rgb->level(zero_level).tileExtents().beginCol()), &progress); printf("\n"); tile_stats.Dump(total_tiles); delete jpg_compressor; delete png_compressor; return 0; } bool DrillDown(const std::string& name, const khTileAddr& addr, khProgressMeter* progress) { // the top level min_lod must always be 0 so that this // overlay can be seen from space. bool top_level = name.length() == 1; int min_lod_override = top_level ? 0 : min_lod; int max_lod_override = top_level ? -1 : max_lod; if (!rp_rgb->validLevel(addr.level) || !rp_rgb->level(addr.level).tileExtents(). ContainsRowCol(addr.row, addr.col)) { return false; } progress->incrementDone((RasterProductTileResolution / tile_size) * (RasterProductTileResolution / tile_size)); // consult opacity mask (if provided) to determine if we can skip // this tile, save as jpg or save as png khOpacityMask::OpacityType opacity = rp_alpha ? rp_alpha->opacityMask()->GetOpacity(addr) : khOpacityMask::Opaque; if (opacity == khOpacityMask::Transparent) { tile_stats.AddOpacity(opacity); // TODO: count transparent children and add to tile_stats return false; } // sometimes the extract will discard the tile due to unknown // opacity mask yielding completely transparent alpha ImageExtentsMap images; ExtractImageryTile(name, addr, &opacity, &images); tile_stats.AddOpacity(opacity); if (opacity == khOpacityMask::Transparent) { // TODO: count transparent children and add to tile_stats return false; } std::ostringstream os; os << std::fixed << std::setprecision(17); os << kKMLHeader << std::endl; os << "<Document>" << std::endl; int child_count = 0; if (DrillDown(name + "0", addr.QuadChild(0), progress)) { AddChild(&os, name + "0", addr.QuadChild(0)); ++child_count; } if (DrillDown(name + "1", addr.QuadChild(1), progress)) { AddChild(&os, name + "1", addr.QuadChild(1)); ++child_count; } if (DrillDown(name + "2", addr.QuadChild(2), progress)) { AddChild(&os, name + "2", addr.QuadChild(2)); ++child_count; } if (DrillDown(name + "3", addr.QuadChild(3), progress)) { AddChild(&os, name + "3", addr.QuadChild(3)); ++child_count; } // last level must never turn off if (child_count == 0) max_lod_override = -1; khExtents<double> extents = addr.degExtents(RasterProductTilespaceBase); InsertRegion(&os, 1, extents, min_lod_override, max_lod_override); int draw_order = name.length() + draw_order_offset; for (ImageExtentsMapIterator image = images.begin(); image != images.end(); ++image) { // every document can have only one region so add sub-documents os << " <Document>" << std::endl; int min_lod_img = min_lod_override; int max_lod_img = max_lod_override; if (min_lod_img != 0 || max_lod_img != -1) { const double n = std::min(extents.north(), image->second.north()); const double s = std::max(extents.south(), image->second.south()); const double e = std::min(extents.east(), image->second.east()); const double w = std::max(extents.west(), image->second.west()); const double area1 = (extents.north() - extents.south()) * (extents.east() - extents.west()); const double area2 = (n - s) * (e - w); if (area1 != area2) { double lod_ratio = sqrt(area2/area1); if (min_lod_img != 0) { min_lod_img = static_cast<int>(min_lod_img * lod_ratio); } if (max_lod_img != -1) { max_lod_img = static_cast<int>(max_lod_img * lod_ratio); } } } InsertRegionNoLodCalc(&os, 2, image->second, min_lod_img, max_lod_img); os << " <GroundOverlay>" << std::endl; os << " <drawOrder>" << draw_order << "</drawOrder>" << std::endl; os << " <Icon>" << std::endl; os << " <href>../" << image->first << "</href>" << std::endl; os << " </Icon>" << std::endl; os << " <LatLonBox>" << std::endl; os << " <north>" << image->second.north() << "</north>" << std::endl; os << " <south>" << image->second.south() << "</south>" << std::endl; os << " <east>" << image->second.east() << "</east>" << std::endl; os << " <west>" << image->second.west() << "</west>" << std::endl; os << " </LatLonBox>" << std::endl; os << " </GroundOverlay>" << std::endl; // output debug geometry // blue X on tile means jpg, red means png if (debug) { AddDebugGeometry(&os, image->second, image->first, draw_order * 2); } os << " </Document>" << std::endl; } os << "</Document>" << std::endl; os << "</kml>" << std::endl; std::string kml_path(out_dir + "/kml/" + name + ".kml"); if (!khWriteSimpleFile(kml_path, os.str().c_str(), os.str().length())) notify(NFY_WARN, "Problem writing kml file: %s", kml_path.c_str()); if (!no_kmz) { std::string kmz_path = khReplaceExtension(kml_path, ".kmz"); std::string cmd = "/usr/bin/zip -m -q " + kmz_path + " " + kml_path; if (system(cmd.c_str()) == -1) notify(NFY_WARN, "Failed to make kmz - %s", cmd.c_str()); } return true; } void AddChild(std::ostringstream* os, const std::string& name, const khTileAddr& addr) { khExtents<double> extents = addr.degExtents(RasterProductTilespaceBase); *os << " <NetworkLink>" << std::endl; *os << " <name>" << name << "</name>" << std::endl; // max lod of networklink hierarchy must always be -1 // so that you can't pass through it without loading InsertRegion(os, 2, extents, min_lod, -1); *os << " <Link>" << std::endl; *os << " <href>" << name << file_ext << "</href>" << std::endl; *os << " <viewRefreshMode>onRegion</viewRefreshMode>" << std::endl; *os << " </Link>" << std::endl; *os << " </NetworkLink>" << std::endl; } bool OutputIndex(const khExtents<double>& extents, const std::string& url_root, const std::string& time_stamp) { std::ostringstream os; os << std::fixed << std::setprecision(17); os << kKMLHeader << std::endl; os << "<NetworkLink>" << std::endl; os << " <name>" << layer_name << "</name>" << std::endl; if (!time_stamp.empty() && time_stamp != kUnknownDate) { os << " <TimeStamp>" << std::endl; // http://code.google.com/apis/kml/documentation/kmlreference.html#timestamp // Print TimeStamp depending on various forms of Fusion time_stamp. // YYYY-MM-DD -> YYYY-MM-DD (date) // YYYY-MM-00 -> YYYY-MM (gYearMonth) // YYYY-00-00 -> YYYY (gYear) const size_t remove_pos = time_stamp.find("-00", 4); if (remove_pos == std::string::npos) { os << " <when>" << time_stamp << "</when>" << std::endl; } else { os << " <when>" << time_stamp.substr(0, remove_pos) << "</when>" << std::endl; } os << " </TimeStamp>" << std::endl; } os << " <Style>" << std::endl; os << " <ListStyle>" << std::endl; os << " <listItemType>checkHideChildren</listItemType>" << std::endl; os << " </ListStyle>" << std::endl; os << " </Style>" << std::endl; InsertRegion(&os, 1, extents, 0, -1); os << " <Link>" << std::endl; os << " <href>" << url_root << "kml/0" << file_ext << "</href>" << std::endl; os << " <viewRefreshMode>onRegion</viewRefreshMode>" << std::endl; os << " </Link>" << std::endl; os << "</NetworkLink>" << std::endl; os << "</kml>" << std::endl; return khWriteSimpleFile(out_dir + "/index.kml", os.str().c_str(), os.str().length()); } void InsertRegion(std::ostringstream* os, int indent, const khExtents<double>& extents, int min_lod, int max_lod) { const double n = std::min(extents.north(), khCutExtent::cut_extent.north()); const double s = std::max(extents.south(), khCutExtent::cut_extent.south()); const double e = std::min(extents.east(), khCutExtent::cut_extent.east()); const double w = std::max(extents.west(), khCutExtent::cut_extent.west()); if (min_lod != 0 || max_lod != -1) { const double area1 = (extents.north() - extents.south()) * (extents.east() - extents.west()); const double area2 = (n - s) * (e - w); if (area1 != area2) { const double lod_ratio = sqrt(area2/area1); if (min_lod != 0) { min_lod = static_cast<int>(min_lod * lod_ratio); } if (max_lod != -1) { max_lod = static_cast<int>(max_lod * lod_ratio); } } } std::string sp(2 * indent, ' '); *os << sp << "<Region>" << std::endl; *os << sp << " <LatLonAltBox>" << std::endl; *os << sp << " <north>" << n << "</north>" << std::endl; *os << sp << " <south>" << s << "</south>" << std::endl; *os << sp << " <east>" << e << "</east>" << std::endl; *os << sp << " <west>" << w << "</west>" << std::endl; *os << sp << " </LatLonAltBox>" << std::endl; *os << sp << " <Lod>" << std::endl; *os << sp << " <minLodPixels>" << min_lod << "</minLodPixels>" << std::endl; *os << sp << " <maxLodPixels>" << max_lod << "</maxLodPixels>" << std::endl; *os << sp << " </Lod>" << std::endl; *os << sp << "</Region>" << std::endl; } void InsertRegionNoLodCalc(std::ostringstream* os, int indent, const khExtents<double>& extents, const int min_lod, const int max_lod) { std::string sp(2 * indent, ' '); *os << sp << "<Region>" << std::endl; *os << sp << " <LatLonAltBox>" << std::endl; *os << sp << " <north>" << extents.north() << "</north>" << std::endl; *os << sp << " <south>" << extents.south() << "</south>" << std::endl; *os << sp << " <east>" << extents.east() << "</east>" << std::endl; *os << sp << " <west>" << extents.west() << "</west>" << std::endl; *os << sp << " </LatLonAltBox>" << std::endl; *os << sp << " <Lod>" << std::endl; *os << sp << " <minLodPixels>" << min_lod << "</minLodPixels>" << std::endl; *os << sp << " <maxLodPixels>" << max_lod << "</maxLodPixels>" << std::endl; *os << sp << " </Lod>" << std::endl; *os << sp << "</Region>" << std::endl; } /* * Debugging geometry is useful to see when image tiles are fading in/out * blended tiles (PNG) will be drawn with a red outline * solid tiles (JPG) will be drawn with a blue outline */ void AddDebugGeometry(std::ostringstream* os, const khExtents<double>& extents, const std::string& image_name, int draw_order) { std::string line_color; std::string poly_color; if(khHasExtension(image_name, "jpg")) { line_color = "e0ff0000"; // Blue poly_color = "a0ff0000"; } else { line_color = "e00000ff"; // Red poly_color = "a00000ff"; } std::string sp(4, ' '); int alt = 100; *os << sp << "<Placemark>" << std::endl; *os << sp << " <drawOrder>" << draw_order << "</drawOrder>" << std::endl; *os << sp << " <name>" << image_name << "</name>" << std::endl; *os << sp << " <Style>" << std::endl; *os << sp << " <LineStyle>" << std::endl; *os << sp << " <color>" << line_color << "</color>" << std::endl; *os << sp << " <width>5</width>" << std::endl; *os << sp << " </LineStyle>" << std::endl; *os << sp << " <PolyStyle>" << std::endl; *os << sp << " <color>" << poly_color << "</color>" << std::endl; *os << sp << " </PolyStyle>" << std::endl; *os << sp << " </Style>" << std::endl; *os << sp << " <LineString>" << std::endl; //*os << sp << " <altitudeMode>relativeToGround</altitudeMode>" << std::endl; *os << sp << " <tessellate>1</tessellate>" << std::endl; *os << sp << " <coordinates>" << std::endl; *os << sp << " " << extents.west() << ", " << extents.south() << ", " << alt << std::endl; *os << sp << " " << extents.west() << ", " << extents.north() << ", " << alt << std::endl; *os << sp << " " << extents.east() << ", " << extents.north() << ", " << alt << std::endl; *os << sp << " " << extents.east() << ", " << extents.south() << ", " << alt << std::endl; *os << sp << " " << extents.west() << ", " << extents.south() << ", " << alt << std::endl; *os << sp << " </coordinates>" << std::endl; *os << sp << " </LineString>" << std::endl; *os << sp << "</Placemark>" << std::endl; } typedef khRasterTile<uchar, RasterProductTileResolution, RasterProductTileResolution, 4> FourChannelTile; typedef khRasterTileBorrowBufs<FourChannelTile> FourChannelBorrowTile; void ExtractImageryTile(const std::string& name, const khTileAddr& addr, khOpacityMask::OpacityType *opacity, ImageExtentsMap* images) { const bool is_monochromatic = rp_rgb->level(addr.level).IsMonoChromatic(); ImageryProductTile rgb_tile(is_monochromatic); rp_rgb->level(addr.level).ReadTile(addr.row, addr.col, rgb_tile); if (*opacity != khOpacityMask::Opaque) { khRasterProductLevel* alpha_level = &rp_alpha->level( std::min(addr.level, rp_alpha->maxLevel())); inset_alpha_reader.ReadTile(alpha_level, addr, alpha_tile, true /* fillMissingWithZero */); if (*opacity == khOpacityMask::Unknown) { *opacity = ComputeOpacity(alpha_tile); } if (*opacity == khOpacityMask::Transparent) { return; } } // break up image directory based on the length of the name std::string split_name; for (uint n = 0; n < name.length(); n += image_dir_break) { if (split_name.length() != 0) split_name += "/"; split_name += name.substr(n, std::min(image_dir_break, static_cast<uint>(name.length() - n))); } const khExtents<double> extents = addr.degExtents(RasterProductTilespaceBase); const int grid_size = RasterProductTileResolution / tile_size; const double lat_step = fabs((extents.north() - extents.south()) / double(grid_size)); const double lon_step = fabs((extents.east() - extents.west()) / double(grid_size)); const double pxl_height = fabs((extents.north() - extents.south()) / RasterProductTileResolution); const double pxl_width = fabs((extents.east() - extents.west()) / RasterProductTileResolution); for (int row = 0; row < grid_size; ++row) { for (int col = 0; col < grid_size; ++col) { khExtents<double> sub_extents(RowColOrder, extents.south() + (lat_step * row), extents.south() + (lat_step * (row + 1)), extents.west() + (lon_step * col), extents.west() + (lon_step * (col + 1))); const khExtents<double> cut_extents = khExtents<double>::Intersection( sub_extents, khCutExtent::cut_extent); // ignore any sub-tiles that are outside our image extents if (cut_extents.degenerate()) { continue; } const khExtents<uint32> cut_extents_pxl( NSEWOrder, static_cast<int>(floor((cut_extents.north() - extents.south()) / pxl_height)), static_cast<int>(ceil((cut_extents.south() - extents.south()) / pxl_height)), static_cast<int>(floor((cut_extents.east() - extents.west()) / pxl_width)), static_cast<int>(ceil((cut_extents.west() - extents.west()) / pxl_width))); bool need_to_cut = !kml_only && (sub_extents != cut_extents); const int width = need_to_cut ? cut_extents_pxl.width() : tile_size; const int height = need_to_cut ? cut_extents_pxl.height() : tile_size; // Another degenerate case, skip this tile for this level. It will // eventually show up in lower levels anyway. // This may happen when the source image extends less than one pixel // in height or width in a sub-tile. if (width < 1 || height < 1) { continue; } int sub = (row * grid_size) + col; std::string image_name = "imagery/" + split_name + "_" + ToString(sub); khOpacityMask::OpacityType sub_opacity = *opacity; if (sub_opacity != khOpacityMask::Opaque) { sub_opacity = ComputeOpacity(alpha_tile, cut_extents_pxl); } // ignore transparent sub-tiles if (sub_opacity == khOpacityMask::Transparent) continue; Compressor * compressor = NULL; if (sub_opacity == khOpacityMask::Opaque) { // create JPG tile image_name += ".jpg"; if (!kml_only) { ExtractAndInterleave(rgb_tile, cut_extents_pxl.beginRow(), cut_extents_pxl.beginCol(), cut_extents_pxl.size(), StartUpperLeft, interleave_buffer); if (need_to_cut) { compressor = new JPEGCompressor(width, height, 3, jpg_quality); } else { compressor = jpg_compressor; } compressor->compress((char*)interleave_buffer); khWriteSimpleFile(out_dir + "/" + image_name, compressor->data(), compressor->dataLen()); tile_stats.AddJPG(width * height * 3, compressor->dataLen()); } } else { // create PNG tile image_name += ".png"; if (!kml_only) { uchar* bufs[4] = { rgb_tile.bufs[0], rgb_tile.bufs[1], rgb_tile.bufs[2], alpha_tile.bufs[0] }; FourChannelBorrowTile borrow_tile(bufs, is_monochromatic); ExtractAndInterleave(borrow_tile, cut_extents_pxl.beginRow(), cut_extents_pxl.beginCol(), cut_extents_pxl.size(), StartUpperLeft, interleave_buffer); if (need_to_cut) { compressor = NewPNGCompressor(width, height, 4); } else { compressor = png_compressor; } compressor->compress((char*)interleave_buffer); khWriteSimpleFile(out_dir + "/" + image_name, compressor->data(), compressor->dataLen()); tile_stats.AddPNG(width * height * 4, compressor->dataLen()); } } if (need_to_cut) { delete compressor; } (*images)[image_name] = need_to_cut ? cut_extents : sub_extents; } } }
[ "avnish@sunrise.mtv.corp.google.com" ]
avnish@sunrise.mtv.corp.google.com
fb772e6a340fe313c3e0e718206ad0e854f1ed86
f13c1d496af0d55c0b4608fbd5d40f7878496c89
/CPP Project/알고리즘챌린지/가운데를 말해요.cpp
1e0ce64cac9940b300b1e75f1be5e6df6a343fc6
[]
no_license
ezzooooo/CPP-Project
ff13dec8a8ddfe5f549ef81464a5582b25df39a8
405365585c53565120393ffc9503140c51e52b9a
refs/heads/master
2020-12-05T06:44:43.095012
2020-04-24T07:03:15
2020-04-24T07:03:15
232,038,196
4
0
null
null
null
null
UTF-8
C++
false
false
1,069
cpp
//#include <iostream> //#include <vector> //#include <queue> // //using namespace std; // //priority_queue<int> max_heap; //priority_queue<int, vector<int>, greater<int>> min_heap; // //int main() { // // int n; // scanf("%d", &n); // // for (int i = 0; i < n; i++) { // int input; // scanf("%d", &input); // // if (max_heap.size() == min_heap.size()) { // if (max_heap.size() == 0 && min_heap.size() == 0) { // max_heap.push(input); // } // else { // if (min_heap.top() < input) { // int temp = min_heap.top(); // min_heap.pop(); // min_heap.push(input); // max_heap.push(temp); // } // else { // max_heap.push(input); // } // } // } // else { // if (max_heap.top() > input) { // int temp = max_heap.top(); // max_heap.pop(); // max_heap.push(input); // min_heap.push(temp); // } // else { // min_heap.push(input); // } // } // // printf("%d\n", max_heap.top()); // } // // return 0; //}
[ "dkreka11@gmail.com" ]
dkreka11@gmail.com
3cf6f2a3b3c9a8187b12acd592b59d554aae1778
de1e806ef74d1af5343ddbc45fcf206e6d4b10d0
/src/RungWheelController/3x2.h
756aec4593bc9a444a5e1f566f1ab2ef9e998dcd
[ "BSD-3-Clause" ]
permissive
janelia-arduino/RungWheelController
ef6dde85e806fcb5ee0110b6009f7723c7ee1b20
ac7403ffce6a08f97320cc93fb62e45c52e4d89d
refs/heads/master
2021-09-25T22:52:28.877313
2021-09-17T14:58:54
2021-09-17T14:58:54
70,087,501
0
1
null
null
null
null
UTF-8
C++
false
false
834
h
// ---------------------------------------------------------------------------- // 3x2.h // // // Authors: // Peter Polidoro peter@polidoro.io // ---------------------------------------------------------------------------- #ifndef RUNG_WHEEL_CONTROLLER_3X2_CONSTANTS_H #define RUNG_WHEEL_CONTROLLER_3X2_CONSTANTS_H #include "Constants.h" #if defined(__MK20DX256__) namespace rung_wheel_controller { namespace constants { // Pins // Units // Properties // Property values must be long, double, bool, long[], double[], bool[], char[], ConstantString *, (ConstantString *)[] extern const bool polarity_reversed_default[h_bridge_controller::constants::CHANNEL_COUNT]; extern const bool channels_enabled_default[h_bridge_controller::constants::CHANNEL_COUNT]; // Parameters // Functions // Callbacks // Errors } } #endif #endif
[ "peterpolidoro@gmail.com" ]
peterpolidoro@gmail.com
64632e16d56846f230336ea1f90d630dd7900efa
2fa08e83ad9e4445f3b44e5c3d51f8f007734802
/server/src/connection.cpp
661b43b87a5c4fbe319b33e098c6bd2c48000e44
[]
no_license
mgmillani/dicely-done
656a659dc7709a0883c1a661c2eb5c5ef2e05522
5620f296b928e4f9910fd2fcdcdae251baf8bc06
refs/heads/master
2021-01-19T03:16:46.772495
2015-06-29T20:40:27
2015-06-29T20:40:27
34,763,989
0
0
null
null
null
null
UTF-8
C++
false
false
5,725
cpp
#include <list> #include <string> #include <random> #include <time.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/fcntl.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <unistd.h> #include "connection.hpp" #include "debug.h" #define MSG_SIZE 64 Connection::Connection(int port, MultiGame *game, bool verbose) { this->verbose = verbose; this->generator.seed(time(NULL)); this->tcpPort = port; this->game = game; this->distribution = std::uniform_int_distribution<int>(1,6); this->setupSocket(); } void Connection::setupSocket() { struct hostent *he; //Resolv hostname to IP Address if ((he=gethostbyname("0.0.0.0")) == NULL) { // get the host info herror("gethostbyname"); } struct sockaddr_in tcpAddr; memset( &tcpAddr, '\0', sizeof(tcpAddr)); bool fail = true; int attempts = 0; while(fail) { attempts++; tcpAddr.sin_family = AF_INET; tcpAddr.sin_addr = *((struct in_addr *)he->h_addr); tcpAddr.sin_port = htons(this->tcpPort); ERR("Server port: %d\n", this->tcpPort); this->tcpSocket = socket(PF_INET, SOCK_STREAM, 0); int b = 1; setsockopt(this->tcpSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&b, sizeof(b)); if(fcntl(this->tcpSocket, F_SETFL, O_NONBLOCK) == -1) { TRACE("Error: %s (%d)\n", strerror(errno), errno); } if( -1 == bind(this->tcpSocket, (struct sockaddr *) &tcpAddr, sizeof(tcpAddr) ) ) { TRACE("Error: %s (%d)\n", strerror(errno), errno); this->tcpPort++; close(this->tcpSocket); } else { listen(this->tcpSocket, SOMAXCONN); fail = false; } } } void Connection::newConnections() { int newSocket = accept(this->tcpSocket, NULL, NULL); if(newSocket < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) { //TRACE("Error: %s (%d)\n", strerror(errno), errno); return; } if(fcntl(newSocket, F_SETFL, O_NONBLOCK) == -1) { TRACE("Error: %s (%d)\n", strerror(errno), errno); return; } Player *p = new Player("",0); p->socket = newSocket; this->players.push_back(p); if(this->verbose) { ERR("new client on socket %d\n", p->socket); } } void Connection::receiveMessages() { this->newConnections(); char buffer[MSG_SIZE]; for(std::list<Player*>::iterator it=this->players.begin() ; it != this->players.end() ; it++) { Player *player = *it; this->sender = player; int socket = player->socket; ssize_t s = recv(socket, buffer, sizeof(buffer)-1, 0); typedef enum e_state {S_TYPE, S_BET, S_REROLL, S_JOIN, S_SKIP} e_state; e_state state = S_TYPE; t_hand hand; hand.len = 0; while( s > 0 ) { buffer[s] = '\0'; if(this->verbose) { ERR("Player <%s> on socket %d sent '%s'\n", player->name.c_str(), player->socket, buffer); } char *word = strtok(buffer, " \n\t\r"); if(word != NULL) { do { switch(state) { // reads the type of the message case S_TYPE: if (strcmp(word, "bet") == 0) state = S_BET; else if(strcmp(word, "reroll") == 0) state = S_REROLL; else if(strcmp(word, "restart") == 0) { state = S_SKIP; this->restart(player); } else if(strcmp(word, "quit") == 0) { state = S_SKIP; this->quit(player); } else if(strcmp(word, "join") == 0) state = S_JOIN; else if(strcmp(word, "roll") == 0) { state = S_SKIP; this->roll(player); } else if(strcmp(word, "fold") == 0) { state = S_SKIP; this->fold(player); } break; // reads the name of the player case S_JOIN: player->name = std::string(word); this->join(player); break; // reads dice case S_REROLL: hand.values[hand.len] = atoi(word); hand.len++; break; case S_BET: this->bet(player, atoi(word)); break; case S_SKIP: break; } }while(NULL != (word = strtok(NULL, " \n\t\r")) && state != S_SKIP ); } s = recv(socket, buffer, sizeof(buffer), 0); } if(s==0) { if(this->verbose) { ERR("Player <%s> on socket %d disconnected\n", player->name.c_str(), player->socket); } it = this->players.erase(it); close(player->socket); delete player; } else { if(state == S_REROLL) this->reroll(player, hand); } } } void Connection::join(Player *player) { this->game->join(player); } void Connection::ack(Player *player) { if(this->game->getNeeded() == Game::Info::ACK && this->game->isPlayerTurn(player)) this->game->giveAck(); } void Connection::restart(Player *player) { if(this->game->getNeeded() == Game::Info::ACK) this->game->giveAck(player); } void Connection::fold(Player *player) { if(this->game->isPlayerTurn(player)) { this->game->giveFold(); } } void Connection::roll(Player *player) { if(this->game->getNeeded() == Game::Info::HAND && this->game->isPlayerTurn(player)) { t_hand hand; for(int i=0 ; i<5 ; i++) hand.values[i] = this->distribution(generator); hand.len = 5; this->game->giveHand(hand); this->game->giveHandAck(); } } void Connection::bet(Player *player, t_score val) { if(this->game->getNeeded() == Game::Info::BET && this->game->isPlayerTurn(player)) this->game->giveBet(val); } void Connection::reroll(Player *player, t_hand hand) { if(this->game->getNeeded() == Game::Info::HAND && this->game->isPlayerTurn(player)) { for(int i=hand.len ; i<5 ; i++) hand.values[i] = this->distribution(generator); hand.len = 5; this->game->giveHand(hand); this->game->giveHandAck(); } } void Connection::quit(Player *player) { this->game->quit(player->name); }
[ "marcelogmillani@gmail.com" ]
marcelogmillani@gmail.com
308beecaf741f4af7b9792c48df2dc532944df04
451ea083d1dce106ffb3ab7c78e8fa3abe61a725
/Day 134/bubbleSort.cpp
d31bf6299a02e81d4cc88df9f25400e3e1c7f83f
[]
no_license
S4ND1X/365-Days-Of-Code
52dd6a8b9d0f5c3c27b23da8914725e141d06596
257186d2a4d7c28a3063add55d6b72d20fccb111
refs/heads/master
2022-04-19T22:55:08.426317
2020-03-02T23:35:28
2020-03-02T23:35:28
164,487,731
5
1
null
null
null
null
UTF-8
C++
false
false
702
cpp
#include <iostream> using namespace std; //Create a macro, for from 0 to a limit #define forA(n) for(int x = 0; x<n; x++) //From limit to 0 #define forD(n) for(int x = n; x>=0; x--) int main(){ //Example Array int arr[] = {6,7,9,2,54,6,1,3,6,8,2,1}; int i, j, aux; //? Bubble sort for(i = 0; i<12; i++){ for(j = 0; j<12; j++){ if(arr[j] > arr[j+1]){ aux = arr[j]; arr[j] = arr[j+1]; arr[j+1] = aux; } } } printf("Ascendente: "); forA(12){ printf("%d->",arr[x]); } printf("\nDescendente: "); forD(12){ printf("%d->",arr[x]); } return 0; }
[ "42609763+S4ND1X@users.noreply.github.com" ]
42609763+S4ND1X@users.noreply.github.com
0579ca9349041cf6b2d49a0c8074cd550727647c
3ded37602d6d303e61bff401b2682f5c2b52928c
/ml/1072/Classes/Unit/tool/KettleNode.cpp
886c4aafad15d3e897223b23525dc9f1e09be30b
[]
no_license
CristinaBaby/Demo_CC
8ce532dcf016f21b442d8b05173a7d20c03d337e
6f6a7ff132e93271b8952b8da6884c3634f5cb59
refs/heads/master
2021-05-02T14:58:52.900119
2018-02-09T11:48:02
2018-02-09T11:48:02
120,727,659
0
0
null
null
null
null
UTF-8
C++
false
false
2,644
cpp
#include "KettleNode.h" #include "Global.h" #include "AudioHelp.h" #include "extensions/cocos-ext.h" #include "cocostudio/CCArmature.h" #include "cocostudio/Cocostudio.h" using namespace cocostudio; USING_NS_CC; USING_NS_CC_EXT; KettleNode::KettleNode() { m_pClippingNode = nullptr; m_pGridNode = nullptr; m_pWater = nullptr; } KettleNode::~KettleNode() { } KettleNode* KettleNode::create(Node* pParent) { KettleNode* node = new KettleNode(); if (node && node->init(pParent)) { node->autorelease(); return node; } CC_SAFE_RELEASE(node); return NULL; } bool KettleNode::init(Node* pParent) { ContainerNode::init(pParent); return true; } void KettleNode::addWater(std::string water,std::string mask,Vec2 pos) { m_pathWater = water; if (!m_pClippingNode) { m_pClippingNode = ClippingNode::create(Sprite::create(mask)); m_pParent->addChild(m_pClippingNode,1); } // m_pClippingNode->setStencil(Sprite::create(mask)); m_pClippingNode->setAlphaThreshold(0.5); m_pClippingNode->setPosition(pos); if (!m_pGridNode) { m_pGridNode = NodeGrid::create(); m_pClippingNode->addChild(m_pGridNode); } if (!m_pWater) { m_pWater = Sprite::create(water); m_pGridNode->addChild(m_pWater); }else{ m_pWater->setTexture(water); } m_pWater->setAnchorPoint(Vec2::ZERO); m_pWater->setPosition(-Vec2(m_pWater->getContentSize().width*0.5,m_pWater->getContentSize().height*0.5)); } void KettleNode::addPourWater(std::string water){ m_pathPourWater = std::string(water); } void KettleNode::waveWater(int wave) { if (m_pGridNode) { if (wave==0) { m_pGridNode->runAction(RepeatForever::create(Sequence::create(Liquid::create(1, Size(10, 10), 2, 3), DelayTime::create(0.1), NULL))); }else{ m_pGridNode->runAction(Liquid::create(3, Size(10, 10), wave, 5)); } } } void KettleNode::pourWater() { waveWater(8); if (m_pWater) { if(m_pathPourWater!=""){ m_pWater->setTexture(m_pathPourWater); } m_pWater->runAction(Sequence::create(ScaleTo::create(2, 0.3,1), DelayTime::create(0.5), CallFunc::create([=](){ m_pGridNode->stopAllActions(); if(m_pathWater!=""){ m_pWater->setTexture(m_pathWater); } m_pWater->setScale(1, 0.4); }), NULL)); } }
[ "wuguiling@smalltreemedia.com" ]
wuguiling@smalltreemedia.com
f94cac252e665450ccc750ed8fc2e758249b9055
d6eda0fc0f6a9cb463eef1f3938b4faf6056d1e2
/CPUT/source/CPUTMaterial.cpp
325fe965d480a38b23b9a70ac0aa09642c7adeef
[ "Apache-2.0" ]
permissive
zjucsxxd/ChatHeads
a061ee38eadb9f2c0adce4f793aa6346bf67b5cf
f83c43f7fd3537badd74c31545ce2a45340474ee
refs/heads/master
2020-03-27T05:08:05.931801
2017-06-05T19:26:06
2017-06-05T19:26:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,136
cpp
///////////////////////////////////////////////////////////////////////////////////////////// // Copyright 2017 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or imlied. // See the License for the specific language governing permissions and // limitations under the License. ///////////////////////////////////////////////////////////////////////////////////////////// #include "CPUT.h" #include "CPUTMaterial.h" #include "CPUTBuffer.h" #include "CPUTRenderStateBlock.h" #ifdef CPUT_FOR_DX11 #include "CPUTMaterialDX11.h" #else #if (defined(CPUT_FOR_OGL) || defined(CPUT_FOR_OGLES)) #include "CPUTMaterialOGL.h" #else #error You must supply a target graphics API (ex: #define CPUT_FOR_DX11), or implement the target API for this file. #endif #endif ConstantBufferDescription::ConstantBufferDescription() : pData(NULL), pBuffer(NULL), size(0), numUniforms(0), bindPoint(-1), bufferName(""), pUniformArrayLengths(NULL), pUniformIndices(NULL), pUniformNames(NULL), pUniformOffsets(NULL), pUniformSizes(NULL), pUniformTypes(NULL), modified(false) { } ConstantBufferDescription::~ConstantBufferDescription() { SAFE_RELEASE(pBuffer); SAFE_DELETE_ARRAY(pData); SAFE_DELETE_ARRAY(pUniformArrayLengths); SAFE_DELETE_ARRAY(pUniformIndices); SAFE_DELETE_ARRAY(pUniformNames); SAFE_DELETE_ARRAY(pUniformOffsets); SAFE_DELETE_ARRAY(pUniformSizes); SAFE_DELETE_ARRAY(pUniformSizes); SAFE_DELETE_ARRAY(pUniformTypes); } //-------------------------------------------------------------------------------------- CPUTMaterial *CPUTMaterial::Create( const std::string &absolutePathAndFilename, CPUT_SHADER_MACRO* pShaderMacros ){ // Create the material and load it from file. #ifdef CPUT_FOR_DX11 CPUTMaterial *pMaterial = CPUTMaterialDX11::Create(); #else #if (defined(CPUT_FOR_OGL) || defined(CPUT_FOR_OGLES)) CPUTMaterial *pMaterial = CPUTMaterialOGL::Create(); #else #error You must supply a target graphics API (ex: #define CPUT_FOR_DX11), or implement the target API for this file. #endif #endif CPUTResult result = pMaterial->LoadMaterial( absolutePathAndFilename, pShaderMacros ); ASSERT( CPUTSUCCESS(result), "\nError - CPUTAssetLibrary::GetMaterial() - Error in material file: '"+absolutePathAndFilename+"'" ); UNREFERENCED_PARAMETER(result); return pMaterial; } void CPUTMaterial::SetRenderStates() { if (mpRenderStateBlock) { mpRenderStateBlock->SetRenderStates(); } } CPUTRenderStateBlock* CPUTMaterial::GetRenderStateBlock(){ mpRenderStateBlock->AddRef(); return mpRenderStateBlock; };
[ "marissa@galacticsoft.net" ]
marissa@galacticsoft.net
5a15e15c88da127fd17f0d1a699195a94794bee2
76957b84c5c97ac08dd2baea6cd3d5db96d26012
/common_project/tool_kits/protocol/utils/byte_parser.h
0bb3fb89fb38c362ca35f81b2ca2b8100e8f1fea
[]
no_license
luchengbiao/base
4e14e71b9c17ff4d2f2c064ec4f5eb7e9ce09ac8
f8af675e01b0fee31a2b648eb0b95d0c115d68ff
refs/heads/master
2021-06-27T12:04:29.620264
2019-04-29T02:39:32
2019-04-29T02:39:32
136,405,188
0
1
null
null
null
null
UTF-8
C++
false
false
2,856
h
#ifndef __PROTO_UTILS_BYTE_PARSER_H__ #define __PROTO_UTILS_BYTE_PARSER_H__ #include <stddef.h> // for size_t #include <stdint.h> // for uint8_t #include <string> #include "protocol/macros.h" PROTO_NAMESPACE_BEGIN namespace byte_parser { class EndianChecker { public: static bool IsLittleEndian() { static EndianChecker checker; return checker.u_.c == 1; } private: EndianChecker() { u_.i = 1; } union { int i; char c; }u_; }; #define IS_LITTLE_ENDIAN (EndianChecker::IsLittleEndian()) // Read an integer (signed or unsigned) from |buf| template<typename T> inline void ReadFromBytes(const char buf[], T* out, bool read_as_lb_order = true) { if (IS_LITTLE_ENDIAN == read_as_lb_order) { *out = buf[0]; for (size_t i = 1; i < sizeof(T); ++i) { *out <<= 8; // Must cast to uint8_t to avoid clobbering by sign extension. *out |= static_cast<uint8_t>(buf[i]); } } else { *out = buf[sizeof(T) - 1]; for (int i = sizeof(T) - 2; i >= 0; --i) { *out <<= 8; *out |= static_cast<uint8_t>(buf[i]); } } } template<typename T> inline T ReadFromBytes(const char buf[], bool read_as_lb_order = true) { T t; ReadFromBytes(buf, &t, read_as_lb_order); return t; } // Write an integer (signed or unsigned) |val| to |buf| template<typename T> inline void WriteToBytes(char buf[], T val, bool write_as_lb_order = true) { if (IS_LITTLE_ENDIAN == write_as_lb_order) { for (size_t i = 0; i < sizeof(T); ++i) { buf[sizeof(T)-i - 1] = static_cast<char>(val & 0xFF); val >>= 8; } } else { for (size_t i = 0; i < sizeof(T); ++i) { buf[i] = static_cast<char>(val & 0xFF); val >>= 8; } } } inline int Bytes2Int(const char bytes[], bool read_as_lb_order = true) { return ReadFromBytes<int>(bytes, read_as_lb_order); } inline std::string Int2Bytes(int i, bool write_as_lb_order = true) { char bytes[sizeof(int)]; WriteToBytes(&bytes[0], i, write_as_lb_order); return std::string(std::cbegin(bytes), std::cend(bytes)); } inline long long Bytes2Longlong(const char *bytes, bool read_as_lb_order = true) { return ReadFromBytes<long long>(bytes, read_as_lb_order); } inline std::string Longlong2Bytes(long long ll, bool write_as_lb_order = true) { char bytes[sizeof(long long)]; WriteToBytes(&bytes[0], ll, write_as_lb_order); return std::string(std::cbegin(bytes), std::cend(bytes)); } union IntUFloat { float f; int i; }; inline float Bytes2Float(const char *bytes, bool read_as_lb_order = true) { IntUFloat iuf; iuf.i = Bytes2Int(bytes, read_as_lb_order); return iuf.f; } inline std::string Float2Bytes(float f, bool write_as_lb_order = true) { IntUFloat iuf; iuf.f = f; return Int2Bytes(iuf.i, write_as_lb_order); } } PROTO_NAMESPACE_END #endif
[ "993925668@qq.com" ]
993925668@qq.com
19d6cc0d08dee57956c4b08424aef757d467bc7b
b269741a89b98982a4692744b4b77bd04dc30ab6
/src/cpu/nhwc_pooling.cpp
92470f739643e37f738bfc288ac3a9a11cfb5493
[ "Intel", "Apache-2.0", "BSD-3-Clause" ]
permissive
ThejanW/mkl-dnn
c6a609a3f4ca445d62ee2f294dcb3a6d29b01696
ec3b670b709b529b230f2f62e333bdf44b2fc7fe
refs/heads/master
2020-03-19T12:11:02.233426
2018-06-05T14:27:43
2018-06-05T14:27:43
136,502,057
1
0
Apache-2.0
2018-06-07T16:10:09
2018-06-07T16:10:09
null
UTF-8
C++
false
false
15,969
cpp
/******************************************************************************* * Copyright 2018 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ #include <assert.h> #include <math.h> #include "c_types_map.hpp" #include "type_helpers.hpp" #include "math_utils.hpp" #include "nstl.hpp" #include "nhwc_pooling.hpp" namespace mkldnn { namespace impl { namespace cpu { #define MEM_D(name) name##_d #define DECLARE_READ_STRIDES(name) \ const size_t name##_n_stride = MEM_D(name).blocking_desc().strides[0][0]; \ const size_t name##_d_stride = (!is_3d) \ ? 0 \ : MEM_D(name).blocking_desc().strides[0][2]; \ const size_t name##_h_stride = (!is_3d) \ ? MEM_D(name).blocking_desc().strides[0][2] \ : MEM_D(name).blocking_desc().strides[0][3]; \ const size_t name##_w_stride = (!is_3d) \ ? MEM_D(name).blocking_desc().strides[0][3] \ : MEM_D(name).blocking_desc().strides[0][4]; namespace nhwc_pooling { size_t strided_offset(const int _n, const size_t _sn, const int _d, const size_t _sd, const int _h, const size_t _sh, const int _w, const size_t _sw) { return _n * _sn + _d * _sd + _h * _sh + _w * _sw; } } template <impl::data_type_t data_type> void nhwc_pooling_fwd_t<data_type>::array_div_by_const(const int n, const data_t *src, const size_t num, data_t *dst) { for (int i = 0; i < n; ++i) { float ftmp = (float)src[i]; ftmp = ftmp / num; dst[i] = math::out_round<data_t>(ftmp); } } template <impl::data_type_t data_type> void nhwc_pooling_fwd_t<data_type>::array_add(const int n, const data_t *src, data_t *dst) { for (int i = 0; i < n; ++i) { dst[i] += src[i]; } } template <impl::data_type_t data_type> void nhwc_pooling_fwd_t<data_type>::execute_forward() { using namespace alg_kind; using namespace prop_kind; using namespace nhwc_pooling; auto alg = conf_.desc()->alg_kind; auto src = reinterpret_cast<const data_t *>(this->input_memory(0)); auto dst = reinterpret_cast<data_t *>(this->memory(0)); unsigned char * ws = reinterpret_cast<unsigned char *>( alg == pooling_max && conf_.desc()->prop_kind == forward_training ? this->memory(1) : nullptr ); const memory_desc_wrapper MEM_D(dst)(conf_.dst_pd()); const memory_desc_wrapper MEM_D(ws)(conf_.workspace_pd()); const memory_desc_wrapper MEM_D(src)(conf_.src_pd()); const int ID = conf_.ID(); const int IH = conf_.IH(); const int IW = conf_.IW(); const int KD = conf_.KD(); const int KH = conf_.KH(); const int KW = conf_.KW(); const int SD = conf_.KSD(); const int SH = conf_.KSH(); const int SW = conf_.KSW(); const int padF = conf_.padFront(); const int padT = conf_.padT(); const int padL = conf_.padL(); const int MB = conf_.MB(); const int OC = conf_.C(); const int OD = conf_.OD(); const int OH = conf_.OH(); const int OW = conf_.OW(); const bool is_3d = conf_.desc()->src_desc.ndims == 5; const data_type_t ws_dt = ws ? ws_d.data_type() : data_type::undef; DECLARE_READ_STRIDES(src); DECLARE_READ_STRIDES(dst); auto apply_offset = [=](int index, int offset) { return (index > offset) ? index - offset : 0; }; #pragma omp parallel for collapse(4) schedule(static) for (int mb = 0; mb < MB; ++mb) for (int od = 0; od < OD; ++od) for (int oh = 0; oh < OH; ++oh) for (int ow = 0; ow < OW; ++ow) { size_t dst_offset_init = strided_offset(mb, dst_n_stride, od, dst_d_stride, oh, dst_h_stride, ow, dst_w_stride); if (alg == pooling_max) { size_t ws_offset_init = 0; if (ws) { DECLARE_READ_STRIDES(ws); ws_offset_init = strided_offset(mb, ws_n_stride, od, ws_d_stride, oh, ws_h_stride, ow, ws_w_stride); } // Note: GCC 4.8.5 won't vectorize below // simple loops unless they are singled out // into separate helper routines: // array_nhwc_initialize, array_nhwc_max if (!ws) array_nhwc_initialize<false>(OC, dst + dst_offset_init, ws, ws_offset_init, ws_dt); else array_nhwc_initialize<true>(OC, dst + dst_offset_init, ws, ws_offset_init, ws_dt); for (int kd = 0; kd < KD; ++kd) for (int kh = 0; kh < KH; ++kh) for (int kw = 0; kw < KW; ++kw) { const int id = od * SD - padF + kd; const int ih = oh * SH - padT + kh; const int iw = ow * SW - padL + kw; if (id < 0 || id >= ID) continue; if (ih < 0 || ih >= IH) continue; if (iw < 0 || iw >= IW) continue; size_t src_offset_init = strided_offset(mb, src_n_stride, id, src_d_stride, ih, src_h_stride, iw, src_w_stride); if (!ws) array_nhwc_max<false>(OC, dst + dst_offset_init, src + src_offset_init, ws, ws_offset_init, ws_dt, kd * KH * KW + kh * KW + kw ); else array_nhwc_max<true>(OC, dst + dst_offset_init, src + src_offset_init, ws, ws_offset_init, ws_dt, kd * KH * KW + kh * KW + kw ); } } else { // pooling_avg auto d = dst + dst_offset_init; utils::array_set(d, 0, OC); auto id_start = apply_offset(od * SD, padF); auto ih_start = apply_offset(oh * SH, padT); auto iw_start = apply_offset(ow * SW, padL); auto id_end = nstl::min(od * SD - padF + KD, ID); auto ih_end = nstl::min(oh * SH - padT + KH, IH); auto iw_end = nstl::min(ow * SW - padL + KW, IW); // it is cheaper to actually count this in a loop // as the typical kernel is small size_t num_summands = 0; for (int id = id_start; id < id_end; ++id) for (int ih = ih_start; ih < ih_end; ++ih) for (int iw = iw_start; iw < iw_end; ++iw) { size_t src_offset_init = strided_offset(mb, src_n_stride, id, src_d_stride, ih, src_h_stride, iw, src_w_stride); auto s = src + src_offset_init; // need to move the loop to separate function // for GCC 4.8.5 to vectorize array_add(OC, s, d); num_summands++; } num_summands = (alg == pooling_avg_include_padding) ? KW * KH * KD : num_summands; // need to move the loop to separate function // for GCC 4.8.5 to vectorize array_div_by_const(OC, d, num_summands, d); } } } template <impl::data_type_t data_type> void nhwc_pooling_bwd_t<data_type>::execute_backward() { using namespace alg_kind; using namespace nhwc_pooling; auto diff_dst = reinterpret_cast<const data_t *>(this->input_memory(0)); auto ws = conf_.desc()->alg_kind != alg_kind::pooling_max ? nullptr : reinterpret_cast<const unsigned char *>(this->input_memory(1)); auto diff_src = reinterpret_cast<data_t *>(this->memory(0)); const memory_desc_wrapper MEM_D(diff_dst)(conf_.diff_dst_pd()); const memory_desc_wrapper MEM_D(ws)(conf_.workspace_pd()); const memory_desc_wrapper MEM_D(diff_src)(conf_.diff_src_pd()); const int ID = conf_.ID(); const int IH = conf_.IH(); const int IW = conf_.IW(); const int KD = conf_.KD(); const int KH = conf_.KH(); const int KW = conf_.KW(); const int SD = conf_.KSD(); const int SH = conf_.KSH(); const int SW = conf_.KSW(); const int OC = conf_.C(); const int padF = conf_.padFront(); const int padT = conf_.padT(); const int padL = conf_.padL(); const int OD = conf_.OD(); const int OH = conf_.OH(); const int OW = conf_.OW(); const bool is_3d = conf_.desc()->diff_src_desc.ndims == 5; auto alg = conf_.desc()->alg_kind; DECLARE_READ_STRIDES(diff_src); DECLARE_READ_STRIDES(diff_dst); auto apply_offset = [=](int index, int offset) { return (index > offset) ? index - offset : 0; }; const int MB = conf_.MB(); #pragma omp parallel for collapse(4) schedule(static) for (int mb = 0; mb < MB; ++mb) for (int id = 0; id < ID; ++id) for (int ih = 0; ih < IH; ++ih) for (int iw = 0; iw < IW; ++iw) { size_t src_offset_init = strided_offset(mb, diff_src_n_stride, id, diff_src_d_stride, ih, diff_src_h_stride, iw, diff_src_w_stride); // check if kernel windows are disjoint, in this case there's no // update needed and we just write there once, no initialization // required. if (!(KD == SD && KH == SH && KW == SW)) for (int oc = 0; oc < OC; ++oc) diff_src[src_offset_init + oc] = data_type_t(0); // Find out which output cells may correspond to current // input position. Current input postition divided by // stride, with integer divide rounding down, is the // right-most output. // Left-most output may be computed if we decrement input // by (kernel_size - 1) and then do the same division by // stride. int od_left = nstl::max((id + padF - KD + 1) / SD, 0); int oh_left = nstl::max((ih + padT - KH + 1) / SH, 0); int ow_left = nstl::max((iw + padL - KW + 1) / SW, 0); // Notice +1 here to preserve the C loop "less than" // condition for continuing the for loop. int od_right = nstl::min((id + padF) / SD + 1 , OD); int oh_right = nstl::min((ih + padT) / SH + 1 , OH); int ow_right = nstl::min((iw + padL) / SW + 1 , OW); for (int od = od_left; od < od_right; ++od) for (int oh = oh_left; oh < oh_right; ++oh) for (int ow = ow_left; ow < ow_right; ++ow) { const int kd = id - od*SD + padF; const int kh = ih - oh*SH + padT; const int kw = iw - ow*SW + padL; if (kd < 0 || kd >= KD) continue; if (kh < 0 || kh >= KH) continue; if (kw < 0 || kw >= KW) continue; size_t dst_offset_init = strided_offset(mb, diff_dst_n_stride, od, diff_dst_d_stride, oh, diff_dst_h_stride, ow, diff_dst_w_stride); if (alg == pooling_max) { DECLARE_READ_STRIDES(ws); size_t ws_offset_init = strided_offset(mb, ws_n_stride, od, ws_d_stride, oh, ws_h_stride, ow, ws_w_stride); const int index = kd * KH * KW + kh * KW + kw; #pragma omp simd for (int oc = 0; oc < OC; ++oc) { const int index_from_ws = (MEM_D(ws).data_type() == data_type::u8) ? (int)ws[ws_offset_init + oc] : ((int *)ws)[ws_offset_init + oc]; const data_t d = diff_dst[dst_offset_init + oc]; // Check if kernel windows are disjoint, in this case // there's no update needed and we just write there once // otherwise we add value to the contents. if (!(KD == SD && KH == SH && KW == SW)) diff_src[src_offset_init + oc] += (index_from_ws == index) ? d : data_type_t(0); else diff_src[src_offset_init + oc] = (index_from_ws == index) ? d : data_type_t(0); } } else { // pooling_avg auto id_start = apply_offset(od*SD, padF); auto ih_start = apply_offset(oh*SH, padT); auto iw_start = apply_offset(ow*SW, padL); auto id_end = nstl::min(od*SD - padF + KD, ID); auto ih_end = nstl::min(oh*SH - padT + KH, IH); auto iw_end = nstl::min(ow*SW - padL + KW, IW); auto num_summands = (alg == pooling_avg_include_padding) ? KW*KH*KD : (ih_end - ih_start)*(iw_end - iw_start)*(id_end - id_start); #pragma omp simd for (int oc = 0; oc < OC; ++oc) { const data_t d = diff_dst[dst_offset_init + oc]; // Check if kernel windows are disjoint, in this case // there's no update needed and we just write there once // otherwise we add value to the contents. if (!(KD == SD && KH == SH && KW == SW)) diff_src[src_offset_init + oc] += d / num_summands; else diff_src[src_offset_init + oc] = d / num_summands; } } } } } template struct nhwc_pooling_fwd_t<data_type::f32>; template struct nhwc_pooling_bwd_t<data_type::f32>; } } } // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s
[ "nikita.astafiev@intel.com" ]
nikita.astafiev@intel.com
8629008eef6bae8c592357cd63ea434bf4dc156c
210adc5d8a9b4e157decf71a852bad4b163a2a8a
/lab5/src/lab5.cpp
cd40341b538e76af47bcb688dde97f38623377b6
[]
no_license
svyatoslavratov/sailfish-unn
08758187a900af3bb629a4f1686fe35c6e186553
145acedb4e2f9a08aa67b64300e52d03adc01ea8
refs/heads/main
2023-08-06T17:35:12.074498
2021-09-29T21:06:10
2021-09-29T21:06:10
411,828,678
0
0
null
null
null
null
UTF-8
C++
false
false
665
cpp
#ifdef QT_QML_DEBUG #include <QtQuick> #endif #include <sailfishapp.h> int main(int argc, char *argv[]) { // SailfishApp::main() will display "qml/lab5.qml", if you need more // control over initialization, you can use: // // - SailfishApp::application(int, char *[]) to get the QGuiApplication * // - SailfishApp::createView() to get a new QQuickView * instance // - SailfishApp::pathTo(QString) to get a QUrl to a resource file // - SailfishApp::pathToMainQml() to get a QUrl to the main QML file // // To display the view, call "show()" (will show fullscreen on device). return SailfishApp::main(argc, argv); }
[ "44136293+svyatoslavratov@users.noreply.github.com" ]
44136293+svyatoslavratov@users.noreply.github.com
b76056a4a207eadf441500df01708f3ab97e1d09
420911b750ec7cbe7aa6a293eedab9a181261557
/headers/asteroid.h
3f52dbd3b267d35f2ec1de4bd937e73c903e771c
[]
no_license
joelewis43/CS463
e05f328623a5ff75cca577ef40f285164b8900f7
e64e86543aec7a59de56e7bd09e8a068250026e9
refs/heads/master
2020-08-07T01:28:09.727173
2019-12-07T01:24:47
2019-12-07T01:24:47
213,240,071
0
0
null
2019-12-06T04:03:45
2019-10-06T20:37:34
null
UTF-8
C++
false
false
1,730
h
#ifndef ASTEROID_LEVEL_H #define ASTEROID_LEVEL_H #include "builder.h" #include "random.h" #include <math.h> #include <algorithm> class AsteroidLevel : public LevelBuilder { public: /** * Constructor for a LevelBuilder object * * @param rows - Number of rows that should generated for the level * @param cols - Number of columns for a row of the level **/ AsteroidLevel(int rows, int cols, int screenHeight) : LevelBuilder(rows, cols, screenHeight){}; /** * Re-Constructs the entire level and stores the level * in the level container **/ void reconstruct() { clear(); construct(); } /** * Constructs the entire level and stores the level * in the level container **/ void construct(); /** * Returns the name of the level * * @returns - name of the level **/ string name() { return "Asteroid Field"; } /** * Returns the next available row of the level * * @returns - A vector or row of Object pointers **/ vector<char> nextRow() { vector<char> row = level.at(0); level.pop_front(); return row; } /** * Indicates if a row is available in the level to be * retrieved * * @returns - True if a row is available **/ bool rowAvailable() { return level.size() > 0; } /** * Clears the contents of the matrix by freeing * memory and deleting all cells **/ void clear() { level.clear(); } /** * Destructor for the AsteroidLevel **/ ~AsteroidLevel(); }; #endif // !ASTEROID_LEVEL_H
[ "tmantock@gmail.com" ]
tmantock@gmail.com
16f879448bb96165ddd3d5b6f98db9f6b2e1ec3d
438fdcf2cbc55ceb7383b5b09b99ab24be1cce49
/src/SetupTab.cpp
731a1784473fcaee34d3659f9933a9986ff3e511
[]
no_license
Squirtle/lazy-newb-pack-qt
1e900bab8a3c39e273fe8a49073e04c325563e09
cddbf5bacaaf05b7f8b9dcc4290c0d481b3bddd4
refs/heads/master
2020-05-19T13:19:13.535807
2012-08-26T22:48:25
2012-08-26T22:48:25
3,108,045
3
1
null
null
null
null
UTF-8
C++
false
false
2,006
cpp
#include "SetupTab.h" #include "ui_SetupTab.h" #include "DwarfFortress.h" #include "DwarfFortressProcess.h" #include <QProcess> #include <QProcessEnvironment> #include <QFileDialog> #include <QDesktopServices> SetupTab::SetupTab(QWidget *parent) : QWidget(parent), ui(new Ui::SetupTab) { ui->setupUi(this); updateDFLocation(); connect(ui->changeInstallButton, SIGNAL(clicked()), this, SLOT(changeDFPressed())); connect(ui->playButton, SIGNAL(clicked()), this, SLOT(playPressed())); } SetupTab::~SetupTab() { delete ui; } void SetupTab::playPressed() { #ifdef Q_WS_X11 QProcessEnvironment env( QProcessEnvironment::systemEnvironment () ); // Work around for bug in Debian/Ubuntu SDL patch. env.insert( "SDL_DISABLE_LOCK_KEYS", "1"); // Center the screen. Messes up resizing. TODO: who/what needs this? //env.insert( "SDL_VIDEO_CENTERED", "1"); DwarfFortressProcess *df = new DwarfFortressProcess(this); df->setWorkingDirectory(DwarfFortress::instance().getDFFolder()); df->setProcessEnvironment(env); df->start("./libs/Dwarf_Fortress"); #endif #ifdef Q_WS_WIN QProcess::startDetached("\"" + DwarfFortress::instance().getDFFolder() + "/Dwarf Fortress.exe\""); #endif } void SetupTab::changeDFPressed() { const QString dir = QFileDialog::getExistingDirectory(this, tr("Choose DF Installation Directory"), QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if( dir.isEmpty() ) return; DwarfFortress::instance().setDFFolder(dir); updateDFLocation(); } void SetupTab::updateDFLocation() { if( DwarfFortress::instance().hasDF() ) { ui->dfInstallLabel->setText(tr("Using DF at:")); ui->dfLocationLabel->setText(DwarfFortress::instance().getDFFolder()); } else { ui->dfInstallLabel->setText(tr("Could not find a Dwarf Fortress Installation!")); ui->dfLocationLabel->setText(QString()); } }
[ "unnamedrambler@gmail.com" ]
unnamedrambler@gmail.com
a094f3919a7da2adf048ee29519dfc88ccaa4836
a7698637dbdd14cd765023c1a084934b8ff7f1d3
/benchmarks/stmbench7/code/src/parameters.h
a8ba54da26898043dc4d7c6c3f05ace3fbae707b
[]
no_license
shadyalaa/RWLE
394eee1907b521f0aaca63cbc6f64fa7e7f98935
03d28a78c14d0b4625bd3c9e27b2ef79f3082ef3
refs/heads/master
2021-06-22T14:33:14.290777
2017-04-06T21:33:49
2017-04-06T21:33:49
57,441,873
1
3
null
null
null
null
UTF-8
C++
false
false
14,222
h
#ifndef SB7_PARAMETERS_H_ #define SB7_PARAMETERS_H_ #include <cmath> #include <iostream> #include <vector> namespace sb7 { class ConfigParameters; class OperationProb; /** * These are final parameters for the benchmark. */ class Parameters { protected: static const int DEFAULT_NUM_ATOMIC_PER_COMP; static const int DEFAULT_NUM_CONN_PER_ATOMIC; static const int DEFAULT_DOCUMENT_SIZE; static const int DEFAULT_MANUAL_SIZE; static const int DEFAULT_NUM_COMP_PER_MODULE; static const int DEFAULT_NUM_ASSM_PER_ASSM; static const int DEFAULT_NUM_ASSM_LEVELS; static const int DEFAULT_NUM_COMP_PER_ASSM; static const int DEFAULT_NUM_MODULES; static const int DEFAULT_MIN_MODULE_DATE; static const int DEFAULT_MAX_MODULE_DATE; static const int DEFAULT_MIN_ASSM_DATE; static const int DEFAULT_MAX_ASSM_DATE; static const int DEFAULT_MIN_ATOMIC_DATE; static const int DEFAULT_MAX_ATOMIC_DATE; static const int DEFAULT_MIN_OLD_COMP_DATE; static const int DEFAULT_MAX_OLD_COMP_DATE; static const int DEFAULT_MIN_YOUNG_COMP_DATE; static const int DEFAULT_MAX_YOUNG_COMP_DATE; static const int DEFAULT_YOUNG_COMP_FRAC; static const int DEFAULT_TYPE_SIZE; static const int DEFAULT_NUM_TYPES; static const int DEFAULT_XY_RANGE; static const int DEFAULT_TITLE_SIZE; static const int DEFAULT_TRAVERSAL_RATIO; static const int DEFAULT_SHORT_TRAVERSAL_RATIO; static const int DEFAULT_OPERATIONS_RATIO; static const int DEFAULT_STRUCTURAL_MODIFICATIONS_RATIO; static const int DEFAULT_READ_ONLY_OPERATIONS_RATIO; static const int DEFAULT_THREAD_NUM; static const int DEFAULT_EXPERIMENT_LENGTH_MS; //Parameters of the output TTC histograms. static const int DEFAULT_MAX_LOW_TTC; static const int DEFAULT_HIGH_TTC_ENTRIES; static const double DEFAULT_HIGH_TTC_LOG_BASE; static const bool DEFAULT_STRUCTURE_MODIFICATION_ENABLED; static const bool DEFAULT_LONG_TRAVERSALS_ENABLED; static const bool DEFAULT_REPORT_TTC_HISTOGRAMS; static const int DEFAULT_VERBOSE_LEVEL; static const char *DEFAULT_FILE_NAME; static const bool DEFAULT_HINT_RO; static const bool DEFAULT_WRITE_ROOT; static const bool DEFAULT_INIT_SINGLE_TX; static const double MAX_TO_INITIAL_RATIO; protected: int numAtomicPerComp; int numConnPerAtomic; int documentSize; int manualSize; int numCompPerModule; int numAssmPerAssm; int numAssmLevels; int numCompPerAssm; int numModules; int initialTotalCompParts; int initialTotalBaseAssemblies; int initialTotalComplexAssemblies; int maxCompParts; int maxAtomicParts; int maxBaseAssemblies; int maxComplexAssemblies; int minModuleDate; int maxModuleDate; int minAssmDate; int maxAssmDate; int minAtomicDate; int maxAtomicDate; int minOldCompDate; int maxOldCompDate; int minYoungCompDate; int maxYoungCompDate; int youngCompFrac; int typeSize; int numTypes; int xyRange; int titleSize; int traversalRatio; int shortTraversalRatio; int operationsRatio; int structuralModificationsRatio; int readOnlyOperationsRatio; int threadNum; int experimentLengthMs; //Parameters of the output TTC histograms. int maxLowTtc; int highTtcEntries; double highTtcLogBase; bool structureModificationEnabled; bool longTraversalsEnabled; bool reportTtcHistograms; int verboseLevel; std::string fileName; bool hintRo; bool writeRoot; bool initSingleTx; bool runSpecificOp; std::vector<OperationProb> opsProb; public: Parameters(); ////////////////////////////////////////////////////////////// // getters are public as they are used to access parameters // ////////////////////////////////////////////////////////////// public: int getNumAtomicPerComp() const { return numAtomicPerComp; } int getNumConnPerAtomic() const { return numConnPerAtomic; } int getDocumentSize() const { return documentSize; } int getManualSize() const { return manualSize; } int getNumCompPerModule() const { return numCompPerModule; } int getNumAssmPerAssm() const { return numAssmPerAssm; } int getNumAssmLevels() const { return numAssmLevels; } int getNumCompPerAssm() const { return numCompPerAssm; } int getNumModules() const { return numModules; } int getInitialTotalCompParts() const { return initialTotalCompParts; } int getInitialTotalBaseAssemblies() const { return initialTotalBaseAssemblies; } int getInitialTotalComplexAssemblies() const { return initialTotalComplexAssemblies; } int getMaxCompParts() const { return maxCompParts; } int getMaxAtomicParts() const { return maxAtomicParts; } int getMaxBaseAssemblies() const { return maxBaseAssemblies; } int getMaxComplexAssemblies() const { return maxComplexAssemblies; } int getMinModuleDate() const { return minModuleDate; } int getMaxModuleDate() const { return maxModuleDate; } int getMinAssmDate() const { return minAssmDate; } int getMaxAssmDate() const { return maxAssmDate; } int getMinAtomicDate() const { return minAtomicDate; } int getMaxAtomicDate() const { return maxAtomicDate; } int getMinOldCompDate() const { return minOldCompDate; } int getMaxOldCompDate() const { return maxOldCompDate; } int getMinYoungCompDate() const { return minYoungCompDate; } int getMaxYoungCompDate() const { return maxYoungCompDate; } int getYoungCompFrac() const { return youngCompFrac; } int getTypeSize() const { return typeSize; } int getNumTypes() const { return numTypes; } int getXYRange() const { return xyRange; } int getTitleSize() const { return titleSize; } int getTraversalsRatio() const { return areLongTraversalsEnabled() ? traversalRatio : 0; } int getShortTraversalsRatio() const { return shortTraversalRatio; } int getOperationsRatio() const { return operationsRatio; } int getStructuralModificationsRatio() const { return isStructureModificationEnabled() ? structuralModificationsRatio : 0; } int getReadOnlyOperationsRatio() const { return readOnlyOperationsRatio; } int getThreadNum() const { return threadNum; } int getExperimentLengthMs() const { return experimentLengthMs; } int getMaxLowTtc() const { return maxLowTtc; } int getHighTtcEntries() const { return highTtcEntries; } double getHighTtcLogBase() const { return highTtcLogBase; } bool isStructureModificationEnabled() const { return structureModificationEnabled; } bool areLongTraversalsEnabled() const { return longTraversalsEnabled; } bool shouldReportTtcHistograms() const { return reportTtcHistograms; } bool shouldHintRo() const { return hintRo; } bool shouldWriteRoot() const { return writeRoot; } bool shouldInitSingleTx() const { return initSingleTx; } bool isRunSpecificOp() const { return runSpecificOp; } std::vector<OperationProb> getOpsProb() { return opsProb; } //////////////////////////////////////////////////////////////// // setters are protected as only initialization of parameters // // is done through init functions // //////////////////////////////////////////////////////////////// #ifdef CHANGEWORKLOAD public: #else protected: #endif void setNumAtomicPerComp(int val) { numAtomicPerComp = val; calcMaxAtomicParts(); } void setNumConnPerAtomic(int val) { numConnPerAtomic = val; } void setDocumentSize(int val) { documentSize = val; } void setManualSize(int val) { manualSize = val; } void setNumCompPerModule(int val) { numCompPerModule = val; calcInitialTotalCompParts(); } void setNumAssmPerAssm(int val) { numAssmPerAssm = val; calcInitialTotalBaseAssemblies(); } void setNumAssmLevels(int val) { numAssmLevels = val; calcInitialTotalBaseAssemblies(); } void setNumCompPerAssm(int val) { numCompPerAssm = val; calcInitialTotalCompParts(); } void setNumModules(int val) { numModules = val; calcInitialTotalCompParts(); } void calcInitialTotalCompParts() { initialTotalCompParts = getNumModules() * getNumCompPerModule(); calcMaxCompParts(); } void calcInitialTotalBaseAssemblies() { initialTotalBaseAssemblies = (int)::pow(getNumAssmPerAssm(), getNumAssmLevels() - 1); calcInitialTotalComplexAssemblies(); calcMaxBaseAssemblies(); } void calcInitialTotalComplexAssemblies() { initialTotalComplexAssemblies = (1 - getInitialTotalBaseAssemblies()) / (1 - getNumAssmPerAssm()); calcMaxComplexAssemblies(); } void calcMaxCompParts() { maxCompParts = (int)(getInitialTotalCompParts() * MAX_TO_INITIAL_RATIO); calcMaxAtomicParts(); } void calcMaxAtomicParts() { maxAtomicParts = getMaxCompParts() * getNumAtomicPerComp(); } void calcMaxBaseAssemblies() { maxBaseAssemblies = (int)(getInitialTotalBaseAssemblies() * MAX_TO_INITIAL_RATIO); } void calcMaxComplexAssemblies() { maxComplexAssemblies = (int)(getInitialTotalComplexAssemblies() * MAX_TO_INITIAL_RATIO); } void setMinModuleDate(int val) { minModuleDate = val; } void setMaxModuleDate(int val) { maxModuleDate = val; } void setMinAssmDate(int val) { minAssmDate = val; } void setMaxAssmDate(int val) { maxAssmDate = val; } void setMinAtomicDate(int val) { minAtomicDate = val; } void setMaxAtomicDate(int val) { maxAtomicDate = val; } void setMinOldCompDate(int val) { minOldCompDate = val; } void setMaxOldCompDate(int val) { maxOldCompDate = val; } void setMinYoungCompDate(int val) { minYoungCompDate = val; } void setMaxYoungCompDate(int val) { maxYoungCompDate = val; } void setYoungCompFrac(int val) { youngCompFrac = val; } void setTypeSize(int val) { typeSize = val; } void setNumTypes(int val) { numTypes = val; } void setXYRange(int val) { xyRange = val; } void setTitleSize(int val) { titleSize = val; } void setTraversalsRatio(int val) { traversalRatio = val; } void setShortTraversalsRatio(int val) { shortTraversalRatio = val; } void setOperationsRatio(int val) { operationsRatio = val; } void setStructuralModificationsRatio(int val) { structuralModificationsRatio = val; } void setReadOnlyOperationsRatio(int val) { readOnlyOperationsRatio = val; } void setThreadNum(int val) { threadNum = val; } void setExperimentLengthMs(int val) { experimentLengthMs = val; } void setMaxLowTtc(int val) { maxLowTtc = val; } void setHighTtcEntries(int val) { highTtcEntries = val; } void setHighTtcLogBase(double val) { highTtcLogBase = val; } void setStructureModificationEnabled(bool val) { structureModificationEnabled = val; } void setLongTraversalsEnabled(bool val) { longTraversalsEnabled = val; } void setReportTtcHistograms(bool val) { reportTtcHistograms = val; } void setVerboseLevel(int val) { verboseLevel = val; } void setFileName(const std::string &val) { fileName = val; } void setHintRo(bool val) { hintRo = val; } void setWriteRoot(bool val) { writeRoot = val; } void setInitSingleTx(bool val) { initSingleTx = val; } /////////////////////////////////////////// // functions for initializing parameters // /////////////////////////////////////////// public: bool init(int argc, char **argv, std::ostream &out); protected: void initDefault(); void parseCommandLine(int argc, char **argv, ConfigParameters &configParams); void readFile(ConfigParameters &configParams); void applyParameters(ConfigParameters &configParams); void printHelp(std::ostream &out); int strToWorkloadType(std::string &val) const; int strToSizeType(std::string &val) const; ////////////////////// // print parameters // ////////////////////// public: void print(std::ostream &out = std::cout) const; }; extern Parameters parameters; /** * These are parameters read from the command line or from the config * file. * TODO think about splitting this into two classes - one for command line * parameters and the other one for file based parameters */ struct OperationProb { int operationIndex; int probability; }; struct ConfigParameters { // filename can be set only from command line bool fileNameSet; std::string fileName; // printing help and exiting can be set only from command line bool printHelp; bool readOnlyPercentSet; int percent; // takes precedence over previous parameter bool workloadTypeSet; enum { read_dominated = 0, read_write, write_dominated } workloadType; bool traversalsEnabledSet; bool traversalsEnabled; bool structuralModificationsEnabledSet; bool structuralModificationsEnabled; bool threadNumSet; int threadNum; bool experimentLengthSet; int experimentLength; bool sizeSet; enum { small = 0, medium, big } size; bool hintRoSet; bool hintRo; bool writeRootSet; bool writeRoot; bool initSingleTxSet; bool initSingleTx; bool runSpecificOp; std::vector<OperationProb> opsProb; void clean() { fileNameSet = false; printHelp = false; readOnlyPercentSet = false; workloadTypeSet = false; traversalsEnabledSet = false; structuralModificationsEnabledSet = false; threadNumSet = false; experimentLengthSet = false; sizeSet = false; hintRoSet = false; writeRootSet = false; initSingleTxSet = false; } }; } #endif /*SB7_PARAMETERS_H_*/
[ "shadyalaa@gmail.com" ]
shadyalaa@gmail.com
34438f5f5d0853fc1c3c646692c360f79584ea0f
9ad207e7b1adf68343438f7c7737e41f4847fcfd
/338. Counting Bits.cpp
c6013b59d34cd763d5a476e60b58b5326cb59421
[]
no_license
MahtabTanim/LeetCode
795200271025027198aa0e247d887f739957f8b5
a2bc61ed45cdf0aeda4336ec15023dec99a5af5f
refs/heads/master
2023-06-06T20:34:27.715906
2021-07-17T05:17:01
2021-07-17T05:17:01
275,657,471
0
0
null
null
null
null
UTF-8
C++
false
false
339
cpp
class Solution { public: vector<int> countBits(int num) { vector<int> V; for(int i = 0;i<=num;i++){ int x = i; int c =0; while(x>0){ c++; x=x&(x-1); } V.push_back(c); } return V; } };
[ "noreply@github.com" ]
noreply@github.com
e7f37dd639bacf7cac3402a219be842b677cbbb8
af67949764ed270923e594a1c255322afa0966a0
/test.cpp
db3acb9f97cf34c036f60bca31c549a4653e7102
[]
no_license
hadrian238890/TEST
d0cd14a2b68ae59adf11a3ec9e88500578ca99b4
e21fffca2f90742cab58618d6185c4a97c66c868
refs/heads/master
2020-04-15T00:28:19.119802
2019-01-06T17:27:07
2019-01-06T17:27:07
164,241,330
0
0
null
null
null
null
UTF-8
C++
false
false
1,124
cpp
#include <iostream> #include <cstdlib> #include <string> #include <set> using namespace std; void backToFront(string word) { for(int i = word.size(); i > -1; i--) { cout << word[i]; } cout << endl; } bool checkIfSameLetter1(string word) { cout << "Set container method " << endl; cout << "Are there any duplicated letters? " << endl; set<char> str; for(int i = 0; i < word.size(); i++) { str.insert(word[i]); } if(str.size() == word.size()) { return false; } else { return true; } } bool checkIfSameLetter2(string word) { cout << "2 Loops method" << endl; cout << "Are there any duplicated letters? " << endl; int counter = 0; for(int i = 0; i <= word.size(); i++) { for(int j = i+1; j <= word.size(); j++) { if(word[i] == word[j]) { counter++; } } } if(counter > 0) { return true; } else { return false; } cout << endl; } int main() { string letter; cout << "Hello world!" << endl; cout << "Type a word: "; cin >> letter; backToFront(letter); cout << checkIfSameLetter1(letter) << endl; cout << checkIfSameLetter2(letter) << endl; return 0; }
[ "hadrianpoland@gmail.com" ]
hadrianpoland@gmail.com
2d79b6bf5abc0760fff314e0d25e96599bec6fa9
491688a1b91cf96ed5f7a458aa77491e65baaa36
/B/Nearest_Neighbor.h
a87e0f1cce3e2c06971791e9329914b118d98724
[ "MIT" ]
permissive
annaptrd/Vector-image-representation-using-autocoding-NN
83796f51633c1d977c23a1da24cc5bf8a22be699
28b44b9b4fefc5e02789575194119fc2a0ffd61e
refs/heads/main
2023-05-27T08:09:37.142706
2021-05-30T16:17:02
2021-05-30T16:17:02
372,252,606
0
0
null
null
null
null
UTF-8
C++
false
false
262
h
#include <vector> #include <iostream> #ifndef Nearest_Neighbor_H #define Nearest_Neighbor_H using namespace std; void find_the_true_distance(vector <vector <int> > input_vector, vector <int> query, int* true_best_distance,int* true_nearest_neighbor); #endif
[ "noreply@github.com" ]
noreply@github.com
02e1db71df29d380ecb627421d297c28d233fd57
d15d4c2932159033e7563fe0889a2874b4822ce2
/Theme/kuangbin/1.EasySearch/A.cpp
7103f0a6bea6f974af123e6e955e7750a81d651b
[ "MIT" ]
permissive
lxdlam/CP-Answers
fd0ee514d87856423cb31d28298c75647f163067
cde519ef9732ff9e4e9e3f53c00fb30d07bdb306
refs/heads/master
2021-03-17T04:50:44.772167
2020-05-04T09:24:32
2020-05-04T09:24:32
86,518,969
1
1
null
null
null
null
UTF-8
C++
false
false
774
cpp
#include <cstring> #include <iostream> using namespace std; typedef long long ll; char board[9][9]; bool vis[9] = {false}; int n, res; void dfs(int row, int m) { if (m == 0) { res++; return; } if (row >= n) { return; } dfs(row + 1, m); for (int i = 0; i < n; i++) { if (board[row][i] == '#' && !vis[i]) { vis[i] = true; dfs(row + 1, m - 1); vis[i] = false; } } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int m; while (cin >> n >> m && n != -1) { cin.get(); res = 0; memset(board, 0, sizeof(board)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cin >> board[i][j]; cin.get(); } dfs(0, m); cout << res << endl; } return 0; }
[ "lxdlam@gmail.com" ]
lxdlam@gmail.com
72576d937c4e2b81fdf362e1706cf4e61291ad6a
107b1734db02c415f739c3375f2a3aaaa25c9692
/Dziennik_lekcyjny/Load_file.cpp
d88610a097db3f101b7764f3c2cd10091f0c8092
[]
no_license
KasiaBartoszek/SchoolRegister
d026c48c50a685362d75d961f2e740e785c7e7ef
0a8f6bc81230f6b1150c41a0db569f2d88382f44
refs/heads/master
2022-07-16T19:05:55.657777
2020-05-13T14:11:10
2020-05-13T14:11:10
263,647,246
0
0
null
null
null
null
UTF-8
C++
false
false
2,584
cpp
#include "Load_file.h" using namespace std; void Load_file::load_student(string inper, Students &obper) { fstream file_inper; file_inper.open((inper), ios::in); if (file_inper.good() == true) { string line, s_pesel, s_name, s_surname, s_date, s_street, s_apartment, s_city; while (getline(file_inper, line)) { student* stu = new student; int first_comma = line.find(','); s_pesel = line.substr(0, first_comma); stu->pesel = s_pesel; string temp1 = line.substr(first_comma + 2); int second_comma = temp1.find(','); s_name = temp1.substr(0, second_comma); stu->name = s_name; string temp2 = temp1.substr(second_comma + 2); int third_comma = temp2.find(','); s_surname = temp2.substr(0, third_comma); stu->surname = s_surname; string temp3 = temp2.substr(third_comma + 2); int fourth_comma = temp3.find(','); s_date = temp3.substr(0, fourth_comma); stu->date = s_date; string temp4 = temp3.substr(fourth_comma + 2); int fifth_comma = temp4.find(','); s_street = temp4.substr(0, fifth_comma); stu->street = s_street; string temp5 = temp4.substr(fifth_comma + 2); int sixth_comma = temp5.find(','); s_apartment = temp5.substr(0, sixth_comma); stu->apartment = s_apartment; string temp6 = temp5.substr(sixth_comma + 2); int seventh_comma = temp6.find(','); s_city = temp6.substr(0, seventh_comma); stu->city = s_city; obper+=((*stu)); // operator delete stu; } file_inper.close(); } } void Load_file::load_subject(string insub, Subjects &obsub) { fstream file_insub; file_insub.open((insub), ios::in); if (file_insub.good() == true) { string line, s_pesel, s_subjectname, s_grade, s_description; while (getline(file_insub, line)) { subject* sub = new subject; int first_comma = line.find(','); s_pesel = line.substr(0, first_comma); sub->pesel = s_pesel; string temp1 = line.substr(first_comma + 2); int second_comma = temp1.find(','); s_subjectname = temp1.substr(0, second_comma); sub->subjectname = s_subjectname; string temp2 = temp1.substr(second_comma + 2); int third_comma = temp2.find(','); s_grade = temp2.substr(0, third_comma); sub->grade = s_grade; string temp3 = temp2.substr(third_comma + 2); int fourth_comma = temp3.find(','); s_description = temp3.substr(0, fourth_comma); sub->description = s_description; obsub+=((*sub)); // operator delete sub; } file_insub.close(); } }
[ "noreply@github.com" ]
noreply@github.com
0fd744badc30770b7d2b22d6056a8d3991b7d625
348517397b884c6f12a3fe74f870fde1a14b7b07
/10-19/problem_12.cpp
70b40ef4a95975c2c886516ec73077012591d364
[]
no_license
xiaff/sword-offer-practice
899f7d9a15fdfaac0b5f0dd62faff525e9035f60
ce6bc52cb313c81aa68ca31d22d11f7036e22209
refs/heads/master
2021-01-10T01:19:50.562527
2015-10-26T15:40:09
2015-10-26T15:40:09
43,377,065
0
1
null
null
null
null
UTF-8
C++
false
false
908
cpp
/* 面试题12:打印 1 到最大的 n 位数 输入数字 n,按顺序打印出从 1 到最大的 n 位十进制数。 比如输入数字 3,则打印出 1、2、3 ··· 999。 */ #include<iostream> using namespace std; class Solution { public: void printToMaxNDigits(int n){ if(n<=0){ return; } char* number=new char[n+1]; number[n]='\0'; for(int i=0;i<10;i++){ number[0]=i+'0'; printToMaxNDigits(number,n,0); } } private: void printToMaxNDigits(char* number,int length,int index){ if(index==length-1){ printNumber(number,length); return; } index++; for(int i=0;i<10;i++){ number[index]=i+'0'; printToMaxNDigits(number,length,index); } } void printNumber(char* number,int length){ int index=0; while((index<length-1)&&(number[index]=='0')){ index++; } for(;index<length;index++){ putchar(number[index]); } putchar('\n'); } };
[ "loochenwei@gmail.com" ]
loochenwei@gmail.com
1ea8f2c807e18eb2ca2f2f38b231df01791457ad
29be7c52e05d32a4b02e6c0a1a6424abb2f60d57
/fuse-qreader/Example/build/Android/Debug/app/src/main/include/Android.com.fuse.Expe-9d584358.h
fe10dbc77a9adbd700f7b565d1299d4a037a6e74
[ "MIT" ]
permissive
redtree0/CITOS-APP
3b8cbc86fd88f6adb5b480035788eac08290c7a6
624f69770d8573dffc174f1f9540c22f19c71f14
refs/heads/master
2020-03-29T05:42:49.041569
2018-09-25T14:24:55
2018-09-25T14:24:55
149,594,359
0
0
null
2018-09-20T10:47:57
2018-09-20T10:47:57
null
UTF-8
C++
false
false
8,623
h
// This file was generated based on C:/Users/채재윤융합IT학부/AppData/Local/Fusetools/Packages/Uno.Net.Http/1.9.0/Implementation/Android/ExperimentalHttp/HttpRequest.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Android.Base.Wrappers.JWrapper.h> #include <Android.Base.Wrappers-90b493fe.h> #include <jni.h> #include <Uno.IDisposable.h> namespace g{namespace Android{namespace com{namespace fuse{namespace ExperimentalHttp{struct HttpRequest;}}}}} namespace g{ namespace Android{ namespace com{ namespace fuse{ namespace ExperimentalHttp{ // public abstract extern class HttpRequest :7 // { struct HttpRequest_type : ::g::Android::Base::Wrappers::JWrapper_type { void(*fp_OnAborted)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*); void(*fp_OnDataReceived)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*, uObject*, int32_t*); void(*fp_OnDone)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*); void(*fp_OnError)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*, uObject*); void(*fp_OnHeadersReceived)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*); void(*fp_OnProgress)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*, int32_t*, int32_t*, bool*); void(*fp_OnTimeout)(::g::Android::com::fuse::ExperimentalHttp::HttpRequest*); }; HttpRequest_type* HttpRequest_typeof(); void HttpRequest__ctor_4_fn(HttpRequest* __this, uObject* arg0, uObject* arg1, uObject* arg2); void HttpRequest___Init1_fn(); void HttpRequest___InitProxy1_fn(); void HttpRequest___IsThisType1_fn(uObject* obj_, bool* __retval); void HttpRequest__Abort_fn(HttpRequest* __this); void HttpRequest__Abort_IMPL_44305_fn(bool* arg0_, jobject* arg1_); void HttpRequest__GetResponseHeader_fn(HttpRequest* __this, uObject* arg0, uObject** __retval); void HttpRequest__GetResponseHeader_IMPL_44307_fn(bool* arg0_, jobject* arg1_, uObject* arg2_, uObject** __retval); void HttpRequest__GetResponseHeaders_fn(HttpRequest* __this, uObject** __retval); void HttpRequest__GetResponseHeaders_IMPL_44308_fn(bool* arg0_, jobject* arg1_, uObject** __retval); void HttpRequest__GetResponseStatus_fn(HttpRequest* __this, int32_t* __retval); void HttpRequest__GetResponseStatus_IMPL_44306_fn(bool* arg0_, jobject* arg1_, int32_t* __retval); void HttpRequest__GetResponseString_fn(HttpRequest* __this, uObject** __retval); void HttpRequest__GetResponseString_IMPL_44297_fn(bool* arg0_, jobject* arg1_, uObject** __retval); void HttpRequest__HttpRequest_IMPL_44284_fn(uObject* arg0_, uObject* arg1_, uObject* arg2_, uObject* arg3_, jobject* __retval); void HttpRequest__InstallCache_fn(uObject* arg0, int64_t* arg1, bool* __retval); void HttpRequest__InstallCache_IMPL_44279_fn(uObject* arg0_, int64_t* arg1_, bool* __retval); void HttpRequest__SendAsync_fn(HttpRequest* __this); void HttpRequest__SendAsync_IMPL_44299_fn(bool* arg0_, jobject* arg1_); void HttpRequest__SendAsyncBuf_fn(HttpRequest* __this, uObject* arg0); void HttpRequest__SendAsyncBuf_IMPL_44300_fn(bool* arg0_, jobject* arg1_, uObject* arg2_); void HttpRequest__SendAsyncStr_fn(HttpRequest* __this, uObject* arg0); void HttpRequest__SendAsyncStr_IMPL_44301_fn(bool* arg0_, jobject* arg1_, uObject* arg2_); void HttpRequest__SetCaching_fn(HttpRequest* __this, bool* arg0); void HttpRequest__SetCaching_IMPL_44295_fn(bool* arg0_, jobject* arg1_, bool* arg2_); void HttpRequest__SetHeader_fn(HttpRequest* __this, uObject* arg0, uObject* arg1); void HttpRequest__SetHeader_IMPL_44293_fn(bool* arg0_, jobject* arg1_, uObject* arg2_, uObject* arg3_); void HttpRequest__SetResponseType_fn(HttpRequest* __this, int32_t* arg0); void HttpRequest__SetResponseType_IMPL_44292_fn(bool* arg0_, jobject* arg1_, int32_t* arg2_); void HttpRequest__SetTimeout_fn(HttpRequest* __this, int32_t* arg0); void HttpRequest__SetTimeout_IMPL_44294_fn(bool* arg0_, jobject* arg1_, int32_t* arg2_); struct HttpRequest : ::g::Android::Base::Wrappers::JWrapper { static jclass _javaClass1_; static jclass& _javaClass1() { return _javaClass1_; } static jclass _javaProxyClass1_; static jclass& _javaProxyClass1() { return _javaProxyClass1_; } static jmethodID InstallCache_44279_ID_; static jmethodID& InstallCache_44279_ID() { return InstallCache_44279_ID_; } static jmethodID HttpRequest_44284_ID_c_; static jmethodID& HttpRequest_44284_ID_c() { return HttpRequest_44284_ID_c_; } static jmethodID HttpRequest_44284_ID_c_prox_; static jmethodID& HttpRequest_44284_ID_c_prox() { return HttpRequest_44284_ID_c_prox_; } static jmethodID SetResponseType_44292_ID_; static jmethodID& SetResponseType_44292_ID() { return SetResponseType_44292_ID_; } static jmethodID SetHeader_44293_ID_; static jmethodID& SetHeader_44293_ID() { return SetHeader_44293_ID_; } static jmethodID SetTimeout_44294_ID_; static jmethodID& SetTimeout_44294_ID() { return SetTimeout_44294_ID_; } static jmethodID SetCaching_44295_ID_; static jmethodID& SetCaching_44295_ID() { return SetCaching_44295_ID_; } static jmethodID GetResponseString_44297_ID_; static jmethodID& GetResponseString_44297_ID() { return GetResponseString_44297_ID_; } static jmethodID SendAsync_44299_ID_; static jmethodID& SendAsync_44299_ID() { return SendAsync_44299_ID_; } static jmethodID SendAsyncBuf_44300_ID_; static jmethodID& SendAsyncBuf_44300_ID() { return SendAsyncBuf_44300_ID_; } static jmethodID SendAsyncStr_44301_ID_; static jmethodID& SendAsyncStr_44301_ID() { return SendAsyncStr_44301_ID_; } static jmethodID Abort_44305_ID_; static jmethodID& Abort_44305_ID() { return Abort_44305_ID_; } static jmethodID GetResponseStatus_44306_ID_; static jmethodID& GetResponseStatus_44306_ID() { return GetResponseStatus_44306_ID_; } static jmethodID GetResponseHeader_44307_ID_; static jmethodID& GetResponseHeader_44307_ID() { return GetResponseHeader_44307_ID_; } static jmethodID GetResponseHeaders_44308_ID_; static jmethodID& GetResponseHeaders_44308_ID() { return GetResponseHeaders_44308_ID_; } void ctor_4(uObject* arg0, uObject* arg1, uObject* arg2); void Abort(); uObject* GetResponseHeader(uObject* arg0); uObject* GetResponseHeaders(); int32_t GetResponseStatus(); uObject* GetResponseString(); void OnAborted() { (((HttpRequest_type*)__type)->fp_OnAborted)(this); } void OnDataReceived(uObject* arg0, int32_t arg1) { (((HttpRequest_type*)__type)->fp_OnDataReceived)(this, arg0, &arg1); } void OnDone() { (((HttpRequest_type*)__type)->fp_OnDone)(this); } void OnError(uObject* arg0) { (((HttpRequest_type*)__type)->fp_OnError)(this, arg0); } void OnHeadersReceived() { (((HttpRequest_type*)__type)->fp_OnHeadersReceived)(this); } void OnProgress(int32_t arg0, int32_t arg1, bool arg2) { (((HttpRequest_type*)__type)->fp_OnProgress)(this, &arg0, &arg1, &arg2); } void OnTimeout() { (((HttpRequest_type*)__type)->fp_OnTimeout)(this); } void SendAsync(); void SendAsyncBuf(uObject* arg0); void SendAsyncStr(uObject* arg0); void SetCaching(bool arg0); void SetHeader(uObject* arg0, uObject* arg1); void SetResponseType(int32_t arg0); void SetTimeout(int32_t arg0); static void _Init1(); static void _InitProxy1(); static bool _IsThisType1(uObject* obj_); static void Abort_IMPL_44305(bool arg0_, jobject arg1_); static uObject* GetResponseHeader_IMPL_44307(bool arg0_, jobject arg1_, uObject* arg2_); static uObject* GetResponseHeaders_IMPL_44308(bool arg0_, jobject arg1_); static int32_t GetResponseStatus_IMPL_44306(bool arg0_, jobject arg1_); static uObject* GetResponseString_IMPL_44297(bool arg0_, jobject arg1_); static jobject HttpRequest_IMPL_44284(uObject* arg0_, uObject* arg1_, uObject* arg2_, uObject* arg3_); static bool InstallCache(uObject* arg0, int64_t arg1); static bool InstallCache_IMPL_44279(uObject* arg0_, int64_t arg1_); static void SendAsync_IMPL_44299(bool arg0_, jobject arg1_); static void SendAsyncBuf_IMPL_44300(bool arg0_, jobject arg1_, uObject* arg2_); static void SendAsyncStr_IMPL_44301(bool arg0_, jobject arg1_, uObject* arg2_); static void SetCaching_IMPL_44295(bool arg0_, jobject arg1_, bool arg2_); static void SetHeader_IMPL_44293(bool arg0_, jobject arg1_, uObject* arg2_, uObject* arg3_); static void SetResponseType_IMPL_44292(bool arg0_, jobject arg1_, int32_t arg2_); static void SetTimeout_IMPL_44294(bool arg0_, jobject arg1_, int32_t arg2_); }; // } }}}}} // ::g::Android::com::fuse::ExperimentalHttp
[ "moter74@naver.com" ]
moter74@naver.com
efabc5fcf009d446dd70c2b3098551928ae78a65
287230b6695941701830dd513273d516c7235ba9
/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ext/pb_ds/detail/cond_dealtor.hpp
4f1cc9b101de5cd2c120ca011da7d345b10dae6b
[]
no_license
haohlliang/rv1126
8279c08ada9e29d8973c4c5532ca4515bd021454
d8455921b05c19b47a2d7c8b682cd03e61789ee9
refs/heads/master
2023-08-10T05:56:01.779701
2021-06-27T14:30:42
2021-06-27T14:30:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
129
hpp
version https://git-lfs.github.com/spec/v1 oid sha256:a3949db1a0f4c423b4e3c62e63a54596ad723e02ded608265846589ac3a4a042 size 2724
[ "geierconstantinabc@gmail.com" ]
geierconstantinabc@gmail.com
f05a7ef3b457dcf2822e657008ebe5296223a39e
7fe9c825a46e0ce6250e05183cd065c258f777f4
/Code/Trees/BST_insert_search_delete.cpp
eea72d5e07ad9543c70fdc453927f4c62e1d1fe5
[]
no_license
100sarthak100/DataStructures-Algorithms
5a550275c9da99e94ea303acac30db6b307af880
b1193665b417a2654767141c7a55ab6d04edd582
refs/heads/master
2023-03-04T17:41:48.381379
2021-02-20T12:57:52
2021-02-20T12:57:52
266,804,252
2
5
null
2020-10-25T03:09:09
2020-05-25T14:43:47
C++
UTF-8
C++
false
false
2,140
cpp
#include <bits/stdc++.h> using namespace std; struct Node { int data; Node* left; Node* right; }; Node* makeNode(int data) { Node* newNode = new Node; newNode->data = data; newNode->left = NULL; newNode->right = NULL; return newNode; } Node* insert(Node* root, int data) { if(root == NULL) return makeNode(data); if(root->data > data) root->left = insert(root->left, data); else root->right = insert(root->right, data); return root; } Node* search(Node* root, int x) { if(root == NULL) return NULL; if(root->data == x) return root; if(root->data > x) return search(root->left, x); else return search(root->right, x); } void inorder(Node* root) { if(root == NULL) return; inorder(root->left); cout<<root->data<<" "; inorder(root->right); } Node* minVal(Node* root) { if(root == NULL) return NULL; while(root && root->left) root = root->left; return root; } Node *deleteNode(Node *root, int X) { if(root == NULL) return NULL; if(root->data > X) root->left = deleteNode(root->left, X); else if(root->data < X) root->right = deleteNode(root->right, X); else { if(root->left == NULL) { Node* temp = root->right; free(root); return temp; } else if(root->right == NULL) { Node* temp = root->left; free(root); return temp; } Node* temp = minVal(root->right); root->data = temp->data; root->right = deleteNode(root->right, temp->data); } return root; } int main() { Node *root = NULL; root = insert(root, 50); root = insert(root, 30); root = insert(root, 20); root = insert(root, 40); root = insert(root, 70); root = insert(root, 60); root = insert(root, 80); inorder(root); cout<<endl; Node* s = search(root, 80); if(s != NULL) cout<<s->data<<endl; }
[ "sarthaknaithani127@gmail.com" ]
sarthaknaithani127@gmail.com
d10f4200bbe9ee1d1664c3bc1e722842f89abf82
db6903560e8c816b85b9adec3187f688f8e40289
/VisualUltimate/WindowsSDKs/vc7/atlmfc/src/mfc/viewprnt.cpp
7dbebe836e53c38e7276838d59bc6fadea699435
[]
no_license
QianNangong/VC6Ultimate
846a4e610859fab5c9d8fb73fa5c9321e7a2a65e
0c74cf644fbdd38018c8d94c9ea9f8b72782ef7c
refs/heads/master
2022-05-05T17:49:52.120385
2019-03-07T14:46:51
2019-03-07T14:46:51
147,986,727
4
1
null
null
null
null
UTF-8
C++
false
false
11,854
cpp
// This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #include "stdafx.h" #ifdef AFX_PRINT_SEG #pragma code_seg(AFX_PRINT_SEG) #endif ///////////////////////////////////////////////////////////////////////////// // Printing Dialog class CPrintingDialog : public CDialog { public: //{{AFX_DATA(CPrintingDialog) enum { IDD = AFX_IDD_PRINTDLG }; //}}AFX_DATA CPrintingDialog::CPrintingDialog(CWnd* pParent) { Create(CPrintingDialog::IDD, pParent); // modeless ! _afxWinState->m_bUserAbort = FALSE; } virtual ~CPrintingDialog() { } virtual BOOL OnInitDialog(); virtual void OnCancel(); }; BOOL CALLBACK _AfxAbortProc(HDC, int) { _AFX_WIN_STATE* pWinState = _afxWinState; MSG msg; while (!pWinState->m_bUserAbort && ::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) { if( !AfxPumpMessage() ) return FALSE; // terminate if WM_QUIT received } return !pWinState->m_bUserAbort; } BOOL CPrintingDialog::OnInitDialog() { SetWindowText(AfxGetAppName()); CenterWindow(); return CDialog::OnInitDialog(); } void CPrintingDialog::OnCancel() { _afxWinState->m_bUserAbort = TRUE; // flag that user aborted print CDialog::OnCancel(); } ///////////////////////////////////////////////////////////////////////////// // CView printing commands BOOL CView::DoPreparePrinting(CPrintInfo* pInfo) { ASSERT(pInfo != NULL); ASSERT(pInfo->m_pPD != NULL); if (pInfo->m_pPD->m_pd.nMinPage > pInfo->m_pPD->m_pd.nMaxPage) pInfo->m_pPD->m_pd.nMaxPage = pInfo->m_pPD->m_pd.nMinPage; // don't prompt the user if we're doing print preview, printing directly, // or printing via IPrint and have been instructed not to ask CWinApp* pApp = AfxGetApp(); if (pInfo->m_bPreview || pInfo->m_bDirect || (pInfo->m_bDocObject && !(pInfo->m_dwFlags & PRINTFLAG_PROMPTUSER))) { if (pInfo->m_pPD->m_pd.hDC == NULL) { // if no printer set then, get default printer DC and create DC without calling // print dialog. if (!pApp->GetPrinterDeviceDefaults(&pInfo->m_pPD->m_pd)) { // bring up dialog to alert the user they need to install a printer. if (!pInfo->m_bDocObject || (pInfo->m_dwFlags & PRINTFLAG_MAYBOTHERUSER)) if (pApp->DoPrintDialog(pInfo->m_pPD) != IDOK) return FALSE; } if (pInfo->m_pPD->m_pd.hDC == NULL) { // call CreatePrinterDC if DC was not created by above if (pInfo->m_pPD->CreatePrinterDC() == NULL) return FALSE; } } // set up From and To page range from Min and Max pInfo->m_pPD->m_pd.nFromPage = (WORD)pInfo->GetMinPage(); pInfo->m_pPD->m_pd.nToPage = (WORD)pInfo->GetMaxPage(); } else { // otherwise, bring up the print dialog and allow user to change things // preset From-To range same as Min-Max range pInfo->m_pPD->m_pd.nFromPage = (WORD)pInfo->GetMinPage(); pInfo->m_pPD->m_pd.nToPage = (WORD)pInfo->GetMaxPage(); if (pApp->DoPrintDialog(pInfo->m_pPD) != IDOK) return FALSE; // do not print } ASSERT(pInfo->m_pPD != NULL); ASSERT(pInfo->m_pPD->m_pd.hDC != NULL); if (pInfo->m_pPD->m_pd.hDC == NULL) return FALSE; pInfo->m_nNumPreviewPages = pApp->m_nNumPreviewPages; VERIFY(pInfo->m_strPageDesc.LoadString(AFX_IDS_PREVIEWPAGEDESC)); return TRUE; } void CView::OnFilePrint() { // get default print info CPrintInfo printInfo; ASSERT(printInfo.m_pPD != NULL); // must be set if (LOWORD(GetCurrentMessage()->wParam) == ID_FILE_PRINT_DIRECT) { CCommandLineInfo* pCmdInfo = AfxGetApp()->m_pCmdInfo; if (pCmdInfo != NULL) { if (pCmdInfo->m_nShellCommand == CCommandLineInfo::FilePrintTo) { printInfo.m_pPD->m_pd.hDC = ::CreateDC(pCmdInfo->m_strDriverName, pCmdInfo->m_strPrinterName, pCmdInfo->m_strPortName, NULL); if (printInfo.m_pPD->m_pd.hDC == NULL) { AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT); return; } } } printInfo.m_bDirect = TRUE; } if (OnPreparePrinting(&printInfo)) { // hDC must be set (did you remember to call DoPreparePrinting?) ASSERT(printInfo.m_pPD->m_pd.hDC != NULL); // gather file to print to if print-to-file selected CString strOutput; if (printInfo.m_pPD->m_pd.Flags & PD_PRINTTOFILE && !printInfo.m_bDocObject) { // construct CFileDialog for browsing CString strDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULTEXT)); CString strPrintDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULT)); CString strFilter(MAKEINTRESOURCE(AFX_IDS_PRINTFILTER)); CString strCaption(MAKEINTRESOURCE(AFX_IDS_PRINTCAPTION)); CFileDialog dlg(FALSE, strDef, strPrintDef, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, strFilter, NULL, 0); dlg.m_ofn.lpstrTitle = strCaption; if (dlg.DoModal() != IDOK) return; // set output device to resulting path name strOutput = dlg.GetPathName(); } // set up document info and start the document printing process CString strTitle; CDocument* pDoc = GetDocument(); if (pDoc != NULL) strTitle = pDoc->GetTitle(); else GetParentFrame()->GetWindowText(strTitle); DOCINFO docInfo; memset(&docInfo, 0, sizeof(DOCINFO)); docInfo.cbSize = sizeof(DOCINFO); docInfo.lpszDocName = strTitle; CString strPortName; if (strOutput.IsEmpty()) { docInfo.lpszOutput = NULL; strPortName = printInfo.m_pPD->GetPortName(); } else { docInfo.lpszOutput = strOutput; AfxGetFileTitle(strOutput, strPortName.GetBuffer(_MAX_PATH), _MAX_PATH); } // setup the printing DC CDC dcPrint; if (!printInfo.m_bDocObject) { dcPrint.Attach(printInfo.m_pPD->m_pd.hDC); // attach printer dc dcPrint.m_bPrinting = TRUE; } OnBeginPrinting(&dcPrint, &printInfo); if (!printInfo.m_bDocObject) dcPrint.SetAbortProc(_AfxAbortProc); // disable main window while printing & init printing status dialog // Store the Handle of the Window in a temp so that it can be enabled // once the printing is finished CWnd * hwndTemp = AfxGetMainWnd(); hwndTemp->EnableWindow(FALSE); CPrintingDialog dlgPrintStatus(this); CString strTemp; dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_DOCNAME, strTitle); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, printInfo.m_pPD->GetDeviceName()); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PORTNAME, strPortName); dlgPrintStatus.ShowWindow(SW_SHOW); dlgPrintStatus.UpdateWindow(); // start document printing process if (!printInfo.m_bDocObject) { printInfo.m_nJobNumber = dcPrint.StartDoc(&docInfo); if (printInfo.m_nJobNumber == SP_ERROR) { // enable main window before proceeding hwndTemp->EnableWindow(TRUE); // cleanup and show error message OnEndPrinting(&dcPrint, &printInfo); dlgPrintStatus.DestroyWindow(); dcPrint.Detach(); // will be cleaned up by CPrintInfo destructor AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT); return; } } // Guarantee values are in the valid range UINT nEndPage = printInfo.GetToPage(); UINT nStartPage = printInfo.GetFromPage(); if (nEndPage < printInfo.GetMinPage()) nEndPage = printInfo.GetMinPage(); if (nEndPage > printInfo.GetMaxPage()) nEndPage = printInfo.GetMaxPage(); if (nStartPage < printInfo.GetMinPage()) nStartPage = printInfo.GetMinPage(); if (nStartPage > printInfo.GetMaxPage()) nStartPage = printInfo.GetMaxPage(); int nStep = (nEndPage >= nStartPage) ? 1 : -1; nEndPage = (nEndPage == 0xffff) ? 0xffff : nEndPage + nStep; VERIFY(strTemp.LoadString(AFX_IDS_PRINTPAGENUM)); // If it's a doc object, we don't loop page-by-page // because doc objects don't support that kind of levity. BOOL bError = FALSE; if (printInfo.m_bDocObject) { OnPrepareDC(&dcPrint, &printInfo); OnPrint(&dcPrint, &printInfo); } else { // begin page printing loop for (printInfo.m_nCurPage = nStartPage; printInfo.m_nCurPage != nEndPage; printInfo.m_nCurPage += nStep) { OnPrepareDC(&dcPrint, &printInfo); // check for end of print if (!printInfo.m_bContinuePrinting) break; // write current page TCHAR szBuf[80]; int cnt = _sntprintf(szBuf, _countof(szBuf), strTemp, printInfo.m_nCurPage); if (cnt < 0 || cnt == _countof(szBuf)) { // No room for nul szBuf[_countof(szBuf)-1] = __T('\0'); } dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PAGENUM, szBuf); // set up drawing rect to entire page (in logical coordinates) printInfo.m_rectDraw.SetRect(0, 0, dcPrint.GetDeviceCaps(HORZRES), dcPrint.GetDeviceCaps(VERTRES)); dcPrint.DPtoLP(&printInfo.m_rectDraw); // attempt to start the current page if (dcPrint.StartPage() < 0) { bError = TRUE; break; } // must call OnPrepareDC on newer versions of Windows because // StartPage now resets the device attributes. OnPrepareDC(&dcPrint, &printInfo); ASSERT(printInfo.m_bContinuePrinting); // page successfully started, so now render the page OnPrint(&dcPrint, &printInfo); // If the user restarts the job when it's spooling, all // subsequent calls to EndPage returns < 0. The first time // GetLastError returns ERROR_PRINT_CANCELLED if (dcPrint.EndPage() < 0 && (GetLastError()!= ERROR_SUCCESS)) { HANDLE hPrinter; if (!OpenPrinter(LPTSTR(printInfo.m_pPD->GetDeviceName().GetBuffer()), &hPrinter, NULL)) { bError = TRUE; break; } DWORD cBytesNeeded; if(!GetJob(hPrinter,printInfo.m_nJobNumber,1,NULL,0,&cBytesNeeded)) { if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { bError = TRUE; break; } } JOB_INFO_1 *pJobInfo; if((pJobInfo = (JOB_INFO_1 *)malloc(cBytesNeeded))== NULL) { bError = TRUE; break; } DWORD cBytesUsed; BOOL bRet = GetJob(hPrinter,printInfo.m_nJobNumber,1,LPBYTE(pJobInfo),cBytesNeeded,&cBytesUsed); DWORD dwJobStatus = pJobInfo->Status; free(pJobInfo); pJobInfo = NULL; // if job status is restart, just continue if(!bRet || !(dwJobStatus & JOB_STATUS_RESTART) ) { bError = TRUE; break; } } if(!_AfxAbortProc(dcPrint.m_hDC, 0)) { bError = TRUE; break; } } } // cleanup document printing process if (!printInfo.m_bDocObject) { if (!bError) dcPrint.EndDoc(); else dcPrint.AbortDoc(); } hwndTemp->EnableWindow(); // enable main window OnEndPrinting(&dcPrint, &printInfo); // clean up after printing dlgPrintStatus.DestroyWindow(); dcPrint.Detach(); // will be cleaned up by CPrintInfo destructor } } ///////////////////////////////////////////////////////////////////////////// // CPrintInfo helper structure CPrintInfo::CPrintInfo() { m_pPD = new CPrintDialog(FALSE, PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOSELECTION); ASSERT(m_pPD->m_pd.hDC == NULL); SetMinPage(1); // one based page numbers SetMaxPage(0xffff); // unknown how many pages m_nCurPage = 1; m_nJobNumber = SP_ERROR; m_lpUserData = NULL; // Initialize to no user data m_bPreview = FALSE; // initialize to not preview m_bDirect = FALSE; // initialize to not direct m_bDocObject = FALSE; // initialize to not IPrint m_bContinuePrinting = TRUE; // Assume it is OK to print m_dwFlags = 0; m_nOffsetPage = 0; } CPrintInfo::~CPrintInfo() { if (m_pPD != NULL && m_pPD->m_pd.hDC != NULL) { ::DeleteDC(m_pPD->m_pd.hDC); m_pPD->m_pd.hDC = NULL; } delete m_pPD; } /////////////////////////////////////////////////////////////////////////////
[ "vc6@ultim.pw" ]
vc6@ultim.pw
0dd8b69f580aef61ebc7d4096e0738c46d6d3ade
92e67b30497ffd29d3400e88aa553bbd12518fe9
/assignment2/part6/Re=110/71.2/U
6146b2d759387b7c7ceb048d0c540410caa07fee
[]
no_license
henryrossiter/OpenFOAM
8b89de8feb4d4c7f9ad4894b2ef550508792ce5c
c54b80dbf0548b34760b4fdc0dc4fb2facfdf657
refs/heads/master
2022-11-18T10:05:15.963117
2020-06-28T15:24:54
2020-06-28T15:24:54
241,991,470
0
0
null
null
null
null
UTF-8
C++
false
false
63,749
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 7 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "71.2"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 2000 ( (-0.000132006 -0.00684531 -2.86357e-22) (6.64061e-05 -0.0150378 0) (0.000862908 -0.018928 0) (0.0022475 -0.0192476 -1.46875e-21) (0.00417953 -0.0164233 4.73656e-22) (0.00662777 -0.0107288 1.60614e-23) (0.00956307 -0.00237931 -8.14764e-22) (0.0129321 0.00839338 0) (0.0166219 0.0212852 0) (0.0204373 0.0358893 0) (0.000434119 -0.00662691 0) (0.00150145 -0.0150983 -1.12253e-21) (0.00291407 -0.0194095 1.03519e-21) (0.00457864 -0.0202461 1.96062e-21) (0.00648675 -0.0180334 0) (0.00864507 -0.0130492 1.78264e-21) (0.0110714 -0.00549104 -1.65772e-21) (0.0137665 0.0044596 0) (0.0166776 0.0165829 3.01537e-21) (0.0196291 0.0305827 -5.80304e-21) (0.0010363 -0.00644591 0) (0.00316884 -0.0151738 9.00252e-21) (0.005444 -0.0198292 0) (0.00762147 -0.0210973 8.03047e-21) (0.00971787 -0.0194221 0) (0.0117712 -0.0151047 -7.21259e-21) (0.0138402 -0.00834199 0) (0.0159771 0.000724646 6.474e-21) (0.0181945 0.0119606 -6.06325e-21) (0.0203278 0.0251892 -5.9138e-21) (0.00170832 -0.00633986 -2.35033e-21) (0.00512321 -0.0153046 -4.48492e-21) (0.00850769 -0.0202018 -2.10658e-21) (0.0114295 -0.0217778 -3.94319e-21) (0.013928 -0.0205163 -3.77529e-21) (0.0160711 -0.0167613 3.54938e-21) (0.0179557 -0.0107287 3.40623e-21) (0.0196799 -0.00253858 -5.62536e-24) (0.0213255 0.00775144 6.14023e-21) (0.0227351 0.0200813 5.91223e-21) (0.00249256 -0.0063407 -2.32422e-21) (0.00742421 -0.0155232 -4.5979e-21) (0.0121504 -0.0205371 -8.72716e-21) (0.0160266 -0.0222691 4.01242e-21) (0.0191219 -0.0212605 0) (0.0215401 -0.0179138 0) (0.023417 -0.0124838 -6.99754e-21) (0.024894 -0.00509107 -6.61882e-21) (0.0261231 0.00426732 6.24677e-21) (0.0269596 0.0156302 1.79207e-20) (0.00343761 -0.00646882 2.35967e-21) (0.0101286 -0.0158423 2.3813e-21) (0.0163961 -0.0208353 -1.29809e-20) (0.0213931 -0.0225588 2.05882e-20) (0.0252358 -0.0216259 -3.8348e-21) (0.0280771 -0.0185081 0) (0.0300998 -0.0135126 0) (0.0314903 -0.00678218 3.31467e-20) (0.0324702 0.00172598 -3.12445e-20) (0.032924 0.012124 5.91331e-21) (0.00459363 -0.0067272 1.84927e-20) (0.0132814 -0.0162508 0) (0.0212369 -0.0210833 1.73326e-20) (0.0274546 -0.0226402 -1.64371e-20) (0.032125 -0.0216163 0) (0.0354709 -0.0185543 7.47075e-21) (0.0377362 -0.0138206 -2.09664e-20) (0.0391596 -0.00759629 -2.65605e-20) (0.0400325 0.000180814 1.24709e-20) (0.04029 0.00967475 1.2006e-20) (0.00600543 -0.00709781 -3.69677e-20) (0.0169059 -0.0167106 -4.67158e-21) (0.0266243 -0.0212528 -8.79803e-21) (0.0340769 -0.022511 -2.07024e-20) (0.0395644 -0.0212658 -7.92711e-21) (0.0434051 -0.0181269 -7.50072e-21) (0.0459221 -0.0135176 1.83526e-23) (0.0474178 -0.00766651 0) (0.0482576 -0.000509783 0) (0.0484491 0.00816437 1.23499e-22) (0.00770521 -0.00754136 1.84754e-20) (0.0209928 -0.0171573 -1.86142e-20) (0.032462 -0.0213008 1.30813e-20) (0.0410667 -0.0221723 2.9152e-20) (0.0472607 -0.0206354 -7.78222e-21) (0.0514858 -0.0173537 7.47506e-21) (0.054161 -0.0127961 7.05434e-21) (0.0556613 -0.00723856 0) (0.0564295 -0.000629529 0) (0.05658 0.0072828 -2.72902e-22) (0.00970625 -0.00800059 -2.31711e-21) (0.0254918 -0.0175056 2.33552e-20) (0.038603 -0.0211755 -4.36906e-21) (0.0481793 -0.0216309 0) (0.0548759 -0.0198073 0) (0.0592888 -0.0164006 1.48445e-20) (0.0619479 -0.0119012 0) (0.063303 -0.00661508 -1.30681e-20) (0.0638478 -0.000525169 1.78845e-26) (0.063813 0.00658132 1.17069e-20) (0.0291332 0.0712839 2.25646e-22) (0.0442308 0.140283 -2.28276e-22) (0.0496003 0.201458 -2.65332e-22) (0.0484563 0.257064 -3.0441e-22) (0.042293 0.314303 -3.7559e-22) (0.0373453 0.376829 -1.32331e-23) (0.0249627 0.446936 1.98428e-22) (0.0216513 0.533487 7.0652e-22) (0.000737276 0.656985 0) (0.00678316 0.805034 -5.18476e-22) (0.0260102 0.0652531 8.57825e-22) (0.0403134 0.135262 -9.93065e-22) (0.0464744 0.199417 1.78365e-21) (0.045955 0.256884 3.04921e-22) (0.0402849 0.315109 6.61503e-22) (0.0357204 0.378285 1.14097e-21) (0.023886 0.448911 -4.28571e-22) (0.0207359 0.535901 -4.73745e-22) (0.000709306 0.659016 9.30002e-22) (0.00633366 0.805725 5.17248e-22) (0.0241683 0.0587062 0) (0.0368803 0.12886 -9.39294e-22) (0.0436905 0.196061 -5.18737e-22) (0.0437382 0.255594 0) (0.0385133 0.314926 -2.03717e-21) (0.0343084 0.378847 6.35012e-22) (0.0229602 0.450064 7.20008e-22) (0.0199292 0.537532 2.55326e-21) (0.000723249 0.660613 -9.26991e-22) (0.00592809 0.806223 1.86612e-21) (0.0239102 0.051989 0) (0.0340008 0.121199 9.47204e-22) (0.041243 0.191371 0) (0.0417845 0.253162 2.34973e-21) (0.0369606 0.313747 -2.3619e-21) (0.0330912 0.378499 -1.45175e-21) (0.0221725 0.450329 -9.28881e-23) (0.0192418 0.538256 -2.49329e-21) (0.000781833 0.661454 -4.08861e-22) (0.0055466 0.806332 -2.29554e-21) (0.0255285 0.0454894 4.07515e-23) (0.0318061 0.112522 -2.70176e-21) (0.0391276 0.185353 1.26187e-22) (0.0400725 0.249573 -2.05972e-21) (0.0356069 0.31159 0) (0.0320454 0.377313 -1.38594e-21) (0.0214989 0.449881 -1.2098e-22) (0.0186439 0.53842 3.13681e-21) (0.00085092 0.662027 4.16783e-22) (0.00519226 0.806383 -4.18295e-22) (0.0291712 0.0395711 -7.36863e-21) (0.0304928 0.103199 4.64997e-21) (0.037348 0.178052 2.00795e-21) (0.0385855 0.244817 -2.00695e-21) (0.0344381 0.308413 -1.12042e-21) (0.0311614 0.375157 0) (0.0209451 0.448439 -2.77879e-21) (0.0181611 0.537486 1.38358e-21) (0.000960869 0.661542 1.52215e-21) (0.00484654 0.805934 1.58626e-21) (0.0346762 0.0345067 -8.92107e-22) (0.0302845 0.0937139 0) (0.0359243 0.16957 0) (0.0373039 0.238935 0) (0.0334289 0.304383 -1.19997e-21) (0.0304093 0.372429 2.31679e-21) (0.0204666 0.446692 2.70869e-21) (0.0177146 0.536552 -4.22033e-21) (0.00103619 0.661379 7.49614e-22) (0.004529 0.805707 -2.31342e-21) (0.0414446 0.030392 5.61829e-21) (0.031312 0.0845153 3.79803e-21) (0.0348906 0.160124 -3.76371e-21) (0.0362316 0.231848 4.12018e-21) (0.0325724 0.299049 -5.12405e-21) (0.0298019 0.368255 0) (0.0201204 0.443299 -1.21775e-21) (0.0174224 0.533702 6.14438e-23) (0.00119137 0.659351 -1.35368e-21) (0.004205 0.804676 -1.42076e-21) (0.048366 0.0268971 -4.79644e-21) (0.0334239 0.0754225 0) (0.0342472 0.149728 -4.27516e-21) (0.0353186 0.224205 7.78093e-21) (0.0318485 0.293914 -2.91217e-21) (0.029264 0.364921 -5.46185e-22) (0.0197552 0.441229 1.21514e-21) (0.0170324 0.532648 8.52359e-24) (0.00120696 0.659174 1.95424e-21) (0.00391703 0.804411 2.06451e-21) (0.0537382 0.0238933 -3.86037e-21) (0.036027 0.0663147 3.7703e-21) (0.0341362 0.136957 4.68045e-22) (0.0345884 0.212564 0) (0.0311916 0.284158 0) (0.0289499 0.356811 5.33215e-22) (0.0196936 0.43429 2.28159e-21) (0.0170239 0.526619 -2.21631e-21) (0.00146143 0.654819 -5.99961e-22) (0.00360048 0.80266 5.80851e-22) (0.0573204 0.0262355 0) (0.039567 0.0615429 0) (0.0348662 0.128313 0) (0.034257 0.207601 0) (0.0301864 0.282981 0) (0.0272394 0.358051 0) (0.0182833 0.436765 0) (0.0154899 0.530303 0) (0.000974661 0.657877 0) (0.00298395 0.80293 0) (0.0607644 0.0484955 0) (0.0431669 0.0822482 0) (0.0338383 0.137809 0) (0.031972 0.211996 0) (0.028316 0.287371 0) (0.025345 0.363597 0) (0.0171487 0.443822 0) (0.0140635 0.538903 0) (0.000880131 0.66559 0) (0.00242504 0.805465 0) (0.0597366 0.0575761 0) (0.0461274 0.0951053 0) (0.034311 0.146224 0) (0.0304482 0.217125 0) (0.0265413 0.292245 0) (0.0231998 0.368564 0) (0.0156221 0.449175 0) (0.0125036 0.544567 0) (0.000616123 0.67018 0) (0.00194179 0.80589 0) (0.0559416 0.0635346 0) (0.0468854 0.105844 0) (0.0348623 0.15427 0) (0.0292848 0.221867 0) (0.0253026 0.297239 0) (0.0220419 0.374762 0) (0.0150072 0.456789 0) (0.0116693 0.55331 0) (0.000821672 0.677791 0) (0.00166367 0.808325 0) (0.0510759 0.066687 0) (0.045883 0.114895 0) (0.0351629 0.162755 0) (0.0286097 0.226794 0) (0.0240286 0.30094 0) (0.0204327 0.378425 0) (0.0138968 0.460781 0) (0.0106097 0.557501 0) (0.000688524 0.681054 0) (0.0013501 0.808256 0) (0.0453185 0.0671878 0) (0.0434338 0.12151 0) (0.03435 0.170411 0) (0.0276564 0.23204 0) (0.0235233 0.305879 0) (0.0200619 0.384456 0) (0.0137981 0.468214 0) (0.0102355 0.566033 0) (0.00105467 0.688298 0) (0.00121243 0.810497 0) (0.0389711 0.0652072 0) (0.0403974 0.126153 0) (0.0338795 0.178282 0) (0.0268192 0.23746 0) (0.0221206 0.3089 0) (0.0187123 0.386858 0) (0.0130067 0.470759 0) (0.00955674 0.568632 0) (0.000995049 0.690224 0) (0.00102479 0.810091 0) (0.0319511 0.0603094 0) (0.0359208 0.126355 0) (0.0321771 0.182853 0) (0.0265767 0.243268 0) (0.0223521 0.314993 0) (0.0188461 0.393749 0) (0.013238 0.478839 0) (0.00947487 0.57766 0) (0.00149271 0.69768 0) (0.000991341 0.812446 0) (0.026615 0.0559073 0) (0.0334895 0.128033 0) (0.0317909 0.188388 0) (0.025894 0.247093 0) (0.0212447 0.316617 0) (0.0179322 0.394847 0) (0.0127403 0.480092 0) (0.00908892 0.57885 0) (0.00145445 0.698563 0) (0.000895351 0.812072 0) (0.0184179 0.0396621 0) (0.0277883 0.117734 0) (0.0309513 0.188726 0) (0.0277247 0.253926 0) (0.022971 0.324574 0) (0.0188932 0.403221 0) (0.0134411 0.489433 0) (0.00928814 0.58906 0) (0.0021032 0.706797 0) (0.000928115 0.814825 0) (0.0686507 0.0162185 3.45723e-21) (0.0679084 0.0276515 -3.39914e-21) (0.0631239 0.031181 2.97263e-22) (0.057185 0.032363 0) (0.0507062 0.031368 0) (0.0433963 0.0285872 9.09056e-23) (0.0355651 0.0241256 -1.14968e-22) (0.0274092 0.0175263 1.13002e-22) (0.0204867 0.0115407 -1.61245e-23) (0.0116584 -0.00310351 1.58495e-23) (0.0709074 0.0121019 -4.53951e-21) (0.0679878 0.0188013 0) (0.0621357 0.0197086 1.68101e-21) (0.0557271 0.0189111 -3.35128e-21) (0.0489536 0.0163168 1.66961e-21) (0.0414069 0.0123319 -8.89813e-23) (0.0333682 0.0069846 7.82817e-23) (0.0251752 -0.00014187 1.86273e-23) (0.0177563 -0.00663941 -2.86825e-23) (0.00952127 -0.0202113 -3.17671e-23) (0.0720326 0.00743259 5.11767e-21) (0.0673642 0.00987178 -2.39638e-21) (0.0608645 0.00832897 2.37332e-21) (0.0541154 0.00559669 -1.32308e-21) (0.047081 0.00142314 1.03582e-21) (0.039316 -0.00374159 0) (0.0311025 -0.00992659 -7.84606e-23) (0.022903 -0.0174092 -1.07911e-24) (0.0151634 -0.0241707 1.02931e-23) (0.00763646 -0.036225 4.75762e-23) (0.0722549 0.00144602 -7.81879e-22) (0.0661003 0.000158082 0) (0.0592224 -0.00346437 0) (0.0522327 -0.00787939 0) (0.0450156 -0.0134218 6.61291e-22) (0.0371042 -0.0195706 -4.07022e-22) (0.0287958 -0.0264028 2.8996e-23) (0.020614 -0.0340143 1.28391e-23) (0.0128242 -0.0407512 1.13791e-23) (0.00596152 -0.0510473 2.10756e-23) (0.071456 -0.00594886 -5.18641e-22) (0.0641084 -0.0103856 -2.08053e-21) (0.0570858 -0.0157279 -8.44338e-22) (0.0499705 -0.0215183 8.43728e-22) (0.0426617 -0.0281544 -2.51101e-22) (0.0347045 -0.0350196 0) (0.0264196 -0.0422448 -7.27286e-23) (0.0183537 -0.0497409 2.21563e-23) (0.0107359 -0.0561685 -5.95752e-24) (0.0045542 -0.0646479 -3.27943e-23) (0.0697277 -0.0145749 -5.70932e-21) (0.0615245 -0.0215422 9.47839e-22) (0.0545555 -0.0283021 2.42245e-22) (0.0474002 -0.0351534 8.25449e-22) (0.0400916 -0.0425983 0) (0.0321834 -0.0499009 0) (0.0240354 -0.0572575 0) (0.0161939 -0.0644112 2.61565e-23) (0.00891326 -0.0702999 0) (0.00342279 -0.0770466 0) (0.0671789 -0.0241583 0) (0.0584814 -0.0330073 1.63062e-21) (0.0517291 -0.0409376 -1.05149e-21) (0.0446029 -0.048546 -5.94684e-22) (0.0373935 -0.0565369 5.97735e-22) (0.0296292 -0.0640146 1.1775e-22) (0.0217165 -0.0712682 -1.4853e-22) (0.014196 -0.0778999 -1.24601e-22) (0.00736725 -0.0831016 9.81289e-24) (0.00254229 -0.0882968 9.9878e-24) (0.06389 -0.0344015 0) (0.0550984 -0.0444666 -5.79521e-22) (0.0486804 -0.0533681 -2.34032e-22) (0.0416684 -0.0614495 0) (0.0346456 -0.0697552 7.76662e-23) (0.0271156 -0.0771838 -2.88859e-22) (0.0195219 -0.0841479 1.17876e-22) (0.0124004 -0.090142 1.7675e-24) (0.00608928 -0.0945944 -7.16092e-24) (0.00187541 -0.0984714 -1.13056e-23) (0.0599886 -0.0449402 7.69175e-22) (0.05148 -0.0556466 5.2448e-22) (0.0454851 -0.0653475 -1.77116e-22) (0.0386745 -0.0736451 9.06689e-23) (0.0319173 -0.0820725 1.26928e-22) (0.0247031 -0.0892774 1.26336e-22) (0.0174936 -0.0958233 -2.62528e-23) (0.0108259 -0.101131 -1.31163e-23) (0.00505458 -0.104846 7.18434e-24) (0.00138157 -0.107652 1.50949e-26) (0.0556425 -0.0554849 -1.62164e-22) (0.0477173 -0.0663249 1.63614e-22) (0.0422145 -0.0766748 -1.18364e-22) (0.0356924 -0.0849658 -9.05309e-23) (0.0292667 -0.0933621 5.58937e-23) (0.0224373 -0.100223 -1.00179e-22) (0.0156557 -0.106279 3.67287e-23) (0.00947206 -0.11091 2.56768e-24) (0.00422895 -0.113951 0) (0.00102166 -0.115923 -1.51265e-26) (0.0510394 -0.0658048 1.66284e-22) (0.043915 -0.0763432 -1.67688e-22) (0.0389498 -0.0872063 -1.24815e-22) (0.032798 -0.095309 -9.66336e-23) (0.0267465 -0.103558 -5.90115e-23) (0.0203528 -0.110009 9.53838e-24) (0.0140186 -0.11555 2.03076e-23) (0.00832537 -0.11956 3.03264e-23) (0.00357544 -0.122018 0) (0.000761298 -0.123363 -2.24506e-24) (0.0463745 -0.0757369 0) (0.0401898 -0.0856109 -5.63147e-22) (0.0357745 -0.0968571 9.51124e-22) (0.030064 -0.104638 9.67757e-23) (0.0244001 -0.112653 1.51361e-22) (0.0184722 -0.118674 1.57089e-22) (0.0125811 -0.12371 -3.21544e-23) (0.0073643 -0.127182 -1.834e-23) (0.00305914 -0.129159 2.15811e-23) (0.000572708 -0.130049 2.23966e-24) (0.0418047 -0.0851868 0) (0.0366343 -0.0941044 -6.53581e-22) (0.0327458 -0.105596 -2.59374e-22) (0.0275378 -0.112977 0) (0.0222502 -0.120687 -4.16953e-22) (0.0167999 -0.126302 1.60095e-22) (0.0113314 -0.130863 9.5234e-23) (0.00656292 -0.133891 1.54276e-22) (0.00264967 -0.135482 -2.15106e-23) (0.000434799 -0.136056 1.59601e-23) (0.037444 -0.0941174 0) (0.0333116 -0.101867 6.58995e-22) (0.0298946 -0.113438 0) (0.0252405 -0.120403 7.56912e-22) (0.0203013 -0.127742 -7.6084e-22) (0.0153254 -0.133002 -1.98291e-22) (0.0102502 -0.137124 4.51938e-23) (0.00589432 -0.139808 -1.6145e-22) (0.00232219 -0.141094 -2.95936e-23) (0.000332016 -0.141458 -2.47125e-23) (0.0333774 -0.102534 6.80018e-21) (0.0302714 -0.109004 -2.54702e-21) (0.027242 -0.120437 -2.48183e-22) (0.0231788 -0.127033 -1.02784e-21) (0.0185512 -0.133926 0) (0.0140318 -0.138904 -2.12942e-22) (0.00931765 -0.142622 7.17713e-23) (0.00533402 -0.14505 2.46967e-22) (0.00205776 -0.146096 1.00079e-23) (0.000253379 -0.146335 -9.99669e-24) (0.0296553 -0.11046 5.94143e-22) (0.0275552 -0.115673 3.97164e-21) (0.0248081 -0.126671 1.07732e-21) (0.0213514 -0.133009 -1.07667e-21) (0.0169978 -0.139369 -3.74321e-22) (0.0129009 -0.144145 0) (0.00851602 -0.147484 -3.46916e-22) (0.00486193 -0.149736 1.85542e-22) (0.00184291 -0.15059 9.31128e-23) (0.000191439 -0.150765 2.36858e-23) (0.0263099 -0.1179 -9.58642e-22) (0.0252155 -0.122076 0) (0.0226316 -0.132241 0) (0.0197603 -0.138481 0) (0.0156469 -0.14421 -2.95675e-22) (0.0119205 -0.14886 6.69251e-22) (0.00783365 -0.151839 3.5806e-22) (0.00446375 -0.153978 -4.23686e-22) (0.00166893 -0.154674 2.42203e-23) (0.000141164 -0.154834 -4.74228e-23) (0.0233426 -0.124809 -2.22228e-21) (0.0232782 -0.12844 2.95922e-21) (0.0207421 -0.137261 -2.93131e-21) (0.0183879 -0.143594 1.87682e-21) (0.0144955 -0.14859 -2.2768e-21) (0.0110726 -0.153181 0) (0.00725744 -0.155807 -2.19436e-22) (0.0041266 -0.157884 -1.02012e-23) (0.0015291 -0.158446 -8.09175e-23) (9.84073e-05 -0.158629 -2.74882e-23) (0.0204459 -0.131018 -1.04201e-21) (0.0214602 -0.134985 0) (0.0189912 -0.141862 -2.89696e-21) (0.0170762 -0.14848 4.49362e-21) (0.0134481 -0.152654 -1.54306e-21) (0.0102815 -0.157232 -1.64495e-22) (0.00674148 -0.159507 2.18937e-22) (0.00382227 -0.161555 2.68784e-23) (0.00141135 -0.162 1.66894e-22) (6.04931e-05 -0.162239 5.45656e-23) (0.0175734 -0.136084 -4.22271e-21) (0.0196107 -0.14191 4.12643e-21) (0.0173894 -0.146234 3.75043e-22) (0.0157995 -0.153276 0) (0.0124876 -0.156561 0) (0.00954044 -0.161145 1.6939e-22) (0.00627865 -0.163062 4.08701e-22) (0.00354908 -0.165098 -4.01071e-22) (0.00131545 -0.165432 -3.03067e-23) (4.0588e-05 -0.165755 2.96491e-23) (0.0177387 -0.143328 0) (0.0199902 -0.15837 0) (0.0171987 -0.156187 0) (0.0152963 -0.164534 0) (0.012002 -0.165803 0) (0.00899872 -0.170509 0) (0.00593113 -0.171578 0) (0.00333319 -0.173585 0) (0.00129088 -0.173605 0) (7.65222e-05 -0.17408 0) (0.0157358 -0.168942 0) (0.0140512 -0.184903 0) (0.0121321 -0.178699 0) (0.0102493 -0.187078 0) (0.008072 -0.18568 0) (0.00599962 -0.190138 0) (0.00399036 -0.189732 0) (0.00228629 -0.191608 0) (0.000937616 -0.19099 0) (9.49182e-05 -0.19161 0) (0.0161199 -0.19906 0) (0.0132129 -0.215873 0) (0.0109389 -0.206822 0) (0.00871744 -0.215595 0) (0.0067485 -0.212105 0) (0.00486824 -0.216743 0) (0.00327688 -0.2151 0) (0.00190352 -0.21713 0) (0.000856633 -0.215883 0) (0.000107985 -0.216738 0) (0.0159068 -0.236652 0) (0.0121842 -0.254731 0) (0.00993627 -0.243561 0) (0.00750184 -0.253222 0) (0.00581243 -0.24798 0) (0.00407051 -0.253221 0) (0.0028288 -0.25045 0) (0.00165834 -0.252915 0) (0.000825426 -0.250999 0) (0.000109693 -0.252232 0) (0.0154344 -0.283592 0) (0.0113191 -0.302279 0) (0.00914967 -0.290247 0) (0.0065659 -0.300751 0) (0.00513003 -0.294396 0) (0.00345138 -0.3004 0) (0.00249297 -0.296758 0) (0.00142094 -0.299818 0) (0.000768203 -0.297299 0) (8.03114e-05 -0.299052 0) (0.0143234 -0.338406 0) (0.0101898 -0.355762 0) (0.00823443 -0.344949 0) (0.00563474 -0.355336 0) (0.00445921 -0.349072 0) (0.00282467 -0.355366 0) (0.00209933 -0.351466 0) (0.0010672 -0.354913 0) (0.000604389 -0.352105 0) (3.97312e-06 -0.354296 0) (0.0122389 -0.394884 0) (0.0085427 -0.408834 0) (0.00689784 -0.401277 0) (0.00454303 -0.410092 0) (0.00361197 -0.405308 0) (0.00211152 -0.410888 0) (0.00155862 -0.407587 0) (0.000600027 -0.410779 0) (0.000334268 -0.408233 0) (-8.87221e-05 -0.410444 0) (0.00927303 -0.444007 0) (0.00639212 -0.453661 0) (0.00513259 -0.450211 0) (0.00328788 -0.456466 0) (0.00258922 -0.453929 0) (0.00137682 -0.457915 0) (0.000954099 -0.455814 0) (0.000172903 -0.458081 0) (7.15256e-05 -0.456267 0) (-0.000138373 -0.457941 0) (0.00573236 -0.478685 0) (0.0038968 -0.48473 0) (0.00311692 -0.484711 0) (0.00195616 -0.488529 0) (0.00152404 -0.488023 0) (0.0007346 -0.490305 0) (0.000459481 -0.489414 0) (-5.06242e-05 -0.490584 0) (-5.80583e-05 -0.489595 0) (-0.000120664 -0.490497 0) (0.00193273 -0.496142 0) (0.00128775 -0.500301 0) (0.00103813 -0.502139 0) (0.000639977 -0.50455 0) (0.00050195 -0.505169 0) (0.000224169 -0.506409 0) (0.000131591 -0.506227 0) (-4.87726e-05 -0.506703 0) (-3.80212e-05 -0.506231 0) (-4.81532e-05 -0.506609 0) (0.0171575 -0.153559 4.96301e-21) (0.017216 -0.180448 -4.86557e-21) (0.0183031 -0.212365 6.29488e-22) (0.0182724 -0.251154 0) (0.0178069 -0.297859 0) (0.0164451 -0.350397 7.30266e-22) (0.0140304 -0.402798 -3.14071e-21) (0.0106871 -0.447333 3.09969e-21) (0.0066837 -0.478329 8.44134e-22) (0.0022735 -0.493839 -8.30987e-22) (0.0172986 -0.158657 -5.84958e-21) (0.018096 -0.185336 0) (0.0193355 -0.217358 4.28164e-21) (0.0193439 -0.256192 -9.88335e-21) (0.0188523 -0.302558 6.34769e-21) (0.0173736 -0.354137 -6.7356e-22) (0.0148215 -0.40505 1.50221e-21) (0.0113188 -0.448022 3.1716e-21) (0.00711015 -0.477832 8.94471e-22) (0.00242128 -0.492755 8.67823e-22) (0.0178066 -0.163955 6.8394e-21) (0.0193484 -0.190518 -4.72491e-21) (0.0206299 -0.222376 4.68018e-21) (0.0206302 -0.260983 -5.24707e-21) (0.0200624 -0.306813 3.88294e-21) (0.0184232 -0.357318 0) (0.0156872 -0.406747 -1.50587e-21) (0.0119753 -0.448258 7.88506e-23) (0.00752442 -0.477027 -1.66591e-21) (0.00255231 -0.491464 -1.70219e-21) (0.0187015 -0.168693 -1.10744e-21) (0.020901 -0.195327 0) (0.0221669 -0.227099 0) (0.0221312 -0.26549 0) (0.0214486 -0.310782 4.32987e-21) (0.0196191 -0.360231 -2.89536e-21) (0.0166614 -0.408225 -1.97246e-23) (0.0126922 -0.448319 -1.78042e-21) (0.00795691 -0.476054 -9.13841e-22) (0.00268106 -0.489974 -9.78413e-22) (0.0200517 -0.172962 1.18201e-22) (0.0227249 -0.199524 -3.34972e-21) (0.0239175 -0.231202 -2.56658e-21) (0.0238218 -0.269408 2.56499e-21) (0.0229956 -0.31421 -1.41506e-21) (0.0209593 -0.3627 0) (0.0177583 -0.409395 -1.66019e-21) (0.0134991 -0.448187 3.63478e-21) (0.00844259 -0.474938 -1.8603e-21) (0.00282628 -0.488335 1.91455e-21) (0.0218989 -0.176851 -8.9104e-21) (0.0248415 -0.203144 9.61674e-22) (0.0258947 -0.234603 -1.89777e-22) (0.0257016 -0.272584 2.63711e-21) (0.0246998 -0.316907 0) (0.0224393 -0.364531 0) (0.0189774 -0.410091 0) (0.0144042 -0.447752 1.94819e-21) (0.00899565 -0.473643 0) (0.00299747 -0.486571 0) (0.0242556 -0.180268 0) (0.0272707 -0.206171 3.69144e-21) (0.0281274 -0.237302 -2.49485e-21) (0.0277894 -0.274997 -2.96281e-21) (0.0265759 -0.31883 2.97822e-21) (0.024067 -0.365663 1.77498e-21) (0.0203202 -0.410238 -1.76108e-21) (0.0154064 -0.446948 -6.95955e-21) (0.00961526 -0.472129 4.95503e-22) (0.00319601 -0.484677 -1.69601e-21) (0.0271298 -0.183078 0) (0.0300201 -0.208528 -1.19945e-21) (0.0306365 -0.23926 -6.78479e-22) (0.0301033 -0.276641 0) (0.0286434 -0.319989 8.65653e-22) (0.0258578 -0.366108 -2.61313e-21) (0.021795 -0.409838 2.90807e-21) (0.0165071 -0.445764 1.03742e-21) (0.0102985 -0.470379 -1.13541e-21) (0.00342104 -0.482637 2.2501e-21) (0.0305322 -0.185177 1.07661e-21) (0.0330945 -0.210143 1.30389e-21) (0.0334342 -0.240424 -2.8874e-22) (0.0326541 -0.277492 3.88101e-22) (0.0309172 -0.320384 8.24758e-22) (0.0278256 -0.365886 1.38394e-21) (0.0234126 -0.408916 -5.20395e-22) (0.0177117 -0.444213 -5.62251e-22) (0.0110454 -0.468393 1.13915e-21) (0.00367253 -0.48044 6.17398e-22) (0.034473 -0.186475 -3.00916e-22) (0.0364993 -0.210978 3.03685e-22) (0.0365304 -0.240749 -3.4941e-22) (0.0354481 -0.277528 -3.87601e-22) (0.0334079 -0.320001 4.60005e-22) (0.0299807 -0.365 -9.39052e-22) (0.0251832 -0.407482 7.9632e-22) (0.0190283 -0.442304 2.84684e-22) (0.0118603 -0.466172 0) (0.00395216 -0.47808 -6.18776e-22) (0.0389603 -0.186906 3.08576e-22) (0.0402376 -0.211025 -3.11526e-22) (0.0399346 -0.240213 -3.75488e-22) (0.0384902 -0.276744 -4.19075e-22) (0.0361243 -0.31884 -4.8013e-22) (0.0323303 -0.363457 -3.35238e-23) (0.0271141 -0.405545 2.80689e-22) (0.0204625 -0.440047 9.06118e-22) (0.012746 -0.463718 0) (0.00426094 -0.475553 -6.75398e-22) (0.0439991 -0.186449 0) (0.0443092 -0.210284 -1.43671e-21) (0.0436537 -0.238828 2.60476e-21) (0.0417823 -0.275148 4.19785e-22) (0.0390749 -0.316901 9.74928e-22) (0.0348811 -0.361255 1.59942e-21) (0.0292147 -0.403098 -5.6875e-22) (0.022024 -0.437432 -6.14715e-22) (0.0137095 -0.461025 1.35972e-21) (0.00460118 -0.472854 6.73823e-22) (0.0495906 -0.185149 0) (0.0487138 -0.208747 -1.41699e-21) (0.0476912 -0.236632 -7.83394e-22) (0.0453291 -0.272762 0) (0.0422652 -0.314222 -3.07031e-21) (0.0376369 -0.358422 1.02633e-21) (0.0314871 -0.400167 1.22135e-21) (0.0237117 -0.434481 3.94325e-21) (0.0147482 -0.458092 -1.35531e-21) (0.00497087 -0.469971 2.92557e-21) (0.0557306 -0.183125 0) (0.0534541 -0.206407 1.42907e-21) (0.052035 -0.23377 0) (0.0491303 -0.269574 3.92464e-21) (0.0457014 -0.310819 -3.94477e-21) (0.0406076 -0.354945 -2.40962e-21) (0.0339425 -0.396727 -5.36496e-23) (0.0255432 -0.43116 -4.05831e-21) (0.0158775 -0.454893 -6.76473e-22) (0.00537423 -0.466882 -3.63899e-21) (0.0623931 -0.180481 1.03237e-20) (0.0585304 -0.203241 -3.96195e-21) (0.0566909 -0.230224 4.24774e-22) (0.0532176 -0.265592 -3.66699e-21) (0.049372 -0.306724 0) (0.0437939 -0.350874 -2.5132e-21) (0.036576 -0.392834 -2.09691e-22) (0.0275093 -0.427519 5.51229e-21) (0.0170882 -0.45147 7.55627e-22) (0.00580572 -0.463615 -7.58524e-22) (0.0695223 -0.177208 -1.06149e-21) (0.0639725 -0.19931 7.41345e-21) (0.0616225 -0.225979 3.81585e-21) (0.0575788 -0.260959 -3.81325e-21) (0.0532831 -0.301958 -2.29708e-21) (0.0472085 -0.346178 0) (0.0394105 -0.388417 -5.63058e-21) (0.0296387 -0.423484 2.82379e-21) (0.0184045 -0.447776 3.01513e-21) (0.00627485 -0.460134 3.23688e-21) (0.0770466 -0.173356 -1.42367e-21) (0.069777 -0.194758 0) (0.0667994 -0.221178 0) (0.0621965 -0.25581 0) (0.0574254 -0.296714 -2.64975e-21) (0.0508262 -0.341106 4.93826e-21) (0.0424022 -0.383736 5.73606e-21) (0.0318758 -0.419257 -9.03143e-21) (0.0197804 -0.443919 1.61624e-21) (0.0067585 -0.456499 -4.80761e-21) (0.0848425 -0.169034 -2.13126e-21) (0.0759386 -0.18955 7.31752e-21) (0.072209 -0.215757 -7.24763e-21) (0.0670811 -0.249929 9.2972e-21) (0.0618367 -0.290645 -1.16919e-20) (0.0547248 -0.335171 0) (0.045671 -0.378278 -2.99905e-21) (0.0343571 -0.414449 -1.23515e-22) (0.0213243 -0.439681 -3.35933e-21) (0.00730332 -0.452566 -3.42311e-21) (0.0927171 -0.164822 -1.51319e-21) (0.0823719 -0.184256 0) (0.0777284 -0.210461 -9.67722e-21) (0.0720898 -0.244319 1.82205e-20) (0.0663372 -0.285048 -7.0518e-21) (0.0586619 -0.329839 -1.4197e-21) (0.0489157 -0.37338 2.99256e-21) (0.0367761 -0.409977 -1.51191e-22) (0.022808 -0.43553 4.90352e-21) (0.00780449 -0.448599 5.06585e-21) (0.101004 -0.158686 -6.80642e-21) (0.0900071 -0.176614 6.6716e-21) (0.0840769 -0.20264 1.0307e-21) (0.0778473 -0.235927 0) (0.0715568 -0.276467 0) (0.0633528 -0.321635 1.3928e-21) (0.0529174 -0.366162 6.37407e-21) (0.0398631 -0.403992 -6.23464e-21) (0.0247547 -0.430545 -1.70646e-21) (0.00849034 -0.444037 1.67785e-21) (0.111993 -0.159285 0) (0.106629 -0.173806 0) (0.0974199 -0.2008 0) (0.0896959 -0.233468 0) (0.0819236 -0.273024 0) (0.0720979 -0.316624 0) (0.0599036 -0.359306 0) (0.0449539 -0.395443 0) (0.0278251 -0.420968 0) (0.00936432 -0.434278 0) (0.131618 -0.144784 0) (0.134914 -0.164443 0) (0.120755 -0.194682 0) (0.1123 -0.226963 0) (0.101873 -0.26548 0) (0.0891318 -0.306641 0) (0.0736858 -0.346131 0) (0.0551399 -0.378942 0) (0.0341843 -0.401419 0) (0.0118588 -0.412195 0) (0.158606 -0.130885 0) (0.165152 -0.15293 0) (0.146023 -0.183297 0) (0.137518 -0.214221 0) (0.12354 -0.251151 0) (0.107396 -0.289243 0) (0.0880517 -0.325516 0) (0.0653955 -0.35589 0) (0.0401824 -0.377548 0) (0.0132599 -0.389444 0) (0.192108 -0.121201 0) (0.199938 -0.143325 0) (0.175575 -0.172482 0) (0.167466 -0.202162 0) (0.148743 -0.237383 0) (0.12896 -0.271943 0) (0.105052 -0.304694 0) (0.077678 -0.331459 0) (0.0478158 -0.349469 0) (0.0167528 -0.357265 0) (0.23157 -0.109046 0) (0.23765 -0.129353 0) (0.208406 -0.156096 0) (0.199794 -0.183301 0) (0.174142 -0.214584 0) (0.150103 -0.244128 0) (0.120441 -0.273042 0) (0.0879956 -0.297183 0) (0.0532606 -0.315365 0) (0.0167847 -0.32716 0) (0.277503 -0.0998563 0) (0.280096 -0.117616 0) (0.246891 -0.142554 0) (0.236217 -0.166423 0) (0.202556 -0.193608 0) (0.17522 -0.219063 0) (0.139277 -0.244904 0) (0.101487 -0.265427 0) (0.0618303 -0.27953 0) (0.0228214 -0.28313 0) (0.325097 -0.0819964 0) (0.320106 -0.0958513 0) (0.283961 -0.116597 0) (0.267881 -0.134576 0) (0.226155 -0.156265 0) (0.195154 -0.176302 0) (0.149954 -0.196991 0) (0.106696 -0.21408 0) (0.0616203 -0.231153 0) (0.0154014 -0.249739 0) (0.372996 -0.0696646 0) (0.361249 -0.0793637 0) (0.325301 -0.0964585 0) (0.302541 -0.109642 0) (0.257792 -0.128298 0) (0.222589 -0.144528 0) (0.171014 -0.163193 0) (0.124116 -0.179902 0) (0.0737429 -0.196503 0) (0.0354987 -0.193613 0) (0.411676 -0.0381479 0) (0.394975 -0.0425469 0) (0.348248 -0.0528317 0) (0.318049 -0.0590773 0) (0.262568 -0.0703046 0) (0.218443 -0.0778926 0) (0.153252 -0.0884734 0) (0.0956132 -0.0980673 0) (0.0345069 -0.118032 0) (-0.0328646 -0.168551 0) (0.653418 -0.0195515 0) (0.631204 -0.0226018 0) (0.589364 -0.0272703 0) (0.554869 -0.0314924 0) (0.501752 -0.0379645 0) (0.452814 -0.0446096 0) (0.384078 -0.0550172 0) (0.311832 -0.0699135 0) (0.215858 -0.0989973 0) (0.15373 -0.156724 0) (0.134443 -0.142725 6.95453e-21) (0.156849 -0.127683 -6.85067e-21) (0.184004 -0.114308 1.12315e-21) (0.217192 -0.104934 0) (0.256487 -0.0938636 0) (0.300453 -0.0855474 1.71573e-21) (0.346758 -0.0697612 -8.19516e-21) (0.391628 -0.0598148 8.08944e-21) (0.438453 -0.0322605 2.30921e-21) (0.674719 -0.0170469 -2.33604e-21) (0.141761 -0.135631 -6.46343e-21) (0.163985 -0.120378 0) (0.190478 -0.107513 8.01287e-21) (0.223627 -0.0984398 -1.93775e-20) (0.263007 -0.0878291 1.30715e-20) (0.306855 -0.0798969 -1.5961e-21) (0.353147 -0.0648878 3.48291e-21) (0.397833 -0.0559104 7.85088e-21) (0.448303 -0.0299418 2.14235e-21) (0.683006 -0.015977 2.12932e-21) (0.148179 -0.127746 7.47024e-21) (0.169883 -0.112682 -7.52499e-21) (0.195696 -0.100549 7.45381e-21) (0.228496 -0.0919033 -1.03122e-20) (0.267786 -0.081837 7.47703e-21) (0.31164 -0.0743986 0) (0.357994 -0.0602474 -3.49134e-21) (0.403064 -0.052293 -7.01159e-23) (0.456907 -0.0278622 -4.04801e-21) (0.690729 -0.0149513 -4.25452e-21) (0.154583 -0.119298 -1.28795e-21) (0.176171 -0.104752 0) (0.201572 -0.0934471 0) (0.23397 -0.0852957 0) (0.273026 -0.0758657 8.48307e-21) (0.316777 -0.0690137 -5.77897e-21) (0.363023 -0.0558016 -2.26557e-22) (0.408373 -0.0488722 -3.99246e-21) (0.46494 -0.0259905 -2.03308e-21) (0.698127 -0.0140031 -2.07763e-21) (0.160443 -0.110454 1.30917e-21) (0.182144 -0.0967171 -4.07967e-21) (0.207248 -0.0863007 -4.2344e-21) (0.239505 -0.0786807 4.23177e-21) (0.278313 -0.0699435 -2.66591e-21) (0.322028 -0.0637511 0) (0.368137 -0.0515117 -3.4023e-21) (0.413723 -0.0455696 7.60762e-21) (0.472576 -0.0242632 -3.82528e-21) (0.705179 -0.013133 4.15043e-21) (0.165541 -0.101245 -9.6181e-21) (0.187363 -0.0885988 4.82923e-22) (0.21216 -0.0791473 -6.74087e-22) (0.244363 -0.0721118 4.13775e-21) (0.28301 -0.0641045 0) (0.326834 -0.0586327 0) (0.372757 -0.0473785 0) (0.418797 -0.0423681 3.63847e-21) (0.47967 -0.0226437 0) (0.711788 -0.0123307 0) (0.169809 -0.0916884 0) (0.191772 -0.0803835 4.85877e-21) (0.216276 -0.071965 -3.37243e-21) (0.248359 -0.065592 -4.73402e-21) (0.286913 -0.058373 4.75864e-21) (0.330899 -0.0536364 3.08418e-21) (0.376625 -0.0434103 -2.91001e-21) (0.423329 -0.0392959 -1.25305e-20) (0.486033 -0.0211103 8.87329e-22) (0.717874 -0.0115954 -2.97274e-21) (0.173148 -0.0818178 0) (0.195345 -0.0720636 -1.49125e-21) (0.219633 -0.0647312 -8.9933e-22) (0.25154 -0.0591027 0) (0.290026 -0.0527278 1.43724e-21) (0.334134 -0.0487436 -4.1344e-21) (0.379835 -0.0395859 4.92842e-21) (0.427148 -0.0363458 1.89199e-21) (0.491627 -0.0196601 -1.86713e-21) (0.723404 -0.0109252 3.97442e-21) (0.175433 -0.0716649 9.24631e-22) (0.198011 -0.0636349 1.60491e-21) (0.222191 -0.0574359 -2.80527e-22) (0.253916 -0.0526269 5.28654e-22) (0.292359 -0.0471362 1.24535e-21) (0.336557 -0.0439411 2.13678e-21) (0.382408 -0.0358754 -7.89884e-22) (0.430251 -0.0334966 -8.72084e-22) (0.496467 -0.0182905 1.87328e-21) (0.728368 -0.0103138 9.64597e-22) (0.176543 -0.0612561 -3.06661e-22) (0.199702 -0.0550894 3.10573e-22) (0.223884 -0.0500698 -4.40994e-22) (0.255442 -0.0461493 -5.27963e-22) (0.293871 -0.0415725 6.54276e-22) (0.33818 -0.0392092 -1.36676e-21) (0.384294 -0.03225 1.20167e-21) (0.432659 -0.0307312 4.57884e-22) (0.500528 -0.0169882 0) (0.732736 -0.00974695 -9.66704e-22) (0.176412 -0.0506175 3.01479e-22) (0.200391 -0.0464182 -3.05339e-22) (0.224677 -0.0426185 -4.30708e-22) (0.256088 -0.0396502 -5.17766e-22) (0.294526 -0.0360154 -6.48655e-22) (0.338996 -0.0345231 -4.00504e-23) (0.385451 -0.028683 3.68977e-22) (0.434382 -0.028035 1.26712e-21) (0.503788 -0.015735 0) (0.736521 -0.00921398 -9.45936e-22) (0.175046 -0.0397892 0) (0.200096 -0.037611 -1.54084e-21) (0.224568 -0.0350623 2.84e-21) (0.25585 -0.0331054 5.18635e-22) (0.294306 -0.0304411 1.20321e-21) (0.338984 -0.0298555 2.07726e-21) (0.385848 -0.0251481 -7.76334e-22) (0.435397 -0.0253915 -8.55052e-22) (0.506201 -0.0145129 1.8032e-21) (0.739714 -0.00870299 9.43723e-22) (0.172477 -0.0288426 0) (0.198833 -0.0286551 -1.35583e-21) (0.22357 -0.027377 -8.58645e-22) (0.254742 -0.0264862 0) (0.293214 -0.0248206 -3.77929e-21) (0.338139 -0.0251761 1.20862e-21) (0.385486 -0.0216188 1.47022e-21) (0.435705 -0.0227828 5.0089e-21) (0.507794 -0.0133089 -1.79735e-21) (0.742351 -0.00821248 3.72432e-21) (0.168742 -0.0178711 0) (0.196583 -0.0195408 1.36738e-21) (0.221681 -0.0195415 0) (0.252772 -0.0197648 4.45248e-21) (0.291255 -0.0191234 -4.47533e-21) (0.336448 -0.0204538 -2.91101e-21) (0.384342 -0.0180662 -1.52825e-22) (0.435267 -0.0201872 -5.02276e-21) (0.508504 -0.0121069 -8.3259e-22) (0.744395 -0.00773004 -4.60811e-21) (0.163924 -0.00699095 8.02019e-21) (0.193337 -0.010265 -3.01495e-21) (0.218914 -0.0115418 7.00897e-22) (0.249962 -0.0129162 -3.78029e-21) (0.288454 -0.0133208 0) (0.333946 -0.0156605 -2.91924e-21) (0.382471 -0.0144684 -2.92975e-22) (0.434154 -0.0175922 6.59314e-21) (0.508485 -0.0109017 9.03208e-22) (0.745927 -0.00726207 -9.02649e-22) (0.158179 0.00365063 -1.39444e-21) (0.189105 -0.000834944 6.09375e-21) (0.215293 -0.00337364 3.79926e-21) (0.246325 -0.00591867 -3.79663e-21) (0.284798 -0.00738467 -2.43139e-21) (0.330581 -0.0107635 0) (0.379767 -0.010788 -6.33274e-21) (0.432235 -0.014967 3.15603e-21) (0.507501 -0.00966891 3.45458e-21) (0.74684 -0.00678458 3.66622e-21) (0.151732 0.0138647 -9.85671e-22) (0.183948 0.00873043 0) (0.210911 0.00495733 0) (0.241974 0.00124159 0) (0.28044 -0.00130137 -2.81702e-21) (0.326578 -0.00575612 5.23936e-21) (0.376513 -0.0070329 6.34631e-21) (0.429828 -0.0123319 -9.99644e-21) (0.506108 -0.00841806 1.79934e-21) (0.747325 -0.00631695 -5.4067e-21) (0.144873 0.0234097 -1.35419e-21) (0.177863 0.0183884 6.29799e-21) (0.205674 0.0134463 -6.238e-21) (0.236731 0.00859897 9.24214e-21) (0.275076 0.00498504 -1.16431e-20) (0.321463 -0.00055567 0) (0.37211 -0.00309768 -3.15171e-21) (0.426319 -0.00959861 -4.10671e-23) (0.50334 -0.0070956 -3.55576e-21) (0.747108 -0.00581018 -3.65407e-21) (0.138084 0.0320564 -1.00905e-21) (0.171543 0.0280397 0) (0.200397 0.0219568 -8.80846e-21) (0.231582 0.016007 1.72116e-20) (0.269955 0.0113153 -6.76427e-21) (0.316739 0.00466008 -1.43755e-21) (0.36812 0.000821637 3.14488e-21) (0.423127 -0.006939 -1.06461e-22) (0.501236 -0.0057508 5.16498e-21) (0.746635 -0.00530814 5.37323e-21) (0.128466 0.0405776 -4.80091e-21) (0.161825 0.0388803 4.69477e-21) (0.191861 0.031546 8.95549e-22) (0.223271 0.024326 0) (0.261521 0.0184122 0) (0.308657 0.0105354 1.41282e-21) (0.361072 0.00530886 6.52083e-21) (0.417357 -0.00393288 -6.36267e-21) (0.495936 -0.00426197 -1.73668e-21) (0.74528 -0.00472622 1.65392e-21) (0.131165 0.0621438 0) (0.16126 0.0629804 0) (0.190743 0.0517257 0) (0.221507 0.042291 0) (0.258841 0.0336592 0) (0.304953 0.0230772 0) (0.356188 0.0147022 0) (0.412042 0.00218731 0) (0.493041 -0.000563824 0) (0.742165 -0.00332866 0) (0.124487 0.0959649 0) (0.153256 0.102554 0) (0.182265 0.0850281 0) (0.212705 0.0733558 0) (0.250253 0.0603267 0) (0.295835 0.0451901 0) (0.346868 0.0312323 0) (0.405214 0.0134548 0) (0.495156 0.00576079 0) (0.749278 -0.000804833 0) (0.114014 0.135702 0) (0.140152 0.144192 0) (0.166546 0.119909 0) (0.195728 0.107301 0) (0.232471 0.089555 0) (0.275931 0.0697473 0) (0.324823 0.049759 0) (0.382818 0.0262681 0) (0.476823 0.0123368 0) (0.733876 0.000675772 0) (0.104684 0.180754 0) (0.126364 0.189053 0) (0.150557 0.158088 0) (0.179101 0.146006 0) (0.215031 0.122315 0) (0.256327 0.0975593 0) (0.304655 0.0707987 0) (0.366143 0.0410279 0) (0.471684 0.0197945 0) (0.73601 0.00316056 0) (0.0906286 0.23281 0) (0.107196 0.23897 0) (0.129306 0.203055 0) (0.155074 0.191631 0) (0.186482 0.159927 0) (0.222452 0.130574 0) (0.267016 0.096493 0) (0.327237 0.0596217 0) (0.436177 0.0299998 0) (0.704504 0.0052215 0) (0.0795944 0.292075 0) (0.0913467 0.295667 0) (0.112555 0.255434 0) (0.133587 0.24311 0) (0.161296 0.202115 0) (0.193762 0.17054 0) (0.237396 0.128687 0) (0.30097 0.0850796 0) (0.421243 0.0454051 0) (0.697627 0.0104954 0) (0.0553933 0.360922 0) (0.0630018 0.359607 0) (0.079515 0.317375 0) (0.0937473 0.303016 0) (0.115966 0.256059 0) (0.141589 0.225382 0) (0.179199 0.175401 0) (0.237986 0.126931 0) (0.356766 0.0755171 0) (0.63386 0.0182919 0) (0.0472598 0.442544 0) (0.052154 0.438968 0) (0.0657054 0.395364 0) (0.0756939 0.379617 0) (0.0945454 0.329872 0) (0.115076 0.300986 0) (0.150962 0.244899 0) (0.209905 0.197924 0) (0.33059 0.131392 0) (0.59855 0.0380422 0) (0.00679443 0.579528 0) (0.0068195 0.574998 0) (0.0117477 0.537797 0) (0.0144376 0.524042 0) (0.0232931 0.481242 0) (0.0344393 0.456563 0) (0.0599942 0.403025 0) (0.106042 0.356462 0) (0.204834 0.259413 0) (0.439524 0.075972 0) (0.0146776 0.774989 0) (0.0185298 0.768798 0) (0.0234203 0.749746 0) (0.0300443 0.738194 0) (0.0393148 0.711284 0) (0.052716 0.687701 0) (0.0736551 0.64131 0) (0.1075 0.58026 0) (0.169633 0.442135 0) (0.311868 0.15052 0) (0.104083 0.0760049 4.66244e-21) (0.106848 0.118988 -4.60802e-21) (0.0990727 0.161612 7.8849e-22) (0.0906924 0.207978 0) (0.0781331 0.26097 0) (0.0681364 0.319005 1.28382e-21) (0.04708 0.387287 -6.16022e-21) (0.0400219 0.468312 6.11161e-21) (0.00506444 0.60117 1.71907e-21) (0.0134082 0.784798 -1.7328e-21) (0.0935616 0.0804749 -4.42828e-21) (0.0993394 0.126244 0) (0.0930913 0.16931 5.70643e-21) (0.0853255 0.216013 -1.39198e-20) (0.0733521 0.269353 9.46539e-21) (0.0637795 0.327591 -1.19097e-21) (0.0438555 0.396048 2.52799e-21) (0.037171 0.477546 5.72151e-21) (0.00439627 0.6093 1.49161e-21) (0.0128682 0.787418 1.51268e-21) (0.083646 0.0834702 5.18947e-21) (0.0917374 0.132037 -5.15709e-21) (0.0871278 0.175817 5.10738e-21) (0.0801025 0.222737 -7.36524e-21) (0.0687809 0.276169 5.31525e-21) (0.059707 0.33478 0) (0.0408765 0.403407 -2.53413e-21) (0.0345874 0.48575 -1.0283e-22) (0.00366593 0.616599 -2.90376e-21) (0.0121838 0.789224 -3.04445e-21) (0.0743804 0.0856193 -8.77197e-22) (0.0843154 0.137262 0) (0.081305 0.182411 0) (0.0750568 0.22967 0) (0.0644162 0.283233 5.98659e-21) (0.05589 0.342114 -4.09903e-21) (0.0381269 0.410779 -1.93231e-22) (0.0322558 0.493782 -2.82717e-21) (0.00292498 0.623617 -1.42336e-21) (0.011397 0.79149 -1.44844e-21) (0.0658051 0.0868054 6.08901e-22) (0.0772652 0.141511 -2.81698e-21) (0.0757413 0.188439 -2.8948e-21) (0.0702779 0.236284 2.89277e-21) (0.0603281 0.290159 -1.86048e-21) (0.052349 0.349383 0) (0.0355919 0.418124 -2.36977e-21) (0.0301463 0.501593 5.25704e-21) (0.00226601 0.630371 -2.61182e-21) (0.0105943 0.794219 2.90586e-21) (0.0579063 0.0869513 -7.0453e-21) (0.0706409 0.144553 4.46112e-22) (0.0704963 0.193423 -4.60928e-22) (0.0658156 0.242198 2.78517e-21) (0.0565597 0.296346 0) (0.0491223 0.356059 0) (0.0332817 0.424979 0) (0.0282537 0.508847 2.41511e-21) (0.00174778 0.636626 0) (0.00983299 0.796953 0) (0.0506813 0.0860173 0) (0.0644539 0.146354 3.25219e-21) (0.0656085 0.197299 -2.24898e-21) (0.0616732 0.247209 -3.12594e-21) (0.0530999 0.301644 3.14208e-21) (0.0462299 0.361914 2.01886e-21) (0.0311989 0.431056 -1.86268e-21) (0.0265754 0.515345 -8.16819e-21) (0.00137546 0.642215 5.74808e-22) (0.00912948 0.799355 -1.88728e-21) (0.0441464 0.0839674 0) (0.0587153 0.14688 -1.00614e-21) (0.0610771 0.200085 -5.82405e-22) (0.057864 0.251215 0) (0.0499435 0.306135 9.34017e-22) (0.0436359 0.366955 -2.63837e-21) (0.0293338 0.436236 3.13499e-21) (0.0251028 0.521017 1.24203e-21) (0.00112352 0.647019 -1.11878e-21) (0.00847413 0.801283 2.5292e-21) (0.0383326 0.080791 8.22086e-22) (0.0534326 0.146074 1.05709e-21) (0.0568988 0.201745 -2.03849e-22) (0.0543953 0.254203 3.29161e-22) (0.0471005 0.309782 7.87703e-22) (0.041298 0.371159 1.33361e-21) (0.0276706 0.440563 -4.71741e-22) (0.0238138 0.525984 -5.24706e-22) (0.000948028 0.651091 1.12248e-21) (0.00785972 0.802825 5.72673e-22) (0.0332949 0.0765261 -2.26223e-22) (0.0486053 0.143885 2.28838e-22) (0.0530738 0.202219 -2.81262e-22) (0.0512637 0.25616 -3.28731e-22) (0.0445578 0.312518 3.93033e-22) (0.0392019 0.374455 -8.27355e-22) (0.0262171 0.44413 7.13999e-22) (0.022677 0.530159 2.81062e-22) (0.000819439 0.654336 0) (0.00728848 0.804023 -5.73931e-22) (0.0119981 -0.00840492 0) (0.0303072 -0.017658 0) (0.044853 -0.0208237 -1.79966e-20) (0.0551323 -0.0209035 0) (0.0620556 -0.0188825 7.95301e-21) (0.066406 -0.0154603 -7.37016e-21) (0.0688464 -0.0111151 0) (0.0699281 -0.00615181 0) (0.0702153 -0.000658024 -1.20215e-20) (0.0702579 0.00517252 2.28284e-20) (0.0145304 -0.00866833 0) (0.0352875 -0.0175127 -1.44887e-20) (0.0509708 -0.0202015 -4.71845e-21) (0.0616192 -0.0200216 -1.71041e-20) (0.0684514 -0.0179759 -7.97675e-21) (0.0724658 -0.0147362 -2.21843e-20) (0.0744674 -0.0107417 0) (0.0750992 -0.0062685 0) (0.0749563 -0.00141295 0) (0.0745146 0.00363093 -3.08601e-22) (0.0172051 -0.00870563 0) (0.0402188 -0.0169874 -5.33805e-21) (0.0566763 -0.0192927 8.86188e-21) (0.06733 -0.0190399 1.28385e-20) (0.0737526 -0.0172073 -1.1746e-22) (0.0771759 -0.0144066 -2.59302e-23) (0.0785461 -0.0110151 1.36595e-20) (0.0785822 -0.00725957 -1.25697e-20) (0.0778965 -0.00318891 2.31508e-20) (0.0769284 0.00108737 -2.18215e-20) (0.019902 -0.00845589 -2.49584e-21) (0.0448614 -0.0160407 1.4712e-20) (0.0616894 -0.0181185 2.32177e-20) (0.0719915 -0.0180348 -2.63383e-20) (0.0777254 -0.0166916 1.60877e-20) (0.0803607 -0.0146066 1.49038e-20) (0.0809751 -0.0120767 -6.79589e-21) (0.0803481 -0.00926474 2.49761e-20) (0.0790956 -0.00616002 -3.70534e-22) (0.0776429 -0.00280806 -1.0899e-20) (0.0224762 -0.00788364 -2.64587e-21) (0.0489606 -0.014676 2.51383e-21) (0.0657496 -0.0167385 0) (0.0753883 -0.0171002 2.20433e-20) (0.0802284 -0.0165312 -4.09502e-21) (0.0819651 -0.0154245 -1.09701e-22) (0.0817874 -0.0139836 -6.8959e-21) (0.0805153 -0.0123044 -1.85645e-20) (0.078754 -0.0103302 8.79034e-23) (0.0769145 -0.00807516 1.56618e-20) (0.0247664 -0.00698515 0) (0.0522668 -0.0129464 -1.61504e-20) (0.0686379 -0.0152479 4.91467e-21) (0.0773782 -0.016341 -1.37294e-20) (0.0812152 -0.0168102 4.17656e-21) (0.0820382 -0.0169016 4.21463e-23) (0.081117 -0.0167214 4.13022e-23) (0.0792862 -0.0163071 1.2397e-20) (0.0771208 -0.0155819 -1.69484e-20) (0.0750148 -0.014543 1.57182e-20) (0.0266088 -0.00579343 1.42591e-21) (0.0545574 -0.0109539 1.08206e-20) (0.0701944 -0.0137716 0) (0.0778983 -0.0158648 1.38387e-20) (0.0807236 -0.0175913 -1.28766e-20) (0.0807063 -0.0190393 -3.79467e-21) (0.079158 -0.0202238 1.04467e-20) (0.0769012 -0.0211391 0) (0.0744551 -0.0217141 0) (0.0721621 -0.0219357 0) (0.0278485 -0.00437856 -1.50916e-21) (0.0556568 -0.0088435 -4.43865e-21) (0.0703286 -0.0124534 5.38294e-21) (0.0769607 -0.0157748 7.27046e-21) (0.0788578 -0.0189158 6.39852e-21) (0.078142 -0.0218098 3.97723e-21) (0.0761255 -0.0243974 0) (0.0735926 -0.0266423 6.26018e-21) (0.071002 -0.0284765 -2.96477e-21) (0.0686233 -0.0299642 0) (0.0283513 -0.00284531 0) (0.0554528 -0.00679367 8.94085e-21) (0.069022 -0.011446 -5.38198e-21) (0.0746418 -0.0161648 -4.88899e-21) (0.0757665 -0.0208071 6.84484e-23) (0.0745382 -0.0251679 -1.93174e-21) (0.07223 -0.0291348 1.82995e-21) (0.0695656 -0.032664 0) (0.0669412 -0.0357216 -2.89832e-21) (0.0645813 -0.0384207 -2.62785e-21) (0.028041 -0.00133049 2.11555e-22) (0.0539052 -0.00500342 -3.45799e-21) (0.0663279 -0.0108992 -3.46407e-22) (0.0710712 -0.0171159 1.63463e-23) (0.0716266 -0.023275 -1.68843e-21) (0.0700912 -0.0290609 0) (0.0676667 -0.0343327 -1.82955e-21) (0.0650036 -0.0390603 0) (0.0624351 -0.0432553 0) (0.0601362 -0.0470501 0) (0.0269479 2.27205e-05 -4.47516e-22) (0.0510745 -0.00366539 0) (0.062371 -0.0109512 0) (0.0664203 -0.0186928 -2.05718e-21) (0.0666303 -0.0263184 5.64954e-22) (0.0649927 -0.0334357 -4.09986e-23) (0.0626143 -0.0398992 -9.71139e-22) (0.0600694 -0.0457069 0) (0.0576336 -0.0509147 0) (0.0554351 -0.0556608 0) (0.0250925 0.00108622 0) (0.0470622 -0.0029382 -1.69346e-21) (0.0573077 -0.0117125 1.56183e-21) (0.0608712 -0.0209461 2.71327e-21) (0.060961 -0.0299357 0) (0.0594132 -0.0382521 2.14839e-21) (0.0572261 -0.0457671 -1.99792e-21) (0.054902 -0.0525157 0) (0.0526691 -0.0585921 3.05799e-21) (0.050617 -0.0641318 -2.96638e-21) (0.0224822 0.0017248 0) (0.041984 -0.00298208 1.45144e-20) (0.0513127 -0.0132836 0) (0.0546178 -0.0239158 1.15709e-20) (0.054806 -0.0341212 0) (0.053521 -0.0434745 -9.13596e-21) (0.0516501 -0.0518827 0) (0.0496337 -0.0594224 7.01711e-21) (0.047666 -0.0662173 -6.57208e-21) (0.0458064 -0.0723939 -6.03726e-21) (0.0192127 0.00181337 -4.01794e-21) (0.0360305 -0.00393545 -7.05832e-21) (0.0446018 -0.0157436 -3.35559e-21) (0.0478681 -0.0276293 -5.81533e-21) (0.0483487 -0.0388664 -5.31718e-21) (0.0474716 -0.0490735 4.60657e-21) (0.0460176 -0.0582068 4.2123e-21) (0.04438 -0.0663847 2.43967e-22) (0.0427309 -0.0737511 6.73929e-21) (0.0411066 -0.0804157 6.04379e-21) (0.0154288 0.00125363 -4.29535e-21) (0.0294354 -0.00589899 -7.48605e-21) (0.0374121 -0.0191436 -1.34709e-20) (0.0408341 -0.032098 6.13879e-21) (0.0417674 -0.044158 0) (0.0414109 -0.0550233 0) (0.040449 -0.0647095 -8.24627e-21) (0.0392433 -0.073375 -7.34373e-21) (0.0379557 -0.0811741 6.81728e-21) (0.0366041 -0.0881916 -5.94805e-21) (0.0113022 -1.95195e-05 4.26241e-21) (0.0224576 -0.00893119 3.60344e-21) (0.0299907 -0.0235054 -2.12662e-20) (0.0337284 -0.0373179 3.07176e-20) (0.0352364 -0.0499772 -5.55154e-21) (0.0354794 -0.0612984 0) (0.0350566 -0.0713643 0) (0.0343143 -0.0803709 3.81189e-20) (0.0334157 -0.0884753 -3.44139e-20) (0.0323636 -0.0957266 -1.88736e-20) (0.00702228 -0.00203344 3.62346e-20) (0.0153693 -0.0130458 0) (0.022588 -0.0288205 2.79261e-20) (0.0267611 -0.0432688 -2.47096e-20) (0.028927 -0.0562992 0) (0.0298148 -0.067873 9.5821e-21) (0.0299497 -0.0781448 -2.64497e-20) (0.0296753 -0.0873479 -3.07856e-20) (0.0291685 -0.0956391 1.43331e-20) (0.0284272 -0.10302 1.30338e-20) (0.00278508 -0.00477558 -7.26665e-20) (0.00844393 -0.0182109 -7.82849e-21) (0.0154499 -0.0350505 -1.41686e-20) (0.0201378 -0.0499151 -3.14827e-20) (0.0230101 -0.0630951 -1.08845e-20) (0.024562 -0.0747243 -9.71073e-21) (0.0252476 -0.0850299 -1.60342e-22) (0.0254134 -0.0942815 0) (0.0252663 -0.102644 0) (0.0248261 -0.110059 2.66985e-20) (-0.00121807 -0.00819434 3.64326e-20) (0.00194453 -0.0243497 -3.16917e-20) (0.00880962 -0.0421277 2.13882e-20) (0.0140544 -0.0572086 4.37932e-20) (0.0176577 -0.0703377 -1.1368e-20) (0.019885 -0.0818422 9.69241e-21) (0.0211145 -0.0920165 8.64416e-21) (0.0216907 -0.10116 0) (0.0218609 -0.109462 0) (0.0216661 -0.116809 -1.35085e-20) (-0.00481208 -0.012203 -4.51195e-21) (-0.00388849 -0.0313441 3.94523e-20) (0.00287806 -0.0499562 -7.15284e-21) (0.00868713 -0.0650901 0) (0.0130313 -0.0780116 0) (0.0159653 -0.0892616 1.98482e-20) (0.0178023 -0.0991908 0) (0.0188934 -0.1081 -1.57824e-20) (0.0195035 -0.11618 4.66604e-22) (0.0195206 -0.123245 1.39335e-20) (-0.00784846 -0.0166881 0) (-0.0088488 -0.0390412 0) (-0.00216786 -0.0584136 -2.7324e-20) (0.00417428 -0.0734861 0) (0.00924076 -0.0861149 1.08405e-20) (0.0129069 -0.0971117 -1.00466e-20) (0.0154462 -0.106957 0) (0.0172243 -0.116074 0) (0.0184641 -0.124878 -1.46228e-20) (0.0188569 -0.133598 2.84499e-20) (-0.0101955 -0.021499 0) (-0.0127579 -0.0472475 -2.20737e-20) (-0.00618235 -0.067339 -6.08319e-21) (0.000610922 -0.0822758 -2.38781e-20) (0.0063135 -0.0945513 -1.07911e-20) (0.0106253 -0.105274 -2.94052e-20) (0.0137482 -0.115036 0) (0.0159955 -0.124258 0) (0.0175167 -0.133219 0) (0.018071 -0.141797 3.96705e-23) (-0.0117508 -0.0264451 0) (-0.0154768 -0.0557176 -5.91471e-21) (-0.00905247 -0.0765249 1.40216e-20) (-0.00193174 -0.0912832 1.79208e-20) (0.00427098 -0.10314 4.7644e-22) (0.00908827 -0.113497 3.07419e-22) (0.0126367 -0.123016 1.75446e-20) (0.0151745 -0.132038 -1.6143e-20) (0.0168453 -0.140668 2.97974e-20) (0.0175929 -0.148664 -2.87946e-20) (-0.0124643 -0.031333 -3.88961e-21) (-0.0169233 -0.064192 2.14038e-20) (-0.0107039 -0.0857441 3.19481e-20) (-0.00339953 -0.10031 -3.37048e-20) (0.0031491 -0.111683 2.11882e-20) (0.00833014 -0.121552 1.92922e-20) (0.0121819 -0.130634 -8.76888e-21) (0.0149288 -0.139195 3.21709e-20) (0.0167463 -0.147241 -1.28529e-22) (0.0177229 -0.15456 -1.44839e-20) (-0.0123311 -0.0359691 -3.53606e-21) (-0.0170668 -0.0724025 3.36007e-21) (-0.011097 -0.0947575 0) (-0.00375516 -0.10915 2.7847e-20) (0.00298388 -0.119995 -5.05291e-21) (0.00839638 -0.12927 9.6246e-23) (0.0124544 -0.137763 -8.61367e-21) (0.0153602 -0.14571 -2.38897e-20) (0.017323 -0.153094 8.8585e-24) (0.0185156 -0.159781 2.17225e-20) (-0.0113888 -0.0401684 0) (-0.0159278 -0.080083 -1.78172e-20) (-0.0102289 -0.103324 5.62911e-21) (-0.00298316 -0.117603 -1.54712e-20) (0.00379934 -0.127912 4.85217e-21) (0.00932133 -0.136527 1.05857e-22) (0.0134998 -0.144338 7.01226e-23) (0.0165165 -0.151601 1.58617e-20) (0.0185996 -0.158322 -2.23138e-20) (0.0199642 -0.164448 2.17609e-20) (-0.00971518 -0.0437645 1.54203e-21) (-0.0135773 -0.0869825 1.17129e-20) (-0.00813433 -0.111212 0) (-0.00109342 -0.125476 1.52359e-20) (0.00560202 -0.135284 -1.37869e-20) (0.0111233 -0.143219 -4.41881e-21) (0.0153436 -0.15031 1.24637e-20) (0.0184209 -0.156868 0) (0.020585 -0.162949 0) (0.0220655 -0.168565 0) (-0.00742242 -0.0466162 -1.37758e-21) (-0.0101336 -0.0928745 -3.62753e-21) (-0.0048862 -0.118202 4.75019e-21) (0.00187685 -0.132587 6.95221e-21) (0.00837819 -0.141977 6.94421e-21) (0.0138027 -0.149258 4.18485e-21) (0.0179933 -0.155629 0) (0.0210807 -0.161492 7.78634e-21) (0.0232827 -0.166957 -3.61848e-21) (0.0248235 -0.172087 0) (-0.00465116 -0.0486095 0) (-0.0057596 -0.0975638 7.17365e-21) (-0.000594553 -0.124096 -4.749e-21) (0.00586224 -0.138769 -4.56439e-21) (0.0120925 -0.147862 -9.10677e-23) (0.017342 -0.154558 -2.16579e-21) (0.0214398 -0.160246 1.95591e-21) (0.0244899 -0.165438 0) (0.0266893 -0.17031 -3.67343e-21) (0.0282423 -0.17496 -3.68562e-21) (-0.001565 -0.0496896 1.37934e-22) (-0.000660269 -0.100907 -2.51244e-21) (0.00459218 -0.128725 -2.89822e-22) (0.0107674 -0.143867 -3.33881e-23) (0.0166871 -0.15282 -1.59203e-21) (0.0217055 -0.159035 0) (0.0256596 -0.164101 -1.95526e-21) (0.0286316 -0.168662 0) (0.0307955 -0.172962 0) (0.0323245 -0.177126 0) (0.0016707 -0.0499692 -2.43301e-22) (0.00493594 -0.102899 0) (0.010494 -0.132017 0) (0.0164689 -0.147786 -1.37158e-21) (0.0220824 -0.156767 5.35548e-22) (0.0268413 -0.162624 5.93006e-23) (0.0306166 -0.167151 -9.18145e-22) (0.0334796 -0.171126 0) (0.0355862 -0.174872 0) (0.037072 -0.178537 0) (0.00493389 -0.049482 0) (0.010843 -0.103492 -9.03778e-22) (0.0169334 -0.133875 8.33483e-22) (0.0228274 -0.150411 1.87564e-21) (0.0281767 -0.159596 0) (0.0326766 -0.165245 1.91891e-21) (0.036258 -0.169334 -1.7845e-21) (0.038995 -0.172785 0) (0.0410376 -0.176001 3.7208e-21) (0.0424842 -0.179155 -3.58644e-21) (0.00809344 -0.0481975 0) (0.0168464 -0.102666 5.7661e-21) (0.0237111 -0.134224 0) (0.0296929 -0.151651 6.53048e-21) (0.0348562 -0.161224 0) (0.039127 -0.166828 -7.03778e-21) (0.0425197 -0.170598 0) (0.0451266 -0.1736 7.48821e-21) (0.0471089 -0.176323 -7.01326e-21) (0.0485431 -0.178967 -7.40436e-21) (0.01102 -0.0461849 -1.34077e-21) (0.022731 -0.100462 -3.02206e-21) (0.0306148 -0.133031 -1.35561e-21) (0.0368801 -0.151442 -3.15459e-21) (0.0419821 -0.161578 -3.11815e-21) (0.0460885 -0.167309 3.40721e-21) (0.0493209 -0.170896 3.37579e-21) (0.051807 -0.173542 -3.01786e-22) (0.0537351 -0.175823 6.96715e-21) (0.0551996 -0.177975 7.39686e-21) (0.0136093 -0.0435535 -1.07694e-21) (0.0282905 -0.0969687 -2.65654e-21) (0.0374289 -0.130333 -5.60726e-21) (0.0441967 -0.149761 2.70031e-21) (0.0493985 -0.160607 0) (0.0534387 -0.166633 0) (0.0565632 -0.17018 -7.26505e-21) (0.0589525 -0.172577 -7.41595e-21) (0.0608346 -0.174487 7.18581e-21) (0.0623589 -0.176163 -8.01596e-21) (0.0157821 -0.0404269 1.03178e-21) (0.03334 -0.0923222 1.4318e-21) (0.0439403 -0.126202 -6.53194e-21) (0.0514436 -0.146615 1.37197e-20) (0.056936 -0.158278 -2.7835e-21) (0.0610401 -0.164753 0) (0.0641332 -0.168406 0) (0.0664648 -0.17067 3.56922e-20) (0.0683332 -0.172288 -3.58385e-20) (0.0699438 -0.173531 -2.35385e-20) (0.0174853 -0.0369355 6.01742e-21) (0.0377244 -0.0866927 0) (0.0499482 -0.120751 9.43564e-21) (0.0584189 -0.14205 -1.07066e-20) (0.0644151 -0.154588 0) (0.0687424 -0.161637 6.70988e-21) (0.0719063 -0.165531 -1.9418e-20) (0.0742328 -0.167782 -2.85171e-20) (0.0761093 -0.169207 1.36316e-20) (0.0778527 -0.170093 1.4874e-20) (0.0186917 -0.0332111 -1.13637e-20) (0.0413235 -0.0802752 -2.04114e-21) (0.055273 -0.114129 -3.92365e-21) (0.0649254 -0.136149 -1.17552e-20) (0.0716501 -0.149561 -6.04806e-21) (0.0763847 -0.157271 -6.39037e-21) (0.0797468 -0.16152 2.6576e-22) (0.08213 -0.163867 0) (0.0840122 -0.165198 0) (0.0859006 -0.165809 3.04347e-20) (0.0193994 -0.0293801 5.34631e-21) (0.0440555 -0.0732794 -6.57799e-21) (0.0597634 -0.106522 5.93433e-21) (0.0707791 -0.129033 1.68414e-20) (0.0784565 -0.143256 -4.80675e-21) (0.0838038 -0.151667 6.7308e-21) (0.087524 -0.15635 6.97747e-21) (0.0900571 -0.158878 0) (0.0919216 -0.160215 0) (0.0938781 -0.160702 -1.48055e-20) (0.0196297 -0.0255607 -5.86266e-22) (0.0458785 -0.0659213 8.40005e-21) (0.0633023 -0.0981418 -1.67927e-21) (0.0758159 -0.120866 0) (0.0846567 -0.135774 0) (0.0908315 -0.144867 1.16486e-20) (0.0950863 -0.150004 0) (0.0978555 -0.152688 -1.418e-20) (0.0994998 -0.153896 -1.43569e-21) (0.10096 -0.154081 1.41098e-20) (0.0194239 -0.021854 0) (0.0467898 -0.0584057 0) (0.0658094 -0.0892095 -7.21494e-21) (0.0798957 -0.111833 0) (0.0900874 -0.127247 5.48034e-21) (0.0973344 -0.136956 -5.07885e-21) (0.102437 -0.142511 0) (0.105996 -0.145225 0) (0.108487 -0.146161 -1.48973e-20) (0.111339 -0.146354 2.92525e-20) (0.0188158 -0.0183281 0) (0.0468027 -0.0509096 -4.43558e-21) (0.0672308 -0.0799447 -1.48465e-21) (0.0829 -0.102147 -8.26075e-21) (0.0945855 -0.117867 -4.16799e-21) (0.103125 -0.128131 -1.56055e-20) (0.109333 -0.1342 0) (0.113963 -0.137283 0) (0.11765 -0.138648 0) (0.12151 -0.13961 3.25972e-22) (0.0178413 -0.0150419 0) (0.0459552 -0.043612 -1.81842e-21) (0.0675471 -0.0705831 3.60016e-21) (0.0847371 -0.0920466 6.42948e-21) (0.0979907 -0.107842 2.41511e-22) (0.107975 -0.118564 3.08809e-22) (0.115453 -0.125195 1.14189e-20) (0.121227 -0.128819 -1.23587e-20) (0.126007 -0.130716 2.74115e-20) (0.13065 -0.132049 -2.85027e-20) (0.0165623 -0.0120543 -5.89157e-22) (0.0443224 -0.0366757 4.50914e-21) (0.0667827 -0.0613486 8.70299e-21) (0.0853582 -0.0817667 -1.25345e-20) (0.100178 -0.0973764 8.35515e-21) (0.111691 -0.108393 9.46453e-21) (0.120544 -0.115519 -6.23907e-21) (0.127498 -0.119673 2.53803e-20) (0.133255 -0.122032 1.198e-21) (0.138527 -0.123575 -1.32002e-20) (0.0150468 -0.00940797 -7.41913e-22) (0.0420034 -0.0302355 7.0487e-22) (0.0650008 -0.0524438 0) (0.0847608 -0.0715348 1.02672e-20) (0.101074 -0.0866788 -2.04581e-21) (0.114135 -0.0977753 4.94965e-22) (0.124431 -0.10526 -5.03616e-21) (0.132623 -0.109863 -1.84377e-20) (0.139356 -0.112623 -9.88904e-22) (0.145232 -0.114354 2.07632e-20) (0.013361 -0.00712649 0) (0.0391109 -0.0243944 -5.37391e-21) (0.0622962 -0.0440445 1.71062e-21) (0.082987 -0.0615663 -6.25794e-21) (0.100653 -0.0759646 2.0355e-21) (0.115225 -0.086896 -3.5567e-22) (0.12699 -0.0945592 -3.26385e-22) (0.136476 -0.0994947 1.19306e-20) (0.144239 -0.102574 -1.87038e-20) (0.150777 -0.10447 1.94298e-20) (0.0115668 -0.00521808 3.67616e-22) (0.0357658 -0.0192248 3.51867e-21) (0.0587894 -0.0362961 0) (0.0801198 -0.0520576 6.26142e-21) (0.0989407 -0.0654473 -6.43996e-21) (0.114923 -0.075955 -2.57805e-21) (0.128138 -0.0835842 7.63005e-21) (0.138946 -0.0886958 0) (0.147799 -0.0919854 0) (0.155085 -0.0940061 0) (0.00972118 -0.0036784 -4.49441e-22) (0.0320911 -0.0147703 -1.53464e-21) (0.0546192 -0.0293118 2.01942e-21) (0.0762759 -0.0431801 3.2109e-21) (0.0960062 -0.0553296 3.37262e-21) (0.113241 -0.0651565 2.34143e-21) (0.127833 -0.0725183 0) (0.139958 -0.0776195 5.75921e-21) (0.149939 -0.0809852 -2.56404e-21) (0.158055 -0.0830679 0) (0.00787385 -0.00249297 0) (0.0282055 -0.0110487 2.99923e-21) (0.049933 -0.0231716 -2.019e-21) (0.0715974 -0.035076 -2.09798e-21) (0.0919573 -0.0457966 -6.86207e-23) (0.110237 -0.054702 -1.24724e-21) (0.12608 -0.0615561 1.22694e-21) (0.139473 -0.0664396 0) (0.150594 -0.0697226 -2.82962e-21) (0.159599 -0.0717749 -3.13562e-21) (0.00607324 -0.00163963 5.90536e-23) (0.0242271 -0.0080552 -1.1771e-21) (0.0448867 -0.0179251 -1.5335e-22) (0.0662481 -0.0278571 -2.72149e-23) (0.086937 -0.0370118 -8.46002e-22) (0.106012 -0.0447851 0) (0.122931 -0.0508976 -1.2266e-21) (0.137495 -0.0553444 0) (0.149727 -0.0583626 0) (0.159645 -0.060256 0) (0.00438317 -0.00108943 -1.28035e-22) (0.020297 -0.00576429 0) (0.0396709 -0.0135921 0) (0.0604425 -0.0216037 -8.49581e-22) (0.0811541 -0.0291135 3.25171e-22) (0.100744 -0.0355867 6.07107e-23) (0.118516 -0.0407444 -5.70661e-22) (0.134101 -0.0445355 0) (0.147364 -0.0470891 0) (0.158176 -0.0486545 0) (0.00282837 -0.000806487 0) (0.0164978 -0.00412513 -6.173e-22) (0.0344193 -0.0101471 5.69244e-22) (0.0543459 -0.0163379 1.14348e-21) (0.0747831 -0.0221799 0) (0.0945934 -0.0272352 1.22633e-21) (0.112965 -0.031261 -1.14039e-21) (0.129383 -0.0341948 0) (0.143557 -0.0360844 2.72826e-21) (0.155209 -0.0371283 -2.60455e-21) (0.00140969 -0.000756423 0) (0.0128819 -0.0030826 5.16109e-21) (0.0292384 -0.00755243 0) (0.0481108 -0.0120625 4.89003e-21) (0.0680045 -0.0162667 0) (0.0877477 -0.0198398 -4.74505e-21) (0.10645 -0.0226 0) (0.123484 -0.0245039 5.14872e-21) (0.138413 -0.0255445 -4.82212e-21) (0.150811 -0.025867 -5.29658e-21) (0.000139356 -0.000906323 -1.32357e-21) (0.00950806 -0.00257665 -2.54753e-21) (0.0242376 -0.00575457 -1.25045e-21) (0.0418923 -0.00875514 -2.33695e-21) (0.0610075 -0.0113985 -2.35824e-21) (0.0804115 -0.0134784 2.26785e-21) (0.0991741 -0.0148893 2.30352e-21) (0.116586 -0.0156301 -2.40814e-22) (0.132083 -0.015662 4.75907e-21) (0.145092 -0.0150706 5.29738e-21) (-0.000971132 -0.00122368 -1.33634e-21) (0.00642646 -0.00254152 -2.83381e-21) (0.0195129 -0.0046841 -5.57067e-21) (0.0358325 -0.0063664 2.51704e-21) (0.0539728 -0.00756514 0) (0.0727905 -0.00819158 0) (0.0913493 -0.00822353 -4.9844e-21) (0.108894 -0.00771664 -5.01117e-21) (0.124756 -0.00661901 4.87711e-21) (0.138211 -0.00494323 -5.83958e-21) (-0.00191516 -0.00167689 1.46711e-21) (0.00367391 -0.00290783 1.56088e-21) (0.015141 -0.00425905 -8.60307e-21) (0.0300516 -0.0048239 1.35189e-20) (0.0470613 -0.00472353 -2.5018e-21) (0.065077 -0.00398113 0) (0.0831863 -0.00265899 0) (0.100624 -0.000877697 2.44515e-20) (0.116644 0.00141562 -2.43291e-20) (0.130374 0.00430297 -1.60692e-20) (-0.00269001 -0.00223513 1.2192e-20) (0.00127499 -0.00360371 0) (0.011179 -0.00438762 1.13324e-20) (0.0246449 -0.00403523 -1.0811e-20) (0.0404071 -0.00279941 0) (0.0574385 -0.000808364 5.13983e-21) (0.0748748 0.00179211 -1.46174e-20) (0.0919769 0.00481049 -1.95891e-20) (0.10796 0.00829018 9.31796e-21) (0.121813 0.012443 9.9439e-21) (-0.00329576 -0.00286814 -2.49668e-20) (-0.000756295 -0.00455582 -3.19194e-21) (0.00766574 -0.00497062 -6.19323e-21) (0.0196832 -0.00389096 -1.43074e-20) (0.0341145 -0.00168867 -5.45451e-21) (0.0500068 0.00140929 -5.31559e-21) (0.0665624 0.00517323 -1.35803e-22) (0.0831052 0.00932974 0) (0.0988683 0.0138895 0) (0.11274 0.0192464 1.9904e-20) (-0.00373484 -0.00354607 1.27751e-20) (-0.00241524 -0.00569056 -1.32864e-20) (0.00462411 -0.00590448 9.03835e-21) (0.0152148 -0.00426826 2.03092e-20) (0.0282591 -0.00125863 -5.4584e-21) (0.0428752 0.00280452 5.09011e-21) (0.0583332 0.00760306 5.02741e-21) (0.0740392 0.0127553 0) (0.089314 0.0181602 0) (0.103083 0.0244449 -9.60358e-21) (-0.00401222 -0.0042399 -1.70373e-21) (-0.00370526 -0.0069361 1.6711e-20) (0.00206382 -0.00708557 -3.15593e-21) (0.0112722 -0.00503697 0) (0.0229011 -0.00135043 0) (0.0361227 0.0035776 1.06026e-20) (0.0502366 0.00934968 0) (0.0646581 0.0154548 -1.00656e-20) (0.0787474 0.0214688 -3.29699e-22) (0.091626 0.027978 9.33997e-21) (-0.00413541 -0.00492261 0) (-0.00463729 -0.008226 0) (-1.67995e-05 -0.00841809 -1.33794e-20) (0.0078777 -0.00607528 0) (0.0181055 -0.00180632 5.87441e-21) (0.029881 0.00396848 -5.4439e-21) (0.0424905 0.0108827 0) (0.0552489 0.0185851 0) (0.0675403 0.0268398 -1.0307e-20) (0.0790528 0.0365316 2.01422e-20) (-0.00411168 -0.0055659 0) (-0.00522733 -0.00950025 -1.10056e-20) (-0.00162805 -0.00982069 -3.75336e-21) (0.0050453 -0.00729005 -1.29242e-20) (0.0139444 -0.00253607 -6.09334e-21) (0.0243531 0.00402937 -1.70011e-20) (0.0356201 0.01209 0) (0.0471572 0.0214181 0) (0.0586427 0.0318676 0) (0.0700691 0.0437285 2.54554e-22) (-0.00395151 -0.00613969 0) (-0.00549921 -0.0107032 -4.18419e-21) (-0.00279076 -0.011226 6.5975e-21) (0.00276987 -0.00861547 9.67917e-21) (0.0104406 -0.00350106 -3.22196e-22) (0.0195954 0.00371848 -2.91227e-22) (0.0296761 0.0127458 1.10811e-20) (0.0402096 0.0233575 -1.0598e-20) (0.0509794 0.0353361 2.0758e-20) (0.0618385 0.0485087 -2.05411e-20) (-0.0036721 -0.00662066 -1.97087e-21) (-0.00548426 -0.0117905 1.12286e-20) (-0.00353543 -0.0125821 1.77244e-20) (0.00102656 -0.0100042 -2.04039e-20) (0.00757259 -0.00467786 1.2359e-20) (0.01557 0.00300775 1.16158e-20) (0.0245476 0.0127492 -5.52368e-21) (0.0341112 0.0242712 2.14794e-20) (0.0440537 0.0372374 5.34734e-22) (0.0540998 0.0512163 -1.01386e-20) (-0.00329434 -0.00699172 -2.04881e-21) (-0.00521757 -0.0127296 1.94664e-21) (-0.00389667 -0.0138512 0) (-0.000216426 -0.0114211 1.71043e-20) (0.00530764 -0.00604378 -3.21067e-21) (0.0122336 0.00190032 -2.9787e-23) (0.0201674 0.0120955 -5.69833e-21) (0.0287713 0.0242133 -1.66169e-20) (0.0378245 0.0378255 -5.92526e-23) (0.0469888 0.0523628 1.58744e-20) (-0.00284083 -0.00724294 0) (-0.00473431 -0.0134994 -1.21961e-20) (-0.00390759 -0.0150081 3.74086e-21) (-0.000987636 -0.0128395 -1.07129e-20) (0.00361865 -0.00757453 3.29015e-21) (0.00955571 0.000418185 -1.2308e-22) (0.0164989 0.0108164 -1.16153e-22) (0.0241557 0.0232573 1.11851e-20) (0.032291 0.0372626 -1.61647e-20) (0.040552 0.0521997 1.59022e-20) (-0.00233258 -0.00736843 1.07111e-21) (-0.00406746 -0.0140954 8.13923e-21) (-0.00359477 -0.0160386 0) (-0.00130483 -0.0142379 1.07959e-20) (0.00249288 -0.00924198 -1.02343e-20) (0.00752407 -0.00140234 -3.21683e-21) (0.0135288 0.00896338 8.94782e-21) (0.0202558 0.0214818 0) (0.0274658 0.0356609 0) (0.034823 0.0508557 0) (-0.00179245 -0.00737031 -1.09962e-21) (-0.00324491 -0.0145243 -3.19176e-21) (-0.00297094 -0.0169385 3.97198e-21) (-0.00116889 -0.0155975 5.5927e-21) (0.00193926 -0.0110113 5.14533e-21) (0.00615362 -0.00350912 3.30515e-21) (0.0112759 0.00660809 0) (0.0170982 0.0189793 5.8961e-21) (0.0233915 0.0331281 -2.70968e-21) (0.0298542 0.0484322 0) (-0.00123941 -0.007263 0) (-0.00228187 -0.0148011 6.38931e-21) (-0.00203442 -0.0177118 -3.97113e-21) (-0.000561089 -0.0169 -3.72935e-21) (0.00199231 -0.0128384 2.26947e-24) (0.00549112 -0.00583219 -1.64829e-21) (0.00979662 0.00384416 1.5948e-21) (0.0147487 0.0158612 0) (0.0201442 0.0297818 -2.81209e-21) (0.0257208 0.0450331 -2.79524e-21) (-0.000685199 -0.0070717 1.41508e-22) (-0.00118221 -0.0149556 -2.4265e-21) (-0.000768083 -0.0183694 -2.61943e-22) (0.000558536 -0.0181252 -9.70687e-24) (0.00271231 -0.014667 -1.34192e-21) (0.00561489 -0.00827954 0) (0.00918439 0.000793679 -1.59434e-21) (0.0133129 0.0122688 0) (0.0178369 0.0257674 0) (0.0225313 0.0407891 0) ) ; boundaryField { inlet { type uniformFixedValue; uniformValue constant (1 0 0); value uniform (1 0 0); } outlet { type pressureInletOutletVelocity; value nonuniform List<vector> 40 ( (0.0184179 0.0396621 0) (0.0277883 0.117734 0) (0.0309513 0.188726 0) (0.0277247 0.253926 0) (0.022971 0.324574 0) (0.0188932 0.403221 0) (0.0134411 0.489433 0) (0.00928814 0.58906 0) (0.0021032 0.706797 0) (0.000928115 0.814825 0) (0 -0.00310351 0) (0 -0.0202113 0) (0 -0.036225 0) (0 -0.0510473 0) (0 -0.0646479 0) (0 -0.0770466 0) (0 -0.0882968 0) (0 -0.0984714 0) (0 -0.107652 0) (0 -0.115923 0) (0 -0.123363 0) (0 -0.130049 0) (0 -0.136056 0) (0 -0.141458 0) (0 -0.146335 0) (0 -0.150765 0) (0 -0.154834 0) (0 -0.158629 0) (0 -0.162239 0) (0 -0.165755 0) (0 -0.17408 0) (0 -0.19161 0) (0 -0.216738 0) (0 -0.252232 0) (0 -0.299052 0) (0 -0.354296 0) (0 -0.410444 0) (0 -0.457941 0) (0 -0.490497 0) (0 -0.506609 0) ) ; } cylinder { type fixedValue; value uniform (0 0 0); } top { type symmetryPlane; } bottom { type symmetryPlane; } defaultFaces { type empty; } } // ************************************************************************* //
[ "henry.rossiter@utexas.edu" ]
henry.rossiter@utexas.edu
ea41a56288c784ad42b5672e8d9dc061f1adbf32
9baddaf0c91617af0554ea80780dff4d8e126cdb
/CodeVein_0.1/Client/Codes/Material_Inven.cpp
75af0dabd47088cffaf8582a5b581a85e1157913
[]
no_license
plmnb14/TeamProject_3D_CodeVein
d0742b799f639f7d78db51aaba198195f4cc5c76
15317dac5d8a75d76abf267d31d7c3930505684a
refs/heads/master
2023-05-07T08:21:02.579479
2020-04-02T06:57:57
2020-04-02T06:57:57
null
0
0
null
null
null
null
UHC
C++
false
false
6,165
cpp
#include "stdafx.h" #include "..\Headers\Material_Inven.h" CMaterial_Inven::CMaterial_Inven(_Device pDevice) : CUI(pDevice) { } CMaterial_Inven::CMaterial_Inven(const CMaterial_Inven & rhs) : CUI(rhs) { } HRESULT CMaterial_Inven::Ready_GameObject_Prototype() { CUI::Ready_GameObject_Prototype(); return NOERROR; } HRESULT CMaterial_Inven::Ready_GameObject(void * pArg) { if (FAILED(Add_Component())) return E_FAIL; CUI::Ready_GameObject(pArg); m_fPosX = WINCX * 0.75f; m_fPosY = WINCY * 0.5f; m_fSizeX = WINCX * 0.5f; m_fSizeY = WINCY; m_fViewZ = 1.f; m_bIsActive = false; // Slot Create CUI::UI_DESC* pDesc = nullptr; CMaterial_Slot* pSlot = nullptr; for (_uint i = 0; i < 2; ++i) { for (_uint j = 0; j < 5; ++j) { pDesc = new CUI::UI_DESC; pDesc->fPosX = m_fPosX - 180.f + 90.f * j; pDesc->fPosY = m_fPosY - 100.f + 90.f * i; pDesc->fSizeX = 80.f; pDesc->fSizeY = 80.f; pDesc->iIndex = 0; g_pManagement->Add_GameObject_ToLayer(L"GameObject_MaterialSlot", SCENE_STAGE, L"Layer_MaterialSlot", pDesc); pSlot = static_cast<CMaterial_Slot*>(g_pManagement->Get_GameObjectBack(L"Layer_MaterialSlot", SCENE_STAGE)); m_vecMaterialSlot.push_back(pSlot); } } return NOERROR; } _int CMaterial_Inven::Update_GameObject(_double TimeDelta) { CUI::Update_GameObject(TimeDelta); if (g_pInput_Device->Key_Up(DIK_2)) m_bIsActive = !m_bIsActive; m_pRendererCom->Add_RenderList(RENDER_UI, this); D3DXMatrixOrthoLH(&m_matProj, WINCX, WINCY, 0.f, 1.0f); for (auto& pSlot : m_vecMaterialSlot) { pSlot->Set_Active(m_bIsActive); pSlot->Set_ViewZ(m_fViewZ - 0.1f); } /*if (g_pInput_Device->Key_Up(DIK_8)) Add_Material(CMaterial::MATERIAL_1); if (g_pInput_Device->Key_Up(DIK_9)) Sell_Material(3);*/ //cout << m_vecMaterialSlot[0]->Get_Size() << endl; return NO_EVENT; } _int CMaterial_Inven::Late_Update_GameObject(_double TimeDelta) { D3DXMatrixIdentity(&m_matWorld); D3DXMatrixIdentity(&m_matView); m_matWorld._11 = m_fSizeX; m_matWorld._22 = m_fSizeY; m_matWorld._33 = 1.f; m_matWorld._41 = m_fPosX - WINCX * 0.5f; m_matWorld._42 = -m_fPosY + WINCY * 0.5f; m_matWorld._42 = 1.f; return NO_EVENT; } HRESULT CMaterial_Inven::Render_GameObject() { if (!m_bIsActive) return NOERROR; if (nullptr == m_pShaderCom || nullptr == m_pBufferCom) return E_FAIL; g_pManagement->Set_Transform(D3DTS_WORLD, m_matWorld); m_matOldView = g_pManagement->Get_Transform(D3DTS_VIEW); m_matOldProj = g_pManagement->Get_Transform(D3DTS_PROJECTION); g_pManagement->Set_Transform(D3DTS_VIEW, m_matView); g_pManagement->Set_Transform(D3DTS_PROJECTION, m_matProj); if (FAILED(SetUp_ConstantTable())) return E_FAIL; m_pShaderCom->Begin_Shader(); m_pShaderCom->Begin_Pass(0); // 버퍼를 렌더링한다. // (인덱스버퍼(012023)에 보관하고있는 인덱스를 가진 정점을 그리낟.) // 삼각형 두개를 그리낟.각각의 삼각형마다 정점세개, 각각의 정점을 버텍스 셰이더의 인자로 던진다. m_pBufferCom->Render_VIBuffer(); m_pShaderCom->End_Pass(); m_pShaderCom->End_Shader(); g_pManagement->Set_Transform(D3DTS_VIEW, m_matOldView); g_pManagement->Set_Transform(D3DTS_PROJECTION, m_matOldProj); return NOERROR; } HRESULT CMaterial_Inven::Add_Component() { // For.Com_Transform if (FAILED(CGameObject::Add_Component(SCENE_STATIC, L"Transform", L"Com_Transform", (CComponent**)&m_pTransformCom))) return E_FAIL; // For.Com_Renderer if (FAILED(CGameObject::Add_Component(SCENE_STATIC, L"Renderer", L"Com_Renderer", (CComponent**)&m_pRendererCom))) return E_FAIL; // For.Com_Texture if (FAILED(CGameObject::Add_Component(SCENE_STATIC, L"Tex_MenuWindow", L"Com_Texture", (CComponent**)&m_pTextureCom))) return E_FAIL; // For.Com_Shader if (FAILED(CGameObject::Add_Component(SCENE_STATIC, L"Shader_UI", L"Com_Shader", (CComponent**)&m_pShaderCom))) return E_FAIL; // for.Com_VIBuffer if (FAILED(CGameObject::Add_Component(SCENE_STATIC, L"VIBuffer_Rect", L"Com_VIBuffer", (CComponent**)&m_pBufferCom))) return E_FAIL; return NOERROR; } HRESULT CMaterial_Inven::SetUp_ConstantTable() { if (nullptr == m_pShaderCom) return E_FAIL; if (FAILED(m_pShaderCom->Set_Value("g_matWorld", &m_matWorld, sizeof(_mat)))) return E_FAIL; if (FAILED(m_pShaderCom->Set_Value("g_matView", &m_matView, sizeof(_mat)))) return E_FAIL; if (FAILED(m_pShaderCom->Set_Value("g_matProj", &m_matProj, sizeof(_mat)))) return E_FAIL; if (FAILED(m_pTextureCom->SetUp_OnShader("g_DiffuseTexture", m_pShaderCom, 2))) return E_FAIL; return NOERROR; } void CMaterial_Inven::Load_Materials(CMaterial * pMaterial, _uint iIndex) { if (iIndex > m_vecMaterialSlot.size()) return; if (m_vecMaterialSlot[iIndex]->Get_Type() == pMaterial->Get_Type() || m_vecMaterialSlot[iIndex]->Get_Size() == 0) m_vecMaterialSlot[iIndex]->Input_Item(pMaterial); else Load_Materials(pMaterial, iIndex + 1); } void CMaterial_Inven::Add_Material(CMaterial::MATERIAL_TYPE eType) { g_pManagement->Add_GameObject_ToLayer(L"GameObject_Material", SCENE_STAGE, L"Layer_Material"); CMaterial* pMaterial = static_cast<CMaterial*>(g_pManagement->Get_GameObjectBack(L"Layer_Material", SCENE_STAGE)); pMaterial->Set_Type(eType); Load_Materials(pMaterial, 0); } void CMaterial_Inven::Sell_Material(_uint iDelete) { for (auto& pSlot : m_vecMaterialSlot) { if (pSlot->Pt_InRect()) { for (_uint i = 0; i < iDelete; ++i) pSlot->Delete_Item(); return; } } } CMaterial_Inven * CMaterial_Inven::Create(_Device pGraphic_Device) { CMaterial_Inven* pInstance = new CMaterial_Inven(pGraphic_Device); if (FAILED(pInstance->Ready_GameObject_Prototype())) Safe_Release(pInstance); return pInstance; } CGameObject * CMaterial_Inven::Clone_GameObject(void * pArg) { CMaterial_Inven* pInstance = new CMaterial_Inven(*this); if (FAILED(pInstance->Ready_GameObject(pArg))) Safe_Release(pInstance); return pInstance; } void CMaterial_Inven::Free() { Safe_Release(m_pTransformCom); Safe_Release(m_pBufferCom); Safe_Release(m_pTextureCom); Safe_Release(m_pRendererCom); Safe_Release(m_pShaderCom); CUI::Free(); }
[ "rala2580@naver.com" ]
rala2580@naver.com
cc4a3a98777e69fe743fe0799df661bd00063e50
efdc794bc1152d9e702ea03e32142cf4ff1031cd
/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
08a40c51b3ba574eed67bca58836d09eba85ba37
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
taggun/node-pdfium
c3c7c85fd4a280993aa0ce99dcb2f41ce8d592dc
1990bc55e39f700434841e35078cecaa347b1e36
refs/heads/master
2020-12-02T12:44:31.341993
2020-02-26T20:52:34
2020-02-26T20:52:34
96,583,707
3
3
BSD-2-Clause
2020-02-26T20:48:59
2017-07-07T23:34:05
C++
UTF-8
C++
false
false
12,875
cpp
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com // Original code is licensed as follows: /* * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h" #include "third_party/bigint/BigIntegerLibrary.hh" #include "xfa/fxbarcode/BC_UtilCodingConvert.h" #include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h" #include "xfa/fxbarcode/utils.h" #define SUBMODE_ALPHA 0 #define SUBMODE_LOWER 1 #define SUBMODE_MIXED 2 int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0; int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1; int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2; int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3; int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900; int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901; int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902; int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913; int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924; uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58, 35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0}; uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = { 59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58, 10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0}; int32_t CBC_PDF417HighLevelEncoder::MIXED[128] = {0}; int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0}; void CBC_PDF417HighLevelEncoder::Initialize() { Inverse(); } void CBC_PDF417HighLevelEncoder::Finalize() {} CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( CFX_WideString wideMsg, Compaction compaction, int32_t& e) { CFX_ByteString bytes; CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes); CFX_WideString msg; int32_t len = bytes.GetLength(); for (int32_t i = 0; i < len; i++) { FX_WCHAR ch = (FX_WCHAR)(bytes.GetAt(i) & 0xff); if (ch == '?' && bytes.GetAt(i) != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; return CFX_WideString(); } msg += ch; } CFX_ArrayTemplate<uint8_t> byteArr; for (int32_t k = 0; k < bytes.GetLength(); k++) { byteArr.Add(bytes.GetAt(k)); } CFX_WideString sb; len = msg.GetLength(); int32_t p = 0; int32_t textSubMode = SUBMODE_ALPHA; if (compaction == TEXT) { encodeText(msg, p, len, sb, textSubMode); } else if (compaction == BYTES) { encodeBinary(&byteArr, p, byteArr.GetSize(), BYTE_COMPACTION, sb); } else if (compaction == NUMERIC) { sb += (FX_WCHAR)LATCH_TO_NUMERIC; encodeNumeric(msg, p, len, sb); } else { int32_t encodingMode = LATCH_TO_TEXT; while (p < len) { int32_t n = determineConsecutiveDigitCount(msg, p); if (n >= 13) { sb += (FX_WCHAR)LATCH_TO_NUMERIC; encodingMode = NUMERIC_COMPACTION; textSubMode = SUBMODE_ALPHA; encodeNumeric(msg, p, n, sb); p += n; } else { int32_t t = determineConsecutiveTextCount(msg, p); if (t >= 5 || n == len) { if (encodingMode != TEXT_COMPACTION) { sb += (FX_WCHAR)LATCH_TO_TEXT; encodingMode = TEXT_COMPACTION; textSubMode = SUBMODE_ALPHA; } textSubMode = encodeText(msg, p, t, sb, textSubMode); p += t; } else { int32_t b = determineConsecutiveBinaryCount(msg, &byteArr, p, e); if (e != BCExceptionNO) return L" "; if (b == 0) { b = 1; } if (b == 1 && encodingMode == TEXT_COMPACTION) { encodeBinary(&byteArr, p, 1, TEXT_COMPACTION, sb); } else { encodeBinary(&byteArr, p, b, encodingMode, sb); encodingMode = BYTE_COMPACTION; textSubMode = SUBMODE_ALPHA; } p += b; } } } } return sb; } void CBC_PDF417HighLevelEncoder::Inverse() { for (size_t l = 0; l < FX_ArraySize(MIXED); ++l) MIXED[l] = -1; for (uint8_t i = 0; i < FX_ArraySize(TEXT_MIXED_RAW); ++i) { uint8_t b = TEXT_MIXED_RAW[i]; if (b != 0) MIXED[b] = i; } for (size_t l = 0; l < FX_ArraySize(PUNCTUATION); ++l) PUNCTUATION[l] = -1; for (uint8_t i = 0; i < FX_ArraySize(TEXT_PUNCTUATION_RAW); ++i) { uint8_t b = TEXT_PUNCTUATION_RAW[i]; if (b != 0) PUNCTUATION[b] = i; } } int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString& sb, int32_t initialSubmode) { CFX_WideString tmp; int32_t submode = initialSubmode; int32_t idx = 0; while (true) { FX_WCHAR ch = msg.GetAt(startpos + idx); switch (submode) { case SUBMODE_ALPHA: if (isAlphaUpper(ch)) { if (ch == ' ') { tmp += (FX_WCHAR)26; } else { tmp += (FX_WCHAR)(ch - 65); } } else { if (isAlphaLower(ch)) { submode = SUBMODE_LOWER; tmp += (FX_WCHAR)27; continue; } else if (isMixed(ch)) { submode = SUBMODE_MIXED; tmp += (FX_WCHAR)28; continue; } else { tmp += (FX_WCHAR)29; tmp += PUNCTUATION[ch]; break; } } break; case SUBMODE_LOWER: if (isAlphaLower(ch)) { if (ch == ' ') { tmp += (FX_WCHAR)26; } else { tmp += (FX_WCHAR)(ch - 97); } } else { if (isAlphaUpper(ch)) { tmp += (FX_WCHAR)27; tmp += (FX_WCHAR)(ch - 65); break; } else if (isMixed(ch)) { submode = SUBMODE_MIXED; tmp += (FX_WCHAR)28; continue; } else { tmp += (FX_WCHAR)29; tmp += PUNCTUATION[ch]; break; } } break; case SUBMODE_MIXED: if (isMixed(ch)) { tmp += MIXED[ch]; } else { if (isAlphaUpper(ch)) { submode = SUBMODE_ALPHA; tmp += (FX_WCHAR)28; continue; } else if (isAlphaLower(ch)) { submode = SUBMODE_LOWER; tmp += (FX_WCHAR)27; continue; } else { if (startpos + idx + 1 < count) { FX_WCHAR next = msg.GetAt(startpos + idx + 1); if (isPunctuation(next)) { submode = SUBMODE_PUNCTUATION; tmp += (FX_WCHAR)25; continue; } } tmp += (FX_WCHAR)29; tmp += PUNCTUATION[ch]; } } break; default: if (isPunctuation(ch)) { tmp += PUNCTUATION[ch]; } else { submode = SUBMODE_ALPHA; tmp += (FX_WCHAR)29; continue; } } idx++; if (idx >= count) { break; } } FX_WCHAR h = 0; int32_t len = tmp.GetLength(); for (int32_t i = 0; i < len; i++) { bool odd = (i % 2) != 0; if (odd) { h = (FX_WCHAR)((h * 30) + tmp.GetAt(i)); sb += h; } else { h = tmp.GetAt(i); } } if ((len % 2) != 0) { sb += (FX_WCHAR)((h * 30) + 29); } return submode; } void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, CFX_WideString& sb) { if (count == 1 && startmode == TEXT_COMPACTION) { sb += (FX_WCHAR)SHIFT_TO_BYTE; } int32_t idx = startpos; int32_t i = 0; if (count >= 6) { sb += (FX_WCHAR)LATCH_TO_BYTE; FX_WCHAR chars[5]; while ((startpos + count - idx) >= 6) { int64_t t = 0; for (i = 0; i < 6; i++) { t <<= 8; t += bytes->GetAt(idx + i) & 0xff; } for (i = 0; i < 5; i++) { chars[i] = (FX_WCHAR)(t % 900); t /= 900; } for (i = 4; i >= 0; i--) { sb += (chars[i]); } idx += 6; } } if (idx < startpos + count) { sb += (FX_WCHAR)LATCH_TO_BYTE_PADDED; } for (i = idx; i < startpos + count; i++) { int32_t ch = bytes->GetAt(i) & 0xff; sb += (FX_WCHAR)ch; } } void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString& sb) { int32_t idx = 0; BigInteger num900 = 900; while (idx < count) { CFX_WideString tmp; int32_t len = 44 < count - idx ? 44 : count - idx; CFX_ByteString part = ((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode(); BigInteger bigint = stringToBigInteger(part.c_str()); do { int32_t c = (bigint % num900).toInt(); tmp += (FX_WCHAR)(c); bigint = bigint / num900; } while (!bigint.isZero()); for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) { sb += tmp.GetAt(i); } idx += len; } } bool CBC_PDF417HighLevelEncoder::isDigit(FX_WCHAR ch) { return ch >= '0' && ch <= '9'; } bool CBC_PDF417HighLevelEncoder::isAlphaUpper(FX_WCHAR ch) { return ch == ' ' || (ch >= 'A' && ch <= 'Z'); } bool CBC_PDF417HighLevelEncoder::isAlphaLower(FX_WCHAR ch) { return ch == ' ' || (ch >= 'a' && ch <= 'z'); } bool CBC_PDF417HighLevelEncoder::isMixed(FX_WCHAR ch) { return MIXED[ch] != -1; } bool CBC_PDF417HighLevelEncoder::isPunctuation(FX_WCHAR ch) { return PUNCTUATION[ch] != -1; } bool CBC_PDF417HighLevelEncoder::isText(FX_WCHAR ch) { return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126); } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( CFX_WideString msg, int32_t startpos) { int32_t count = 0; int32_t len = msg.GetLength(); int32_t idx = startpos; if (idx < len) { FX_WCHAR ch = msg.GetAt(idx); while (isDigit(ch) && idx < len) { count++; idx++; if (idx < len) { ch = msg.GetAt(idx); } } } return count; } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( CFX_WideString msg, int32_t startpos) { int32_t len = msg.GetLength(); int32_t idx = startpos; while (idx < len) { FX_WCHAR ch = msg.GetAt(idx); int32_t numericCount = 0; while (numericCount < 13 && isDigit(ch) && idx < len) { numericCount++; idx++; if (idx < len) { ch = msg.GetAt(idx); } } if (numericCount >= 13) { return idx - startpos - numericCount; } if (numericCount > 0) { continue; } ch = msg.GetAt(idx); if (!isText(ch)) { break; } idx++; } return idx - startpos; } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount( CFX_WideString msg, CFX_ArrayTemplate<uint8_t>* bytes, int32_t startpos, int32_t& e) { int32_t len = msg.GetLength(); int32_t idx = startpos; while (idx < len) { FX_WCHAR ch = msg.GetAt(idx); int32_t numericCount = 0; while (numericCount < 13 && isDigit(ch)) { numericCount++; int32_t i = idx + numericCount; if (i >= len) { break; } ch = msg.GetAt(i); } if (numericCount >= 13) { return idx - startpos; } int32_t textCount = 0; while (textCount < 5 && isText(ch)) { textCount++; int32_t i = idx + textCount; if (i >= len) { break; } ch = msg.GetAt(i); } if (textCount >= 5) { return idx - startpos; } ch = msg.GetAt(idx); if (bytes->GetAt(idx) == 63 && ch != '?') { e = BCExceptionNonEncodableCharacterDetected; return -1; } idx++; } return idx - startpos; }
[ "michael.arthur@ikegps.com" ]
michael.arthur@ikegps.com
8ce6f1b44b1d5f5764ca2b7fd7e077609e8e8f28
d85777873c9462bf0ca2e9e001808118517a4e71
/SegmentBracketWord.cpp
47f94c5301c2d6793ddaccf202e8723302ee1794
[]
no_license
hkmangla/cppProgramms
e8806e12d12aa948997dd02e5f2e747def42e661
9ebe9866ff7362092a3929d6f11a8d8fcb7c1ca5
refs/heads/master
2020-05-21T13:33:44.837358
2017-09-21T18:01:25
2017-09-21T18:01:25
69,689,126
1
0
null
null
null
null
UTF-8
C++
false
false
1,596
cpp
#include<iostream> using namespace std; //char arr[30002]; char tree[100001]; int lazy[100001]; int final; /** * Build and init tree */ void build_tree(int node,int last, int a, int b,char arr[]) { if(a > b) return; // Out of range if(a == b) { // Leaf node tree[node] = arr[a]; // Init value if(a==last) final = node; return; } build_tree(node*2,last, a, (a+b)/2,arr); // Init left child build_tree(node*2+1,last, 1+(a+b)/2, b,arr); // Init right child if(tree[node*2] == tree[node*2+1]) tree[node] = tree[node*2]; // Init root value if(tree[node*2] != tree[node*2+1]) { if(tree[node*2]=='('&&tree[node*2+1]==')') tree[node] = '0'; if(tree[node*2]==')'&&tree[node*2+1]=='(') tree[node] = '1'; if(tree[node*2]!='0'&&tree[node*2+1]=='0') tree[node] = tree[node*2]; if(tree[node*2+1]!='0'&&tree[node*2]=='0') tree[node] = tree[node*2+1]; } } void update(int node,int a,int b,int range) { if(range>b||range<a)return; int mid = (a+b)/2; if(a==b&&a==range) { if(tree[node]=='(') tree[node]=')'; if(tree[node]==')') tree[node]='('; } if(range<=mid) update(node*2,a,mid,range); if(range>mid) update(node*2,mid+1,b,range); } int main() { int t=10,f=1; while(t--) { int n;cin>>n; char a[30001]; cin>>a; build_tree(1,n-1,0,n-1,a); for(int i=1;i<17;i++) cout<<tree[i]<<" "; cout<<final<<endl; int m;cin>>m; while(m--) { int q;cin>>q; if(q>0) update(1,0,n-1,q); for(int i=1;i<17;i++) cout<<tree[i]<<" "; } } }
[ "hemantmangla78@gmail.com" ]
hemantmangla78@gmail.com
e52af348b5e5e309e753c794a3626f66ed6de5b5
c3c848ae6c90313fed11be129187234e487c5f96
/VC6PLATSDK/samples/Com/async/server/cunknown.h
f4a6b2b478c56dd671a61388ce7f96793413a36a
[]
no_license
timxx/VC6-Platform-SDK
247e117cfe77109cd1b1effcd68e8a428ebe40f0
9fd59ed5e8e25a1a72652b44cbefb433c62b1c0f
refs/heads/master
2023-07-04T06:48:32.683084
2021-08-10T12:52:47
2021-08-10T12:52:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,902
h
// ---------------------------------------------------------------------------- // // This file is part of the Microsoft COM+ Samples. // // Copyright (C) 1995-2000 Microsoft Corporation. All rights reserved. // // This source code is intended only as a supplement to Microsoft // Development Tools and/or on-line documentation. See these other // materials for detailed information regarding Microsoft code samples. // // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // ---------------------------------------------------------------------------- #if !defined(__CUnknown_h__) #define __CUnknown_h__ #include <objidl.h> /////////////////////////////////////////////////////////// // // Macro's for setting DCOM security structures // // #define SETAUTHINFO(ai, athnsvc, athzsvc, name, athnl, impl, ident, cap) \ { \ (ai).dwAuthnSvc=athnsvc; \ (ai).dwAuthzSvc=athzsvc; \ (ai).pwszServerPrincName=name; \ (ai).dwAuthnLevel=athnl; \ (ai).dwImpersonationLevel=impl; \ (ai).pAuthIdentityData=ident; \ (ai).dwCapabilities=cap; \ } #define SETDEFAUTHINFO(ai, athnl, impl) \ SETAUTHINFO(ai, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, athnl, impl, NULL, RPC_C_QOS_CAPABILITIES_DEFAULT) #define SETDEFSERVERINFO(psi, name) \ { \ (psi)->dwReserved1=0; \ (psi)->pwszName=name; \ (psi)->pAuthInfo=reinterpret_cast<COAUTHINFO*>((psi)+1); \ SETDEFAUTHINFO(*(psi)->pAuthInfo,RPC_C_AUTHN_LEVEL_CONNECT,RPC_C_IMP_LEVEL_IMPERSONATE); \ (psi)->dwReserved2=0; \ } #define SETAUTHIDENTITY(aid, usr, pw, d) \ { \ (aid).User=usr; \ (aid).UserLength=lstrlenW(usr); \ (aid).Domain=d; \ (aid).DomainLength=d==NULL?0:lstrlenW(d); \ (aid).Password=pw; \ (aid).PasswordLength=pw==NULL?0:lstrlenW(pw); \ (aid).Flags=SEC_WINNT_AUTH_IDENTITY_UNICODE; \ } /////////////////////////////////////////////////////////// // // Nondelegating IUnknown interface // - Nondelegating version of IUnknown // interface INondelegatingUnknown { virtual HRESULT __stdcall NondelegatingQueryInterface(const IID& iid, void** ppv) = 0; virtual ULONG __stdcall NondelegatingAddRef() = 0; virtual ULONG __stdcall NondelegatingRelease() = 0; }; /////////////////////////////////////////////////////////// // // Declaration of CUnknown // - Base class for implementing IUnknown // struct CFactoryData; class CUnknown : public INondelegatingUnknown { friend class CFactory; protected: // Nondelegating IUnknown implementation virtual HRESULT __stdcall NondelegatingQueryInterface(const IID&, void**); virtual ULONG __stdcall NondelegatingAddRef(); virtual ULONG __stdcall NondelegatingRelease(); // Constructor CUnknown(IUnknown* pUnknownOuter, LPCSTR className = "CUnknown"); // Destructor virtual ~CUnknown(); // Initialization (especially for aggregates) virtual HRESULT __stdcall Init(const CFactoryData *pData) = 0; virtual HRESULT Init() {return S_OK;} // Notification to derived classes that we are releasing virtual void __stdcall FinalRelease(); // Count of currently active components static DWORD ActiveComponents() { return s_cActiveComponents ;} // Helper function HRESULT _stdcall FinishQI(IUnknown* pI, REFIID iid, void** ppv); public: LPUNKNOWN GetOuterUnknown() const { return m_pUnknownOuter;} protected: virtual HRESULT __stdcall Quit(); private: // Reference count for this object long m_cRef; // Pointer to (external) outer IUnknown IUnknown* m_pUnknownOuter; // Count of all active instances static long s_cActiveComponents; LPCSTR m_lpstrClass; }; /////////////////////////////////////////////////////////// // // Delegating IUnknown // - Delegates to the nondelegating IUnknown, or to the // outer IUnknown if the component is aggregated. // #define DECLARE_IUNKNOWN \ virtual HRESULT __stdcall \ QueryInterface(const IID& iid, void** ppv) \ { \ return GetOuterUnknown()->QueryInterface(iid,ppv) ; \ } ; \ virtual ULONG __stdcall AddRef() \ { \ return GetOuterUnknown()->AddRef() ; \ } ; \ virtual ULONG __stdcall Release() \ { \ return GetOuterUnknown()->Release() ; \ } ; #endif
[ "radiowebmasters@gmail.com" ]
radiowebmasters@gmail.com
1340f79a4c60178d861f3af9f8279d1e80d38d5a
9f16950a070174c4ad6419b6aa48e0b3fd34a09e
/users/marcel/renderOne/imgui/colorGradingLutDesigner.cpp
1c52625f4ed86ddf6af55e7e3ff3320a4454880d
[]
no_license
marcel303/framework
594043fad6a261ce2f8e862f921aee1192712612
9459898c280223b853bf16d6e382a6f7c573e10e
refs/heads/master
2023-05-14T02:30:51.063401
2023-05-07T07:57:12
2023-05-07T10:16:34
112,006,739
53
1
null
2020-01-13T18:48:32
2017-11-25T13:45:56
C++
UTF-8
C++
false
false
14,159
cpp
#include "colorGradingLutDesigner.h" #include "imgui.h" #include "imgui_internal.h" #include "nfd.h" #include "framework.h" #include "gx_texture.h" #include "image.h" #include "Path.h" namespace ImGui { ColorGradingEditor::ColorGradingEditor() { applyIdentity(lookupTable); textureFilename[0] = 0; previewFilename[0] = 0; } void ColorGradingEditor::applyTransform() { Assert(transformParams.transformType != kTransformType_None); UndoItem undoItem; memcpy(undoItem.lookupTable, lookupTable, sizeof(LookupTable)); undoStack.push(undoItem); redoStack = std::stack<UndoItem>(); applyTransform( transformParams, lookupTable, lookupTable); transformParams.transformType = kTransformType_None; } void ColorGradingEditor::applyTransform( const TransformParams & transformParams, const LookupTable src, LookupTable dst) { LookupTable temp; switch (transformParams.transformType) { case kTransformType_None: memcpy(temp, src, sizeof(LookupTable)); break; case kTransformType_Identity: applyIdentity(temp); break; case kTransformType_ColorTemperature: applyColorTemperature(src, temp, transformParams.colorTemperature); break; case kTransformType_Colorize: applyColorize(src, temp, transformParams.colorizeHue, transformParams.colorizeSaturation, transformParams.colorizeLightness); break; case kTransformType_ColorGradient: applyColorGradient(src, temp, transformParams.colorGradient.taps, 2); break; case kTransformType_ContrastBrightness: applyContrastBrightness(src, temp, transformParams.contrast, transformParams.brightness); break; case kTransformType_Gamma: applyGamma(src, temp, transformParams.gamma); break; } applyBlend(src, temp, dst, transformParams.transformAmount); } void ColorGradingEditor::applyBlend( const LookupTable from, const LookupTable to, LookupTable dst, const float weight) { for (int z = 0; z < kLookupSize; ++z) for (int y = 0; y < kLookupSize; ++y) for (int x = 0; x < kLookupSize; ++x) for (int i = 0; i < 3; ++i) dst[z][y][x][i] = from[z][y][x][i] * (1.f - weight) + to[z][y][x][i] * weight; } void ColorGradingEditor::applyIdentity( LookupTable lookupTable) { float value[16]; for (int x = 0; x < kLookupSize; ++x) value[x] = x / (kLookupSize - 1.f); for (int z = 0; z < kLookupSize; ++z) { for (int y = 0; y < kLookupSize; ++y) { for (int x = 0; x < kLookupSize; ++x) { lookupTable[z][y][x][0] = value[x]; lookupTable[z][y][x][1] = value[y]; lookupTable[z][y][x][2] = value[z]; } } } } void ColorGradingEditor::colorTemperatureToRgb( const float in_temperatureInKelvins, float * rgb) { const float temperatureInKelvins = fminf(fmaxf(in_temperatureInKelvins, 1000.f), 40000.f) / 100.f; if (temperatureInKelvins <= 66.f) { rgb[0] = 1.f; rgb[1] = saturate(0.39008157876901960784f * logf(temperatureInKelvins) - 0.63184144378862745098f); } else { float t = temperatureInKelvins - 60.f; rgb[0] = saturate(1.29293618606274509804 * powf(t, -0.1332047592f)); rgb[1] = saturate(1.12989086089529411765 * powf(t, -0.0755148492f)); } if (temperatureInKelvins >= 66.f) rgb[2] = 1.f; else if(temperatureInKelvins <= 19.f) rgb[2] = 0.f; else rgb[2] = saturate(0.54320678911019607843f * logf(temperatureInKelvins - 10.f) - 1.19625408914f); } void ColorGradingEditor::applyColorTemperature( const LookupTable src, LookupTable dst, const float temperatureInKelvins) { Color c; colorTemperatureToRgb(temperatureInKelvins, &c.r); for (int z = 0; z < kLookupSize; ++z) { for (int y = 0; y < kLookupSize; ++y) { for (int x = 0; x < kLookupSize; ++x) { dst[z][y][x][0] = src[z][y][x][0] * c.r; dst[z][y][x][1] = src[z][y][x][1] * c.g; dst[z][y][x][2] = src[z][y][x][2] * c.b; } } } } void ColorGradingEditor::applyColorize( const LookupTable src, LookupTable dst, const float hue, const float saturation, const float lightness) { const Color c = Color::fromHSL(hue, saturation, lightness); for (int z = 0; z < kLookupSize; ++z) { for (int y = 0; y < kLookupSize; ++y) { for (int x = 0; x < kLookupSize; ++x) { dst[z][y][x][0] = src[z][y][x][0] * c.r; dst[z][y][x][1] = src[z][y][x][1] * c.g; dst[z][y][x][2] = src[z][y][x][2] * c.b; } } } } void ColorGradingEditor::applyColorGradient( const LookupTable src, LookupTable dst, const TransformParams::ColorGradient::Tap * taps, const int numTaps) { const float wr = 1.f / 3.f; const float wg = 1.f / 3.f; const float wb = 1.f / 3.f; for (int z = 0; z < kLookupSize; ++z) { for (int y = 0; y < kLookupSize; ++y) { for (int x = 0; x < kLookupSize; ++x) { const float luminance = wr * src[z][y][x][0] + wg * src[z][y][x][1] + wb * src[z][y][x][2]; int tapIndex = 0; while (tapIndex + 2 < numTaps && luminance > taps[tapIndex + 1].luminance) { tapIndex++; } auto lum1 = taps[tapIndex ].luminance; auto lum2 = taps[tapIndex + 1].luminance; const float a = (lum2 - luminance) / (lum2 - lum1); const float b = 1.f - a; for (int i = 0; i < 3; ++i) { dst[z][y][x][i] = a * taps[tapIndex ].rgb[i] + b * taps[tapIndex + 1].rgb[i]; } } } } } void ColorGradingEditor::applyContrastBrightness( const LookupTable src, LookupTable dst, const float contrast, const float brightness) { for (int z = 0; z < kLookupSize; ++z) { for (int y = 0; y < kLookupSize; ++y) { for (int x = 0; x < kLookupSize; ++x) { dst[z][y][x][0] = (src[z][y][x][0] - .5f) * contrast + .5f + brightness; dst[z][y][x][1] = (src[z][y][x][1] - .5f) * contrast + .5f + brightness; dst[z][y][x][2] = (src[z][y][x][2] - .5f) * contrast + .5f + brightness; } } } } void ColorGradingEditor::applyGamma( const LookupTable src, LookupTable dst, const float gamma) { for (int z = 0; z < kLookupSize; ++z) { for (int y = 0; y < kLookupSize; ++y) { for (int x = 0; x < kLookupSize; ++x) { dst[z][y][x][0] = powf(fmaxf(0.f, src[z][y][x][0]), gamma); dst[z][y][x][1] = powf(fmaxf(0.f, src[z][y][x][1]), gamma); dst[z][y][x][2] = powf(fmaxf(0.f, src[z][y][x][2]), gamma); } } } } void ColorGradingEditor::Edit() { ImGui::Text("File: %s", Path::GetFileName(textureFilename).c_str()); if (ImGui::Button("Load..")) { nfdchar_t * path = nullptr; auto result = NFD_OpenDialog(nullptr, nullptr, &path); if (result != NFD_CANCEL) { bool success = false; if (result == NFD_OKAY) { auto * image = loadImage(path); if (image != nullptr && image->sx == kLookupSize * kLookupSize && image->sy == kLookupSize) { for (int y = 0; y < kLookupSize; ++y) { auto * line = image->getLine(y); for (int z = 0; z < kLookupSize; ++z) { for (int x = 0; x < kLookupSize; ++x, ++line) { lookupTable[z][y][x][0] = line->r / 255.f; lookupTable[z][y][x][1] = line->g / 255.f; lookupTable[z][y][x][2] = line->b / 255.f; } } } strcpy(textureFilename, path); success = true; } delete image; image = nullptr; } if (success == false) { applyIdentity(lookupTable); textureFilename[0] = 0; ImGui::OpenPopup("LoadError_LoadImage"); } // reset editing transformParams = TransformParams(); undoStack = std::stack<UndoItem>(); redoStack = std::stack<UndoItem>(); } if (path != nullptr) { free(path); path = nullptr; } } if (ImGui::BeginPopupModal("LoadError_LoadImage", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("Failed to load image"); if (ImGui::Button("OK")) ImGui::CloseCurrentPopup(); ImGui::EndPopup(); } bool save = false; if (textureFilename[0] != 0) { ImGui::SameLine(); if (ImGui::Button("Save")) { save = true; } } ImGui::SameLine(); if (ImGui::Button("Save as..")) { nfdchar_t * path = nullptr; auto result = NFD_SaveDialog(nullptr, textureFilename, &path); if (result != NFD_CANCEL) { if (result == NFD_OKAY) { strcpy(textureFilename, path); save = true; } else { ImGui::OpenPopup("SaveError_Filename"); } } if (path != nullptr) { free(path); path = nullptr; } } if (save) { if (transformParams.transformType != kTransformType_None) { applyTransform(); } ImageData image; image.sx = kLookupSize * kLookupSize; image.sy = kLookupSize; image.imageData = new ImageData::Pixel[image.sx * image.sy]; for (int y = 0; y < image.sy; ++y) { ImageData::Pixel * line = image.getLine(y); const int ly = y; for (int x = 0; x < image.sx; ++x) { const int lx = x % kLookupSize; const int lz = x / kLookupSize; line[x].r = int(clamp(lookupTable[lz][ly][lx][0], 0.f, 1.f) * 255.f); line[x].g = int(clamp(lookupTable[lz][ly][lx][1], 0.f, 1.f) * 255.f); line[x].b = int(clamp(lookupTable[lz][ly][lx][2], 0.f, 1.f) * 255.f); line[x].a = 255; } } if (saveImage(&image, textureFilename) == false) { ImGui::OpenPopup("SaveError_SaveImage"); } } if (ImGui::BeginPopupModal("SaveError_Filename", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("Failed to select file for save"); if (ImGui::Button("OK")) ImGui::CloseCurrentPopup(); ImGui::EndPopup(); } if (ImGui::BeginPopupModal("SaveError_SaveImage", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { ImGui::Text("Failed to save image"); if (ImGui::Button("OK")) ImGui::CloseCurrentPopup(); ImGui::EndPopup(); } ImGui::PushItemFlag(ImGuiItemFlags_Disabled, undoStack.empty()); { if (ImGui::Button("Undo")) { UndoItem redoItem; memcpy(redoItem.lookupTable, lookupTable, sizeof(LookupTable)); redoStack.push(redoItem); auto & undoItem = undoStack.top(); memcpy(lookupTable, undoItem.lookupTable, sizeof(LookupTable)); undoStack.pop(); } } ImGui::PopItemFlag(); ImGui::SameLine(); ImGui::PushItemFlag(ImGuiItemFlags_Disabled, redoStack.empty()); { if (ImGui::Button("Redo")) { UndoItem undoItem; memcpy(undoItem.lookupTable, lookupTable, sizeof(LookupTable)); undoStack.push(undoItem); auto & redoItem = redoStack.top();; memcpy(lookupTable, redoItem.lookupTable, sizeof(LookupTable)); redoStack.pop(); } } ImGui::PopItemFlag(); const char * transform_items[] = { "(Select)", "Identity", "Color temperature", "Colorize", "Color gradient", "Contrast & Brightness", "Gamma" }; int transform_index = transformParams.transformType; if (ImGui::Combo("Transform", &transform_index, transform_items, sizeof(transform_items) / sizeof(transform_items[0]))) { transformParams = TransformParams(); transformParams.transformType = (TransformType)transform_index; } if (transformParams.transformType == kTransformType_Identity) { } if (transformParams.transformType == kTransformType_ColorTemperature) { ImGui::SliderFloat("Temperature (K)", &transformParams.colorTemperature, 0.f, 10000.f); } if (transformParams.transformType == kTransformType_Colorize) { ImGui::SliderFloat("Hue", &transformParams.colorizeHue, 0.f, 1.f); ImGui::SliderFloat("Saturation", &transformParams.colorizeSaturation, 0.f, 1.f); ImGui::SliderFloat("Lightness", &transformParams.colorizeLightness, 0.f, 1.f); } if (transformParams.transformType == kTransformType_ColorGradient) { ImGui::ColorEdit3("Color 1", transformParams.colorGradient.taps[0].rgb); ImGui::ColorEdit3("Color 2", transformParams.colorGradient.taps[1].rgb); } if (transformParams.transformType == kTransformType_ContrastBrightness) { ImGui::SliderFloat("Contrast", &transformParams.contrast, 0.f, 4.f); ImGui::SliderFloat("Brightness", &transformParams.brightness, -1.f, 1.f); } if (transformParams.transformType == kTransformType_Gamma) { ImGui::SliderFloat("Gamma", &transformParams.gamma, 0.f, 3.f); } if (transformParams.transformType != kTransformType_None) { ImGui::SliderFloat("Amount", &transformParams.transformAmount, 0.f, 1.f); if (Button("Apply")) { applyTransform(); } ImGui::SameLine(); if (Button("Cancel")) transformParams.transformType = kTransformType_None; } } void ColorGradingEditor::DrawPreview( const int sx, const int sy) { LookupTable previewLookupTable; applyTransform( transformParams, lookupTable, previewLookupTable); GxTexture3d currentTexture; currentTexture.allocate( kLookupSize, kLookupSize, kLookupSize, GX_RGB32_FLOAT); currentTexture.upload(lookupTable, 4, 0); GxTexture3d previewTexture; previewTexture.allocate( kLookupSize, kLookupSize, kLookupSize, GX_RGB32_FLOAT); previewTexture.upload(previewLookupTable, 4, 0); pushBlend(BLEND_OPAQUE); { setColor(colorWhite); gxSetTexture(getTexture(previewFilename), GX_SAMPLE_LINEAR, true); drawRect(0, 0, sx/2, sy/2); gxClearTexture(); Shader shader("renderOne/postprocess/color-grade"); setShader(shader); { shader.setTexture("colorTexture", 0, getTexture(previewFilename), true); shader.setTexture3d("lutTexture", 1, currentTexture.id, true, true); drawRect(0, sy/2, sx/2, sy); shader.setTexture3d("lutTexture", 1, previewTexture.id, true, true); drawRect(sx/2, sy/2, sx, sy); } clearShader(); } popBlend(); currentTexture.free(); previewTexture.free(); } }
[ "marcel303@gmail.com" ]
marcel303@gmail.com
ef4aa4a194460c1296672a02e414347716f7e3d0
f09828d9f3e7d08948e4d132d7077ce09d4807ab
/hexwindow.cpp
927a8a85cbac0acb41fbdc2872ef9d2030b339f5
[]
no_license
xobs/nandsee
f84957e5237be61c65114203f7ac2158c83cc4f2
f3509921fea693a615e940fd7a1fe85c75c42b2f
refs/heads/master
2021-01-10T01:18:27.668878
2013-06-04T06:19:50
2013-06-04T06:19:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
458
cpp
#include "hexwindow.h" #include "ui_hexwindow.h" HexWindow::HexWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::HexWindow) { ui->setupUi(this); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow())); } HexWindow::~HexWindow() { delete ui; } void HexWindow::setData(const QByteArray &data) { _data = data; ui->hexView->setData(_data); } void HexWindow::closeWindow() { close(); emit closeHexWindow(this); }
[ "smcross@gmail.com" ]
smcross@gmail.com
ad4dfe012c9ec38931c40cee9c2388c37820303b
523767a79d9329509860112f55eb28109613af93
/_micro-api/libraries/Modbus/Modbus.h
b7e501488743c00c688bfc0413d23ead15b4b216
[]
no_license
Matheus-Garbelini/TransformerMonitoringSystem
4408d6f0ff36aabfd814b7bf966de8aecabc08fb
bd7ddf0abbc0f457adb4218ef994919ba4a4f906
refs/heads/master
2020-04-03T00:16:42.496763
2018-11-23T01:34:09
2018-11-23T01:34:09
152,512,116
1
0
null
null
null
null
WINDOWS-1250
C++
false
false
2,702
h
/* Modbus.h - Header for Modbus Base Library Copyright (C) 2014 André Sarmento Barbosa */ #include "Arduino.h" #ifndef MODBUS_H #define MODBUS_H #define MAX_REGS 32 #define MAX_FRAME 128 //#define USE_HOLDING_REGISTERS_ONLY typedef unsigned int u_int; //Function Codes enum { MB_FC_READ_COILS = 0x01, // Read Coils (Output) Status 0xxxx MB_FC_READ_INPUT_STAT = 0x02, // Read Input Status (Discrete Inputs) 1xxxx MB_FC_READ_REGS = 0x03, // Read Holding Registers 4xxxx MB_FC_READ_INPUT_REGS = 0x04, // Read Input Registers 3xxxx MB_FC_WRITE_COIL = 0x05, // Write Single Coil (Output) 0xxxx MB_FC_WRITE_REG = 0x06, // Preset Single Register 4xxxx MB_FC_WRITE_COILS = 0x0F, // Write Multiple Coils (Outputs) 0xxxx MB_FC_WRITE_REGS = 0x10, // Write block of contiguous registers 4xxxx }; //Exception Codes enum { MB_EX_ILLEGAL_FUNCTION = 0x01, // Function Code not Supported MB_EX_ILLEGAL_ADDRESS = 0x02, // Output Address not exists MB_EX_ILLEGAL_VALUE = 0x03, // Output Value not in Range MB_EX_SLAVE_FAILURE = 0x04, // Slave Deive Fails to process request }; //Reply Types enum { MB_REPLY_OFF = 0x01, MB_REPLY_ECHO = 0x02, MB_REPLY_NORMAL = 0x03, }; typedef struct TRegister { word address; word value; struct TRegister* next; } TRegister; class ModbusSlave { private: TRegister *_regs_head; TRegister *_regs_last; void readRegisters(word startreg, word numregs); void writeSingleRegister(word reg, word value); void writeMultipleRegisters(byte* frame, word startreg, word numoutputs, byte bytecount); void exceptionResponse(byte fcode, byte excode); #ifndef USE_HOLDING_REGISTERS_ONLY void readCoils(word startreg, word numregs); void readInputStatus(word startreg, word numregs); void readInputRegisters(word startreg, word numregs); void writeSingleCoil(word reg, word status); void writeMultipleCoils(byte* frame, word startreg, word numoutputs, byte bytecount); #endif TRegister* searchRegister(word addr); void addReg(word address, word value = 0); bool Reg(word address, word value); word Reg(word address); protected: HardwareSerial *_port; byte *_frame; byte _len; byte _reply; void receivePDU(byte* frame); public: ModbusSlave(); void addHreg(word offset, word value = 0); bool Hreg(word offset, word value); word Hreg(word offset); #ifndef USE_HOLDING_REGISTERS_ONLY void addCoil(word offset, bool value = false); void addIsts(word offset, bool value = false); void addIreg(word offset, word value = 0); bool Coil(word offset, bool value); bool Ists(word offset, bool value); bool Ireg(word offset, word value); bool Coil(word offset); bool Ists(word offset); word Ireg(word offset); #endif }; #endif //MODBUS_H
[ "mgabelix@gmail.com" ]
mgabelix@gmail.com
341180cd40032b5e00ddcbdb32119d14964c5405
74377cb6c163a0cf5f76fbccded9d47f49ce83e8
/console/console.hpp
594f8702475086a3c52e24dbd4b916f343e9c5b5
[]
no_license
mauve/util
a083ed95c8466f562c6fa444de3ab0666d7e0fda
94f46bdbbdc29da8cc1b002d9571f9d58b10f318
refs/heads/master
2020-05-14T14:28:31.565374
2015-02-25T12:05:17
2015-02-25T12:05:17
5,748,002
0
0
null
null
null
null
UTF-8
C++
false
false
926
hpp
/* * Copyright (C) 2012, All rights reserved, Mikael Olenfalk <mikael@olenfalk.se> */ #ifndef UTIL_CONSOLE_CONSOLE_HPP_ #define UTIL_CONSOLE_CONSOLE_HPP_ #include <iosfwd> #include <vector> #include <boost/noncopyable.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <console/mode.hpp> namespace util { namespace console { class mode; class console : public boost::noncopyable { public: console (); virtual ~console (); // no unique_ptr in C++03 have to live with // shared_ptr for now void enter_mode (boost::shared_ptr<mode> m); virtual std::ostream& out (); virtual std::ostream& err (); virtual std::istream& in (); void quit (int exit_code); int run (); private: friend class mode; void leave_mode (mode& m); private: bool _quit; int _exit_code; std::vector<boost::shared_ptr<mode> > _modes; }; } // namespace console } // namespace util #endif /* UTIL_CONSOLE_CONSOLE_HPP_ */
[ "olenfalk@spotify.com" ]
olenfalk@spotify.com
7bd8aaa6949efa10bbafca6b1cf50c4733e48d45
ce348db4e164bab99136df8809f375e5ea61f715
/pyada/test/unittest/Addition_test.cpp
e4a6136b4cc62d203e00a391be925774acdbbede
[ "MIT" ]
permissive
tadeze/pyad
ecc883727d055fcc3d9a23ff2f3011ee97704cdb
ef3b4312989597d8d4a01194c0a03e2beca5bfb5
refs/heads/master
2022-03-30T18:28:26.014797
2020-01-23T20:27:33
2020-01-23T20:27:33
58,245,056
0
0
null
2019-10-25T21:42:42
2016-05-07T02:16:44
C++
UTF-8
C++
false
false
558
cpp
/* * Addition_test.cpp * * Created on: Apr 16, 2016 * Author: tadeze */ #include "gtest/gtest.h" //#include "../Addition.hpp" class AdditionTest : public ::testing::Test { protected: virtual void SetUp() { } virtual void TearDown() { // Code here will be called immediately after each test // (right before the destructor). } }; TEST(AdditionTest,twoValues){ const int x = 4; const int y = 5; //Addition addition; EXPECT_EQ(9,9); //addition.twoValues(x,y)); EXPECT_EQ(5,5);//addition.twoValues(2,3)); }
[ "tadesse.habte@gmail.com" ]
tadesse.habte@gmail.com
1f1a37cac74c3db33e81f63636d5e2309a6563fa
1e51eae49731a9b9da87869328c2612f7b6bcfc4
/OpenCV/opencv-2.4.13/build/modules/calib3d/opencv_calib3d_pch_dephelp.cxx
074907ca1ffa213b1b08e47065de097ddd4f074e
[ "BSD-3-Clause" ]
permissive
Kairat100/Python-Optical-Flow
343b95d9e5f2abb5621ee2d5e0655df3bd15811b
0f946db528905d0a4c9ac1a617573af96cc88db1
refs/heads/master
2021-01-01T05:04:56.843664
2016-06-06T04:23:22
2016-06-06T04:23:22
57,938,997
0
1
null
null
null
null
UTF-8
C++
false
false
174
cxx
#include "/home/shynggys/DenseTrajectories/Python-Optical-Flow/OpenCV/opencv-2.4.13/modules/calib3d/src/precomp.hpp" int testfunction(); int testfunction() { return 0; }
[ "sislam@nu.edu.kz" ]
sislam@nu.edu.kz
85181543a6da483a77981636171a7e7d1095a4d8
e28d2b90c7b0766cdac30bf9145d4a87750e8de7
/include/dg/llvm/ValueRelations/RelationsAnalyzer.h
96552f9683f22319018f9f7b650941c28ffade6e
[ "MIT" ]
permissive
wxzed0/dg
7e0441c3bab6c46de8e34c58bfe64c69d70966e8
0b1ada38d25d34898f5d1e19dbfe6e10006127e6
refs/heads/master
2023-06-19T08:03:09.938269
2021-07-14T09:10:59
2021-07-20T14:54:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
46,787
h
#ifndef DG_LLVM_VALUE_RELATION_RELATIONS_ANALYZER_HPP_ #define DG_LLVM_VALUE_RELATION_RELATIONS_ANALYZER_HPP_ #include <dg/util/SilenceLLVMWarnings.h> SILENCE_LLVM_WARNINGS_PUSH #include <llvm/IR/CFG.h> #include <llvm/IR/Constants.h> #include <llvm/IR/Instructions.h> #include <llvm/IR/IntrinsicInst.h> #include <llvm/IR/Module.h> #include <llvm/IR/Value.h> SILENCE_LLVM_WARNINGS_POP #include <algorithm> #include <string> #include "GraphElements.h" #include "StructureAnalyzer.h" #include "ValueRelations.h" #ifndef NDEBUG #include "getValName.h" #endif namespace dg { namespace vr { class RelationsAnalyzer { const std::set<std::string> safeFunctions = {"__VERIFIER_nondet_int", "__VERIFIER_nondet_char"}; const llvm::Module &module; // VRLocation corresponding to the state of the program BEFORE executing the // instruction const std::map<const llvm::Instruction *, VRLocation *> &locationMapping; const std::map<const llvm::BasicBlock *, std::unique_ptr<VRBBlock>> &blockMapping; // holds information about structural properties of analyzed module // like set of instructions executed in loop starging at given location // or possibly set of values defined at given location const StructureAnalyzer &structure; bool processOperation(VRLocation *source, VRLocation *target, VROp *op) { if (!target) return false; assert(source && target && op); ValueRelations newGraph = source->relations; if (op->isInstruction()) { const llvm::Instruction *inst = static_cast<VRInstruction *>(op)->getInstruction(); forgetInvalidated(newGraph, inst); processInstruction(newGraph, inst); } else if (op->isAssume()) { if (op->isAssumeBool()) processAssumeBool(newGraph, static_cast<VRAssumeBool *>(op)); else // isAssumeEqual processAssumeEqual(newGraph, static_cast<VRAssumeEqual *>(op)); } // else op is noop return andSwapIfChanged(target->relations, newGraph); } void forgetInvalidated(ValueRelations &graph, const llvm::Instruction *inst) const { for (const llvm::Value *invalid : instructionInvalidatesFromGraph(graph, inst)) graph.unsetAllLoadsByPtr(invalid); } void addAndUnwrapLoads( std::set<std::pair<const llvm::Value *, unsigned>> &writtenTo, const llvm::Value *val) const { unsigned depth = 0; writtenTo.emplace(val, 0); while (auto load = llvm::dyn_cast<llvm::LoadInst>(val)) { writtenTo.emplace(load->getPointerOperand(), ++depth); val = load->getPointerOperand(); } } std::set<std::pair<const llvm::Value *, unsigned>> instructionInvalidates(const llvm::Instruction *inst) const { if (!inst->mayWriteToMemory() && !inst->mayHaveSideEffects()) return std::set<std::pair<const llvm::Value *, unsigned>>(); if (auto intrinsic = llvm::dyn_cast<llvm::IntrinsicInst>(inst)) { if (isIgnorableIntrinsic(intrinsic->getIntrinsicID())) { return std::set<std::pair<const llvm::Value *, unsigned>>(); } } if (auto call = llvm::dyn_cast<llvm::CallInst>(inst)) { auto function = call->getCalledFunction(); if (function && safeFunctions.find(function->getName().str()) != safeFunctions.end()) return std::set<std::pair<const llvm::Value *, unsigned>>(); } std::set<std::pair<const llvm::Value *, unsigned>> unsetAll = { {nullptr, 0}}; auto store = llvm::dyn_cast<llvm::StoreInst>(inst); if (!store) // most probably CallInst // unable to presume anything about such instruction return unsetAll; // if store writes to a fix location, it cannot be easily said which // values it affects if (llvm::isa<llvm::Constant>(store->getPointerOperand())) return unsetAll; const llvm::Value *memoryPtr = store->getPointerOperand(); const llvm::Value *underlyingPtr = stripCastsAndGEPs(memoryPtr); std::set<std::pair<const llvm::Value *, unsigned>> writtenTo; // DANGER TODO unset everything in between too addAndUnwrapLoads(writtenTo, underlyingPtr); // unset underlying memory addAndUnwrapLoads(writtenTo, memoryPtr); // unset pointer itself const ValueRelations &graph = locationMapping.at(store)->relations; // every pointer with unknown origin is considered having an alias if (mayHaveAlias(graph, memoryPtr) || !hasKnownOrigin(graph, memoryPtr)) { // if invalidated memory may have an alias, unset all memory whose // origin is unknown since it may be the alias for (const auto &fromsValues : graph.getAllLoads()) { if (!hasKnownOrigin(graph, fromsValues.first[0])) { addAndUnwrapLoads(writtenTo, fromsValues.first[0]); } } } if (!hasKnownOrigin(graph, memoryPtr)) { // if memory does not have a known origin, unset all values which // may have an alias, since this memory may be the alias for (const auto &fromsValues : graph.getAllLoads()) { if (mayHaveAlias(graph, fromsValues.first[0])) addAndUnwrapLoads(writtenTo, fromsValues.first[0]); } } return writtenTo; } const llvm::Value *getInvalidatedPointer(const ValueRelations &graph, const llvm::Value *invalid, unsigned depth) const { while (depth && invalid) { const auto &values = graph.getValsByPtr(invalid); if (values.empty()) { invalid = nullptr; // invalidated pointer does not load anything // in current graph } else { invalid = values[0]; --depth; } } return graph.hasLoad(invalid) ? invalid : nullptr; } // returns set of values that have a load in given graph and are invalidated // by the instruction std::set<const llvm::Value *> instructionInvalidatesFromGraph(const ValueRelations &graph, const llvm::Instruction *inst) const { const auto &indirectlyInvalid = instructionInvalidates(inst); // go through all (indireclty) invalidated pointers and add those // that occur in current location std::set<const llvm::Value *> allInvalid; for (const auto &pair : indirectlyInvalid) { if (!pair.first) { // add all loads in graph for (auto &fromsValues : graph.getAllLoads()) allInvalid.emplace(fromsValues.first[0]); break; } auto directlyInvalid = getInvalidatedPointer(graph, pair.first, pair.second); if (directlyInvalid) allInvalid.emplace(directlyInvalid); } return allInvalid; } bool mayHaveAlias(const ValueRelations &graph, const llvm::Value *val) const { for (auto eqval : graph.getEqual(val)) if (mayHaveAlias(llvm::cast<llvm::User>(eqval))) return true; return false; } bool mayHaveAlias(const llvm::User *val) const { // if value is not pointer, we don't care whether there can be other // name for same value if (!val->getType()->isPointerTy()) return false; for (const llvm::User *user : val->users()) { // if value is stored, it can be accessed if (llvm::isa<llvm::StoreInst>(user)) { if (user->getOperand(0) == val) return true; } else if (llvm::isa<llvm::CastInst>(user)) { if (mayHaveAlias(user)) return true; } else if (auto gep = llvm::dyn_cast<llvm::GetElementPtrInst>(user)) { if (gep->getPointerOperand() == val) { if (gep->hasAllZeroIndices()) return true; // TODO really? remove llvm::Type *valType = val->getType(); llvm::Type *gepType = gep->getPointerOperandType(); if (gepType->isVectorTy() || valType->isVectorTy()) assert(0 && "i dont know what it is and when does it " "happen"); if (gepType->getPrimitiveSizeInBits() < valType->getPrimitiveSizeInBits()) return true; } } else if (auto intrinsic = llvm::dyn_cast<llvm::IntrinsicInst>(user)) { if (!isIgnorableIntrinsic(intrinsic->getIntrinsicID()) && intrinsic->mayWriteToMemory()) return true; } else if (auto inst = llvm::dyn_cast<llvm::Instruction>(user)) { if (inst->mayWriteToMemory()) return true; } } return false; } bool isIgnorableIntrinsic(llvm::Intrinsic::ID id) const { switch (id) { case llvm::Intrinsic::lifetime_start: case llvm::Intrinsic::lifetime_end: case llvm::Intrinsic::stacksave: case llvm::Intrinsic::stackrestore: case llvm::Intrinsic::dbg_declare: case llvm::Intrinsic::dbg_value: return true; default: return false; } } static const llvm::Value *stripCastsAndGEPs(const llvm::Value *memoryPtr) { memoryPtr = memoryPtr->stripPointerCasts(); while (auto gep = llvm::dyn_cast<llvm::GetElementPtrInst>(memoryPtr)) { memoryPtr = gep->getPointerOperand()->stripPointerCasts(); } return memoryPtr; } static bool hasKnownOrigin(const ValueRelations &graph, const llvm::Value *from) { for (auto memoryPtr : graph.getEqual(from)) { memoryPtr = stripCastsAndGEPs(memoryPtr); if (llvm::isa<llvm::AllocaInst>(memoryPtr)) return true; } return false; } void storeGen(ValueRelations &graph, const llvm::StoreInst *store) { graph.setLoad(store->getPointerOperand()->stripPointerCasts(), store->getValueOperand()); } void loadGen(ValueRelations &graph, const llvm::LoadInst *load) { graph.setLoad(load->getPointerOperand()->stripPointerCasts(), load); } void gepGen(ValueRelations &graph, const llvm::GetElementPtrInst *gep) { if (gep->hasAllZeroIndices()) graph.setEqual(gep, gep->getPointerOperand()); for (auto &fromsValues : graph.getAllLoads()) { for (const llvm::Value *from : fromsValues.first) { if (auto otherGep = llvm::dyn_cast<llvm::GetElementPtrInst>(from)) { if (operandsEqual(graph, gep, otherGep, true)) graph.setEqual(gep, otherGep); } } } // TODO something more? // indices method gives iterator over indices } void extGen(ValueRelations &graph, const llvm::CastInst *ext) { graph.setEqual(ext, ext->getOperand(0)); } void addGen(ValueRelations &graph, const llvm::BinaryOperator *add) { auto c1 = llvm::dyn_cast<llvm::ConstantInt>(add->getOperand(0)); auto c2 = llvm::dyn_cast<llvm::ConstantInt>(add->getOperand(1)); // TODO check wheter equal to constant solveEquality(graph, add); solveCommutativity(graph, add); if (solvesSameType(graph, c1, c2, add)) return; const llvm::Value *param = nullptr; if (c2) { c1 = c2; param = add->getOperand(0); } else param = add->getOperand(1); assert(c1 && add && param); // add = param + c1 if (c1->isZero()) return graph.setEqual(add, param); else if (c1->isNegative()) { // c1 < 0 ==> param + c1 < param graph.setLesser(add, param); // lesser < param ==> lesser <= param + (-1) if (c1->isMinusOne()) solvesDiffOne(graph, param, add, true); } else { // c1 > 0 => param < param + c1 graph.setLesser(param, add); // param < greater => param + 1 <= greater if (c1->isOne()) solvesDiffOne(graph, param, add, false); } const llvm::ConstantInt *constBound = graph.getLesserEqualBound(param); if (constBound) { const llvm::APInt &boundResult = constBound->getValue() + c1->getValue(); const llvm::Constant *llvmResult = llvm::ConstantInt::get(add->getType(), boundResult); if (graph.isLesser(constBound, param)) graph.setLesser(llvmResult, add); else if (graph.isEqual(constBound, param)) graph.setEqual(llvmResult, add); else graph.setLesserEqual(llvmResult, add); } } void subGen(ValueRelations &graph, const llvm::BinaryOperator *sub) { auto c1 = llvm::dyn_cast<llvm::ConstantInt>(sub->getOperand(0)); auto c2 = llvm::dyn_cast<llvm::ConstantInt>(sub->getOperand(1)); // TODO check wheter equal to constant solveEquality(graph, sub); if (solvesSameType(graph, c1, c2, sub)) return; if (c1) { // TODO collect something here? return; } const llvm::Value *param = sub->getOperand(0); assert(c2 && sub && param); // sub = param - c1 if (c2->isZero()) return graph.setEqual(sub, param); else if (c2->isNegative()) { // c1 < 0 ==> param < param - c1 graph.setLesser(param, sub); // param < greater ==> param - (-1) <= greater if (c2->isMinusOne()) solvesDiffOne(graph, param, sub, false); } else { // c1 > 0 => param - c1 < param graph.setLesser(sub, param); // lesser < param ==> lesser <= param - 1 if (c2->isOne()) solvesDiffOne(graph, param, sub, true); } const llvm::ConstantInt *constBound = graph.getLesserEqualBound(param); if (constBound) { const llvm::APInt &boundResult = constBound->getValue() - c2->getValue(); const llvm::Constant *llvmResult = llvm::ConstantInt::get(sub->getType(), boundResult); if (graph.isLesser(constBound, param)) graph.setLesser(llvmResult, sub); else if (graph.isEqual(constBound, param)) graph.setEqual(llvmResult, sub); else graph.setLesserEqual(llvmResult, sub); } } void mulGen(ValueRelations &graph, const llvm::BinaryOperator *mul) { auto c1 = llvm::dyn_cast<llvm::ConstantInt>(mul->getOperand(0)); auto c2 = llvm::dyn_cast<llvm::ConstantInt>(mul->getOperand(1)); // TODO check wheter equal to constant solveEquality(graph, mul); solveCommutativity(graph, mul); if (solvesSameType(graph, c1, c2, mul)) return; const llvm::Value *param = nullptr; if (c2) { c1 = c2; param = mul->getOperand(0); } else param = mul->getOperand(1); assert(c1 && mul && param); // mul = param + c1 if (c1->isZero()) return graph.setEqual(mul, c1); else if (c1->isOne()) return graph.setEqual(mul, param); // TODO collect something here? } bool solvesSameType(ValueRelations &graph, const llvm::ConstantInt *c1, const llvm::ConstantInt *c2, const llvm::BinaryOperator *op) { if (c1 && c2) { llvm::APInt result; switch (op->getOpcode()) { case llvm::Instruction::Add: result = c1->getValue() + c2->getValue(); break; case llvm::Instruction::Sub: result = c1->getValue() - c2->getValue(); break; case llvm::Instruction::Mul: result = c1->getValue() * c2->getValue(); break; default: assert(0 && "solvesSameType: shouldn't handle any other operation"); } graph.setEqual(op, llvm::ConstantInt::get(c1->getType(), result)); return true; } llvm::Type *i32 = llvm::Type::getInt32Ty(op->getContext()); const llvm::Constant *one = llvm::ConstantInt::getSigned(i32, 1); const llvm::Constant *minusOne = llvm::ConstantInt::getSigned(i32, -1); const llvm::Value *fst = op->getOperand(0); const llvm::Value *snd = op->getOperand(1); if (!c1 && !c2) { switch (op->getOpcode()) { case llvm::Instruction::Add: if (graph.isLesserEqual(one, fst)) graph.setLesser(snd, op); if (graph.isLesserEqual(one, snd)) graph.setLesser(fst, op); if (graph.isLesserEqual(fst, minusOne)) graph.setLesser(op, snd); if (graph.isLesserEqual(snd, minusOne)) graph.setLesser(op, fst); break; case llvm::Instruction::Sub: if (graph.isLesserEqual(one, snd)) graph.setLesser(op, fst); if (graph.isLesserEqual(snd, minusOne)) graph.setLesser(fst, op); break; default: break; } return true; } return false; } void solvesDiffOne(ValueRelations &graph, const llvm::Value *param, const llvm::BinaryOperator *op, bool getLesser) { std::vector<const llvm::Value *> sample = getLesser ? graph.getDirectlyLesser(param) : graph.getDirectlyGreater(param); for (const llvm::Value *value : sample) if (getLesser) graph.setLesserEqual(value, op); else graph.setLesserEqual(op, value); } bool operandsEqual( ValueRelations &graph, const llvm::Instruction *fst, const llvm::Instruction *snd, bool sameOrder) const { // false means checking in reverse order unsigned total = fst->getNumOperands(); if (total != snd->getNumOperands()) return false; for (unsigned i = 0; i < total; ++i) { unsigned otherI = sameOrder ? i : total - i - 1; if (!graph.isEqual(fst->getOperand(i), snd->getOperand(otherI))) return false; } return true; } void solveByOperands(ValueRelations &graph, const llvm::BinaryOperator *operation, bool sameOrder) { for (auto same : structure.getInstructionSetFor(operation->getOpcode())) { auto sameOperation = llvm::dyn_cast<const llvm::BinaryOperator>(same); if (operandsEqual(graph, operation, sameOperation, sameOrder)) graph.setEqual(operation, sameOperation); } } void solveEquality(ValueRelations &graph, const llvm::BinaryOperator *operation) { solveByOperands(graph, operation, true); } void solveCommutativity(ValueRelations &graph, const llvm::BinaryOperator *operation) { solveByOperands(graph, operation, false); } void remGen(ValueRelations &graph, const llvm::BinaryOperator *rem) { assert(rem); const llvm::Constant *zero = llvm::ConstantInt::getSigned(rem->getType(), 0); if (!graph.isLesserEqual(zero, rem->getOperand(0))) return; graph.setLesserEqual(zero, rem); graph.setLesser(rem, rem->getOperand(1)); } void castGen(ValueRelations &graph, const llvm::CastInst *cast) { if (cast->isLosslessCast() || cast->isNoopCast(module.getDataLayout())) graph.setEqual(cast, cast->getOperand(0)); } void processInstruction(ValueRelations &graph, const llvm::Instruction *inst) { switch (inst->getOpcode()) { case llvm::Instruction::Store: return storeGen(graph, llvm::cast<llvm::StoreInst>(inst)); case llvm::Instruction::Load: return loadGen(graph, llvm::cast<llvm::LoadInst>(inst)); case llvm::Instruction::GetElementPtr: return gepGen(graph, llvm::cast<llvm::GetElementPtrInst>(inst)); case llvm::Instruction::ZExt: case llvm::Instruction::SExt: // (S)ZExt should not change value return extGen(graph, llvm::cast<llvm::CastInst>(inst)); case llvm::Instruction::Add: return addGen(graph, llvm::cast<llvm::BinaryOperator>(inst)); case llvm::Instruction::Sub: return subGen(graph, llvm::cast<llvm::BinaryOperator>(inst)); case llvm::Instruction::Mul: return mulGen(graph, llvm::cast<llvm::BinaryOperator>(inst)); case llvm::Instruction::SRem: case llvm::Instruction::URem: return remGen(graph, llvm::cast<llvm::BinaryOperator>(inst)); default: if (auto *cast = llvm::dyn_cast<llvm::CastInst>(inst)) { return castGen(graph, cast); } } } void processAssumeBool(ValueRelations &newGraph, VRAssumeBool *assume) const { if (llvm::isa<llvm::ICmpInst>(assume->getValue())) processICMP(newGraph, assume); if (llvm::isa<llvm::PHINode>(assume->getValue())) processPhi(newGraph, assume); } void processICMP(ValueRelations &newGraph, VRAssumeBool *assume) const { const llvm::ICmpInst *icmp = llvm::cast<llvm::ICmpInst>(assume->getValue()); bool assumption = assume->getAssumption(); const llvm::Value *op1 = icmp->getOperand(0); const llvm::Value *op2 = icmp->getOperand(1); llvm::ICmpInst::Predicate pred = assumption ? icmp->getSignedPredicate() : icmp->getInversePredicate(); switch (pred) { case llvm::ICmpInst::Predicate::ICMP_EQ: if (!newGraph.hasConflictingRelation(op1, op2, Relation::EQ)) { newGraph.setEqual(op1, op2); return; } break; case llvm::ICmpInst::Predicate::ICMP_NE: if (!newGraph.hasConflictingRelation(op1, op2, Relation::NE)) { newGraph.setNonEqual(op1, op2); return; } break; case llvm::ICmpInst::Predicate::ICMP_ULE: case llvm::ICmpInst::Predicate::ICMP_SLE: if (!newGraph.hasConflictingRelation(op1, op2, Relation::LE)) { newGraph.setLesserEqual(op1, op2); return; } break; case llvm::ICmpInst::Predicate::ICMP_ULT: case llvm::ICmpInst::Predicate::ICMP_SLT: if (!newGraph.hasConflictingRelation(op1, op2, Relation::LT)) { newGraph.setLesser(op1, op2); return; } break; case llvm::ICmpInst::Predicate::ICMP_UGE: case llvm::ICmpInst::Predicate::ICMP_SGE: if (!newGraph.hasConflictingRelation(op1, op2, Relation::GE)) { newGraph.setLesserEqual(op2, op1); return; } break; case llvm::ICmpInst::Predicate::ICMP_UGT: case llvm::ICmpInst::Predicate::ICMP_SGT: if (!newGraph.hasConflictingRelation(op1, op2, Relation::GT)) { newGraph.setLesser(op2, op1); return; } break; default: #ifndef NDEBUG llvm::errs() << "Unhandled predicate in" << *icmp << "\n"; #endif abort(); } // reachable only if conflicting relation found newGraph.unsetComparativeRelations(op1); newGraph.unsetComparativeRelations(op2); } void processPhi(ValueRelations &newGraph, VRAssumeBool *assume) const { const llvm::PHINode *phi = llvm::cast<llvm::PHINode>(assume->getValue()); bool assumption = assume->getAssumption(); const llvm::BasicBlock *assumedPred = nullptr; for (unsigned i = 0; i < phi->getNumIncomingValues(); ++i) { const llvm::Value *result = phi->getIncomingValue(i); auto constResult = llvm::dyn_cast<llvm::ConstantInt>(result); if (!constResult || (constResult && ((constResult->isOne() && assumption) || (constResult->isZero() && !assumption)))) { if (!assumedPred) assumedPred = phi->getIncomingBlock(i); else return; // we found other viable incoming block } } assert(assumedPred); VRBBlock *vrbblock = blockMapping.at(assumedPred).get(); VRLocation *source = vrbblock->last(); bool result = newGraph.merge(source->relations); assert(result); } void processAssumeEqual(ValueRelations &newGraph, VRAssumeEqual *assume) const { const llvm::Value *val1 = assume->getValue(); const llvm::Value *val2 = assume->getAssumption(); if (!newGraph.hasConflictingRelation(val1, val2, Relation::EQ)) newGraph.setEqual(val1, val2); } bool relatesInAll(const std::vector<VRLocation *> &locations, const llvm::Value *fst, const llvm::Value *snd, bool (ValueRelations::*relates)(const llvm::Value *, const llvm::Value *) const) const { // which is function pointer to isEqual, isLesser, or isLesserEqual for (const VRLocation *vrloc : locations) { if (!(vrloc->relations.*relates)(fst, snd)) return false; } return true; } bool relatesByLoadInAll(const std::vector<VRLocation *> &locations, const llvm::Value *related, const llvm::Value *from, bool (ValueRelations::*relates)(const llvm::Value *, const llvm::Value *) const, bool flip) const { for (const VRLocation *vrloc : locations) { const std::vector<const llvm::Value *> &loaded = vrloc->relations.getValsByPtr(from); if (loaded.empty() || (!flip && !(vrloc->relations.*relates)(related, loaded[0])) || (flip && !(vrloc->relations.*relates)(loaded[0], related))) return false; } return true; } bool mergeRelations(VRLocation *location) { return mergeRelations(location->getPredLocations(), location); } bool mergeRelations(const std::vector<VRLocation *> &preds, VRLocation *location) { if (preds.empty()) return false; ValueRelations newGraph = location->relations; ValueRelations &oldGraph = preds[0]->relations; std::vector<const llvm::Value *> values = oldGraph.getAllValues(); // merge from all predecessors for (auto valueIt = values.begin(); valueIt != values.end(); ++valueIt) { const llvm::Value *val = *valueIt; for (auto it = oldGraph.begin_lesserEqual(val); it != oldGraph.end_lesserEqual(val); ++it) { const llvm::Value *related; Relation relation; std::tie(related, relation) = *it; if (related == val) continue; switch (relation) { case Relation::EQ: if (relatesInAll(preds, related, val, &ValueRelations::isEqual)) { newGraph.setEqual(related, val); auto found = std::find(values.begin(), values.end(), related); if (found != values.end()) { values.erase(found); valueIt = std::find(values.begin(), values.end(), val); } } break; case Relation::LT: if (relatesInAll(preds, related, val, &ValueRelations::isLesser)) newGraph.setLesser(related, val); break; case Relation::LE: if (relatesInAll(preds, related, val, &ValueRelations::isLesserEqual)) newGraph.setLesserEqual(related, val); break; default: assert(0 && "going down, not up"); } } } // merge relations from tree predecessor only VRLocation *treePred = getTreePred(location); const ValueRelations &treePredGraph = treePred->relations; if (location->isJustLoopJoin()) { bool result = newGraph.merge(treePredGraph, true); assert(result); } return andSwapIfChanged(location->relations, newGraph); } bool loadsInAll(const std::vector<VRLocation *> &locations, const llvm::Value *from, const llvm::Value *value) const { for (const VRLocation *vrloc : locations) { if (!vrloc->relations.isLoad(from, value)) // DANGER does it suffice that from equals to value's ptr // (before instruction on edge)? return false; } return true; } bool loadsSomethingInAll(const std::vector<VRLocation *> &locations, const llvm::Value *from) const { for (const VRLocation *vrloc : locations) { if (!vrloc->relations.hasLoad(from)) return false; } return true; } bool mergeLoads(VRLocation *location) { return mergeLoads(location->getPredLocations(), location); } bool mergeLoads(const std::vector<VRLocation *> &preds, VRLocation *location) { if (preds.empty()) return false; ValueRelations newGraph = location->relations; const auto &loadBucketPairs = preds[0]->relations.getAllLoads(); // merge loads from all predecessors for (const auto &fromsValues : loadBucketPairs) { for (const llvm::Value *from : fromsValues.first) { for (const llvm::Value *val : fromsValues.second) { if (loadsInAll(preds, from, val)) newGraph.setLoad(from, val); } } } // merge loads from outloop predecessor, that are not invalidated // inside the loop if (location->isJustLoopJoin()) { const ValueRelations &oldGraph = getTreePred(location)->relations; std::set<const llvm::Value *> allInvalid; for (const auto *inst : structure.getInloopValues(location)) { auto invalid = instructionInvalidatesFromGraph(oldGraph, inst); allInvalid.insert(invalid.begin(), invalid.end()); } for (const auto &fromsValues : oldGraph.getAllLoads()) { if (!anyInvalidated(allInvalid, fromsValues.first)) { for (auto from : fromsValues.first) { for (auto val : fromsValues.second) { newGraph.setLoad(from, val); } } } } } return andSwapIfChanged(location->relations, newGraph); } VRLocation *getTreePred(VRLocation *location) const { VRLocation *treePred = nullptr; for (VREdge *predEdge : location->predecessors) { if (predEdge->type == EdgeType::TREE) treePred = predEdge->source; } assert(treePred); return treePred; } bool hasConflictLoad(const std::vector<VRLocation *> &preds, const llvm::Value *from, const llvm::Value *val) { for (const VRLocation *pred : preds) { for (const auto &fromsValues : pred->relations.getAllLoads()) { auto findFrom = std::find(fromsValues.first.begin(), fromsValues.first.end(), from); auto findVal = std::find(fromsValues.second.begin(), fromsValues.second.end(), val); if (findFrom != fromsValues.first.end() && findVal == fromsValues.second.end()) return true; } } return false; } bool anyInvalidated(const std::set<const llvm::Value *> &allInvalid, const std::vector<const llvm::Value *> &froms) { for (auto from : froms) { if (allInvalid.find(from) != allInvalid.end()) return true; } return false; } bool mergeRelationsByLoads(VRLocation *location) { return mergeRelationsByLoads(location->getPredLocations(), location); } bool mergeRelationsByLoads(const std::vector<VRLocation *> &preds, VRLocation *location) { ValueRelations newGraph = location->relations; std::vector<const llvm::Value *> froms; for (auto fromsValues : preds[0]->relations.getAllLoads()) { for (auto from : fromsValues.first) { if (isGoodFromForPlaceholder(preds, from, fromsValues.second)) froms.emplace_back(from); } } // infer some invariants in loop if (preds.size() == 2 && location->isJustLoopJoin() && preds[0]->relations.holdsAnyRelations() && preds[1]->relations.holdsAnyRelations()) inferChangeInLoop(newGraph, froms, location); inferFromChangeLocations(newGraph, location); return andSwapIfChanged(location->relations, newGraph); } void inferChangeInLoop(ValueRelations &newGraph, const std::vector<const llvm::Value *> &froms, VRLocation *location) { for (const llvm::Value *from : froms) { const auto &predEdges = location->predecessors; VRLocation *outloopPred = predEdges[0]->type == EdgeType::BACK ? predEdges[1]->source : predEdges[0]->source; VRLocation *inloopPred = predEdges[0]->type == EdgeType::BACK ? predEdges[0]->source : predEdges[1]->source; std::vector<const llvm::Value *> valsInloop = inloopPred->relations.getValsByPtr(from); if (valsInloop.empty()) continue; const llvm::Value *valInloop = valsInloop[0]; std::vector<const llvm::Value *> allRelated = inloopPred->relations.getAllRelated(valInloop); // get some value, that is both related to the value loaded from // from at the end of the loop and at the same time is loaded // from from in given loop const llvm::Value *firstLoadInLoop = nullptr; for (const auto *val : structure.getInloopValues(location)) { const ValueRelations &relations = locationMapping.at(val)->relations; auto invalidated = instructionInvalidatesFromGraph(relations, val); if (invalidated.find(from) != invalidated.end()) break; if (std::find(allRelated.begin(), allRelated.end(), val) != allRelated.end()) { if (auto load = llvm::dyn_cast<llvm::LoadInst>(val)) { if (load->getPointerOperand() == from) { firstLoadInLoop = load; break; } } } } // set all preserved relations if (firstLoadInLoop) { // get all equal vals from load from outloopPred std::vector<const llvm::Value *> valsOutloop = outloopPred->relations.getValsByPtr(from); if (valsOutloop.empty()) continue; unsigned placeholder = newGraph.newPlaceholderBucket(); if (inloopPred->relations.isLesser(firstLoadInLoop, valInloop)) newGraph.setLesserEqual(valsOutloop[0], placeholder); if (inloopPred->relations.isLesser(valInloop, firstLoadInLoop)) newGraph.setLesserEqual(placeholder, valsOutloop[0]); if (newGraph.hasComparativeRelations(placeholder)) { newGraph.setLoad(from, placeholder); for (const llvm::Value *val : valsOutloop) { newGraph.setEqual(valsOutloop[0], val); } } else { newGraph.erasePlaceholderBucket(placeholder); } } } } void inferFromChangeLocations(ValueRelations &newGraph, VRLocation *location) { if (location->isJustLoopJoin()) { VRLocation *treePred = getTreePred(location); for (auto fromsValues : treePred->relations.getAllLoads()) { for (const llvm::Value *from : fromsValues.first) { std::vector<VRLocation *> locationsAfterInvalidating = { treePred}; // get all locations which influence value loaded from from for (const llvm::Instruction *invalidating : structure.getInloopValues(location)) { const ValueRelations &relations = locationMapping.at(invalidating)->relations; auto invalidated = instructionInvalidatesFromGraph( relations, invalidating); if (invalidated.find(from) != invalidated.end()) { locationsAfterInvalidating.emplace_back( locationMapping.at(invalidating) ->getSuccLocations()[0]); } } if (!isGoodFromForPlaceholder(locationsAfterInvalidating, from, fromsValues.second)) continue; intersectByLoad(locationsAfterInvalidating, from, newGraph); } } } } bool isGoodFromForPlaceholder(const std::vector<VRLocation *> &preds, const llvm::Value *from, const std::vector<const llvm::Value *> values) { if (!loadsSomethingInAll(preds, from)) return false; for (auto value : values) { if (loadsInAll(preds, from, value)) return false; } return true; } void intersectByLoad(const std::vector<VRLocation *> &preds, const llvm::Value *from, ValueRelations &newGraph) { auto &loads = preds[0]->relations.getValsByPtr(from); if (loads.empty()) return; const llvm::ConstantInt *bound = nullptr; for (VRLocation *pred : preds) { const ValueRelations &predGraph = pred->relations; auto &loads = predGraph.getValsByPtr(from); if (loads.empty()) return; const llvm::ConstantInt *value = predGraph.getLesserEqualBound(loads[0]); if (!value) { bound = nullptr; break; } if (!bound || value->getValue().slt(bound->getValue())) bound = value; } unsigned placeholder = newGraph.newPlaceholderBucket(); if (bound) newGraph.setLesserEqual(bound, placeholder); const llvm::Value *loaded = preds[0]->relations.getValsByPtr(from)[0]; for (auto it = preds[0]->relations.begin_all(loaded); it != preds[0]->relations.end_all(loaded); ++it) { const llvm::Value *related; Relation relation; std::tie(related, relation) = *it; if (related == loaded) continue; switch (relation) { case Relation::EQ: if (relatesByLoadInAll(preds, related, from, &ValueRelations::isEqual, false)) newGraph.setEqual(related, placeholder); else if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesserEqual, false)) newGraph.setLesserEqual(related, placeholder); else if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesserEqual, true)) newGraph.setLesserEqual(placeholder, related); break; case Relation::LT: if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesser, false)) newGraph.setLesser(related, placeholder); else if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesserEqual, false)) newGraph.setLesserEqual(related, placeholder); break; case Relation::LE: if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesserEqual, false)) newGraph.setLesserEqual(related, placeholder); break; case Relation::GT: if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesser, true)) newGraph.setLesser(placeholder, related); else if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesserEqual, true)) newGraph.setLesserEqual(placeholder, related); break; case Relation::GE: if (relatesByLoadInAll(preds, related, from, &ValueRelations::isLesserEqual, true)) newGraph.setLesserEqual(placeholder, related); break; default: assert(0 && "other relations do not participate"); } } if (newGraph.hasComparativeRelations(placeholder)) newGraph.setLoad(from, placeholder); else newGraph.erasePlaceholderBucket(placeholder); } bool andSwapIfChanged(ValueRelations &oldGraph, ValueRelations &newGraph) { if (oldGraph.hasAllRelationsFrom(newGraph) && newGraph.hasAllRelationsFrom(oldGraph)) return false; swap(oldGraph, newGraph); return true; } bool analysisPass() { bool changed = false; for (auto &pair : blockMapping) { auto &vrblockPtr = pair.second; for (auto &locationPtr : vrblockPtr->locations) { if (locationPtr->predecessors.size() > 1) { changed = mergeRelations(locationPtr.get()) | mergeLoads(locationPtr.get()) | mergeRelationsByLoads(locationPtr.get()); } else if (locationPtr->predecessors.size() == 1) { VREdge *edge = locationPtr->predecessors[0]; changed |= processOperation(edge->source, edge->target, edge->op.get()); } // else no predecessors => nothing to be passed } } return changed; } public: RelationsAnalyzer( const llvm::Module &m, std::map<const llvm::Instruction *, VRLocation *> &locs, std::map<const llvm::BasicBlock *, std::unique_ptr<VRBBlock>> &blcs, const StructureAnalyzer &sa) : module(m), locationMapping(locs), blockMapping(blcs), structure(sa) {} void analyze(unsigned maxPass) { bool changed = true; unsigned passNum = 0; while (changed && ++passNum <= maxPass) changed = analysisPass(); } }; } // namespace vr } // namespace dg #endif // DG_LLVM_VALUE_RELATION_RELATIONS_ANALYZER_HPP_
[ "mchqwerty@gmail.com" ]
mchqwerty@gmail.com
88a262be5decf5e7fdd1058070ddb26f555f8777
693f6694c179ea26c34f4cfd366bcf875edd5511
/lksh/lksh2016ch/day7/molecule.cpp
7f4ec4008c1f69965389a682cac70a829832586b
[]
no_license
romanasa/olymp_codes
db4a2a6af72c5cc1f2e6340f485e5d96d8f0b218
52dc950496ab28c4003bf8c96cbcdb0350f0646a
refs/heads/master
2020-05-07T18:54:47.966848
2019-05-22T19:41:38
2019-05-22T19:41:38
180,765,711
0
0
null
null
null
null
UTF-8
C++
false
false
122
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, L, R; scanf("%d %d %d", &n, &L, &R); return 0; }
[ "romanfml31@gmail.com" ]
romanfml31@gmail.com
39482cdcc8ea20de11aa628444642d563e74b250
8dc84558f0058d90dfc4955e905dab1b22d12c08
/third_party/blink/renderer/modules/indexeddb/idb_request_queue_item.cc
89cb7b04ab86d4115b61c4f476ec09b1db47c6c9
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
C++
false
false
8,348
cc
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/modules/indexeddb/idb_request_queue_item.h" #include <memory> #include <utility> #include "base/memory/scoped_refptr.h" #include "third_party/blink/public/platform/modules/indexeddb/web_idb_cursor.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/modules/indexeddb/idb_key.h" #include "third_party/blink/renderer/modules/indexeddb/idb_request.h" #include "third_party/blink/renderer/modules/indexeddb/idb_request_loader.h" #include "third_party/blink/renderer/modules/indexeddb/idb_value.h" namespace blink { IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, DOMException* error, base::OnceClosure on_result_load_complete) : request_(request), error_(error), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kError), ready_(true) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, int64_t value, base::OnceClosure on_result_load_complete) : request_(request), on_result_load_complete_(std::move(on_result_load_complete)), int64_value_(value), response_type_(kNumber), ready_(true) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, base::OnceClosure on_result_load_complete) : request_(request), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kVoid), ready_(true) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, std::unique_ptr<IDBKey> key, base::OnceClosure on_result_load_complete) : request_(request), key_(std::move(key)), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kKey), ready_(true) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, std::unique_ptr<IDBValue> value, bool attach_loader, base::OnceClosure on_result_load_complete) : request_(request), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kValue), ready_(!attach_loader) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; values_.push_back(std::move(value)); if (attach_loader) loader_ = std::make_unique<IDBRequestLoader>(this, values_); } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, Vector<std::unique_ptr<IDBValue>> values, bool attach_loader, base::OnceClosure on_result_load_complete) : request_(request), values_(std::move(values)), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kValueArray), ready_(!attach_loader) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; if (attach_loader) loader_ = std::make_unique<IDBRequestLoader>(this, values_); } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, std::unique_ptr<IDBKey> key, std::unique_ptr<IDBKey> primary_key, std::unique_ptr<IDBValue> value, bool attach_loader, base::OnceClosure on_result_load_complete) : request_(request), key_(std::move(key)), primary_key_(std::move(primary_key)), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kKeyPrimaryKeyValue), ready_(!attach_loader) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; values_.push_back(std::move(value)); if (attach_loader) loader_ = std::make_unique<IDBRequestLoader>(this, values_); } IDBRequestQueueItem::IDBRequestQueueItem( IDBRequest* request, std::unique_ptr<WebIDBCursor> cursor, std::unique_ptr<IDBKey> key, std::unique_ptr<IDBKey> primary_key, std::unique_ptr<IDBValue> value, bool attach_loader, base::OnceClosure on_result_load_complete) : request_(request), key_(std::move(key)), primary_key_(std::move(primary_key)), cursor_(std::move(cursor)), on_result_load_complete_(std::move(on_result_load_complete)), response_type_(kCursorKeyPrimaryKeyValue), ready_(!attach_loader) { DCHECK(on_result_load_complete_); DCHECK_EQ(request->queue_item_, nullptr); request_->queue_item_ = this; values_.push_back(std::move(value)); if (attach_loader) loader_ = std::make_unique<IDBRequestLoader>(this, values_); } IDBRequestQueueItem::~IDBRequestQueueItem() { #if DCHECK_IS_ON() DCHECK(ready_); DCHECK(callback_fired_); #endif // DCHECK_IS_ON() } void IDBRequestQueueItem::OnResultLoadComplete() { DCHECK(!ready_); ready_ = true; DCHECK(on_result_load_complete_); std::move(on_result_load_complete_).Run(); } void IDBRequestQueueItem::OnResultLoadComplete(DOMException* error) { DCHECK(!ready_); DCHECK(response_type_ != kError); response_type_ = kError; error_ = error; // This is not necessary, but releases non-trivial amounts of memory early. values_.clear(); OnResultLoadComplete(); } void IDBRequestQueueItem::StartLoading() { if (request_->request_aborted_) { // The backing store can get the result back to the request after it's been // aborted due to a transaction abort. In this case, we can't rely on // IDBRequest::Abort() to call CancelLoading(). // Setting loader_ to null here makes sure we don't call Cancel() on a // IDBRequestLoader that hasn't been Start()ed. The current implementation // behaves well even if Cancel() is called without Start() being called, but // this reset makes the IDBRequestLoader lifecycle easier to reason about. loader_.reset(); CancelLoading(); return; } if (loader_) { DCHECK(!ready_); loader_->Start(); } } void IDBRequestQueueItem::CancelLoading() { if (ready_) return; if (loader_) { loader_->Cancel(); loader_.reset(); // IDBRequestLoader::Cancel() should not call any of the EnqueueResponse // variants. DCHECK(!ready_); } // Mark this item as ready so the transaction's result queue can be drained. response_type_ = kCanceled; values_.clear(); OnResultLoadComplete(); } void IDBRequestQueueItem::EnqueueResponse() { DCHECK(ready_); #if DCHECK_IS_ON() DCHECK(!callback_fired_); callback_fired_ = true; #endif // DCHECK_IS_ON() DCHECK_EQ(request_->queue_item_, this); request_->queue_item_ = nullptr; switch (response_type_) { case kCanceled: DCHECK_EQ(values_.size(), 0U); break; case kCursorKeyPrimaryKeyValue: DCHECK_EQ(values_.size(), 1U); request_->EnqueueResponse(std::move(cursor_), std::move(key_), std::move(primary_key_), std::move(values_.front())); break; case kError: DCHECK(error_); request_->EnqueueResponse(error_); break; case kKeyPrimaryKeyValue: DCHECK_EQ(values_.size(), 1U); request_->EnqueueResponse(std::move(key_), std::move(primary_key_), std::move(values_.front())); break; case kKey: DCHECK_EQ(values_.size(), 0U); request_->EnqueueResponse(std::move(key_)); break; case kNumber: DCHECK_EQ(values_.size(), 0U); request_->EnqueueResponse(int64_value_); break; case kValue: DCHECK_EQ(values_.size(), 1U); request_->EnqueueResponse(std::move(values_.front())); break; case kValueArray: request_->EnqueueResponse(std::move(values_)); break; case kVoid: DCHECK_EQ(values_.size(), 0U); request_->EnqueueResponse(); break; } } } // namespace blink
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
4aaaabad7deca47f844f3b700403f4ed55e62cbe
05042a6ec2764594be984be45f01edae5218c549
/tests/cpp14/can_require_concept_not_applicable_static.cpp
64c475cd8607bb86c0c7ae64ee5d5a17a96cf650
[ "BSL-1.0" ]
permissive
jaredhoberock/propria
9a84fdd763e43f7fc8216376938367f905ba8dba
7c46c8d2fcd0b16ad3de26835023e53d5c2c3750
refs/heads/master
2020-05-03T04:48:20.955755
2019-03-22T21:43:57
2019-03-22T21:50:09
178,432,109
0
0
null
2019-03-29T15:35:19
2019-03-29T15:35:18
null
UTF-8
C++
false
false
821
cpp
// // cpp14/can_require_concept_not_applicable_static.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include "propria/require_concept.hpp" #include <cassert> template <int> struct prop { static constexpr bool is_requirable_concept = true; template <typename> static constexpr bool static_query_v = true; static constexpr bool value() { return true; } }; template <int> struct object { }; int main() { static_assert(!propria::can_require_concept_v<object<1>, prop<2>>, ""); static_assert(!propria::can_require_concept_v<const object<1>, prop<2>>, ""); }
[ "chris@kohlhoff.com" ]
chris@kohlhoff.com
b466c7a9f59b6858f709e0014f3a396a68a22d66
f131f99c2410c2c84bfa8cd3ae1bc035048ebe48
/axe3d.mod/m3d.mod/max3d/resource.cpp
5b956a009eaaf0f1c1e42f732ba712d980709af7
[]
no_license
nitrologic/mod
b2a81e44db5ef85a573187c27b634eb393c1ca0c
f4f1e3c5e6af0890dc9b81eea17513e9a2f29916
refs/heads/master
2021-05-15T01:39:21.181554
2018-03-16T21:16:56
2018-03-16T21:16:56
38,656,465
2
2
null
null
null
null
UTF-8
C++
false
false
1,955
cpp
/* Max3D Copyright (c) 2008, Mark Sibly All rights reserved. Redistribution and use in source and binary forms, with or without conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Max3D's copyright owner nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "std.h" #include "app.h" #include "resource.h" vector<CResource*> CResource::_flush; CResource::~CResource(){ Assert( !_refs ); } void CResource::FlushResources(){ vector<CResource*> out; for( vector<CResource*>::iterator it=_flush.begin();it!=_flush.end();++it ){ CResource *resource=*it; if( resource->Refs()>0 ){ out.push_back( resource ); }else{ cout<<"Deleting resource!"<<endl; delete resource; } } out.swap( _flush ); }
[ "nitrologic@548b755b-aa20-0410-b24a-7f7e2b255a79" ]
nitrologic@548b755b-aa20-0410-b24a-7f7e2b255a79
1fb9b6d61ed1009a653bc27efc1df0add8e52b5c
952e9f52ae2ceea9cfea81767797f8c07e0255d5
/opengl_GIS/tvec3.h
2ec04181bfcdfa1608b42f2ee99e9300e70bc054
[]
no_license
tianyahechy/opengl_gisStudy
cec429fa2578d881733638f0c7d4fce68076b70b
26fc7df730cc75e508ac9b645cb3ea6b521efa7c
refs/heads/master
2021-07-20T20:52:41.447783
2020-04-29T22:30:06
2020-04-29T22:30:06
154,655,310
4
2
null
null
null
null
GB18030
C++
false
false
3,846
h
#pragma once #include "lifeiMathUtil.h" namespace CELL { template <typename T> struct tvec3 { typedef T value_type; T x; T y; T z; size_t length() const { return 3; } T& operator[] (size_t i) { assert(i < this->length()); return (&x)[i]; } T const& operator[] (size_t i) const { assert(i < this->length()); return (&x)[i]; } inline tvec3() { x = T(0); y = T(0); z = T(0); } inline tvec3(T s) { x = s; y = s; z = s; } template<typename A, typename B, typename C> tvec3(A a, B b, C c) { x = T(a); y = T(b); z = T(c); } template<typename U> tvec3<T>& operator += (tvec3<U> const& v) { this->x += T(v.x); this->y += T(v.y); this->z += T(v.z); return *this; } template<typename U> tvec3<T>& operator -= (tvec3<U> const& v) { this->x -= T(v.x); this->y -= T(v.y); this->z -= T(v.z); return *this; } template<typename U> tvec3<T>& operator *= (U const& s) { this->x *= T(s); this->y *= T(s); this->z *= T(s); return *this; } }; template <typename T> tvec3<T> operator + (tvec3<T> const & v1, tvec3<T> const& v2) { return tvec3<T>( v1.x + T(v2.x), v1.y + T(v2.y), v1.z + T(v2.z)); } template <typename T> tvec3<T> operator - (tvec3<T> const & v1, tvec3<T> const& v2) { return tvec3<T>( v1.x - T(v2.x), v1.y - T(v2.y), v1.z - T(v2.z)); } template <typename T> tvec3<T> operator * (tvec3<T> const & v1, T const& s) { return tvec3<T>( v1.x * T(s), v1.y * T(s), v1.z * T(s)); } template <typename T> tvec3<T> operator * ( T const& s, tvec3<T> const & v1) { return tvec3<T>( T(s) * v1.x, T(s) *v1.y, T(s) *v1.z ); } template<typename T> typename tvec3<T>::value_type length(tvec3<T> const& v) { typename tvec3<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; return sqrt(sqr); } template <typename T> typename tvec3<T>::value_type dot(tvec3<T> const& x, tvec3<T> const& y) { return x.x * y.x + x.y * y.y + x.z * y.z; } template<typename T> tvec3<T> cross(tvec3<T> const& x, tvec3<T> const& y) { return tvec3<T>( x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y ); } template <typename T> tvec3<T> normalize(tvec3<T> const & x) { typename tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; return x * inversesqrt(sqr); } //射线与三角形相交 template <typename T> bool intersectTriangle( const tvec3<T>& origin, const tvec3<T>& dir, const tvec3<T>& v0, const tvec3<T>& v1, const tvec3<T>& v2, T * t, T * u, T * v ) { tvec3<T> edge1 = v1 - v0; tvec3<T> edge2 = v2 - v0; tvec3<T> pvec = cross(dir, edge2); T det = dot(edge1, pvec); tvec3<T> tvec; if (det > 0) { tvec = origin - v0; } else { tvec = v0 - origin; det = -det; } if (det < 0.00000001) { return false; } *u = dot(tvec, pvec); if (*u < 0.0f || *u > det) { return false; } tvec3<T> qvec = cross(dir, edge1); *v = dot(dir, pvec); if (*v < T(0.0f) || *u + *v> det) { return false; } *t = dot(edge2, qvec); T fInvDet = T(1.0) / det; *t *= fInvDet; *u *= fInvDet; *v *= fInvDet; return true; } typedef tvec3<unsigned char> uchar3; typedef tvec3<byte> byte3; typedef tvec3<unsigned short> ushort3; typedef tvec3<unsigned int> uint3; typedef tvec3<int> int3; typedef tvec3<unsigned> uint3; typedef tvec3<float> float3; typedef tvec3<double> double3; typedef tvec3<real> real3; typedef tvec3<unsigned short> half3; }
[ "tianyahechu2004@163.com" ]
tianyahechu2004@163.com
280375bc45f267a43b07876e83f07e70c9631037
1f81ca5af199914280b1e23302984f4248bd4cf9
/Function.h
9f6e71af7d40e3e68a9cd8b0d9386d41baada548
[]
no_license
manni901/DSI_4
f60bd044f2b1fb18104d1a2f651953250c060f03
4b046bbc37304794cf45b349930af9e9a0dd6db5
refs/heads/master
2020-03-09T11:13:50.021191
2018-05-03T17:16:11
2018-05-03T17:16:11
128,756,341
0
0
null
null
null
null
UTF-8
C++
false
false
1,142
h
#ifndef FUNCTION_H #define FUNCTION_H #include "Record.h" #include "ParseTree.h" #define MAX_DEPTH 100 enum ArithOp {PushInt, PushDouble, ToDouble, ToDouble2Down, IntUnaryMinus, IntMinus, IntPlus, IntDivide, IntMultiply, DblUnaryMinus, DblMinus, DblPlus, DblDivide, DblMultiply}; struct Arithmatic { ArithOp myOp; int recInput; void *litInput; }; class Function { private: Arithmatic *opList; int numOps; int returnsInt; public: Function (); // this grows the specified function from a parse tree and converts // it into an accumulator-based computation over the attributes in // a record with the given schema; the record "literal" is produced // by the GrowFromParseTree method void GrowFromParseTree (struct FuncOperator *parseTree, Schema &mySchema); // helper function Type RecursivelyBuild (struct FuncOperator *parseTree, Schema &mySchema); // prints out the function to the screen void Print (); // applies the function to the given record and returns the result Type Apply (Record &toMe, int &intResult, double &doubleResult); Type GetType() { return returnsInt == 1 ? Int : Double; } }; #endif
[ "jeeves901@Prashants-MacBook-Pro.local" ]
jeeves901@Prashants-MacBook-Pro.local
57dfc908d7948aecf8185c19f11cbed8295dd96d
8ff5d6f435da374cae475f0e6771fef8ac18321b
/VGP330/14_FinalProject/WinMain.cpp
4155032a9eec578252841f66386086ed13e565a6
[ "MIT" ]
permissive
CyroPCJr/OmegaEngine
18f982ad351ad18f4a7124091a9b3f5276160a92
8399ef8786ad487d9c20d43f5e12e4972a8c413a
refs/heads/main
2023-08-16T19:55:14.881116
2023-08-08T22:31:31
2023-08-08T22:31:31
350,535,694
5
1
MIT
2023-08-08T22:31:32
2021-03-23T00:56:54
C++
UTF-8
C++
false
false
212
cpp
#include "GameState.h" int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { Omega::MainApp().AddState<GameState>("GameState"); Omega::MainApp().Run({"VGP330 - Final Project", 1280,720}); return 0; }
[ "cpcmetal@hotmail.com" ]
cpcmetal@hotmail.com
fbf5b2c1fa47f21a3cae57399a0fcb5692643aa7
11dac444fa1aca03eb30a1895dfaa6d2bcd7987f
/arduino/sketch/sketch.ino
23f2bf9d50e09dc9b0ccbb9cd6ab78f4a790fa79
[ "CC0-1.0" ]
permissive
Rombaldoni/Studio-del-moto-uniformemente-accelerato-con-arduino
fb27ad9dc51a9f6521cbec4d3b04de0c8ede7671
4171efe1e4d8798e96f2c0782b0d9d13acc0c89d
refs/heads/master
2020-12-03T03:50:49.422094
2017-06-30T10:13:38
2017-06-30T10:13:38
95,781,744
0
0
null
null
null
null
UTF-8
C++
false
false
3,761
ino
// Librerie da usare #include <LiquidCrystal.h> #include <_Timer.h> #include "IRremote.h" const int ledCampionamento = 13;//posizione led "campionamento" const int ledReady = 10;// posizione led "ready" int receiver = 9; //posizione del sensore a infrarossi //parte del sensore ad ultrasuioni const int triggerPort = 7;// posizione del emettitore di ultrasuoni const int echoPort = 8; //posizione del ricevitore ad ultrasuoni //inizializzazione tempo campioni const long tempoCampioni=100; int sled = 0, inizializzato=0; // zona di memorizzazione dello stato del led (1 = acceso; 0 = spento) long origineTemporale=0, campioneTempo=0, duration=0, distanza=0; //istanza classe display LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //istanza classe timer _Timer Attesa; IRrecv irrecv(receiver); // istanza classe IRecv decode_results results; // create instance of decode_results void setup() { pinMode(ledCampionamento,OUTPUT);//configurazione led pinMode(ledReady,OUTPUT); pinMode(triggerPort, OUTPUT );// configurazione sensore ad ultrasuoni pinMode(echoPort, INPUT ); //inizializzazione seriale Serial.begin(115200); Serial.println("Sensore ultrasuoni: "); //inizializzazione display lcd.begin(16, 2); //colonne, righe //accensione led "Ready" digitalWrite (ledReady, HIGH); irrecv.enableIRIn(); // Start the receiver pinMode (13, OUTPUT); } void loop() { delay(300); if (irrecv.decode(&results));// parte che controlla se il telecomando è in funzione { switch(results.value) { case 0xFF629D: // vol+ digitalWrite(ledCampionamento,HIGH); sled = 1; break; case 0xFFA857: // vol- digitalWrite (ledCampionamento, LOW); sled = 0; break; } irrecv.resume(); // pronto a ricevere un'altro comando } if (sled==1) { if (inizializzato==0) { //inizializzazione display lcd.setCursor(0, 0); lcd.print("Distanza :"); lcd.setCursor(0, 1); lcd.print("(cm)"); //header file campioni Serial.println("File di campioni Spazio-Tempo"); Serial.println("Distanza [cm] Tempo [millis]"); //inizializzazione origine temporale origineTemporale=millis(); inizializzato=1; } //gestione campione distanza if (Attesa.LeggiAttivo()==0) { //avvia il timer per il prossimo ciclo Attesa.Start(tempoCampioni); //campionamento tempo campioneTempo=millis()-origineTemporale; //campionamento distanza //porta bassa l'uscita del trigger digitalWrite( triggerPort, LOW ); //invia un impulso di 10microsec su trigger digitalWrite( triggerPort, HIGH ); delayMicroseconds( 10 ); digitalWrite( triggerPort, LOW ); duration = pulseIn( echoPort, HIGH ); distanza = 0.034 * duration / 2; //gestione display if(distanza > 99) { lcd.setCursor(13, 0); lcd.print(distanza); } else { if(distanza > 9) { lcd.setCursor(13, 0); lcd.print(" "); lcd.setCursor(14, 0); lcd.print(distanza); } else { lcd.setCursor(13, 0); lcd.print(" "); lcd.setCursor(15, 0); lcd.print(distanza); } } //gestione porta seriale if( duration <= 38000 ) { Serial.println(distanza); } else { Serial.println(0); //Serial.println("Distanza 0 Tempo 0"); } } } else { if (inizializzato==1) { lcd.clear(); inizializzato=0; } } }
[ "djromba@gmail.com" ]
djromba@gmail.com