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
e3452c7a4a39d70eaf3d756783e67cb081c2286a
cb393fe99ef421b9ea87f1a91d8fff7a74e2ddaa
/C言語プログラミング/probex4-3.cpp
2a6cfb3a4198f36b52a4a1394508e5ca3b38c018
[]
no_license
yutatanaka/C_Programing
d1e8f8f5a88f53f7bc01375eb8f8c5a41faed6f7
df8e2249ca512a76f0fd843f72b9c771da7e3a33
refs/heads/master
2021-01-20T19:19:35.239946
2017-02-02T15:09:23
2017-02-02T15:09:23
63,483,652
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
615
cpp
/* コメントで示された部分1と2を、適切な処理に変えてプログラムを完成させなさい */ #include <stdio.h> #include <stdlib.h> int main() { /* 数値配列代入用ポインタ変数 */ int *array = NULL; int i; /* 1 長さ10の配列の生成(mallocを使用) */ array = (int *)malloc(sizeof(int *) *10); for (i = 0; i < 10; i++) { /* 値の代入 */ array[i] = i; } /* 値の表示 */ for (i = 0; i < 10; i++) { printf("%d ", array[i]); } printf("\n"); /* 2 生成したメモリの解放(free()を使用) */ free(array); getchar(); return 0; }
[ "koryotennis99@gmail.com" ]
koryotennis99@gmail.com
e8b29068441a833d5ffdff46695116bd6c079797
8304f9f7e99335f8531850a2eec466b4910c2883
/ext_gcd.cpp
dfd98f652b5409a355ba56649719c0df5476ba88
[]
no_license
duoxida/algo_templates
5386dd9aa60089592a1ef5558e255729b26d40ac
958d91dc2976044e80ed6b22c5dbd3a24775761f
refs/heads/master
2021-01-18T21:25:22.806210
2013-06-05T02:53:37
2013-06-05T02:53:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,232
cpp
#include <algorithm> #include <iostream> using namespace std; typedef long long LL; LL ext_gcd(LL a, LL b, LL &x, LL &y) { if(b == 0) { x = 1; y = 0; return a; } int ret = ext_gcd(b, a%b, y, x); y -= x*(a / b); return ret; } int get(int x) { if(x < 4) return x; if(x % 2 == 0) return get(x / 2) + 1; if(x % 4 == 1) return get(x / 2) + 2; if(x % 8 == 3) return get(x / 4) + 4; return get(x+1) + 1; } int main () { LL a, b, x, y; int T; for(cin>>T; T--; ) { LL a, b, c; cin >> c >> b >> a; LL d = ext_gcd(a, b, x, y); if(c % d) { cout << -1 << endl; continue; } c /= d; a /= d; b /= d; LL xx = x % b; if(xx <= 0) xx += b; LL yy = y - (xx-x)/b*a; xx = xx * c; yy = -yy * c; while(get(xx) > yy) { yy += a; xx += b; } cout << yy << endl; } return 0; }
[ "duoxida@gmail.com" ]
duoxida@gmail.com
e214a250b1ae7bbdbc31f80f342b0aa063a7b83b
d39e9889f571b2acd6985ee2130464532137f591
/Game.h
e9084fced6803db3bbb971b7f9ec91e1e5be867a
[]
no_license
mauro7x/taller_tp2
27c9931152a8b7d1b226aaaad63881e6a635f7a1
dbf8689ada771da1ee8c458fb5d76b7607fa88f0
refs/heads/master
2022-07-16T14:36:17.269496
2020-05-17T23:59:44
2020-05-17T23:59:44
261,635,594
0
0
null
null
null
null
UTF-8
C++
false
false
4,813
h
#ifndef __GAME_H__ #define __GAME_H__ //----------------------------------------------------------------------------- #include <string> #include <vector> #include "Thread.h" #include "WorkersConfig.h" #include "MapParser.h" #include "ResourceQueue.h" #include "Inventory.h" #include "Counter.h" #include "Recipes.h" #include "Resources.h" //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- class Game { private: // config files WorkersConfig workers_quantities; MapParser map; // game static stuff InventoryProtected inventory; CounterProtected points; ResourceQueue farmers_source, lumberjacks_source, miners_source; Recipe cooks_recipe, carpenters_recipe, blacksmiths_recipe; // threads std::vector<Thread*> gatherers, producers; int total_gatherers; int total_producers; /** * Descripcion: spawnea a los trabajadores, llamando a los métodos * spawnGatherers y spawnProducers con los parámetros correctos. * Parametros: - * Retorno: - */ void _spawnWorkers(); /** * Descripcion: crea las instancias de Recolectores en el heap, y los * agrega al vector de recolectores. * Parametros: cantidad de recolectores a instanciar, referencia a la * cola de recursos que deberá pasarse al recolector. * Retorno: - */ void _spawnGatherers(const int &n, ResourceQueue& source); /** * Descripcion: crea las instancias de Productores en el heap, y los * agrega al vector de productores. * Parametros: cantidad de productores a instanciar, puntos que gana el * productor por producir, referencia a receta constante. * Retorno: - */ void _spawnProducers(const int &n, int profitForProducing, const Recipe& recipe); /** * Descripcion: pone a correr a los threads. * Parametros: vector de threads pasado por referencia. * Retorno: - */ void _startThreads(std::vector<Thread*>& threads); /** * Descripcion: espera la finalización de los threads. * Parametros: vector de threads por referencia. * Retorno: - */ void _joinThreads(std::vector<Thread*>& threads); /** * Descripcion: libera la memoria dinámica reservada para los threads. * Parametros: vector de threads por referencia. * Retorno: - */ void _freeThreads(std::vector<Thread*>& threads); /** * Descripcion: organiza la distribución de los recursos generados por * el MapParser. * Parametros: - * Retorno: - */ void _distributeResources(); /** * Descripcion: cierra las colas de recursos. * Parametros: - * Retorno: - */ void _closeResourceQueues(); /** * Descripcion: organiza la correcta finalización de los threads, * cuando el programa falla (y se levanta una excepción). * Parametros: - * Retorno: - */ void _forceFinish(); /** * Descripcion: imprime los resultados finales. * Parametros: - * Retorno: - */ void _printResults(); public: /** * Descripcion: constructor. Establece los valores de total_gatherers, * total_producers, y reserva el espacio para los mismos en sus * respectivos vectores. Inicia las recetas de los productores. * Parametros: rutas al archivo de configuración de los workers, * y del mapa. */ Game(std::string workers_path, std::string map_path); /** * Deshabilitamos el constructor por copia y su operador. * Deshabilitamos el constructor por movimiento y su operador (los * mutex son inamovibles). */ Game(const Game&) = delete; Game& operator=(const Game&) = delete; Game(Game&& other) = delete; Game& operator=(Game&& other) = delete; /** * Descripcion: Método que organiza la ejecución. Si se quiere * hacer en un hilo, se puede heredar de thread para que * overridee el método run de Thread.. * Parametros: - * Retorno: - */ void run(); /** * Descripcion: destructor. */ ~Game(); }; //----------------------------------------------------------------------------- #endif // __GAME_H__
[ "mparafati@fi.uba.ar" ]
mparafati@fi.uba.ar
97a3074e3d41eea1b71662d12c52763690678825
4fa4e77c11bb6d1bc2819bda7080850665fd54c6
/综合提高2.cpp
111d0d453ab5de5a688c54bf0ca417ec51036064
[]
no_license
steamqaqwq/Ccode
c1c3c9e27856843588a2889ae7e72939fa6a7af9
af2f6abc550384ace1af2cc5bef91fb0a9f3d913
refs/heads/main
2023-03-30T04:06:37.700673
2021-04-05T16:25:11
2021-04-05T16:25:11
353,055,999
0
0
null
null
null
null
UTF-8
C++
false
false
1,593
cpp
#include <stdio.h> #include <string.h> // 1.加密算法 // int main() // { // char str[102]; // // 字符一定要 '' 而非 "" // gets(str); // for (int i = 0; i < strlen(str); i++) // { // if (str[i] >= 'a' && str[i] <= 'z') // { // str[i] += 3; // if (str[i] > 'z') // str[i] -= 26; // } // else if (str[i] >= 'A' && str[i] <= 'Z') // { // str[i] += 3; // if (str[i] > 'Z') // str[i] -= 26; // } // else // { // continue; // } // } // // printf("%s\n", str); // puts(str); // return 0; // } // 2.最长连续因子 int main() { int n; scanf("%d", &n); int maxC = 0; int curC = 0; int arr[n] = {0}; int index = 0; for (int i = 2; i <= n / 2; i++) { // 可整除 因子 if (n % i == 0) { // 以max 和cur比较 看是否录入数据 if (maxC != 0 && maxC >= curC) { index = 0; } else { printf("%d\n", arr[index]); arr[index++] = i; } curC++; } else { if (curC > maxC) { maxC = curC; } curC = 0; } } for (int i = 0; i < n; i++) { if (arr[i] == 0) { continue; } else { printf("%d ", i); } } return 0; }
[ "1293410417@qq.com" ]
1293410417@qq.com
045f9c233350476582c38c1b75949750e8bd3ebf
4c8020f06386ee7b62c87cc797e795ca4a769d63
/src/YVector.cpp
2dbfb8044b0057e7df094c4adcfd9186ccdc58a1
[ "MIT" ]
permissive
sergiosvieira/yda
06cec8cba9aaf28c5d8cfba0a294260bcfb9eb74
8861ced66abe884bc31aeccf7ac2c79e99e121b8
refs/heads/master
2021-03-12T20:26:32.871074
2015-06-27T02:20:05
2015-06-27T02:20:05
30,476,461
0
0
null
null
null
null
UTF-8
C++
false
false
2,217
cpp
/**************************************************************************** Copyright (c) 2015 Sérgio Vieira - sergiosvieira@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "YVector.h" /** C++ **/ #include <cmath> YVector YVector::operator+(const YVector& a_vector) const { return YVector(m_x + a_vector.m_x, m_y + a_vector.m_y, m_z + a_vector.m_z); } YVector YVector::operator-(const YVector& a_vector) const { return YVector(m_x - a_vector.m_x, m_y - a_vector.m_y, m_z - a_vector.m_z); } YVector YVector::operator*(float a_value) const { return YVector(m_x * a_value, m_y * a_value, m_z * a_value); } YVector YVector::operator/(float a_value) const { return YVector(m_x / a_value, m_y / a_value, m_z / a_value); } int YVector::length() const { return sqrt(m_x * m_x + m_y * m_y + m_z * m_z); } int YVector::lengthSqrt() const { return m_x * m_x + m_y * m_y + m_z * m_z; } float YVector::x() const { return m_x; } float YVector::y() const { return m_y; } float YVector::z() const { return m_z; }
[ "sergiosvieira@gmail.com" ]
sergiosvieira@gmail.com
edeb9bc7499de08b585c3928466bc1417d5978ac
b778b18efb8e51fda19eea63e4263c65577f3dfa
/src/devices/led.cpp
979cf91b9d34450b9ec2e0ef5d454e757b4998dc
[]
no_license
alambin/sad_lamp_arduino
c620695c1cf913598018ab233a15e8891c83e081
f7b31d71708cf0d60dfc9310ff1b2082849e54a9
refs/heads/master
2023-08-26T00:35:59.410867
2021-10-11T07:45:51
2021-10-11T07:45:51
339,043,853
0
0
null
null
null
null
UTF-8
C++
false
false
208
cpp
#include "led.h" #include <Arduino.h> Led::Led(uint8_t pin) : pin_{pin} { } void Led::Setup() { pinMode(pin_, OUTPUT); } void Led::TurnOn(bool is_on) { digitalWrite(pin_, is_on ? HIGH : LOW); }
[ "extern.aleksei.lambin@porsche.de" ]
extern.aleksei.lambin@porsche.de
09d87f00151c605c70efc196a89bfd905d09afdb
8bd0d65ff544ebc20904fb1d40e1f6c6d8e44f32
/fibonacci_n_series_dp.cpp
193ca6ab471b08be380b804ad330954b63080b1b
[]
no_license
rockstarmood/classical-problems
901235e44cb422aa8b2e95e43346199eb3dfd74b
a77eff42b043e83821a00b165ba9b84cfd75cbbe
refs/heads/main
2022-12-29T08:02:52.202843
2020-10-20T11:30:28
2020-10-20T11:30:28
305,685,254
0
0
null
2020-10-20T11:25:37
2020-10-20T11:25:36
null
UTF-8
C++
false
false
378
cpp
//Condition is t < 85 (increase it by your requirement) #include <iostream> using namespace std; int main() { int t; cin >> t; long int dp[85]={0}; dp[0] = 1; dp[1] = 1; for(int i=2;i<85;i++){ dp[i] = dp[i-1] + dp[i-2]; } while(t--){ int n; cin >> n; for(int i=0;i<n;i++){ cout << dp[i] << " "; } cout << endl; } return 0; }
[ "noreply@github.com" ]
noreply@github.com
ae0ca0c883b52da367394c46b9fe4e041237cfaf
91e7d66498f2efc8ec74ed9d35824b69820baff2
/src/mono/filters/langcollectorfilter.cpp
df51d51e291d20c5f87b2499efa240d43bdd6c3d
[ "Apache-2.0" ]
permissive
paracrawl/extractor
c7fbedde3356719cb5df9e9af8383ae38213993b
14d66691b0da4b41ad1e7fe2f27cc9e1ab9cbd58
refs/heads/master
2021-08-22T06:22:07.883175
2017-11-29T13:55:59
2017-11-29T13:55:59
103,895,709
24
4
null
null
null
null
UTF-8
C++
false
false
2,274
cpp
#include "langcollectorfilter.h" #include "../../utils/common.h" #include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string.hpp> #include <boost/regex.hpp> #include <iostream> #include <map> #include <fstream> namespace mono { namespace filters { LangCollectorFilter::LangCollectorFilter(std::string output_folder_, utils::compression_option compr_) : boost::iostreams::line_filter(true), header(""), text_buffer(""), ls(output_folder_, compr_) {}; std::string LangCollectorFilter::do_filter(const std::string &str_) { std::string line = boost::trim_copy(str_); if (line.empty()) { return ""; } if (boost::starts_with(line, magic_number)) { if (output_to_langsink()) { return ""; } // update header header = line; return ""; } else { text_buffer += line + "\n"; } return ""; } std::string LangCollectorFilter::parse_language(std::string const &str) { std::string found = find_language(str); if (found.length() > 0) { return boost::trim_copy(found.substr(language_guard.length())); } return ""; }; std::string LangCollectorFilter::find_language(std::string const &str) { std::string str_uri = str.substr(magic_number.length()); std::ostringstream ss; boost::regex expr{language_guard + "\\s*[a-zA-Z0-9]+\\s*"}; boost::smatch match; if (boost::regex_search(str_uri, match, expr) && match.size() >= 1) { return match[0]; } return ""; }; bool LangCollectorFilter::output_to_langsink() { if (header.size() > 0) { std::string res = header + '\n' + text_buffer; std::string lang = parse_language(header); text_buffer.erase(); if (lang.length() == 0) { header = ""; return true; } ls.output(lang, res); } return false; } } }
[ "marek.strelec@gmail.com" ]
marek.strelec@gmail.com
0f3f459b179818856707b224768b7893d8631c42
cd6ae6d04e47fb9f434d445304d3d2d86121b52e
/src/main.cpp
37f80935c1a3c5266e26f6cebf4ec7f195262b02
[]
no_license
fatgigi/Route-Planning-Project
57f4827d2b1a347985a40a0c04c59c7eebe164f1
8008ff1de0d94d14ed65ab925df7d4a4fc5879cb
refs/heads/master
2023-03-23T09:36:20.223086
2021-03-17T19:57:32
2021-03-17T19:57:32
348,835,264
0
0
null
null
null
null
UTF-8
C++
false
false
3,200
cpp
#include <optional> #include <fstream> #include <iostream> #include <vector> #include <string> #include <io2d.h> #include "route_model.h" #include "render.h" #include "route_planner.h" using namespace std::experimental; static std::optional<std::vector<std::byte>> ReadFile(const std::string &path) { std::ifstream is{path, std::ios::binary | std::ios::ate}; if( !is ) return std::nullopt; auto size = is.tellg(); std::vector<std::byte> contents(size); is.seekg(0); is.read((char*)contents.data(), size); if( contents.empty() ) return std::nullopt; return std::move(contents); } void getInput(float& input, std::string promt){ std::cout << promt << std::endl; std::cin >> input; } bool checkRange(int user_input){ if (user_input < 0 || user_input > 100 ) return false; return true; } int main(int argc, const char **argv) { std::string osm_data_file = ""; if( argc > 1 ) { for( int i = 1; i < argc; ++i ) if( std::string_view{argv[i]} == "-f" && ++i < argc ) osm_data_file = argv[i]; } else { std::cout << "To specify a map file use the following format: " << std::endl; std::cout << "Usage: [executable] [-f filename.osm]" << std::endl; osm_data_file = "../map.osm"; } std::vector<std::byte> osm_data; if( osm_data.empty() && !osm_data_file.empty() ) { std::cout << "Reading OpenStreetMap data from the following file: " << osm_data_file << std::endl; auto data = ReadFile(osm_data_file); if( !data ) std::cout << "Failed to read." << std::endl; else osm_data = std::move(*data); } float start_x; getInput(start_x, "Please enter x axis for start point"); if (!checkRange(start_x)) std::cout << "Not a valid input, must in range [0, 100]." << std::endl; float start_y; getInput(start_y, "Please enter y axis for start point"); if (!checkRange(start_y)) std::cout << "Not a valid input, must in range [0, 100]." << std::endl; float end_x; getInput(end_x, "Please enter x axis for end point"); if (!checkRange(end_x)) std::cout << "Not a valid input, must in range [0, 100]." << std::endl; float end_y; getInput(end_y, "Please enter y axis for end point"); if (!checkRange(end_y)) std::cout << "Not a valid input, must in range [0, 100]." << std::endl; // Build Model. RouteModel model{osm_data}; // Create RoutePlanner object and perform A* search. RoutePlanner route_planner{model, start_x, start_y, end_x, end_y}; route_planner.AStarSearch(); std::cout << "Distance: " << route_planner.GetDistance() << " meters. \n"; // Render results of search. Render render{model}; auto display = io2d::output_surface{400, 400, io2d::format::argb32, io2d::scaling::none, io2d::refresh_style::fixed, 30}; display.size_change_callback([](io2d::output_surface& surface){ surface.dimensions(surface.display_dimensions()); }); display.draw_callback([&](io2d::output_surface& surface){ render.Display(surface); }); display.begin_show(); }
[ "zoe.xiaoqing@gmail.com" ]
zoe.xiaoqing@gmail.com
a237f60395855bbc942659ddd6d0fd6b56e2584f
b75cf0aba343612fdfcd2d9a91acf7475d9c6e87
/IdlerGameIdea/binary_semaphore.cpp
753cb08e0b78404e0d21bbbcb9857c15e85a561b
[]
no_license
Shendul/OpSysFinal
0dd46f9ab33e95cae98a7ab9062112eecbbcfd1b
9af44fc5bbe7fbb5c20c1c1d51b86e1d3ed2c55b
refs/heads/master
2021-08-22T23:27:24.878683
2017-12-01T17:06:44
2017-12-01T17:06:44
111,129,653
0
0
null
null
null
null
UTF-8
C++
false
false
1,799
cpp
#include <pthread.h> #include "binary_semaphore.h" void semInitB(binary_semaphore* s, int state) { pthread_mutex_init(&(s->mutex), NULL); // initialize mutex pthread_cond_init(&(s->cv), NULL); // initialize condition variable s->flag = state; // set flag value } void semWaitB(binary_semaphore* s) { // try to get exclusive access to s->flag pthread_mutex_lock(&(s->mutex)); // no other thread can get here unless current thread unlocks "mutex" // examine the flag and wait until flag == 1 while (s->flag == 0) { pthread_cond_wait(&(s->cv), &(s->mutex)); // When the current thread executes the pthread_cond_wait() // statement, the current thread will be blocked on s->cv and // (atomically) unlocks s->mutex. Unlocking s->mutex will let // other threads in to test s->flag. } // ----------------------------------------- // If the program arrives here, we know that s->flag == 1 and this // thread has now successfully passed the semaphore // ------------------------------------------- s->flag = 0; // This will cause all other threads that execute a // semWaitB() call to wait in the (above) while-loop // release exclusive access to s->flag pthread_mutex_unlock(&(s->mutex)); } void semSignalB(binary_semaphore* s) { // try to get exclusive access to s->flag pthread_mutex_lock(&(s->mutex)); pthread_cond_signal(&(s->cv)); // This call may restart some thread that was blocked on s->cv (in // the semWaitB() call) if there was no thread blocked on cv, this // operation does nothing. // update semaphore state to Up s->flag = 1; // release exclusive access to s->flag pthread_mutex_unlock(&(s->mutex)); }
[ "shendul@MrsLenny-V.localdomain" ]
shendul@MrsLenny-V.localdomain
b3b901ce94fe1abcbdd8a0575958187d4e9a4fae
6e4f9952ef7a3a47330a707aa993247afde65597
/PROJECTS_ROOT/SmartWires/TI/tiscript.hpp
8aaf31c3c32cdd853b9b6d9d4b322e95352d4e5f
[]
no_license
meiercn/wiredplane-wintools
b35422570e2c4b486c3aa6e73200ea7035e9b232
134db644e4271079d631776cffcedc51b5456442
refs/heads/master
2021-01-19T07:50:42.622687
2009-07-07T03:34:11
2009-07-07T03:34:11
34,017,037
2
1
null
null
null
null
UTF-8
C++
false
false
4,979
hpp
#ifndef __tiscript_hpp__ #define __tiscript_hpp__ /* * Terra Informatica Script Engine. * Copyright 2005, Andrew Fedoniouk * * TISCRIPT is a variation of ECMAScript. * Compiler, bytecoded VM, copying GC * * C++ API. * */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdlib.h> #include "tiscript.h" namespace tiscript { typedef wchar_t wchar; typedef json::value value; typedef json::string string; class engine; class stream { friend class engine; public: stream() {} virtual const wchar_t* stream_name() { return 0; } // these two needs to be overrided virtual int get() { return -1; } virtual bool put(int v) { v; return false; } void *tag() { return this; } static int CALLBACK input(void *tag) { return ((stream*)tag)->get(); } static int CALLBACK output(void *tag, int v) { return ((stream*)tag)->put(v); } }; class engine { public: HSCRIPT _hengine; bool _owner; stream *_console; engine(stream *console = 0): _console(console), _owner(true) { _hengine = ::TIS_create_engine( 0xFFFFFFFF, this, 0 ); if( _console ) ::TIS_set_std_streams(_hengine, _console->tag(), &stream::input, // stdin in script _console->tag(), &stream::output, // stdout in script _console->tag(), &stream::output); // stderr in script } explicit engine(HSCRIPT hengine): _hengine(hengine), _owner(false) { } ~engine() { if(_owner) ::TIS_destroy_engine( _hengine ); } bool load(stream* in, bool hypertext_mode) { return 0 != ::TIS_load(_hengine, in->tag(), &stream::input, in->stream_name(), hypertext_mode? TRUE:FALSE); } bool compile(stream* in, stream* out, bool hypertext_mode) { return 0 != ::TIS_compile(_hengine, in->tag(), &stream::input, in->stream_name(), out->tag(), &stream::output, hypertext_mode? TRUE:FALSE); } bool loadbc( stream* bytecodes ) { return 0 != ::TIS_loadbc(_hengine, bytecodes->tag(), &stream::input); } bool call(const char* funcpath, JSON_VALUE* argv, int argc, JSON_VALUE& r) { return ::TIS_call(_hengine, funcpath, argv, argc, &r) != 0; } // add native class to script namespace bool add(TIS_class_def* pcd) { return ::TIS_define_class( _hengine, pcd) != 0; } void throw_error(const wchar_t* message) { ::TIS_throw(_hengine, message); } }; // various stream implementations class string_in_stream: public stream { const wchar* _str; public: string_in_stream(const wchar* str): _str(str) {} virtual int get() { if(*_str) return *_str++; return -1; } }; class string_out_stream: public stream { wchar *_str, *_p, *_end; public: string_out_stream() { _p = _str = (wchar*)malloc( 128 * sizeof(wchar) ); _end = _str + 128; } virtual bool put(int v) { if( _p >= _end ) { size_t sz = _end - _str; size_t nsz = (sz * 2) / 3; wchar *nstr = (wchar*)realloc(_str, nsz * sizeof(wchar)); if(!nstr) return false; _str = nstr; _p = _str + sz; _end = _str + nsz; } *_p++ = v; return true; } }; // simple file stream. class file_in_stream: public stream { FILE * _file; string _name; public: file_in_stream(const char* filename) { _file = fopen(filename,"rb"); _name = aux::a2w(filename); } ~file_in_stream() { if(_file) fclose(_file); } virtual const wchar_t* stream_name() { return _name; } virtual int get() { if(!_file || feof(_file)) return -1; return fgetc(_file); } bool is_valid() const { return _file != 0; } }; class file_in_stream_w: public stream { FILE * _file; string _name; public: file_in_stream_w(const char* filename) { _file = fopen(filename,"rb"); _name = aux::a2w(filename); } ~file_in_stream_w() { if(_file) fclose(_file); } virtual const wchar_t* stream_name() { return _name; } virtual int get() { if(!_file || feof(_file)) return -1; wchar_t wc; if(fread(&wc,sizeof(wchar_t),1,_file)) return wc; return -1; } bool is_valid() const { return _file != 0; } }; inline wchar oem2wchar(char c) { wchar wc = '?'; MultiByteToWideChar(CP_OEMCP,0,&c,1,&wc,1); return wc; } inline char wchar2oem(wchar wc) { char c = '?'; WideCharToMultiByte(CP_OEMCP,0,&wc,1,&c,1,0,0); return c; } class console: public stream { public: virtual int get() { int c = getchar(); return c != EOF? oem2wchar(c) : -1; } virtual bool put(int v) { return putchar( wchar2oem(v) ) != EOF; } }; } #endif
[ "wplabs@3fb49600-69e0-11de-a8c1-9da277d31688" ]
wplabs@3fb49600-69e0-11de-a8c1-9da277d31688
9f792e4197b548338740ad7ef132c5ba5c7375b2
ce0e7e0a8484eb79459d81916b74ceab9fc64116
/Undistort.hpp
79710672835d13c1fb2d42c7ddc1615d6392114e
[]
no_license
HareshKarnan/TrackUSVBehaviour
488165b9e3904deed97a75238425b19be1e7a1ab
1f69226898d5264fb8f4b7dcf5bbbf3b49029158
refs/heads/master
2021-06-16T12:58:39.358074
2017-05-08T23:36:47
2017-05-08T23:36:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
572
hpp
/* * File: Undistort.hpp * Author: Jan Dufek */ #ifndef UNDISTORT_HPP #define UNDISTORT_HPP #include "opencv2/opencv.hpp" #include "Settings.hpp" #define PI 3.14159265 using namespace cv; class Undistort { public: Undistort(Settings&, Size); Undistort(const Undistort& orig); virtual ~Undistort(); void undistort_camera(Mat&, Mat&); void undistort_perspective(Mat&, Mat&); private: Settings * settings; Size video_size; Mat undistortRectifyMap1; Mat undistortRectifyMap2; }; #endif /* UNDISTORT_HPP */
[ "haresh.miriyala@gmail.com" ]
haresh.miriyala@gmail.com
ab0e36cec4c6b80c78e6a31bb5647c1dc4d964e2
370d50f32a18c9c8e3b96e790b0fbf6c4c321965
/main.cpp
77cd56a1043730c1a6f1b71bf48773d8c175d3d8
[]
no_license
NormanBetancourth/Lista_Simple
392ca685f4a43cdd01925c86911a8b1aa9cbe78b
e0b438473094a32bea043da3a50ab57076c334fd
refs/heads/main
2023-04-13T11:25:53.963545
2021-04-18T02:52:51
2021-04-18T02:52:51
358,975,774
2
0
null
null
null
null
UTF-8
C++
false
false
593
cpp
#include <iostream> #include <sstream> #include "Lista.h" int main() { Lista *L =new Lista(); Persona* P1 =new Persona(1,"Norman"); Persona* P2 =new Persona(2,"perla"); Persona* P3 =new Persona(3,"fabi"); Persona* P4 =new Persona(4,"allen"); Persona* P5 =new Persona(5,"jose"); L->agregarFinal(P5); L->agregarFinal(P1); L->agregarFinal(P3); L->agregarFinal(P4); L->agregarFinal(P2); cout<<L->toString(); cout<<L->cuentaNodos(); L->ordenarLista(); L->eliminarEspecifico("perla"); cout<<L->toString(); return 0; }
[ "norman.betancourtt.mairena@est.una.ac.cr" ]
norman.betancourtt.mairena@est.una.ac.cr
a715ba506bbe7ab0d1d3127d6c121005763a6fa1
933d988240d69e8c5b9fd71de86870a88447be23
/src/clibgame/timer.hpp
e6c9f5eefcfa5b1c9287ce207f3c6b54f5fa2306
[ "MIT" ]
permissive
crockeo/clibgame
041e0b9a0bf98bae1e265971fa014c70a709c3dc
e2cedf43be69b1c665d544083e48899ab3025258
refs/heads/master
2021-01-19T01:36:17.548425
2015-09-30T17:24:40
2015-09-30T17:24:40
30,318,342
1
0
null
null
null
null
UTF-8
C++
false
false
1,243
hpp
// Name: clibgame/timer.hpp // // Description: // This file provides a class to keep track of time for the library. #ifndef _CLIBGAME_TIMER_HPP_ #define _CLIBGAME_TIMER_HPP_ ////////////// // Includes // #include <thread> ////////// // Code // namespace clibgame { // A class to keep track of time. class Timer { private: std::thread updateThread; float fidelity; bool running; float time; float cap; public: // The default fidelity of the Timer. constexpr static float defaultFidelity = 0.01f; // Creating a timer with a non-standard fidelity that loops at a given // point (if you want it not to loop, make the first float less than 0). Timer(float, float); // Creating a timer that loops at a given point. Timer(float); // Creating a timer that doesn't loop. Timer(); // Copy constructor. Timer(const Timer&); // Destroying this timer. ~Timer(); // Assignment operator. Timer& operator=(const Timer&); // Some accessors. float getFidelity() const; float getTime() const; float getCap() const; }; } #endif
[ "crockeo@gmail.com" ]
crockeo@gmail.com
c396e68082a5ec4d0a13d71603a0cde8b2655a5e
202f1634852e51cd1e33d82f33c9c667487d857c
/lw2/process_vector/pch.h
e6c57f5f295c613c04113ff47bfd817c15284714
[]
no_license
VeevtaMayli/OOP
6a44f317ad14c6413f9ab7803a0328ca54d03b70
9b59ee29c897273a70e33f12ca62354721f87019
refs/heads/master
2020-04-22T23:31:38.605858
2019-07-11T21:04:26
2019-07-11T21:04:26
170,730,991
0
0
null
null
null
null
UTF-8
C++
false
false
127
h
#ifndef PCH_H #define PCH_H #include <algorithm> #include <iostream> #include <iterator> #include <vector> #endif //PCH_H
[ "matveeffilia@gmail.com" ]
matveeffilia@gmail.com
78eb43ed91219add492bf3eba236ea3253392668
aade1e73011f72554e3bd7f13b6934386daf5313
/Contest/AsiaPacific/Seoul2018/A.cpp
03e68997508083095297ff348b08b237cf162783
[]
no_license
edisonhello/waynedisonitau123
3a57bc595cb6a17fc37154ed0ec246b145ab8b32
48658467ae94e60ef36cab51a36d784c4144b565
refs/heads/master
2022-09-21T04:24:11.154204
2022-09-18T15:23:47
2022-09-18T15:23:47
101,478,520
34
6
null
null
null
null
UTF-8
C++
false
false
2,239
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int ux[maxn], uy[maxn], vx[maxn], vy[maxn]; int l[maxn], r[maxn]; vector<int> st[maxn], ed[maxn]; namespace segtree { int mx[maxn * 4], tg[maxn * 4]; void init() { for (int i = 0; i < maxn * 4; ++i) mx[i] = 0, tg[i] = 0; } void push(int o) { if (tg[o] == 0) return; mx[o * 2 + 1] += tg[o], tg[o * 2 + 1] += tg[o]; mx[o * 2 + 2] += tg[o], tg[o * 2 + 2] += tg[o]; tg[o] = 0; } void modify(int l, int r, int ql, int qr, int v, int o = 0) { if (r - l > 1) push(o); if (l >= qr || ql >= r) return; if (l >= ql && r <= qr) return mx[o] += v, tg[o] += v, void(); modify(l, (l + r) >> 1, ql, qr, v, o * 2 + 1); modify((l + r) >> 1, r, ql, qr, v, o * 2 + 2); mx[o] = max(mx[o * 2 + 1], mx[o * 2 + 2]); } int query(int l, int r, int ql, int qr, int o = 0) { if (r - l > 1) push(o); if (l >= qr || ql >= r) return 0; if (l >= ql && r <= qr) return mx[o]; return query(l, (l + r) >> 1, ql, qr, o * 2 + 1) + query((l + r) >> 1, r, ql, qr, o * 2 + 2); } } int main() { int n; scanf("%d", &n); vector<int> ds; for (int i = 0; i < n; ++i) { scanf("%d%d%d%d", &ux[i], &uy[i], &vx[i], &vy[i]); l[i] = vy[i]; r[i] = uy[i]; ds.push_back(l[i]); ds.push_back(r[i]); } sort(ds.begin(), ds.end()); ds.resize(unique(ds.begin(), ds.end()) - ds.begin()); for (int i = 0; i < n; ++i) { l[i] = lower_bound(ds.begin(), ds.end(), l[i]) - ds.begin(); r[i] = lower_bound(ds.begin(), ds.end(), r[i]) - ds.begin(); st[l[i]].push_back(i); ed[r[i]].push_back(i); } int ans = 0, got = 0; for (int i = 0; i < n; ++i) segtree::modify(0, maxn, l[i], r[i] + 1, 1); for (int i = 0; i < maxn; ++i) { for (int j = 0; j < (int)st[i].size(); ++j) segtree::modify(0, maxn, l[st[i][j]], r[st[i][j]] + 1, -1), ++got; ans = max(ans, got + segtree::query(0, maxn, 0, maxn)); for (int j = 0; j < (int)ed[i].size(); ++j) --got; } printf("%d\n", ans); return 0; }
[ "tu.da.wei@gmail.com" ]
tu.da.wei@gmail.com
c7655d600e7e31585a34e7125a754b1ea72a9f11
bbebebef92974fb7e8fdb4ed72abe47032a97d18
/ecs/TextureManager.cpp
d24c2e41645ede98facad1834a8413ad16aaf5c2
[]
no_license
fantasiorona/ecs
8be7e39a4642fc0159f17cd657b52d7fc71e1bc6
ce7cdc7509d9a19a7f242501e4676de808be4ed4
refs/heads/main
2023-04-16T13:17:12.162283
2021-04-27T11:11:26
2021-04-27T11:11:26
360,845,118
0
0
null
null
null
null
UTF-8
C++
false
false
216
cpp
#include <cassert> #include "TextureManager.h" TextureManager::TextureManager() { // load the texture, assume success const auto success = _circleTexture.loadFromFile("textures/circle.png"); assert(success); }
[ "skaillzsupp@gmail.com" ]
skaillzsupp@gmail.com
c8b18a8e8b2f83bc1ac9d0c41739404978857c72
9ad9cbf14c53370a5981e45a993f5e32f4405028
/源.cpp
1bc5da61878996e165b5ee345990c2c7119d3931
[]
no_license
DRAWPIETY/Tree
66d85f4e82825b9042822a584d5019305e1d5b3d
1cd7bae9e7f59e91fa15bb370f701ee91bd93a3e
refs/heads/master
2020-03-22T17:21:51.737498
2018-07-10T07:04:03
2018-07-10T07:04:03
140,391,069
0
0
null
null
null
null
GB18030
C++
false
false
10,433
cpp
#define N 100 #include <iostream> #include <limits> #include <cmath> #include <cstdlib> #include <fstream> #include <cstddef> #include <cctype> #include <ctime> #include <stack> using namespace std; enum Error_code { success, fail, range_error, underflow, overflow, fatal, not_present, duplicate_error, entry_inserted, entry_found, internal_error }; template <class Entry> struct Binary_node { Entry data; Binary_node<Entry> *left; Binary_node<Entry> *right; Binary_node(); Binary_node(const Entry &x); }; template <class Entry> class Binary_tree { public: Binary_tree(); Binary_tree(const Binary_tree<Entry> &original); bool empty() const; int leaf_count() const; void preorder(void(*visit)(Entry &)); void inorder(void(*visit)(Entry &)); void postorder(void(*visit)(Entry &)); void NoRePreorder(); void NoReInorder(); int size() const; int height() const; void clear(); void insert(const Entry &); ~Binary_tree(); Binary_tree & operator =(const Binary_tree<Entry> &original); void level_traverse(void(*visit)(Entry &)); Binary_node<Entry>* createBiTree(Entry *pre, Entry *in, int n); protected: Binary_node<Entry> *root; int recursive_leaf_count(Binary_node<Entry> *sub_root) const; void recursive_preorder(Binary_node<Entry> *, void(*visit)(Entry &)); void recursive_inorder(Binary_node<Entry> *, void(*visit)(Entry &)); void recursive_postorder(Binary_node<Entry> *, void(*visit)(Entry &)); int recursive_size(Binary_node<Entry> *sub_root) const; int recursive_height(Binary_node<Entry> *sub_root) const; void recursive_clear(Binary_node<Entry> *&sub_root); void recursive_insert(Binary_node<Entry> *&sub_root, const Entry &x); Binary_node<Entry> *recursive_copy(Binary_node<Entry> *sub_root); }; template <class Entry> Binary_node<Entry>::Binary_node() { left = right = NULL; data = NULL; } template <class Entry> Binary_node<Entry>::Binary_node(const Entry &x) { data = x; left = right = NULL; } template <class Entry> Binary_tree<Entry>::Binary_tree() { root = NULL; } template <class Entry> bool Binary_tree<Entry>::empty() const { return root == NULL; } template <class Entry> int Binary_tree<Entry>::leaf_count() const { return recursive_leaf_count(root); } template <class Entry> int Binary_tree<Entry>::recursive_leaf_count(Binary_node<Entry> *sub_root) const { if (sub_root == NULL) return 0; if (sub_root->left == NULL && sub_root->right == NULL) return 1; return recursive_leaf_count(sub_root->left) + recursive_leaf_count(sub_root->right); } template <class Entry> void Binary_tree<Entry>::preorder(void(*visit)(Entry &)) { recursive_preorder(root, visit); } template <class Entry> void Binary_tree<Entry>::recursive_preorder(Binary_node<Entry> *sub_root, void(*visit)(Entry &)) { if (sub_root != NULL) { (*visit)(sub_root->data); recursive_preorder(sub_root->left, visit); recursive_preorder(sub_root->right, visit); } } template <class Entry> void Binary_tree<Entry>::inorder(void(*visit)(Entry &)) { recursive_inorder(root, visit); } template <class Entry> void Binary_tree<Entry>::recursive_inorder(Binary_node<Entry> *sub_root, void(*visit)(Entry &)) { if (sub_root != NULL) { recursive_inorder(sub_root->left, visit); (*visit)(sub_root->data); recursive_inorder(sub_root->right, visit); } } template <class Entry> void Binary_tree<Entry>::postorder(void(*visit)(Entry &)) { recursive_postorder(root, visit); } template <class Entry> void Binary_tree<Entry>::recursive_postorder(Binary_node<Entry> *sub_root, void(*visit)(Entry &)) { if (sub_root != NULL) { recursive_postorder(sub_root->left, visit); recursive_postorder(sub_root->right, visit); (*visit)(sub_root->data); } } template<class Entry> void Binary_tree<Entry>::NoRePreorder() { if (root == NULL) return; Binary_node<Entry> * p = root; stack<Binary_node<Entry>*> s; while (!s.empty() || p) { if (p) { cout << p->data; s.push(p); p = p->left; } else { p = s.top(); s.pop(); p = p->right; } } } template <class Entry> void Binary_tree<Entry>::NoReInorder() { //空树 if (root == NULL) return; //树非空 Binary_node<Entry> * p = root; stack<Binary_node<Entry>*> s; while (!s.empty() || p) { if (p) { s.push(p); p = p->left; } else { p = s.top(); s.pop(); cout << p->data; p = p->right; } } } template <class Entry> int Binary_tree<Entry>::size() const { return recursive_size(root); } template <class Entry> int Binary_tree<Entry>::recursive_size(Binary_node<Entry> *sub_root) const { if (sub_root == NULL) return 0; return 1 + recursive_size(sub_root->left) + recursive_size(sub_root->right); } template <class Entry> int Binary_tree<Entry>::height() const { return recursive_height(root); } template <class Entry> int Binary_tree<Entry> ::recursive_height(Binary_node<Entry> *sub_root) const { if (sub_root == NULL) return 0; int l = recursive_height(sub_root->left); int r = recursive_height(sub_root->right); if (l > r) return 1 + l; else return 1 + r; } template <class Entry> void Binary_tree<Entry>::clear() { recursive_clear(root); } template <class Entry> void Binary_tree<Entry>::recursive_clear(Binary_node<Entry> *&sub_root) { Binary_node<Entry> *temp = sub_root; if (sub_root == NULL) return; recursive_clear(sub_root->left); recursive_clear(sub_root->right); sub_root = NULL; delete temp; } template <class Entry> void Binary_tree<Entry>::insert(const Entry &x) { recursive_insert(root, x); } template <class Entry> void Binary_tree<Entry>::recursive_insert(Binary_node<Entry> *&sub_root, const Entry &x) { if (sub_root == NULL) sub_root = new Binary_node<Entry>(x); else if (recursive_height(sub_root->right) < recursive_height(sub_root->left)) recursive_insert(sub_root->right, x); else recursive_insert(sub_root->left, x); } template <class Entry> Binary_tree<Entry>::~Binary_tree() { clear(); } template <class Entry> Binary_tree<Entry>::Binary_tree(const Binary_tree<Entry> &original) { root = recursive_copy(original.root); } template <class Entry> Binary_node<Entry> *Binary_tree<Entry>::recursive_copy(Binary_node<Entry> *sub_root) { if (sub_root == NULL) return NULL; Binary_node<Entry> *temp = new Binary_node<Entry>(sub_root->data); temp->left = recursive_copy(sub_root->left); temp->right = recursive_copy(sub_root->right); return temp; } template <class Entry> Binary_tree<Entry> &Binary_tree<Entry>::operator =(const Binary_tree<Entry> &original) { Binary_tree<Entry> new_copy(original); clear(); root = new_copy.root; new_copy.root = NULL; return *this; } template <class Entry> void Binary_tree<Entry> ::level_traverse(void(*visit)(Entry &)) { Binary_node<Entry> *sub_root; if (root != NULL) { Queue < Binary_node<Entry> * > waiting_nodes; waiting_nodes.append(root); do { waiting_nodes.retrieve(sub_root); (*visit)(sub_root->data); if (sub_root->left) waiting_nodes.append(sub_root->left); if (sub_root->right) waiting_nodes.append(sub_root->right); waiting_nodes.serve(); } while (!waiting_nodes.empty()); } } template<class Entry> Binary_node<Entry>* Binary_tree<Entry>::createBiTree(Entry *pre, Entry *in, int n) { int i = 0; int n1 = 0, n2 = 0; int m1 = 0, m2 = 0; Binary_node<Entry> *node = NULL; char lpre[100], rpre[100]; char lin[100], rin[100]; if (n == 0) { return NULL; } node = (Binary_node<Entry>*)malloc(sizeof(Binary_node<Entry>)); if (node == NULL) { return NULL; } memset(node, 0, sizeof(Binary_node<Entry>)); //先序序列的第一个元素必为根结点 node->data = pre[0]; //根据根结点将中序序列分为左子树和右子数 for (i = 0; i<n; i++) { if ((i <= n1) && (in[i] != pre[0])) { lin[n1++] = in[i]; } else if (in[i] != pre[0]) { rin[n2++] = in[i]; } } //根据树的先序序列的长度等于中序序列的长度 //且先序遍历是先左子树再后子树,无论先序还是中序 左子树和右子树的长度都是固定的 //主意 从i=1开始 因为先序遍历的第一个是根 for (i = 1; i < n; i++) { if (i< (n1 + 1))//n1代表了左子树的长度 { lpre[m1++] = pre[i]; } else { rpre[m2++] = pre[i]; } } node->left = createBiTree(lpre, lin, n1); node->right = createBiTree(rpre, rin, n2); root = node; return node; } void test_creat_tree() { cout << endl; cout << "开始测试两个序列创建一个二叉树" << endl; char preNode[N]; char inNode[N]; int n = 0; char ch; cout << "请输入先序序列:"; while ((ch = getchar()) && ch != '\n') preNode[n++] = ch; n = 0; cout << "请输入中序序列:";; while ((ch = getchar()) && ch != '\n') inNode[n++] = ch; Binary_tree<char> A; A.createBiTree(preNode, inNode, n); cout << "由两序列创建的二叉树高度为:" << A.height() << endl; cout << "由两序列创建的二叉树结点数为:" << A.size() << endl; cout << "由两序列创建的二叉树叶子数为:" << A.leaf_count() << endl; cout << "由两序列创建的二叉树的前序遍历为:"; A.NoRePreorder(); cout << endl; cout << "由两序列创建的二叉树的中序遍历为:"; A.NoReInorder(); cout << endl; } void main() { Binary_tree<char> TA; if (TA.empty()) { cout << "该树为空" << endl; } string s = "ABCDEFGHIJK"; for (unsigned int i = 0; i < s.size(); i++) { TA.insert(s[i]); } cout << "TA前序遍历:"; TA.NoRePreorder(); cout << endl; cout << "TA中序遍历:"; TA.NoReInorder(); cout << endl; cout << "结点数:" << TA.size() << endl; cout << "叶子数:" << TA.leaf_count() << endl; cout << "高度:" << TA.height() << endl; Binary_tree<char> TB(TA); cout << "TB前序遍历:"; TB.NoRePreorder(); cout << endl; Binary_tree<char> TC = TA; cout << "TC中序遍历:"; TC.NoReInorder(); cout << endl; TC.clear(); cout << "TC使用clear函数后结点数为:" << TC.size() << endl; test_creat_tree(); }
[ "noreply@github.com" ]
noreply@github.com
66f37dee2dd0b6cabbfe6f5b340ce290b0d5af66
5a9dd0f99dafb9fe719ae19ef18b91aeb8ab3076
/apps/NxBTPhone/MainDialog.cpp
fa19f49b4b8f71cce051fe8234161f1f060a7016
[]
no_license
NexellCorp/linux_sdk_displayaudio
3529c67d5b82655eb010396ca6821bb8a83ed3a7
a93ecb7dff63cb5f7033a43ba86e7a84c0fc3dd1
refs/heads/master
2021-07-09T11:04:14.073928
2020-03-19T06:49:10
2020-03-24T23:34:36
156,818,510
0
1
null
null
null
null
UTF-8
C++
false
false
749
cpp
#include "MainDialog.h" #include "ui_MainDialog.h" #define MAX_RETRY_COMMAND_COUNT 3 //pthread_cond_t g_pthread_condition; //pthread_mutex_t g_pthread_mutex; MainDialog::MainDialog(QWidget *parent) : QDialog(parent, Qt::FramelessWindowHint), ui(new Ui::MainDialog) { ui->setupUi(this); // m_bProtectForPlayStatus = false; m_bDisconnectedCall = false; m_nRetryCommandCount = 0; m_pCallingDialog = new InCommingCallDialog(this); connect(m_pCallingDialog, SIGNAL(signalCommandToServer(QString)), m_pBTCommandProcessor, SLOT(slotCommandToServer(QString))); connect(m_pBTCommandProcessor, SIGNAL(signalCommandFromServer(QString)), m_pCallingDialog, SLOT(slotCommandFromServer(QString))); } MainDialog::~MainDialog() { delete ui; }
[ "daegeun.han@nexell.co.kr" ]
daegeun.han@nexell.co.kr
deedd4701d0ed927b0e0cc21dc2836a141aab5f3
18f071e4a8884fc60822ce8bca02004d2ec994fe
/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.cpp
6d7a33c1062b63e41b3cfa34ebed4730a7d31d6d
[ "MIT", "CC-BY-4.0" ]
permissive
lynnfang/reactNativeP
5816ec48e7a83008c3800ca3d7a8fcb914a03fe4
1daf2cd2c38a11d9ddd2cd8fa0193535722b3d59
refs/heads/master
2022-12-11T10:42:22.790990
2019-08-19T12:25:53
2019-08-19T12:25:53
201,169,240
3
0
MIT
2022-12-04T06:34:18
2019-08-08T03:15:50
JavaScript
UTF-8
C++
false
false
4,764
cpp
// Copyright (c) 2004-present, Facebook, Inc. // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. #include "ReadableNativeArray.h" #include "ReadableNativeMap.h" using namespace facebook::jni; namespace facebook { namespace react { // This attribute exports the ctor symbol, so ReadableNativeArray to be // constructed from other DSOs. __attribute__((visibility("default"))) ReadableNativeArray::ReadableNativeArray(folly::dynamic array) : HybridBase(std::move(array)) {} void ReadableNativeArray::mapException(const std::exception& ex) { if (dynamic_cast<const folly::TypeError*>(&ex) != nullptr) { throwNewJavaException(exceptions::gUnexpectedNativeTypeExceptionClass, ex.what()); } } jint ReadableNativeArray::getSize() { return array_.size(); } jboolean ReadableNativeArray::isNull(jint index) { return array_.at(index).isNull() ? JNI_TRUE : JNI_FALSE; } jboolean ReadableNativeArray::getBoolean(jint index) { return array_.at(index).getBool() ? JNI_TRUE : JNI_FALSE; } jdouble ReadableNativeArray::getDouble(jint index) { const folly::dynamic& val = array_.at(index); if (val.isInt()) { return val.getInt(); } return val.getDouble(); } jint ReadableNativeArray::getInt(jint index) { const folly::dynamic& val = array_.at(index); int64_t integer = convertDynamicIfIntegral(val); return makeJIntOrThrow(integer); } const char* ReadableNativeArray::getString(jint index) { const folly::dynamic& dyn = array_.at(index); if (dyn.isNull()) { return nullptr; } return dyn.getString().c_str(); } local_ref<JArrayClass<jobject>> ReadableNativeArray::importArray() { jint size = array_.size(); auto jarray = JArrayClass<jobject>::newArray(size); for (jint i = 0; i < size; i++) { switch(array_.at(i).type()) { case folly::dynamic::Type::NULLT: { jarray->setElement(i, nullptr); break; } case folly::dynamic::Type::BOOL: { (*jarray)[i] = JBoolean::valueOf(ReadableNativeArray::getBoolean(i)); break; } case folly::dynamic::Type::INT64: case folly::dynamic::Type::DOUBLE: { (*jarray)[i] = JDouble::valueOf(ReadableNativeArray::getDouble(i)); break; } case folly::dynamic::Type::STRING: { (*jarray)[i] = make_jstring(ReadableNativeArray::getString(i)); break; } case folly::dynamic::Type::OBJECT: { (*jarray)[i] = ReadableNativeArray::getMap(i); break; } case folly::dynamic::Type::ARRAY: { (*jarray)[i] = ReadableNativeArray::getArray(i); break; } default: break; } } return jarray; } local_ref<ReadableNativeArray::jhybridobject> ReadableNativeArray::getArray(jint index) { auto& elem = array_.at(index); if (elem.isNull()) { return local_ref<ReadableNativeArray::jhybridobject>(nullptr); } else { return ReadableNativeArray::newObjectCxxArgs(elem); } } local_ref<ReadableType> ReadableNativeArray::getType(jint index) { return ReadableType::getType(array_.at(index).type()); } local_ref<JArrayClass<jobject>> ReadableNativeArray::importTypeArray() { jint size = array_.size(); auto jarray = JArrayClass<jobject>::newArray(size); for (jint i = 0; i < size; i++) { jarray->setElement(i, ReadableNativeArray::getType(i).get()); } return jarray; } local_ref<NativeMap::jhybridobject> ReadableNativeArray::getMap(jint index) { auto& elem = array_.at(index); return ReadableNativeMap::createWithContents(folly::dynamic(elem)); } namespace { // This is just to allow signature deduction below. local_ref<ReadableNativeMap::jhybridobject> getMapFixed(alias_ref<ReadableNativeArray::jhybridobject> array, jint index) { return static_ref_cast<ReadableNativeMap::jhybridobject>(array->cthis()->getMap(index)); } } void ReadableNativeArray::registerNatives() { registerHybrid({ makeNativeMethod("importArray", ReadableNativeArray::importArray), makeNativeMethod("importTypeArray", ReadableNativeArray::importTypeArray), makeNativeMethod("sizeNative", ReadableNativeArray::getSize), makeNativeMethod("isNullNative", ReadableNativeArray::isNull), makeNativeMethod("getBooleanNative", ReadableNativeArray::getBoolean), makeNativeMethod("getDoubleNative", ReadableNativeArray::getDouble), makeNativeMethod("getIntNative", ReadableNativeArray::getInt), makeNativeMethod("getStringNative", ReadableNativeArray::getString), makeNativeMethod("getArrayNative", ReadableNativeArray::getArray), makeNativeMethod("getMapNative", getMapFixed), makeNativeMethod("getTypeNative", ReadableNativeArray::getType), }); } } // namespace react } // namespace facebook
[ "lynnfang@tencent.com" ]
lynnfang@tencent.com
5c6e054c05def260b4b36a1ccffdc1f039773b8a
7a2631e3af71af5f4c5b958481e671d974719db1
/Embedded Systems Programming/Atmel/WinAVR/lib/gcc/avr32/4.3.2/include/c++/ext/throw_allocator.h
ffa0b4f24c7480846d6a3327ad71a1ba07958a83
[]
no_license
xufeiwaei/HHcourses
32f2d15a52b984a58d67d1385a26dc6e1984140d
8e3642425d00a13442751577ac69b876c099cd97
refs/heads/master
2020-05-18T20:30:14.192308
2014-01-12T13:22:47
2014-01-12T13:22:47
14,732,022
6
1
null
null
null
null
UTF-8
C++
false
false
12,106
h
// -*- C++ -*- // Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can 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, or (at your option) any later // version. // This library is distributed in the hope that it will be useful, but // WITHOUT 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 library; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, Boston, // MA 02111-1307, USA. // As a special exception, you may use this file as part of a free // software library without restriction. Specifically, if other files // instantiate templates or use macros or inline functions from this // file, or you compile this file and link it with other files to // produce an executable, this file does not by itself cause the // resulting executable to be covered by the GNU General Public // License. This exception does not however invalidate any other // reasons why the executable file might be covered by the GNU General // Public License. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** @file ext/throw_allocator.h * This file is a GNU extension to the Standard C++ Library. * * Contains an exception-throwing allocator, useful for testing * exception safety. In addition, allocation addresses are stored and * sanity checked. */ #ifndef _THROW_ALLOCATOR_H #define _THROW_ALLOCATOR_H 1 #include <cmath> #include <ctime> #include <map> #include <set> #include <string> #include <ostream> #include <stdexcept> #include <utility> #include <tr1/random> #include <bits/functexcept.h> #include <bits/stl_move.h> _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) class twister_rand_gen { public: twister_rand_gen(unsigned int seed = static_cast<unsigned int>(std::time(0))); void init(unsigned int); double get_prob(); private: std::tr1::mt19937 _M_generator; }; /// Thown by throw_allocator. struct forced_exception_error : public std::exception { }; // Substitute for concurrence_error object in the case of -fno-exceptions. inline void __throw_forced_exception_error() { #if __EXCEPTIONS throw forced_exception_error(); #else __builtin_abort(); #endif } /// Base class. class throw_allocator_base { public: void init(unsigned long seed); static void set_throw_prob(double throw_prob); static double get_throw_prob(); static void set_label(size_t l); static bool empty(); struct group_throw_prob_adjustor { group_throw_prob_adjustor(size_t size) : _M_throw_prob_orig(_S_throw_prob) { _S_throw_prob = 1 - std::pow(double(1 - _S_throw_prob), double(0.5 / (size + 1))); } ~group_throw_prob_adjustor() { _S_throw_prob = _M_throw_prob_orig; } private: const double _M_throw_prob_orig; }; struct zero_throw_prob_adjustor { zero_throw_prob_adjustor() : _M_throw_prob_orig(_S_throw_prob) { _S_throw_prob = 0; } ~zero_throw_prob_adjustor() { _S_throw_prob = _M_throw_prob_orig; } private: const double _M_throw_prob_orig; }; protected: static void insert(void*, size_t); static void erase(void*, size_t); static void throw_conditionally(); // See if a particular address and size has been allocated by this // allocator. static void check_allocated(void*, size_t); // See if a given label has been allocated by this allocator. static void check_allocated(size_t); private: typedef std::pair<size_t, size_t> alloc_data_type; typedef std::map<void*, alloc_data_type> map_type; typedef map_type::value_type entry_type; typedef map_type::const_iterator const_iterator; typedef map_type::const_reference const_reference; friend std::ostream& operator<<(std::ostream&, const throw_allocator_base&); static entry_type make_entry(void*, size_t); static void print_to_string(std::string&); static void print_to_string(std::string&, const_reference); static twister_rand_gen _S_g; static map_type _S_map; static double _S_throw_prob; static size_t _S_label; }; /// Allocator class with logging and exception control. template<typename T> class throw_allocator : public throw_allocator_base { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef T value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; template<typename U> struct rebind { typedef throw_allocator<U> other; }; throw_allocator() throw() { } throw_allocator(const throw_allocator&) throw() { } template<typename U> throw_allocator(const throw_allocator<U>&) throw() { } ~throw_allocator() throw() { } size_type max_size() const throw() { return std::allocator<value_type>().max_size(); } pointer allocate(size_type __n, std::allocator<void>::const_pointer hint = 0) { if (__builtin_expect(__n > this->max_size(), false)) std::__throw_bad_alloc(); throw_conditionally(); value_type* const a = std::allocator<value_type>().allocate(__n, hint); insert(a, sizeof(value_type) * __n); return a; } void construct(pointer __p, const T& val) { return std::allocator<value_type>().construct(__p, val); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ template<typename... _Args> void construct(pointer __p, _Args&&... __args) { return std::allocator<value_type>(). construct(__p, std::forward<_Args>(__args)...); } #endif void destroy(pointer __p) { std::allocator<value_type>().destroy(__p); } void deallocate(pointer __p, size_type __n) { erase(__p, sizeof(value_type) * __n); std::allocator<value_type>().deallocate(__p, __n); } void check_allocated(pointer __p, size_type __n) { throw_allocator_base::check_allocated(__p, sizeof(value_type) * __n); } void check_allocated(size_type label) { throw_allocator_base::check_allocated(label); } }; template<typename T> inline bool operator==(const throw_allocator<T>&, const throw_allocator<T>&) { return true; } template<typename T> inline bool operator!=(const throw_allocator<T>&, const throw_allocator<T>&) { return false; } std::ostream& operator<<(std::ostream& os, const throw_allocator_base& alloc) { std::string error; throw_allocator_base::print_to_string(error); os << error; return os; } // XXX Should be in .cc. twister_rand_gen:: twister_rand_gen(unsigned int seed) : _M_generator(seed) { } void twister_rand_gen:: init(unsigned int seed) { _M_generator.seed(seed); } double twister_rand_gen:: get_prob() { const double eng_min = _M_generator.min(); const double eng_range = static_cast<const double>(_M_generator.max() - eng_min); const double eng_res = static_cast<const double>(_M_generator() - eng_min); const double ret = eng_res / eng_range; _GLIBCXX_DEBUG_ASSERT(ret >= 0 && ret <= 1); return ret; } twister_rand_gen throw_allocator_base::_S_g; throw_allocator_base::map_type throw_allocator_base::_S_map; double throw_allocator_base::_S_throw_prob; size_t throw_allocator_base::_S_label = 0; throw_allocator_base::entry_type throw_allocator_base::make_entry(void* p, size_t size) { return std::make_pair(p, alloc_data_type(_S_label, size)); } void throw_allocator_base::init(unsigned long seed) { _S_g.init(seed); } void throw_allocator_base::set_throw_prob(double throw_prob) { _S_throw_prob = throw_prob; } double throw_allocator_base::get_throw_prob() { return _S_throw_prob; } void throw_allocator_base::set_label(size_t l) { _S_label = l; } void throw_allocator_base::insert(void* p, size_t size) { const_iterator found_it = _S_map.find(p); if (found_it != _S_map.end()) { std::string error("throw_allocator_base::insert"); error += "double insert!"; error += '\n'; print_to_string(error, make_entry(p, size)); print_to_string(error, *found_it); std::__throw_logic_error(error.c_str()); } _S_map.insert(make_entry(p, size)); } bool throw_allocator_base::empty() { return _S_map.empty(); } void throw_allocator_base::erase(void* p, size_t size) { check_allocated(p, size); _S_map.erase(p); } void throw_allocator_base::check_allocated(void* p, size_t size) { const_iterator found_it = _S_map.find(p); if (found_it == _S_map.end()) { std::string error("throw_allocator_base::check_allocated by value "); error += "null erase!"; error += '\n'; print_to_string(error, make_entry(p, size)); std::__throw_logic_error(error.c_str()); } if (found_it->second.second != size) { std::string error("throw_allocator_base::check_allocated by value "); error += "wrong-size erase!"; error += '\n'; print_to_string(error, make_entry(p, size)); print_to_string(error, *found_it); std::__throw_logic_error(error.c_str()); } } void throw_allocator_base::check_allocated(size_t label) { std::string found; const_iterator it = _S_map.begin(); while (it != _S_map.end()) { if (it->second.first == label) print_to_string(found, *it); ++it; } if (!found.empty()) { std::string error("throw_allocator_base::check_allocated by label "); error += '\n'; error += found; std::__throw_logic_error(error.c_str()); } } void throw_allocator_base::throw_conditionally() { if (_S_g.get_prob() < _S_throw_prob) __throw_forced_exception_error(); } void throw_allocator_base::print_to_string(std::string& s) { const_iterator begin = throw_allocator_base::_S_map.begin(); const_iterator end = throw_allocator_base::_S_map.end(); for (; begin != end; ++begin) print_to_string(s, *begin); } void throw_allocator_base::print_to_string(std::string& s, const_reference ref) { char buf[40]; const char tab('\t'); s += "address: "; __builtin_sprintf(buf, "%p", ref.first); s += buf; s += tab; s += "label: "; unsigned long l = static_cast<unsigned long>(ref.second.first); __builtin_sprintf(buf, "%lu", l); s += buf; s += tab; s += "size: "; l = static_cast<unsigned long>(ref.second.second); __builtin_sprintf(buf, "%lu", l); s += buf; s += '\n'; } _GLIBCXX_END_NAMESPACE #endif
[ "xufeiwaei@gmail.com" ]
xufeiwaei@gmail.com
bf378037d2180b24233cdcb04460414bb2539e5d
b51a937d9ec5ed8397dfbdcd8a18ead5fa2c5050
/test/copy_test.cpp
3a61cddcf756402f2a32a46e753e2ece07ca1486
[]
no_license
sabjohnso/range
81e35a4835a586e02f47085dea213f44eaa5c8b8
96ed2f21dacf12b805566d3455d2107f0b3bf34b
refs/heads/master
2021-01-10T21:39:33.520504
2015-07-30T00:02:11
2015-07-30T00:02:11
39,924,397
0
0
null
null
null
null
UTF-8
C++
false
false
1,252
cpp
/** @file copy_test.cpp @brief Test the range based copy algorithm @copyright 2015 Samuel B. Johnson @author: Samuel B. Johnson <sabjohnso@yahoo.com> */ // Standard header files #include <vector> #include <iterator> // Third-party header files #include <combine/macro_tools.hpp> // range header files #include <range/range.hpp> int main () { { std::vector<int> x = { 10, 20, 30, 40, 50, 60, 70 }; std::vector<int> y; range::copy( x, std::back_inserter( y )); COMBINE_TEST_EQUAL( x.size(), y.size()); auto itx = begin( x ); auto lastx = end( x ); auto ity = begin( y ); auto lasty = end( y ); while( itx != lastx && ity != lasty ) { COMBINE_TEST_EQUAL( *itx, *ity ); ++itx; ++ity; } } { const std::vector<int> x = { 10, 20, 30, 40, 50, 60, 70 }; std::vector<int> y; range::copy( x, std::back_inserter( y )); COMBINE_TEST_EQUAL( x.size(), y.size()); auto itx = begin( x ); auto lastx = end( x ); auto ity = begin( y ); auto lasty = end( y ); while( itx != lastx && ity != lasty ) { COMBINE_TEST_EQUAL( *itx, *ity ); ++itx; ++ity; } } return 0; }
[ "sabjohnso@yahoo.com" ]
sabjohnso@yahoo.com
a87c20fbff0155f5c1c524992a6dc26b5252ff75
d2190cbb5ea5463410eb84ec8b4c6a660e4b3d0e
/hydra2-4.9w/base/util/hseed.h
299fb3634400031660d0372d2ba61cb3d8cdf408
[]
no_license
wesmail/hydra
6c681572ff6db2c60c9e36ec864a3c0e83e6aa6a
ab934d4c7eff335cc2d25f212034121f050aadf1
refs/heads/master
2021-07-05T17:04:53.402387
2020-08-12T08:54:11
2020-08-12T08:54:11
149,625,232
0
0
null
null
null
null
UTF-8
C++
false
false
1,951
h
#ifndef HSEED_H #define HSEED_H #include "TObject.h" #include "TString.h" #include "TRandom3.h" class HSeed : public TObject { private: Int_t fMethod; // 0 (default) : /dev/random, // 1 : TRandom3 (local) with systime , // 2 : TRandom3 (local) with systime + processid + iplast, // 3 : like 1 but gRandom, // 4 : like 2 but gRandom, // 5 : fixed (needs seed to be set) Int_t fFallBack; // case /dev/random is not available : default 2 Bool_t fNoBlock; // default kTRUE switch /dev/radom to /dev/urandom to avoid blocking (less randomness!) Int_t fFixedSeed ; // default -1 setFixedSeed() Int_t fInitialSeed; // default -1, stores the seed input gRandom Int_t fFirstSeed; // default -1, stores the first seed generated TString fHostname; // hostname of execution UInt_t fAddress; // 4 * 8bit address fields UInt_t fPid; // process id TRandom3 fGenerator; //! Int_t fFileHandle; //! filehandle for /dev/random TRandom* frandom; //! pointer to use generator public: HSeed(Int_t method=0,Int_t fallback=2,Int_t fixedseed=-1, Bool_t noBlock = kTRUE) ; ~HSeed(); UInt_t getPid(); UInt_t getIP(); UInt_t getIPPart(UInt_t field=0); Int_t getSeed(); Int_t getMethod() { return fMethod; } Int_t getFallBack() { return fFallBack; } Int_t getFixedSeed() { return fInitialSeed;} Int_t getInitialSeed() { return fInitialSeed;} Int_t getFirstSeed() { return fFirstSeed; } TString getHostName() { return fHostname; } UInt_t getAddress() { return fAddress; } void print(); ClassDef(HSeed,1) }; #endif /*! HSEED_H */
[ "w.esmail@fz-juelich.de" ]
w.esmail@fz-juelich.de
69ef13fbf945ba8e55905b2a804d8fc112c1c837
746bbef0f5ab866864ce47f57fb31220816a91d7
/graphics/glmatrix.hpp
7af39b599d57804400e7fdb8aeff5c2a2cc5e83b
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
hirakuni45/RX
baf64286b70132eb41db7ed52c6a2f9b70cf0f45
679878b98d0c03597e16431e87e75a9a24f5c8d1
refs/heads/master
2023-05-04T13:27:26.894545
2023-04-18T13:54:06
2023-04-18T13:54:06
14,785,870
65
19
BSD-3-Clause
2023-09-14T01:41:49
2013-11-28T20:27:58
C++
UTF-8
C++
false
false
16,739
hpp
#pragma once //=====================================================================// /*! @file @brief OpenGL マトリックス・エミュレーター @author 平松邦仁 (hira@rvf-rc45.net) @copyright Copyright (C) 2017, 2021 Kunihito Hiramatsu @n Released under the MIT license @n https://github.com/hirakuni45/RX/blob/master/LICENSE */ //=====================================================================// #include "common/vtx.hpp" #include "common/mtx.hpp" #include "common/fixed_stack.hpp" #include "common/format.hpp" namespace gl { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// /*! @brief OpenGL matrix エミュレータークラス @param[in] T 基本型(float、又は double) */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// template <typename T> struct matrix { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// /*! @brief マトリックス・モード */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// enum class mode { modelview, projection, num_ }; typedef T value_type; typedef mtx::matrix4<T> matrix_type; private: static constexpr uint32_t STACK_SIZE = 4; mode mode_; matrix_type acc_[static_cast<int>(mode::num_)]; typedef utils::fixed_stack<matrix_type, STACK_SIZE> STACK; STACK stack_; T near_; T far_; int vp_x_; int vp_y_; int vp_w_; int vp_h_; public: //-----------------------------------------------------------------// /*! @brief OpenGL 系マトリックス操作コンストラクター */ //-----------------------------------------------------------------// matrix() : mode_(mode::modelview), near_(0.0f), far_(1.0f), vp_x_(0), vp_y_(0), vp_w_(0), vp_h_(0) { } //-----------------------------------------------------------------// /*! @brief OpenGL マトリックスモードを設定 @param[in] md マトリックス・モード */ //-----------------------------------------------------------------// void set_mode(mode md) { mode_ = md; } //-----------------------------------------------------------------// /*! @brief OpenGL マトリックスモードを取得 @return マトリックスモード */ //-----------------------------------------------------------------// mode get_mode() const { return mode_; } //-----------------------------------------------------------------// /*! @brief OpenGL ビューポートを取り出す。 @param[in] x X 軸の位置 @param[in] y Y 軸の位置 @param[in] w X 軸の幅 @param[in] h Y 軸の高さ */ //-----------------------------------------------------------------// void get_viewport(int& x, int& y, int& w, int& h) const { x = vp_x_; y = vp_y_; w = vp_w_; h = vp_h_; } //-----------------------------------------------------------------// /*! @brief OpenGL ビューポートの設定 @param[in] x X 軸の位置 @param[in] y Y 軸の位置 @param[in] w X 軸の幅 @param[in] h Y 軸の高さ */ //-----------------------------------------------------------------// void set_viewport(int x, int y, int w, int h) { vp_x_ = x; vp_y_ = y; vp_w_ = w; vp_h_ = h; } //-----------------------------------------------------------------// /*! @brief OpenGL カレント・マトリックスに単位行列をセット */ //-----------------------------------------------------------------// void identity() noexcept { acc_[static_cast<int>(mode_)].identity(); } //-----------------------------------------------------------------// /*! @brief カレント・マトリックスにロード @param[in] m マトリックスのポインター先頭(fmat4) */ //-----------------------------------------------------------------// void load(const value_type& m) { acc_[static_cast<int>(mode_)] = m; } //-----------------------------------------------------------------// /*! @brief カレント・マトリックスにロード @param[in] m マトリックスのポインター先頭(float) */ //-----------------------------------------------------------------// void load(const T* m) { acc_[static_cast<int>(mode_)] = m; } //-----------------------------------------------------------------// /*! @brief カレント・マトリックスにロード @param[in] m マトリックスのポインター先頭(double) */ //-----------------------------------------------------------------// void load(const double* m) { acc_[static_cast<int>(mode_)] = m; } //-----------------------------------------------------------------// /*! @brief OpenGL 4 X 4 行列をカレント・マトリックスと積算 @param[in] m 4 X 4 マトリックス */ //-----------------------------------------------------------------// void mult(const mtx::matrix4<T>& m) { mtx::matmul4<T>(acc_[static_cast<int>(mode_)].m, acc_[static_cast<int>(mode_)].m, m.m); } //-----------------------------------------------------------------// /*! @brief OpenGL 4 X 4 行列をカレント・マトリックスと積算 @param[in] m マトリックス列(float) */ //-----------------------------------------------------------------// void mult(const float* m) { mtx::matrix4<T> tm = m; mtx::matmul4<T>(acc_[static_cast<int>(mode_)].m, acc_[static_cast<int>(mode_)].m, tm.m); } //-----------------------------------------------------------------// /*! @brief OpenGL 4 X 4 行列をカレント・マトリックスと積算 @param[in] m マトリックス列(double) */ //-----------------------------------------------------------------// void mult(const double* m) { mtx::matrix4<T> tm = m; mtx::matmul4<T>(acc_[static_cast<int>(mode_)].m, acc_[static_cast<int>(mode_)].m, tm.m); } //-----------------------------------------------------------------// /*! @brief OpenGL カレント・マトリックスをスタックに退避 */ //-----------------------------------------------------------------// void push() { stack_[static_cast<int>(mode_)].push(acc_[static_cast<int>(mode_)]); } //-----------------------------------------------------------------// /*! @brief OpenGL カレント・マトリックスをスタックから復帰 */ //-----------------------------------------------------------------// void pop() { stack_[static_cast<int>(mode_)].pop(); acc_[static_cast<int>(mode_)] = stack_[static_cast<int>(mode_)].top(); } //-----------------------------------------------------------------// /*! @brief OpenGL 視体積行列をカレント・マトリックスに合成する @param[in] left クリップ平面上の位置(左) @param[in] right クリップ平面上の位置(右) @param[in] bottom クリップ平面上の位置(下) @param[in] top クリップ平面上の位置(上) @param[in] nearval クリップ平面上の位置(手前) @param[in] farval クリップ平面上の位置(奥) */ //-----------------------------------------------------------------// void frustum(T left, T right, T bottom, T top, T nearval, T farval) { near_ = nearval; far_ = farval; acc_[static_cast<int>(mode_)].frustum(left, right, bottom, top, nearval, farval); } //-----------------------------------------------------------------// /*! @brief OpenGL 正射影行列をカレント・マトリックスに合成する @param[in] left クリップ平面上の位置(左) @param[in] right クリップ平面上の位置(右) @param[in] bottom クリップ平面上の位置(下) @param[in] top クリップ平面上の位置(上) @param[in] nearval クリップ平面上の位置(手前) @param[in] farval クリップ平面上の位置(奥) */ //-----------------------------------------------------------------// void ortho(T left, T right, T bottom, T top, T nearval, T farval) { near_ = nearval; far_ = farval; acc_[static_cast<int>(mode_)].ortho(left, right, bottom, top, nearval, farval); } //-----------------------------------------------------------------// /*! @brief OpenGL/GLU gluPerspective と同等な行列をカレント・マトリックスに合成する @param[in] fovy 視野角度 @param[in] aspect アスペクト比 @param[in] nearval クリップ平面上の位置(手前) @param[in] farval クリップ平面上の位置(奥) */ //-----------------------------------------------------------------// void perspective(T fovy, T aspect, T nearval, T farval) { near_ = nearval; far_ = farval; acc_[static_cast<int>(mode_)].perspective(fovy, aspect, nearval, farval); } //-----------------------------------------------------------------// /*! @brief OpenGL/GLU gluLookAt と同等な行列をカレント・マトリックスに合成する @param[in] eye カメラの位置 @param[in] center 視線方向 @param[in] up カメラの上向き方向ベクトル */ //-----------------------------------------------------------------// void look_at(const vtx::vertex3<T>& eye, const vtx::vertex3<T>& center, const vtx::vertex3<T>& up) { acc_[static_cast<int>(mode_)].look_at(eye, center, up); } //-----------------------------------------------------------------// /*! @brief OpenGL スケール @param[in] v スケール */ //-----------------------------------------------------------------// void scale(const vtx::vertex3<T>& v) { acc_[static_cast<int>(mode_)].scale(v); } //-----------------------------------------------------------------// /*! @brief OpenGL スケール @param[in] x X スケール @param[in] y Y スケール @param[in] z Z スケール */ //-----------------------------------------------------------------// void scale(T x, T y, T z) { acc_[static_cast<int>(mode_)].scale(vtx::vertex3<T>(x, y, z)); } //-----------------------------------------------------------------// /*! @brief OpenGL 移動行列をカレント・マトリックスに合成する @param[in] x X 軸移動量 @param[in] y Y 軸移動量 @param[in] z Z 軸移動量 */ //-----------------------------------------------------------------// void translate(T x, T y, T z) { acc_[static_cast<int>(mode_)].translate(vtx::vertex3<T>(x, y, z)); } //-----------------------------------------------------------------// /*! @brief OpenGL 回転行列をカレント・マトリックスに合成する @param[in] angle 0 〜 360 度の(DEG)角度 @param[in] x 回転中心の X 要素 @param[in] y 回転中心の Y 要素 @param[in] z 回転中心の Z 要素 */ //-----------------------------------------------------------------// void rotate(T angle, T x, T y, T z) { acc_[static_cast<int>(mode_)].rotate(angle, vtx::vertex3<T>(x, y, z)); }; //-----------------------------------------------------------------// /*! @brief カレント・マトリックスを参照 @return OpenGL 並びの、ベースマトリックス */ //-----------------------------------------------------------------// matrix_type& at_current_matrix() { return acc_[static_cast<int>(mode_)]; }; //-----------------------------------------------------------------// /*! @brief カレント・マトリックスを得る @return OpenGL 並びの、ベースマトリックス */ //-----------------------------------------------------------------// const matrix_type& get_current_matrix() const { return acc_[static_cast<int>(mode_)]; }; //-----------------------------------------------------------------// /*! @brief プロジェクション・マトリックスを得る @return OpenGL 並びの、ベースマトリックス */ //-----------------------------------------------------------------// const matrix_type& get_projection_matrix() const { return acc_[mode::projection]; }; //-----------------------------------------------------------------// /*! @brief モデル・マトリックスを得る @return OpenGL 並びの、ベースマトリックス */ //-----------------------------------------------------------------// const matrix_type& get_modelview_matrix() const { return acc_[mode::modelview]; }; //-----------------------------------------------------------------// /*! @brief ワールド・マトリックス(最終)を計算する @return OpenGL 並びの、ワールド・マトリックス */ //-----------------------------------------------------------------// void world_matrix(matrix_type& mat) const noexcept { const auto& pm = acc_[static_cast<int>(mode::projection)]; const auto& mm = acc_[static_cast<int>(mode::modelview)]; mtx::matmul4(mat(), pm(), mm()); } //-----------------------------------------------------------------// /*! @brief 頂点から変換された座標を得る @param[in] mat ベース・マトリックス @param[in] inv 頂点 @param[out] out 変換された座標 @param[out] scr スクリーン座標 */ //-----------------------------------------------------------------// void vertex(const matrix_type& mat, const vtx::vertex3<T>& inv, vtx::vertex3<T>& out, vtx::vertex3<T>& scr) const noexcept { vtx::vertex4<T> in = inv; T o[4]; mtx::matmul1<T>(o, mat(), in.getXYZW()); out.set(o[0], o[1], o[2]); T invw = static_cast<T>(1) / o[3]; T w = (far_ * near_) / (far_ - near_) * invw; scr.set(out.x * invw, out.y * invw, w); } //-----------------------------------------------------------------// /*! @brief 頂点から変換されたワールド座標を得る @param[in] mat ベース・マトリックス @param[in] inv 頂点 @param[out] out 結果を受け取るベクター */ //-----------------------------------------------------------------// static void vertex_world(const matrix_type& mat, const vtx::vertex3<T>& inv, vtx::vertex4<T>& out) { vtx::vertex4<T> in = inv; T o[4]; mtx::matmul1<T>(o, mat(), in.getXYZW()); out.set(o[0], o[1], o[2], o[3]); } //-----------------------------------------------------------------// /*! @brief 頂点から正規化されたスクリーン座標を得る @param[in] mat ベース・マトリックス @param[in] inv 頂点 @param[out] outv 結果を受け取るベクター */ //-----------------------------------------------------------------// void vertex_screen(const mtx::matrix4<T>& mat, const vtx::vertex3<T>& inv, vtx::vertex3<T>& outv) const noexcept { T out[4]; vtx::vertex4<T> in = inv; mtx::matmul1<T>(out, mat(), in.getXYZW()); T invw = 1.0f / out[3]; T w = (far_ * near_) / (far_ - near_) * invw; outv.set(out[0] * invw, out[1] * invw, w); } //-----------------------------------------------------------------// /*! @brief マウス座標を正規化する @param[in] mspos マウス位置(左上が0,0) @param[in] rpos 正規化された位置 */ //-----------------------------------------------------------------// void regularization_mouse_position(const vtx::spos& mspos, vtx::vertex2<T>& rpos) const { T fw = static_cast<T>(vp_w_) / static_cast<T>(2); T fh = static_cast<T>(vp_h_) / static_cast<T>(2); rpos.set((static_cast<float>(mspos.x) - fw) / fw, (fh - static_cast<float>(mspos.y)) / fh); } //-----------------------------------------------------------------// /*! @brief カレント・マトリックスの表示 */ //-----------------------------------------------------------------// void print_matrix() { for(int i = 0; i < 4; ++i) { utils::format("(%d) %-6.5f, %-6.5f, %-6.5f, %-6.5f\n") % i % acc_[static_cast<int>(mode_)].m[0 * 4 + i] % acc_[static_cast<int>(mode_)].m[1 * 4 + i] % acc_[static_cast<int>(mode_)].m[2 * 4 + i] % acc_[static_cast<int>(mode_)].m[3 * 4 + i]; } } }; typedef matrix<float> matrixf; typedef matrix<double> matrixd; }
[ "hira@rvf-rc45.net" ]
hira@rvf-rc45.net
3905e690a6969b12cbae3639ba8822e575283714
c776476e9d06b3779d744641e758ac3a2c15cddc
/examples/litmus/c/run-scripts/tmp_1/WWC+ctrl+ctrlisb.c.cbmc_out.cpp
6e5527a149f5e36133eeb608e36c7afdf40159e5
[]
no_license
ashutosh0gupta/llvm_bmc
aaac7961c723ba6f7ffd77a39559e0e52432eade
0287c4fb180244e6b3c599a9902507f05c8a7234
refs/heads/master
2023-08-02T17:14:06.178723
2023-07-31T10:46:53
2023-07-31T10:46:53
143,100,825
3
4
null
2023-05-25T05:50:55
2018-08-01T03:47:00
C++
UTF-8
C++
false
false
36,823
cpp
// 0:vars:2 // 2:atom_1_X0_2:1 // 3:atom_2_X0_1:1 // 4:thr0:1 // 5:thr1:1 // 6:thr2:1 #define ADDRSIZE 7 #define NPROC 4 #define NCONTEXT 1 #define ASSUME(stmt) __CPROVER_assume(stmt) #define ASSERT(stmt) __CPROVER_assert(stmt, "error") #define max(a,b) (a>b?a:b) char __get_rng(); char get_rng( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } char get_rng_th( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } int main(int argc, char **argv) { // declare arrays for intial value version in contexts int meminit_[ADDRSIZE*NCONTEXT]; #define meminit(x,k) meminit_[(x)*NCONTEXT+k] int coinit_[ADDRSIZE*NCONTEXT]; #define coinit(x,k) coinit_[(x)*NCONTEXT+k] int deltainit_[ADDRSIZE*NCONTEXT]; #define deltainit(x,k) deltainit_[(x)*NCONTEXT+k] // declare arrays for running value version in contexts int mem_[ADDRSIZE*NCONTEXT]; #define mem(x,k) mem_[(x)*NCONTEXT+k] int co_[ADDRSIZE*NCONTEXT]; #define co(x,k) co_[(x)*NCONTEXT+k] int delta_[ADDRSIZE*NCONTEXT]; #define delta(x,k) delta_[(x)*NCONTEXT+k] // declare arrays for local buffer and observed writes int buff_[NPROC*ADDRSIZE]; #define buff(x,k) buff_[(x)*ADDRSIZE+k] int pw_[NPROC*ADDRSIZE]; #define pw(x,k) pw_[(x)*ADDRSIZE+k] // declare arrays for context stamps char cr_[NPROC*ADDRSIZE]; #define cr(x,k) cr_[(x)*ADDRSIZE+k] char iw_[NPROC*ADDRSIZE]; #define iw(x,k) iw_[(x)*ADDRSIZE+k] char cw_[NPROC*ADDRSIZE]; #define cw(x,k) cw_[(x)*ADDRSIZE+k] char cx_[NPROC*ADDRSIZE]; #define cx(x,k) cx_[(x)*ADDRSIZE+k] char is_[NPROC*ADDRSIZE]; #define is(x,k) is_[(x)*ADDRSIZE+k] char cs_[NPROC*ADDRSIZE]; #define cs(x,k) cs_[(x)*ADDRSIZE+k] char crmax_[NPROC*ADDRSIZE]; #define crmax(x,k) crmax_[(x)*ADDRSIZE+k] char sforbid_[ADDRSIZE*NCONTEXT]; #define sforbid(x,k) sforbid_[(x)*NCONTEXT+k] // declare arrays for synchronizations int cl[NPROC]; int cdy[NPROC]; int cds[NPROC]; int cdl[NPROC]; int cisb[NPROC]; int caddr[NPROC]; int cctrl[NPROC]; int cstart[NPROC]; int creturn[NPROC]; // declare arrays for contexts activity int active[NCONTEXT]; int ctx_used[NCONTEXT]; int r0= 0; char creg_r0; int r1= 0; char creg_r1; int r2= 0; char creg_r2; int r3= 0; char creg_r3; int r4= 0; char creg_r4; int r5= 0; char creg_r5; int r6= 0; char creg_r6; int r7= 0; char creg_r7; int r8= 0; char creg_r8; int r9= 0; char creg_r9; int r10= 0; char creg_r10; int r11= 0; char creg_r11; char old_cctrl= 0; char old_cr= 0; char old_cdy= 0; char old_cw= 0; char new_creg= 0; buff(0,0) = 0; pw(0,0) = 0; cr(0,0) = 0; iw(0,0) = 0; cw(0,0) = 0; cx(0,0) = 0; is(0,0) = 0; cs(0,0) = 0; crmax(0,0) = 0; buff(0,1) = 0; pw(0,1) = 0; cr(0,1) = 0; iw(0,1) = 0; cw(0,1) = 0; cx(0,1) = 0; is(0,1) = 0; cs(0,1) = 0; crmax(0,1) = 0; buff(0,2) = 0; pw(0,2) = 0; cr(0,2) = 0; iw(0,2) = 0; cw(0,2) = 0; cx(0,2) = 0; is(0,2) = 0; cs(0,2) = 0; crmax(0,2) = 0; buff(0,3) = 0; pw(0,3) = 0; cr(0,3) = 0; iw(0,3) = 0; cw(0,3) = 0; cx(0,3) = 0; is(0,3) = 0; cs(0,3) = 0; crmax(0,3) = 0; buff(0,4) = 0; pw(0,4) = 0; cr(0,4) = 0; iw(0,4) = 0; cw(0,4) = 0; cx(0,4) = 0; is(0,4) = 0; cs(0,4) = 0; crmax(0,4) = 0; buff(0,5) = 0; pw(0,5) = 0; cr(0,5) = 0; iw(0,5) = 0; cw(0,5) = 0; cx(0,5) = 0; is(0,5) = 0; cs(0,5) = 0; crmax(0,5) = 0; buff(0,6) = 0; pw(0,6) = 0; cr(0,6) = 0; iw(0,6) = 0; cw(0,6) = 0; cx(0,6) = 0; is(0,6) = 0; cs(0,6) = 0; crmax(0,6) = 0; cl[0] = 0; cdy[0] = 0; cds[0] = 0; cdl[0] = 0; cisb[0] = 0; caddr[0] = 0; cctrl[0] = 0; cstart[0] = get_rng(0,NCONTEXT-1); creturn[0] = get_rng(0,NCONTEXT-1); buff(1,0) = 0; pw(1,0) = 0; cr(1,0) = 0; iw(1,0) = 0; cw(1,0) = 0; cx(1,0) = 0; is(1,0) = 0; cs(1,0) = 0; crmax(1,0) = 0; buff(1,1) = 0; pw(1,1) = 0; cr(1,1) = 0; iw(1,1) = 0; cw(1,1) = 0; cx(1,1) = 0; is(1,1) = 0; cs(1,1) = 0; crmax(1,1) = 0; buff(1,2) = 0; pw(1,2) = 0; cr(1,2) = 0; iw(1,2) = 0; cw(1,2) = 0; cx(1,2) = 0; is(1,2) = 0; cs(1,2) = 0; crmax(1,2) = 0; buff(1,3) = 0; pw(1,3) = 0; cr(1,3) = 0; iw(1,3) = 0; cw(1,3) = 0; cx(1,3) = 0; is(1,3) = 0; cs(1,3) = 0; crmax(1,3) = 0; buff(1,4) = 0; pw(1,4) = 0; cr(1,4) = 0; iw(1,4) = 0; cw(1,4) = 0; cx(1,4) = 0; is(1,4) = 0; cs(1,4) = 0; crmax(1,4) = 0; buff(1,5) = 0; pw(1,5) = 0; cr(1,5) = 0; iw(1,5) = 0; cw(1,5) = 0; cx(1,5) = 0; is(1,5) = 0; cs(1,5) = 0; crmax(1,5) = 0; buff(1,6) = 0; pw(1,6) = 0; cr(1,6) = 0; iw(1,6) = 0; cw(1,6) = 0; cx(1,6) = 0; is(1,6) = 0; cs(1,6) = 0; crmax(1,6) = 0; cl[1] = 0; cdy[1] = 0; cds[1] = 0; cdl[1] = 0; cisb[1] = 0; caddr[1] = 0; cctrl[1] = 0; cstart[1] = get_rng(0,NCONTEXT-1); creturn[1] = get_rng(0,NCONTEXT-1); buff(2,0) = 0; pw(2,0) = 0; cr(2,0) = 0; iw(2,0) = 0; cw(2,0) = 0; cx(2,0) = 0; is(2,0) = 0; cs(2,0) = 0; crmax(2,0) = 0; buff(2,1) = 0; pw(2,1) = 0; cr(2,1) = 0; iw(2,1) = 0; cw(2,1) = 0; cx(2,1) = 0; is(2,1) = 0; cs(2,1) = 0; crmax(2,1) = 0; buff(2,2) = 0; pw(2,2) = 0; cr(2,2) = 0; iw(2,2) = 0; cw(2,2) = 0; cx(2,2) = 0; is(2,2) = 0; cs(2,2) = 0; crmax(2,2) = 0; buff(2,3) = 0; pw(2,3) = 0; cr(2,3) = 0; iw(2,3) = 0; cw(2,3) = 0; cx(2,3) = 0; is(2,3) = 0; cs(2,3) = 0; crmax(2,3) = 0; buff(2,4) = 0; pw(2,4) = 0; cr(2,4) = 0; iw(2,4) = 0; cw(2,4) = 0; cx(2,4) = 0; is(2,4) = 0; cs(2,4) = 0; crmax(2,4) = 0; buff(2,5) = 0; pw(2,5) = 0; cr(2,5) = 0; iw(2,5) = 0; cw(2,5) = 0; cx(2,5) = 0; is(2,5) = 0; cs(2,5) = 0; crmax(2,5) = 0; buff(2,6) = 0; pw(2,6) = 0; cr(2,6) = 0; iw(2,6) = 0; cw(2,6) = 0; cx(2,6) = 0; is(2,6) = 0; cs(2,6) = 0; crmax(2,6) = 0; cl[2] = 0; cdy[2] = 0; cds[2] = 0; cdl[2] = 0; cisb[2] = 0; caddr[2] = 0; cctrl[2] = 0; cstart[2] = get_rng(0,NCONTEXT-1); creturn[2] = get_rng(0,NCONTEXT-1); buff(3,0) = 0; pw(3,0) = 0; cr(3,0) = 0; iw(3,0) = 0; cw(3,0) = 0; cx(3,0) = 0; is(3,0) = 0; cs(3,0) = 0; crmax(3,0) = 0; buff(3,1) = 0; pw(3,1) = 0; cr(3,1) = 0; iw(3,1) = 0; cw(3,1) = 0; cx(3,1) = 0; is(3,1) = 0; cs(3,1) = 0; crmax(3,1) = 0; buff(3,2) = 0; pw(3,2) = 0; cr(3,2) = 0; iw(3,2) = 0; cw(3,2) = 0; cx(3,2) = 0; is(3,2) = 0; cs(3,2) = 0; crmax(3,2) = 0; buff(3,3) = 0; pw(3,3) = 0; cr(3,3) = 0; iw(3,3) = 0; cw(3,3) = 0; cx(3,3) = 0; is(3,3) = 0; cs(3,3) = 0; crmax(3,3) = 0; buff(3,4) = 0; pw(3,4) = 0; cr(3,4) = 0; iw(3,4) = 0; cw(3,4) = 0; cx(3,4) = 0; is(3,4) = 0; cs(3,4) = 0; crmax(3,4) = 0; buff(3,5) = 0; pw(3,5) = 0; cr(3,5) = 0; iw(3,5) = 0; cw(3,5) = 0; cx(3,5) = 0; is(3,5) = 0; cs(3,5) = 0; crmax(3,5) = 0; buff(3,6) = 0; pw(3,6) = 0; cr(3,6) = 0; iw(3,6) = 0; cw(3,6) = 0; cx(3,6) = 0; is(3,6) = 0; cs(3,6) = 0; crmax(3,6) = 0; cl[3] = 0; cdy[3] = 0; cds[3] = 0; cdl[3] = 0; cisb[3] = 0; caddr[3] = 0; cctrl[3] = 0; cstart[3] = get_rng(0,NCONTEXT-1); creturn[3] = get_rng(0,NCONTEXT-1); // Dumping initializations mem(0+0,0) = 0; mem(0+1,0) = 0; mem(2+0,0) = 0; mem(3+0,0) = 0; mem(4+0,0) = 0; mem(5+0,0) = 0; mem(6+0,0) = 0; // Dumping context matching equalities co(0,0) = 0; delta(0,0) = -1; co(1,0) = 0; delta(1,0) = -1; co(2,0) = 0; delta(2,0) = -1; co(3,0) = 0; delta(3,0) = -1; co(4,0) = 0; delta(4,0) = -1; co(5,0) = 0; delta(5,0) = -1; co(6,0) = 0; delta(6,0) = -1; // Dumping thread 1 int ret_thread_1 = 0; cdy[1] = get_rng(0,NCONTEXT-1); ASSUME(cdy[1] >= cstart[1]); T1BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !35, metadata !DIExpression()), !dbg !41 // br label %label_1, !dbg !42 goto T1BLOCK1; T1BLOCK1: // call void @llvm.dbg.label(metadata !40), !dbg !43 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !36, metadata !DIExpression()), !dbg !44 // call void @llvm.dbg.value(metadata i64 2, metadata !39, metadata !DIExpression()), !dbg !44 // store atomic i64 2, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !45 // ST: Guess iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW old_cw = cw(1,0); cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM // Check ASSUME(active[iw(1,0)] == 1); ASSUME(active[cw(1,0)] == 1); ASSUME(sforbid(0,cw(1,0))== 0); ASSUME(iw(1,0) >= 0); ASSUME(iw(1,0) >= 0); ASSUME(cw(1,0) >= iw(1,0)); ASSUME(cw(1,0) >= old_cw); ASSUME(cw(1,0) >= cr(1,0)); ASSUME(cw(1,0) >= cl[1]); ASSUME(cw(1,0) >= cisb[1]); ASSUME(cw(1,0) >= cdy[1]); ASSUME(cw(1,0) >= cdl[1]); ASSUME(cw(1,0) >= cds[1]); ASSUME(cw(1,0) >= cctrl[1]); ASSUME(cw(1,0) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0) = 2; mem(0,cw(1,0)) = 2; co(0,cw(1,0))+=1; delta(0,cw(1,0)) = -1; ASSUME(creturn[1] >= cw(1,0)); // ret i8* null, !dbg !46 ret_thread_1 = (- 1); // Dumping thread 2 int ret_thread_2 = 0; cdy[2] = get_rng(0,NCONTEXT-1); ASSUME(cdy[2] >= cstart[2]); T2BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !49, metadata !DIExpression()), !dbg !64 // br label %label_2, !dbg !52 goto T2BLOCK1; T2BLOCK1: // call void @llvm.dbg.label(metadata !62), !dbg !66 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !52, metadata !DIExpression()), !dbg !67 // %0 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !55 // LD: Guess old_cr = cr(2,0); cr(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0)] == 2); ASSUME(cr(2,0) >= iw(2,0)); ASSUME(cr(2,0) >= 0); ASSUME(cr(2,0) >= cdy[2]); ASSUME(cr(2,0) >= cisb[2]); ASSUME(cr(2,0) >= cdl[2]); ASSUME(cr(2,0) >= cl[2]); // Update creg_r0 = cr(2,0); crmax(2,0) = max(crmax(2,0),cr(2,0)); caddr[2] = max(caddr[2],0); if(cr(2,0) < cw(2,0)) { r0 = buff(2,0); } else { if(pw(2,0) != co(0,cr(2,0))) { ASSUME(cr(2,0) >= old_cr); } pw(2,0) = co(0,cr(2,0)); r0 = mem(0,cr(2,0)); } ASSUME(creturn[2] >= cr(2,0)); // call void @llvm.dbg.value(metadata i64 %0, metadata !54, metadata !DIExpression()), !dbg !67 // %conv = trunc i64 %0 to i32, !dbg !56 // call void @llvm.dbg.value(metadata i32 %conv, metadata !50, metadata !DIExpression()), !dbg !64 // %tobool = icmp ne i32 %conv, 0, !dbg !57 // br i1 %tobool, label %if.then, label %if.else, !dbg !59 old_cctrl = cctrl[2]; cctrl[2] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[2] >= old_cctrl); ASSUME(cctrl[2] >= creg_r0); ASSUME(cctrl[2] >= 0); if((r0!=0)) { goto T2BLOCK2; } else { goto T2BLOCK3; } T2BLOCK2: // br label %lbl_LC00, !dbg !60 goto T2BLOCK4; T2BLOCK3: // br label %lbl_LC00, !dbg !61 goto T2BLOCK4; T2BLOCK4: // call void @llvm.dbg.label(metadata !63), !dbg !75 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !55, metadata !DIExpression()), !dbg !76 // call void @llvm.dbg.value(metadata i64 1, metadata !57, metadata !DIExpression()), !dbg !76 // store atomic i64 1, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !64 // ST: Guess iw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,0+1*1); cw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,0+1*1)] == 2); ASSUME(active[cw(2,0+1*1)] == 2); ASSUME(sforbid(0+1*1,cw(2,0+1*1))== 0); ASSUME(iw(2,0+1*1) >= 0); ASSUME(iw(2,0+1*1) >= 0); ASSUME(cw(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cw(2,0+1*1) >= old_cw); ASSUME(cw(2,0+1*1) >= cr(2,0+1*1)); ASSUME(cw(2,0+1*1) >= cl[2]); ASSUME(cw(2,0+1*1) >= cisb[2]); ASSUME(cw(2,0+1*1) >= cdy[2]); ASSUME(cw(2,0+1*1) >= cdl[2]); ASSUME(cw(2,0+1*1) >= cds[2]); ASSUME(cw(2,0+1*1) >= cctrl[2]); ASSUME(cw(2,0+1*1) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,0+1*1) = 1; mem(0+1*1,cw(2,0+1*1)) = 1; co(0+1*1,cw(2,0+1*1))+=1; delta(0+1*1,cw(2,0+1*1)) = -1; ASSUME(creturn[2] >= cw(2,0+1*1)); // %cmp = icmp eq i32 %conv, 2, !dbg !65 // %conv1 = zext i1 %cmp to i32, !dbg !65 // call void @llvm.dbg.value(metadata i32 %conv1, metadata !58, metadata !DIExpression()), !dbg !64 // call void @llvm.dbg.value(metadata i64* @atom_1_X0_2, metadata !59, metadata !DIExpression()), !dbg !79 // %1 = zext i32 %conv1 to i64 // call void @llvm.dbg.value(metadata i64 %1, metadata !61, metadata !DIExpression()), !dbg !79 // store atomic i64 %1, i64* @atom_1_X0_2 seq_cst, align 8, !dbg !67 // ST: Guess iw(2,2) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,2); cw(2,2) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,2)] == 2); ASSUME(active[cw(2,2)] == 2); ASSUME(sforbid(2,cw(2,2))== 0); ASSUME(iw(2,2) >= max(creg_r0,0)); ASSUME(iw(2,2) >= 0); ASSUME(cw(2,2) >= iw(2,2)); ASSUME(cw(2,2) >= old_cw); ASSUME(cw(2,2) >= cr(2,2)); ASSUME(cw(2,2) >= cl[2]); ASSUME(cw(2,2) >= cisb[2]); ASSUME(cw(2,2) >= cdy[2]); ASSUME(cw(2,2) >= cdl[2]); ASSUME(cw(2,2) >= cds[2]); ASSUME(cw(2,2) >= cctrl[2]); ASSUME(cw(2,2) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,2) = (r0==2); mem(2,cw(2,2)) = (r0==2); co(2,cw(2,2))+=1; delta(2,cw(2,2)) = -1; ASSUME(creturn[2] >= cw(2,2)); // ret i8* null, !dbg !68 ret_thread_2 = (- 1); // Dumping thread 3 int ret_thread_3 = 0; cdy[3] = get_rng(0,NCONTEXT-1); ASSUME(cdy[3] >= cstart[3]); T3BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !84, metadata !DIExpression()), !dbg !98 // br label %label_3, !dbg !52 goto T3BLOCK1; T3BLOCK1: // call void @llvm.dbg.label(metadata !96), !dbg !100 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !86, metadata !DIExpression()), !dbg !101 // %0 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !55 // LD: Guess old_cr = cr(3,0+1*1); cr(3,0+1*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN LDCOM // Check ASSUME(active[cr(3,0+1*1)] == 3); ASSUME(cr(3,0+1*1) >= iw(3,0+1*1)); ASSUME(cr(3,0+1*1) >= 0); ASSUME(cr(3,0+1*1) >= cdy[3]); ASSUME(cr(3,0+1*1) >= cisb[3]); ASSUME(cr(3,0+1*1) >= cdl[3]); ASSUME(cr(3,0+1*1) >= cl[3]); // Update creg_r1 = cr(3,0+1*1); crmax(3,0+1*1) = max(crmax(3,0+1*1),cr(3,0+1*1)); caddr[3] = max(caddr[3],0); if(cr(3,0+1*1) < cw(3,0+1*1)) { r1 = buff(3,0+1*1); } else { if(pw(3,0+1*1) != co(0+1*1,cr(3,0+1*1))) { ASSUME(cr(3,0+1*1) >= old_cr); } pw(3,0+1*1) = co(0+1*1,cr(3,0+1*1)); r1 = mem(0+1*1,cr(3,0+1*1)); } ASSUME(creturn[3] >= cr(3,0+1*1)); // call void @llvm.dbg.value(metadata i64 %0, metadata !88, metadata !DIExpression()), !dbg !101 // %conv = trunc i64 %0 to i32, !dbg !56 // call void @llvm.dbg.value(metadata i32 %conv, metadata !85, metadata !DIExpression()), !dbg !98 // %tobool = icmp ne i32 %conv, 0, !dbg !57 // br i1 %tobool, label %if.then, label %if.else, !dbg !59 old_cctrl = cctrl[3]; cctrl[3] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[3] >= old_cctrl); ASSUME(cctrl[3] >= creg_r1); ASSUME(cctrl[3] >= 0); if((r1!=0)) { goto T3BLOCK2; } else { goto T3BLOCK3; } T3BLOCK2: // br label %lbl_LC01, !dbg !60 goto T3BLOCK4; T3BLOCK3: // br label %lbl_LC01, !dbg !61 goto T3BLOCK4; T3BLOCK4: // call void @llvm.dbg.label(metadata !97), !dbg !109 // call void (...) @isb(), !dbg !63 // isb: Guess cisb[3] = get_rng(0,NCONTEXT-1); // Check ASSUME(cisb[3] >= cdy[3]); ASSUME(cisb[3] >= cctrl[3]); ASSUME(cisb[3] >= caddr[3]); ASSUME(creturn[3] >= cisb[3]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !89, metadata !DIExpression()), !dbg !111 // call void @llvm.dbg.value(metadata i64 1, metadata !91, metadata !DIExpression()), !dbg !111 // store atomic i64 1, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !65 // ST: Guess iw(3,0) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW old_cw = cw(3,0); cw(3,0) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM // Check ASSUME(active[iw(3,0)] == 3); ASSUME(active[cw(3,0)] == 3); ASSUME(sforbid(0,cw(3,0))== 0); ASSUME(iw(3,0) >= 0); ASSUME(iw(3,0) >= 0); ASSUME(cw(3,0) >= iw(3,0)); ASSUME(cw(3,0) >= old_cw); ASSUME(cw(3,0) >= cr(3,0)); ASSUME(cw(3,0) >= cl[3]); ASSUME(cw(3,0) >= cisb[3]); ASSUME(cw(3,0) >= cdy[3]); ASSUME(cw(3,0) >= cdl[3]); ASSUME(cw(3,0) >= cds[3]); ASSUME(cw(3,0) >= cctrl[3]); ASSUME(cw(3,0) >= caddr[3]); // Update caddr[3] = max(caddr[3],0); buff(3,0) = 1; mem(0,cw(3,0)) = 1; co(0,cw(3,0))+=1; delta(0,cw(3,0)) = -1; ASSUME(creturn[3] >= cw(3,0)); // %cmp = icmp eq i32 %conv, 1, !dbg !66 // %conv1 = zext i1 %cmp to i32, !dbg !66 // call void @llvm.dbg.value(metadata i32 %conv1, metadata !92, metadata !DIExpression()), !dbg !98 // call void @llvm.dbg.value(metadata i64* @atom_2_X0_1, metadata !93, metadata !DIExpression()), !dbg !114 // %1 = zext i32 %conv1 to i64 // call void @llvm.dbg.value(metadata i64 %1, metadata !95, metadata !DIExpression()), !dbg !114 // store atomic i64 %1, i64* @atom_2_X0_1 seq_cst, align 8, !dbg !68 // ST: Guess iw(3,3) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW old_cw = cw(3,3); cw(3,3) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM // Check ASSUME(active[iw(3,3)] == 3); ASSUME(active[cw(3,3)] == 3); ASSUME(sforbid(3,cw(3,3))== 0); ASSUME(iw(3,3) >= max(creg_r1,0)); ASSUME(iw(3,3) >= 0); ASSUME(cw(3,3) >= iw(3,3)); ASSUME(cw(3,3) >= old_cw); ASSUME(cw(3,3) >= cr(3,3)); ASSUME(cw(3,3) >= cl[3]); ASSUME(cw(3,3) >= cisb[3]); ASSUME(cw(3,3) >= cdy[3]); ASSUME(cw(3,3) >= cdl[3]); ASSUME(cw(3,3) >= cds[3]); ASSUME(cw(3,3) >= cctrl[3]); ASSUME(cw(3,3) >= caddr[3]); // Update caddr[3] = max(caddr[3],0); buff(3,3) = (r1==1); mem(3,cw(3,3)) = (r1==1); co(3,cw(3,3))+=1; delta(3,cw(3,3)) = -1; ASSUME(creturn[3] >= cw(3,3)); // ret i8* null, !dbg !69 ret_thread_3 = (- 1); // Dumping thread 0 int ret_thread_0 = 0; cdy[0] = get_rng(0,NCONTEXT-1); ASSUME(cdy[0] >= cstart[0]); T0BLOCK0: // %thr0 = alloca i64, align 8 // %thr1 = alloca i64, align 8 // %thr2 = alloca i64, align 8 // call void @llvm.dbg.value(metadata i32 %argc, metadata !124, metadata !DIExpression()), !dbg !159 // call void @llvm.dbg.value(metadata i8** %argv, metadata !125, metadata !DIExpression()), !dbg !159 // %0 = bitcast i64* %thr0 to i8*, !dbg !76 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !76 // call void @llvm.dbg.declare(metadata i64* %thr0, metadata !126, metadata !DIExpression()), !dbg !161 // %1 = bitcast i64* %thr1 to i8*, !dbg !78 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !78 // call void @llvm.dbg.declare(metadata i64* %thr1, metadata !130, metadata !DIExpression()), !dbg !163 // %2 = bitcast i64* %thr2 to i8*, !dbg !80 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #7, !dbg !80 // call void @llvm.dbg.declare(metadata i64* %thr2, metadata !131, metadata !DIExpression()), !dbg !165 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !132, metadata !DIExpression()), !dbg !166 // call void @llvm.dbg.value(metadata i64 0, metadata !134, metadata !DIExpression()), !dbg !166 // store atomic i64 0, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !83 // ST: Guess iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0+1*1); cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0+1*1)] == 0); ASSUME(active[cw(0,0+1*1)] == 0); ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(cw(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cw(0,0+1*1) >= old_cw); ASSUME(cw(0,0+1*1) >= cr(0,0+1*1)); ASSUME(cw(0,0+1*1) >= cl[0]); ASSUME(cw(0,0+1*1) >= cisb[0]); ASSUME(cw(0,0+1*1) >= cdy[0]); ASSUME(cw(0,0+1*1) >= cdl[0]); ASSUME(cw(0,0+1*1) >= cds[0]); ASSUME(cw(0,0+1*1) >= cctrl[0]); ASSUME(cw(0,0+1*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+1*1) = 0; mem(0+1*1,cw(0,0+1*1)) = 0; co(0+1*1,cw(0,0+1*1))+=1; delta(0+1*1,cw(0,0+1*1)) = -1; ASSUME(creturn[0] >= cw(0,0+1*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !135, metadata !DIExpression()), !dbg !168 // call void @llvm.dbg.value(metadata i64 0, metadata !137, metadata !DIExpression()), !dbg !168 // store atomic i64 0, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !85 // ST: Guess iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0); cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0)] == 0); ASSUME(active[cw(0,0)] == 0); ASSUME(sforbid(0,cw(0,0))== 0); ASSUME(iw(0,0) >= 0); ASSUME(iw(0,0) >= 0); ASSUME(cw(0,0) >= iw(0,0)); ASSUME(cw(0,0) >= old_cw); ASSUME(cw(0,0) >= cr(0,0)); ASSUME(cw(0,0) >= cl[0]); ASSUME(cw(0,0) >= cisb[0]); ASSUME(cw(0,0) >= cdy[0]); ASSUME(cw(0,0) >= cdl[0]); ASSUME(cw(0,0) >= cds[0]); ASSUME(cw(0,0) >= cctrl[0]); ASSUME(cw(0,0) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0) = 0; mem(0,cw(0,0)) = 0; co(0,cw(0,0))+=1; delta(0,cw(0,0)) = -1; ASSUME(creturn[0] >= cw(0,0)); // call void @llvm.dbg.value(metadata i64* @atom_1_X0_2, metadata !138, metadata !DIExpression()), !dbg !170 // call void @llvm.dbg.value(metadata i64 0, metadata !140, metadata !DIExpression()), !dbg !170 // store atomic i64 0, i64* @atom_1_X0_2 monotonic, align 8, !dbg !87 // ST: Guess iw(0,2) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,2); cw(0,2) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,2)] == 0); ASSUME(active[cw(0,2)] == 0); ASSUME(sforbid(2,cw(0,2))== 0); ASSUME(iw(0,2) >= 0); ASSUME(iw(0,2) >= 0); ASSUME(cw(0,2) >= iw(0,2)); ASSUME(cw(0,2) >= old_cw); ASSUME(cw(0,2) >= cr(0,2)); ASSUME(cw(0,2) >= cl[0]); ASSUME(cw(0,2) >= cisb[0]); ASSUME(cw(0,2) >= cdy[0]); ASSUME(cw(0,2) >= cdl[0]); ASSUME(cw(0,2) >= cds[0]); ASSUME(cw(0,2) >= cctrl[0]); ASSUME(cw(0,2) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,2) = 0; mem(2,cw(0,2)) = 0; co(2,cw(0,2))+=1; delta(2,cw(0,2)) = -1; ASSUME(creturn[0] >= cw(0,2)); // call void @llvm.dbg.value(metadata i64* @atom_2_X0_1, metadata !141, metadata !DIExpression()), !dbg !172 // call void @llvm.dbg.value(metadata i64 0, metadata !143, metadata !DIExpression()), !dbg !172 // store atomic i64 0, i64* @atom_2_X0_1 monotonic, align 8, !dbg !89 // ST: Guess iw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,3); cw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,3)] == 0); ASSUME(active[cw(0,3)] == 0); ASSUME(sforbid(3,cw(0,3))== 0); ASSUME(iw(0,3) >= 0); ASSUME(iw(0,3) >= 0); ASSUME(cw(0,3) >= iw(0,3)); ASSUME(cw(0,3) >= old_cw); ASSUME(cw(0,3) >= cr(0,3)); ASSUME(cw(0,3) >= cl[0]); ASSUME(cw(0,3) >= cisb[0]); ASSUME(cw(0,3) >= cdy[0]); ASSUME(cw(0,3) >= cdl[0]); ASSUME(cw(0,3) >= cds[0]); ASSUME(cw(0,3) >= cctrl[0]); ASSUME(cw(0,3) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,3) = 0; mem(3,cw(0,3)) = 0; co(3,cw(0,3))+=1; delta(3,cw(0,3)) = -1; ASSUME(creturn[0] >= cw(0,3)); // %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !90 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,2+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,2+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[1] >= cdy[0]); // %call7 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !91 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,2+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,2+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[2] >= cdy[0]); // %call8 = call i32 @pthread_create(i64* noundef %thr2, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t2, i8* noundef null) #7, !dbg !92 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,2+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,2+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[3] >= cdy[0]); // %3 = load i64, i64* %thr0, align 8, !dbg !93, !tbaa !94 // LD: Guess old_cr = cr(0,4); cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,4)] == 0); ASSUME(cr(0,4) >= iw(0,4)); ASSUME(cr(0,4) >= 0); ASSUME(cr(0,4) >= cdy[0]); ASSUME(cr(0,4) >= cisb[0]); ASSUME(cr(0,4) >= cdl[0]); ASSUME(cr(0,4) >= cl[0]); // Update creg_r3 = cr(0,4); crmax(0,4) = max(crmax(0,4),cr(0,4)); caddr[0] = max(caddr[0],0); if(cr(0,4) < cw(0,4)) { r3 = buff(0,4); } else { if(pw(0,4) != co(4,cr(0,4))) { ASSUME(cr(0,4) >= old_cr); } pw(0,4) = co(4,cr(0,4)); r3 = mem(4,cr(0,4)); } ASSUME(creturn[0] >= cr(0,4)); // %call9 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !98 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,2+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,2+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[1]); // %4 = load i64, i64* %thr1, align 8, !dbg !99, !tbaa !94 // LD: Guess old_cr = cr(0,5); cr(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,5)] == 0); ASSUME(cr(0,5) >= iw(0,5)); ASSUME(cr(0,5) >= 0); ASSUME(cr(0,5) >= cdy[0]); ASSUME(cr(0,5) >= cisb[0]); ASSUME(cr(0,5) >= cdl[0]); ASSUME(cr(0,5) >= cl[0]); // Update creg_r4 = cr(0,5); crmax(0,5) = max(crmax(0,5),cr(0,5)); caddr[0] = max(caddr[0],0); if(cr(0,5) < cw(0,5)) { r4 = buff(0,5); } else { if(pw(0,5) != co(5,cr(0,5))) { ASSUME(cr(0,5) >= old_cr); } pw(0,5) = co(5,cr(0,5)); r4 = mem(5,cr(0,5)); } ASSUME(creturn[0] >= cr(0,5)); // %call10 = call i32 @pthread_join(i64 noundef %4, i8** noundef null), !dbg !100 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,2+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,2+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[2]); // %5 = load i64, i64* %thr2, align 8, !dbg !101, !tbaa !94 // LD: Guess old_cr = cr(0,6); cr(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,6)] == 0); ASSUME(cr(0,6) >= iw(0,6)); ASSUME(cr(0,6) >= 0); ASSUME(cr(0,6) >= cdy[0]); ASSUME(cr(0,6) >= cisb[0]); ASSUME(cr(0,6) >= cdl[0]); ASSUME(cr(0,6) >= cl[0]); // Update creg_r5 = cr(0,6); crmax(0,6) = max(crmax(0,6),cr(0,6)); caddr[0] = max(caddr[0],0); if(cr(0,6) < cw(0,6)) { r5 = buff(0,6); } else { if(pw(0,6) != co(6,cr(0,6))) { ASSUME(cr(0,6) >= old_cr); } pw(0,6) = co(6,cr(0,6)); r5 = mem(6,cr(0,6)); } ASSUME(creturn[0] >= cr(0,6)); // %call11 = call i32 @pthread_join(i64 noundef %5, i8** noundef null), !dbg !102 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,2+0)); ASSUME(cdy[0] >= cw(0,3+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,2+0)); ASSUME(cdy[0] >= cr(0,3+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[3]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !145, metadata !DIExpression()), !dbg !187 // %6 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) seq_cst, align 8, !dbg !104 // LD: Guess old_cr = cr(0,0); cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,0)] == 0); ASSUME(cr(0,0) >= iw(0,0)); ASSUME(cr(0,0) >= 0); ASSUME(cr(0,0) >= cdy[0]); ASSUME(cr(0,0) >= cisb[0]); ASSUME(cr(0,0) >= cdl[0]); ASSUME(cr(0,0) >= cl[0]); // Update creg_r6 = cr(0,0); crmax(0,0) = max(crmax(0,0),cr(0,0)); caddr[0] = max(caddr[0],0); if(cr(0,0) < cw(0,0)) { r6 = buff(0,0); } else { if(pw(0,0) != co(0,cr(0,0))) { ASSUME(cr(0,0) >= old_cr); } pw(0,0) = co(0,cr(0,0)); r6 = mem(0,cr(0,0)); } ASSUME(creturn[0] >= cr(0,0)); // call void @llvm.dbg.value(metadata i64 %6, metadata !147, metadata !DIExpression()), !dbg !187 // %conv = trunc i64 %6 to i32, !dbg !105 // call void @llvm.dbg.value(metadata i32 %conv, metadata !144, metadata !DIExpression()), !dbg !159 // %cmp = icmp eq i32 %conv, 2, !dbg !106 // %conv12 = zext i1 %cmp to i32, !dbg !106 // call void @llvm.dbg.value(metadata i32 %conv12, metadata !148, metadata !DIExpression()), !dbg !159 // call void @llvm.dbg.value(metadata i64* @atom_1_X0_2, metadata !150, metadata !DIExpression()), !dbg !191 // %7 = load atomic i64, i64* @atom_1_X0_2 seq_cst, align 8, !dbg !108 // LD: Guess old_cr = cr(0,2); cr(0,2) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,2)] == 0); ASSUME(cr(0,2) >= iw(0,2)); ASSUME(cr(0,2) >= 0); ASSUME(cr(0,2) >= cdy[0]); ASSUME(cr(0,2) >= cisb[0]); ASSUME(cr(0,2) >= cdl[0]); ASSUME(cr(0,2) >= cl[0]); // Update creg_r7 = cr(0,2); crmax(0,2) = max(crmax(0,2),cr(0,2)); caddr[0] = max(caddr[0],0); if(cr(0,2) < cw(0,2)) { r7 = buff(0,2); } else { if(pw(0,2) != co(2,cr(0,2))) { ASSUME(cr(0,2) >= old_cr); } pw(0,2) = co(2,cr(0,2)); r7 = mem(2,cr(0,2)); } ASSUME(creturn[0] >= cr(0,2)); // call void @llvm.dbg.value(metadata i64 %7, metadata !152, metadata !DIExpression()), !dbg !191 // %conv16 = trunc i64 %7 to i32, !dbg !109 // call void @llvm.dbg.value(metadata i32 %conv16, metadata !149, metadata !DIExpression()), !dbg !159 // call void @llvm.dbg.value(metadata i64* @atom_2_X0_1, metadata !154, metadata !DIExpression()), !dbg !194 // %8 = load atomic i64, i64* @atom_2_X0_1 seq_cst, align 8, !dbg !111 // LD: Guess old_cr = cr(0,3); cr(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,3)] == 0); ASSUME(cr(0,3) >= iw(0,3)); ASSUME(cr(0,3) >= 0); ASSUME(cr(0,3) >= cdy[0]); ASSUME(cr(0,3) >= cisb[0]); ASSUME(cr(0,3) >= cdl[0]); ASSUME(cr(0,3) >= cl[0]); // Update creg_r8 = cr(0,3); crmax(0,3) = max(crmax(0,3),cr(0,3)); caddr[0] = max(caddr[0],0); if(cr(0,3) < cw(0,3)) { r8 = buff(0,3); } else { if(pw(0,3) != co(3,cr(0,3))) { ASSUME(cr(0,3) >= old_cr); } pw(0,3) = co(3,cr(0,3)); r8 = mem(3,cr(0,3)); } ASSUME(creturn[0] >= cr(0,3)); // call void @llvm.dbg.value(metadata i64 %8, metadata !156, metadata !DIExpression()), !dbg !194 // %conv20 = trunc i64 %8 to i32, !dbg !112 // call void @llvm.dbg.value(metadata i32 %conv20, metadata !153, metadata !DIExpression()), !dbg !159 // %and = and i32 %conv16, %conv20, !dbg !113 creg_r9 = max(creg_r7,creg_r8); ASSUME(active[creg_r9] == 0); r9 = r7 & r8; // call void @llvm.dbg.value(metadata i32 %and, metadata !157, metadata !DIExpression()), !dbg !159 // %and21 = and i32 %conv12, %and, !dbg !114 creg_r10 = max(max(creg_r6,0),creg_r9); ASSUME(active[creg_r10] == 0); r10 = (r6==2) & r9; // call void @llvm.dbg.value(metadata i32 %and21, metadata !158, metadata !DIExpression()), !dbg !159 // %cmp22 = icmp eq i32 %and21, 1, !dbg !115 // br i1 %cmp22, label %if.then, label %if.end, !dbg !117 old_cctrl = cctrl[0]; cctrl[0] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[0] >= old_cctrl); ASSUME(cctrl[0] >= creg_r10); ASSUME(cctrl[0] >= 0); if((r10==1)) { goto T0BLOCK1; } else { goto T0BLOCK2; } T0BLOCK1: // call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([101 x i8], [101 x i8]* @.str.1, i64 0, i64 0), i32 noundef 71, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !118 // unreachable, !dbg !118 r11 = 1; T0BLOCK2: // %9 = bitcast i64* %thr2 to i8*, !dbg !121 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %9) #7, !dbg !121 // %10 = bitcast i64* %thr1 to i8*, !dbg !121 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %10) #7, !dbg !121 // %11 = bitcast i64* %thr0 to i8*, !dbg !121 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %11) #7, !dbg !121 // ret i32 0, !dbg !122 ret_thread_0 = 0; ASSERT(r11== 0); }
[ "tuan-phong.ngo@it.uu.se" ]
tuan-phong.ngo@it.uu.se
da6e5cab8e3de5d03a90776ad0f9b2ef054b3055
cf8ddfc720bf6451c4ef4fa01684327431db1919
/SDK/ARKSurvivalEvolved_PrimalItemStructure_WoodDoor_functions.cpp
aaf7a9bd712e68eea271d1f8e19b7378b03b53e6
[ "MIT" ]
permissive
git-Charlie/ARK-SDK
75337684b11e7b9f668da1f15e8054052a3b600f
c38ca9925309516b2093ad8c3a70ed9489e1d573
refs/heads/master
2023-06-20T06:30:33.550123
2021-07-11T13:41:45
2021-07-11T13:41:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,137
cpp
// ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_PrimalItemStructure_WoodDoor_parameters.hpp" namespace sdk { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function PrimalItemStructure_WoodDoor.PrimalItemStructure_WoodDoor_C.ExecuteUbergraph_PrimalItemStructure_WoodDoor // () // Parameters: // int EntryPoint (Parm, ZeroConstructor, IsPlainOldData) void UPrimalItemStructure_WoodDoor_C::ExecuteUbergraph_PrimalItemStructure_WoodDoor(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function PrimalItemStructure_WoodDoor.PrimalItemStructure_WoodDoor_C.ExecuteUbergraph_PrimalItemStructure_WoodDoor"); UPrimalItemStructure_WoodDoor_C_ExecuteUbergraph_PrimalItemStructure_WoodDoor_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "sergey.2bite@gmail.com" ]
sergey.2bite@gmail.com
7ca4a42b21d64971ba0bacba02753569acc7101c
67b4bc373412ad450f76c50d2a8473d5542b5169
/Classes/GiveLayer.cpp
51fde3c3a30f0579d14b26cc33539bb5af5d2877
[ "MIT" ]
permissive
AndyZhou3087/JH
91da3bc72e56bc82085458a0187c4ebe5e2cea49
354c19ebf6a962e6c884222fdcd3b8875fe6d016
refs/heads/master
2020-05-27T13:56:56.697411
2018-04-24T07:17:50
2018-04-24T07:17:50
82,545,435
1
1
null
null
null
null
UTF-8
C++
false
false
13,931
cpp
#include "GiveLayer.h" #include "GlobalData.h" #include "CommonFuncs.h" #include "MyPackage.h" #include "Const.h" #include "GameScene.h" #include "StorageRoom.h" #include "SoundManager.h" #include "NpcLayer.h" #include "MyMenu.h" #include "GameDataSave.h" #include "Winlayer.h" GiveLayer::GiveLayer() { lastMyGoodsSrollViewHeight = -1; lastGiveGoodsSrollViewHeight = -1; } GiveLayer::~GiveLayer() { } GiveLayer* GiveLayer::create(std::string npcid, std::string addrid) { GiveLayer *pRet = new GiveLayer(); if (pRet && pRet->init(npcid, addrid)) { pRet->autorelease(); } else { delete pRet; pRet = NULL; } return pRet; } bool GiveLayer::init(std::string npcid, std::string addrid) { Node* csbnode = CSLoader::createNode("giveLayer.csb"); this->addChild(csbnode); m_npcid = npcid; m_addrid = addrid; m_backbtn = (cocos2d::ui::Widget*)csbnode->getChildByName("backbtn"); m_backbtn->addTouchEventListener(CC_CALLBACK_2(GiveLayer::onBack, this)); m_givebtn = (cocos2d::ui::Widget*)csbnode->getChildByName("givebtn"); m_givebtn->addTouchEventListener(CC_CALLBACK_2(GiveLayer::onGive, this)); cocos2d::ui::ImageView* npchead = (cocos2d::ui::ImageView*)csbnode->getChildByName("npcicon"); std::string npcheadstr = StringUtils::format("ui/%s.png", m_npcid.c_str()); npchead->loadTexture(npcheadstr, cocos2d::ui::TextureResType::PLIST); npchead->setScale(0.6f); cocos2d::ui::Text* npcname = (cocos2d::ui::Text*)csbnode->getChildByName("npcname"); npcname->setString(GlobalData::map_npcs[npcid].name); m_giveGoodsSrollView = (cocos2d::ui::ScrollView*)csbnode->getChildByName("givescroll"); m_giveGoodsSrollView->setScrollBarEnabled(false); m_myGoodsSrollView = (cocos2d::ui::ScrollView*)csbnode->getChildByName("mygoodsscroll"); m_myGoodsSrollView->setScrollBarEnabled(false); giveval = 0; friendly = GlobalData::map_myfriendly[m_npcid].friendly; friendlylbl = (cocos2d::ui::Text*)csbnode->getChildByName("friendly"); if (friendly < -100000 || friendly > 100000) friendly = 0; std::string friendstr = StringUtils::format("%d", friendly); friendlylbl->setString(friendstr); for (int i = 0; i < MyPackage::getSize(); i++) { myGoodsData.push_back(MyPackage::vec_packages[i]); } updataMyGoodsUI(); auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [=](Touch *touch, Event *event) { return true; }; listener->setSwallowTouches(true); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); return true; } void GiveLayer::onEnterTransitionDidFinish() { Layer::onEnterTransitionDidFinish(); } void GiveLayer::onGiveGoodsItem(cocos2d::Ref* pSender) { SoundManager::getInstance()->playSound(SoundManager::SOUND_ID_BUTTON); Node* node = (Node*)pSender; PackageData* data = (PackageData*)node->getUserData(); int datatag = node->getTag(); PackageData udata = *data; udata.count = 1; if (--data->count <= 0) { myGiveData.erase(myGiveData.begin() + datatag); } updateMyGoods(udata); updata(); } void GiveLayer::updateMyGoods(PackageData data) { unsigned int i = 0; for (i = 0; i < myGoodsData.size(); i++) { if (data.strid.compare(myGoodsData[i].strid) == 0 && (myGoodsData[i].type == FOOD || myGoodsData[i].type == MEDICINAL || myGoodsData[i].type == RES_1 || myGoodsData[i].type == RES_2)) { if (myGoodsData[i].count < 10) { myGoodsData[i].count++; break; } else continue; } } if (i == myGoodsData.size()) { data.count = 1; myGoodsData.push_back(data); } } void GiveLayer::updateGiveGoods(PackageData data) { unsigned int i = 0; for (i = 0; i < myGiveData.size(); i++) { if (data.strid.compare(myGiveData[i].strid) == 0 && (myGiveData[i].type == FOOD || myGiveData[i].type == MEDICINAL || myGiveData[i].type == RES_1 || myGiveData[i].type == RES_2)) { myGiveData[i].count++; break; } } if (i == myGiveData.size()) { data.count = 1; myGiveData.push_back(data); } } void GiveLayer::onMyGoodsItem(cocos2d::Ref* pSender) { SoundManager::getInstance()->playSound(SoundManager::SOUND_ID_BUTTON); Node* node = (Node*)pSender; PackageData* data = (PackageData*)node->getUserData(); int datatag = node->getTag(); PackageData udata = *data; udata.count = 1; if (--data->count <= 0) { myGoodsData.erase(myGoodsData.begin() + datatag); } updateGiveGoods(udata); updata(); } void GiveLayer::onBack(cocos2d::Ref *pSender, cocos2d::ui::Widget::TouchEventType type) { CommonFuncs::BtnAction(pSender, type); if (type == ui::Widget::TouchEventType::ENDED) { this->removeFromParentAndCleanup(true); } } void GiveLayer::removeSelf(float dt) { this->removeFromParentAndCleanup(true); } void GiveLayer::onGive(cocos2d::Ref *pSender, cocos2d::ui::Widget::TouchEventType type) { CommonFuncs::BtnAction(pSender, type); if (type == ui::Widget::TouchEventType::ENDED) { m_backbtn->setEnabled(false); m_givebtn->setEnabled(false); MyPackage::vec_packages.clear(); for (unsigned int i = 0; i < myGoodsData.size(); i++) { MyPackage::vec_packages.push_back(myGoodsData[i]); } GlobalData::map_myfriendly[m_npcid].friendly = friendly + giveval; GlobalData::saveFriendly(); MyPackage::save(); NpcLayer* npclayer = (NpcLayer*)g_gameLayer->getChildByName("npclayer"); npclayer->reFreshFriendlyUI(); doGiveMission(); } } void GiveLayer::checkValue() { giveval = 0; for (unsigned int i = 0; i < myGiveData.size(); i++) { std::string resid = myGiveData[i].strid; giveval += GlobalData::map_allResource[resid].fval * myGiveData[i].count; } std::string friendstr = StringUtils::format("%d", friendly + giveval); friendlylbl->setString(friendstr); } void GiveLayer::updata() { updataMyGoodsUI(); updataGiveGoodsUI(); checkValue(); } void GiveLayer::updataMyGoodsUI() { int size = myGoodsData.size(); m_myGoodsSrollView->removeAllChildrenWithCleanup(true); int row = size % 5 == 0 ? size / 5 : (size / 5 + 1); int innerheight = row * 140; if (lastMyGoodsSrollViewHeight != innerheight) { lastMyGoodsSrollViewHeight = innerheight; int contentheight = m_myGoodsSrollView->getContentSize().height; if (innerheight < contentheight) innerheight = contentheight; m_myGoodsSrollView->setInnerContainerSize(Size(m_myGoodsSrollView->getContentSize().width, innerheight)); } std::vector<PackageData*> allMydata; for (unsigned int i = 0; i < myGoodsData.size(); i++) { allMydata.push_back(&myGoodsData[i]); } int allsize = allMydata.size(); for (int i = 0; i < allsize; i++) { std::string boxstr = "ui/buildsmall.png"; PackageData* tmpdata = allMydata[i]; if (tmpdata->type == WEAPON || tmpdata->type == PROTECT_EQU) { boxstr = StringUtils::format("ui/qubox%d.png", GlobalData::map_equips[tmpdata->strid].qu); } else if (tmpdata->type == N_GONG || tmpdata->type == W_GONG) { boxstr = StringUtils::format("ui/qubox%d.png", GlobalData::map_wgngs[tmpdata->strid].qu); } Sprite * box = Sprite::createWithSpriteFrameName(boxstr); MenuItemSprite* boxItem = MenuItemSprite::create( box, box, box, CC_CALLBACK_1(GiveLayer::onMyGoodsItem, this)); boxItem->setUserData(allMydata[i]); boxItem->setTag(i); boxItem->setPosition(Vec2(boxItem->getContentSize().width / 2 + 10 + i % 5 * 125, innerheight - boxItem->getContentSize().height / 2 - i / 5 * 140)); MyMenu* menu = MyMenu::create(); menu->addChild(boxItem); menu->setTouchlimit(m_myGoodsSrollView); menu->setPosition(Vec2(0, 0)); std::string name = StringUtils::format("pitem%d", i); m_myGoodsSrollView->addChild(menu, 0, name); std::string str = StringUtils::format("ui/%s.png", tmpdata->strid.c_str()); Sprite * res = Sprite::createWithSpriteFrameName(str); res->setPosition(Vec2(box->getContentSize().width / 2, box->getContentSize().height / 2)); box->addChild(res); str = StringUtils::format("%d", tmpdata->count); Label * reslbl = Label::createWithTTF(str, "fonts/STXINGKA.TTF", 18);//Label::createWithSystemFont(str, "", 18); reslbl->setPosition(Vec2(box->getContentSize().width - 25, 25)); box->addChild(reslbl); } } void GiveLayer::updataGiveGoodsUI() { int size = myGiveData.size(); m_giveGoodsSrollView->removeAllChildrenWithCleanup(true); int row = size % 5 == 0 ? size / 5 : (size / 5 + 1); int innerheight = m_giveGoodsSrollView->getInnerContainerSize().height; if (lastGiveGoodsSrollViewHeight < 0) { innerheight = row * 140; int contentheight = m_giveGoodsSrollView->getContentSize().height; if (innerheight < contentheight) innerheight = contentheight; lastGiveGoodsSrollViewHeight = innerheight; m_giveGoodsSrollView->setInnerContainerSize(Size(m_giveGoodsSrollView->getContentSize().width, innerheight)); } std::vector<PackageData*> allNpcdata; for (unsigned int i = 0; i < myGiveData.size(); i++) { allNpcdata.push_back(&myGiveData[i]); } int allsize = allNpcdata.size(); for (int i = 0; i < allsize; i++) { std::string boxstr = "ui/buildsmall.png"; PackageData *tmpdata = allNpcdata[i]; if (tmpdata->type == WEAPON || tmpdata->type == PROTECT_EQU) { boxstr = StringUtils::format("ui/qubox%d.png", GlobalData::map_equips[tmpdata->strid].qu); } else if (tmpdata->type == N_GONG || tmpdata->type == W_GONG) { boxstr = StringUtils::format("ui/qubox%d.png", GlobalData::map_wgngs[tmpdata->strid].qu); } Sprite * box = Sprite::createWithSpriteFrameName(boxstr); MenuItemSprite* boxItem = MenuItemSprite::create( box, box, box, CC_CALLBACK_1(GiveLayer::onGiveGoodsItem, this)); boxItem->setUserData(allNpcdata[i]); boxItem->setTag(i); boxItem->setPosition(Vec2(boxItem->getContentSize().width / 2 + 10 + i % 5 * 125, innerheight - boxItem->getContentSize().height / 2 - i / 5 * 140)); MyMenu* menu = MyMenu::create(); menu->addChild(boxItem); menu->setTouchlimit(m_giveGoodsSrollView); menu->setPosition(Vec2(0, 0)); std::string name = StringUtils::format("pitem%d", i); m_giveGoodsSrollView->addChild(menu, 0, name); std::string str = StringUtils::format("ui/%s.png", tmpdata->strid.c_str()); Sprite * res = Sprite::createWithSpriteFrameName(str); res->setPosition(Vec2(box->getContentSize().width / 2, box->getContentSize().height / 2)); box->addChild(res); str = StringUtils::format("%d", tmpdata->count); Label * reslbl = Label::createWithTTF(str, "fonts/STXINGKA.TTF", 18);//Label::createWithSystemFont(str, "", 18); reslbl->setPosition(Vec2(box->getContentSize().width - 25, 25)); box->addChild(reslbl); } } void GiveLayer::doGiveMission() { bool isAnim = false; std::string curmid = GlobalData::getCurBranchPlotMissison(); std::map<std::string, int> map_needGoods; std::map<std::string, int>::iterator it; if (curmid.length() > 0) { int subindex = GlobalData::map_BranchPlotMissionItem[curmid].subindex; PlotMissionData pd = GlobalData::map_BranchPlotMissionData[curmid][subindex]; std::vector<std::string> vec_rwdres = pd.rewords; std::string savedgstr = GameDataSave::getInstance()->getBranchPlotMissionGiveGoods(); std::vector<std::string> needgoods; if (savedgstr.length() > 0) { std::vector<std::string> vec_retstr; CommonFuncs::split(savedgstr, needgoods, ";"); } else { needgoods = pd.needgoods; } if (pd.status == M_DOING && pd.type == 2 && GlobalData::map_BranchPlotMissionItem[curmid].count > 0) { for (unsigned int i = 0; i < needgoods.size(); i++) { std::string resid = needgoods[i]; int intresid = atoi(resid.c_str()); int count = 1; if (intresid > 0) { resid = StringUtils::format("%d", intresid / 1000); count = intresid % 1000; } map_needGoods[resid] = count; } for (unsigned int i = 0; i < myGiveData.size(); i++) { for (it = map_needGoods.begin(); it != map_needGoods.end(); it++) { if (myGiveData[i].strid.compare(it->first) == 0) { if (myGiveData[i].count >= map_needGoods[it->first]) { map_needGoods.erase(it); break; } else { map_needGoods[it->first] -= myGiveData[i].count; } } } } if (needgoods.size() > 0) { if (map_needGoods.size() <= 0) { //完成 int subindex = GlobalData::map_BranchPlotMissionItem[curmid].subindex; GlobalData::map_BranchPlotMissionData[curmid][subindex].status = M_NONE; giveRes(GlobalData::map_BranchPlotMissionData[curmid][subindex].rewords); if (subindex + 1 >= GlobalData::map_BranchPlotMissionData[curmid].size()) { GlobalData::map_BranchPlotMissionItem[curmid].subindex = 0; GlobalData::map_BranchPlotMissionItem[curmid].count--; GlobalData::map_BranchPlotMissionItem[curmid].time = GlobalData::map_BranchPlotMissionItem[curmid].maxtime; GlobalData::saveBranchPlotMissionStatus("", 0); } else { GlobalData::map_BranchPlotMissionItem[curmid].subindex++; GlobalData::saveBranchPlotMissionStatus(curmid, M_NONE); } GameDataSave::getInstance()->setBranchPlotMissionGiveGoods(""); Winlayer::showMissionAnim(this, "任务完成", vec_rwdres); isAnim = true; } else { std::string str; //未完成 for (it = map_needGoods.begin(); it != map_needGoods.end(); it++) { std::string tempstr; int intresid = atoi(it->first.c_str()); if (intresid > 0) tempstr = StringUtils::format("%d;", intresid * 1000 + map_needGoods[it->first]); else tempstr = StringUtils::format("%s;", it->first.c_str()); str.append(tempstr); } if (str.length() > 0) { GameDataSave::getInstance()->setBranchPlotMissionGiveGoods(str.substr(0, str.length() - 1)); } } } } } if (isAnim) { this->scheduleOnce(schedule_selector(GiveLayer::removeSelf), 2.5f); } else { removeSelf(0); } } void GiveLayer::giveRes(std::vector<std::string> vec_res) { NpcLayer::getWinRes(vec_res, m_addrid); }
[ "zhou_jian007@126.com" ]
zhou_jian007@126.com
a32893440028ed67f9edc30b80a1a5096aba7032
5d2a85672442851c232eb9be907e8768914fa75e
/noc/SimpleAddressMap.h
4a24c5a8e7b6a96ea939a3da33e8adbbe480acc6
[]
no_license
assam1231/platform_SPLASH2
a6dc896921e4492f794383609673663a64499bd7
1b92e4821ce688ee3dddc35771c0d2ff1b438d98
refs/heads/master
2021-01-25T08:07:26.049423
2017-06-08T07:01:08
2017-06-08T07:01:08
93,717,681
0
0
null
null
null
null
UTF-8
C++
false
false
6,200
h
/***************************************************************************** The following code is derived, directly or indirectly, from the SystemC source code Copyright (c) 1996-2008 by all Contributors. All Rights reserved. The contents of this file are subject to the restrictions and limitations set forth in the SystemC Open Source License Version 3.0 (the "License"); You may not use this file except in compliance with such restrictions and limitations. You may obtain instructions on how to receive a copy of the License at http://www.systemc.org/. Software distributed by Contributors under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. *****************************************************************************/ #ifndef SIMPLE_ADDRESS_MAP_H__ #define SIMPLE_ADDRESS_MAP_H__ #include <systemc> #include <map> #include <iostream> //-------------------------------------------------------------------------- /** * Simple address map implementation for the generic protocol. */ //-------------------------------------------------------------------------- class SimpleAddressMap { typedef std::map<sc_dt::uint64, unsigned int> mapType; typedef std::map<sc_dt::uint64, unsigned int>::iterator addressMapIterator; public: SimpleAddressMap() {} //-------------------------------------------------------------------------- /** * Check for overlapping address ranges */ //-------------------------------------------------------------------------- void checkSanity() { addressMapIterator pos; for (pos=m_addressMap.begin();pos!=m_addressMap.end();++pos){ if(pos->second!=255) SC_REPORT_ERROR("SimpleAddressMap","Overlapping Address Regions."); else ++pos; if(pos->second==255) SC_REPORT_ERROR("SimpleAddressMap","Overlapping Address Regions."); } std::cout<<"Address check successful."<<std::endl; } //-------------------------------------------------------------------------- /** * Print map */ //-------------------------------------------------------------------------- void dumpMap() { std::cout<<"SimpleAddressMap: printing the sorted MAP:"<<std::endl; addressMapIterator pos; for (pos=m_addressMap.begin();pos!=m_addressMap.end();++pos){ if(pos->second==255) printf("key: %x value: %i \n", (unsigned int) ((pos->first+1)>>1)-1, pos->second); else printf("key: %x value: %i \n", (unsigned int) (pos->first>>1)-1, pos->second); } } //-------------------------------------------------------------------------- /** * Decode slave address. * @param address_ A slave address. * @return The decoded slave port number. On error, the value 255 is returned. */ //-------------------------------------------------------------------------- unsigned int decode(sc_dt::uint64 address_) { addressMapIterator lbound; lbound=m_addressMap.lower_bound((address_+1)<<1); if((lbound->second == 255) | (lbound==m_addressMap.end())){ std::cout<<"address == 0x"<<std::hex<<address_<<std::dec<<std::endl; SC_REPORT_ERROR("SimpleAddressMap", "Address does not match any registered address range."); } else{ return lbound->second; } return 255; } unsigned int crossbar_decode(sc_dt::uint64 address_, unsigned int source) { addressMapIterator lbound; lbound=m_addressMap.lower_bound((address_+1)<<1); unsigned int target_id = lbound->second; if((lbound->second == 255) | (lbound==m_addressMap.end())){ std::cout<<"address == 0x"<<std::hex<<address_<<std::dec<<std::endl; SC_REPORT_ERROR("SimpleAddressMap", "Address does not match any registered address range."); } else{ if((source == 0 || source == 1 || source == 2 || source == 5) && (target_id == 17 || target_id == 18 || target_id == 19)){ return 16; } else if((source == 3 || source == 6 || source == 7 || source == 11) && (target_id == 16 || target_id == 18 || target_id == 19)){ return 17; } else if((source == 10 || source == 13 || source == 14 || source == 15) && (target_id == 16 || target_id == 17 || target_id == 19)){ return 18; } else if((source == 4 || source == 8 || source == 9 || source == 12) && (target_id == 16 || target_id == 17 || target_id == 18)){ return 19; } else { return lbound->second; } } return 255; } const sc_dt::uint64& get_max(){ if (m_addressMap.size()){ addressMapIterator i=(m_addressMap.end()); i--; retval=(i->first>>1)-1; return retval; } else { SC_REPORT_ERROR("SimpleAddressMap", "get_max() called on empty address map."); return retval; } } const sc_dt::uint64& get_min(){ if (m_addressMap.size()){ addressMapIterator i=(m_addressMap.begin()); retval=((i->first+1)>>1)-1; return retval; } else { SC_REPORT_ERROR("SimpleAddressMap", "get_min() called on empty address map."); return retval; } } //-------------------------------------------------------------------------- /** * Insert a slave into the address map */ //-------------------------------------------------------------------------- void insert(sc_dt::uint64 baseAddress_, sc_dt::uint64 highAddress_, unsigned int portNumber_) { if(baseAddress_>highAddress_) SC_REPORT_ERROR("SimpleAddressMap", "Base address must be lower than high address."); if(portNumber_>=255) SC_REPORT_ERROR("SimpleAddressMap", "Only ;-) 255 targets can be handled."); m_addressMap.insert(mapType::value_type(((baseAddress_+1)<<1)-1, 255 )); m_addressMap.insert(mapType::value_type( (highAddress_+1)<<1 ,portNumber_)); } const sc_dt::uint64 getBaseAddress( unsigned int portNumber ) { addressMapIterator pos; sc_dt::uint64 baseAddress; for (pos=m_addressMap.begin();pos!=m_addressMap.end();++pos){ baseAddress = ((pos->first+1)>>1)-1; ++pos; if(pos->second==portNumber) return baseAddress; } //2011-04-24 23:14:39, tshsu: shold not run here? return (sc_dt::uint64)(-1); } private: sc_dt::uint64 retval; /// the address map mapType m_addressMap; }; #endif
[ "assam1231@gmail.com" ]
assam1231@gmail.com
5bf4c62d2a322de42ac25d092e180ecbd699cf18
4c870343d1bd680f1f27938eaf8516d2c49003ce
/HappyNumbers.cpp
c8fde45ff8ea2c5848376622f10c0076e373ecdc
[]
no_license
DionysiosB/CodeEval
7d6054f9d07ff5665f891ed6441de00bf34eae18
e856f9950279b95252dcf883d8ed43d607fd440e
refs/heads/master
2016-09-06T16:50:05.956455
2014-12-10T01:19:20
2014-12-10T01:19:20
10,972,338
0
1
null
null
null
null
UTF-8
C++
false
false
781
cpp
#include <iostream> #include <cmath> #include <vector> #include <fstream> #include <sstream> #include <stdlib.h> using namespace std; const int maxIterations=100000; void happyNumbers(char * inputName) { string line; unsigned n;unsigned total; int counter; ifstream inputFile (inputName); //ifstream inputFile ("inputFile.txt"); if(inputFile){ while(getline(inputFile,line)){ n=atoi(line.c_str()); counter=0; while(counter<maxIterations){ ++counter;total=0; while(n>0){total+=int(pow(1.0*(n%10),2));n /=10;} if(total==1){cout << "1"<<endl;break;} if(counter>=maxIterations){cout << "0"<<endl;break;} n=total; } } } } int main (int argc, char * const argv[]) { char * inputName=argv[1]; happyNumbers(inputName); return 0; }
[ "barmpoutis@gmail.com" ]
barmpoutis@gmail.com
6aba7f8d455c1e0dbb3ab386dd522d66a0e13b95
8718e6260bafca8f0e1c516759de7bbaf2271653
/src/sketch/LiquidCrystal_I2C.cpp
63a380efe0898b10ee2cdf055c20cb07a79e28bb
[]
no_license
ainsey11/Arduino-DesktopScreens
f1bfa60e3f6237ccd9320ab53c7a59037e0c5c29
5aa5e5852e5420f743931249cb3eff8602386f82
refs/heads/master
2021-04-15T05:44:37.190629
2018-04-03T13:52:34
2018-04-03T13:52:34
126,554,307
1
0
null
null
null
null
UTF-8
C++
false
false
8,085
cpp
// --------------------------------------------------------------------------- // Created by Francisco Malpartida on 20/08/11. // Copyright 2011 - Under creative commons license 3.0: // Attribution-ShareAlike CC BY-SA // // This software is furnished "as is", without technical support, and with no // warranty, express or implied, as to its usefulness for any purpose. // // Thread Safe: No // Extendable: Yes // // @file LiquidCrystal_I2C.c // This file implements a basic liquid crystal library that comes as standard // in the Arduino SDK but using an I2C IO extension board. // // @brief // This is a basic implementation of the LiquidCrystal library of the // Arduino SDK. The original library has been reworked in such a way that // this class implements the all methods to command an LCD based // on the Hitachi HD44780 and compatible chipsets using I2C extension // backpacks such as the I2CLCDextraIO with the PCF8574* I2C IO Expander ASIC. // // The functionality provided by this class and its base class is identical // to the original functionality of the Arduino LiquidCrystal library. // // // // @author F. Malpartida - fmalpartida@gmail.com // --------------------------------------------------------------------------- #if (ARDUINO < 100) #include <WProgram.h> #else #include <Arduino.h> #endif #include <inttypes.h> #include "I2CIO.h" #include "LiquidCrystal_I2C.h" // CONSTANT definitions // --------------------------------------------------------------------------- // flags for backlight control /*! @defined @abstract LCD_NOBACKLIGHT @discussion NO BACKLIGHT MASK */ #define LCD_NOBACKLIGHT 0x00 /*! @defined @abstract LCD_BACKLIGHT @discussion BACKLIGHT MASK used when backlight is on */ #define LCD_BACKLIGHT 0xFF // Default library configuration parameters used by class constructor with // only the I2C address field. // --------------------------------------------------------------------------- /*! @defined @abstract Enable bit of the LCD @discussion Defines the IO of the expander connected to the LCD Enable */ #define EN 6 // Enable bit /*! @defined @abstract Read/Write bit of the LCD @discussion Defines the IO of the expander connected to the LCD Rw pin */ #define RW 5 // Read/Write bit /*! @defined @abstract Register bit of the LCD @discussion Defines the IO of the expander connected to the LCD Register select pin */ #define RS 4 // Register select bit /*! @defined @abstract LCD dataline allocation this library only supports 4 bit LCD control mode. @discussion D4, D5, D6, D7 LCD data lines pin mapping of the extender module */ #define D4 0 #define D5 1 #define D6 2 #define D7 3 // CONSTRUCTORS // --------------------------------------------------------------------------- LiquidCrystal_I2C::LiquidCrystal_I2C( uint8_t lcd_Addr ) { config(lcd_Addr, EN, RW, RS, D4, D5, D6, D7); } LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol = POSITIVE) { config(lcd_Addr, EN, RW, RS, D4, D5, D6, D7); setBacklightPin(backlighPin, pol); } LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs) { config(lcd_Addr, En, Rw, Rs, D4, D5, D6, D7); } LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, uint8_t backlighPin, t_backlighPol pol = POSITIVE) { config(lcd_Addr, En, Rw, Rs, D4, D5, D6, D7); setBacklightPin(backlighPin, pol); } LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7 ) { config(lcd_Addr, En, Rw, Rs, d4, d5, d6, d7); } LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t backlighPin, t_backlighPol pol = POSITIVE ) { config(lcd_Addr, En, Rw, Rs, d4, d5, d6, d7); setBacklightPin(backlighPin, pol); } // PUBLIC METHODS // --------------------------------------------------------------------------- // // begin void LiquidCrystal_I2C::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) { init(); // Initialise the I2C expander interface LCD::begin ( cols, lines, dotsize ); } // User commands - users can expand this section //---------------------------------------------------------------------------- // Turn the (optional) backlight off/on // // setBacklightPin void LiquidCrystal_I2C::setBacklightPin ( uint8_t value, t_backlighPol pol = POSITIVE ) { _backlightPinMask = ( 1 << value ); _polarity = pol; setBacklight(BACKLIGHT_OFF); } // // setBacklight void LiquidCrystal_I2C::setBacklight( uint8_t value ) { // Check if backlight is available // ---------------------------------------------------- if ( _backlightPinMask != 0x0 ) { // Check for polarity to configure mask accordingly // ---------------------------------------------------------- if (((_polarity == POSITIVE) && (value > 0)) || ((_polarity == NEGATIVE ) && ( value == 0 ))) { _backlightStsMask = _backlightPinMask & LCD_BACKLIGHT; } else { _backlightStsMask = _backlightPinMask & LCD_NOBACKLIGHT; } _i2cio.write( _backlightStsMask ); } } // PRIVATE METHODS // --------------------------------------------------------------------------- // // init int LiquidCrystal_I2C::init() { int status = 0; // initialize the backpack IO expander // and display functions. // ------------------------------------------------------------------------ if ( _i2cio.begin ( _Addr ) == 1 ) { _i2cio.portMode ( OUTPUT ); // Set the entire IO extender to OUTPUT _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; status = 1; _i2cio.write(0); // Set the entire port to LOW } return ( status ); } // // config void LiquidCrystal_I2C::config (uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7 ) { _Addr = lcd_Addr; _backlightPinMask = 0; _backlightStsMask = LCD_NOBACKLIGHT; _polarity = POSITIVE; _En = ( 1 << En ); _Rw = ( 1 << Rw ); _Rs = ( 1 << Rs ); // Initialise pin mapping _data_pins[0] = ( 1 << d4 ); _data_pins[1] = ( 1 << d5 ); _data_pins[2] = ( 1 << d6 ); _data_pins[3] = ( 1 << d7 ); } // low level data pushing commands //---------------------------------------------------------------------------- // // send - write either command or data void LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) { // No need to use the delay routines since the time taken to write takes // longer that what is needed both for toggling and enable pin an to execute // the command. if ( mode == FOUR_BITS ) { write4bits( (value & 0x0F), COMMAND ); } else { write4bits( (value >> 4), mode ); write4bits( (value & 0x0F), mode); } } // // write4bits void LiquidCrystal_I2C::write4bits ( uint8_t value, uint8_t mode ) { uint8_t pinMapValue = 0; // Map the value to LCD pin mapping // -------------------------------- for ( uint8_t i = 0; i < 4; i++ ) { if ( ( value & 0x1 ) == 1 ) { pinMapValue |= _data_pins[i]; } value = ( value >> 1 ); } // Is it a command or data // ----------------------- if ( mode == LCD_DATA ) { mode = _Rs; } pinMapValue |= mode | _backlightStsMask; pulseEnable ( pinMapValue ); } // // pulseEnable void LiquidCrystal_I2C::pulseEnable (uint8_t data) { _i2cio.write (data | _En); // En HIGH _i2cio.write (data & ~_En); // En LOW }
[ "ainsey11@users.noreply.github.com" ]
ainsey11@users.noreply.github.com
4192c1dd0d889051b51908ad03d50719ff66fe2f
66561d5af3949f8187ba94b9bfc586f0fb51c879
/Minesweeper/NewGame.cpp
bcf65f7befa6929a215d0a33c323573c557853b6
[]
no_license
whinyadventure/Minesweeper-Game-Project
6c47979dd7cda8ed104c7063bdcb6c559b8472cf
d2bc99d6d02748ce5c469808e00fb6f3c8fcfb2a
refs/heads/master
2020-05-24T21:02:05.567384
2019-05-19T11:35:19
2019-05-19T11:35:19
187,467,687
0
1
null
null
null
null
UTF-8
C++
false
false
7,804
cpp
#include "headers/variables.h" #include "headers/newGame.h" #include "headers/board.h" #include "headers/gameplay.h" void setNewGameDisplay() { al_clear_to_color(darkBlue); al_draw_text(title_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y, ALLEGRO_ALIGN_CENTRE, "MINESWEEPER"); al_draw_text(info_font, infoColor, MINESWEEPER_X, MINESWEEPER_Y + 60, ALLEGRO_ALIGN_CENTRE, "Choose difficulty level"); al_draw_text(menu_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y + 110, ALLEGRO_ALIGN_CENTRE, "easy"); al_draw_text(menu_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y + 165, ALLEGRO_ALIGN_CENTRE, "medium"); al_draw_text(menu_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y + 220, ALLEGRO_ALIGN_CENTRE, "hard"); al_draw_text(menu_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y + 275, ALLEGRO_ALIGN_CENTRE, "custom"); al_draw_text(menu_font, infoColor, MINESWEEPER_X, MINESWEEPER_Y + 340, ALLEGRO_ALIGN_CENTRE, "back"); } void setCustomDisplay(int cursor) { al_clear_to_color(darkBlue); al_draw_text(title_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y, ALLEGRO_ALIGN_CENTRE, "MINESWEEPER"); al_draw_text(info_font, infoColor, MINESWEEPER_X, MINESWEEPER_Y + 60, ALLEGRO_ALIGN_CENTRE, "Specify the dimentions"); al_draw_text(info_font, infoColor, MINESWEEPER_X, MINESWEEPER_Y + 85, ALLEGRO_ALIGN_CENTRE, "max 30 x 24"); al_draw_text(menu_font, lightBlue, MINESWEEPER_X - 110, MINESWEEPER_Y + 140, ALLEGRO_ALIGN_CENTRE, "X = "); al_draw_filled_rectangle(MINESWEEPER_X - 75, MINESWEEPER_Y + 140, MINESWEEPER_X + 180, MINESWEEPER_Y + 180, infoColor); al_draw_ustr(nbr_font, lightBlue, MINESWEEPER_X - 65, MINESWEEPER_Y + 140, ALLEGRO_ALIGN_LEFT, input_X); al_draw_text(menu_font, lightBlue, MINESWEEPER_X - 110, MINESWEEPER_Y + 200, ALLEGRO_ALIGN_CENTRE, "Y = "); al_draw_filled_rectangle(MINESWEEPER_X - 75, MINESWEEPER_Y + 200, MINESWEEPER_X + 180, MINESWEEPER_Y + 240, infoColor); al_draw_ustr(nbr_font, lightBlue, MINESWEEPER_X - 65, MINESWEEPER_Y + 200, ALLEGRO_ALIGN_LEFT, input_Y); al_draw_text(menu_font, lightBlue, MINESWEEPER_X - 140, MINESWEEPER_Y + 260, ALLEGRO_ALIGN_CENTRE, "mines = "); al_draw_filled_rectangle(MINESWEEPER_X - 75, MINESWEEPER_Y + 260, MINESWEEPER_X + 180, MINESWEEPER_Y + 300, infoColor); al_draw_ustr(nbr_font, lightBlue, MINESWEEPER_X - 65, MINESWEEPER_Y + 260, ALLEGRO_ALIGN_LEFT, input_mines); if (cursor == 0) al_draw_rectangle(MINESWEEPER_X - 75, MINESWEEPER_Y + 140, MINESWEEPER_X + 180, MINESWEEPER_Y + 180, lightBlue, 1); else if(cursor == 1) al_draw_rectangle(MINESWEEPER_X - 75, MINESWEEPER_Y + 200, MINESWEEPER_X + 180, MINESWEEPER_Y + 240, lightBlue, 1); else if(cursor == 2) al_draw_rectangle(MINESWEEPER_X - 75, MINESWEEPER_Y + 260, MINESWEEPER_X + 180, MINESWEEPER_Y + 300, lightBlue, 1); } void warning(bool smaller) { if(smaller) al_draw_text(menu_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y + 320, ALLEGRO_ALIGN_CENTRE, "Choose smaller number !"); else al_draw_text(menu_font, lightBlue, MINESWEEPER_X, MINESWEEPER_Y + 320, ALLEGRO_ALIGN_CENTRE, "Choose greater number !"); } void newGameLoop() { int mouse_x, mouse_y; while (true) { setNewGameDisplay(); al_wait_for_event(event_queue, &events); if (events.type == ALLEGRO_EVENT_MOUSE_AXES) { mouse_x = events.mouse.x; mouse_y = events.mouse.y; if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 104) && (mouse_y <= MINESWEEPER_Y + 154)) al_draw_rectangle(MINESWEEPER_X - 130, MINESWEEPER_Y + 104, MINESWEEPER_X + 125, MINESWEEPER_Y + 154, lightBlue, 1); else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 159) && (mouse_y <= MINESWEEPER_Y + 209)) al_draw_rectangle(MINESWEEPER_X - 130, MINESWEEPER_Y + 159, MINESWEEPER_X + 125, MINESWEEPER_Y + 209, lightBlue, 1); else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 214) && (mouse_y <= MINESWEEPER_Y + 264)) al_draw_rectangle(MINESWEEPER_X - 130, MINESWEEPER_Y + 214, MINESWEEPER_X + 125, MINESWEEPER_Y + 264, lightBlue, 1); else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 269) && (mouse_y <= MINESWEEPER_Y + 319)) al_draw_rectangle(MINESWEEPER_X - 130, MINESWEEPER_Y + 269, MINESWEEPER_X + 125, MINESWEEPER_Y + 319, lightBlue, 1); else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 334) && (mouse_y <= MINESWEEPER_Y + 384)) al_draw_rectangle(MINESWEEPER_X - 130, MINESWEEPER_Y + 334, MINESWEEPER_X + 125, MINESWEEPER_Y + 384, infoColor, 1); } else if (events.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { mouse_x = events.mouse.x; mouse_y = events.mouse.y; if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 104) && (mouse_y <= MINESWEEPER_Y + 154)) { fill_boardData(8, 8, 10); gameplayLoop(); break; } else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 159) && (mouse_y <= MINESWEEPER_Y + 209)) { fill_boardData(16, 16, 40); gameplayLoop(); break; } else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 214) && (mouse_y <= MINESWEEPER_Y + 264)) { fill_boardData(16, 30, 99); gameplayLoop(); break; } else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 269) && (mouse_y <= MINESWEEPER_Y + 319)) { customLoop(); break; } else if ((mouse_x >= MINESWEEPER_X - 130) && (mouse_x <= MINESWEEPER_X + 125) && (mouse_y >= MINESWEEPER_Y + 334) && (mouse_y <= MINESWEEPER_Y + 384)) break; } al_flip_display(); } } void customLoop() { ALLEGRO_USTR **ptr; ptr = &input_X; int number, digit, p; setCustomDisplay(3); for (int i = 0; i < 3; i++) { number = NULL; *ptr = al_ustr_new(""); p = (int)al_ustr_size(*ptr); while (true) { al_register_event_source(event_queue, al_get_keyboard_event_source()); al_wait_for_event(event_queue, &events); setCustomDisplay(i); if (events.type == ALLEGRO_EVENT_KEY_CHAR) { if (events.keyboard.unichar >= '0' && events.keyboard.unichar <= '9') { p += al_ustr_append_chr(*ptr, events.keyboard.unichar); digit = events.keyboard.unichar - '0'; number = number * 10 + digit; } else if (events.keyboard.keycode == ALLEGRO_KEY_BACKSPACE) { if (al_ustr_prev(*ptr, &p)) al_ustr_truncate(*ptr, p); number = number / 10; } else if (events.keyboard.keycode == ALLEGRO_KEY_ENTER) { if (i == 0) { if (number < 10 || number > 30) { if (number < 10) warning(0); else warning(1); al_flip_display(); continue; } new_board.columns = number; ptr = &input_Y; *ptr = al_ustr_new(""); p = (int)al_ustr_size(*ptr); } else if (i == 1) { if (number < 10 || number > 24) { if (number < 10) warning(0); else warning(1); al_flip_display(); continue; } new_board.rows = number; ptr = &input_mines; *ptr = al_ustr_new(""); p = (int)al_ustr_size(*ptr); } else if (i == 2) { if (number < 10 || number > ((new_board.columns - 1) * (new_board.rows - 1))) { if (number < 10) warning(0); else if (number > ((new_board.columns - 1) * (new_board.rows - 1))) warning(1); al_flip_display(); continue; } new_board.mines = number; } break; } } al_flip_display(); } } input_X = NULL; input_Y = NULL; input_mines = NULL; gameplayLoop(); }
[ "mizera.aleksandra@gmail.com" ]
mizera.aleksandra@gmail.com
2fab0c880c3ce16b7657173f5481598842eb3a0b
06711d689eb1637346013b84be6f212f994249e7
/Linked List Problems 1/printreverse1.cpp
3fc5c6430c901def3f857783260c954b95493651
[]
no_license
talhaarshad7/Problem-Solving-Data-Structures-and-Algorithms
5f3dc01ecaebe7f0130a32e514e1a253a891984a
d38efab338a79c00ac7e505914e31aa864e164f1
refs/heads/main
2023-07-27T00:06:01.916276
2021-09-09T16:14:32
2021-09-09T16:14:32
404,788,484
0
0
null
null
null
null
UTF-8
C++
false
false
781
cpp
#include<iostream> using namespace std; #include"nodeclass.cpp" Node *takeInput() { int data; cin >> data; Node *head = NULL; Node *tail = NULL; while (data != -1) { Node *newNode = new Node(data); if (head == NULL) { head = newNode; tail = head; //or tail=newNode; } else { tail->next = newNode; tail = newNode; //tail=tail->next; } cin >> data; } return head; } void revprint(Node *head) { if(head==NULL) return; revprint(head->next); cout<<head->data<<" "; } void solve() { Node* head=takeInput(); revprint(head); cout<<endl; } int main() { int testcase; cin>>testcase; while(testcase--) solve(); }
[ "talhaarshad7860@gmail.com" ]
talhaarshad7860@gmail.com
7088c26f0da73134b877472af02d454291346821
383b4ee67dd82d261d806afabe0a5636f8c118fd
/Programs/equalizerdialog.cpp
715b6e6d06eaa6767df263923646527a851612b0
[ "MIT" ]
permissive
nstitely/Car_Audio
396f412723b90c895e1e688fe688c689574419fe
43a3d2b318ee1fdebcc375108990d16e8af47fda
refs/heads/main
2023-06-15T22:04:19.525331
2021-07-20T04:15:17
2021-07-20T04:15:17
387,539,757
0
0
MIT
2021-07-19T17:10:27
2021-07-19T17:10:26
null
UTF-8
C++
false
false
3,103
cpp
#include "equalizerdialog.h" #include <QtWidgets> EqualizerDialog::EqualizerDialog(QWidget *parent) : QDialog(parent) , balance(new QLabel) , bass(new QLabel) , treble(new QLabel) { QVBoxLayout *verticalLayout; int frameStyle = QFrame::Sunken | QFrame::Panel; balanceLabel = new QLabel; balanceLabel->setFrameStyle(frameStyle); QPushButton *balanceBtn = new QPushButton(tr("Update Balance")); balanceLabel->setText(tr("%1%").arg(x)); bassLabel = new QLabel; bassLabel->setFrameStyle(frameStyle); QPushButton *bassBtn = new QPushButton(tr("Update Bass")); bassLabel->setText(tr("%1%").arg(y)); trebleLabel = new QLabel; trebleLabel->setFrameStyle(frameStyle); QPushButton *trebleBtn = new QPushButton(tr("Update Treble")); trebleLabel->setText(tr("%1%").arg(z)); connect(balanceBtn, &QAbstractButton::clicked, this, &EqualizerDialog::setBalance); connect(bassBtn, &QAbstractButton::clicked, this, &EqualizerDialog::setBass); connect(trebleBtn, &QAbstractButton::clicked, this, &EqualizerDialog::setTreble); QWidget *page = new QWidget; QGridLayout *layout = new QGridLayout(page); layout->setColumnStretch(1, 1); layout->setColumnMinimumWidth(1, 250); layout->addWidget(balanceBtn, 0, 0); layout->addWidget(balanceLabel, 0, 1); layout->addWidget(bassBtn, 1, 0); layout->addWidget(bassLabel, 1, 1); layout->addWidget(trebleBtn, 2, 0); layout->addWidget(trebleLabel, 2, 1); layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0); setLayout(layout); } // setters for the new balance, bass, and treble levels. // also prevents users from inputting anything that isn't between 0-100% void EqualizerDialog::setBalance() { bool ok; x = QInputDialog::getInt(this, tr("Balance Level"), tr("Percentage:"), 50, 0, 100, 1, &ok); if (ok) balanceLabel->setText(tr("%1%").arg(x)); } void EqualizerDialog::setBass() { bool ok; y = QInputDialog::getInt(this, tr("Bass Level"), tr("Percentage:"), 50, 0, 100, 1, &ok); if (ok) bassLabel->setText(tr("%1%").arg(y)); } void EqualizerDialog::setTreble() { bool ok; z = QInputDialog::getInt(this, tr("Treble Level"), tr("Percentage:"), 50, 0, 100, 1, &ok); if (ok) trebleLabel->setText(tr("%1%").arg(z)); } int EqualizerDialog::getBalance() { return x; } int EqualizerDialog::getBass() { return y; } int EqualizerDialog::getTreble() { return z; } // passes the balance, bass, and treble levels by reference from the main window to the dialog window so that when the user changes the values they get updated in the main window. void EqualizerDialog::getLevels(int &balance, int &bass, int &treble) { balance = x; bass = y; treble = z; return; }
[ "stitely28@gmail.com" ]
stitely28@gmail.com
38b8c7182781c9d1e5023e2640a58abeb87b09fa
3ab31f7ced13dd544b8a1bc9f51cf050d4d08809
/compare_2number.cpp
96ae34d2d98a59eae3f7e582c05d96252556ce04
[]
no_license
mushroomchan/Accelerate-Cpp
810a68bd069f311b4ca1f57418aebcfe0ce9560f
150dd949201708900ebc5fee7d2b27afeb0b583e
refs/heads/main
2023-09-03T07:31:19.108035
2021-11-01T14:02:04
2021-11-01T14:02:04
410,485,527
0
0
null
null
null
null
UTF-8
C++
false
false
355
cpp
#include <iostream> using namespace std; int main() { cout<<"Please enter two number to compare their value: "; int a=0,b=0; cin>>a>>b; cout<<endl; if(a>b) cout<<a<<" is larger than "<<b<<endl; else if(a<b) cout<<b<<" is larger than "<<a<<endl; else cout<<a<<" is equal to "<<b<<endl; return 0; }
[ "ddchen@pku.edu.cn" ]
ddchen@pku.edu.cn
40a8239dd79f92b19b8169e62cd5e9d6d974c425
3002a846820eb48aa8204df5572f64c25f0df0a4
/foo_discord_rich/ui/ui_pref_tab_advanced.cpp
f73110b66c099e401e3885aeeb63ee4554459cc3
[ "MIT" ]
permissive
hsuallan/foo_discord_rich
df5918c952498b1e52cea5e4f1e45ea0d024bdf0
5a793a2e22517b2d45bb748dfbaf288785b8f158
refs/heads/master
2021-01-08T17:31:26.537272
2020-01-29T11:33:37
2020-01-29T11:33:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,814
cpp
#include <stdafx.h> #include "ui_pref_tab_advanced.h" #include <ui/ui_pref_tab_manager.h> #include <discord_impl.h> #include <config.h> namespace drp::ui { using namespace config; PreferenceTabAdvanced::PreferenceTabAdvanced( PreferenceTabManager* pParent ) : pParent_( pParent ) , configs_( { CreateUiCfgWrap( config::g_discordAppToken, IDC_TEXTBOX_APP_TOKEN ), CreateUiCfgWrap( config::g_largeImageId_Light, IDC_TEXTBOX_LARGE_LIGHT_ID ), CreateUiCfgWrap( config::g_largeImageId_Dark, IDC_TEXTBOX_LARGE_DARK_ID ), CreateUiCfgWrap( config::g_playingImageId_Light, IDC_TEXTBOX_SMALL_PLAYING_LIGHT_ID ), CreateUiCfgWrap( config::g_playingImageId_Dark, IDC_TEXTBOX_SMALL_PLAYING_DARK_ID ), CreateUiCfgWrap( config::g_pausedImageId_Light, IDC_TEXTBOX_SMALL_PAUSED_LIGHT_ID ), CreateUiCfgWrap( config::g_pausedImageId_Dark, IDC_TEXTBOX_SMALL_PAUSED_DARK_ID ) } ) { } PreferenceTabAdvanced::~PreferenceTabAdvanced() { for ( auto& config : configs_ ) { config->GetCfg().Revert(); } } HWND PreferenceTabAdvanced::CreateTab( HWND hParent ) { return Create( hParent ); } CDialogImplBase& PreferenceTabAdvanced::Dialog() { return *this; } const wchar_t* PreferenceTabAdvanced::Name() const { return L"Advanced"; } t_uint32 PreferenceTabAdvanced::get_state() { const bool hasChanged = configs_.cend() != std::find_if( configs_.cbegin(), configs_.cend(), []( const auto& config ) { return config->GetCfg().HasChanged(); } ); return ( preferences_state::resettable | ( hasChanged ? preferences_state::changed : 0 ) ); } void PreferenceTabAdvanced::apply() { for ( auto& config : configs_ ) { config->GetCfg().Apply(); } } void PreferenceTabAdvanced::reset() { for ( auto& config : configs_ ) { config->GetCfg().ResetToDefault(); } UpdateUiFromCfg(); } BOOL PreferenceTabAdvanced::OnInitDialog( HWND hwndFocus, LPARAM lParam ) { for ( auto& config : configs_ ) { config->SetHwnd( m_hWnd ); } UpdateUiFromCfg(); return TRUE; // set focus to default control } void PreferenceTabAdvanced::OnEditChange( UINT uNotifyCode, int nID, CWindow wndCtl ) { auto it = std::find_if( configs_.begin(), configs_.end(), [nID]( auto& val ) { return val->IsMatchingId( nID ); } ); if ( configs_.end() != it ) { ( *it )->ReadFromUi(); } OnChanged(); } void PreferenceTabAdvanced::OnChanged() { pParent_->OnDataChanged(); } void PreferenceTabAdvanced::UpdateUiFromCfg() { if ( !this->m_hWnd ) { return; } for ( auto& config : configs_ ) { config->WriteToUi(); } } } // namespace drp::ui
[ "qwertiest@mail.ru" ]
qwertiest@mail.ru
4bb2f0c28afee57d19f97a0cbee92dfc9c6adae6
9ada6ca9bd5e669eb3e903f900bae306bf7fd75e
/case3/ddtFoam_Tutorial/0.002700000/c
4f1d4ed61b88082a25e3e0ed8d37e98a4fbb5811
[]
no_license
ptroyen/DDT
a6c8747f3a924a7039b71c96ee7d4a1618ad4197
6e6ddc7937324b04b22fbfcf974f9c9ea24e48bf
refs/heads/master
2020-05-24T15:04:39.786689
2018-01-28T21:36:40
2018-01-28T21:36:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
53,407
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.002700000"; object c; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 12384 ( 1 1 1 1 1 1 1 1 1 1 1 1 0.107448 0.00107734 0.0149697 0.0920704 0.207741 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.349845 0.188532 0.100324 0.0223015 0.000420052 3.86224e-06 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.330592 0.0460992 0.000616315 1.36802e-05 3.75056e-07 0.210492 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.146722 0.113991 0.0855848 0.0566843 0.0454487 0.00140348 0.000225271 0.000326852 0.00039205 4.287e-05 0.00521325 0.045822 0.981785 1 1 1 1 1 1 1 1 1 1 1 1 1 0.193978 0.0769601 0.0419735 0.00529652 0.00141741 0.000595589 8.80946e-05 5.46568e-06 2.13527e-07 2.19708e-09 9.82667e-12 4.01262e-14 1.70657e-16 8.35528e-19 3.22722e-23 2.49511e-21 6.72411e-20 5.43359e-19 1.8233e-18 2.90855e-18 4.59462e-18 2.33511e-17 7.77592e-17 7.20105e-16 5.50162e-15 6.83654e-15 6.31042e-15 1.26238e-15 1.30329e-17 2.87469e-20 1.2357e-23 2.24314e-27 1.45178e-31 7.79294e-36 5.11433e-40 4.10003e-44 3.90783e-48 4.30326e-52 4.94646e-56 6.01876e-60 8.4318e-64 1.06121e-67 1.28416e-71 1.49557e-75 2.12643e-90 6.35104e-92 1.26514e-95 1.8887e-99 2.12983e-103 2.03772e-107 1.77245e-111 1.4451e-115 1.14192e-119 8.77818e-124 6.62107e-128 4.89483e-132 3.54887e-136 2.5379e-140 1.77749e-144 1.23412e-148 8.40688e-153 5.69583e-157 3.79767e-161 2.51916e-165 1.33848e-171 8.06923e-178 1.18954e-183 1.2375e-188 1.30162e-193 8.19944e-199 2.26616e-204 4.70072e-210 1.08244e-215 4.17835e-221 2.51975e-241 3.33246e-245 6.6963e-251 9.4976e-257 1.15112e-262 1.28461e-268 1.36969e-274 1.43108e-280 1.48949e-286 1.55552e-292 1.63273e-298 1.73421e-304 1.88374e-310 2.12063e-316 2.42092e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.363841 0.0274479 0.000151609 0.0740509 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0892597 0.00198681 1.61789e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0691196 0.000511562 1.20382e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0140875 0.0135323 0.0578802 0.0293872 0.00262567 0.068288 0.969948 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.137072 0.0470453 0.0346494 0.00560707 0.000696654 5.82878e-05 7.41783e-07 3.23477e-09 5.59878e-12 1.88753e-14 7.66481e-17 2.92445e-20 3.24262e-18 1.41032e-16 1.95565e-15 8.54246e-15 1.45336e-14 2.19742e-14 6.39614e-14 2.05449e-13 1.6609e-12 1.93871e-11 2.4629e-11 2.87374e-11 7.62476e-12 2.02515e-13 4.3084e-16 2.48711e-19 4.40605e-23 2.21639e-27 2.48196e-32 1.6928e-36 5.6404e-42 2.52935e-45 5.3707e-49 4.55456e-53 3.26213e-57 4.23167e-60 4.73108e-64 5.04573e-68 5.23669e-72 2.70428e-86 8.36281e-88 1.56498e-91 2.1677e-95 2.08037e-99 1.64633e-103 1.11347e-107 6.87974e-112 4.11108e-116 2.4359e-120 1.4862e-124 9.07994e-129 5.76775e-133 3.66502e-137 2.39328e-141 1.58727e-145 1.09942e-149 7.83816e-154 5.88199e-158 4.49417e-162 3.50526e-166 4.08002e-172 1.67841e-177 3.32698e-182 3.39238e-187 1.94225e-192 4.94319e-198 9.44532e-204 1.95757e-209 5.74789e-215 2.43531e-235 3.77097e-239 6.39934e-245 8.02723e-251 8.77737e-257 9.04028e-263 9.06858e-269 9.01799e-275 9.01613e-281 9.09596e-287 9.29386e-293 9.64304e-299 1.02643e-304 1.13327e-310 1.31113e-316 1.28457e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.288477 0.0281071 0.00024566 0.199172 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0617395 0.000497964 4.47555e-06 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.270594 0.00938451 7.03508e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.9953 1 0.217703 0.0279142 0.0899966 0.995881 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0925191 0.032074 0.00460221 0.000256431 1.74123e-06 2.94291e-09 3.40936e-12 1.10083e-14 3.27231e-17 6.7224e-15 5.27938e-13 8.50171e-12 2.8985e-11 4.45236e-11 4.51217e-11 9.90465e-11 2.06362e-10 9.51829e-10 2.585e-08 3.88505e-08 4.48891e-08 1.74888e-08 9.47581e-10 2.22526e-12 2.22319e-15 1.24247e-18 3.09538e-22 3.75387e-26 2.97883e-30 8.94245e-36 3.62702e-40 2.00978e-44 1.08151e-48 4.76003e-53 5.77353e-56 2.72867e-60 1.38006e-64 5.18898e-69 1.03008e-81 3.44498e-83 6.17793e-87 8.14532e-91 6.95889e-95 5.03139e-99 2.76683e-103 1.53323e-107 6.90246e-112 3.83233e-116 1.78681e-120 1.08845e-124 5.48621e-129 3.69441e-133 2.09199e-137 1.53833e-141 1.01473e-145 8.10726e-150 6.06957e-154 5.03576e-158 3.84743e-162 3.10558e-166 2.50149e-171 8.83798e-176 8.19777e-181 4.31655e-186 1.00269e-191 1.74323e-197 3.19851e-203 7.09354e-209 3.65224e-229 5.53349e-233 7.82988e-239 8.24394e-245 7.67407e-251 6.84814e-257 6.10278e-263 5.52729e-269 5.11359e-275 4.84879e-281 4.71092e-287 4.70153e-293 4.83111e-299 5.14897e-305 5.72724e-311 6.70027e-317 3.95253e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.371574 0.0478602 0.000606156 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999314 0.420472 0.125927 0.0117445 9.84297e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.259992 0.0114207 0.00014514 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.994758 0.0803597 0.00673289 0.0863398 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.119722 0.0130376 0.000354468 1.74256e-06 2.19772e-09 2.22559e-12 6.8457e-14 2.00559e-11 1.22826e-09 1.64689e-08 4.61432e-08 6.8007e-08 6.10721e-08 9.75265e-08 2.20578e-07 6.60864e-07 2.36278e-05 3.28181e-05 4.81996e-05 2.19708e-05 2.33483e-06 6.15343e-09 7.07636e-12 4.58842e-15 2.07827e-18 5.78328e-22 1.02953e-25 1.06924e-29 8.3645e-34 5.23978e-38 3.04025e-42 1.43753e-46 6.21534e-51 2.06834e-55 5.83808e-60 1.11697e-64 1.66643e-76 4.72595e-78 8.9309e-82 1.09807e-85 1.06674e-89 7.13477e-94 4.31809e-98 2.13006e-102 1.13449e-106 5.2078e-111 2.95488e-115 1.46483e-119 8.88576e-124 4.90039e-128 3.2107e-132 2.01145e-136 1.46651e-140 1.0659e-144 8.61105e-149 6.94645e-153 5.72894e-157 4.62289e-161 3.6413e-165 2.3327e-169 1.97375e-174 1.00623e-179 2.21421e-185 3.54412e-191 5.69316e-197 9.71183e-203 7.73099e-223 1.17849e-226 1.3245e-232 1.15431e-238 9.07284e-245 6.87596e-251 5.24002e-257 4.10955e-263 3.35367e-269 2.85517e-275 2.53472e-281 2.34127e-287 2.24978e-293 2.25102e-299 2.35237e-305 2.581e-311 2.9913e-317 1.97626e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.998246 0.167543 0.0057438 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.99887 0.442151 0.419916 0.0682842 0.00171419 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.126024 0.00168451 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0605542 0.0748849 1 1 1 1 0.278807 0.335947 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.12753 0.0118251 0.000270678 7.67336e-07 8.04672e-10 1.32106e-10 2.38359e-08 1.1505e-06 1.93701e-05 4.94455e-05 7.82705e-05 7.06949e-05 8.91969e-05 0.000487486 0.00113526 0.0147888 0.020571 0.0313906 0.0151625 0.00387705 1.33126e-05 1.66918e-08 1.26117e-11 6.3166e-15 2.35744e-18 5.75471e-22 1.10981e-25 1.44887e-29 1.44845e-33 1.15248e-37 8.07261e-42 4.67131e-46 2.07057e-50 6.2618e-55 1.15512e-59 9.78242e-72 2.01606e-73 3.79345e-77 6.04435e-81 6.54326e-85 5.69994e-89 3.74332e-93 2.22787e-97 1.2084e-101 6.75144e-106 3.54894e-110 2.10052e-114 1.16732e-118 7.45175e-123 4.46655e-127 3.13238e-131 2.10425e-135 1.65881e-139 1.24515e-143 1.05986e-147 8.48003e-152 7.37788e-156 5.92328e-160 4.89439e-164 3.4077e-168 1.88215e-173 4.43305e-179 6.78251e-185 9.72708e-191 1.31949e-196 1.8351e-216 2.55409e-220 2.42605e-226 1.79339e-232 1.20354e-238 7.85807e-245 5.14479e-251 3.47469e-257 2.45574e-263 1.83404e-269 1.44557e-275 1.20204e-281 1.04999e-287 9.65019e-294 9.32386e-300 9.50456e-306 1.02359e-311 1.17448e-317 4.94066e-324 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0.997888 0.110324 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999917 0.999846 0.998639 0.193158 0.0113609 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.132159 0.00331928 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.1674 0.064619 1 1 1 0.869193 0.034422 0.155753 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.117974 0.00699818 0.000122821 1.68419e-07 1.18055e-07 1.21307e-05 0.00142684 0.0138928 0.0295961 0.0457519 0.0477146 0.0570413 0.0547156 0.0839484 0.117984 0.216922 0.242083 0.20883 0.080617 0.0198801 4.44496e-05 3.03689e-08 1.54363e-11 6.33734e-15 1.9648e-18 4.11091e-22 7.62015e-26 1.1498e-29 1.41236e-33 1.43961e-37 1.24815e-41 8.14616e-46 3.68009e-50 8.37942e-55 2.55679e-67 3.09488e-69 5.6089e-73 8.9826e-77 1.2624e-80 1.38349e-84 1.21171e-88 8.64297e-93 5.64289e-97 3.47202e-101 2.18655e-105 1.29407e-109 8.50057e-114 5.20465e-118 3.60743e-122 2.37666e-126 1.80595e-130 1.33047e-134 1.10312e-138 8.7787e-143 7.55166e-147 6.22177e-151 5.4084e-155 4.45168e-159 3.60027e-163 2.69709e-167 7.8514e-173 1.20012e-178 1.57493e-184 1.77831e-190 4.58582e-210 6.62664e-214 4.65985e-220 2.83819e-226 1.61989e-232 9.17343e-239 5.27314e-245 3.1032e-251 1.90553e-257 1.23645e-263 8.53244e-270 6.26693e-276 4.89543e-282 4.06187e-288 3.57426e-294 3.32666e-300 3.27537e-306 3.44013e-312 3.88698e-318 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.161747 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.997736 0.135207 0.0151014 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.994236 0.0497629 0.00488241 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.997188 0.17833 0.0355743 1 1 1 0.0531342 0.046938 0.262597 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.172448 0.0125413 3.28612e-05 6.11039e-05 0.00406341 0.155461 0.242643 0.362984 0.422509 0.445381 0.413682 0.406419 0.435908 0.528598 0.995871 1 1 0.536339 0.181163 0.0411941 0.000188638 3.11295e-08 1.31398e-11 4.53609e-15 1.19325e-18 2.14976e-22 3.74181e-26 5.84503e-30 8.41339e-34 1.0639e-37 1.12982e-41 8.39726e-46 2.95851e-50 3.78285e-63 3.425e-65 4.85881e-69 6.92291e-73 9.48304e-77 1.21764e-80 1.36577e-84 1.30015e-88 1.05989e-92 7.96816e-97 5.67867e-101 4.03096e-105 2.72057e-109 1.96502e-113 1.34063e-117 1.02097e-121 7.49998e-126 6.24643e-130 4.97478e-134 4.36341e-138 3.59753e-142 3.18333e-146 2.65514e-150 2.34639e-154 1.9159e-158 1.58472e-162 1.2152e-166 1.97871e-172 2.40725e-178 2.36645e-184 1.17966e-203 1.2779e-207 7.45965e-214 3.8633e-220 1.91038e-226 9.45977e-233 4.83648e-239 2.56161e-245 1.39324e-251 7.93408e-258 4.77404e-264 3.06775e-270 2.10692e-276 1.55273e-282 1.22561e-288 1.03762e-294 9.3992e-301 9.14001e-307 9.55767e-313 1.08069e-318 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.25824 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.99639 0.138026 0.129527 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.989233 0.0904045 0.0949154 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.990658 0.102743 0.00393899 0.0636268 0.104032 0.0521571 0.0722492 0.994489 0.994766 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.191169 0.00635554 0.0138915 0.0618452 0.989108 1 1 1 1 1 1 1 0.998306 0.99983 1 1 0.997394 1 0.277829 0.0485865 4.3928e-05 1.90867e-08 7.59561e-12 2.2044e-15 4.89249e-19 7.72062e-23 1.24239e-26 1.94346e-30 3.04206e-34 4.46489e-38 4.97952e-42 2.33383e-46 4.4688e-59 3.89356e-61 3.60577e-65 3.94149e-69 4.60951e-73 5.42453e-77 6.28845e-81 6.86062e-85 6.99746e-89 6.51657e-93 5.74195e-97 4.76314e-101 3.84763e-105 2.96311e-109 2.36329e-113 1.84292e-117 1.55102e-121 1.29213e-125 1.14454e-129 9.87027e-134 8.80485e-138 7.61687e-142 6.73242e-146 5.80419e-150 5.04758e-154 4.2298e-158 3.48674e-162 2.81075e-166 3.31958e-172 2.88289e-178 2.96566e-197 2.49055e-201 9.8997e-208 3.97328e-214 1.61814e-220 6.81971e-227 3.02251e-233 1.43332e-239 7.12477e-246 3.65621e-252 1.96101e-258 1.11579e-264 6.80797e-271 4.4878e-277 3.20399e-283 2.47915e-289 2.06987e-295 1.86285e-301 1.80879e-307 1.90539e-313 2.18757e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.993078 0.99976 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.994595 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999976 0.991627 1 1 0.935211 0.925893 0.914927 0.950937 0.972407 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.19078 0.0878678 0.105281 0.135945 0.2322 0.970853 1 1 1 1 1 1 1 1 1 1 1 0.999996 1 1 0.274108 0.0359152 2.02097e-05 8.15305e-09 2.56929e-12 5.80624e-16 1.01893e-19 1.37169e-23 2.03894e-27 3.3077e-31 5.80545e-35 9.81661e-39 1.17781e-42 1.00948e-46 8.30746e-51 6.55416e-55 7.80617e-59 1.06112e-62 1.63109e-66 2.44075e-70 3.35848e-74 4.45964e-78 5.7976e-82 7.26616e-86 8.85137e-90 1.03887e-93 1.16094e-97 1.28065e-101 1.35097e-105 1.4023e-109 1.41592e-113 1.39171e-117 1.35508e-121 1.28027e-125 1.20546e-129 1.10505e-133 1.01111e-137 9.08409e-142 8.1243e-146 7.19154e-150 6.31018e-154 5.40824e-158 4.55625e-162 3.73762e-166 3.08068e-172 2.04589e-178 1.25413e-184 7.23753e-191 4.08593e-197 2.27268e-203 1.23777e-209 6.69765e-216 3.64849e-222 2.02475e-228 1.15028e-234 6.5581e-241 3.75061e-247 2.19036e-253 1.33047e-259 8.48838e-266 5.74786e-272 4.13817e-278 3.18435e-284 2.61775e-290 2.30003e-296 2.15845e-302 2.1696e-308 2.34302e-314 2.73416e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999994 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.992836 0.997405 1 1 0.995915 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999652 1 0.187067 0.0161356 6.17603e-06 1.72124e-09 3.79251e-13 6.06992e-17 8.50791e-21 1.16648e-24 1.9845e-28 3.67474e-32 6.73489e-36 1.14676e-39 1.79948e-43 2.48864e-47 3.4404e-51 4.43712e-55 6.01895e-59 8.02064e-63 1.01769e-66 1.25046e-70 1.48337e-74 1.76809e-78 2.10511e-82 2.47693e-86 2.91713e-90 3.31907e-94 3.77432e-98 4.16151e-102 4.53665e-106 4.82061e-110 5.0774e-114 5.19204e-118 5.27867e-122 5.21051e-126 5.10664e-130 4.876e-134 4.62454e-138 4.29036e-142 3.95849e-146 3.58875e-150 3.22415e-154 2.83146e-158 2.45763e-162 2.08188e-166 1.33354e-172 7.76434e-179 4.34838e-185 2.40015e-191 1.27805e-197 6.64021e-204 3.42836e-210 1.77715e-216 9.30052e-223 4.82233e-229 2.48294e-235 1.28993e-241 6.8916e-248 3.83792e-254 2.25135e-260 1.4008e-266 9.26046e-273 6.51522e-279 4.87412e-285 3.88619e-291 3.30115e-297 3.0013e-303 2.92889e-309 3.08248e-315 3.38929e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.558199 0.0951765 0.00304228 4.66179e-07 6.13569e-11 9.89231e-15 1.86925e-18 3.78341e-22 6.7136e-26 1.13429e-29 1.82895e-33 2.99261e-37 4.69704e-41 7.89042e-45 1.20054e-48 1.92853e-52 2.85846e-56 3.94059e-60 5.16275e-64 6.23837e-68 7.46936e-72 8.78979e-76 1.04425e-79 1.23911e-83 1.43587e-87 1.67133e-91 1.88882e-95 2.09547e-99 2.31046e-103 2.47576e-107 2.64576e-111 2.75349e-115 2.84806e-119 2.8848e-123 2.89162e-127 2.85655e-131 2.79326e-135 2.69762e-139 2.58904e-143 2.45648e-147 2.31995e-151 2.1613e-155 1.99393e-159 1.81059e-163 1.4842e-167 9.69991e-174 5.55656e-180 2.91999e-186 1.42734e-192 6.76569e-199 3.16822e-205 1.46843e-211 6.69681e-218 3.11789e-224 1.52647e-230 7.99049e-237 4.49296e-243 2.69092e-249 1.70414e-255 1.12997e-261 7.8238e-268 5.64529e-274 4.24016e-280 3.32521e-286 2.72965e-292 2.35528e-298 2.14495e-304 2.07705e-310 2.15014e-316 2.02567e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.31999 0.0344116 1.49249e-05 6.44308e-09 2.09027e-12 5.11125e-16 8.26799e-20 1.24145e-23 1.81403e-27 2.84478e-31 4.60635e-35 7.99622e-39 1.32253e-42 2.04847e-46 3.08069e-50 4.092e-54 5.56814e-58 6.87102e-62 8.61231e-66 1.01966e-69 1.21972e-73 1.42036e-77 1.66082e-81 1.8708e-85 2.10904e-89 2.33047e-93 2.50669e-97 2.70535e-101 2.82636e-105 2.94078e-109 2.98199e-113 2.994e-117 2.94862e-121 2.88009e-125 2.7678e-129 2.64823e-133 2.49702e-137 2.34556e-141 2.17472e-145 2.00789e-149 1.83148e-153 1.6606e-157 1.4833e-161 1.30909e-165 1.44692e-171 1.45237e-177 1.34667e-183 1.14634e-189 8.91571e-196 6.19857e-202 3.98641e-208 2.41416e-214 1.40975e-220 8.03404e-227 4.54108e-233 2.5678e-239 1.46657e-245 8.52444e-252 5.07519e-258 3.11929e-264 1.99343e-270 1.33786e-276 9.48677e-283 7.17511e-289 5.83216e-295 5.1185e-301 4.86947e-307 5.03117e-313 5.65547e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.567789 0.133366 0.00759865 1.656e-06 3.3184e-10 5.01619e-14 7.28991e-18 1.09626e-21 2.0404e-25 3.64037e-29 6.14911e-33 9.29245e-37 1.38458e-40 1.88919e-44 2.75235e-48 3.58438e-52 5.03604e-56 6.20439e-60 7.97353e-64 9.44285e-68 1.12448e-71 1.29077e-75 1.4681e-79 1.63259e-83 1.78914e-87 1.90853e-91 1.988e-95 2.03804e-99 2.02958e-103 2.00878e-107 1.93383e-111 1.86194e-115 1.74944e-119 1.64366e-123 1.51259e-127 1.38666e-131 1.25015e-135 1.12099e-139 9.91123e-144 8.72088e-148 7.57914e-152 6.55091e-156 5.58139e-160 4.70888e-164 3.14326e-168 2.01754e-174 1.08678e-180 5.14856e-187 2.30301e-193 1.02626e-199 4.84611e-206 2.49431e-212 1.41371e-218 8.60628e-225 5.52224e-231 3.65319e-237 2.47609e-243 1.7083e-249 1.20159e-255 8.62565e-262 6.33898e-268 4.7873e-274 3.73065e-280 3.01284e-286 2.53355e-292 2.23632e-298 2.08381e-304 2.06905e-310 2.20575e-316 2.17389e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.312249 0.0412319 3.22909e-05 1.23538e-08 3.64726e-12 8.03251e-16 1.40824e-19 2.0571e-23 2.9182e-27 4.05832e-31 6.03499e-35 9.23114e-39 1.44864e-42 2.16084e-46 3.07305e-50 4.03578e-54 5.09623e-58 6.02433e-62 7.1855e-66 8.25913e-70 9.53977e-74 1.05997e-77 1.17794e-81 1.24819e-85 1.3303e-89 1.35006e-93 1.38699e-97 1.36422e-101 1.35188e-105 1.29065e-109 1.23321e-113 1.14158e-117 1.05417e-121 9.48759e-126 8.52115e-130 7.49778e-134 6.58674e-138 5.6881e-142 4.9014e-146 4.15416e-150 3.49905e-154 2.89737e-158 2.38348e-162 1.91481e-166 1.64409e-172 1.28481e-178 9.07091e-185 5.93769e-191 3.62811e-197 2.12217e-203 1.19883e-209 6.66305e-216 3.66062e-222 2.01396e-228 1.11395e-234 6.27515e-241 3.62358e-247 2.17312e-253 1.36342e-259 9.0465e-266 6.37409e-272 4.79526e-278 3.85741e-284 3.31614e-290 3.04343e-296 2.97614e-302 3.10041e-308 3.44845e-314 4.10173e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.482639 0.089045 0.0030028 4.82538e-07 6.06038e-11 9.05334e-15 1.52326e-18 3.07788e-22 5.54544e-26 9.29546e-30 1.43042e-33 2.12343e-37 3.09433e-41 4.47701e-45 6.51638e-49 8.8181e-53 1.1918e-56 1.47545e-60 1.8293e-64 2.17193e-68 2.58203e-72 2.98703e-76 3.46247e-80 3.85229e-84 4.29018e-88 4.53815e-92 4.81489e-96 4.86815e-100 4.95337e-104 4.85295e-108 4.79181e-112 4.59737e-116 4.44399e-120 4.19737e-124 3.98914e-128 3.71824e-132 3.47935e-136 3.19689e-140 2.93293e-144 2.64055e-148 2.36718e-152 2.08396e-156 1.8243e-160 1.56967e-164 1.45541e-170 1.09374e-176 8.63838e-183 6.14671e-189 4.48418e-195 3.13733e-201 2.22984e-207 1.56402e-213 1.10505e-219 7.78439e-226 5.51641e-232 3.92e-238 2.81049e-244 2.03415e-250 1.49491e-256 1.11896e-262 8.56953e-269 6.74758e-275 5.49432e-281 4.65846e-287 4.14127e-293 3.88318e-299 3.88195e-305 4.16343e-311 4.819e-317 3.45846e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.401244 0.103389 0.00290526 5.17118e-07 8.88965e-11 1.7109e-14 4.14975e-18 8.60179e-22 1.80669e-25 3.42477e-29 5.93955e-33 9.31447e-37 1.39203e-40 1.8686e-44 2.5956e-48 3.25747e-52 4.49104e-56 5.68994e-60 7.80797e-64 1.01518e-67 1.35849e-71 1.74476e-75 2.24327e-79 2.73171e-83 3.30998e-87 3.77021e-91 4.28774e-95 4.62904e-99 5.01957e-103 5.25606e-107 5.56422e-111 5.76725e-115 6.06053e-119 6.27056e-123 6.54785e-127 6.72261e-131 6.90475e-135 6.94662e-139 6.93791e-143 6.7702e-147 6.53043e-151 6.1543e-155 5.72695e-159 5.21817e-163 4.59915e-167 3.22577e-173 2.10798e-179 1.30019e-185 7.56078e-192 4.22822e-198 2.28156e-204 1.20974e-210 6.34032e-217 3.34545e-223 1.7962e-229 1.00204e-235 5.88922e-242 3.70979e-248 2.51715e-254 1.8431e-260 1.44425e-266 1.20344e-272 1.05901e-278 9.80046e-285 9.51764e-291 9.6966e-297 1.03782e-302 1.17401e-308 1.40771e-314 1.80087e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0.0955475 0.00179197 0.0227598 0.141174 0.211586 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.318573 0.172284 0.107687 0.0172889 0.000297272 3.04854e-06 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.36187 0.0407721 0.000312532 8.86114e-06 2.90305e-07 0.192876 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.153844 0.121547 0.0979738 0.0726711 0.0643497 0.00148674 0.000165548 0.000175533 6.56791e-05 1.59595e-05 0.00600378 0.0506842 0.987608 1 1 1 1 1 1 1 1 1 1 1 1 1 0.210816 0.0771349 0.045813 0.00495241 0.00115979 0.000601086 9.96315e-05 6.12585e-06 2.33982e-07 2.44894e-09 1.10141e-11 4.18139e-14 1.84195e-16 9.47916e-19 2.22052e-23 2.01919e-21 7.15878e-20 7.01683e-19 2.21955e-18 3.93411e-18 6.39044e-18 1.43834e-17 1.27773e-16 7.01466e-16 2.81475e-15 9.54885e-15 5.12745e-15 1.06321e-15 2.16737e-17 2.82016e-20 1.3722e-23 3.06746e-27 1.99707e-31 1.49152e-35 1.27822e-39 1.20289e-43 1.22893e-47 1.29969e-51 1.42264e-55 1.5e-59 1.64186e-63 1.74982e-67 1.82388e-71 1.9335e-75 2.78172e-90 4.36538e-92 1.02698e-95 1.5408e-99 1.81042e-103 1.7855e-107 1.56609e-111 1.29486e-115 1.0278e-119 8.01347e-124 6.15427e-128 4.6773e-132 3.52799e-136 2.63037e-140 1.95249e-144 1.42669e-148 1.03686e-152 7.40032e-157 5.24158e-161 3.64763e-165 1.98313e-171 1.1931e-177 1.75013e-183 1.56821e-188 2.42164e-193 1.24581e-198 3.53185e-204 7.6425e-210 1.72941e-215 6.04734e-221 3.11484e-241 3.3639e-245 6.19925e-251 8.50483e-257 1.01568e-262 1.12453e-268 1.18939e-274 1.22982e-280 1.26502e-286 1.30416e-292 1.35233e-298 1.4182e-304 1.52307e-310 1.69453e-316 1.5316e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0.0610867 0.000242148 0.0896125 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0956952 0.00283252 2.4483e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.475348 0.0393346 0.000315866 7.58971e-06 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.994433 0.0124535 0.0266279 0.0101673 0.00916786 0.000930917 0.0674542 0.968232 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.143515 0.0426653 0.0317202 0.00548822 0.000770358 5.08527e-05 8.36876e-07 2.74498e-09 6.7018e-12 1.89611e-14 9.10512e-17 2.00332e-20 2.61122e-18 1.44206e-16 2.41385e-15 9.76329e-15 1.86077e-14 2.61703e-14 4.91513e-14 2.77222e-13 2.36206e-12 8.64949e-12 3.62471e-11 2.24321e-11 7.45133e-12 2.71598e-13 4.69016e-16 2.30003e-19 5.31103e-23 2.62378e-28 2.23268e-32 1.8253e-36 7.40643e-42 3.04579e-45 8.21276e-49 5.88209e-53 4.80323e-57 5.51492e-60 5.86132e-64 5.83403e-68 5.80069e-72 3.38794e-86 5.37334e-88 1.21883e-91 1.66731e-95 1.7472e-99 1.41366e-103 9.74378e-108 6.11374e-112 3.66988e-116 2.21716e-120 1.3503e-124 8.62e-129 5.56478e-133 3.7446e-137 2.56769e-141 1.82264e-145 1.32831e-149 1.01351e-153 7.81053e-158 6.24707e-162 4.91372e-166 5.65894e-172 2.4028e-177 4.07452e-182 6.00592e-187 2.95079e-192 7.63142e-198 1.50756e-203 3.07537e-209 8.44872e-215 3.14894e-235 3.6249e-239 5.65717e-245 6.72423e-251 7.12245e-257 7.18794e-263 7.09491e-269 6.96298e-275 6.86391e-281 6.84364e-287 6.90723e-293 7.09739e-299 7.4849e-305 8.20756e-311 9.44744e-317 5.92879e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.353895 0.0334428 0.000286771 0.239437 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0548597 0.000510936 5.46157e-06 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.997109 0.243084 0.00680645 5.45484e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.998345 1 0.295475 0.0453762 0.00243042 0.0872167 0.996215 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.103508 0.0299728 0.00553954 0.000202644 1.89012e-06 2.96343e-09 5.1887e-12 1.42664e-14 2.1004e-17 5.64491e-15 5.32888e-13 1.00386e-11 3.59092e-11 4.90901e-11 6.49156e-11 7.27157e-11 2.59319e-10 3.57725e-09 1.17043e-08 4.98837e-08 4.13009e-08 1.63739e-08 1.17928e-09 2.26465e-12 2.19848e-15 1.12039e-18 2.92102e-22 3.29101e-26 2.95531e-30 1.09975e-35 4.20505e-40 2.7995e-44 1.45362e-48 7.10065e-53 7.96369e-56 3.51963e-60 1.74656e-64 6.09958e-69 1.18019e-81 1.98574e-83 4.46714e-87 5.68239e-91 5.71333e-95 3.99749e-99 2.48973e-103 1.22668e-107 6.78096e-112 3.1016e-116 1.82566e-120 9.00545e-125 5.99549e-129 3.36435e-133 2.5151e-137 1.62729e-141 1.32591e-145 9.93963e-150 8.33692e-154 6.66308e-158 5.51233e-162 4.23992e-166 3.56935e-171 1.05877e-175 1.37072e-180 6.48203e-186 1.534e-191 2.72441e-197 4.92776e-203 1.04779e-208 4.76269e-229 5.58406e-233 6.78156e-239 6.54184e-245 5.76416e-251 4.9509e-257 4.29864e-263 3.81459e-269 3.4763e-275 3.2528e-281 3.13098e-287 3.10037e-293 3.17344e-299 3.37531e-305 3.76174e-311 4.41971e-317 2.47033e-323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.359727 0.0590373 0.00102501 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.996853 0.408486 0.127864 0.0100948 9.31559e-05 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999435 0.123874 0.00711059 0.000230628 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.0644716 0.00287726 0.0832572 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.105614 0.0138433 0.000349914 2.21579e-06 2.28853e-09 3.17517e-12 4.21015e-14 1.57048e-11 1.13771e-09 1.9364e-08 5.56485e-08 6.90593e-08 9.16368e-08 9.51927e-08 1.47989e-07 4.26855e-06 1.00203e-05 4.84241e-05 3.99599e-05 2.23498e-05 2.87675e-06 6.14465e-09 6.64168e-12 4.33088e-15 1.7914e-18 5.41109e-22 9.01459e-26 1.06044e-29 9.12328e-34 6.74967e-38 4.00524e-42 2.1347e-46 8.44379e-51 2.90162e-55 7.50016e-60 1.24678e-64 1.78139e-76 2.73549e-78 5.59398e-82 8.06281e-86 7.48051e-90 5.88967e-94 3.432e-98 1.94194e-102 9.19792e-107 5.09585e-111 2.45271e-115 1.46615e-119 7.90218e-124 5.20515e-128 3.22307e-132 2.3593e-136 1.69002e-140 1.36788e-144 1.09833e-148 9.39402e-153 7.78735e-157 6.44667e-161 5.18258e-165 2.80595e-169 3.11177e-174 1.49265e-179 3.35241e-185 5.41659e-191 8.62048e-197 1.42908e-202 1.0213e-222 1.09571e-226 1.08652e-232 8.62449e-239 6.32478e-245 4.55253e-251 3.33399e-257 2.53962e-263 2.02797e-269 1.70148e-275 1.49641e-281 1.37686e-287 1.3239e-293 1.33151e-299 1.40448e-305 1.56155e-311 1.84137e-317 4.94066e-324 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0.998965 0.185098 0.00661897 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.998104 0.441667 0.360514 0.0628348 0.00115683 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.99953 0.202789 0.00439811 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.103016 0.0721782 1 1 1 1 0.283406 0.338187 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.117194 0.0137111 0.000264671 9.68295e-07 6.70138e-10 8.48524e-11 1.74559e-08 9.47619e-07 2.07157e-05 6.04492e-05 7.44107e-05 0.000128042 0.000172223 0.000137364 0.00438255 0.00892171 0.0284131 0.024432 0.0181722 0.00334326 1.22816e-05 2.06736e-08 1.23727e-11 5.74884e-15 1.97427e-18 5.27176e-22 9.65725e-26 1.43406e-29 1.58386e-33 1.4523e-37 1.089e-41 6.55386e-46 2.83298e-50 8.47765e-55 1.45278e-59 1.10492e-71 1.14645e-73 2.60123e-77 3.94523e-81 4.89607e-85 4.19125e-89 3.03345e-93 1.83698e-97 1.06291e-101 5.72204e-106 3.34207e-110 1.83805e-114 1.16252e-118 6.96895e-123 4.89065e-127 3.27442e-131 2.57946e-135 1.932e-139 1.65578e-143 1.33028e-147 1.18524e-151 9.76122e-156 8.58651e-160 6.7029e-164 5.16527e-168 2.75411e-173 6.6572e-179 1.01632e-184 1.44808e-190 1.91443e-196 2.452e-216 2.66872e-220 1.98351e-226 1.28312e-232 7.8663e-239 4.79154e-245 2.97861e-251 1.93102e-257 1.32803e-263 9.73774e-270 7.62539e-276 6.34223e-282 5.59374e-288 5.21424e-294 5.14787e-300 5.37851e-306 5.97339e-312 7.0848e-318 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0.997646 0.111916 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999992 1 1 0.181436 0.0103299 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999213 0.057096 0.00168301 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.210597 0.0603926 1 1 1 1 0.0467571 0.148497 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.117366 0.00880177 0.000100692 1.95549e-07 6.78946e-08 9.31213e-06 0.000897193 0.0138058 0.0352356 0.0447543 0.0573415 0.0498893 0.0623629 0.0804575 0.139963 0.192016 0.273295 0.184126 0.0984381 0.0187937 0.000132954 6.02934e-08 1.50857e-11 5.65004e-15 1.63946e-18 3.74239e-22 6.68868e-26 1.11994e-29 1.56332e-33 1.81031e-37 1.64628e-41 1.13065e-45 4.9614e-50 1.11157e-54 2.72869e-67 1.88539e-69 3.47325e-73 5.85966e-77 8.51802e-81 1.01242e-84 9.13282e-89 6.95341e-93 4.70355e-97 3.06002e-101 1.8772e-105 1.238e-109 7.64164e-114 5.34134e-118 3.53813e-122 2.70047e-126 1.98406e-130 1.6568e-134 1.32549e-138 1.16024e-142 9.67979e-147 8.58137e-151 7.30736e-155 6.33769e-159 5.04906e-163 3.9023e-167 1.17063e-172 1.77263e-178 2.30497e-184 2.5672e-190 6.23883e-210 5.1406e-214 3.2712e-220 1.81116e-226 9.57027e-233 5.07288e-239 2.76114e-245 1.55818e-251 9.29081e-258 5.9379e-264 4.09073e-270 3.03889e-276 2.42668e-282 2.07632e-288 1.89677e-294 1.84195e-300 1.90035e-306 2.09799e-312 2.49998e-318 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.16707 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.997441 0.103444 0.013043 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.995848 0.0408399 0.0043191 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.16853 0.0207996 0.672095 1 0.302115 0.0582695 0.0440271 0.283369 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.153408 0.00849035 2.20711e-05 3.59216e-05 0.00244117 0.139195 0.237375 0.370123 0.441859 0.444219 0.432916 0.40359 0.452635 0.534295 0.987781 1 1 0.470118 0.215108 0.036683 0.000509462 6.29596e-08 1.25946e-11 4.11331e-15 1.01397e-18 2.01632e-22 3.3953e-26 5.85273e-30 9.34087e-34 1.31784e-37 1.49004e-41 1.16858e-45 3.94285e-50 3.89632e-63 2.03181e-65 2.81112e-69 4.10129e-73 5.95828e-77 8.11962e-81 9.87033e-85 9.81601e-89 8.52236e-93 6.71082e-97 5.02236e-101 3.58281e-105 2.64892e-109 1.85582e-113 1.4336e-117 1.06147e-121 8.87628e-126 7.10333e-130 6.31574e-134 5.28848e-138 4.79429e-142 4.07947e-146 3.68974e-150 3.15367e-154 2.75834e-158 2.20205e-162 1.799e-166 2.89024e-172 3.47861e-178 3.38318e-184 1.62515e-203 1.17737e-207 5.33357e-214 2.36157e-220 1.04706e-226 4.7855e-233 2.31288e-239 1.17673e-245 6.27635e-252 3.55689e-258 2.17444e-264 1.43936e-270 1.03519e-276 8.05324e-283 6.76959e-289 6.11333e-295 5.92597e-301 6.15532e-307 6.88265e-313 8.30188e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.303517 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.996425 0.140332 0.117083 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.990198 0.0776353 0.122368 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.991314 0.0948713 0.00319293 0.035645 0.0670977 0.0322687 0.0612818 0.994783 0.996564 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.158493 0.00377254 0.0080385 0.0533106 0.990177 1 1 1 1 0.999948 1 0.999544 1 1 1 1 1 1 0.3085 0.0429681 0.000300644 3.08485e-08 7.21496e-12 2.14381e-15 4.4503e-19 7.78008e-23 1.2261e-26 2.05845e-30 3.45583e-34 5.46921e-38 6.54675e-42 3.3413e-46 4.48895e-59 2.05793e-61 1.82041e-65 2.13184e-69 2.70203e-73 3.38269e-77 4.19269e-81 4.97473e-85 5.36083e-89 5.3849e-93 4.98769e-97 4.38875e-101 3.64729e-105 3.0418e-109 2.44202e-113 2.08495e-117 1.74629e-121 1.5615e-125 1.36212e-129 1.24138e-133 1.09823e-137 9.98075e-142 8.82068e-146 7.92757e-150 6.93347e-154 5.97677e-158 4.97247e-162 4.03627e-166 4.77374e-172 4.11611e-178 4.16098e-197 1.0688e-201 4.06104e-208 1.57282e-214 6.30976e-221 2.65569e-227 1.19723e-233 5.85923e-240 3.03918e-246 1.64609e-252 9.44241e-259 5.81263e-265 3.87249e-271 2.79622e-277 2.18765e-283 1.84479e-289 1.67021e-295 1.61781e-301 1.6814e-307 1.88339e-313 2.28846e-319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.994153 0.999822 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.99542 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999326 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999717 0.98861 1 0.998074 0.940006 0.942282 0.904876 0.941286 0.978466 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.18492 0.0796505 0.0922536 0.150906 0.235734 0.966859 1 1 1 1 1 1 0.999999 1 1 1 0.999997 1 1 1 0.295769 0.0340881 1.9089e-05 8.57994e-09 2.75925e-12 6.91491e-16 1.17155e-19 1.77999e-23 2.60901e-27 4.2209e-31 7.25714e-35 1.21676e-38 1.44618e-42 1.037e-46 7.79526e-51 6.12885e-55 5.7643e-59 9.79151e-63 1.71691e-66 2.73382e-70 3.96802e-74 5.44912e-78 7.29466e-82 9.46795e-86 1.16165e-89 1.35758e-93 1.54265e-97 1.65275e-101 1.74565e-105 1.77115e-109 1.75774e-113 1.72191e-117 1.64669e-121 1.57602e-125 1.47581e-129 1.38716e-133 1.28052e-137 1.18157e-141 1.07757e-145 9.77322e-150 8.72351e-154 7.63561e-158 6.48968e-162 5.37749e-166 4.39708e-172 2.93701e-178 1.78263e-184 1.03121e-190 5.77246e-197 3.17796e-203 1.7177e-209 9.19106e-216 4.95599e-222 2.72462e-228 1.5328e-234 8.68832e-241 4.95421e-247 2.90468e-253 1.77532e-259 1.14737e-265 7.87249e-272 5.76346e-278 4.50447e-284 3.76416e-290 3.3561e-296 3.19819e-302 3.25843e-308 3.5707e-314 4.22821e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.991004 0.998376 0.994797 1 1 0.999785 0.999942 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.199944 0.017756 6.56969e-06 2.032e-09 4.63872e-13 8.28863e-17 1.09247e-20 1.57556e-24 2.57034e-28 4.65501e-32 8.4762e-36 1.4433e-39 2.13918e-43 3.11066e-47 3.88106e-51 5.2609e-55 7.01396e-59 9.55005e-63 1.25961e-66 1.56417e-70 1.91339e-74 2.31892e-78 2.80924e-82 3.38263e-86 3.94241e-90 4.56104e-94 5.06842e-98 5.5608e-102 5.9272e-106 6.23625e-110 6.39065e-114 6.52757e-118 6.507e-122 6.48539e-126 6.33261e-130 6.17451e-134 5.90714e-138 5.63233e-142 5.27298e-146 4.90655e-150 4.46878e-154 4.00408e-158 3.50134e-162 2.9957e-166 1.94598e-172 1.13641e-178 6.5094e-185 3.60241e-191 1.92641e-197 9.99966e-204 5.13163e-210 2.63797e-216 1.36011e-222 6.9572e-229 3.52286e-235 1.80872e-241 9.56049e-248 5.28936e-254 3.0938e-260 1.92425e-266 1.27642e-272 9.01251e-279 6.78503e-285 5.43816e-291 4.65272e-297 4.2573e-303 4.18705e-309 4.44138e-315 5.14322e-321 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.527449 0.109459 0.00373665 6.06314e-07 9.02903e-11 1.37267e-14 2.683e-18 4.89818e-22 9.1631e-26 1.6065e-29 2.6586e-33 4.17702e-37 6.64089e-41 9.85827e-45 1.59249e-48 2.39942e-52 3.59765e-56 5.08383e-60 6.58472e-64 8.29245e-68 9.99178e-72 1.20629e-75 1.44438e-79 1.71124e-83 2.02859e-87 2.31843e-91 2.62494e-95 2.93049e-99 3.19045e-103 3.46989e-107 3.67842e-111 3.88695e-115 4.01826e-119 4.11907e-123 4.15241e-127 4.13484e-131 4.059e-135 3.94548e-139 3.78255e-143 3.60051e-147 3.38449e-151 3.15455e-155 2.88889e-159 2.62131e-163 2.23689e-167 1.5812e-173 1.00927e-179 5.84192e-186 3.14887e-192 1.61644e-198 8.11797e-205 3.92909e-211 1.82477e-217 8.34698e-224 3.86849e-230 1.86195e-236 9.45312e-243 5.12375e-249 2.9659e-255 1.83196e-261 1.20166e-267 8.33196e-274 6.08423e-280 4.67369e-286 3.78327e-292 3.2303e-298 2.92377e-304 2.81923e-310 2.91626e-316 3.16202e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.310535 0.0393959 1.88337e-05 7.75611e-09 2.71273e-12 6.34822e-16 1.13639e-19 1.6306e-23 2.31947e-27 3.40951e-31 5.54409e-35 9.08577e-39 1.54823e-42 2.54034e-46 3.63463e-50 5.33337e-54 6.98258e-58 9.30793e-62 1.14343e-65 1.40883e-69 1.6678e-73 1.97263e-77 2.25929e-81 2.58951e-85 2.86934e-89 3.13787e-93 3.43874e-97 3.66305e-101 3.90955e-105 4.067e-109 4.19658e-113 4.24042e-117 4.23674e-121 4.15593e-125 4.04292e-129 3.86818e-133 3.67915e-137 3.44959e-141 3.21713e-145 2.96278e-149 2.7146e-153 2.45467e-157 2.20099e-161 1.94029e-165 2.13537e-171 2.17187e-177 2.02499e-183 1.76153e-189 1.39368e-195 9.97249e-202 6.58188e-208 4.11881e-214 2.47737e-220 1.45998e-226 8.50772e-233 4.9616e-239 2.9155e-245 1.73853e-251 1.05905e-257 6.62338e-264 4.2905e-270 2.89766e-276 2.05774e-282 1.54852e-288 1.24679e-294 1.08077e-300 1.01396e-306 1.03445e-312 1.14998e-318 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.629266 0.131454 0.00879978 2.16223e-06 4.32906e-10 7.14321e-14 8.86899e-18 1.29462e-21 2.18899e-25 3.94637e-29 6.55847e-33 1.04761e-36 1.53536e-40 2.34806e-44 3.24919e-48 4.82927e-52 6.24739e-56 8.42987e-60 1.01223e-63 1.23063e-67 1.41495e-71 1.61584e-75 1.80523e-79 2.00124e-83 2.17432e-87 2.33097e-91 2.45597e-95 2.52418e-99 2.57054e-103 2.54428e-107 2.50959e-111 2.40945e-115 2.31034e-119 2.16364e-123 2.01776e-127 1.84541e-131 1.67663e-135 1.49908e-139 1.33174e-143 1.16708e-147 1.01762e-151 8.75821e-156 7.48343e-160 6.29793e-164 3.57567e-168 2.23744e-174 1.18422e-180 5.63007e-187 2.5435e-193 1.16851e-199 5.71003e-206 3.06457e-212 1.78471e-218 1.10963e-224 7.16981e-231 4.76614e-237 3.22463e-243 2.22164e-249 1.55702e-255 1.11387e-261 8.15639e-268 6.1376e-274 4.76938e-280 3.83954e-286 3.22306e-292 2.83925e-298 2.64391e-304 2.62478e-310 2.79992e-316 2.56914e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.347991 0.0432874 5.08146e-05 1.39821e-08 4.00006e-12 9.96577e-16 1.76134e-19 2.92552e-23 4.32983e-27 6.26293e-31 8.99628e-35 1.34424e-38 1.97494e-42 2.87215e-46 3.94809e-50 5.18685e-54 6.33179e-58 7.7177e-62 9.04491e-66 1.07458e-69 1.23537e-73 1.41716e-77 1.55362e-81 1.69671e-85 1.75934e-89 1.83227e-93 1.821e-97 1.82494e-101 1.76032e-105 1.70471e-109 1.59899e-113 1.49814e-117 1.3663e-121 1.24235e-125 1.10478e-129 9.80062e-134 8.53811e-138 7.42282e-142 6.35648e-146 5.42422e-150 4.5539e-154 3.80119e-158 3.12603e-162 2.54826e-166 2.24986e-172 1.80673e-178 1.34077e-184 9.19094e-191 5.95372e-197 3.66609e-203 2.1913e-209 1.27822e-215 7.37695e-222 4.22116e-228 2.42195e-234 1.39796e-240 8.21144e-247 4.93519e-253 3.07066e-259 1.99153e-265 1.36081e-271 9.86164e-278 7.63985e-284 6.34677e-290 5.66257e-296 5.42554e-302 5.57528e-308 6.15978e-314 7.31069e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.495641 0.108447 0.0049352 9.14161e-07 1.48993e-10 1.92948e-14 2.8486e-18 4.86886e-22 8.93075e-26 1.50875e-29 2.36928e-33 3.50561e-37 5.10771e-41 7.55082e-45 1.081e-48 1.57857e-52 2.09098e-56 2.76597e-60 3.37261e-64 4.06844e-68 4.69309e-72 5.36959e-76 5.91772e-80 6.53693e-84 6.94232e-88 7.43703e-92 7.65349e-96 7.96761e-100 8.00797e-104 8.12709e-108 7.99666e-112 7.90784e-116 7.59396e-120 7.29423e-124 6.81793e-128 6.36027e-132 5.8016e-136 5.28045e-140 4.71814e-144 4.21195e-148 3.71342e-152 3.27972e-156 2.87096e-160 2.51869e-164 2.0208e-170 1.81067e-176 1.36537e-182 1.07459e-188 7.77555e-195 5.76727e-201 4.13349e-207 3.00193e-213 2.15565e-219 1.56047e-225 1.12781e-231 8.2165e-238 6.01711e-244 4.45918e-250 3.34736e-256 2.55987e-262 2.00075e-268 1.60472e-274 1.32937e-280 1.14435e-286 1.02957e-292 9.75223e-299 9.80147e-305 1.05515e-310 1.21908e-316 1.58101e-322 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.539748 0.100689 0.00670743 2.48617e-06 6.16401e-10 1.1196e-13 1.3642e-17 1.74177e-21 2.48087e-25 4.05042e-29 6.84613e-33 1.17733e-36 1.97355e-40 3.45482e-44 5.52572e-48 9.07536e-52 1.30332e-55 1.87284e-59 2.42325e-63 3.08063e-67 3.66957e-71 4.28824e-75 4.79686e-79 5.38919e-83 5.89277e-87 6.62813e-91 7.3298e-95 8.33417e-99 9.28556e-103 1.04501e-106 1.14218e-110 1.242e-114 1.30538e-118 1.35587e-122 1.36353e-126 1.35502e-130 1.31227e-134 1.26142e-138 1.19211e-142 1.12521e-146 1.05235e-150 9.86892e-155 9.20066e-159 8.59162e-163 7.78257e-167 5.58624e-173 3.8178e-179 2.45397e-185 1.50794e-191 8.84819e-198 5.04544e-204 2.80228e-210 1.54109e-216 8.4378e-223 4.67914e-229 2.65416e-235 1.56907e-241 9.7766e-248 6.51095e-254 4.64856e-260 3.56283e-266 2.91557e-272 2.53673e-278 2.33412e-284 2.265e-290 2.31187e-296 2.48665e-302 2.82763e-308 3.41423e-314 4.38977e-320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) ; boundaryField { wand { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
[ "ubuntu@ip-172-31-45-175.eu-west-1.compute.internal" ]
ubuntu@ip-172-31-45-175.eu-west-1.compute.internal
3ee38e3b8b8760480c4e5cce2c5d89533cb3f168
40f6f140567a45f594991602c20d02ffa602206c
/halfnetwork/HalfNetwork/ACE_wrappers/ace/POSIX_Asynch_IO.cpp
1e4d53246360e91c45ed4901be92a167aee1b6eb
[ "MIT" ]
permissive
sonyeo/com2us_cppNetStudy_work
0f169c0dd66b81d4ab1ffcb3b27659c2d67a4ad7
992d4ecfe66b74e6547d108f570abb58c4294015
refs/heads/master
2020-12-13T05:50:58.021219
2019-10-29T05:53:29
2019-10-29T05:53:29
234,328,099
1
0
MIT
2020-01-16T13:38:16
2020-01-16T13:38:15
null
UTF-8
C++
false
false
74,191
cpp
// $Id: POSIX_Asynch_IO.cpp 84565 2009-02-23 08:20:39Z johnnyw $ #include "ace/POSIX_Asynch_IO.h" #if defined (ACE_HAS_AIO_CALLS) #include "ace/Flag_Manip.h" #include "ace/Proactor.h" #include "ace/Message_Block.h" #include "ace/INET_Addr.h" #include "ace/Asynch_Pseudo_Task.h" #include "ace/POSIX_Proactor.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_NS_sys_stat.h" ACE_RCSID (ace, POSIX_Asynch_IO, "$Id: POSIX_Asynch_IO.cpp 84565 2009-02-23 08:20:39Z johnnyw $") ACE_BEGIN_VERSIONED_NAMESPACE_DECL size_t ACE_POSIX_Asynch_Result::bytes_transferred (void) const { return this->bytes_transferred_; } void ACE_POSIX_Asynch_Result::set_bytes_transferred (size_t nbytes) { this->bytes_transferred_= nbytes; } const void * ACE_POSIX_Asynch_Result::act (void) const { return this->act_; } int ACE_POSIX_Asynch_Result::success (void) const { return this->success_; } const void * ACE_POSIX_Asynch_Result::completion_key (void) const { return this->completion_key_; } u_long ACE_POSIX_Asynch_Result::error (void) const { return this->error_; } void ACE_POSIX_Asynch_Result::set_error (u_long errcode) { this->error_=errcode; } ACE_HANDLE ACE_POSIX_Asynch_Result::event (void) const { return ACE_INVALID_HANDLE; } u_long ACE_POSIX_Asynch_Result::offset (void) const { return this->aio_offset; } u_long ACE_POSIX_Asynch_Result::offset_high (void) const { // // @@ Support aiocb64?? // ACE_NOTSUP_RETURN (0); } int ACE_POSIX_Asynch_Result::priority (void) const { return this->aio_reqprio; } int ACE_POSIX_Asynch_Result::signal_number (void) const { return this->aio_sigevent.sigev_signo; } int ACE_POSIX_Asynch_Result::post_completion (ACE_Proactor_Impl *proactor_impl) { // Get to the platform specific implementation. ACE_POSIX_Proactor *posix_proactor = dynamic_cast<ACE_POSIX_Proactor *> (proactor_impl); if (posix_proactor == 0) ACE_ERROR_RETURN ((LM_ERROR, "Dynamic cast to POSIX Proactor failed\n"), -1); // Post myself. return posix_proactor->post_completion (this); } ACE_POSIX_Asynch_Result::~ACE_POSIX_Asynch_Result (void) { } ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, const void* act, ACE_HANDLE /* event */, // Event is not used on POSIX. u_long offset, u_long offset_high, int priority, int signal_number) : handler_proxy_ (handler_proxy), act_ (act), bytes_transferred_ (0), success_ (0), completion_key_ (0), error_ (0) { aio_offset = offset; aio_reqprio = priority; aio_sigevent.sigev_signo = signal_number; // // @@ Support offset_high with aiocb64. // ACE_UNUSED_ARG (offset_high); // Other fields in the <aiocb> will be initialized by the // subclasses. } // **************************************************************** int ACE_POSIX_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void * /* completion_key */, ACE_Proactor *proactor) { this->proactor_ = proactor; this->handler_proxy_ = handler_proxy; this->handle_ = handle; // Grab the handle from the <handler> if <handle> is invalid if (this->handle_ == ACE_INVALID_HANDLE) { ACE_Handler *handler = handler_proxy.get ()->handler (); if (handler != 0) this->handle_ = handler->handle (); } if (this->handle_ == ACE_INVALID_HANDLE) return -1; #if 0 // @@ If <proactor> is 0, let us not bother about getting this // Proactor, we have already got the specific implementation // Proactor. // If no proactor was passed if (this->proactor_ == 0) { // Grab the proactor from the <Service_Config> if // <handler->proactor> is zero this->proactor_ = this->handler_->proactor (); if (this->proactor_ == 0) this->proactor_ = ACE_Proactor::instance(); } #endif /* 0 */ return 0; } int ACE_POSIX_Asynch_Operation::cancel (void) { if (!posix_proactor_) return -1; return posix_proactor_->cancel_aio (this->handle_); } ACE_Proactor * ACE_POSIX_Asynch_Operation::proactor (void) const { return this->proactor_; } ACE_POSIX_Proactor * ACE_POSIX_Asynch_Operation::posix_proactor (void) const { return this->posix_proactor_; } ACE_POSIX_Asynch_Operation::~ACE_POSIX_Asynch_Operation (void) { } ACE_POSIX_Asynch_Operation::ACE_POSIX_Asynch_Operation (ACE_POSIX_Proactor *posix_proactor) : posix_proactor_ (posix_proactor), handle_ (ACE_INVALID_HANDLE) { } // ********************************************************************* size_t ACE_POSIX_Asynch_Read_Stream_Result::bytes_to_read (void) const { return this->aio_nbytes; } ACE_Message_Block & ACE_POSIX_Asynch_Read_Stream_Result::message_block (void) const { return this->message_block_; } ACE_HANDLE ACE_POSIX_Asynch_Read_Stream_Result::handle (void) const { return this->aio_fildes; } ACE_POSIX_Asynch_Read_Stream_Result::ACE_POSIX_Asynch_Read_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, const void* act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block) { this->aio_fildes = handle; this->aio_buf = message_block.wr_ptr (); this->aio_nbytes = bytes_to_read; } void ACE_POSIX_Asynch_Read_Stream_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // <errno> is available in the aiocb. ACE_UNUSED_ARG (error); // Appropriately move the pointers in the message block. this->message_block_.wr_ptr (bytes_transferred); // Create the interface result class. ACE_Asynch_Read_Stream::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_read_stream (result); } ACE_POSIX_Asynch_Read_Stream_Result::~ACE_POSIX_Asynch_Read_Stream_Result (void) { } // ************************************************************ ACE_POSIX_Asynch_Read_Stream::ACE_POSIX_Asynch_Read_Stream (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor) { } int ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) { size_t space = message_block.space (); if (bytes_to_read > space) bytes_to_read=space; if (bytes_to_read == 0) { errno = ENOSPC; return -1; } // Create the Asynch_Result. ACE_POSIX_Asynch_Read_Stream_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Read_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, act, proactor->get_handle (), priority, signal_number), -1); int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ); if (return_val == -1) delete result; return return_val; } ACE_POSIX_Asynch_Read_Stream::~ACE_POSIX_Asynch_Read_Stream (void) { } // ********************************************************************* size_t ACE_POSIX_Asynch_Write_Stream_Result::bytes_to_write (void) const { return this->aio_nbytes; } ACE_Message_Block & ACE_POSIX_Asynch_Write_Stream_Result::message_block (void) const { return this->message_block_; } ACE_HANDLE ACE_POSIX_Asynch_Write_Stream_Result::handle (void) const { return this->aio_fildes; } ACE_POSIX_Asynch_Write_Stream_Result::ACE_POSIX_Asynch_Write_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, const void* act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block) { this->aio_fildes = handle; this->aio_buf = message_block.rd_ptr (); this->aio_nbytes = bytes_to_write; } void ACE_POSIX_Asynch_Write_Stream_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Get all the data copied. this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // <errno> is available in the aiocb. ACE_UNUSED_ARG (error); // Appropriately move the pointers in the message block. this->message_block_.rd_ptr (bytes_transferred); // Create the interface result class. ACE_Asynch_Write_Stream::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_write_stream (result); } ACE_POSIX_Asynch_Write_Stream_Result::~ACE_POSIX_Asynch_Write_Stream_Result (void) { } // ********************************************************************* ACE_POSIX_Asynch_Write_Stream::ACE_POSIX_Asynch_Write_Stream (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor) { } int ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) { size_t len = message_block.length (); if (bytes_to_write > len) bytes_to_write = len; if (bytes_to_write == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_POSIX_Asynch_Write_Stream::write:") ACE_TEXT ("Attempt to write 0 bytes\n")), -1); ACE_POSIX_Asynch_Write_Stream_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Write_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, act, proactor->get_handle (), priority, signal_number), -1); int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE); if (return_val == -1) delete result; return return_val; } ACE_POSIX_Asynch_Write_Stream::~ACE_POSIX_Asynch_Write_Stream (void) { } // ********************************************************************* ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, const void* act, u_long offset, u_long offset_high, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Read_Stream_Result (handler_proxy, handle, message_block, bytes_to_read, act, event, priority, signal_number) { this->aio_offset = offset; // // @@ Use aiocb64?? // ACE_UNUSED_ARG (offset_high); } void ACE_POSIX_Asynch_Read_File_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy all the data. this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // <errno> is available in the aiocb. ACE_UNUSED_ARG (error); // Appropriately move the pointers in the message block. this->message_block_.wr_ptr (bytes_transferred); // Create the interface result class. ACE_Asynch_Read_File::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_read_file (result); } ACE_POSIX_Asynch_Read_File_Result::~ACE_POSIX_Asynch_Read_File_Result (void) { } // ********************************************************************* ACE_POSIX_Asynch_Read_File::ACE_POSIX_Asynch_Read_File (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Read_Stream (posix_proactor) { } int ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block, size_t bytes_to_read, u_long offset, u_long offset_high, const void *act, int priority, int signal_number) { size_t space = message_block.space (); if ( bytes_to_read > space ) bytes_to_read=space; if ( bytes_to_read == 0 ) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_POSIX_Asynch_Read_File::read:") ACE_TEXT ("Attempt to read 0 bytes or no space in the message block\n")), -1); ACE_POSIX_Asynch_Read_File_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Read_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, act, offset, offset_high, posix_proactor ()->get_handle (), priority, signal_number), -1); int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ); if (return_val == -1) delete result; return return_val; } ACE_POSIX_Asynch_Read_File::~ACE_POSIX_Asynch_Read_File (void) { } int ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) { return ACE_POSIX_Asynch_Read_Stream::read (message_block, bytes_to_read, act, priority, signal_number); } // ************************************************************ ACE_POSIX_Asynch_Write_File_Result::ACE_POSIX_Asynch_Write_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, const void* act, u_long offset, u_long offset_high, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Write_Stream_Result (handler_proxy, handle, message_block, bytes_to_write, act, event, priority, signal_number) { this->aio_offset = offset; // // @@ Support offset_high with aiocb64. // ACE_UNUSED_ARG (offset_high); } void ACE_POSIX_Asynch_Write_File_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy the data. this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // <error> is available in <aio_resultp.aio_error> ACE_UNUSED_ARG (error); // Appropriately move the pointers in the message block. this->message_block_.rd_ptr (bytes_transferred); // Create the interface result class. ACE_Asynch_Write_File::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_write_file (result); } ACE_POSIX_Asynch_Write_File_Result::~ACE_POSIX_Asynch_Write_File_Result (void) { } // ********************************************************************* ACE_POSIX_Asynch_Write_File::ACE_POSIX_Asynch_Write_File (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Write_Stream (posix_proactor) { } int ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block, size_t bytes_to_write, u_long offset, u_long offset_high, const void *act, int priority, int signal_number) { size_t len = message_block.length (); if (bytes_to_write > len) bytes_to_write = len; if (bytes_to_write == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_POSIX_Asynch_Write_File::write:") ACE_TEXT ("Attempt to write 0 bytes\n")), -1); ACE_POSIX_Asynch_Write_File_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Write_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, act, offset, offset_high, proactor->get_handle (), priority, signal_number), -1); int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE); if (return_val == -1) delete result; return return_val; } ACE_POSIX_Asynch_Write_File::~ACE_POSIX_Asynch_Write_File (void) { } int ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) { return ACE_POSIX_Asynch_Write_Stream::write (message_block, bytes_to_write, act, priority, signal_number); } // ********************************************************************* size_t ACE_POSIX_Asynch_Accept_Result::bytes_to_read (void) const { return this->aio_nbytes; } ACE_Message_Block & ACE_POSIX_Asynch_Accept_Result::message_block (void) const { return this->message_block_; } ACE_HANDLE ACE_POSIX_Asynch_Accept_Result::listen_handle (void) const { return this->listen_handle_; } ACE_HANDLE ACE_POSIX_Asynch_Accept_Result::accept_handle (void) const { return this->aio_fildes; } ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, size_t bytes_to_read, const void* act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block), listen_handle_ (listen_handle) { this->aio_fildes = accept_handle; this->aio_nbytes = bytes_to_read; } void ACE_POSIX_Asynch_Accept_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy the data. this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // Appropriately move the pointers in the message block. this->message_block_.wr_ptr (bytes_transferred); // Create the interface result class. ACE_Asynch_Accept::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_accept (result); } ACE_POSIX_Asynch_Accept_Result::~ACE_POSIX_Asynch_Accept_Result (void) { } // ********************************************************************* ACE_POSIX_Asynch_Accept::ACE_POSIX_Asynch_Accept (ACE_POSIX_Proactor * posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor), flg_open_ (false) { } ACE_POSIX_Asynch_Accept::~ACE_POSIX_Asynch_Accept (void) { this->close (); this->reactor (0); // to avoid purge_pending_notifications } ACE_HANDLE ACE_POSIX_Asynch_Accept::get_handle (void) const { return this->handle_; } void ACE_POSIX_Asynch_Accept::set_handle (ACE_HANDLE handle) { ACE_ASSERT (handle_ == ACE_INVALID_HANDLE); this->handle_ = handle; } int ACE_POSIX_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { ACE_TRACE ("ACE_POSIX_Asynch_Accept::open"); // if we are already opened, // we could not create a new handler without closing the previous if (this->flg_open_) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::open:") ACE_TEXT("acceptor already open\n")), -1); if (-1 == ACE_POSIX_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor)) return -1; flg_open_ = true; ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); if (-1 == task.register_io_handler (this->get_handle(), this, ACE_Event_Handler::ACCEPT_MASK, 1)) // suspend after register { this->flg_open_= false; this->handle_ = ACE_INVALID_HANDLE; return -1 ; } return 0; } int ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block, size_t bytes_to_read, ACE_HANDLE accept_handle, const void *act, int priority, int signal_number, int addr_family) { ACE_TRACE ("ACE_POSIX_Asynch_Accept::accept"); if (!this->flg_open_) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::accept") ACE_TEXT("acceptor was not opened before\n")), -1); // Sanity check: make sure that enough space has been allocated by // the caller. size_t address_size = sizeof (sockaddr_in); #if defined (ACE_HAS_IPV6) if (addr_family == AF_INET6) address_size = sizeof (sockaddr_in6); #else ACE_UNUSED_ARG (addr_family); #endif size_t available_space = message_block.space (); size_t space_needed = bytes_to_read + 2 * address_size; if (available_space < space_needed) { ACE_OS::last_error (ENOBUFS); return -1; } // Common code for both WIN and POSIX. // Create future Asynch_Accept_Result ACE_POSIX_Asynch_Accept_Result *result = 0; ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Accept_Result (this->handler_proxy_, this->handle_, accept_handle, message_block, bytes_to_read, act, this->posix_proactor()->get_handle (), priority, signal_number), -1); // Enqueue result { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); if (this->result_queue_.enqueue_tail (result) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_POSIX_Asynch_Accept::accept: %p\n") ACE_TEXT ("enqueue_tail"))); delete result; // to avoid memory leak return -1; } if (this->result_queue_.size () > 1) return 0; } // If this is the only item, then it means there the set was empty // before. So enable the accept handle in the reactor. ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); return task.resume_io_handler (this->get_handle ()); } //@@ New method cancel_uncompleted // It performs cancellation of all pending requests // // Parameter flg_notify can be // 0 - don't send notifications about canceled accepts // !0 - notify user about canceled accepts // according POSIX standards we should receive notifications // on canceled AIO requests // // Return value : number of cancelled requests // int ACE_POSIX_Asynch_Accept::cancel_uncompleted (int flg_notify) { ACE_TRACE ("ACE_POSIX_Asynch_Accept::cancel_uncompleted"); int retval = 0; for (; ; retval++) { ACE_POSIX_Asynch_Accept_Result* result = 0; this->result_queue_.dequeue_head (result); if (result == 0) break; if (this->flg_open_ == 0 || flg_notify == 0) //if we should not notify delete result ; // we have to delete result else //else notify as any cancelled AIO { // Store the new handle. result->aio_fildes = ACE_INVALID_HANDLE ; result->set_bytes_transferred (0); result->set_error (ECANCELED); if (this->posix_proactor ()->post_completion (result) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT("(%P | %t):%p\n"), ACE_TEXT("ACE_POSIX_Asynch_Accept::") ACE_TEXT("cancel_uncompleted") )); } } return retval; } int ACE_POSIX_Asynch_Accept::cancel (void) { ACE_TRACE ("ACE_POSIX_Asynch_Accept::cancel"); // Since this is not a real POSIX asynch I/O operation, we can't // call ::aiocancel () or ACE_POSIX_Asynch_Operation::cancel (). // We delegate real cancelation to cancel_uncompleted (1) int rc = -1 ; // ERRORS { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); int num_cancelled = cancel_uncompleted (flg_open_); if (num_cancelled == 0) rc = 1 ; // AIO_ALLDONE else if (num_cancelled > 0) rc = 0 ; // AIO_CANCELED if (!this->flg_open_) return rc ; } ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); task.suspend_io_handler (this->get_handle()); return 0; } int ACE_POSIX_Asynch_Accept::close () { ACE_TRACE ("ACE_POSIX_Asynch_Accept::close"); // 1. It performs cancellation of all pending requests // 2. Removes itself from Reactor ( ACE_Asynch_Pseudo_Task) // 3. close the socket // // Parameter flg_notify can be // 0 - don't send notifications about canceled accepts // !0 - notify user about canceled accepts // according POSIX standards we should receive notifications // on canceled AIO requests // // Return codes : 0 - OK , // -1 - Errors { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); this->cancel_uncompleted (flg_open_); } if (!this->flg_open_) { if (this->handle_ != ACE_INVALID_HANDLE) { ACE_OS::closesocket (this->handle_); this->handle_ = ACE_INVALID_HANDLE; } return 0; } if (this->handle_ == ACE_INVALID_HANDLE) return 0; ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); task.remove_io_handler (this->get_handle ()); if (this->handle_ != ACE_INVALID_HANDLE) { ACE_OS::closesocket (this->handle_); this->handle_ = ACE_INVALID_HANDLE; } this->flg_open_ = false; return 0; } int ACE_POSIX_Asynch_Accept::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { ACE_TRACE ("ACE_POSIX_Asynch_Accept::handle_close"); ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); // handle_close is called in two cases: // 1. Pseudo task is closing (i.e. proactor destructor) // 2. The listen handle is closed (we don't have exclusive access to this) this->cancel_uncompleted (0); this->flg_open_ = false; this->handle_ = ACE_INVALID_HANDLE; return 0; } int ACE_POSIX_Asynch_Accept::handle_input (ACE_HANDLE /* fd */) { ACE_TRACE ("ACE_POSIX_Asynch_Accept::handle_input"); // An <accept> has been sensed on the <listen_handle>. We should be // able to just go ahead and do the <accept> now on this <fd>. This // should be the same as the <listen_handle>. ACE_POSIX_Asynch_Accept_Result* result = 0; { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); // Deregister this info pertaining to this accept call. if (this->result_queue_.dequeue_head (result) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT("%N:%l:(%P | %t):%p\n"), ACE_TEXT("ACE_POSIX_Asynch_Accept::handle_input:") ACE_TEXT( " dequeueing failed"))); // Disable the handle in the reactor if no more accepts are pending. if (this->result_queue_.size () == 0) { ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); task.suspend_io_handler (this->get_handle()); } } // Issue <accept> now. // @@ We shouldnt block here since we have already done poll/select // thru reactor. But are we sure? ACE_HANDLE new_handle = ACE_OS::accept (this->handle_, 0, 0); if (result == 0) // there is nobody to notify { ACE_OS::closesocket (new_handle); return 0; } if (new_handle == ACE_INVALID_HANDLE) { result->set_error (errno); ACE_ERROR ((LM_ERROR, ACE_TEXT("%N:%l:(%P | %t):%p\n"), ACE_TEXT("ACE_POSIX_Asynch_Accept::handle_input: ") ACE_TEXT("accept"))); // Notify client as usual, "AIO" finished with errors } // Store the new handle. result->aio_fildes = new_handle; // Notify the main process about this completion // Send the Result through the notification pipe. if (this->posix_proactor ()->post_completion (result) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT("Error:(%P | %t):%p\n"), ACE_TEXT("ACE_POSIX_Asynch_Accept::handle_input: ") ACE_TEXT(" <post_completion> failed"))); return 0; } // ********************************************************************* ACE_HANDLE ACE_POSIX_Asynch_Connect_Result::connect_handle (void) const { return this->aio_fildes; } void ACE_POSIX_Asynch_Connect_Result::connect_handle (ACE_HANDLE handle) { this->aio_fildes = handle; } ACE_POSIX_Asynch_Connect_Result::ACE_POSIX_Asynch_Connect_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number) { this->aio_fildes = connect_handle; this->aio_nbytes = 0; } void ACE_POSIX_Asynch_Connect_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy the data. this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // Create the interface result class. ACE_Asynch_Connect::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_connect (result); } ACE_POSIX_Asynch_Connect_Result::~ACE_POSIX_Asynch_Connect_Result (void) { } // ********************************************************************* ACE_POSIX_Asynch_Connect::ACE_POSIX_Asynch_Connect (ACE_POSIX_Proactor * posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor), flg_open_ (false) { } ACE_POSIX_Asynch_Connect::~ACE_POSIX_Asynch_Connect (void) { this->close (); this->reactor(0); // to avoid purge_pending_notifications } ACE_HANDLE ACE_POSIX_Asynch_Connect::get_handle (void) const { ACE_ASSERT (0); return ACE_INVALID_HANDLE; } void ACE_POSIX_Asynch_Connect::set_handle (ACE_HANDLE) { ACE_ASSERT (0) ; } int ACE_POSIX_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::open"); if (this->flg_open_) return -1; //int result = ACE_POSIX_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); // Ignore result as we pass ACE_INVALID_HANDLE //if (result == -1) // return result; this->flg_open_ = true; return 0; } int ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle, const ACE_Addr & remote_sap, const ACE_Addr & local_sap, int reuse_addr, const void *act, int priority, int signal_number) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::connect"); if (this->flg_open_ == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%N:%l:ACE_POSIX_Asynch_Connect::connect") ACE_TEXT("connector was not opened before\n")), -1); // Common code for both WIN and POSIX. // Create future Asynch_Connect_Result ACE_POSIX_Asynch_Connect_Result *result = 0; ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Connect_Result (this->handler_proxy_, connect_handle, act, this->posix_proactor ()->get_handle (), priority, signal_number), -1); int rc = connect_i (result, remote_sap, local_sap, reuse_addr); // update handle connect_handle = result->connect_handle (); if (rc != 0) return post_result (result, true); // Enqueue result we will wait for completion { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); if (this->result_map_.bind (connect_handle, result) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%N:%l:%p\n"), ACE_TEXT ("ACE_POSIX_Asynch_Connect::connect:") ACE_TEXT ("bind"))); result->set_error (EFAULT); return post_result (result, true); } } ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); rc = task.register_io_handler (connect_handle, this, ACE_Event_Handler::CONNECT_MASK, 0); // don't suspend after register if (rc < 0) { { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); this->result_map_.unbind (connect_handle, result); } if (result != 0) { result->set_error (EFAULT); this->post_result (result, true); } return -1; } else result = 0; return 0; } int ACE_POSIX_Asynch_Connect::post_result (ACE_POSIX_Asynch_Connect_Result * result, bool post_enable) { if (this->flg_open_ && post_enable != 0) { if (this->posix_proactor ()->post_completion (result) == 0) return 0; ACE_ERROR ((LM_ERROR, ACE_TEXT("Error:(%P | %t):%p\n"), ACE_TEXT("ACE_POSIX_Asynch_Connect::post_result: ") ACE_TEXT(" <post_completion> failed"))); } ACE_HANDLE handle = result->connect_handle (); if (handle != ACE_INVALID_HANDLE) ACE_OS::closesocket (handle); delete result; return -1; } //connect_i // return code : // -1 errors before attempt to connect // 0 connect started // 1 connect finished ( may be unsuccessfully) int ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result, const ACE_Addr & remote_sap, const ACE_Addr & local_sap, int reuse_addr) { result->set_bytes_transferred (0); ACE_HANDLE handle = result->connect_handle (); if (handle == ACE_INVALID_HANDLE) { int protocol_family = remote_sap.get_type (); handle = ACE_OS::socket (protocol_family, SOCK_STREAM, 0); // save it result->connect_handle (handle); if (handle == ACE_INVALID_HANDLE) { result->set_error (errno); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("ACE_POSIX_Asynch_Connect::connect_i: %p\n"), ACE_TEXT("socket")), -1); } // Reuse the address int one = 1; if (protocol_family != PF_UNIX && reuse_addr != 0 && ACE_OS::setsockopt (handle, SOL_SOCKET, SO_REUSEADDR, (const char*) &one, sizeof one) == -1 ) { result->set_error (errno); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("ACE_POSIX_Asynch_Connect::connect_i: %p\n"), ACE_TEXT("setsockopt")), -1); } } if (local_sap != ACE_Addr::sap_any) { sockaddr * laddr = reinterpret_cast<sockaddr *> (local_sap.get_addr ()); size_t size = local_sap.get_size (); if (ACE_OS::bind (handle, laddr, size) == -1) { result->set_error (errno); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("ACE_POSIX_Asynch_Connect::connect_i: %p\n"), ACE_TEXT("bind")), -1); } } // set non blocking mode if (ACE::set_flags (handle, ACE_NONBLOCK) != 0) { result->set_error (errno); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("ACE_POSIX_Asynch_Connect::connect_i: %p\n") ACE_TEXT("set_flags")), -1); } for (;;) { int rc = ACE_OS::connect (handle, reinterpret_cast<sockaddr *> (remote_sap.get_addr ()), remote_sap.get_size ()); if (rc < 0) // failure { if (errno == EWOULDBLOCK || errno == EINPROGRESS) return 0; // connect started if (errno == EINTR) continue; result->set_error (errno); } return 1 ; // connect finished } ACE_NOTREACHED (return 0); } //@@ New method cancel_uncompleted // It performs cancellation of all pending requests // // Parameter flg_notify can be // 0 - don't send notifications about canceled accepts // !0 - notify user about canceled accepts // according POSIX standards we should receive notifications // on canceled AIO requests // // Return value : number of cancelled requests // int ACE_POSIX_Asynch_Connect::cancel_uncompleted (bool flg_notify, ACE_Handle_Set & set) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::cancel_uncompleted"); int retval = 0; MAP_MANAGER::ITERATOR iter (result_map_); MAP_MANAGER::ENTRY * me = 0; set.reset (); for (; iter.next (me) != 0; retval++ , iter.advance ()) { ACE_HANDLE handle = me->ext_id_; ACE_POSIX_Asynch_Connect_Result* result = me->int_id_ ; set.set_bit (handle); result->set_bytes_transferred (0); result->set_error (ECANCELED); this->post_result (result, flg_notify); } result_map_.unbind_all (); return retval; } int ACE_POSIX_Asynch_Connect::cancel (void) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::cancel"); // Since this is not a real asynch I/O operation, we can't just call // ::aiocancel () or ACE_POSIX_Asynch_Operation::cancel (). // Delegate real cancelation to cancel_uncompleted (1) int rc = -1 ; // ERRORS ACE_Handle_Set set; int num_cancelled = 0; { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); num_cancelled = cancel_uncompleted (flg_open_, set); } if (num_cancelled == 0) rc = 1 ; // AIO_ALLDONE else if (num_cancelled > 0) rc = 0 ; // AIO_CANCELED if (!this->flg_open_) return rc ; ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); task.remove_io_handler (set); return rc; } int ACE_POSIX_Asynch_Connect::close (void) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::close"); ACE_Handle_Set set ; int num_cancelled = 0; { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); num_cancelled = cancel_uncompleted (flg_open_, set); } if (num_cancelled == 0 || !this->flg_open_) { this->flg_open_ = false; return 0; } ACE_Asynch_Pseudo_Task & task = this->posix_proactor ()->get_asynch_pseudo_task (); task.remove_io_handler (set); this->flg_open_ = false; return 0; } int ACE_POSIX_Asynch_Connect::handle_output (ACE_HANDLE fd) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::handle_output"); ACE_POSIX_Asynch_Connect_Result* result = 0; { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); if (this->result_map_.unbind (fd, result) != 0) // not found return -1; } int sockerror = 0 ; int lsockerror = sizeof sockerror; ACE_OS::getsockopt (fd, SOL_SOCKET, SO_ERROR, (char*) &sockerror, &lsockerror); result->set_bytes_transferred (0); result->set_error (sockerror); // This previously just did a "return -1" and let handle_close() clean // things up. However, this entire object may be gone as a result of // the application's completion handler, so don't count on 'this' being // legitimate on return from post_result(). // remove_io_handler() contains flag DONT_CALL this->posix_proactor ()->get_asynch_pseudo_task ().remove_io_handler (fd); this->post_result (result, this->flg_open_); return 0; } int ACE_POSIX_Asynch_Connect::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask) { ACE_TRACE ("ACE_POSIX_Asynch_Connect::handle_close"); ACE_Asynch_Pseudo_Task &task = this->posix_proactor ()->get_asynch_pseudo_task (); task.remove_io_handler (fd); ACE_POSIX_Asynch_Connect_Result* result = 0; { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); if (this->result_map_.unbind (fd, result) != 0) // not found return -1; } result->set_bytes_transferred (0); result->set_error (ECANCELED); this->post_result (result, this->flg_open_); return 0; } // ********************************************************************* ACE_HANDLE ACE_POSIX_Asynch_Transmit_File_Result::socket (void) const { return this->socket_; } ACE_HANDLE ACE_POSIX_Asynch_Transmit_File_Result::file (void) const { return this->aio_fildes; } ACE_Asynch_Transmit_File::Header_And_Trailer * ACE_POSIX_Asynch_Transmit_File_Result::header_and_trailer (void) const { return this->header_and_trailer_; } size_t ACE_POSIX_Asynch_Transmit_File_Result::bytes_to_write (void) const { return this->aio_nbytes; } size_t ACE_POSIX_Asynch_Transmit_File_Result::bytes_per_send (void) const { return this->bytes_per_send_; } u_long ACE_POSIX_Asynch_Transmit_File_Result::flags (void) const { return this->flags_; } ACE_POSIX_Asynch_Transmit_File_Result::ACE_POSIX_Asynch_Transmit_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, size_t bytes_to_write, u_long offset, u_long offset_high, size_t bytes_per_send, u_long flags, const void *act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, offset, offset_high, priority, signal_number), socket_ (socket), header_and_trailer_ (header_and_trailer), bytes_per_send_ (bytes_per_send), flags_ (flags) { this->aio_fildes = file; this->aio_nbytes = bytes_to_write; } void ACE_POSIX_Asynch_Transmit_File_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy the data. this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // We will not do this because (a) the header and trailer blocks may // be the same message_blocks and (b) in cases of failures we have // no idea how much of what (header, data, trailer) was sent. /* if (this->success_ && this->header_and_trailer_ != 0) { ACE_Message_Block *header = this->header_and_trailer_->header (); if (header != 0) header->rd_ptr (this->header_and_trailer_->header_bytes ()); ACE_Message_Block *trailer = this->header_and_trailer_->trailer (); if (trailer != 0) trailer->rd_ptr (this->header_and_trailer_->trailer_bytes ()); } */ // Create the interface result class. ACE_Asynch_Transmit_File::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_transmit_file (result); } ACE_POSIX_Asynch_Transmit_File_Result::~ACE_POSIX_Asynch_Transmit_File_Result (void) { } // ********************************************************************* /** * @class ACE_POSIX_Asynch_Transmit_Handler * * @brief Auxillary handler for doing <Asynch_Transmit_File> in * Unix. <ACE_POSIX_Asynch_Transmit_File> internally uses this. * * This is a helper class for implementing * <ACE_POSIX_Asynch_Transmit_File> in Unix systems. */ class ACE_Export ACE_POSIX_Asynch_Transmit_Handler : public ACE_Handler { public: /// Constructor. Result pointer will have all the information to do /// the file transmission (socket, file, application handler, bytes /// to write). ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_Proactor *posix_proactor, ACE_POSIX_Asynch_Transmit_File_Result *result); /// Destructor. virtual ~ACE_POSIX_Asynch_Transmit_Handler (void); /// Do the transmission. All the info to do the transmission is in /// the <result> member. int transmit (void); protected: /// The asynch result pointer made from the initial transmit file /// request. ACE_POSIX_Asynch_Transmit_File_Result *result_; /// Message bloack used to do the transmission. ACE_Message_Block *mb_; enum ACT { HEADER_ACT = 1, DATA_ACT = 2, TRAILER_ACT = 3 }; /// ACT to transmit header. ACT header_act_; /// ACT to transmit data. ACT data_act_; /// ACT to transmit trailer. ACT trailer_act_; /// Current offset of the file being transmitted. size_t file_offset_; /// Total size of the file. size_t file_size_; /// Number of bytes transferred on the stream. size_t bytes_transferred_; /// This is called when asynchronous writes from the socket complete. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); /// This is called when asynchronous reads from the file complete. virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); /// Issue asynch read from the file. int initiate_read_file (void); /// To read from the file to be transmitted. ACE_POSIX_Asynch_Read_File rf_; /// Write stream to write the header, trailer and the data. ACE_POSIX_Asynch_Write_Stream ws_; }; // ************************************************************ // Constructor. ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_Proactor *posix_proactor, ACE_POSIX_Asynch_Transmit_File_Result *result) : result_ (result), mb_ (0), header_act_ (this->HEADER_ACT), data_act_ (this->DATA_ACT), trailer_act_ (this->TRAILER_ACT), file_offset_ (result->offset ()), file_size_ (0), bytes_transferred_ (0), rf_ (posix_proactor), ws_ (posix_proactor) { // Allocate memory for the message block. ACE_NEW (this->mb_, ACE_Message_Block (this->result_->bytes_per_send () + 1)); // Init the file size. file_size_ = ACE_OS::filesize (this->result_->file ()); } // Destructor. ACE_POSIX_Asynch_Transmit_Handler::~ACE_POSIX_Asynch_Transmit_Handler (void) { delete result_; mb_->release (); } // Do the transmission. // Initiate transmitting the header. When that completes // handle_write_stream will be called, there start transmitting the file. int ACE_POSIX_Asynch_Transmit_Handler::transmit (void) { // No proactor is given for the <open>'s. Because we are using the // concrete implementations of the Asynch_Operations, and we have // already given them the specific proactor, so they wont need the // general <proactor> interface pointer. // Open Asynch_Read_File. if (this->rf_.open (this->proxy (), this->result_->file (), 0, 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, "ACE_Asynch_Transmit_Handler:read_file open failed\n"), -1); // Open Asynch_Write_Stream. if (this->ws_.open (this->proxy (), this->result_->socket (), 0, 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, "ACE_Asynch_Transmit_Handler:write_stream open failed\n"), -1); // Transmit the header. if (this->ws_.write (*this->result_->header_and_trailer ()->header (), this->result_->header_and_trailer ()->header_bytes (), reinterpret_cast<void *> (&this->header_act_), 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Asynch_Transmit_Handler:transmitting header:write_stream failed\n"), -1); return 0; } void ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { // Update bytes transferred so far. this->bytes_transferred_ += result.bytes_transferred (); // Check the success parameter. if (result.success () == 0) { // Failure. ACE_ERROR ((LM_ERROR, "Asynch_Transmit_File failed.\n")); ACE_SEH_TRY { this->result_->complete (this->bytes_transferred_, 0, // Failure. 0, // @@ Completion key. 0); // @@ Error no. } ACE_SEH_FINALLY { // This is crucial to prevent memory leaks. This deletes // the result pointer also. delete this; } } // Write stream successful. // Partial write to socket. size_t unsent_data = result.bytes_to_write () - result.bytes_transferred (); if (unsent_data != 0) { ACE_DEBUG ((LM_DEBUG, "%N:%l:Partial write to socket: Asynch_write called again\n")); // Duplicate the message block and retry remaining data if (this->ws_.write (*result.message_block ().duplicate (), unsent_data, result.act (), this->result_->priority (), this->result_->signal_number ()) == -1) { // @@ Handle this error. ACE_ERROR ((LM_ERROR, "Asynch_Transmit_Handler:write_stream failed\n")); return; } // @@ Handling *partial write* to a socket. Let us not continue // further before this write finishes. Because proceeding with // another read and then write might change the order of the // file transmission, because partial write to the stream is // always possible. return; } // Not a partial write. A full write. // Check ACT to see what was sent. ACT act = * (ACT *) result.act (); switch (act) { case TRAILER_ACT: // If it is the "trailer" that is just sent, then transmit file // is complete. // Call the application handler. ACE_SEH_TRY { this->result_->complete (this->bytes_transferred_, 1, // @@ Success. 0, // @@ Completion key. 0); // @@ Errno. } ACE_SEH_FINALLY { delete this; } break; case HEADER_ACT: case DATA_ACT: // If header/data was sent, initiate the file data transmission. if (this->initiate_read_file () == -1) // @@ Handle this error. ACE_ERROR ((LM_ERROR, "Error:Asynch_Transmit_Handler:read_file couldnt be initiated\n")); break; default: // @@ Handle this error. ACE_ERROR ((LM_ERROR, "Error:ACE_Asynch_Transmit_Handler::handle_write_stream::Unexpected act\n")); } } void ACE_POSIX_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File::Result &result) { // Failure. if (result.success () == 0) { // ACE_SEH_TRY { this->result_->complete (this->bytes_transferred_, 0, // Failure. 0, // @@ Completion key. errno); // Error no. } ACE_SEH_FINALLY { delete this; } return; } // Read successful. if (result.bytes_transferred () == 0) return; // Increment offset. this->file_offset_ += result.bytes_transferred (); // Write data to network. if (this->ws_.write (result.message_block (), result.bytes_transferred (), (void *)&this->data_act_, this->result_->priority (), this->result_->signal_number ()) == -1) { // @@ Handle this error. ACE_ERROR ((LM_ERROR, "Error:ACE_Asynch_Transmit_File : write to the stream failed\n")); return; } } int ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file (void) { // Is there something to read. if (this->file_offset_ >= this->file_size_) { // File is sent. Send the trailer. if (this->ws_.write (*this->result_->header_and_trailer ()->trailer (), this->result_->header_and_trailer ()->trailer_bytes (), (void *)&this->trailer_act_, this->result_->priority (), this->result_->signal_number ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error:Asynch_Transmit_Handler:write_stream writing trailer failed\n"), -1); return 0; } else { // @@ Is this right?? // Previous reads and writes are over. For the new read, adjust // the wr_ptr and the rd_ptr to the beginning. this->mb_->rd_ptr (this->mb_->base ()); this->mb_->wr_ptr (this->mb_->base ()); // Inititiate an asynchronous read from the file. if (this->rf_.read (*this->mb_, this->mb_->size () - 1, this->file_offset_, 0, // @@ offset_high !!! if aiocb64 is used. 0, // Act this->result_->priority (), this->result_->signal_number ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error:Asynch_Transmit_Handler::read from file failed\n"), -1); return 0; } } // ********************************************************************* ACE_POSIX_Asynch_Transmit_File::ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor) { } int ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, size_t bytes_to_write, u_long offset, u_long offset_high, size_t bytes_per_send, u_long flags, const void *act, int priority, int signal_number) { // Adjust these parameters if there are default values specified. ssize_t file_size = ACE_OS::filesize (file); if (file_size == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("Error:%N:%l:%p\n"), ACE_TEXT("POSIX_Asynch_Transmit_File:filesize failed")), -1); if (bytes_to_write == 0) bytes_to_write = file_size; if (offset > (size_t) file_size) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("Error:%p\n"), ACE_TEXT("Asynch_Transmit_File:File size is less than offset")), -1); if (offset != 0) bytes_to_write = file_size - offset + 1; if (bytes_per_send == 0) bytes_per_send = bytes_to_write; // Configure the result parameter. ACE_POSIX_Asynch_Transmit_File_Result *result = 0; ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Transmit_File_Result (this->handler_proxy_, this->handle_, file, header_and_trailer, bytes_to_write, offset, offset_high, bytes_per_send, flags, act, this->posix_proactor ()->get_handle (), priority, signal_number), -1); // Make the auxillary handler and initiate transmit. ACE_POSIX_Asynch_Transmit_Handler *transmit_handler = 0; ACE_NEW_RETURN (transmit_handler, ACE_POSIX_Asynch_Transmit_Handler (this->posix_proactor (), result), -1); ssize_t return_val = transmit_handler->transmit (); if (return_val == -1) // This deletes the <result> in it too. delete transmit_handler; return 0; } ACE_POSIX_Asynch_Transmit_File::~ACE_POSIX_Asynch_Transmit_File (void) { } // ********************************************************************* size_t ACE_POSIX_Asynch_Read_Dgram_Result::bytes_to_read (void) const { return this->bytes_to_read_; } int ACE_POSIX_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const { int retVal = -1; // failure // make sure the addresses are of the same type if (addr.get_type () == this->remote_address_->get_type ()) { // copy the remote_address_ into addr addr.set_addr (this->remote_address_->get_addr (), this->remote_address_->get_size ()); retVal = 0; // success } return retVal; } sockaddr * ACE_POSIX_Asynch_Read_Dgram_Result::saddr () const { return (sockaddr *) this->remote_address_->get_addr (); } int ACE_POSIX_Asynch_Read_Dgram_Result::flags (void) const { return this->flags_; } ACE_HANDLE ACE_POSIX_Asynch_Read_Dgram_Result::handle (void) const { return this->handle_; } ACE_Message_Block* ACE_POSIX_Asynch_Read_Dgram_Result::message_block () const { return this->message_block_; } ACE_POSIX_Asynch_Read_Dgram_Result::ACE_POSIX_Asynch_Read_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, int flags, int protocol_family, const void* act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_read_ (bytes_to_read), message_block_ (message_block), remote_address_ (0), addr_len_ (0), flags_ (flags), handle_ (handle) { ACE_UNUSED_ARG (protocol_family); this->aio_fildes = handle; this->aio_buf = message_block->wr_ptr (); this->aio_nbytes = bytes_to_read; ACE_NEW (this->remote_address_, ACE_INET_Addr); } void ACE_POSIX_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy the data which was returned by GetQueuedCompletionStatus this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // Appropriately move the pointers in the message block. this->message_block_->wr_ptr (bytes_transferred); // <errno> is available in the aiocb. ACE_UNUSED_ARG (error); this->remote_address_->set_size(this->addr_len_); // Create the interface result class. ACE_Asynch_Read_Dgram::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_read_dgram (result); } ACE_POSIX_Asynch_Read_Dgram_Result::~ACE_POSIX_Asynch_Read_Dgram_Result (void) { delete this->remote_address_; } //*************************************************************************** size_t ACE_POSIX_Asynch_Write_Dgram_Result::bytes_to_write (void) const { return this->bytes_to_write_; } int ACE_POSIX_Asynch_Write_Dgram_Result::flags (void) const { return this->flags_; } ACE_HANDLE ACE_POSIX_Asynch_Write_Dgram_Result::handle (void) const { return this->handle_; } ACE_Message_Block* ACE_POSIX_Asynch_Write_Dgram_Result::message_block () const { return this->message_block_; } ACE_POSIX_Asynch_Write_Dgram_Result::ACE_POSIX_Asynch_Write_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, int flags, const void* act, ACE_HANDLE event, int priority, int signal_number) : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_write_ (bytes_to_write), message_block_ (message_block), flags_ (flags), handle_ (handle) { this->aio_fildes = handle; this->aio_buf = message_block->rd_ptr (); this->aio_nbytes = bytes_to_write; } void ACE_POSIX_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred, int success, const void *completion_key, u_long error) { // Copy the data which was returned by GetQueuedCompletionStatus this->bytes_transferred_ = bytes_transferred; this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; // <errno> is available in the aiocb. ACE_UNUSED_ARG (error); // Appropriately move the pointers in the message block. this->message_block_->rd_ptr (bytes_transferred); // Create the interface result class. ACE_Asynch_Write_Dgram::Result result (this); // Call the application handler. ACE_Handler *handler = this->handler_proxy_.get ()->handler (); if (handler != 0) handler->handle_write_dgram (result); } ACE_POSIX_Asynch_Write_Dgram_Result::~ACE_POSIX_Asynch_Write_Dgram_Result (void) { } /***************************************************************************/ ACE_POSIX_Asynch_Read_Dgram::~ACE_POSIX_Asynch_Read_Dgram (void) { } ssize_t ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, size_t & /*number_of_bytes_recvd*/, int flags, int protocol_family, const void *act, int priority, int signal_number) { size_t space = message_block->space (); // Create the Asynch_Result. ACE_POSIX_Asynch_Read_Dgram_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Read_Dgram_Result (this->handler_proxy_, this->handle_, message_block, space, flags, protocol_family, act, proactor->get_handle (), priority, signal_number), -1); int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ); if (return_val == -1) delete result; return return_val; } ACE_POSIX_Asynch_Read_Dgram::ACE_POSIX_Asynch_Read_Dgram (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor) { } //*************************************************************************** ACE_POSIX_Asynch_Write_Dgram::~ACE_POSIX_Asynch_Write_Dgram (void) { } ssize_t ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, size_t &/*number_of_bytes_sent*/, int flags, const ACE_Addr &/*addr*/, const void *act, int priority, int signal_number) { size_t len = message_block->length (); if (len == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_POSIX_Asynch_Write_Stream::write:") ACE_TEXT ("Attempt to write 0 bytes\n")), -1); ACE_POSIX_Asynch_Write_Dgram_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, ACE_POSIX_Asynch_Write_Dgram_Result (this->handler_proxy_, this->handle_, message_block, len, flags, act, proactor->get_handle (), priority, signal_number), -1); int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE); if (return_val == -1) delete result; return return_val; } ACE_POSIX_Asynch_Write_Dgram::ACE_POSIX_Asynch_Write_Dgram (ACE_POSIX_Proactor *posix_proactor) : ACE_POSIX_Asynch_Operation (posix_proactor) { } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_AIO_CALLS */
[ "jacking75@gmail.com" ]
jacking75@gmail.com
a4d68e16a89e6c877fc6c57aed4d3fd6795bfa7a
7ffc3f8edd26ed4bb435fb5adabdc08cf5aa341b
/Stars45/TacticalView.cpp
5e12898e12287cdf4b38b670bcad8c0769adb896
[]
no_license
lightgemini78/Starshatter-Rearmed
c92abc12c8dc4f0f7db69ed46d032989efcf576d
673288f8a243ffdf1ba1c11c06355c189ce19909
refs/heads/master
2021-01-21T13:48:34.811566
2016-05-28T01:39:19
2016-05-28T01:39:19
36,512,077
1
1
null
null
null
null
UTF-8
C++
false
false
43,409
cpp
/* Project Starshatter 5.0 Destroyer Studios LLC Copyright (C) 1997-2007. All Rights Reserved. SUBSYSTEM: Stars.exe FILE: TacticalView.cpp AUTHOR: John DiCamillo OVERVIEW ======== View class for Tactical Data Readout HUD Overlay */ #include "MemDebug.h" #include "TacticalView.h" #include "QuantumView.h" #include "RadioView.h" #include "RadioMessage.h" #include "RadioTraffic.h" #include "HUDSounds.h" #include "HUDView.h" #include "WepView.h" #include "CameraDirector.h" #include "Ship.h" #include "ShipCtrl.h" #include "ShipDesign.h" #include "QuantumDrive.h" #include "Farcaster.h" #include "Instruction.h" #include "Element.h" #include "Contact.h" #include "Sim.h" #include "Starshatter.h" #include "GameScreen.h" #include "MenuView.h" #include "Pilot.h" #include "ShipAI.h" #include "Projector.h" #include "Color.h" #include "Window.h" #include "Video.h" #include "DataLoader.h" #include "Scene.h" #include "FontMgr.h" #include "Keyboard.h" #include "Mouse.h" #include "MouseController.h" #include "Menu.h" #include "Game.h" #include "FormatUtil.h" static Color hud_color = Color::Black; static Color txt_color = Color::Black; // +--------------------------------------------------------------------+ TacticalView* TacticalView::tac_view = 0; // +--------------------------------------------------------------------+ TacticalView::TacticalView(Window* c, GameScreen* parent) : View(c), gamescreen(parent), ship(0), camview(0), projector(0), mouse_down(0), right_down(0), shift_down(0), show_move(0), show_action(0), show_position(0), active_menu(0), menu_view(0), msg_ship(0), base_alt(0), move_alt(0) { tac_view = this; sim = Sim::GetSim(); width = window->Width(); height = window->Height(); xcenter = (width / 2.0) - 0.5; ycenter = (height / 2.0) + 0.5; font = FontMgr::Find("HUD"); SetColor(Color::White); mouse_start.x = 0; mouse_start.y = 0; mouse_action.x = 0; mouse_action.y = 0; menu_view = new(__FILE__,__LINE__) MenuView(window); } TacticalView::~TacticalView() { delete menu_view; tac_view = 0; } void TacticalView::OnWindowMove() { width = window->Width(); height = window->Height(); xcenter = (width / 2.0) - 0.5; ycenter = (height / 2.0) + 0.5; if (menu_view) menu_view->OnWindowMove(); } // +--------------------------------------------------------------------+ bool TacticalView::Update(SimObject* obj) { if (obj == ship) { ship = 0; } if (obj == msg_ship) { msg_ship = 0; } return SimObserver::Update(obj); } const char* TacticalView::GetObserverName() const { return "TacticalView"; } void TacticalView::UseProjector(Projector* p) { projector = p; } // +--------------------------------------------------------------------+ void TacticalView::Refresh() { sim = Sim::GetSim(); if (sim) { bool rebuild = false; if (ship != sim->GetPlayerShip()) { ship = sim->GetPlayerShip(); if (ship) { if (ship->Life() == 0 || ship->IsDying() || ship->IsDead()) { ship = 0; } else { Observe(ship); } } rebuild = true; } if (ship) { if (current_sector != ship->GetRegion()->Name()) rebuild = true; if (rebuild) { BuildMenu(); current_sector = ship->GetRegion()->Name(); } } } if (!ship || ship->InTransition()) return; DrawMouseRect(); if (sim) { ListIter<Ship> sel = sim->GetSelection(); if (sel.size()) { while (++sel) { Ship* selection = sel.value(); // draw selection rect on selected ship: if (selection && selection->Rep()) DrawSelection(selection); } RadioView* rv = RadioView::GetInstance(); QuantumView* qv = QuantumView::GetInstance(); if ((!rv || !rv->IsMenuShown()) && (!qv || !qv->IsMenuShown())) { sel.reset(); if (sel.size() == 1) { DrawSelectionInfo(sel.next()); } else { DrawSelectionList(sel); } } } } DrawMenu(); if (show_move || show_position) { Mouse::Show(false); DrawMove(); } else if (show_action) { Mouse::Show(false); DrawAction(); } } // +--------------------------------------------------------------------+ void TacticalView::ExecFrame() { HUDView* hud = HUDView::GetInstance(); if (hud) { if (hud_color != hud->GetTextColor()) { hud_color = hud->GetTextColor(); SetColor(hud_color); } } } // +--------------------------------------------------------------------+ void TacticalView::SetColor(Color c) { HUDView* hud = HUDView::GetInstance(); if (hud) { hud_color = hud->GetHUDColor(); txt_color = hud->GetTextColor(); } else { hud_color = c; txt_color = c; } } // +--------------------------------------------------------------------+ void TacticalView::DrawMouseRect() { if (mouse_rect.w > 0 && mouse_rect.h > 0) { Color c = hud_color * 0.66; if (shift_down) c = Color::Orange; window->DrawRect(mouse_rect, c); } } // +--------------------------------------------------------------------+ void TacticalView::DrawSelection(Ship* seln) { if (!seln) return; Graphic* g = seln->Rep(); Rect r = g->ScreenRect(); Point mark_pt = seln->Location(); projector->Transform(mark_pt); // clip: if (mark_pt.z > 1.0) { projector->Project(mark_pt); int x = (int) mark_pt.x; int y = r.y; if (y >= 2000) y = (int) mark_pt.y; if (x > 4 && x < width-4 && y > 4 && y < height-4) { const int BAR_LENGTH = 40; // life bars: int sx = x - BAR_LENGTH/2; int sy = y - 8; double hull_strength = seln->HullStrength() / 100.0; int hw = (int) (BAR_LENGTH * hull_strength); int sw = (int) (BAR_LENGTH * (seln->ShieldStrength() / 100.0)); if (hw < 0) hw = 0; if (sw < 0) sw = 0; System::STATUS s = System::NOMINAL; if (hull_strength < 0.30) s = System::CRITICAL; else if (hull_strength < 0.60) s = System::DEGRADED; Color hc = HUDView::GetStatusColor(s); Color sc = hud_color; window->FillRect(sx, sy, sx+hw, sy+1, hc); window->FillRect(sx, sy+3, sx+sw, sy+4, sc); } } } // +--------------------------------------------------------------------+ void TacticalView::DrawSelectionInfo(Ship* seln) { if (!ship || !seln) return; Rect label_rect(width-140, 10, 90, 12); Rect info_rect(width-100, 10, 90, 12); if (width >= 800) { label_rect.x -= 20; info_rect.x -= 20; info_rect.w += 20; } static char name[64]; static char design[64]; static char shield[32]; static char hull[32]; static char range[32]; static char heading[32]; static char speed[32]; static char orders[64]; static char psv[32]; static char act[32]; static char pilot[32]; int show_labels = width > 640; int full_info = true; int shield_val = seln->ShieldStrength(); int hull_val = seln->HullStrength(); if (shield_val < 0) shield_val = 0; if (hull_val < 0) hull_val = 0; sprintf_s(name, "%s", seln->Name()); if (show_labels) { sprintf_s(shield, "%s %03d", Game::GetText("HUDView.symbol.shield").data(), shield_val); sprintf_s(hull, "%s %03d", Game::GetText("HUDView.symbol.hull").data(), hull_val); } else { sprintf_s(shield, "%03d", shield_val); sprintf_s(hull, "%03d", hull_val); } FormatNumberExp(range, Point(seln->Location()-ship->Location()).length()/1000); strcat_s(range, " km"); sprintf_s(heading, "%03d %s", (int) (seln->CompassHeading() / DEGREES), Game::GetText("HUDView.symbol.degrees").data()); double ss = seln->Velocity().length(); if (seln->Velocity() * seln->Heading() < 0) ss = -ss; FormatNumberExp(speed, ss); strcat_s(speed, " m/s"); Contact* contact = 0; // always recognize ownside: if (seln->GetIFF() != ship->GetIFF()) { ListIter<Contact> c = ship->ContactList(); while (++c) { if (c->GetShip() == seln) { contact = c.value(); if (c->GetIFF(ship) > seln->GetIFF()) { sprintf_s(name, "%s %04d", Game::GetText("TacView.contact").data(), seln->GetContactID()); full_info = false; } break; } } } if (show_labels) { font->SetColor(txt_color); font->SetAlpha(1); font->DrawText(Game::GetText("TacView.name"), 5, label_rect, DT_LEFT); label_rect.y += 10; font->DrawText(Game::GetText("TacView.type"), 5, label_rect, DT_LEFT); label_rect.y += 10; if (full_info) { font->DrawText(Game::GetText("TacView.shield"), 5, label_rect, DT_LEFT); label_rect.y += 10; font->DrawText(Game::GetText("TacView.hull"), 5, label_rect, DT_LEFT); label_rect.y += 10; } font->DrawText(Game::GetText("TacView.range"), 4, label_rect, DT_LEFT); label_rect.y += 10; if (full_info) { font->DrawText(Game::GetText("TacView.speed"), 4, label_rect, DT_LEFT); label_rect.y += 10; font->DrawText(Game::GetText("TacView.heading"), 4, label_rect, DT_LEFT); label_rect.y += 10; if(seln->GetPilot()){ font->DrawTextA("Pilot:", 6, label_rect, DT_LEFT); //** pilot label label_rect.y += 10; } } else { font->DrawText(Game::GetText("TacView.passive"), 4, label_rect, DT_LEFT); label_rect.y += 10; font->DrawText(Game::GetText("TacView.active"), 4, label_rect, DT_LEFT); label_rect.y += 10; } } font->DrawText(name, 0, info_rect, DT_LEFT); info_rect.y += 10; if (full_info) { sprintf_s(design, "%s %s", seln->Abbreviation(), seln->Design()->display_name); font->DrawText(design, 0, info_rect, DT_LEFT); info_rect.y += 10; } else { if (seln->IsStarship()) font->DrawText(Game::GetText("TacView.starship"), 8, info_rect, DT_LEFT); else font->DrawText(Game::GetText("TacView.fighter"), 7, info_rect, DT_LEFT); info_rect.y += 10; } if (full_info) { font->DrawText(shield, 0, info_rect, DT_LEFT); info_rect.y += 10; font->DrawText(hull, 0, info_rect, DT_LEFT); info_rect.y += 10; } font->DrawText(range, 0, info_rect, DT_LEFT); info_rect.y += 10; if (full_info) { font->DrawText(speed, 0, info_rect, DT_LEFT); info_rect.y += 10; font->DrawText(heading, 0, info_rect, DT_LEFT); info_rect.y += 10; //** Display pilot name. if (seln->GetPilot()) { if(seln->GetPilot()->Ejected()) sprintf_s(pilot, "%s", "None"); else { sprintf_s(pilot, "%s" "%s" , seln->GetPilot()->GetName(), seln->GetPilot()->GetSurname()); } font->DrawText(pilot, 0, info_rect, DT_LEFT); } info_rect.y += 10; if (seln->GetIFF() == ship->GetIFF()) { Instruction* instr = seln->GetRadioOrders(); if (instr && instr->Action()) { strcpy_s(orders, RadioMessage::ActionName(instr->Action())); if (instr->Action() == RadioMessage::QUANTUM_TO) { strcat_s(orders, " "); strcat_s(orders, instr->RegionName()); } } else { *orders = 0; } if (*orders) { if (show_labels) { font->DrawText(Game::GetText("TacView.orders"), 5, label_rect, DT_LEFT); label_rect.y += 10; } font->DrawText(orders, 0, info_rect, DT_LEFT); info_rect.y += 10; } } } else { sprintf_s(psv, "%03d", (int) (contact->PasReturn() * 100.0)); sprintf_s(act, "%03d", (int) (contact->ActReturn() * 100.0)); if (contact->Threat(ship)) strcat_s(psv, " !"); font->DrawText(psv, 0, info_rect, DT_LEFT); info_rect.y += 10; font->DrawText(act, 0, info_rect, DT_LEFT); info_rect.y += 10; } font->DrawText(seln->GetDirectorInfo(), 0, info_rect, DT_LEFT); info_rect.y += 10; /***/ } // +--------------------------------------------------------------------+ void TacticalView::DrawSelectionList(ListIter<Ship> seln) { int index = 0; Rect info_rect(width-100, 10, 90, 12); while (++seln) { char name[64]; sprintf_s(name, "%s", seln->Name()); // always recognize ownside: if (seln->GetIFF() != ship->GetIFF()) { ListIter<Contact> c = ship->ContactList(); while (++c) { if (c->GetShip() == seln.value()) { if (c->GetIFF(ship) > seln->GetIFF()) { sprintf_s(name, "%s %04d", Game::GetText("TacView.contact").data(), seln->GetContactID()); } break; } } } font->DrawText(name, 0, info_rect, DT_LEFT); info_rect.y += 10; index++; if (index >= 10) break; } } // +--------------------------------------------------------------------+ void TacticalView::DoMouseFrame() { static DWORD rbutton_latch = 0; Starshatter* stars = Starshatter::GetInstance(); if (stars->InCutscene()) return; if (Mouse::RButton()) { MouseController* mouse_con = MouseController::GetInstance(); if (!right_down && (!mouse_con || !mouse_con->Active())) { rbutton_latch = Game::RealTime(); right_down = true; } } else { if (sim && right_down && (Game::RealTime() - rbutton_latch < 250)) { Ship* seln = WillSelectAt(Mouse::X(), Mouse::Y()); if (seln && sim->IsSelected(seln) && seln->GetIFF() == ship->GetIFF() && ship->GetElement()->CanCommand(seln->GetElement())) { msg_ship = seln; Observe(msg_ship); } else if (ship && seln == ship && (!ship->GetDirector() || ship->GetDirector()->Type() != ShipCtrl::DIR_TYPE)) { msg_ship = seln; } else { msg_ship = 0; } } right_down = false; } if (menu_view) menu_view->DoMouseFrame(); MouseController* mouse_con = MouseController::GetInstance(); if (!mouse_con || !mouse_con->Active()) { if (Mouse::LButton()) { if (!mouse_down) { mouse_start.x = Mouse::X(); mouse_start.y = Mouse::Y(); shift_down = Keyboard::KeyDown(VK_SHIFT); } else { if (Mouse::X() < mouse_start.x) { mouse_rect.x = Mouse::X(); mouse_rect.w = mouse_start.x - Mouse::X(); } else { mouse_rect.x = mouse_start.x; mouse_rect.w = Mouse::X() - mouse_start.x; } if (Mouse::Y() < mouse_start.y) { mouse_rect.y = Mouse::Y(); mouse_rect.h = mouse_start.y - Mouse::Y(); } else { mouse_rect.y = mouse_start.y; mouse_rect.h = Mouse::Y() - mouse_start.y; } // don't draw seln rectangle while zooming: if (Mouse::RButton() || show_move || show_action || show_position) { mouse_rect.w = 0; mouse_rect.h = 0; } else { SelectRect(mouse_rect); } } mouse_down = true; } else { if (mouse_down) { int mouse_x = Mouse::X(); int mouse_y = Mouse::Y(); if (menu_view && menu_view->GetAction()) { ProcessMenuItem(menu_view->GetAction()); Mouse::Show(true); } else if (show_move) { SendMove(); show_move = false; Mouse::Show(true); } else if (show_position) { SendFormPosition(); show_position = false; Mouse::Show(true); } else if (show_action) { SendAction(); show_action = false; Mouse::Show(true); } else { if (!HUDView::IsMouseLatched() && !WepView::IsMouseLatched()) { int dx = (int) fabs((double) (mouse_x - mouse_start.x)); int dy = (int) fabs((double) (mouse_y - mouse_start.y)); static DWORD click_time = 0; if (dx < 3 && dy < 3) { bool hit = SelectAt(mouse_x, mouse_y); if (ship->IsStarship() && Game::RealTime() - click_time < 350) SetHelm(hit); click_time = Game::RealTime(); } } } mouse_rect = Rect(); mouse_down = false; } } } if (show_action && !mouse_down && !right_down) { mouse_action.x = Mouse::X(); mouse_action.y = Mouse::Y(); } } // +--------------------------------------------------------------------+ bool TacticalView::SelectAt(int x, int y) //** Target selection by drag box or select it for info and camera focus { if (!ship) return false; Ship* selection = WillSelectAt(x,y); if (selection && shift_down) ship->SetTarget(selection); else if (sim && selection) sim->SetSelection(selection); return selection != 0; } // +--------------------------------------------------------------------+ bool TacticalView::SelectRect(const Rect& rect) { bool result = false; if (!ship || !sim) return result; if (rect.w > 8 || rect.h > 8) sim->ClearSelection(); // check distance to each contact: List<Contact>& contact_list = ship->ContactList(); for (int i = 0; i < ship->NumContacts(); i++) { Ship* test = contact_list[i]->GetShip(); if (test && test != ship) { Point test_loc = test->Location(); projector->Transform(test_loc); if (test_loc.z > 1) { projector->Project(test_loc); if (rect.Contains((int) test_loc.x, (int) test_loc.y)) { // shift-select targets: if (shift_down) { if (test->GetIFF() == 0 || test->GetIFF() == ship->GetIFF()) continue; ship->SetTarget(test); result = true; } else { sim->AddSelection(test); result = true; } } } } } // select self only in orbit cam if (!shift_down && CameraDirector::GetCameraMode() == CameraDirector::MODE_ORBIT) { Point test_loc = ship->Location(); projector->Transform(test_loc); if (test_loc.z > 1) { projector->Project(test_loc); if (rect.Contains((int) test_loc.x, (int) test_loc.y)) { sim->AddSelection(ship); result = true; } } } return result; } // +--------------------------------------------------------------------+ Ship* TacticalView::WillSelectAt(int x, int y) { Ship* selection = 0; if (ship) { // check distance to each contact: List<Contact>& contact_list = ship->ContactList(); for (int i = 0; i < ship->NumContacts(); i++) { Ship* test = contact_list[i]->GetShip(); if (test) { // shift-select targets: if (shift_down) { if (test->GetIFF() == 0 || test->GetIFF() == ship->GetIFF()) continue; } Graphic* g = test->Rep(); if (g) { Rect r = g->ScreenRect(); if (r.x == 2000 && r.y == 2000 && r.w == 0 && r.h == 0) { if (projector) { Point loc = test->Location(); projector->Transform(loc); projector->Project(loc); r.x = (int) loc.x; r.y = (int) loc.y; } } if (r.w < 20 || r.h < 20) r.Inflate(20,20); else r.Inflate(10,10); if (r.Contains(x,y)) { selection = test; break; } } } } if (!selection && !shift_down) { Graphic* g = ship->Rep(); if (g) { Rect r = g->ScreenRect(); if (r.Contains(x,y)) { selection = ship; } } } } if (selection == ship && CameraDirector::GetCameraMode() != CameraDirector::MODE_ORBIT) selection = 0; return selection; } // +--------------------------------------------------------------------+ void TacticalView::SetHelm(bool approach) { Point delta; // double-click on ship: set helm to approach if (sim && approach) { ListIter<Ship> iter = sim->GetSelection(); ++iter; Ship* selection = iter.value(); if (selection != ship) { delta = selection->Location() - ship->Location(); delta.Normalize(); } } // double-click on space: set helm in direction if (delta.length() < 1) { int mx = Mouse::X(); int my = Mouse::Y(); if (projector) { double focal_dist = width / tan(projector->XAngle()); delta = projector->vpn() * focal_dist + projector->vup() * -1 * (my-height/2) + projector->vrt() * (mx-width/2); delta.Normalize(); } else { return; } } double az = atan2(fabs(delta.x), delta.z); double el = asin(delta.y); if (delta.x < 0) az *= -1; az += PI; if (az >= 2*PI) az -= 2*PI; ship->SetHelmHeading(az); ship->SetHelmPitch(el); } // +====================================================================+ // // TACTICAL COMMUNICATIONS MENU: // static Menu* main_menu = 0; static Menu* view_menu = 0; static Menu* emcon_menu = 0; static Menu* fighter_menu = 0; static Menu* starship_menu = 0; static Menu* action_menu = 0; static Menu* formation_menu = 0; static Menu* sensors_menu = 0; static Menu* quantum_menu = 0; static Menu* farcast_menu = 0; static Menu* squad_menu = 0; //** Battle group menu static Menu* command_menu = 0; static Menu* silent_menu = 0; static Menu* form_menu = 0; static Menu* offset_menu = 0; static Element* dst_elem = 0; enum VIEW_MENU { VIEW_FORWARD = 1000, VIEW_CHASE, VIEW_PADLOCK, VIEW_ORBIT, VIEW_NAV, VIEW_WEP, VIEW_ENG, VIEW_FLT, VIEW_INS, VIEW_CMD }; enum BATTLE_GROUP { ASSEMBLE = 2100, DISMISS, EMCON1, EMCON2, EMCON3 }; enum GROUP_FORMATION { GROUP_DIAMOND = 2200, GROUP_WALL = 2202, GROUP_TRAIL }; enum OFFSETS { FRONT = 2301, BACK, LEFT, RIGHT, UP, DOWN, RESET, POSITION, //** Single unit position move SHIFT //** Whole group position shift }; const int QUANTUM = 2000; const int FARCAST = 2001; void TacticalView::Initialize() { static int initialized = 0; if (initialized) return; view_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.view")); view_menu->AddItem(Game::GetText("TacView.item.forward"), VIEW_FORWARD); view_menu->AddItem(Game::GetText("TacView.item.chase"), VIEW_CHASE); view_menu->AddItem(Game::GetText("TacView.item.orbit"), VIEW_ORBIT); view_menu->AddItem(Game::GetText("TacView.item.padlock"), VIEW_PADLOCK); emcon_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.emcon")); quantum_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.quantum")); farcast_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.farcast")); main_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.main")); action_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.action")); action_menu->AddItem(Game::GetText("TacView.item.engage"), RadioMessage::ATTACK); action_menu->AddItem(Game::GetText("TacView.item.bracket"), RadioMessage::BRACKET); action_menu->AddItem(Game::GetText("TacView.item.escort"), RadioMessage::ESCORT); action_menu->AddItem(Game::GetText("TacView.item.identify"), RadioMessage::IDENTIFY); action_menu->AddItem(Game::GetText("TacView.item.hold"), RadioMessage::WEP_HOLD); formation_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.formation")); formation_menu->AddItem(Game::GetText("TacView.item.diamond"), RadioMessage::GO_DIAMOND); formation_menu->AddItem(Game::GetText("TacView.item.spread"), RadioMessage::GO_SPREAD); formation_menu->AddItem(Game::GetText("TacView.item.box"), RadioMessage::GO_BOX); formation_menu->AddItem(Game::GetText("TacView.item.trail"), RadioMessage::GO_TRAIL); form_menu = new(__FILE__,__LINE__) Menu("Formation"); //**Battlegroup menus form_menu->AddItem("Diamond" , GROUP_DIAMOND); form_menu->AddItem("Wall" , GROUP_WALL); form_menu->AddItem("Trail" , GROUP_TRAIL); offset_menu = new(__FILE__,__LINE__) Menu("Offset"); offset_menu->AddItem("POSITION",POSITION); offset_menu->AddItem("Front" , FRONT); offset_menu->AddItem("Back" , BACK); offset_menu->AddItem("Left" , LEFT); offset_menu->AddItem("Right" , RIGHT); offset_menu->AddItem("Up" , UP); offset_menu->AddItem("Down" , DOWN); offset_menu->AddItem("RESET" , RESET); squad_menu = new(__FILE__,__LINE__) Menu("Battle Group"); squad_menu->AddItem("Form up", RadioMessage::FORM_UP); squad_menu->AddItem("Leave" , RadioMessage::RESUME_MISSION); squad_menu->AddMenu("Formation" , form_menu); squad_menu->AddMenu("Offsets" , offset_menu); silent_menu = new(__FILE__,__LINE__) Menu("Run Silent"); silent_menu->AddItem("Emcon1", EMCON1); silent_menu->AddItem("Emcon2", EMCON2); silent_menu->AddItem("Emcon3", EMCON3); command_menu = new(__FILE__,__LINE__) Menu("Battle Group"); command_menu->AddItem("Assemble", ASSEMBLE); command_menu->AddItem("Dismiss" , DISMISS); command_menu->AddMenu("Formation" , form_menu); command_menu->AddMenu("Offsets" , offset_menu); command_menu->AddMenu("Run Silent" , silent_menu); sensors_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.emcon")); sensors_menu->AddItem(Game::GetText("TacView.item.emcon-1"), RadioMessage::GO_EMCON1); sensors_menu->AddItem(Game::GetText("TacView.item.emcon-2"), RadioMessage::GO_EMCON2); sensors_menu->AddItem(Game::GetText("TacView.item.emcon-3"), RadioMessage::GO_EMCON3); sensors_menu->AddItem(Game::GetText("TacView.item.probe"), RadioMessage::LAUNCH_PROBE); fighter_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.context")); fighter_menu->AddMenu(Game::GetText("TacView.item.action"), action_menu); fighter_menu->AddMenu(Game::GetText("TacView.item.formation"), formation_menu); fighter_menu->AddMenu(Game::GetText("TacView.item.sensors"), sensors_menu); fighter_menu->AddItem(Game::GetText("TacView.item.patrol"), RadioMessage::MOVE_PATROL); fighter_menu->AddItem(Game::GetText("TacView.item.cancel"), RadioMessage::RESUME_MISSION); fighter_menu->AddItem("", 0); fighter_menu->AddItem(Game::GetText("TacView.item.rtb"), RadioMessage::RTB); fighter_menu->AddItem(Game::GetText("TacView.item.dock"), RadioMessage::DOCK_WITH); fighter_menu->AddMenu(Game::GetText("TacView.item.farcast"), farcast_menu); starship_menu = new(__FILE__,__LINE__) Menu(Game::GetText("TacView.menu.context")); starship_menu->AddMenu("Battle Group", squad_menu); starship_menu->AddMenu(Game::GetText("TacView.item.action"), action_menu); starship_menu->AddMenu(Game::GetText("TacView.item.sensors"), sensors_menu); starship_menu->AddItem(Game::GetText("TacView.item.patrol"), RadioMessage::MOVE_PATROL); starship_menu->AddItem(Game::GetText("TacView.item.cancel"), RadioMessage::RESUME_MISSION); starship_menu->AddItem("", 0); starship_menu->AddMenu(Game::GetText("TacView.item.quantum"), quantum_menu); starship_menu->AddMenu(Game::GetText("TacView.item.farcast"), farcast_menu); initialized = 1; } void TacticalView::Close() { delete view_menu; delete emcon_menu; delete main_menu; delete fighter_menu; delete starship_menu; delete action_menu; delete formation_menu; delete sensors_menu; delete quantum_menu; delete farcast_menu; delete squad_menu; delete command_menu; delete silent_menu; delete form_menu; delete offset_menu; } // +--------------------------------------------------------------------+ void TacticalView::ProcessMenuItem(int action) { Starshatter* stars = Starshatter::GetInstance(); switch (action) { case RadioMessage::MOVE_PATROL: show_move = true; base_alt = 0; move_alt = 0; if (msg_ship) base_alt = msg_ship->Location().y; break; case POSITION: show_position = true; base_alt = 0; move_alt = 0; if (msg_ship) base_alt = msg_ship->Location().y; if (ship) base_alt = ship->Location().y; break; if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard && guard->GetLeader() != ship) continue; if(guard && !guard->IsCold() && !guard->IsDying()) { guard->GetRadioOrders()->SetOffset(action); } } ListIter<Ship> fiter = ship->wfslot(); while (++fiter) { Ship* fguard = fiter.value(); if(fguard && !fguard->IsCold() && fguard->GetPilot()->Alive()) fguard->GetRadioOrders()->SetOffset(action); } } break; case RadioMessage::ATTACK: case RadioMessage::BRACKET: case RadioMessage::ESCORT: case RadioMessage::IDENTIFY: case RadioMessage::DOCK_WITH: show_action = action; break; case RadioMessage::WEP_HOLD: case RadioMessage::RESUME_MISSION: case RadioMessage::RTB: case RadioMessage::GO_DIAMOND: case RadioMessage::GO_SPREAD: case RadioMessage::GO_BOX: case RadioMessage::GO_TRAIL: case RadioMessage::GO_EMCON1: case RadioMessage::GO_EMCON2: case RadioMessage::GO_EMCON3: case RadioMessage::LAUNCH_PROBE: if (msg_ship) { Element* elem = msg_ship->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, action); if (msg) RadioTraffic::Transmit(msg); } else if (ship) { if (action == RadioMessage::GO_EMCON1) ship->SetEMCON(1); else if (action == RadioMessage::GO_EMCON2) ship->SetEMCON(2); else if (action == RadioMessage::GO_EMCON3) ship->SetEMCON(3); else if (action == RadioMessage::LAUNCH_PROBE) ship->LaunchProbe(); } break; case RadioMessage::FORM_UP: //**Battlegroup stuff if (msg_ship) { Element* elem = msg_ship->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::ESCORT); if (msg) { msg->AddTarget(ship); RadioTraffic::Transmit(msg); } } break; case ASSEMBLE: if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard) { Element* elem = guard->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::ESCORT); if (msg) { msg->AddTarget(ship); RadioTraffic::Transmit(msg); } } } } break; case DISMISS: if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard) { Element* elem = guard->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::RESUME_MISSION); if (msg) { msg->AddTarget(ship); RadioTraffic::Transmit(msg); } } } } break; case EMCON1: if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard) { Element* elem = guard->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::GO_EMCON1); if (msg) { RadioTraffic::Transmit(msg); } } } ship->SetEMCON(1); } break; case EMCON2: if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard) { Element* elem = guard->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::GO_EMCON2); if (msg) { RadioTraffic::Transmit(msg); } } } ship->SetEMCON(2); } break; case EMCON3: if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard) { Element* elem = guard->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::GO_EMCON3); if (msg) { RadioTraffic::Transmit(msg); } } } ship->SetEMCON(3); } break; case GROUP_DIAMOND: case GROUP_WALL: case GROUP_TRAIL: action -= 2200; if(msg_ship) { msg_ship->GetRadioOrders()->SetFormation(action); } else if (ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard && guard->GetLeader() != guard) continue; if(!guard->IsCold() || !guard->IsDying()) { guard->GetRadioOrders()->SetFormation(action); } } ListIter<Ship> fiter = ship->wfslot(); while (++fiter) { Ship* fguard = fiter.value(); Pilot* p = fguard->GetPilot(); if(fguard && !fguard->IsCold() && p && p->Alive()) fguard->GetRadioOrders()->SetFormation(action); } } break; case FRONT: case BACK: case LEFT: case RIGHT: case UP: case DOWN: case RESET: action -= 2300; if(msg_ship) { msg_ship->GetRadioOrders()->SetOffset(action); break; } if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard && guard->GetLeader() != guard) continue; if(!guard->IsCold() || !guard->IsDying()) { guard->GetRadioOrders()->SetOffset(action); } } ListIter<Ship> fiter = ship->wfslot(); while (++fiter) { Ship* fguard = fiter.value(); if(fguard && !fguard->IsCold()) fguard->GetRadioOrders()->SetOffset(action); } } break; case VIEW_FORWARD: stars->PlayerCam(CameraDirector::MODE_COCKPIT); break; case VIEW_CHASE: stars->PlayerCam(CameraDirector::MODE_CHASE); break; case VIEW_PADLOCK: stars->PlayerCam(CameraDirector::MODE_TARGET); break; case VIEW_ORBIT: stars->PlayerCam(CameraDirector::MODE_ORBIT); break; case VIEW_NAV: gamescreen->ShowNavDlg(); break; case VIEW_WEP: gamescreen->ShowWeaponsOverlay(); break; case VIEW_ENG: gamescreen->ShowEngDlg(); break; case VIEW_INS: HUDView::GetInstance()->CycleHUDInst(); break; case VIEW_FLT: gamescreen->ShowFltDlg(); break; case VIEW_CMD: if (ship && ship->IsStarship()) { ship->CommandMode(); } break; case QUANTUM: if (sim) { Ship* s = msg_ship; if (!s) s = ship; if (s && s->GetQuantumDrive()) { QuantumDrive* quantum = s->GetQuantumDrive(); if (quantum) { MenuItem* menu_item = menu_view->GetMenuItem(); Text rgn_name = menu_item->GetText(); SimRegion* rgn = sim->FindRegion(rgn_name); if (rgn) { if (s == ship) { quantum->SetDestination(rgn, Point(0,0,0)); quantum->Engage(); } else { Element* elem = msg_ship->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::QUANTUM_TO); if (msg) { msg->SetInfo(rgn_name); RadioTraffic::Transmit(msg); } } } } } } break; case FARCAST: if (sim && msg_ship) { MenuItem* menu_item = menu_view->GetMenuItem(); Text rgn_name = menu_item->GetText(); SimRegion* rgn = sim->FindRegion(rgn_name); if (rgn) { Element* elem = msg_ship->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::FARCAST_TO); if (msg) { msg->SetInfo(rgn_name); RadioTraffic::Transmit(msg); } } } break; default: break; } } // +--------------------------------------------------------------------+ void TacticalView::BuildMenu() { main_menu->ClearItems(); quantum_menu->ClearItems(); farcast_menu->ClearItems(); emcon_menu->ClearItems(); if (!ship) return; // prepare quantum and farcast menus: ListIter<SimRegion> iter = sim->GetRegions(); while (++iter) { SimRegion* rgn = iter.value(); if (rgn != ship->GetRegion() && rgn->Type() != SimRegion::AIR_SPACE) quantum_menu->AddItem(rgn->Name(), QUANTUM); } if (ship->GetRegion()) { ListIter<Ship> iter = ship->GetRegion()->Ships(); while (++iter) { Ship* s = iter.value(); if (s && s->GetFarcaster()) { Farcaster* farcaster = s->GetFarcaster(); // ensure that the farcaster is connected: farcaster->ExecFrame(0); // now find the destination const Ship* dest = farcaster->GetDest(); if (dest && dest->GetRegion()) { SimRegion* rgn = dest->GetRegion(); farcast_menu->AddItem(rgn->Name(), FARCAST); } } } } // build the main menu: main_menu->AddMenu("Battle Group", command_menu); main_menu->AddMenu(Game::GetText("TacView.item.camera"), view_menu); main_menu->AddItem("", 0); main_menu->AddItem(Game::GetText("TacView.item.instructions"), VIEW_INS); main_menu->AddItem(Game::GetText("TacView.item.navigation"), VIEW_NAV); if (ship->Design()->repair_screen) main_menu->AddItem(Game::GetText("TacView.item.engineering"), VIEW_ENG); if (ship->Design()->wep_screen) main_menu->AddItem(Game::GetText("TacView.item.weapons"), VIEW_WEP); if (ship->NumFlightDecks() > 0) main_menu->AddItem(Game::GetText("TacView.item.flight"), VIEW_FLT); emcon_menu->AddItem(Game::GetText("TacView.item.emcon-1"), RadioMessage::GO_EMCON1); emcon_menu->AddItem(Game::GetText("TacView.item.emcon-2"), RadioMessage::GO_EMCON2); emcon_menu->AddItem(Game::GetText("TacView.item.emcon-3"), RadioMessage::GO_EMCON3); if (ship->GetProbeLauncher()) emcon_menu->AddItem(Game::GetText("TacView.item.probe"), RadioMessage::LAUNCH_PROBE); main_menu->AddItem("", 0); main_menu->AddMenu(Game::GetText("TacView.item.sensors"), emcon_menu); if (sim && ship->GetQuantumDrive()) { main_menu->AddItem("", 0); main_menu->AddMenu(Game::GetText("TacView.item.quantum"), quantum_menu); } if (ship->IsStarship()) { main_menu->AddItem("", 0); main_menu->AddItem(Game::GetText("TacView.item.command"), VIEW_CMD); } } // +--------------------------------------------------------------------+ void TacticalView::DrawMenu() { active_menu = 0; if (ship) active_menu = main_menu; if (msg_ship) { if (msg_ship->IsStarship()) active_menu = starship_menu; else if (msg_ship->IsDropship()) active_menu = fighter_menu; } if (menu_view) { menu_view->SetBackColor(hud_color); menu_view->SetTextColor(txt_color); menu_view->SetMenu(active_menu); menu_view->Refresh(); } } // +--------------------------------------------------------------------+ bool TacticalView::GetMouseLoc3D() { int mx = Mouse::X(); int my = Mouse::Y(); if (projector) { double focal_dist = width / tan(projector->XAngle()); Point focal_vect = projector->vpn() * focal_dist + projector->vup() * -1 * (my-height/2) + projector->vrt() * (mx-width/2); focal_vect.Normalize(); if (Keyboard::KeyDown(VK_SHIFT)) { if (Mouse::RButton()) return true; if (fabs(focal_vect.x) > fabs(focal_vect.z)) { double dx = move_loc.x - projector->Pos().x; double t = -1 * ((projector->Pos().x - dx) / focal_vect.x); if (t > 0) { Point p = projector->Pos() + focal_vect * t; move_alt = p.y - base_alt; } } else { double dz = move_loc.z - projector->Pos().z; double t = -1 * ((projector->Pos().z - dz) / focal_vect.z); Point p = projector->Pos() + focal_vect * t; if (t > 0) { Point p = projector->Pos() + focal_vect * t; move_alt = p.y - base_alt; } } if (move_alt > 25e3) move_alt = 25e3; else if (move_alt < -25e3) move_alt = -25e3; return true; } else { if (fabs(focal_vect.y) > 1e-5) { if (Mouse::RButton()) return true; bool clamp = false; double t = -1 * ((projector->Pos().y - base_alt) / focal_vect.y); while (t <= 0 && my < height-1) { my++; clamp = true; focal_vect = projector->vpn() * focal_dist + projector->vup() * -1 * (my-height/2) + projector->vrt() * (mx-width/2); focal_vect.Normalize(); t = -1 * ((projector->Pos().y - base_alt) / focal_vect.y); } if (t > 0) { if (clamp) Mouse::SetCursorPos(mx, my); move_loc = projector->Pos() + focal_vect * t; } return true; } } } return false; } void TacticalView::DrawMove() { if (!projector || !msg_ship && !ship) return; if (!show_move && !show_position) return; Point origin; if(msg_ship) origin = msg_ship->Location(); else if (ship) origin = ship->Location(); if (GetMouseLoc3D()) { Point dest = move_loc; double distance = (dest - origin).length(); projector->Transform(origin); projector->Project(origin); int x0 = (int) origin.x; int y0 = (int) origin.y; projector->Transform(dest); projector->Project(dest); int x = (int) dest.x; int y = (int) dest.y; window->DrawEllipse(x-10, y-10, x+10, y+10, Color::White); window->DrawLine(x0, y0, x, y, Color::White); char range[32]; Rect range_rect(x+12, y-8, 120, 20); if (fabs(move_alt) > 1) { dest = move_loc; dest.y += move_alt; distance = (dest - msg_ship->Location()).length(); projector->Transform(dest); projector->Project(dest); int x1 = (int) dest.x; int y1 = (int) dest.y; window->DrawEllipse(x1-10, y1-10, x1+10, y1+10, Color::White); window->DrawLine(x0, y0, x1, y1, Color::White); window->DrawLine(x1, y1, x, y, Color::White); range_rect.x = x1+12; range_rect.y = y1-8; } FormatNumber(range, distance); font->SetColor(Color::White); font->DrawText(range, 0, range_rect, DT_LEFT | DT_SINGLELINE); font->SetColor(txt_color); } } void TacticalView::SendMove() { if (!projector || !show_move || !msg_ship) return; if (GetMouseLoc3D()) { Element* elem = msg_ship->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, RadioMessage::MOVE_PATROL); Point dest = move_loc; dest.y += move_alt; msg->SetLocation(dest); RadioTraffic::Transmit(msg); HUDSounds::PlaySound(HUDSounds::SND_TAC_ACCEPT); } } void TacticalView::SendFormPosition() { if (!projector || !show_position) return; if (GetMouseLoc3D()) { Point dest = move_loc; dest.y += move_alt; if (msg_ship) { msg_ship->GetRadioOrders()->SetOffset(POSITION-2300); msg_ship->GetRadioOrders()->SetOffsetPos(dest); } else if(ship) { ListIter<Ship> iter = ship->wslot(); while (++iter) { Ship* guard = iter.value(); if(guard && guard->GetLeader() != guard) continue; if(guard && !guard->IsCold() && !guard->IsDying()) { guard->GetRadioOrders()->SetOffset(SHIFT-2300); guard->GetRadioOrders()->SetOffsetPos(dest); } } ListIter<Ship> fiter = ship->wfslot(); while (++fiter) { Ship* fguard = fiter.value(); if(fguard && !fguard->IsCold() && fguard->GetPilot()->Alive()) fguard->GetRadioOrders()->SetOffset(SHIFT-2300); fguard->GetRadioOrders()->SetOffsetPos(dest); } } HUDSounds::PlaySound(HUDSounds::SND_TAC_ACCEPT); } } // +--------------------------------------------------------------------+ static int invalid_action = false; void TacticalView::DrawAction() { if (!projector || !show_action || !msg_ship) return; Point origin = msg_ship->Location(); projector->Transform(origin); projector->Project(origin); int x0 = (int) origin.x; int y0 = (int) origin.y; int mx = mouse_action.x; int my = mouse_action.y; int r = 10; int enemy = 2; if (ship->GetIFF() > 1) enemy = 1; Ship* tgt = WillSelectAt(mx, my); int tgt_iff = 0; if (tgt) tgt_iff = tgt->GetIFF(); Color c = Color::White; switch (show_action) { case RadioMessage::ATTACK: case RadioMessage::BRACKET: c = Ship::IFFColor(enemy); if (tgt) { if (tgt_iff == ship->GetIFF() || tgt_iff == 0) r = 0; } break; case RadioMessage::ESCORT: case RadioMessage::DOCK_WITH: c = ship->MarkerColor(); if (tgt) { if (tgt_iff == enemy) r = 0; // must have a hangar to dock with... if (show_action == RadioMessage::DOCK_WITH && tgt->GetHangar() == 0) r = 0; } break; default: if (tgt) { if (tgt_iff == ship->GetIFF()) r = 0; } break; } if (tgt && r) { if ((Game::RealTime()/200) & 1) r = 20; else r = 15; } if (r) { invalid_action = false; window->DrawEllipse(mx-r, my-r, mx+r, my+r, c); } else { invalid_action = true; window->DrawLine(mx-10, my-10, mx+10, my+10, c); window->DrawLine(mx+10, my-10, mx-10, my+10, c); } window->DrawLine(x0, y0, mx, my, c); } void TacticalView::SendAction() { if (!show_action || !msg_ship || invalid_action) { HUDSounds::PlaySound(HUDSounds::SND_TAC_REJECT); return; } int mx = mouse_action.x; int my = mouse_action.y; Ship* tgt = WillSelectAt(mx, my); if (tgt) { Element* elem = msg_ship->GetElement(); RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(elem, ship, show_action); /*** Element* tgt_elem = tgt->GetElement(); if (tgt_elem) { for (int i = 1; i <= tgt_elem->NumShips(); i++) msg->AddTarget(tgt_elem->GetShip(i)); } else { msg->AddTarget(tgt); } ***/ msg->AddTarget(tgt); RadioTraffic::Transmit(msg); HUDSounds::PlaySound(HUDSounds::SND_TAC_ACCEPT); } else { HUDSounds::PlaySound(HUDSounds::SND_TAC_REJECT); } }
[ "light_gemini@hotmail.com" ]
light_gemini@hotmail.com
7a19a8be0f12df6df07feed58c210a2fbf4251a3
47392118552ff3dded543bc75d4852f57c88c828
/include/ore/sdk/core/compiler.h
210980b6da26a4a82b047615a8dbfa7d6d7f6553
[ "Apache-2.0", "LLVM-exception" ]
permissive
ore-project/ore-sdk
6b38c9fe743aa55d24862763253d7cd653401ab2
3bad705bdc6e7a353539253010bcce35b7926749
refs/heads/master
2023-08-06T10:03:15.017076
2021-09-27T19:54:41
2021-09-27T19:54:41
402,206,750
0
0
null
null
null
null
UTF-8
C++
false
false
958
h
/******************************************************************************* * Copyright 2021 Kyrylo Rud * * 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. ******************************************************************************/ #pragma once #include <ore/sdk/core/opr.h> #include <ore/sdk/frontend/ast.h> #include <vector> namespace ore::sdk { opr compile(const std::vector<ast>& trees); opr link(const std::vector<opr>& objects); }
[ "krud.official@gmail.com" ]
krud.official@gmail.com
6cb6d6e4cb33c30a43915d8ff446ac3e92aa2052
d1ef3ea5961b19183ed4241f97faf5a26bdb64e3
/Esp8266UartLogger/Base64.cpp
34984a7f7a5bf24cdbb04195c9953c3cd88ca82b
[]
no_license
gabonator/Projects
d69fd88558d79b0104af708e374605a3d4b5d7f4
9d2fa11404ff0a362c876b43a519f4e2728d4d7d
refs/heads/master
2023-08-31T07:53:32.893768
2023-08-23T21:02:40
2023-08-23T21:02:40
139,358,974
24
12
null
2021-07-13T19:42:55
2018-07-01T20:14:01
C++
UTF-8
C++
false
false
2,452
cpp
#include "Base64.h" const char b64_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; /* 'Private' declarations */ inline void a3_to_a4(unsigned char * a4, unsigned char * a3); inline void a4_to_a3(unsigned char * a3, unsigned char * a4); inline unsigned char b64_lookup(char c); int BASE64PREFIX(base64_encode)(char *output, char *input, int inputLen) { int i = 0, j = 0; int encLen = 0; unsigned char a3[3]; unsigned char a4[4]; while(inputLen--) { a3[i++] = *(input++); if(i == 3) { a3_to_a4(a4, a3); for(i = 0; i < 4; i++) { output[encLen++] = b64_alphabet[a4[i]]; } i = 0; } } if(i) { for(j = i; j < 3; j++) { a3[j] = '\0'; } a3_to_a4(a4, a3); for(j = 0; j < i + 1; j++) { output[encLen++] = b64_alphabet[a4[j]]; } while((i++ < 3)) { output[encLen++] = '='; } } output[encLen] = '\0'; return encLen; } int BASE64PREFIX(base64_decode)(char * output, char * input, int inputLen) { int i = 0, j = 0; int decLen = 0; unsigned char a3[3]; unsigned char a4[4]; while (inputLen--) { if(*input == '=') { break; } a4[i++] = *(input++); if (i == 4) { for (i = 0; i <4; i++) { a4[i] = b64_lookup(a4[i]); } a4_to_a3(a3,a4); for (i = 0; i < 3; i++) { output[decLen++] = a3[i]; } i = 0; } } if (i) { for (j = i; j < 4; j++) { a4[j] = '\0'; } for (j = 0; j <4; j++) { a4[j] = b64_lookup(a4[j]); } a4_to_a3(a3,a4); for (j = 0; j < i - 1; j++) { output[decLen++] = a3[j]; } } output[decLen] = '\0'; return decLen; } int base64_enc_len(int plainLen) { int n = plainLen; return (n + 2 - ((n + 2) % 3)) / 3 * 4; } int base64_dec_len(char * input, int inputLen) { int i = 0; int numEq = 0; for(i = inputLen - 1; input[i] == '='; i--) { numEq++; } return ((6 * inputLen) / 8) - numEq; } inline void a3_to_a4(unsigned char * a4, unsigned char * a3) { a4[0] = (a3[0] & 0xfc) >> 2; a4[1] = ((a3[0] & 0x03) << 4) + ((a3[1] & 0xf0) >> 4); a4[2] = ((a3[1] & 0x0f) << 2) + ((a3[2] & 0xc0) >> 6); a4[3] = (a3[2] & 0x3f); } inline void a4_to_a3(unsigned char * a3, unsigned char * a4) { a3[0] = (a4[0] << 2) + ((a4[1] & 0x30) >> 4); a3[1] = ((a4[1] & 0xf) << 4) + ((a4[2] & 0x3c) >> 2); a3[2] = ((a4[2] & 0x3) << 6) + a4[3]; } inline unsigned char b64_lookup(char c) { int i; for(i = 0; i < 64; i++) { if(b64_alphabet[i] == c) { return i; } } return -1; }
[ "gvalky@sygic.com" ]
gvalky@sygic.com
54512aebb9154c25b890e0f9bfab2e0456f6b275
84b42eb5734bfe3339eb161c5be0f8e3a123930f
/cvmfs/history.h
1be0b914323f94280886fba70937a840049e18fd
[]
no_license
ssheikki/cvmfs
d8d197c96be5bbc4208db8c67c4f4088eca6ef17
ba59b637b452045510e79671961dd3b846ce2db4
refs/heads/master
2020-12-25T22:29:39.352526
2014-05-28T08:18:08
2014-05-28T08:18:08
18,674,393
0
0
null
null
null
null
UTF-8
C++
false
false
3,419
h
/** * This file is part of the CernVM File System. */ #ifndef CVMFS_HISTORY_H_ #define CVMFS_HISTORY_H_ #include <stdint.h> #include <string> #include <vector> #include <set> #include <map> #include "sql.h" #include "hash.h" namespace history { enum UpdateChannel { kChannelTrunk = 0, kChannelDevel = 4, kChannelTest = 16, kChannelProd = 64, }; struct Tag { Tag() { size = 0; revision = 0; timestamp = 0; channel = kChannelTrunk; } Tag(const std::string &n, const shash::Any &h, const uint64_t s, const unsigned r, const time_t t, const UpdateChannel c, const std::string &d) { name = n; root_hash = h; size = s; revision = r; timestamp = t; channel = c; description = d; } bool operator ==(const Tag &other) const { return this->revision == other.revision; } bool operator <(const Tag &other) const { return this->revision < other.revision; } std::string name; shash::Any root_hash; uint64_t size; unsigned revision; time_t timestamp; UpdateChannel channel; std::string description; }; class Database { public: static const float kLatestSchema; static const float kLatestSupportedSchema; static const float kSchemaEpsilon; // floats get imprecise in SQlite // backwards-compatible schema changes static const unsigned kLatestSchemaRevision; Database() { sqlite_db_ = NULL; schema_version_ = 0.0; schema_revision_ = 0; read_write_ = false; ready_ = false; } ~Database(); static bool Create(const std::string &filename, const std::string &repository_name); bool Open(const std::string filename, const sqlite::DbOpenMode open_mode); sqlite3 *sqlite_db() const { return sqlite_db_; } std::string filename() const { return filename_; } float schema_version() const { return schema_version_; } unsigned schema_revision() const { return schema_revision_; } bool ready() const { return ready_; } std::string GetLastErrorMsg() const; private: Database(sqlite3 *sqlite_db, const float schema, const unsigned schema_revision, const bool rw); sqlite3 *sqlite_db_; std::string filename_; float schema_version_; unsigned schema_revision_; bool read_write_; bool ready_; }; class SqlTag : public sqlite::Sql { public: SqlTag(const Database &database, const std::string &statement) { Init(database.sqlite_db(), statement); } virtual ~SqlTag() { /* Done by super class */ } bool BindTag(const Tag &tag); Tag RetrieveTag(); }; class TagList { public: struct ChannelTag { ChannelTag(const UpdateChannel c, const shash::Any &h) : channel(c), root_hash(h) { } UpdateChannel channel; shash::Any root_hash; }; enum Failures { kFailOk = 0, kFailTagExists, }; bool FindTag(const std::string &name, Tag *tag); bool FindRevision(const unsigned revision, Tag *tag); bool FindHash(const shash::Any &hash, Tag *tag); Failures Insert(const Tag &tag); void Remove(const std::string &name); void Rollback(const unsigned until_revision); // Ordered list, newest releases first std::vector<ChannelTag> GetChannelTops(); std::string List(); std::map<std::string, shash::Any> GetAllHashes(); bool Load(Database *database); bool Store(Database *database); private: std::vector<Tag> list_; }; } // namespace hsitory #endif // CVMFS_HISTORY_H_
[ "jblomer@cern.ch" ]
jblomer@cern.ch
9f82b7ab16d5369d78b200f9b3e710237874b39c
07693804fba7a5d513be141319ff6fc441602244
/GainTrial2/Source/PluginProcessor.cpp
612fe7c4aeb32c76000411d0f75a026c91ef6262
[]
no_license
qzhann/JUCE-Plugin
05391f4535c287f34931f6e154f4470584d2906e
df2619c106dcabf0914d8174156f65fa9850ba9b
refs/heads/master
2020-08-07T19:22:35.045208
2019-10-08T06:22:44
2019-10-08T06:22:44
213,563,534
0
0
null
null
null
null
UTF-8
C++
false
false
6,669
cpp
/* ============================================================================== This file was auto-generated! It contains the basic framework code for a JUCE plugin processor. ============================================================================== */ #include "PluginProcessor.h" #include "PluginEditor.h" //============================================================================== GainTrial2AudioProcessor::GainTrial2AudioProcessor() #ifndef JucePlugin_PreferredChannelConfigurations : AudioProcessor (BusesProperties() #if ! JucePlugin_IsMidiEffect #if ! JucePlugin_IsSynth .withInput ("Input", AudioChannelSet::stereo(), true) #endif .withOutput ("Output", AudioChannelSet::stereo(), true) #endif ), parameters(*this, nullptr, "PARAMETERS", {std::make_unique<AudioParameterFloat>("GainId", "Gain", -48, 0, -15)}) #endif { } GainTrial2AudioProcessor::~GainTrial2AudioProcessor() { parameters.state = ValueTree("Parameters"); } //============================================================================== const String GainTrial2AudioProcessor::getName() const { return JucePlugin_Name; } bool GainTrial2AudioProcessor::acceptsMidi() const { #if JucePlugin_WantsMidiInput return true; #else return false; #endif } bool GainTrial2AudioProcessor::producesMidi() const { #if JucePlugin_ProducesMidiOutput return true; #else return false; #endif } bool GainTrial2AudioProcessor::isMidiEffect() const { #if JucePlugin_IsMidiEffect return true; #else return false; #endif } double GainTrial2AudioProcessor::getTailLengthSeconds() const { return 0.0; } int GainTrial2AudioProcessor::getNumPrograms() { return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs, // so this should be at least 1, even if you're not really implementing programs. } int GainTrial2AudioProcessor::getCurrentProgram() { return 0; } void GainTrial2AudioProcessor::setCurrentProgram (int index) { } const String GainTrial2AudioProcessor::getProgramName (int index) { return {}; } void GainTrial2AudioProcessor::changeProgramName (int index, const String& newName) { } //============================================================================== void GainTrial2AudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { previousGain = pow(10, *parameters.getRawParameterValue("GainId") / 20); } void GainTrial2AudioProcessor::releaseResources() { // When playback stops, you can use this as an opportunity to free up any // spare memory, etc. } #ifndef JucePlugin_PreferredChannelConfigurations bool GainTrial2AudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const { #if JucePlugin_IsMidiEffect ignoreUnused (layouts); return true; #else // This is the place where you check if the layout is supported. // In this template code we only support mono or stereo. if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono() && layouts.getMainOutputChannelSet() != AudioChannelSet::stereo()) return false; // This checks if the input layout matches the output layout #if ! JucePlugin_IsSynth if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) return false; #endif return true; #endif } #endif void GainTrial2AudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages) { ScopedNoDenormals noDenormals; auto totalNumInputChannels = getTotalNumInputChannels(); auto totalNumOutputChannels = getTotalNumOutputChannels(); for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i) buffer.clear (i, 0, buffer.getNumSamples()); // This is the place where you'd normally do the guts of your plugin's // audio processing... // Make sure to reset the state if your inner loop is processing // the samples and the outer loop is handling the channels. // Alternatively, you can process the samples with the channels // interleaved by keeping the same state. float currentGain = pow(10, *parameters.getRawParameterValue("GainId") / 20); if (currentGain == previousGain) { buffer.applyGain(currentGain); } else { buffer.applyGainRamp(0, buffer.getNumSamples(), previousGain, currentGain); previousGain = currentGain; } /* for (int channel = 0; channel < totalNumInputChannels; ++channel) { auto* channelData = buffer.getWritePointer (channel); for (int sample = 0; sample < buffer.getNumSamples(); sample++) { channelData[sample] = buffer.getSample(channel, sample) * volume; } } */ } //============================================================================== bool GainTrial2AudioProcessor::hasEditor() const { return true; // (change this to false if you choose to not supply an editor) } AudioProcessorEditor* GainTrial2AudioProcessor::createEditor() { return new GainTrial2AudioProcessorEditor (*this); } //============================================================================== void GainTrial2AudioProcessor::getStateInformation (MemoryBlock& destData) { // You should use this method to store your parameters in the memory block. // You could do that either as raw data, or use the XML or ValueTree classes // as intermediaries to make it easy to save and load complex data. ScopedPointer<XmlElement> xml(parameters.state.createXml()); copyXmlToBinary(*xml, destData); } void GainTrial2AudioProcessor::setStateInformation (const void* data, int sizeInBytes) { // You should use this method to restore your parameters from this memory block, // whose contents will have been created by the getStateInformation() call. ScopedPointer<XmlElement> theParameters(getXmlFromBinary(data, sizeInBytes)); if (theParameters->hasTagName((parameters.state.getType()))) { parameters.state = ValueTree::fromXml(*theParameters); } } //============================================================================== // This creates new instances of the plugin.. AudioProcessor* JUCE_CALLTYPE createPluginFilter() { return new GainTrial2AudioProcessor(); }
[ "noreply@github.com" ]
noreply@github.com
1ff86e1b03b13c6318dd5725a6d26b0238278d1d
c79998048d20aef3d751d082170ebb9ca7c911da
/4.Logic_elements.cpp
f1dc786f884e25dae93fa9bbece13de52903d817
[]
no_license
priyamnagar/CPP
1d5549faa0495e23ed6a0d6d7c42497fd19ed86e
d6d67c7ba18517766a3ddd181d434ea0b0019295
refs/heads/master
2020-05-30T06:57:10.699847
2019-06-12T09:28:20
2019-06-12T09:28:20
189,590,992
0
0
null
null
null
null
UTF-8
C++
false
false
1,668
cpp
#include<iostream> using namespace std; // Switch statement int test_switch(){ char grade; printf("Enter your grade(A-C) : "); scanf("%c",&grade); printf("\nYou entered : %c\n",grade); switch (grade) { case 'A' : printf("Your grade is A"); break; case 'B' : printf("Your grade is B"); break; case 'C' : printf("Your grade is C"); break; default: printf("Invalid input!"); break; } return 0; } //Conditional operator int test_conditional(){ int a = 10, b; b = a==10 ? 1 : 0; printf("Conditional Output: %d",b); return b; } int main(){ //loops //while loop int a = 0; printf("While loop:\n"); while(a<20){ printf("%d ",a); a++; } //for loop printf("\nFor loop: \n"); for( int i=0; i<20; i++ ){ printf("%d ",i); } //do while loop a=0; printf("\ndo-while loop:\n"); do{ printf("%d ",a); a++; }while(a<20); //loop control statements //break statement for(int i=0; i<20;i++){ if(i==5){ printf("\nBroken\n"); break; } } //continue for(int i=0;i<20;i++){ if(i==1){ printf("\nContinue\n"); continue; } break; } //goto for(int i=0;i<20;i++){ if(i==3){ printf("\nGoto Label\n"); goto label; } printf("%d ",i); } label: printf("Switch called\n"); test_switch(); printf("\nConditional operator\n"); test_conditional(); return 0; }
[ "noreply@github.com" ]
noreply@github.com
a4cdfe670c697a39243b53a917a9c1dd0bfefe89
1a93a3b56dc2d54ffe3ee344716654888b0af777
/env/Library/include/qt/QtCharts/5.12.9/QtCharts/private/legendscroller_p.h
fc57a9d32426185750dc8e6452e03f341a7905fd
[ "BSD-3-Clause", "GPL-1.0-or-later", "GPL-3.0-only", "GPL-2.0-only", "Python-2.0", "LicenseRef-scancode-python-cwi", "LicenseRef-scancode-other-copyleft", "0BSD", "LicenseRef-scancode-free-unknown" ]
permissive
h4vlik/TF2_OD_BRE
ecdf6b49b0016407007a1a049f0fdb952d58cbac
54643b6e8e9d76847329b1dbda69efa1c7ae3e72
refs/heads/master
2023-04-09T16:05:27.658169
2021-02-22T14:59:07
2021-02-22T14:59:07
327,001,911
0
0
BSD-3-Clause
2021-02-22T14:59:08
2021-01-05T13:08:03
null
UTF-8
C++
false
false
2,239
h
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 or (at your option) any later version ** approved by the KDE Free Qt Foundation. The licenses are as published by ** the Free Software Foundation and appearing in the file LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // W A R N I N G // ------------- // // This file is not part of the Qt Chart API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. #ifndef LEGENDSCROLLER_P_H #define LEGENDSCROLLER_P_H #include <QtCharts/qlegend.h> #include <private/qlegend_p.h> #include <private/scroller_p.h> #include <QtCharts/private/qchartglobal_p.h> QT_CHARTS_BEGIN_NAMESPACE class QT_CHARTS_PRIVATE_EXPORT LegendScroller: public QLegend, public Scroller { Q_OBJECT public: LegendScroller(QChart *chart); void setOffset(const QPointF &point); QPointF offset() const; void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); }; QT_CHARTS_END_NAMESPACE #endif
[ "martin.cernil@ysoft.com" ]
martin.cernil@ysoft.com
638b332622aedff8fb60bf921364ea65e7a86a1b
5ce3e63d2a661765bf0350f6b66a281ede5eeb01
/dystopian_components/dystopian_maze.cpp
1ed3329ab0ea7a11733600adac600f1bec194ede
[]
no_license
hgholami/abstractfactory
48593ccfb54d35dc82cb57e8eae9432d95be241d
74e449609c67c3f767d79aaf5ce8d0eb70cd4af1
refs/heads/master
2022-04-29T23:32:03.725632
2019-11-30T04:02:36
2019-11-30T04:02:36
224,919,071
0
0
null
null
null
null
UTF-8
C++
false
false
279
cpp
// // Created by Houman on 2019-11-29. // #include "dystopian_maze.hpp" void dystopian_maze::print() { cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl; cout << "Futuristic Dystopian maze includes:" << endl; for(door* d : doors) d->print(); }
[ "35938542+hgholami@users.noreply.github.com" ]
35938542+hgholami@users.noreply.github.com
74e9e5369d7b836f0523d0b1e10efc32de86c9fc
9b4f4ad42b82800c65f12ae507d2eece02935ff6
/header/IO/StmData/MemoryData.h
b9dd3a10f9233138283c806c72f428d8c8902dcc
[]
no_license
github188/SClass
f5ef01247a8bcf98d64c54ee383cad901adf9630
ca1b7efa6181f78d6f01a6129c81f0a9dd80770b
refs/heads/main
2023-07-03T01:25:53.067293
2021-08-06T18:19:22
2021-08-06T18:19:22
393,572,232
0
1
null
2021-08-07T03:57:17
2021-08-07T03:57:16
null
UTF-8
C++
false
false
777
h
#ifndef _SM_IO_STMDATA_MEMORYDATA #define _SM_IO_STMDATA_MEMORYDATA #include "IO/IStreamData.h" namespace IO { namespace StmData { class MemoryData : public IO::IStreamData { private: const UInt8 *data; UOSInt dataLength; public: MemoryData(const UInt8 *data, UOSInt dataLength); virtual ~MemoryData(); virtual UOSInt GetRealData(UInt64 offset, UOSInt length, UInt8 *buffer); virtual const UTF8Char *GetFullName(); virtual const UTF8Char *GetShortName(); virtual UInt64 GetDataSize(); virtual const UInt8 *GetPointer(); virtual IO::IStreamData *GetPartialData(UInt64 offset, UInt64 length); virtual Bool IsFullFile(); virtual Bool IsLoading(); virtual UOSInt GetSeekCount(); }; } } #endif
[ "sswroom@yahoo.com" ]
sswroom@yahoo.com
405af4d325098933f78fa3c71a303a61fb06858c
16b55ac17e77822411c81687bc2039e3e40c24c2
/DP/分割數.cpp
10395c35344508441124d815453dee3924c5ede3
[]
no_license
kaixiang4515/Algorithm_exercise
43e52428a2ecf951c48ee891d8f87ae3b28c57c2
efd8bd2d04deaf8efbe1c9cad4b32032fa058626
refs/heads/master
2020-04-13T18:15:25.916318
2019-11-05T13:06:33
2019-11-05T13:06:33
163,368,688
0
0
null
null
null
null
UTF-8
C++
false
false
730
cpp
//#include <cstdio> //#include <cstring> //#include <algorithm> //#include <ctime> #include <bits/stdc++.h> using namespace std; int dp[1001][1001]; int main() { //freopen("..\\file\\input.txt","r",stdin); //freopen("..\\file\\output.txt","w",stdout); /*clock_t start_c,end_c; start_c=clock();*/ int m,n,M; while(~scanf("%d",&n) && n){ scanf("%d%d",&m,&M); memset(dp,0,sizeof(dp)); dp[0][0]=1; for(int i=1;i<=m;++i) for(int j=0;j<=n;++j) dp[i][j]=j>=i?(dp[i][j-i]+dp[i-1][j])%M:dp[j][j]; printf("%d\n",dp[m][n]); } /*end_c=clock(); printf("Use %.0lf ms\n", (((double)(end_c-start_c))/CLOCKS_PER_SEC)*1000);*/ return 0; }
[ "kaixiang4515@gmail.com" ]
kaixiang4515@gmail.com
afa3fc2e168784a19fbc686b5b229a2619a056b9
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/Display/GeometryHelperSphere.cpp
7a1e03a128c595f9420335e7a1901bc17ad8ea59
[]
no_license
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
18,338
cpp
#include "stdafx.h" #include "../Core/Util.h" #include "../Display/Display.h" #include "../Display/Effect.h" #include "../Display/GeometryHelper.h" #include "../Display/PointInTriangleTester.h" namespace ElixirEngine { //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- #define SV2 sizeof(Vector2) #define SV3 sizeof(Vector3) #define SV4 sizeof(Vector4) VertexElement GeometryHelperVertex::s_VertexElement[4] = { { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 1 * SV3, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, { 0, 2 * SV3, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() }; #undef SV2 #undef SV3 #undef SV4 //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- struct VertexAccessor { virtual GeometryHelperVertexPtr Get(UInt _uIndex) = 0; }; template<typename T> struct TVertexAccessor : public VertexAccessor { TVertexAccessor(GeometryHelperVertexPtr _pVertex, T* _pIndex) : m_pVertex(_pVertex), m_pIndex(_pIndex) { } virtual GeometryHelperVertexPtr Get(UInt _uIndex) { assert((NULL != m_pVertex) && (NULL != m_pIndex)); return m_pVertex + m_pIndex[_uIndex]; } GeometryHelperVertexPtr m_pVertex; T* m_pIndex; }; //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- DisplayGeometrySphere::DisplayGeometrySphere(OctreeRef _rOctree) : DisplayObject(), OctreeObject(_rOctree), m_f4Color(1.0f, 1.0f, 1.0f, 1.0f), m_pIndex16(NULL), m_pIndex32(NULL), m_pVertex(NULL), m_uVertexBuffer(0), m_uIndexBuffer(0), m_uVertexCount(0), m_uIndexCount(0) { } DisplayGeometrySphere::~DisplayGeometrySphere() { } bool DisplayGeometrySphere::Create(const boost::any& _rConfig) { CreateInfoPtr pInfo = boost::any_cast<CreateInfoPtr>(_rConfig); bool bResult = (NULL != pInfo); if (false != bResult) { Release(); bResult = CreateBuffers(*pInfo); if (false != bResult) { bResult = FillVertexBuffer(*pInfo); } if (false != bResult) { bResult = FillIndexBuffer(*pInfo); } if (false != bResult) { CreateBoundingMesh(*pInfo); Matrix m4Pos; D3DXMatrixTranslation(&m4Pos, pInfo->m_f3Pos.x, pInfo->m_f3Pos.y, pInfo->m_f3Pos.z); Matrix m4Rot; D3DXMatrixRotationYawPitchRoll(&m4Rot, D3DXToRadian(pInfo->m_f3Rot.x), D3DXToRadian(pInfo->m_f3Rot.y), D3DXToRadian(pInfo->m_f3Rot.z)); Matrix m4World; D3DXMatrixMultiply(&m4World, &m4Rot, &m4Pos); SetWorldMatrix(m4World); m_f4Color = pInfo->m_f4Color; } } return bResult; } void DisplayGeometrySphere::Update() { } void DisplayGeometrySphere::Release() { if (0 != m_uIndexBuffer) { Display::GetInstance()->ReleaseIndexBufferKey(m_uIndexBuffer); m_uIndexBuffer = 0; m_uIndexCount = 0; } if (NULL != m_uVertexBuffer) { Display::GetInstance()->ReleaseVertexBufferKey(m_uVertexBuffer); m_uVertexBuffer = 0; m_uVertexCount = 0; } if (NULL != m_pIndex16) { delete[] m_pIndex16; m_pIndex16 = NULL; } if (NULL != m_pIndex32) { delete[] m_pIndex32; m_pIndex32 = NULL; } if (NULL != m_pVertex) { delete[] m_pVertex; m_pVertex = NULL; } DisplayObject::Release(); } void DisplayGeometrySphere::RenderBegin() { static const Key uDiffuseColorKey = MakeKey(string("DIFFUSECOLOR")); DisplayPtr pDisplay = Display::GetInstance(); pDisplay->GetMaterialManager()->SetVector4BySemantic(uDiffuseColorKey, &m_f4Color); } void DisplayGeometrySphere::Render() { DisplayPtr pDisplay = Display::GetInstance(); if ((false != pDisplay->SetCurrentVertexBufferKey(m_uVertexBuffer)) && (false != pDisplay->SetCurrentIndexBufferKey(m_uIndexBuffer))) { pDisplay->GetDevicePtr()->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, 0, m_uVertexCount, 0, m_uIndexCount - 2); } } bool DisplayGeometrySphere::RayIntersect(const Vector3& _f3RayBegin, const Vector3& _f3RayEnd, Vector3& _f3Intersect) { Vector3 aVertices[3]; VertexAccessor* pVertexAccessor = NULL; PITTester3 oPITTester; Vector3 f3Out; Vector3 f3Delta; float fLength; float fNearest = FLT_MAX; UInt uIndex = 0; bool bResult = false; if (NULL != m_pIndex16) { pVertexAccessor = new TVertexAccessor<Word>(m_pVertex, m_pIndex16); } else { pVertexAccessor = new TVertexAccessor<UInt>(m_pVertex, m_pIndex32); } aVertices[0] = pVertexAccessor->Get(0)->m_f3Position; aVertices[1] = pVertexAccessor->Get(1)->m_f3Position; for (UInt i = 2 ; m_uIndexCount > i ; ++i, ++uIndex) { const UInt uI0 = ((uIndex + 0) % 3); const UInt uI1 = ((uIndex + 1) % 3); const UInt uI2 = ((uIndex + 2) % 3); aVertices[i % 3] = pVertexAccessor->Get(i)->m_f3Position; if ((aVertices[uI0] == aVertices[uI1]) || (aVertices[uI0] == aVertices[uI2])) { continue; } if (false != oPITTester.Do(_f3RayBegin, _f3RayEnd, aVertices[uI0], aVertices[uI1], aVertices[uI2], f3Out)) { f3Delta = f3Out - _f3RayBegin; fLength = D3DXVec3Length(&f3Delta); if (fNearest > fLength) { _f3Intersect = f3Out; fNearest = fLength; bResult = true; } } } delete pVertexAccessor; return bResult; } bool DisplayGeometrySphere::CreateBuffers(CreateInfoRef _rInfo) { DisplayPtr pDisplay = Display::GetInstance(); const UInt uHemisphereCount = (_rInfo.m_bBottomHemisphere ? 1 : 0) + (_rInfo.m_bTopHemisphere ? 1 : 0); bool bResult = (0 < uHemisphereCount) && (0 < _rInfo.m_uHorizSlices) && (2 < _rInfo.m_uVertSlices); if (false != bResult) { const UInt uHSVertexCount = _rInfo.m_uVertSlices; m_uVertexCount = uHemisphereCount // one vertex for each hemisphere end + (uHemisphereCount * uHSVertexCount * (_rInfo.m_uHorizSlices - 1)) // intermediate + uHSVertexCount; // equator end DisplayVertexBuffer::CreateInfo oVBCInfo; oVBCInfo.m_pVertexElement = GeometryHelperVertex::s_VertexElement; oVBCInfo.m_uVertexSize = sizeof(GeometryHelperVertex); oVBCInfo.m_uBufferSize = m_uVertexCount * sizeof(GeometryHelperVertex); m_uVertexBuffer = pDisplay->CreateVertexBufferKey(oVBCInfo); bResult = (0 != m_uVertexBuffer); } if (false != bResult) { const UInt uNormalStripSize = 2 + _rInfo.m_uVertSlices * 2; const UInt uStripLink = 2; m_uFanToStripSize = 2 * (_rInfo.m_uVertSlices + 1); m_uIndexCount = uHemisphereCount * m_uFanToStripSize; m_uIndexCount += uHemisphereCount * (uNormalStripSize * (_rInfo.m_uHorizSlices - 1)); m_uIndexCount += uHemisphereCount * (uStripLink * (_rInfo.m_uHorizSlices - 1)); DisplayIndexBuffer::CreateInfo oIBCInfo; oIBCInfo.m_b16Bits = (m_uIndexCount <= 0xffff); oIBCInfo.m_uBufferSize = m_uIndexCount; m_uIndexBuffer = pDisplay->CreateIndexBufferKey(oIBCInfo); bResult = (0 != m_uVertexBuffer); } return bResult; } bool DisplayGeometrySphere::FillVertexBuffer(CreateInfoRef _rInfo) { bool bResult = (0 != m_uVertexBuffer); if (false != bResult) { const UInt uHemisphereCount = (_rInfo.m_bBottomHemisphere ? 1 : 0) + (_rInfo.m_bTopHemisphere ? 1 : 0); const UInt uHSVertexCount = _rInfo.m_uVertSlices; const float fVertSliceAngle = D3DXToRadian(360.0f / float(_rInfo.m_uVertSlices)); const float fHorizSliceAngle = D3DXToRadian(90.0f / float(_rInfo.m_uHorizSlices)); m_pVertex = new GeometryHelperVertex[m_uVertexCount]; GeometryHelperVertexPtr pVertex = m_pVertex; /* phi = Acos(pn.Normal.z) pnt.Tv = (phi / PI) u = Acos(Max(Min(pnt.Normal.y / Sin(phi), 1.0), -1.0)) / (2.0 * PI) If pnt.Normal.x > 0 Then pnt.Tu = u Else pnt.Tu = 1 - u End If */ /* u=Nx/2 + 0.5 v=Ny/2 + 0.5 */ if (false != _rInfo.m_bTopHemisphere) { // top hemisphere end pVertex->m_f3Position.x = 0.0f; pVertex->m_f3Position.y = 1.0f; pVertex->m_f3Position.z = 0.0f; ++pVertex; for (UInt i = 0 ; _rInfo.m_uHorizSlices > i ; ++i) { const float fHeight = cos((i + 1) * fHorizSliceAngle); const float fScale = sin((i + 1) * fHorizSliceAngle); if (false == _rInfo.m_bViewFromInside) { for (UInt j = 0 ; _rInfo.m_uVertSlices > j ; ++j) { const float fAngle = j * fVertSliceAngle; pVertex->m_f3Position.x = cos(fAngle) * fScale; pVertex->m_f3Position.y = fHeight; pVertex->m_f3Position.z = sin(fAngle) * fScale; //vsoutput("%f;%f;%f\n", pVertex->m_f3Position.x, pVertex->m_f3Position.y, pVertex->m_f3Position.z); ++pVertex; } } else { for (UInt j = _rInfo.m_uVertSlices - 1 ; _rInfo.m_uVertSlices > j ; --j) { const float fAngle = j * fVertSliceAngle; pVertex->m_f3Position.x = cos(fAngle) * fScale; pVertex->m_f3Position.y = fHeight; pVertex->m_f3Position.z = sin(fAngle) * fScale; //vsoutput("%f;%f;%f\n", pVertex->m_f3Position.x, pVertex->m_f3Position.y, pVertex->m_f3Position.z); ++pVertex; } } } } if (false != _rInfo.m_bBottomHemisphere) { const UInt uStartSlice = (false != _rInfo.m_bTopHemisphere) ? _rInfo.m_uHorizSlices - 1 : _rInfo.m_uHorizSlices; for (UInt i = uStartSlice ; 0 < i ; --i) { const float fHeight = cos(i * fHorizSliceAngle); const float fScale = sin(i * fHorizSliceAngle); if (false == _rInfo.m_bViewFromInside) { for (UInt j = 0 ; _rInfo.m_uVertSlices > j ; ++j) { const float fAngle = j * fVertSliceAngle; pVertex->m_f3Position.x = cos(fAngle) * fScale; pVertex->m_f3Position.y = -fHeight; pVertex->m_f3Position.z = sin(fAngle) * fScale; //vsoutput("%f;%f;%f\n", pVertex->m_f3Position.x, pVertex->m_f3Position.y, pVertex->m_f3Position.z); ++pVertex; } } else { for (UInt j = _rInfo.m_uVertSlices - 1 ; _rInfo.m_uVertSlices > j ; --j) { const float fAngle = j * fVertSliceAngle; pVertex->m_f3Position.x = cos(fAngle) * fScale; pVertex->m_f3Position.y = -fHeight; pVertex->m_f3Position.z = sin(fAngle) * fScale; //vsoutput("%f;%f;%f\n", pVertex->m_f3Position.x, pVertex->m_f3Position.y, pVertex->m_f3Position.z); ++pVertex; } } } // bottom hemisphere end pVertex->m_f3Position.x = 0.0f; pVertex->m_f3Position.y = -1.0f; pVertex->m_f3Position.z = 0.0f; } pVertex = m_pVertex; const float fNormalDir = (false == _rInfo.m_bViewFromInside) ? 1.0f : -1.0f; for (UInt i = 0 ; m_uVertexCount > i ; ++i) { pVertex->m_f3Position.x *= _rInfo.m_f3Radius.x; pVertex->m_f3Position.y *= _rInfo.m_f3Radius.y; pVertex->m_f3Position.z *= _rInfo.m_f3Radius.z; D3DXVec3Normalize(&pVertex->m_f3Normal, &pVertex->m_f3Position); pVertex->m_f3Normal *= fNormalDir; ++pVertex; } Display::GetInstance()->SetVertexBufferKeyData(m_uVertexBuffer, m_pVertex); fsVector3 fs3TRF(_rInfo.m_f3Radius.x, (false != _rInfo.m_bTopHemisphere) ? _rInfo.m_f3Radius.y : 0.0f, _rInfo.m_f3Radius.z); fsVector3 fs3BLN(-_rInfo.m_f3Radius.x, (false != _rInfo.m_bBottomHemisphere) ? -_rInfo.m_f3Radius.y : 0.0f, -_rInfo.m_f3Radius.z); SetAABB(fs3TRF, fs3BLN); } return bResult; } bool DisplayGeometrySphere::FillIndexBuffer(CreateInfoRef _rInfo) { bool bResult = (NULL != m_uIndexBuffer); if (false != bResult) { const bool b16Bits = (m_uIndexCount <= 0xffff); if (false != b16Bits) { m_pIndex16 = new Word[m_uIndexCount]; WordPtr pIndex = m_pIndex16; memset(m_pIndex16, 0, m_uIndexCount * sizeof(Word)); const UInt uHSVertexCount = _rInfo.m_uVertSlices; Word uCurrentVertexIndex = 0; if (false != _rInfo.m_bTopHemisphere) { for (Word i = 0 ; _rInfo.m_uVertSlices > i ; ++i, pIndex += 2) { pIndex[0] = 0; pIndex[1] = i + 1; } pIndex[0] = 0; pIndex[1] = 1; pIndex += 2; uCurrentVertexIndex = 1; } const UInt uHemisphereCount = (_rInfo.m_bBottomHemisphere ? 1 : 0) + (_rInfo.m_bTopHemisphere ? 1 : 0); const UInt uHorizSlicesWOTops = uHemisphereCount * (_rInfo.m_uHorizSlices - 1); // WOTops = WithOut tops for (UInt i = 0 ; uHorizSlicesWOTops > i ; ++i) { const UInt uStartVertexIndex = uCurrentVertexIndex; for (UInt j = 0 ; _rInfo.m_uVertSlices > j ; ++j, pIndex += 2, ++uCurrentVertexIndex) { pIndex[0] = uCurrentVertexIndex; pIndex[1] = uCurrentVertexIndex + uHSVertexCount; } // end of horizontal slice strip (back to starting vertex index) uCurrentVertexIndex = uStartVertexIndex; pIndex[0] = uCurrentVertexIndex; uCurrentVertexIndex += uHSVertexCount; pIndex[1] = uCurrentVertexIndex; pIndex += 2; // link to next strip if (((uHorizSlicesWOTops - 1) > i) || (false != _rInfo.m_bBottomHemisphere)) { pIndex[0] = uCurrentVertexIndex; pIndex[1] = uCurrentVertexIndex; pIndex += 2; } } if (false != _rInfo.m_bBottomHemisphere) { const UInt uStartVertexIndex = uCurrentVertexIndex; for (Word i = 0 ; _rInfo.m_uVertSlices > i ; ++i, pIndex += 2) { pIndex[0] = uCurrentVertexIndex + i; pIndex[1] = m_uVertexCount - 1; } pIndex[0] = uStartVertexIndex; pIndex[1] = m_uVertexCount - 1; } Display::GetInstance()->SetIndexBufferKeyData(m_uIndexBuffer, m_pIndex16); } else { m_pIndex32 = new UInt[m_uIndexCount]; UIntPtr pIndex = m_pIndex32; memset(m_pIndex32, 0, m_uIndexCount * sizeof(UInt)); const UInt uHSVertexCount = _rInfo.m_uVertSlices; UInt uCurrentVertexIndex = 0; if (false != _rInfo.m_bTopHemisphere) { for (UInt i = 0 ; _rInfo.m_uVertSlices > i ; ++i, pIndex += 2) { pIndex[0] = 0; pIndex[1] = i + 1; } pIndex[0] = 0; pIndex[1] = 1; pIndex += 2; uCurrentVertexIndex = 1; } const UInt uHemisphereCount = (_rInfo.m_bBottomHemisphere ? 1 : 0) + (_rInfo.m_bTopHemisphere ? 1 : 0); const UInt uHorizSlicesWOTops = uHemisphereCount * (_rInfo.m_uHorizSlices - 1); // WOTops = WithOut tops for (UInt i = 0 ; uHorizSlicesWOTops > i ; ++i) { const UInt uStartVertexIndex = uCurrentVertexIndex; for (UInt j = 0 ; _rInfo.m_uVertSlices > j ; ++j, pIndex += 2, ++uCurrentVertexIndex) { pIndex[0] = uCurrentVertexIndex; pIndex[1] = uCurrentVertexIndex + uHSVertexCount; } // end of horizontal slice strip (back to starting vertex index) uCurrentVertexIndex = uStartVertexIndex; pIndex[0] = uCurrentVertexIndex; uCurrentVertexIndex += uHSVertexCount; pIndex[1] = uCurrentVertexIndex; pIndex += 2; // link to next strip if (((uHorizSlicesWOTops - 1) > i) || (false != _rInfo.m_bBottomHemisphere)) { pIndex[0] = uCurrentVertexIndex; pIndex[1] = uCurrentVertexIndex; pIndex += 2; } } if (false != _rInfo.m_bBottomHemisphere) { const UInt uStartVertexIndex = uCurrentVertexIndex; for (UInt i = 0 ; _rInfo.m_uVertSlices > i ; ++i, pIndex += 2) { pIndex[0] = uCurrentVertexIndex + i; pIndex[1] = m_uVertexCount - 1; } pIndex[0] = uStartVertexIndex; pIndex[1] = m_uVertexCount - 1; } Display::GetInstance()->SetIndexBufferKeyData(m_uIndexBuffer, m_pIndex32); } } return bResult; } bool DisplayGeometrySphere::CreateBoundingMesh(CreateInfoRef _rInfo) { m_oBoundingMesh.Clear(); const float fTop = (false != _rInfo.m_bTopHemisphere) ? _rInfo.m_f3Radius.y : 0.0f; const float fBottom = (false != _rInfo.m_bBottomHemisphere) ? -_rInfo.m_f3Radius.y : 0.0f; // vertex m_oBoundingMesh.AddVertex(-_rInfo.m_f3Radius.x, fTop, _rInfo.m_f3Radius.z); // TOPLEFTFAR m_oBoundingMesh.AddVertex(_rInfo.m_f3Radius.x, fTop, _rInfo.m_f3Radius.z); // TOPRIGHTTFAR m_oBoundingMesh.AddVertex(_rInfo.m_f3Radius.x, fTop, -_rInfo.m_f3Radius.z); // TOPRIGHTTNEAR m_oBoundingMesh.AddVertex(-_rInfo.m_f3Radius.x, fTop, -_rInfo.m_f3Radius.z); // TOPLEFTNEAR m_oBoundingMesh.AddVertex(-_rInfo.m_f3Radius.x, fBottom, _rInfo.m_f3Radius.z); // BOTTOMLEFTFAR m_oBoundingMesh.AddVertex(_rInfo.m_f3Radius.x, fBottom, _rInfo.m_f3Radius.z); // BOTTOMRIGHTTFAR m_oBoundingMesh.AddVertex(_rInfo.m_f3Radius.x, fBottom, -_rInfo.m_f3Radius.z); // BOTTOMRIGHTTNEAR m_oBoundingMesh.AddVertex(-_rInfo.m_f3Radius.x, fBottom, -_rInfo.m_f3Radius.z); // BOTTOMLEFTTNEAR //triangles // top m_oBoundingMesh.AddTriangle(0, 3, 2); m_oBoundingMesh.AddTriangle(0, 2, 1); // right m_oBoundingMesh.AddTriangle(3, 7, 6); m_oBoundingMesh.AddTriangle(3, 6, 2); // near m_oBoundingMesh.AddTriangle(2, 6, 5); m_oBoundingMesh.AddTriangle(2, 5, 5); // bottom m_oBoundingMesh.AddTriangle(7, 4, 5); m_oBoundingMesh.AddTriangle(7, 5, 6); // left m_oBoundingMesh.AddTriangle(0, 4, 7); m_oBoundingMesh.AddTriangle(0, 7, 3); // far m_oBoundingMesh.AddTriangle(1, 5, 4); m_oBoundingMesh.AddTriangle(1, 4, 0); return true; } }
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329
353b539b32cf6ebd0cdf28fa1b088150870b2b64
189d4887307c99e3c4c87ad9ebea3dbaa4323c02
/latihan contoh aray dua dimensi p.10.1.cpp
392c86da7fd5a50e426dd22a889522cf14527907
[]
no_license
ismail96/pratikum
06994849c55c596229ecfec313069af29f0897ff
96c6bf672098d96980a24150023f7b449f05a5fc
refs/heads/master
2021-01-11T21:46:15.967481
2017-01-13T12:45:56
2017-01-13T12:45:56
78,847,696
0
0
null
null
null
null
UTF-8
C++
false
false
301
cpp
#include <conio.h> #include <iostream.h> main() { char nama[2][3][10]={{"pak","Bu","Mas",}, {"Andi","budi","carli",}}; clrscr(); cout<<nama[0][0]<<ends<<nama[1][0]<<endl; cout<<nama[0][1]<<ends<<nama[1][2]<<endl; cout<<nama[0][2]<<ends<<nama[1][1]<<endl; getch(); }
[ "noreply@github.com" ]
noreply@github.com
c4114987f7a8f29824443e949832eb02ff0c5c73
67ed24f7e68014e3dbe8970ca759301f670dc885
/win10.19042/SysWOW64/wsp_sr.dll.cpp
507cb8503134ec07e5ed4c4793e202b84150bc6c
[]
no_license
nil-ref/dll-exports
d010bd77a00048e52875d2a739ea6a0576c82839
42ccc11589b2eb91b1aa82261455df8ee88fa40c
refs/heads/main
2023-04-20T21:28:05.295797
2021-05-07T14:06:23
2021-05-07T14:06:23
401,055,938
1
0
null
2021-08-29T14:00:50
2021-08-29T14:00:49
null
UTF-8
C++
false
false
998
cpp
#pragma comment(linker, "/export:DllCanUnloadNow=\"C:\\Windows\\SysWOW64\\wsp_sr.DllCanUnloadNow\"") #pragma comment(linker, "/export:DllGetClassObject=\"C:\\Windows\\SysWOW64\\wsp_sr.DllGetClassObject\"") #pragma comment(linker, "/export:DllMain=\"C:\\Windows\\SysWOW64\\wsp_sr.DllMain\"") #pragma comment(linker, "/export:DllRegisterServer=\"C:\\Windows\\SysWOW64\\wsp_sr.DllRegisterServer\"") #pragma comment(linker, "/export:DllUnregisterServer=\"C:\\Windows\\SysWOW64\\wsp_sr.DllUnregisterServer\"") #pragma comment(linker, "/export:GetProviderClassID=\"C:\\Windows\\SysWOW64\\wsp_sr.GetProviderClassID\"") #pragma comment(linker, "/export:MI_Main=\"C:\\Windows\\SysWOW64\\wsp_sr.MI_Main\"") #pragma comment(linker, "/export:PreShutdown=\"C:\\Windows\\SysWOW64\\wsp_sr.PreShutdown\"") #pragma comment(linker, "/export:SetShutdownCallback=\"C:\\Windows\\SysWOW64\\wsp_sr.SetShutdownCallback\"") #pragma comment(linker, "/export:SmpUnload=\"C:\\Windows\\SysWOW64\\wsp_sr.SmpUnload\"")
[ "magnus@stubman.eu" ]
magnus@stubman.eu
ee776acafa649c195c552848959a81f2c4b864a5
9642cdabcc5979498e6a15f986369a7cbab4846f
/src/quipper/dso_test_utils.h
3d2678d2b4973350e0d573aa0d4f129c1469c883
[ "BSD-3-Clause" ]
permissive
ymotongpoo/perf_data_converter
532258acbcb22f3b12755bc03d1ccb011737af3d
8bd3574fc60b54c774da5eb0692829190f103f5d
refs/heads/master
2020-08-19T19:01:06.331189
2019-10-03T21:49:33
2019-10-03T21:49:33
215,945,270
0
0
BSD-3-Clause
2019-10-18T05:07:19
2019-10-18T05:07:18
null
UTF-8
C++
false
false
770
h
// Copyright 2016 The Chromium OS 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 CHROMIUMOS_WIDE_PROFILING_DSO_TEST_UTILS_H_ #define CHROMIUMOS_WIDE_PROFILING_DSO_TEST_UTILS_H_ #include <utility> #include <vector> #include "compat/string.h" namespace quipper { namespace testing { void WriteElfWithBuildid(string filename, string section_name, string buildid); // Note: an ELF with multiple buildid notes is unusual, but useful for testing. void WriteElfWithMultipleBuildids( string filename, const std::vector<std::pair<string, string>> section_buildids); } // namespace testing } // namespace quipper #endif // CHROMIUMOS_WIDE_PROFILING_DSO_TEST_UTILS_H_
[ "lannadorai@gmail.com" ]
lannadorai@gmail.com
eedb3ff04a75d26bf0988fee17a131ca8bce548c
47a838d491581a3d41912ec70702bb68a0d29816
/program23.cpp
9b5ce439b3a4186ab5ac2cfb2830d3dd9dfc2401
[]
no_license
Ujjwal-kr-ydv/Data-sruture-and-Algorithm
ef0a0b7519249692e9e881282a8732ae59b5b8ad
b9922e8726f490402c183aab3c860d93f20eab1b
refs/heads/main
2023-02-28T22:56:19.907885
2021-02-09T17:44:21
2021-02-09T17:44:21
337,485,218
0
0
null
null
null
null
UTF-8
C++
false
false
5,154
cpp
#include<iostream> #include<fstream> #include<cstring> using namespace std; class tel { public: int rollNo,roll1; char name[10]; char div; char address[20]; void accept() { cout<<"\n\tEnter Roll Number : "; cin>>rollNo; cout<<"\n\tEnter the Name : "; cin>>name; cout<<"\n\tEnter the Division:"; cin>>div; cout<<"\n\tEnter the Address:"; cin>>address; } void accept2() { cout<<"\n\tEnter the Roll No. to modify : "; cin>>rollNo; } void accept3() { cout<<"\n\tEnter the name to modify : "; cin>>name; } int getRollNo() { return rollNo; } void show() { cout<<"\n\t"<<rollNo<<"\t\t"<<name<<"\t\t"<<div<<"\t\t"<<address; } }; int main() { int i,n,ch,ch1,rec,start,count,add,n1,add2,start2,n2,y,a,b,on,oname,add3,start3,n3,y1,add4,start4,n4; char name[20],name2[20]; tel t1; count=0; fstream g,f; do { cout<<"\n>>>>>>>>>>>>>>>>>>>>>>MENU<<<<<<<<<<<<<<<<<<<<"; cout<<"\n1.Insert and overwrite\n2.Show\n3.Search & Edit(number)\n4.Search & Edit(name)\n5.Search & Edit(onlynumber)\n6.Search & edit(only name)\n 7.Delete a Student Record\n 8.Exit\n\tEnter the Choice\t:"; cin>>ch; switch(ch) { case 1: f.open("StuRecord.txt",ios::out); x:t1.accept(); f.write((char*) &t1,(sizeof(t1))); cout<<"\nDo you want to enter more records?\n1.Yes\n2.No"; cin>>ch1; if(ch1==1) goto x; else { f.close(); break; } case 2: f.open("StuRecord.txt",ios::in); f.read((char*) &t1,(sizeof(t1))); //cout<<"\n\tRoll No.\t\tName \t\t Division \t\t Address"; while(f) { t1.show(); f.read((char*) &t1,(sizeof(t1))); } f.close(); break; case 3: cout<<"\nEnter the roll number you want to find"; cin>>rec; f.open("StuRecord.txt",ios::in|ios::out); f.read((char*)&t1,(sizeof(t1))); while(f) { if(rec==t1.rollNo) { cout<<"\nRecord found"; add=f.tellg(); f.seekg(0,ios::beg); start=f.tellg(); n1=(add-start)/(sizeof(t1)); f.seekp((n1-1)*sizeof(t1),ios::beg); t1.accept(); f.write((char*) &t1,(sizeof(t1))); f.close(); count++; break; } f.read((char*)&t1,(sizeof(t1))); } if(count==0) cout<<"\nRecord not found"; f.close(); break; case 4: cout<<"\nEnter the name you want to find and edit"; cin>>name; f.open("StuRecord.txt",ios::in|ios::out); f.read((char*)&t1,(sizeof(t1))); while(f) { y=(strcmp(name,t1.name)); if(y==0) { cout<<"\nName found"; add2=f.tellg(); f.seekg(0,ios::beg); start2=f.tellg(); n2=(add2-start2)/(sizeof(t1)); f.seekp((n2-1)*sizeof(t1),ios::beg); t1.accept(); f.write((char*) &t1,(sizeof(t1))); f.close(); break; } f.read((char*)&t1,(sizeof(t1))); } break; case 5: cout<<"\n\tEnter the roll number you want to modify"; cin>>on; f.open("StuRecord.txt",ios::in|ios::out); f.read((char*) &t1,(sizeof(t1))); while(f) { if(on==t1.rollNo) { cout<<"\n\tNumber found"; add3=f.tellg(); f.seekg(0,ios::beg); start3=f.tellg(); n3=(add3-start3)/(sizeof(t1)); f.seekp((n3-1)*(sizeof(t1)),ios::beg); t1.accept2(); f.write((char*)&t1,(sizeof(t1))); f.close(); break; } f.read((char*)&t1,(sizeof(t1))); } break; case 6: cout<<"\nEnter the name you want to find and edit"; cin>>name2; f.open("StuRecord.txt",ios::in|ios::out); f.read((char*)&t1,(sizeof(t1))); while(f) { y1=(strcmp(name2,t1.name)); if(y1==0) { cout<<"\nName found"; add4=f.tellg(); f.seekg(0,ios::beg); start4=f.tellg(); n4=(add4-start4)/(sizeof(t1)); f.seekp((n4-1)*sizeof(t1),ios::beg); t1.accept3(); f.write((char*) &t1,(sizeof(t1))); f.close(); break; } f.read((char*)&t1,(sizeof(t1))); } break; case 7: int roll; cout<<"Please Enter the Roll No. of Student Whose Info You Want to Delete: "; cin>>roll; f.open("StuRecord.txt",ios::in); g.open("temp.txt",ios::out); f.read((char *)&t1,sizeof(t1)); while(!f.eof()) { if (t1.getRollNo() != roll) g.write((char *)&t1,sizeof(t1)); f.read((char *)&t1,sizeof(t1)); } cout << "The record with the roll no. " << roll << " has been deleted " << endl; f.close(); g.close(); remove("StuRecord.txt"); rename("temp.txt","StuRecord.txt"); break; case 8: cout<<"\n\tThank you"; break; } }while(ch!=8); }
[ "noreply@github.com" ]
noreply@github.com
8d11277261b8e31d97d0ea26876e015dd1d58b90
05d7dff950101ba021b369ecb997a7bd5007f7fc
/sysroots/i586-poky-linux-uclibc/usr/src/debug/coreutils/8.21-r0/build/lib/stdio.h
4a97af36ac889d21e6f610300efcf10d44eae5d4
[]
no_license
ghsecuritylab/galileoToolchain
1d529d8657cd184ce880697c37a4407a18010155
bb37d589480b1d86bee62c3d27465958e2ac77c5
refs/heads/master
2021-03-01T00:35:12.560725
2015-04-22T13:56:22
2015-04-22T13:56:22
245,742,634
0
0
null
2020-03-08T03:02:15
2020-03-08T03:02:15
null
UTF-8
C++
false
false
59,371
h
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* A GNU-like <stdio.h>. Copyright (C) 2004, 2007-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 #pragma GCC system_header #endif #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H /* Special invocation convention: - Inside glibc header files. - On OSF/1 5.1 we have a sequence of nested includes <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> -> <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>. In this situation, the functions are not yet declared, therefore we cannot provide the C++ aliases. */ #include_next <stdio.h> #else /* Normal invocation convention. */ #ifndef _GL_STDIO_H #define _GL_ALREADY_INCLUDING_STDIO_H /* The include_next requires a split double-inclusion guard. */ #include_next <stdio.h> #undef _GL_ALREADY_INCLUDING_STDIO_H #ifndef _GL_STDIO_H #define _GL_STDIO_H /* Get va_list. Needed on many systems, including glibc 2.8. */ #include <stdarg.h> #include <stddef.h> /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 and eglibc 2.11.2. May also define off_t to a 64-bit type on native Windows. */ #include <sys/types.h> /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) #else # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif /* _GL_ATTRIBUTE_FORMAT_PRINTF indicates to GCC that the function takes a format string and arguments, where the format string directives are the ones standardized by ISO C99 and POSIX. */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) #else # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) #endif /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, except that it indicates to GCC that the supported format string directives are the ones of the system printf(), rather than the ones standardized by ISO C99 and POSIX. */ #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) /* _GL_ATTRIBUTE_FORMAT_SCANF indicates to GCC that the function takes a format string and arguments, where the format string directives are the ones standardized by ISO C99 and POSIX. */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) #else # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) #endif /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, except that it indicates to GCC that the supported format string directives are the ones of the system scanf(), rather than the ones standardized by ISO C99 and POSIX. */ #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ /* But in any case avoid namespace pollution on glibc systems. */ #if (0 || defined GNULIB_POSIXCHECK) && defined __sun \ && ! defined __GLIBC__ # include <unistd.h> #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some platforms, but is declared and works fine on the platforms on which it exists: #if @GNULIB_FOO@ # if !@HAVE_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on all platforms, but is broken/insufficient and needs to be replaced on some platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on some platforms but is broken/insufficient and needs to be replaced on some of them and is additionally either missing or undeclared on some other platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif */ /* _GL_EXTERN_C declaration; performs the declaration with C linkage. */ #if defined __cplusplus # define _GL_EXTERN_C extern "C" #else # define _GL_EXTERN_C extern #endif /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); declares a replacement function, named rpl_func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype rpl_func parameters_and_attributes /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype func parameters_and_attributes /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ rettype (*const func) parameters = ::rpl_func; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); except that the C function rpl_func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ rettype (*const func) parameters = \ reinterpret_cast<rettype(*)parameters>(::rpl_func); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to the system provided function func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); */ #if defined __cplusplus && defined GNULIB_NAMESPACE /* If we were to write rettype (*const func) parameters = ::func; like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls better (remove an indirection through a 'static' pointer variable), but then the _GL_CXXALIASWARN macro below would cause a warning not only for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = ::func; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = \ reinterpret_cast<rettype(*)parameters>(::func); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function is picked among a set of overloaded functions, namely the one with rettype2 and parameters2. Two consecutive casts are used to silence the "cannot find a match" and "invalid conversion" errors that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE /* The outer cast must be a reinterpret_cast. The inner cast: When the function is defined as a set of overloaded functions, it works as a static_cast<>, choosing the designated variant. When the function is defined as a single variant, it works as a reinterpret_cast<>. The parenthesized cast syntax works both ways. */ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = \ reinterpret_cast<rettype(*)parameters>( \ (rettype2(*)parameters2)(::func)); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN (func); causes a warning to be emitted when ::func is used but not when GNULIB_NAMESPACE::func is used. func must be defined without overloaded variants. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN(func) \ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_WARN_ON_USE (func, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN_2(func,namespace) \ extern __typeof__ (func) func # else # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN(func) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); causes a warning to be emitted when the given overloaded variant of ::func is used but not when GNULIB_NAMESPACE::func is used. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ extern __typeof__ (func) func # else # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif #endif /* _GL_CXXDEFS_H */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. n = 1 stands for the first argument, n = 2 for the second argument etc. */ #ifndef _GL_ARG_NONNULL # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) # else # define _GL_ARG_NONNULL(params) # endif #endif /* The definition of _GL_WARN_ON_USE is copied here. */ #ifndef _GL_WARN_ON_USE # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif #endif /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") is like _GL_WARN_ON_USE (function, "string"), except that the function is declared with the given prototype, consisting of return type, parameters, and attributes. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does not work in this case. */ #ifndef _GL_WARN_ON_USE_CXX # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ extern rettype function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ extern rettype function parameters_and_attributes # else /* Unsupported. */ # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif #endif /* _GL_WARN_EXTERN_C declaration; performs the declaration with C linkage. */ #ifndef _GL_WARN_EXTERN_C # if defined __cplusplus # define _GL_WARN_EXTERN_C extern "C" # else # define _GL_WARN_EXTERN_C extern # endif #endif /* Macros for stringification. */ #define _GL_STDIO_STRINGIZE(token) #token #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dprintf rpl_dprintf # endif _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); # else # if !1 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); # endif _GL_CXXALIASWARN (dprintf); #elif defined GNULIB_POSIXCHECK # undef dprintf # if HAVE_RAW_DECL_DPRINTF _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " "use gnulib module dprintf for portability"); # endif #endif #if 1 /* Close STREAM and its underlying file descriptor. */ # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fclose rpl_fclose # endif _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); # endif _GL_CXXALIASWARN (fclose); #elif defined GNULIB_POSIXCHECK # undef fclose /* Assume fclose is always declared. */ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " "use gnulib module fclose for portable POSIX compliance"); #endif #if 1 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fdopen # define fdopen rpl_fdopen # endif _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); # else _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIASWARN (fdopen); #elif defined GNULIB_POSIXCHECK # undef fdopen /* Assume fdopen is always declared. */ _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " "use gnulib module fdopen for portability"); #endif #if 1 /* Flush all pending data on STREAM according to POSIX rules. Both output and seekable input streams are supported. Note! LOSS OF DATA can occur if fflush is applied on an input stream that is _not_seekable_ or on an update stream that is _not_seekable_ and in which the most recent operation was input. Seekability can be tested with lseek(fileno(fp),0,SEEK_CUR). */ # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fflush rpl_fflush # endif _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); # else _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); # endif _GL_CXXALIASWARN (fflush); #elif defined GNULIB_POSIXCHECK # undef fflush /* Assume fflush is always declared. */ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); #endif #if 1 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fgetc # define fgetc rpl_fgetc # endif _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); # endif _GL_CXXALIASWARN (fgetc); #endif #if 1 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fgets # define fgets rpl_fgets # endif _GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); # else _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); # endif _GL_CXXALIASWARN (fgets); #endif #if 1 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fopen # define fopen rpl_fopen # endif _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); # else _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); # endif _GL_CXXALIASWARN (fopen); #elif defined GNULIB_POSIXCHECK # undef fopen /* Assume fopen is always declared. */ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); #endif #if 0 || 1 # if (0 && 0) \ || (1 && 0 && (0 || 0)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fprintf rpl_fprintf # endif # define GNULIB_overrides_fprintf 1 # if 0 || 1 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # else _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); # else _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); # endif _GL_CXXALIASWARN (fprintf); #endif #if !0 && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_fprintf # undef fprintf # endif /* Assume fprintf is always declared. */ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " "use gnulib module fprintf-posix for portable " "POSIX compliance"); #endif #if 1 /* Discard all pending buffered I/O data on STREAM. STREAM must not be wide-character oriented. When discarding pending output, the file position is set back to where it was before the write calls. When discarding pending input, the file position is advanced to match the end of the previously read input. Return 0 if successful. Upon error, return -1 and set errno. */ # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fpurge rpl_fpurge # endif _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); # else # if !0 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); # endif _GL_CXXALIASWARN (fpurge); #elif defined GNULIB_POSIXCHECK # undef fpurge # if HAVE_RAW_DECL_FPURGE _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " "use gnulib module fpurge for portability"); # endif #endif #if 1 # if 0 && (0 || 0) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputc # define fputc rpl_fputc # endif _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); # endif _GL_CXXALIASWARN (fputc); #endif #if 1 # if 0 && (0 || 0) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputs # define fputs rpl_fputs # endif _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); # else _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); # endif _GL_CXXALIASWARN (fputs); #endif #if 1 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fread # define fread rpl_fread # endif _GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) _GL_ARG_NONNULL ((4))); _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); # else _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); # endif _GL_CXXALIASWARN (fread); #endif #if 1 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef freopen # define freopen rpl_freopen # endif _GL_FUNCDECL_RPL (freopen, FILE *, (const char *filename, const char *mode, FILE *stream) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (freopen, FILE *, (const char *filename, const char *mode, FILE *stream)); # else _GL_CXXALIAS_SYS (freopen, FILE *, (const char *filename, const char *mode, FILE *stream)); # endif _GL_CXXALIASWARN (freopen); #elif defined GNULIB_POSIXCHECK # undef freopen /* Assume freopen is always declared. */ _GL_WARN_ON_USE (freopen, "freopen on native Windows platforms is not POSIX compliant - " "use gnulib module freopen for portability"); #endif #if 1 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fscanf # define fscanf rpl_fscanf # endif _GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); # else _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); # endif _GL_CXXALIASWARN (fscanf); #endif /* Set up the following warnings, based on which modules are in use. GNU Coding Standards discourage the use of fseek, since it imposes an arbitrary limitation on some 32-bit hosts. Remember that the fseek module depends on the fseeko module, so we only have three cases to consider: 1. The developer is not using either module. Issue a warning under GNULIB_POSIXCHECK for both functions, to remind them that both functions have bugs on some systems. _GL_NO_LARGE_FILES has no impact on this warning. 2. The developer is using both modules. They may be unaware of the arbitrary limitations of fseek, so issue a warning under GNULIB_POSIXCHECK. On the other hand, they may be using both modules intentionally, so the developer can define _GL_NO_LARGE_FILES in the compilation units where the use of fseek is safe, to silence the warning. 3. The developer is using the fseeko module, but not fseek. Gnulib guarantees that fseek will still work around platform bugs in that case, but we presume that the developer is aware of the pitfalls of fseek and was trying to avoid it, so issue a warning even when GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be defined to silence the warning in particular compilation units. In C++ compilations with GNULIB_NAMESPACE, in order to avoid that fseek gets defined as a macro, it is recommended that the developer uses the fseek module, even if he is not calling the fseek function. Most gnulib clients that perform stream operations should fall into category 3. */ #if 1 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES # define _GL_FSEEK_WARN /* Category 2, above. */ # undef fseek # endif # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fseek # define fseek rpl_fseek # endif _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); # else _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); # endif _GL_CXXALIASWARN (fseek); #endif #if 1 # if !1 && !defined _GL_NO_LARGE_FILES # define _GL_FSEEK_WARN /* Category 3, above. */ # undef fseek # endif # if 1 /* Provide an fseeko function that is aware of a preceding fflush(), and which detects pipes. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fseeko # define fseeko rpl_fseeko # endif _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); # else # if ! 1 _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); # endif _GL_CXXALIASWARN (fseeko); #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek # undef fseeko # if HAVE_RAW_DECL_FSEEKO _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " "use gnulib module fseeko for portability"); # endif #endif #ifdef _GL_FSEEK_WARN # undef _GL_FSEEK_WARN /* Here, either fseek is undefined (but C89 guarantees that it is declared), or it is defined as rpl_fseek (declared above). */ _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " "on 32-bit platforms - " "use fseeko function for handling of large files"); #endif /* ftell, ftello. See the comments on fseek/fseeko. */ #if 1 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES # define _GL_FTELL_WARN /* Category 2, above. */ # undef ftell # endif # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftell # define ftell rpl_ftell # endif _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); # else _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); # endif _GL_CXXALIASWARN (ftell); #endif #if 1 # if !1 && !defined _GL_NO_LARGE_FILES # define _GL_FTELL_WARN /* Category 3, above. */ # undef ftell # endif # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ftello # define ftello rpl_ftello # endif _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); # else # if ! 1 _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); # endif _GL_CXXALIASWARN (ftello); #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell # undef ftello # if HAVE_RAW_DECL_FTELLO _GL_WARN_ON_USE (ftello, "ftello is unportable - " "use gnulib module ftello for portability"); # endif #endif #ifdef _GL_FTELL_WARN # undef _GL_FTELL_WARN /* Here, either ftell is undefined (but C89 guarantees that it is declared), or it is defined as rpl_ftell (declared above). */ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " "on 32-bit platforms - " "use ftello function for handling of large files"); #endif #if 1 # if 0 && (0 || 0) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fwrite # define fwrite rpl_fwrite # endif _GL_FUNCDECL_RPL (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream) _GL_ARG_NONNULL ((1, 4))); _GL_CXXALIAS_RPL (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); # else _GL_CXXALIAS_SYS (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc, and is not needed for C++. */ # if (0 < __USE_FORTIFY_LEVEL \ && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ && !defined __cplusplus) # undef fwrite # define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; }) # endif # endif _GL_CXXALIASWARN (fwrite); #endif #if 1 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getc # define getc rpl_fgetc # endif _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); # endif _GL_CXXALIASWARN (getc); #endif #if 1 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getchar # define getchar rpl_getchar # endif _GL_FUNCDECL_RPL (getchar, int, (void)); _GL_CXXALIAS_RPL (getchar, int, (void)); # else _GL_CXXALIAS_SYS (getchar, int, (void)); # endif _GL_CXXALIASWARN (getchar); #endif #if 1 /* Read input, up to (and including) the next occurrence of DELIMITER, from STREAM, store it in *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE bytes of space. It is realloc'd as necessary. Return the number of bytes read and stored at *LINEPTR (not including the NUL terminator), or -1 on error or EOF. */ # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getdelim # define getdelim rpl_getdelim # endif _GL_FUNCDECL_RPL (getdelim, ssize_t, (char **lineptr, size_t *linesize, int delimiter, FILE *stream) _GL_ARG_NONNULL ((1, 2, 4))); _GL_CXXALIAS_RPL (getdelim, ssize_t, (char **lineptr, size_t *linesize, int delimiter, FILE *stream)); # else # if !1 _GL_FUNCDECL_SYS (getdelim, ssize_t, (char **lineptr, size_t *linesize, int delimiter, FILE *stream) _GL_ARG_NONNULL ((1, 2, 4))); # endif _GL_CXXALIAS_SYS (getdelim, ssize_t, (char **lineptr, size_t *linesize, int delimiter, FILE *stream)); # endif _GL_CXXALIASWARN (getdelim); #elif defined GNULIB_POSIXCHECK # undef getdelim # if HAVE_RAW_DECL_GETDELIM _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " "use gnulib module getdelim for portability"); # endif #endif #if 1 /* Read a line, up to (and including) the next newline, from STREAM, store it in *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE bytes of space. It is realloc'd as necessary. Return the number of bytes read and stored at *LINEPTR (not including the NUL terminator), or -1 on error or EOF. */ # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getline # define getline rpl_getline # endif _GL_FUNCDECL_RPL (getline, ssize_t, (char **lineptr, size_t *linesize, FILE *stream) _GL_ARG_NONNULL ((1, 2, 3))); _GL_CXXALIAS_RPL (getline, ssize_t, (char **lineptr, size_t *linesize, FILE *stream)); # else # if !1 _GL_FUNCDECL_SYS (getline, ssize_t, (char **lineptr, size_t *linesize, FILE *stream) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (getline, ssize_t, (char **lineptr, size_t *linesize, FILE *stream)); # endif # if 1 _GL_CXXALIASWARN (getline); # endif #elif defined GNULIB_POSIXCHECK # undef getline # if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is unportable - " "use gnulib module getline for portability"); # endif #endif /* It is very rare that the developer ever has full control of stdin, so any use of gets warrants an unconditional warning; besides, C11 removed it. */ #undef gets #if HAVE_RAW_DECL_GETS _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif #if 0 || 0 struct obstack; /* Grow an obstack with formatted output. Return the number of bytes added to OBS. No trailing nul byte is added, and the object should be closed with obstack_finish before use. Upon memory allocation error, call obstack_alloc_failed_handler. Upon other error, return -1. */ # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define obstack_printf rpl_obstack_printf # endif _GL_FUNCDECL_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...)); # else # if !1 _GL_FUNCDECL_SYS (obstack_printf, int, (struct obstack *obs, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_printf, int, (struct obstack *obs, const char *format, ...)); # endif _GL_CXXALIASWARN (obstack_printf); # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define obstack_vprintf rpl_obstack_vprintf # endif _GL_FUNCDECL_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args)); # else # if !1 _GL_FUNCDECL_SYS (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args)); # endif _GL_CXXALIASWARN (obstack_vprintf); #endif #if 0 # if !1 _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); _GL_CXXALIASWARN (pclose); #elif defined GNULIB_POSIXCHECK # undef pclose # if HAVE_RAW_DECL_PCLOSE _GL_WARN_ON_USE (pclose, "pclose is unportable - " "use gnulib module pclose for more portability"); # endif #endif #if IN_COREUTILS_GNULIB_TESTS /* Print a message to standard error, describing the value of ERRNO, (if STRING is not NULL and not empty) prefixed with STRING and ": ", and terminated with a newline. */ # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define perror rpl_perror # endif _GL_FUNCDECL_RPL (perror, void, (const char *string)); _GL_CXXALIAS_RPL (perror, void, (const char *string)); # else _GL_CXXALIAS_SYS (perror, void, (const char *string)); # endif _GL_CXXALIASWARN (perror); #elif defined GNULIB_POSIXCHECK # undef perror /* Assume perror is always declared. */ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " "use gnulib module perror for portability"); #endif #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef popen # define popen rpl_popen # endif _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); # else # if !1 _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); # endif _GL_CXXALIASWARN (popen); #elif defined GNULIB_POSIXCHECK # undef popen # if HAVE_RAW_DECL_POPEN _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " "use gnulib module popen or pipe for more portability"); # endif #endif #if 0 || 1 # if (0 && 0) \ || (1 && 0 && (0 || 0)) # if defined __GNUC__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ # endif # if 0 || 1 _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *format, ...) __asm__ ( _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); # else _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *format, ...) __asm__ ( _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); # else # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define printf rpl_printf # endif _GL_FUNCDECL_RPL (printf, int, (const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); # endif # define GNULIB_overrides_printf 1 # else _GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); # endif _GL_CXXALIASWARN (printf); #endif #if !0 && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_printf # undef printf # endif /* Assume printf is always declared. */ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " "use gnulib module printf-posix for portable " "POSIX compliance"); #endif #if 1 # if 0 && (0 || 0) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putc # define putc rpl_fputc # endif _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); # endif _GL_CXXALIASWARN (putc); #endif #if 1 # if 0 && (0 || 0) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putchar # define putchar rpl_putchar # endif _GL_FUNCDECL_RPL (putchar, int, (int c)); _GL_CXXALIAS_RPL (putchar, int, (int c)); # else _GL_CXXALIAS_SYS (putchar, int, (int c)); # endif _GL_CXXALIASWARN (putchar); #endif #if 1 # if 0 && (0 || 0) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef puts # define puts rpl_puts # endif _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (puts, int, (const char *string)); # else _GL_CXXALIAS_SYS (puts, int, (const char *string)); # endif _GL_CXXALIASWARN (puts); #endif #if 1 # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef remove # define remove rpl_remove # endif _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (remove, int, (const char *name)); # else _GL_CXXALIAS_SYS (remove, int, (const char *name)); # endif _GL_CXXALIASWARN (remove); #elif defined GNULIB_POSIXCHECK # undef remove /* Assume remove is always declared. */ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " "use gnulib module remove for more portability"); #endif #if 1 # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef rename # define rename rpl_rename # endif _GL_FUNCDECL_RPL (rename, int, (const char *old_filename, const char *new_filename) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (rename, int, (const char *old_filename, const char *new_filename)); # else _GL_CXXALIAS_SYS (rename, int, (const char *old_filename, const char *new_filename)); # endif _GL_CXXALIASWARN (rename); #elif defined GNULIB_POSIXCHECK # undef rename /* Assume rename is always declared. */ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " "use gnulib module rename for more portability"); #endif #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef renameat # define renameat rpl_renameat # endif _GL_FUNCDECL_RPL (renameat, int, (int fd1, char const *file1, int fd2, char const *file2) _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (renameat, int, (int fd1, char const *file1, int fd2, char const *file2)); # else # if !1 _GL_FUNCDECL_SYS (renameat, int, (int fd1, char const *file1, int fd2, char const *file2) _GL_ARG_NONNULL ((2, 4))); # endif _GL_CXXALIAS_SYS (renameat, int, (int fd1, char const *file1, int fd2, char const *file2)); # endif _GL_CXXALIASWARN (renameat); #elif defined GNULIB_POSIXCHECK # undef renameat # if HAVE_RAW_DECL_RENAMEAT _GL_WARN_ON_USE (renameat, "renameat is not portable - " "use gnulib module renameat for portability"); # endif #endif #if 1 # if 0 && 0 # if defined __GNUC__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef scanf /* Don't break __attribute__((format(scanf,M,N))). */ # define scanf __scanf__ # endif _GL_FUNCDECL_RPL_1 (__scanf__, int, (const char *format, ...) __asm__ ( _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); # else # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef scanf # define scanf rpl_scanf # endif _GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); # endif # else _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); # endif _GL_CXXALIASWARN (scanf); #endif #if 1 # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define snprintf rpl_snprintf # endif _GL_FUNCDECL_RPL (snprintf, int, (char *str, size_t size, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, (char *str, size_t size, const char *format, ...)); # else # if !1 _GL_FUNCDECL_SYS (snprintf, int, (char *str, size_t size, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (snprintf, int, (char *str, size_t size, const char *format, ...)); # endif _GL_CXXALIASWARN (snprintf); #elif defined GNULIB_POSIXCHECK # undef snprintf # if HAVE_RAW_DECL_SNPRINTF _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " "use gnulib module snprintf for portability"); # endif #endif /* Some people would argue that all sprintf uses should be warned about (for example, OpenBSD issues a link warning for it), since it can cause security holes due to buffer overruns. However, we believe that sprintf can be used safely, and is more efficient than snprintf in those safe cases; and as proof of our belief, we use sprintf in several gnulib modules. So this header intentionally avoids adding a warning to sprintf except when GNULIB_POSIXCHECK is defined. */ #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define sprintf rpl_sprintf # endif _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); # else _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); # endif _GL_CXXALIASWARN (sprintf); #elif defined GNULIB_POSIXCHECK # undef sprintf /* Assume sprintf is always declared. */ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " "use gnulib module sprintf-posix for portable " "POSIX compliance"); #endif #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define tmpfile rpl_tmpfile # endif _GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); # else _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); # endif _GL_CXXALIASWARN (tmpfile); #elif defined GNULIB_POSIXCHECK # undef tmpfile # if HAVE_RAW_DECL_TMPFILE _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " "use gnulib module tmpfile for portability"); # endif #endif #if 1 /* Write formatted output to a string dynamically allocated with malloc(). If the memory allocation succeeds, store the address of the string in *RESULT and return the number of resulting bytes, excluding the trailing NUL. Upon memory allocation error, or some other error, return -1. */ # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define asprintf rpl_asprintf # endif _GL_FUNCDECL_RPL (asprintf, int, (char **result, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (asprintf, int, (char **result, const char *format, ...)); # else # if !1 _GL_FUNCDECL_SYS (asprintf, int, (char **result, const char *format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (asprintf, int, (char **result, const char *format, ...)); # endif _GL_CXXALIASWARN (asprintf); # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vasprintf rpl_vasprintf # endif _GL_FUNCDECL_RPL (vasprintf, int, (char **result, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vasprintf, int, (char **result, const char *format, va_list args)); # else # if !1 _GL_FUNCDECL_SYS (vasprintf, int, (char **result, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (vasprintf, int, (char **result, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vasprintf); #endif #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vdprintf rpl_vdprintf # endif _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); # else # if !1 _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on Solaris, the third parameter will likely be __va_list args. */ _GL_CXXALIAS_SYS_CAST (vdprintf, int, (int fd, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vdprintf); #elif defined GNULIB_POSIXCHECK # undef vdprintf # if HAVE_RAW_DECL_VDPRINTF _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " "use gnulib module vdprintf for portability"); # endif #endif #if 1 || 1 # if (1 && 1) \ || (1 && 0 && (0 || 0)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vfprintf rpl_vfprintf # endif # define GNULIB_overrides_vfprintf 1 # if 1 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # else _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vfprintf, int, (FILE *fp, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vfprintf); #endif #if !1 && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vfprintf # undef vfprintf # endif /* Assume vfprintf is always declared. */ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "use gnulib module vfprintf-posix for portable " "POSIX compliance"); #endif #if 0 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef vfscanf # define vfscanf rpl_vfscanf # endif _GL_FUNCDECL_RPL (vfscanf, int, (FILE *stream, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vfscanf, int, (FILE *stream, const char *format, va_list args)); # else _GL_CXXALIAS_SYS (vfscanf, int, (FILE *stream, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vfscanf); #endif #if 1 || 1 # if (1 && 1) \ || (1 && 0 && (0 || 0)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vprintf rpl_vprintf # endif # define GNULIB_overrides_vprintf 1 # if 1 || 1 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) _GL_ARG_NONNULL ((1))); # else _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); # else /* Need to cast, because on Solaris, the second parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); # endif _GL_CXXALIASWARN (vprintf); #endif #if !1 && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vprintf # undef vprintf # endif /* Assume vprintf is always declared. */ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "use gnulib module vprintf-posix for portable " "POSIX compliance"); #endif #if 0 # if 0 && 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef vscanf # define vscanf rpl_vscanf # endif _GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); # else _GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); # endif _GL_CXXALIASWARN (vscanf); #endif #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsnprintf rpl_vsnprintf # endif _GL_FUNCDECL_RPL (vsnprintf, int, (char *str, size_t size, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, (char *str, size_t size, const char *format, va_list args)); # else # if !1 _GL_FUNCDECL_SYS (vsnprintf, int, (char *str, size_t size, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (vsnprintf, int, (char *str, size_t size, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vsnprintf); #elif defined GNULIB_POSIXCHECK # undef vsnprintf # if HAVE_RAW_DECL_VSNPRINTF _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " "use gnulib module vsnprintf for portability"); # endif #endif #if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsprintf rpl_vsprintf # endif _GL_FUNCDECL_RPL (vsprintf, int, (char *str, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vsprintf, int, (char *str, const char *format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vsprintf, int, (char *str, const char *format, va_list args)); # endif _GL_CXXALIASWARN (vsprintf); #elif defined GNULIB_POSIXCHECK # undef vsprintf /* Assume vsprintf is always declared. */ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "use gnulib module vsprintf-posix for portable " "POSIX compliance"); #endif #endif /* _GL_STDIO_H */ #endif /* _GL_STDIO_H */ #endif
[ "schwannden@localhost.localdomain" ]
schwannden@localhost.localdomain
db1e752247f29d42b75e27466547954eb410d0b4
91c67d472915c414f386c0eb5adff7b01c4dcddb
/interface/RemoveTooth.cpp
f45ea8b17c10fe515167c6d04608b36e765d464b
[]
no_license
handtan/3DViewer
e74ba21275d0da3c0ddd58de66fff87cbff1c450
ee573b34ba6aa6e6734e86d548ae1f40fba61acd
refs/heads/master
2022-10-15T15:25:38.077549
2020-06-04T06:28:46
2020-06-04T06:28:46
265,424,151
0
2
null
null
null
null
UTF-8
C++
false
false
999
cpp
#include "pch.h" #include "RemoveTooth.h" #include "MessageID.h" using namespace System; using namespace System::Windows; using namespace System::Windows::Controls; using namespace System::Windows::Media; using namespace System::Runtime; using namespace System::Windows::Interop; gcroot<HwndSource^> gHwndSource_REMOVETEETH; gcroot<UI::RemoveTooth^> gwcObject = nullptr; RemoveTooth::RemoveTooth(HWND hView, HWND hWnd) { gwcObject = gcnew UI::RemoveTooth(); gwcObject->SetParentHwnd((IntPtr)hView); } RemoveTooth::~RemoveTooth() { Is_Show = FALSE; } void RemoveTooth::Show() { gwcObject->Show(); Is_Show = TRUE; } void RemoveTooth::Hide() { gwcObject->Hide(); Is_Show = FALSE; } HWND RemoveTooth::GetHWND() { return hwndWPF; } int RemoveTooth::GetWidth() { return (int)gwcObject->Width; } int RemoveTooth::GetHeight() { return (int)gwcObject->Height; } void RemoveTooth::SetPosition(int MFCFrameTop, int MFCFrameLeft) { gwcObject->SetFramePosition(MFCFrameTop, MFCFrameLeft); }
[ "handtan@gmail.com" ]
handtan@gmail.com
b6f2587d5651aaedda4b6b9d76d00c9cc336d598
9a3b9d80afd88e1fa9a24303877d6e130ce22702
/src/Providers/UNIXProviders/OrderedDependency/UNIX_OrderedDependency_HPUX.hxx
861b0bcd82cfb6f09275eeeedec8efc9d64b36f1
[ "MIT" ]
permissive
brunolauze/openpegasus-providers
3244b76d075bc66a77e4ed135893437a66dd769f
f24c56acab2c4c210a8d165bb499cd1b3a12f222
refs/heads/master
2020-04-17T04:27:14.970917
2015-01-04T22:08:09
2015-01-04T22:08:09
19,707,296
0
0
null
null
null
null
UTF-8
C++
false
false
1,818
hxx
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #ifdef PEGASUS_OS_HPUX #ifndef __UNIX_ORDEREDDEPENDENCY_PRIVATE_H #define __UNIX_ORDEREDDEPENDENCY_PRIVATE_H #endif #endif
[ "brunolauze@msn.com" ]
brunolauze@msn.com
7232dc44c348ded6419a1cea93080f2b1102a489
4352b5c9e6719d762e6a80e7a7799630d819bca3
/tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/processor0/4.35/p
ee36c86b5b5b49c1260c13de3179481147d0d52c
[]
no_license
dashqua/epicProject
d6214b57c545110d08ad053e68bc095f1d4dc725
54afca50a61c20c541ef43e3d96408ef72f0bcbc
refs/heads/master
2022-02-28T17:20:20.291864
2019-10-28T13:33:16
2019-10-28T13:33:16
184,294,390
1
0
null
null
null
null
UTF-8
C++
false
false
26,461
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "4.35"; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField nonuniform List<scalar> 5625 ( 1.00024 1.00017 1.00012 1.00009 1.00006 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999998 1 0.999998 0.999996 0.999995 0.999994 0.999988 0.999984 0.999981 0.999967 0.999956 0.999945 0.999932 0.999917 0.999913 0.999923 0.999962 1.00006 1.00024 1.00058 1.00114 1.00204 1.00342 1.00548 1.00842 1.01245 1.01763 1.02367 1.02976 1.03475 1.03763 1.03797 1.00022 1.00016 1.00011 1.00008 1.00006 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 0.999999 1 0.999999 0.999999 0.999998 0.999997 0.999995 0.999993 0.999992 0.999982 0.999981 0.99997 0.999957 0.999948 0.999931 0.999918 0.999911 0.999914 0.999944 1.00002 1.00017 1.00046 1.00094 1.00172 1.00294 1.00476 1.00739 1.01104 1.01583 1.02161 1.02777 1.03322 1.03689 1.03816 1.0002 1.00015 1.0001 1.00008 1.00005 1.00004 1.00003 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 0.999998 1 0.999998 0.999999 0.999997 0.999996 0.999994 0.999991 0.999986 0.999979 0.999973 0.99996 0.999948 0.999935 0.999919 0.999909 0.999909 0.99993 0.999987 1.00012 1.00035 1.00077 1.00144 1.0025 1.00409 1.00642 1.00968 1.01406 1.01951 1.0256 1.0314 1.03578 1.03798 1.00019 1.00013 1.0001 1.00007 1.00005 1.00004 1.00003 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 0.999999 1 0.999999 0.999998 0.999995 0.999995 0.999991 0.999989 0.999978 0.999973 0.999966 0.999948 0.999936 0.999924 0.999907 0.999906 0.999916 0.999963 1.00007 1.00026 1.00061 1.00119 1.0021 1.00348 1.00552 1.00841 1.01235 1.0174 1.0233 1.02928 1.03429 1.03739 1.00017 1.00012 1.00009 1.00006 1.00005 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999998 0.999998 0.999997 0.999993 0.999992 0.999988 0.999985 0.999972 0.999967 0.999954 0.999938 0.999925 0.999911 0.999902 0.999909 0.999942 1.00002 1.00019 1.00047 1.00096 1.00174 1.00293 1.00469 1.00723 1.01073 1.01533 1.02091 1.02693 1.0324 1.03634 1.00015 1.00011 1.00008 1.00006 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 0.999999 1 0.999996 0.999999 0.999995 0.999991 0.999989 0.999986 0.999975 0.999966 0.999958 0.999944 0.999925 0.999915 0.999902 0.999904 0.999925 0.999988 1.00012 1.00036 1.00076 1.00142 1.00243 1.00395 1.00615 1.00922 1.01334 1.01852 1.02439 1.03017 1.03483 1.00014 1.0001 1.00007 1.00005 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999999 1 0.999998 0.999999 0.999998 0.999996 0.999998 0.999992 0.999989 0.999984 0.99998 0.999969 0.999959 0.999947 0.999931 0.999918 0.999903 0.9999 0.999915 0.999962 1.00006 1.00026 1.00059 1.00114 1.002 1.00329 1.00517 1.00784 1.01147 1.01617 1.02176 1.02763 1.03285 1.00012 1.00009 1.00007 1.00005 1.00004 1.00003 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 0.999998 1 0.999995 0.999996 0.999995 0.99999 0.999986 0.99998 0.999974 0.999962 0.999949 0.999936 0.999921 0.999909 0.999899 0.999906 0.999941 1.00002 1.00017 1.00044 1.0009 1.00161 1.0027 1.00431 1.00659 1.00975 1.01393 1.0191 1.02487 1.03045 1.00011 1.00008 1.00006 1.00005 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 0.999999 1 0.999999 0.999999 1 0.999998 0.999998 1 0.999993 0.999995 0.999993 0.999987 0.999982 0.999975 0.999966 0.999954 0.999941 0.999925 0.999911 0.999904 0.999902 0.999922 0.999983 1.00011 1.00032 1.00069 1.00128 1.00219 1.00354 1.00548 1.0082 1.01184 1.01651 1.02199 1.0277 1.0001 1.00007 1.00006 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999998 1 1 0.999999 1 1 0.999999 1 1 1 1 1 0.999999 1 1 0.999998 1 0.999996 1 0.999998 0.999992 0.999994 0.999989 0.999983 0.999977 0.999969 0.999959 0.999943 0.999932 0.999916 0.999905 0.999902 0.999913 0.999957 1.00005 1.00022 1.00052 1.001 1.00175 1.00288 1.00451 1.00681 1.00995 1.01406 1.0191 1.02471 1.00009 1.00007 1.00005 1.00004 1.00003 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999998 1 1 0.999999 0.999999 1 0.999999 0.999996 1 0.999995 0.999993 0.999992 0.999984 0.99998 0.999971 0.999961 0.999951 0.999935 0.99992 0.99991 0.999903 0.999908 0.999935 1.00001 1.00014 1.00038 1.00077 1.00138 1.00231 1.00367 1.0056 1.00826 1.01181 1.01631 1.0216 1.00008 1.00006 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999998 0.999997 0.999999 0.999991 0.999992 0.999988 0.99998 0.999975 0.999966 0.999954 0.999942 0.999927 0.999915 0.999905 0.999904 0.999925 0.999975 1.00007 1.00026 1.00057 1.00107 1.00182 1.00294 1.00455 1.00678 1.00979 1.01371 1.01852 1.00007 1.00005 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 0.999998 1 1 0.999997 1 0.999996 0.999997 0.999997 0.999989 0.99999 0.999985 0.999976 0.999971 0.999957 0.999948 0.999935 0.999919 0.999909 0.999907 0.999914 0.99995 1.00003 1.00017 1.00041 1.00081 1.00142 1.00233 1.00365 1.0055 1.00802 1.01136 1.01559 1.00006 1.00005 1.00003 1.00003 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 0.999999 1 0.999999 0.999999 1 1 0.999999 0.999999 0.999999 0.999995 0.999998 0.999993 0.999989 0.999987 0.999979 0.999974 0.999964 0.999952 0.999939 0.999928 0.999915 0.999908 0.999913 0.999934 0.99999 1.0001 1.00029 1.0006 1.00109 1.00182 1.00289 1.00441 1.0065 1.0093 1.01292 1.00005 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 0.999998 1 0.999998 1 0.999996 0.999995 0.999997 0.999989 0.999987 0.999985 0.999973 0.999969 0.99996 0.999944 0.999933 0.999924 0.999913 0.999912 0.999926 0.999963 1.00005 1.00019 1.00043 1.00082 1.00141 1.00226 1.00349 1.0052 1.00752 1.01056 1.00005 1.00003 1.00003 1.00002 1.00001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 0.999999 0.999998 0.999999 0.999996 0.999994 0.999994 0.999989 0.999985 0.99998 0.999971 0.999963 0.999953 0.999939 0.99993 0.999919 0.999915 0.999921 0.99995 1 1.00011 1.0003 1.0006 1.00106 1.00175 1.00273 1.00411 1.00601 1.00852 1.00004 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 0.999999 1 0.999997 0.999996 1 0.999995 0.999992 0.999992 0.999987 0.999982 0.999975 0.999966 0.999961 0.999945 0.999934 0.999929 0.999919 0.99992 0.999938 0.999979 1.00006 1.0002 1.00043 1.00079 1.00132 1.00211 1.00322 1.00474 1.00679 1.00003 1.00003 1.00002 1.00001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 0.999999 1 0.999998 1 1 0.999999 1 1 0.999998 1 1 0.999997 1 0.999999 0.999999 0.999999 0.999997 0.999997 0.999995 0.999992 0.999989 0.999983 0.99998 0.999972 0.999963 0.999954 0.999944 0.999932 0.999926 0.999924 0.999931 0.999961 1.00002 1.00012 1.00029 1.00057 1.00099 1.0016 1.00248 1.0037 1.00535 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999998 1 1 0.999999 1 1 1 1 0.999998 1 0.999999 0.999999 1 0.999999 1 0.999998 0.999995 0.999996 0.999994 0.99999 0.999987 0.999982 0.999974 0.999969 0.999959 0.99995 0.99994 0.999931 0.999929 0.99993 0.999948 0.99999 1.00007 1.0002 1.0004 1.00073 1.0012 1.00189 1.00285 1.00416 1.00002 1.00002 1.00001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 0.999999 0.999999 0.999999 0.999997 0.999996 0.999997 0.999991 0.999987 0.999987 0.999979 0.999971 0.999968 0.999955 0.999946 0.99994 0.999934 0.999935 0.999943 0.999972 1.00003 1.00012 1.00028 1.00052 1.00089 1.00142 1.00217 1.0032 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 1 0.999999 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999996 0.999999 0.999998 0.999993 0.999995 0.999991 0.999986 0.999983 0.999977 0.999969 0.999963 0.999954 0.999945 0.999941 0.999937 0.999943 0.999961 0.999998 1.00007 1.00018 1.00037 1.00065 1.00105 1.00163 1.00243 1.00002 1.00001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 0.999998 1 1 1 1 0.999999 0.999999 1 0.999998 0.999997 0.999999 0.999995 0.999994 0.999994 0.999988 0.999984 0.999982 0.999974 0.999966 0.999962 0.999954 0.999945 0.999943 0.999946 0.999957 0.99998 1.00003 1.00012 1.00025 1.00046 1.00077 1.00121 1.00183 1.00001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 0.999998 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999998 1 1 0.999998 0.999999 1 0.999996 0.999998 0.999995 0.999993 0.999992 0.999988 0.999982 0.99998 0.999972 0.999966 0.99996 0.999954 0.999948 0.999949 0.999955 0.999972 1.00001 1.00007 1.00017 1.00032 1.00055 1.00089 1.00136 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 0.999999 0.999999 0.999999 0.999998 0.999998 0.999998 0.999993 0.999993 0.999992 0.999985 0.999982 0.999978 0.999972 0.999964 0.99996 0.999957 0.999953 0.999956 0.999969 0.999992 1.00003 1.00011 1.00022 1.00039 1.00064 1.001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 1 0.999999 1 1 0.999999 0.999999 1 0.999996 0.999998 0.999997 0.999992 0.999992 0.99999 0.999985 0.999981 0.999976 0.999971 0.999966 0.999961 0.999959 0.999959 0.999967 0.999983 1.00001 1.00006 1.00015 1.00027 1.00046 1.00072 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 0.999999 0.999999 0.999996 0.999997 0.999995 0.999993 0.999991 0.999989 0.999983 0.999981 0.999976 0.999972 0.999968 0.999963 0.999965 0.999968 0.999978 1 1.00004 1.0001 1.00019 1.00032 1.00052 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 0.999999 1 0.999998 0.999999 1 0.999998 0.999999 0.999998 0.999996 0.999998 0.999995 0.999991 0.999991 0.999989 0.999983 0.99998 0.999976 0.999972 0.999971 0.999968 0.999971 0.999977 0.999992 1.00002 1.00006 1.00013 1.00023 1.00037 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 0.999999 0.999999 0.999999 0.999997 0.999996 0.999997 0.999994 0.999991 0.999991 0.999987 0.999984 0.99998 0.999978 0.999974 0.999972 0.999976 0.99998 0.999987 1.00001 1.00004 1.00009 1.00016 1.00026 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999998 1 0.999996 0.999996 0.999996 0.999995 0.999991 0.999989 0.999989 0.999985 0.99998 0.999981 0.999979 0.999976 0.99998 0.99999 1 1.00002 1.00006 1.00011 1.00018 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 0.999998 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 0.999999 0.999999 0.999998 0.999998 0.999997 0.999997 0.999995 0.999994 0.999991 0.999989 0.999989 0.999985 0.999982 0.999983 0.999983 0.999984 0.999988 0.999999 1.00001 1.00004 1.00007 1.00013 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999998 1 1 0.999999 1 0.999999 1 1 1 1 1 1 0.999999 1 0.999999 1 0.999999 0.999999 1 0.999999 1 1 0.999999 0.999998 1 0.999999 0.999997 0.999998 0.999996 0.999994 0.999993 0.999993 0.999989 0.999989 0.999988 0.999984 0.999985 0.999987 0.999989 0.999997 1.00001 1.00003 1.00005 1.00009 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 0.999998 1 1 0.999999 1 1 0.999998 1 1 0.999998 0.999999 1 0.999995 0.999998 0.999998 0.999995 0.999992 0.999993 0.999992 0.999988 0.99999 0.999988 0.99999 0.999992 0.999995 1.00001 1.00002 1.00004 1.00007 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 0.999998 1 1 0.999997 1 1 0.999998 1 1 0.999998 1 1 0.999998 0.999999 1 0.999996 0.999997 0.999998 0.999994 0.999994 0.999992 0.999993 0.999992 0.999991 0.99999 0.999993 0.999999 1 1.00001 1.00003 1.00005 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 0.999999 1 1 1 0.999999 1 1 0.999997 1 0.999998 0.999999 1 0.999998 1 1 0.999998 0.999999 1 0.999998 0.999999 1 0.999999 0.999999 0.999999 0.999996 0.999997 0.999998 0.999995 0.999995 0.999992 0.999993 0.999995 0.999993 0.999995 0.999998 1 1.00001 1.00002 1.00004 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 0.999996 1 0.999999 0.999998 1 0.999999 0.999999 1 0.999999 1 1 0.999999 1 1 0.999998 1 0.999999 0.999997 0.999997 0.999997 0.999997 0.999996 0.999993 0.999994 0.999997 0.999996 0.999997 1 1.00001 1.00002 1.00003 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 0.999998 1 1 0.999996 1 1 0.999998 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999998 1 0.999999 0.999997 0.999998 0.999997 0.999998 0.999996 0.999995 0.999997 0.999999 1 1 1.00001 1.00001 1.00002 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999998 1 0.999999 0.999999 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999998 1 1 0.999997 1 1 0.999998 1 1 1 1 0.999998 1 1 0.999999 1 0.999999 0.999999 0.999999 1 0.999997 0.999997 0.999998 1 0.999998 0.999994 0.999999 1 1 1.00001 1.00001 1.00002 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 0.999998 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 0.999999 1 1 0.999999 1 0.999998 1 1 0.999997 1 1 0.999999 1 0.999999 1 1 0.999998 1 1 0.999998 0.999999 0.999999 1 0.999997 0.999999 1 0.999997 0.999996 1 1 0.999997 1 1.00001 1.00001 1.00001 1.00002 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 1 0.999998 1 1 0.999998 1 1 0.999999 1 0.999999 1 1 0.999999 0.999999 1 0.999999 0.999999 0.999999 1 0.999998 0.999997 1 0.999999 0.999997 1 1 0.999999 1 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 0.999998 1 1 0.999999 1 1 1 1 0.999999 1 1 1 0.999999 1 1 0.999999 0.999997 1 1 0.999996 1 1 0.999997 1 1 1 1 1.00001 1.00002 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 0.999998 1 0.999999 0.999999 1 1 1 1 0.999999 1 1 1 0.999999 0.999999 1 0.999999 0.999997 1 1 0.999997 0.999999 1 0.999999 0.999999 1 1.00001 1 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 0.999999 1 1 0.999998 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 0.999998 1 1 0.999997 0.999999 1 0.999999 0.999998 1 1 1 1 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999998 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 0.999999 1 1 1 0.999999 1 1 0.999999 1 1 0.999998 1 1 0.999998 0.999999 1 1 0.999999 1 1 1 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999998 1 1 0.999999 1 1 1 0.999999 1 0.999999 1 1 1 1 1 0.999999 1 0.999999 0.999999 1 1 0.999999 1 1 1 0.999999 1 1 0.999998 1 1 0.999998 0.999999 1 1 0.999998 1 1 1 1 1 1 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999998 1 1 0.999999 0.999998 1 1 0.999999 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 0.999998 1 1 1 1 1 1 1 1 1 1 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999998 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 0.999999 0.999999 1 1 0.999998 1 1 0.999999 1 1 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 0.999998 1 1 0.999998 1 1 0.999998 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 0.999999 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 0.999998 1 1 0.999998 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 1 0.999998 1 1 0.999998 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999998 1 1 0.999999 1 1 0.999999 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 0.999998 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 0.999998 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 0.999999 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 0.999999 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 0.999999 0.999998 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 1 1 1 1 0.999999 1 1 0.999999 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 0.999999 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 0.999999 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999999 0.999998 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999998 0.999998 0.999997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999999 0.999999 0.999999 0.999998 0.999997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999999 0.999999 0.999998 0.999997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 0.999999 0.999998 0.999997 0.999996 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999999 0.999998 0.999996 0.999995 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999998 0.999998 0.999996 0.999994 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999998 0.999997 0.999995 0.999994 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999999 0.999999 0.999997 0.999995 0.999992 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999998 0.999997 0.999995 0.999992 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999998 0.999996 0.999994 0.999991 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999997 0.999994 0.999992 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999998 0.999996 0.999993 ) ; boundaryField { emptyPatches_empt { type empty; } top_cyc { type cyclic; } bottom_cyc { type cyclic; } inlet_cyc { type cyclic; } outlet_cyc { type cyclic; } procBoundary0to1 { type processor; value nonuniform List<scalar> 75 ( 1.03589 1.03697 1.03774 1.03814 1.03811 1.03757 1.03651 1.0349 1.03276 1.03013 1.02713 1.02389 1.02058 1.01737 1.0144 1.01175 1.00947 1.00752 1.00591 1.00459 1.00352 1.00267 1.002 1.00148 1.00109 1.00079 1.00057 1.00041 1.00029 1.00021 1.00015 1.00011 1.00008 1.00006 1.00005 1.00004 1.00003 1.00002 1.00002 1.00002 1.00002 1.00001 1.00001 1.00001 1.00001 1 1.00001 1 1 1 1 1 1 1 1 1 0.999999 1 0.999998 1 0.999999 0.999998 0.999998 0.999997 0.999996 0.999995 0.999995 0.999993 0.999992 0.999991 0.999989 0.999989 0.999988 0.999989 0.999991 ) ; } procBoundary0to1throughinlet_cyc { type processorCyclic; value nonuniform List<scalar> 75 ( 1.00034 1.00031 1.00029 1.00026 1.00023 1.00021 1.00019 1.00017 1.00015 1.00013 1.00012 1.0001 1.00009 1.00008 1.00007 1.00006 1.00005 1.00004 1.00004 1.00003 1.00003 1.00002 1.00002 1.00002 1.00001 1.00001 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 ) ; } procBoundary0to2 { type processor; value nonuniform List<scalar> 75 ( 1.00026 1.00018 1.00013 1.00009 1.00007 1.00005 1.00003 1.00002 1.00002 1.00001 1.00001 1.00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 1 1 1 1 1 0.999999 1 0.999999 0.999999 0.999999 0.999999 0.999996 0.999995 0.999994 0.999987 0.999986 0.999977 0.999966 0.999957 0.999945 0.999929 0.999919 0.999917 0.999935 0.999984 1.0001 1.00032 1.00071 1.00135 1.00237 1.00394 1.00624 1.00951 1.01391 1.01943 1.02563 1.03154 1.03595 1.03801 1.03747 ) ; } procBoundary0to2throughbottom_cyc { type processorCyclic; value nonuniform List<scalar> 75 ( 0.999999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.999999 0.999998 0.999997 ) ; } } // ************************************************************************* //
[ "tdg@debian" ]
tdg@debian
3ec404490dd79aabc1c6ef6775a86245d3e2f953
a2a185bbeabe99022a6b60b5ae1f0c1d4a0d6b7d
/MCsim Integration with MacSim(v2.3.0)/src/process_manager.cc
e5da115ac1d0c15cb9ff59f3996dbde598ed0e10
[ "MIT" ]
permissive
FanosLab/MCsim
34b07e9d9b79da2498b5e42fe8ef25e7566d00d9
2a1670ba565cd9048a80384e22531cc97edbac8f
refs/heads/master
2023-01-01T01:54:06.870789
2020-10-22T15:23:10
2020-10-22T15:23:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
50,268
cc
/* Copyright (c) <2012>, <Georgia Institute of Technology> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the <Georgia Institue of Technology> 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /********************************************************************************************** * File : process_manager.cc * Author : Jaekyu Lee * Date : 1/6/2011 * SVN : $Id: main.cc,v 1.26 2008-09-21 00:02:54 kacear Exp $: * Description : process manager (creation, termination, scheduling, ...) * combine sim_process and sim_thread_schedule *********************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////////// /// \page process Process management /// /// In process, we manage each application as a process which consists of one or more /// threads (for multi-threaded CPU or GPU applications). /// /// \section process_core Core Partition /// /// \section process_queue Queues /// We maintain two separate queues for the simulation; thread queue and block queue. Thread /// queue has CPU traces and block queue has GPU traces. Especially, block queue consists of /// thread list. Each list in the block queue will have threads from the same thread block. /// \see process_manager_c::m_thread_queue /// \see process_manager_c::m_block_queue /// /// \section process_schedule Thread Scheduling /// When a core becomes available, based on the core type, it pulls out a thread from /// the corresponding queue. Each core has maximum number of threads that can run concurrently. /// /// \section process_storage Storage Management /// Since each thread requires its own data structure and GPU simulation will have huge number /// of threads, GPU simulation will require huge memory consumption. However, since there are /// limited number of threads at a certain time, we just need to maintain data structure for /// those active threads. In each thread/block queue, it will have dummy thread structures. /// When a thread is actually scheduled to the core, its data structure will be allocated. /// /// \todo We need to carefully handle core allocation process. multiple x86s, multi-threaded.. /////////////////////////////////////////////////////////////////////////////////////////////// #include <iostream> #include <fstream> #include <cstring> #include <sstream> #include "assert_macros.h" #include "knob.h" #include "core.h" #include "utils.h" #include "statistics.h" #include "frontend.h" #include "process_manager.h" #include "pref_common.h" #include "trace_read.h" #include "debug_macros.h" #include "all_knobs.h" /////////////////////////////////////////////////////////////////////////////////////////////// #define BLOCK_ID_SHIFT 16 #define THREAD_ID_MASK 0xFFF #define BLOCK_ID_MOD 16384 #define t_gen_ver "1.3" #define DEBUG(args...) \ _DEBUG(*m_simBase->m_knobs->KNOB_DEBUG_SIM_THREAD_SCHEDULE, ##args) /////////////////////////////////////////////////////////////////////////////////////////////// // thread_stat_s constructor thread_stat_s::thread_stat_s() { m_thread_id = 0; m_unique_thread_id = 0; m_block_id = 0; m_thread_sched_cycle = 0; m_thread_fetch_cycle = 0; m_thread_end_cycle = 0; } //////////////////////////////////////////////////////////////////////////////// // process_manager_c() - constructor // m_thread_queue - contains the list of unassigned threads (from all // applications) that are ready to be launched // m_block_queue - contains the list of unassigned blocks (from all // applications) that are ready to be launched //////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // process_s() - constructor //////////////////////////////////////////////////////////////////////////////// process_s::process_s() { m_process_id = 0; m_orig_pid = 0; m_max_block = 0; m_thread_start_info = NULL; m_thread_trace_info = NULL; m_no_of_threads = 0; m_no_of_threads_created = 0; m_no_of_threads_terminated = 0; m_core_pool = NULL; m_ptx = false; m_repeat = 0; m_current_file_name_base = ""; m_kernel_config_name = ""; m_current_vector_index = 0; m_inst_count_tot = 0; m_block_count = 0; } //////////////////////////////////////////////////////////////////////////////// // process_s() - constructor //////////////////////////////////////////////////////////////////////////////// process_s::~process_s() { } //////////////////////////////////////////////////////////////////////////////// // thread_s() - constructor //////////////////////////////////////////////////////////////////////////////// thread_s::thread_s(macsim_c *simBase) { m_simBase = simBase; m_fetch_data = new frontend_s; int buf_ele_size = (CPU_TRACE_SIZE > GPU_TRACE_SIZE) ? CPU_TRACE_SIZE : GPU_TRACE_SIZE; m_buffer = new char[1000 * buf_ele_size]; m_prev_trace_info = NULL; m_next_trace_info = NULL; for (int ii = 0; ii < MAX_PUP; ++ii) { m_trace_uop_array[ii] = new trace_uop_s; if (static_cast<string>(*m_simBase->m_knobs->KNOB_FETCH_POLICY) == "row_hit") { m_next_trace_uop_array[ii] = new trace_uop_s; } } } //////////////////////////////////////////////////////////////////////////////// // thread_s() - destructor //////////////////////////////////////////////////////////////////////////////// thread_s::~thread_s() { #if 0 delete m_fetch_data; delete[] m_buffer; delete m_prev_trace_info; delete m_next_trace_info; for (int ii = 0; ii < MAX_PUP; ++ii) { delete m_trace_uop_array[ii]; if (static_cast<string>(*m_simBase->m_knobs->KNOB_FETCH_POLICY) == "row_hit") { delete m_next_trace_uop_array[ii]; } } #endif } //////////////////////////////////////////////////////////////////////////////// // block_schedule_info_s() - constructor //////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// // block_schedule_info_s constructor block_schedule_info_s::block_schedule_info_s() { m_start_to_fetch = false; m_dispatched_core_id = -1; m_retired = false; m_dispatched_thread_num = 0; m_retired_thread_num = 0; m_dispatch_done = false; m_trace_exist = false; m_total_thread_num = 0; } block_schedule_info_s::~block_schedule_info_s() { } /////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // process_manager_c() - constructor // m_thread_queue - contains the list of unassigned threads (from all // applications) that are ready to be launched // m_block_queue - contains the list of unassigned blocks (from all // applications) that are ready to be launched //////////////////////////////////////////////////////////////////////////////// process_manager_c::process_manager_c(macsim_c *simBase) { // base simulation reference m_simBase = simBase; // allocate queues m_thread_queue = new list<thread_trace_info_node_s *>; m_block_queue = new unordered_map<int, list<thread_trace_info_node_s *> *>; m_inst_hash_pool = new pool_c<hash_c<inst_info_s> >(1, "inst_hash_pool"); } //////////////////////////////////////////////////////////////////////////////// // process_manager_c() - destructor //////////////////////////////////////////////////////////////////////////////// process_manager_c::~process_manager_c() { // deallocate thread queue m_thread_queue->clear(); delete m_thread_queue; // deallocate block queue m_block_queue->clear(); delete m_block_queue; // delete m_inst_hash_pool; } //////////////////////////////////////////////////////////////////////////////// // process_manager_c::create_thread_node() // called for each thread/warp when it becomes ready to be launched (started); // allocates a node for the thread/warp and add its to m_thread_queue (for x86) // or m_block_queue (for ptx) //////////////////////////////////////////////////////////////////////////////// void process_manager_c::create_thread_node(process_s *process, int tid, bool main) { // create a new thread node thread_trace_info_node_s *node = m_simBase->m_trace_node_pool->acquire_entry(); // initialize the node node->m_trace_info_ptr = NULL; node->m_process = process; node->m_tid = tid; node->m_main = main; node->m_ptx = process->m_ptx; // create a new thread start information thread_start_info_s *start_info = &(process->m_thread_start_info[tid]); // TODO (jaekyu, 8-2-2010) // check block id assignment policy // block id assignment in case of multiple applications int block_id = start_info->m_thread_id >> BLOCK_ID_SHIFT; node->m_block_id = m_simBase->m_block_id_mapper->find( process->m_process_id, block_id + process->m_kernel_block_start_count[process->m_current_vector_index - 1]); // new block has been executed. if (node->m_block_id == -1) { node->m_block_id = m_simBase->m_block_id_mapper->insert( process->m_process_id, block_id + process ->m_kernel_block_start_count[process->m_current_vector_index - 1]); // increase total block count ++process->m_block_count; } // update process block list process->m_block_list[node->m_block_id] = true; // add a new node to m_thread_queue (for x86) or m_block_queue (for ptx) if (process->m_ptx == true) insert_block(node); else insert_thread(node); // increase number of active threads ++m_simBase->m_num_active_threads; } //////////////////////////////////////////////////////////////////////////////// // process_manager_c::create_thread_node() // creates a process and opens the trace for the main thread of the process //////////////////////////////////////////////////////////////////////////////// int process_manager_c::create_process(string appl) { return create_process(appl, 0, 0); } // Creates a process and opens the trace for the main thread of the process int process_manager_c::create_process(string appl, int repeat, int pid) { /// /// Create a process and setup id and other fields /// // create a new process process_s *process = new process_s; // create new instruction hash table to reduce cost of decoding trace instructions string name; stringstream sstr; sstr << "inst_info_" << m_simBase->m_process_count; sstr >> name; hash_c<inst_info_s> *new_inst_hash = m_inst_hash_pool->acquire_entry(); m_simBase->m_inst_info_hash[m_simBase->m_process_count] = new_inst_hash; // process data structure setup process->m_repeat = repeat; process->m_process_id = m_simBase->m_process_count++; process->m_kernel_config_name = appl; // keep original process id in case of the repeated application if (repeat == 0) { ++m_simBase->m_process_count_without_repeat; process->m_orig_pid = process->m_process_id; } else { process->m_orig_pid = pid; } m_simBase->m_sim_processes[process->m_orig_pid] = process; /// /// Get configurations from the file /// // Setup file name of process trace size_t dot_location = appl.find_last_of("."); if (dot_location == string::npos) ASSERTM(0, "file(%s) formats should be <appl_name>.<extn>\n", appl.c_str()); // open trace configuration file ifstream trace_config_file; trace_config_file.open(appl.c_str(), ifstream::in); // open trace configuration file if (trace_config_file.fail()) { STAT_EVENT(FILE_OPEN_ERROR); ASSERTM(0, "filename:%s cannot be opened\n", appl.c_str()); } // Read the first line of trace configuration file // TYPE string trace_type; if (!(trace_config_file >> trace_type)) ASSERTM(0, "error reading from file:%s", appl.c_str()); int trace_ver = -1; if (trace_type != "x86" && trace_type != "a64" && trace_type != "igpu") { if (!(trace_config_file >> trace_ver) || trace_ver != 14) { ASSERTM(0, "this version of the simulator supports only version 1.4 of the " "GPU traces\n"); } } int thread_count; if (!(trace_config_file >> thread_count)) { ASSERTM(0, "error reading from file:%s", appl.c_str()); } // To support new trace version : each kernel has own configuration and some applications // may have multiple kernels if (thread_count == -1) { string kernel_directory; while (trace_config_file >> kernel_directory) { string kernel_path = appl.substr(0, appl.find_last_of('/')); kernel_path += kernel_directory.substr( kernel_directory.rfind('/', kernel_directory.find_last_of('/') - 1), kernel_directory.length()); // When a trace directory is moved to the different path, // since everything is coded in absolute path, this will cause problem. // By taking relative path here, the problem can be solved process->m_applications.push_back(kernel_path); // process->m_applications.push_back(kernel_directory); process->m_kernel_block_start_count.push_back(0); } } else { process->m_applications.push_back(appl); process->m_kernel_block_start_count.push_back(0); } trace_config_file.close(); // setup core pool if (trace_type == "ptx" || trace_type == "newptx") { process->m_ptx = true; process->m_core_pool = &m_simBase->m_ptx_core_pool; // most basic check to ensure that offsets of members in structure that we // use for reading traces (which contains one extra field compared to the // structure used when generating traces) match with the structure used when // generating traces if (*KNOB(KNOB_TRACE_USES_64_BIT_ADDR)) { assert(sizeof(trace_info_gpu_s) == (sizeof(trace_info_gpu_small_s) + sizeof(uint64_t))); } else { assert(sizeof(trace_info_gpu_s) == (sizeof(trace_info_gpu_small_s) + sizeof(uint32_t))); } } else { process->m_ptx = false; process->m_core_pool = &m_simBase->m_x86_core_pool; } // now we set up a new process to execute it setup_process(process); return 0; } // setup a process to run. Each process has vector which holds all sub-applications. // (GPU with multiple kernel calls). void process_manager_c::setup_process(process_s *process) { report( "setup_process:" << process->m_orig_pid << " " << process->m_applications[process->m_current_vector_index] << " current_index:" << process->m_current_vector_index << " (" << process->m_applications.size() << ")"); ASSERT(process->m_current_vector_index < process->m_applications.size()); // Each block within an application (across multiple kernels) has unique id process->m_kernel_block_start_count[process->m_current_vector_index] = process->m_block_count; // trace file name string trace_info_file_name = process->m_applications[process->m_current_vector_index++]; size_t dot_location = trace_info_file_name.find_last_of("."); if (dot_location == string::npos) ASSERTM(0, "file(%s) formats should be <appl_name>.<extn>\n", trace_info_file_name.c_str()); // get the base name of current application (without extension) process->m_current_file_name_base = trace_info_file_name.substr(0, dot_location); // get hmc info if hmc inst is enabled if (*KNOB(KNOB_ENABLE_HMC_INST) || *KNOB(KNOB_ENABLE_NONHMC_STAT) || *KNOB(KNOB_ENABLE_HMC_TRANS) || *KNOB(KNOB_ENABLE_HMC_INST_SKIP)) hmc_function_c::hmc_info_read(process->m_current_file_name_base, process->m_hmc_info, process->m_hmc_info_ext); if (*KNOB(KNOB_ENABLE_HMC_FENCE)) hmc_function_c::hmc_fence_info_read(process->m_current_file_name_base, process->m_hmc_fence_info); if (*KNOB(KNOB_ENABLE_LOCK_SKIP)) hmc_function_c::lock_info_read(process->m_current_file_name_base, process->m_lock_info); // open TRACE_CONFIG file ifstream trace_config_file; trace_config_file.open(trace_info_file_name.c_str(), ifstream::in); if (trace_config_file.fail()) { STAT_EVENT(FILE_OPEN_ERROR); ASSERTM(0, "trace_config_file:%s\n", trace_info_file_name.c_str()); } // ------------------------------------------- // TRACE_CONFIG Format // ------------------------------------------- // Trace version // #Threads | Trace Type | (Optional Fields) // 1st Thread ID | #Instructions // 2nd Thread ID | #Instructions // .... // nth Thread ID | #Instructions // read the first line of TRACE_CONFIG file // X86 Traces : (#Threads | x86) // GPU Traces (OLD) : (#Warps | ptx) // GPU Traces (NEW) : (#Warps | newptx | #MaxBlocks per Core) string trace_type; if (!(trace_config_file >> trace_type)) ASSERTM(0, "error reading from file:%s", trace_info_file_name.c_str()); printf("trace:%s is opened \n", trace_info_file_name.c_str()); int trace_ver = -1; if (trace_type != "x86" && trace_type != "a64" && trace_type != "igpu") { if (!(trace_config_file >> trace_ver) || trace_ver != 14) { ASSERTM(0, "this version of the simulator supports only version 1.4 of the " "GPU traces\n"); } } // get occupancy if (trace_type == "ptx") { process->m_max_block = *m_simBase->m_knobs->KNOB_MAX_BLOCK_PER_CORE; } if (trace_type == "newptx") { if (!(trace_config_file >> process->m_max_block)) ASSERTM(0, "error reading from file:%s", trace_info_file_name.c_str()); trace_type = "ptx"; if (*m_simBase->m_knobs->KNOB_MAX_BLOCK_PER_CORE_SUPER > 0) { process->m_max_block = *m_simBase->m_knobs->KNOB_MAX_BLOCK_PER_CORE_SUPER; } } if (trace_type == "x86") { std::string gen_version; trace_config_file >> gen_version; if (gen_version != t_gen_ver) std::cout << "!!WARNING!! Trace reader and trace generator version " "mismatch; trace may not be read correctly." << std::endl; } // get thread count int thread_count; if (!(trace_config_file >> thread_count)) ASSERTM(0, "error reading from file:%s", trace_info_file_name.c_str()); // # thread_count > 0 if (thread_count <= 0) ASSERTM(0, "invalid thread count:%d", thread_count); if (*KNOB(KNOB_ENABLE_TRACE_MAX_THREAD)) { if (thread_count > *KNOB(KNOB_TRACE_MAX_THREAD_COUNT)) thread_count = *KNOB(KNOB_TRACE_MAX_THREAD_COUNT); } report("thread_count:" << thread_count); // create data structures thread_stat_s *new_stat = new thread_stat_s[thread_count]; m_simBase->m_thread_stats[process->m_process_id] = new_stat; m_simBase->m_all_threads += thread_count; process->m_no_of_threads = thread_count; process->m_thread_start_info = new thread_start_info_s[thread_count]; process->m_thread_trace_info = new thread_s *[thread_count]; if (process->m_thread_start_info == NULL || process->m_thread_trace_info == NULL) { ASSERTM(0, "unable to allocate memory\n"); } // read each thread's information (thread id, # of starting instruction (spawn)) // This should start to read the first field of the second line in TRACE_CONFIG. for (int ii = 0; ii < thread_count; ++ii) { if (!(trace_config_file >> process->m_thread_start_info[ii].m_thread_id >> process->m_thread_start_info[ii].m_inst_count)) { ASSERTM(0, "error reading from file:%s ii:%d\n", trace_info_file_name.c_str(), ii); } } // close TRACE_CONFIG file trace_config_file.close(); // GPU simulation if (true == process->m_ptx) { string path = process->m_current_file_name_base; path += "_info.txt"; // read trace information file ifstream trace_lengths_file(path.c_str()); if (!trace_lengths_file.good()) ASSERTM(0, "could not open file: %s\n", path.c_str()); // FIXME Counter inst_count_tot = 0; Counter inst_count; Counter thread_id; for (int ii = 0; ii < thread_count; ++ii) { trace_lengths_file >> thread_id >> inst_count; inst_count_tot += inst_count; } trace_lengths_file.close(); process->m_inst_count_tot = inst_count_tot; // FIXME // TODO (jaekyu, 1-30-2009) // fix this // Calculate the number of threads (warps) per block // Currently, (n * 65536) is assigned to the first global warp ID for the nth block. m_simBase->m_no_threads_per_block = 0; for (int ii = 0; ii < thread_count; ++ii) { if (process->m_thread_start_info[ii].m_thread_id < 100) ++m_simBase->m_no_threads_per_block; else break; } queue<int> *core_pool = process->m_core_pool; // Allocate cores to this application (bi-directonal) // get maximum allowed if (*m_simBase->m_knobs->KNOB_MAX_NUM_CORE_PER_APPL == 0) { while (!core_pool->empty()) { int core_id = core_pool->front(); core_pool->pop(); process->m_core_list[core_id] = true; m_simBase->m_core_pointers[core_id]->init(); m_simBase->m_core_pointers[core_id]->add_application(0, process); } } // get limited (*m_simBase->m_knobs->KNOB_MAX_NUM_CORE_PER_APPL) number of cores else { int count = 0; while (!core_pool->empty() && count < *m_simBase->m_knobs->KNOB_MAX_NUM_CORE_PER_APPL) { int core_id = core_pool->front(); core_pool->pop(); process->m_core_list[core_id] = true; m_simBase->m_core_pointers[core_id]->init(); m_simBase->m_core_pointers[core_id]->add_application(0, process); ++count; } } } // TODO (jaekyu, 1-30-2009) // FIXME if (trace_type == "ptx" && *KNOB(KNOB_BLOCKS_TO_SIMULATE)) { if ((*KNOB(KNOB_BLOCKS_TO_SIMULATE) * m_simBase->m_no_threads_per_block) < static_cast<unsigned int>(thread_count)) { uns temp = thread_count; thread_count = *KNOB(KNOB_BLOCKS_TO_SIMULATE) * m_simBase->m_no_threads_per_block; // print the thread count of the application at the beginning REPORT("new thread count %d\n", thread_count); process->m_no_of_threads = thread_count; // assign thread_count to the number of threads of the process m_simBase->m_all_threads += thread_count; if (*KNOB(KNOB_SIMULATE_LAST_BLOCKS)) { for (int i = 0; i < thread_count; ++i) { process->m_thread_start_info[i].m_thread_id = process->m_thread_start_info[temp - thread_count + i].m_thread_id; process->m_thread_start_info[i].m_inst_count = process->m_thread_start_info[temp - thread_count + i].m_inst_count; } } } } // Initialize stats (this will be used to determine process termination process->m_no_of_threads_created = 1; process->m_no_of_threads_terminated = 0; // Insert the main thread to the pool create_thread_node(process, 0, true); if (process->m_ptx) { for (int tid = 1; tid < thread_count; ++tid) { if (process->m_thread_start_info[tid].m_inst_count == 0) { create_thread_node(process, process->m_no_of_threads_created++, false); } else { break; } } } } // terminate a process bool process_manager_c::terminate_process(process_s *process) { delete[] process->m_thread_start_info; delete[] process->m_thread_trace_info; process->m_block_list.clear(); // TODO (jaekyu, 2-3-2010) // We may need to change this using pool_c m_simBase->m_inst_info_hash[process->m_process_id]->clear(); // deallocate data structures thread_stat_s *thread_stat_data_to_delete = m_simBase->m_thread_stats[process->m_process_id]; m_simBase->m_thread_stats.erase(process->m_process_id); delete[] thread_stat_data_to_delete; // Since there are more kernels within an application, we need to finish these // before terminate this application if (process->m_current_vector_index < process->m_applications.size() && (*m_simBase->m_ProcessorStats)[INST_COUNT_TOT].getCount() < *KNOB(KNOB_MAX_INSTS1)) { setup_process(process); return false; } m_simBase->m_block_id_mapper->delete_table(process->m_process_id); // release allocated cores for (auto I = process->m_core_list.begin(), E = process->m_core_list.end(); I != E; ++I) { int core_id = (*I).first; process->m_core_pool->push(core_id); m_simBase->m_core_pointers[core_id]->delete_application( process->m_process_id); } process->m_core_list.clear(); hash_c<inst_info_s> *inst_info_hash = m_simBase->m_inst_info_hash[process->m_process_id]; m_simBase->m_inst_info_hash.erase(process->m_process_id); inst_info_hash->clear(); m_inst_hash_pool->release_entry(inst_info_hash); stringstream sstr; string ext; sstr << "." << process->m_process_id; sstr >> ext; int delta; if (m_appl_cyccount_info.find(process->m_orig_pid) == m_appl_cyccount_info.end()) { delta = static_cast<int>(CYCLE); } else { delta = static_cast<int>(CYCLE - m_appl_cyccount_info[process->m_orig_pid]); } m_appl_cyccount_info[process->m_orig_pid] = CYCLE; STAT_EVENT_N(APPL_CYC_COUNT0 + process->m_orig_pid, delta); STAT_EVENT(APPL_CYC_COUNT_BASE0 + process->m_orig_pid); // FIXME (jaekyu, 4-2-2010) // need to handle repeat_trace_n > 0 cases if (process->m_repeat == 0) { m_simBase->m_ProcessorStats->saveStats(ext); } return true; } // try to give a unique thread id // counter to assign unique thread_ids to threads/warps static int global_unique_thread_id = 0; // create a new thread (actually, a thread has been created when create_thread_node() // has been called. However, when a thread is actually scheduled, we allocate and initialize // data in a thread. thread_s *process_manager_c::create_thread(process_s *process, int tid, bool main) { thread_s *trace_info = m_simBase->m_thread_pool->acquire_entry(m_simBase); process->m_thread_trace_info[tid] = trace_info; // TODO - nbl (apr-17-2013): use pools if (process->m_ptx) { trace_info->m_prev_trace_info = new trace_info_gpu_s; trace_info->m_next_trace_info = new trace_info_gpu_s; } else { if (KNOB(KNOB_LARGE_CORE_TYPE)->getValue() == "x86") { trace_info->m_prev_trace_info = new trace_info_cpu_s; trace_info->m_next_trace_info = new trace_info_cpu_s; } else if (KNOB(KNOB_LARGE_CORE_TYPE)->getValue() == "a64") { trace_info->m_prev_trace_info = new trace_info_a64_s; trace_info->m_next_trace_info = new trace_info_a64_s; } else if (KNOB(KNOB_LARGE_CORE_TYPE)->getValue() == "igpu") { trace_info->m_prev_trace_info = new trace_info_igpu_s; trace_info->m_next_trace_info = new trace_info_igpu_s; } else { ASSERTM(0, "Wrong core type %s\n", KNOB(KNOB_LARGE_CORE_TYPE)->getValue().c_str()); } } thread_start_info_s *start_info = &process->m_thread_start_info[tid]; int block_id = start_info->m_thread_id >> BLOCK_ID_SHIFT; // original block id trace_info->m_orig_block_id = block_id; trace_info->m_block_id = m_simBase->m_block_id_mapper->find( process->m_process_id, block_id + process->m_kernel_block_start_count[process->m_current_vector_index - 1]); // FIXME // trace_info->m_orig_thread_id = start_info->m_thread_id; // trace_info->m_unique_thread_id = global_unique_thread_id++; trace_info->m_unique_thread_id = (start_info->m_thread_id) % BLOCK_ID_MOD; trace_info->m_orig_thread_id = global_unique_thread_id++; // set up trace file name stringstream sstr; sstr << process->m_current_file_name_base << "_" << start_info->m_thread_id << ".raw"; string filename = ""; sstr >> filename; #ifndef USING_QSIM // open trace file trace_info->m_trace_file = gzopen(filename.c_str(), "r"); if (trace_info->m_trace_file == NULL) ASSERTM(0, "error opening trace file:%s\n", filename.c_str()); #endif trace_info->m_file_opened = true; trace_info->m_trace_ended = false; trace_info->m_ptx = process->m_ptx; trace_info->m_buffer_index = 0; trace_info->m_buffer_index_max = 0; trace_info->m_buffer_exhausted = true; trace_info->m_inst_count = 0; trace_info->m_uop_count = 0; trace_info->m_process = process; trace_info->m_main_thread = main; trace_info->m_temp_inst_count = 0; trace_info->m_temp_uop_count = 0; trace_info->m_thread_init = true; trace_info->m_num_sending_uop = 0; trace_info->m_bom = true; trace_info->m_eom = true; trace_info->m_fetch_data->init(); // changed by Lifeng trace_info->has_cached_inst = false; trace_info->m_inside_hmc_func = false; trace_info->m_prev_hmc_type = HMC_NONE; trace_info->m_next_hmc_type = HMC_NONE; trace_info->m_prev_hmc_trans_id = 0; trace_info->m_next_hmc_trans_id = 0; trace_info->m_cur_hmc_trans_cnt = 0; return trace_info; } // terminate a thread int process_manager_c::terminate_thread(int core_id, thread_s *trace_info, int thread_id, int b_id) { core_c *core = m_simBase->m_core_pointers[core_id]; ASSERT(core->m_running_thread_num); // final heartbeat for the thread core->final_heartbeat(thread_id); int block_id = trace_info->m_block_id; --core->m_running_thread_num; // All threads have been terminated in a core. Mark core as ended. if (core->m_running_thread_num == 0) m_simBase->m_core_end_trace[core_id] = true; // Mark thread terminated core->m_thread_finished[thread_id] = 1; // deallocate data structures core->deallocate_thread_data(thread_id); DEBUG( "core_id:%d terminated block: %d thread - %d running_thread_num:%d " "block_id:%d \n", core_id, trace_info->m_block_id, trace_info->m_thread_id, core->m_running_thread_num, b_id); // update number of terminated thread for an application ++trace_info->m_process->m_no_of_threads_terminated; // decrement number of active threads --m_simBase->m_num_active_threads; // GPU simulation if (trace_info->m_ptx == true) { int t_process_id = trace_info->m_process->m_process_id; int t_thread_id = trace_info->m_unique_thread_id; m_simBase->m_thread_stats[t_process_id][t_thread_id].m_thread_end_cycle = core->get_cycle_count(); block_schedule_info_s *block_info = m_simBase->m_block_schedule_info[block_id]; ++block_info->m_retired_thread_num; DEBUG( "core_id:%d block_id:%d block_retired_thread_num:%d " "block_total_thread_num:%d " "running_block_num:%d\n", core_id, block_id, block_info->m_retired_thread_num, block_info->m_total_thread_num, core->m_running_block_num); // BLOCK RETIRE : all threads in a block have been retired, so the block is retired now if (block_info->m_retired_thread_num == block_info->m_total_thread_num) { block_info->m_retired = true; --core->m_running_block_num; // deallocate block information block_schedule_info_s *block_schedule_info = m_simBase->m_block_schedule_info[block_id]; m_simBase->m_block_schedule_info.erase(block_id); delete block_schedule_info; trace_info->m_process->m_block_list.erase(block_id); list<thread_trace_info_node_s *> *block_queue = (*m_block_queue)[block_id]; m_block_queue->erase(block_id); block_queue->clear(); delete block_queue; // stats STAT_EVENT_N(AVG_BLOCK_EXE_CYCLE, CYCLE - block_info->m_sched_cycle); STAT_EVENT(AVG_BLOCK_EXE_CYCLE_BASE); ++m_simBase->m_total_retired_block; if (*m_simBase->m_knobs->KNOB_MAX_BLOCKS_TO_SIMULATE > 0 && m_simBase->m_total_retired_block >= *m_simBase->m_knobs->KNOB_MAX_BLOCKS_TO_SIMULATE) { m_simBase->m_end_simulation = true; } } // FIXME TONAGESH // delete all synchronization information section_info_s *info; while (trace_info->m_sections.size() > 0) { info = trace_info->m_sections.front(); trace_info->m_sections.pop_front(); m_simBase->m_section_pool->release_entry(info); } while (trace_info->m_bar_sections.size() > 0) { info = trace_info->m_bar_sections.front(); trace_info->m_bar_sections.pop_front(); m_simBase->m_section_pool->release_entry(info); } while (trace_info->m_mem_sections.size() > 0) { info = trace_info->m_mem_sections.front(); trace_info->m_mem_sections.pop_front(); m_simBase->m_section_pool->release_entry(info); } while (trace_info->m_mem_bar_sections.size() > 0) { info = trace_info->m_mem_bar_sections.front(); trace_info->m_mem_bar_sections.pop_front(); m_simBase->m_section_pool->release_entry(info); } while (trace_info->m_mem_for_bar_sections.size() > 0) { info = trace_info->m_mem_for_bar_sections.front(); trace_info->m_mem_for_bar_sections.pop_front(); m_simBase->m_section_pool->release_entry(info); } ASSERT(core->m_running_block_num >= 0); } // TODO - nbl (apr-17-2013): use pools if (trace_info->m_process->m_ptx) { trace_info_gpu_s *temp = static_cast<trace_info_gpu_s *>(trace_info->m_prev_trace_info); delete temp; temp = static_cast<trace_info_gpu_s *>(trace_info->m_next_trace_info); delete temp; } else { if (KNOB(KNOB_LARGE_CORE_TYPE)->getValue() == "x86") { trace_info_cpu_s *temp = static_cast<trace_info_cpu_s *>(trace_info->m_prev_trace_info); delete temp; temp = static_cast<trace_info_cpu_s *>(trace_info->m_next_trace_info); delete temp; } else if (KNOB(KNOB_LARGE_CORE_TYPE)->getValue() == "a64") { trace_info_a64_s *temp = static_cast<trace_info_a64_s *>(trace_info->m_prev_trace_info); delete temp; temp = static_cast<trace_info_a64_s *>(trace_info->m_next_trace_info); delete temp; } else if (KNOB(KNOB_LARGE_CORE_TYPE)->getValue() == "igpu") { trace_info_igpu_s *temp = static_cast<trace_info_igpu_s *>(trace_info->m_prev_trace_info); delete temp; temp = static_cast<trace_info_igpu_s *>(trace_info->m_next_trace_info); delete temp; } else { ASSERTM(0, "Wrong core type %s\n", KNOB(KNOB_LARGE_CORE_TYPE)->getValue().c_str()); } } gzclose(trace_info->m_trace_file); // release thread_trace_info to the pool m_simBase->m_thread_pool->release_entry(trace_info); // if there are remaining threads, schedule it if (m_simBase->m_num_waiting_dispatched_threads) sim_thread_schedule(false); return 0; } // insert a new thread void process_manager_c::insert_thread(thread_trace_info_node_s *incoming) { ++m_simBase->m_num_waiting_dispatched_threads; m_thread_queue->push_back(incoming); } // insert a new thread block void process_manager_c::insert_block(thread_trace_info_node_s *incoming) { ++m_simBase->m_num_waiting_dispatched_threads; int block_id = incoming->m_block_id; if (m_simBase->m_block_schedule_info.find(block_id) == m_simBase->m_block_schedule_info.end()) { block_schedule_info_s *block_schedule_info = new block_schedule_info_s; m_simBase->m_block_schedule_info[block_id] = block_schedule_info; } ++m_simBase->m_block_schedule_info[block_id]->m_total_thread_num; m_simBase->m_block_schedule_info[block_id]->m_trace_exist = true; DEBUG("block_schedule_info[%d].trace_exist:%d\n", block_id, m_simBase->m_block_schedule_info[block_id]->m_trace_exist); if (m_block_queue->find(block_id) == m_block_queue->end()) { list<thread_trace_info_node_s *> *new_list = new list<thread_trace_info_node_s *>; (*m_block_queue)[block_id] = new_list; } (*m_block_queue)[block_id]->push_back(incoming); } // fetch a new thread thread_trace_info_node_s *process_manager_c::fetch_thread(void) { if (m_thread_queue->empty()) { return NULL; } ASSERT(m_simBase->m_num_waiting_dispatched_threads > 0); --m_simBase->m_num_waiting_dispatched_threads; thread_trace_info_node_s *front = m_thread_queue->front(); m_thread_queue->pop_front(); return front; } // get a thread from a block // fetch_block is a misnomer - it actually fetches a warp from the specified block thread_trace_info_node_s *process_manager_c::fetch_block(int block_id) { list<thread_trace_info_node_s *> *block_list = (*m_block_queue)[block_id]; if (block_list->empty()) { return NULL; } ASSERT(m_simBase->m_num_waiting_dispatched_threads > 0); --m_simBase->m_num_waiting_dispatched_threads; thread_trace_info_node_s *front = block_list->front(); block_list->pop_front(); return front; } int process_manager_c::get_next_low_occupancy_core(std::string core_type) { int least_occupied_core = -1; int min_occupancy = INT_MAX; for (int core_id = 0; core_id < *KNOB(KNOB_NUM_SIM_CORES); ++core_id) { core_c *core = m_simBase->m_core_pointers[core_id]; if (*KNOB(KNOB_ROUTER_PLACEMENT) == 1 && core->get_core_type() != "ptx" && (core_id < *KNOB(KNOB_CORE_ENABLE_BEGIN) || *KNOB(KNOB_CORE_ENABLE_END) < core_id)) continue; if ((core->m_running_thread_num < core->get_max_threads_per_core()) && (core->m_running_thread_num < min_occupancy) && core->get_core_type() == core_type) { least_occupied_core = core_id; min_occupancy = core->m_running_thread_num; } } return least_occupied_core; } int process_manager_c::get_next_available_core(std::string core_type) { int result = -1; for (int core_id = 0; core_id < *KNOB(KNOB_NUM_SIM_CORES); ++core_id) { core_c *core = m_simBase->m_core_pointers[core_id]; if (*KNOB(KNOB_ROUTER_PLACEMENT) == 1 && core->get_core_type() != "ptx" && (core_id < *KNOB(KNOB_CORE_ENABLE_BEGIN) || *KNOB(KNOB_CORE_ENABLE_END) < core_id)) continue; if (core->m_running_thread_num < core->get_max_threads_per_core() && core->get_core_type() == core_type) { result = core_id; break; } } return result; } // schedule a thread // assigns a new thread/block to a core if the number of live threads/blocks // on the core are fewer than the maximum allowed // Order can be greedy or balanced void process_manager_c::sim_thread_schedule(bool initial) { std::string sched = KNOB(KNOB_CORE_THREAD_SCHED)->getValue(); int (process_manager_c::*get_next_core)(std::string core_type); if (sched == "greedy") get_next_core = &process_manager_c::get_next_available_core; else if (sched == "balanced") get_next_core = &process_manager_c::get_next_low_occupancy_core; else { fprintf(m_simBase->g_mystderr, "ERROR: Invalid value '%s' for KNOB_CORE_THREAD_SCHED\n" "Valid values are 'greedy' and 'balanced'\n", sched.c_str()); exit(1); } // Split the total cores into types // For each core type, we follow the core_thread_sched knob // We do this only for non-ptx cores. // ptx continues to do whatever it was doing earlier // -pgera 03-20-2017 std::set<std::string> core_type_set; for (int core_id = 0; core_id < *KNOB(KNOB_NUM_SIM_CORES); ++core_id) { core_c *core = m_simBase->m_core_pointers[core_id]; core_type_set.insert(core->get_core_type()); } // Iterate over core types for (std::set<std::string>::const_iterator itr = core_type_set.begin(); itr != core_type_set.end(); itr++) { std::string core_type = *itr; if (core_type == "ptx") continue; // Get a core of this type // Follow the knob policy (greedy or balanced) int core_id = (this->*get_next_core)(core_type); // Keep getting cores while there is work to be done while (core_id >= 0) { thread_trace_info_node_s *trace_to_run; core_c *core = m_simBase->m_core_pointers[core_id]; // fetch a new thread trace_to_run = fetch_thread(); if (trace_to_run != NULL) { // create a new thread trace_to_run->m_trace_info_ptr = create_thread( trace_to_run->m_process, trace_to_run->m_tid, trace_to_run->m_main); // unique thread num of a core int unique_scheduled_thread_num = core->m_unique_scheduled_thread_num; trace_to_run->m_trace_info_ptr->m_thread_id = unique_scheduled_thread_num; // add a new application to the core core->add_application(unique_scheduled_thread_num, trace_to_run->m_process); // add a new thread trace information core->create_trace_info(unique_scheduled_thread_num, trace_to_run->m_trace_info_ptr); thread_s *m_trace_info_ptr = trace_to_run->m_trace_info_ptr; int m_thread_id = m_trace_info_ptr->m_thread_id; int m_unique_thread_id = m_trace_info_ptr->m_unique_thread_id; DEBUG("schedule: core %d will run thread id %d unique_thread_id:%d\n", core_id, m_thread_id, m_unique_thread_id); // set flag for the simulation m_simBase->m_core_end_trace[core_id] = false; m_simBase->m_sim_end[core_id] = false; m_simBase->m_core_started[core_id] = true; // release the node entry m_simBase->m_trace_node_pool->release_entry(trace_to_run); } else { // Done with this core_type // Get out of this loop break; } // Get the next core of this type core_id = (this->*get_next_core)(core_type); } // End of work for this core type } // End of work for all non-ptx core types // NVIDIA GPU for (int core_id = 0; core_id < *KNOB(KNOB_NUM_SIM_CORES); ++core_id) { thread_trace_info_node_s *trace_to_run; core_c *core = m_simBase->m_core_pointers[core_id]; std::string core_type = core->get_core_type(); if (core_type != "ptx") continue; // get currently fetching id int prev_fetching_block_id = core->m_fetching_block_id; // get block id int block_id = sim_schedule_thread_block(core_id, initial); // no thread to schedule if (block_id == -1) continue; // find a new thread trace_to_run = fetch_block(block_id); // try to schedule as many threads as possible in the same block while (trace_to_run != NULL) { // create a new thread trace_to_run->m_trace_info_ptr = create_thread( trace_to_run->m_process, trace_to_run->m_tid, trace_to_run->m_main); // increment dispatched thread number of a block ++m_simBase->m_block_schedule_info[block_id]->m_dispatched_thread_num; // unique thread num of a core int unique_scheduled_thread_num = core->m_unique_scheduled_thread_num; trace_to_run->m_trace_info_ptr->m_thread_id = unique_scheduled_thread_num; // add a new application to the core core->add_application(unique_scheduled_thread_num, trace_to_run->m_process); // add a new thread trace information core->create_trace_info(unique_scheduled_thread_num, trace_to_run->m_trace_info_ptr); // m_simBase->m_trace_reader->pre_read_trace(trace_to_run->m_trace_info_ptr); // set flag for the simulation m_simBase->m_core_end_trace[core_id] = false; m_simBase->m_sim_end[core_id] = false; m_simBase->m_core_started[core_id] = true; // for thread start end cycles uint32_t unique_thread_id = trace_to_run->m_trace_info_ptr->m_unique_thread_id; uint32_t process_id = trace_to_run->m_trace_info_ptr->m_process->m_process_id; ASSERT(unique_thread_id < m_simBase->m_all_threads); thread_stat_s *thread_stat = &m_simBase->m_thread_stats[process_id][unique_thread_id]; thread_stat->m_unique_thread_id = unique_thread_id; thread_stat->m_block_id = block_id; thread_stat->m_thread_sched_cycle = core->get_cycle_count(); if (core->m_running_thread_num == core->get_max_threads_per_core()) break; // release the node entry m_simBase->m_trace_node_pool->release_entry(trace_to_run); // try to schedule other threads in the same block prev_fetching_block_id = core->m_fetching_block_id; block_id = sim_schedule_thread_block(core_id, initial); if (block_id == -1) break; // fetch a new thread trace_to_run = fetch_block(block_id); } } // End of work for this core type (ptx) } // assign a new block to the core // get the block id of the warp to be next assigned to the core // assignment of warps from a block doesn't happen in one go, it is done one // warp at a time, hence this function is called once for each warp. however, // all warps of a block get assigned in the same cycle (TODO: make it 1 call) int process_manager_c::sim_schedule_thread_block(int core_id, bool initial) { core_c *core = m_simBase->m_core_pointers[core_id]; int new_block_id = -1; int fetching_block_id = core->m_fetching_block_id; if ((fetching_block_id != -1) && m_simBase->m_block_schedule_info.find(fetching_block_id) != m_simBase->m_block_schedule_info.end()) { DEBUG( "core:%d fetching_block_id:%d total_thread_num:%d " "dispatched_thread_num:%d " "running_block_num:%d block_retired:%d \n", core_id, fetching_block_id, (m_simBase->m_block_schedule_info[fetching_block_id]->m_total_thread_num), (m_simBase->m_block_schedule_info[fetching_block_id] ->m_dispatched_thread_num), core->m_running_block_num, m_simBase->m_block_schedule_info[fetching_block_id]->m_retired); } // All threads from the currently serviced block should be scheduled before a new block // executes. Check currently fetching block has other threads to schedule if ((fetching_block_id != -1) && m_simBase->m_block_schedule_info.find(fetching_block_id) != m_simBase->m_block_schedule_info.end() && !(m_simBase->m_block_schedule_info[fetching_block_id]->m_retired)) { if (m_simBase->m_block_schedule_info[fetching_block_id] ->m_total_thread_num > m_simBase->m_block_schedule_info[fetching_block_id] ->m_dispatched_thread_num) { DEBUG( "fetching_continue block_id:%d total_thread_num:%d " "dispatched_thread_num:%d \n", fetching_block_id, m_simBase->m_block_schedule_info[fetching_block_id]->m_total_thread_num, m_simBase->m_block_schedule_info[fetching_block_id] ->m_dispatched_thread_num); return fetching_block_id; } } // All threads from previous block have been schedule. Thus, need to find a new block int appl_id = core->get_appl_id(); int max_block_per_core = m_simBase->m_sim_processes[appl_id]->m_max_block; // If the core already has maximum blocks, do not fetch more if ((core->m_running_block_num + 1) > max_block_per_core) return -1; bool block_found = true; process_s *process = m_simBase->m_sim_processes[appl_id]; for (auto I = process->m_block_list.begin(), E = process->m_block_list.end(); I != E; ++I) { int block_id = (*I).first; if (initial && !*m_simBase->m_knobs->KNOB_ASSIGN_BLOCKS_GREEDILY_INITIALLY) { int min_core_id; if (*m_simBase->m_knobs->KNOB_MAX_NUM_CORE_PER_APPL == 0) { min_core_id = 0; } else { min_core_id = process->m_core_list.begin()->first; } int num_core_per_appl = process->m_core_list.size(); if ((block_id - m_simBase->m_block_id_mapper->find( process->m_process_id, process->m_kernel_block_start_count [process->m_current_vector_index - 1])) % num_core_per_appl != (core_id - min_core_id)) { continue; } } // this block was not fetched yet and has traces to schedule if (!(m_simBase->m_block_schedule_info[block_id]->m_start_to_fetch) && m_simBase->m_block_schedule_info[block_id]->m_trace_exist) { block_found = true; new_block_id = block_id; break; } } // no block found to schedule if (new_block_id == -1) return -1; DEBUG("new block is %d \n", new_block_id); // set up block m_simBase->m_block_schedule_info[new_block_id]->m_start_to_fetch = true; m_simBase->m_block_schedule_info[new_block_id]->m_dispatched_core_id = core_id; m_simBase->m_block_schedule_info[new_block_id]->m_sched_cycle = core->get_cycle_count(); // set up core core->m_running_block_num = core->m_running_block_num + 1; core->m_fetching_block_id = new_block_id; DEBUG( "new block is allocated to core:%d running_block:%d fetching_block_id:%d " "\n", core_id, new_block_id, core->m_fetching_block_id); return new_block_id; }
[ "rmirosan@rp8.eng.uwaterloo.ca" ]
rmirosan@rp8.eng.uwaterloo.ca
891669002fc97cd4f5ab27f0c9fb71eb676ac281
393dbd4f385a28f7d6f312edd13c525888586a19
/src/network.cpp
95bde344be25ceeeb355a90098a5170364e7f0cb
[]
no_license
TheoNass/Network
f4b8df4bcb44922ba2271efa21439ade2b2ef1e2
3fac8eedf9b5fa134acac37e70f175bdfcb1f86d
refs/heads/master
2020-04-05T01:07:12.840017
2018-11-07T17:53:29
2018-11-07T17:53:29
156,424,215
0
0
null
null
null
null
UTF-8
C++
false
false
2,663
cpp
#include "network.h" #include "random.h" #include <iostream> #include <algorithm> using namespace std; void Network::resize(const size_t &n) { vector<double> tmp (n); RandomNumbers rd; rd.normal(tmp); values = tmp; } bool Network::add_link(const size_t& a, const size_t& b) { /// tout d'abord je dois regarder si les nodes a et b existes /// en gros je dois regarder si j'ai un lien de a à b et/ou de b à a /// ce qui veut dire que je dois itérer sur la multimap if ((values.size() <= a) or (values.size() <= b) or (a == b)) return false; /// on verifie que les nodes existent, puis que l'on essaye pas de lier le meme node for(pair<size_t, size_t> elem : links) { if (((elem.first == a) and (elem.second ==b)) or ((elem.first == b) and (elem.second ==a))) { return false; /// si le lien existe deja on retourne false } } links.insert ( std::pair<size_t,size_t>(a,b) ); /// si le lien n'existe pas je le rajoute links.insert ( std::pair<size_t,size_t>(b,a) ); /// dans les 2 sens return true; } size_t Network::random_connect(const double& mean) { //FAUX links.clear(); size_t compteur(0); RandomNumbers rd; for (size_t i(0); i<values.size(); i++) { ///on parcoure les nodes size_t nb_links(rd.poisson(mean)); for (size_t j(0); j<nb_links; j++) { size_t node(rd.uniform_double(0, values.size())); // pb de lien avec lui meme, et pb de lien double if (add_link (i,node)) compteur ++; } } return compteur; } size_t Network::set_values(const vector<double>& vec) { size_t compteur(0); vector<double> tmp; if (vec.size()>values.size()){ tmp = vec; tmp.resize(values.size()); values=tmp; compteur =values.size(); } else { for (size_t i=0; i<vec.size(); i++) { values[i] = vec[i]; compteur ++; } } return compteur; } size_t Network::size() const { ///WILL WORK return values.size();/// return # of nodes } size_t Network::degree(const size_t &_n) const { /// WILL WORK size_t compteur(0); for(pair<size_t, size_t> elem : links) { if (elem.first == _n) compteur++; ///on considere 1 lien comme un lien bidirectionnel } return compteur; } double Network::value(const size_t &_n) const { ///WILL WORK return values[_n]; } vector<double> Network::sorted_values() const { ///SHOULD WORK... I GUESS vector<double> vec = values; sort(vec.rbegin(), vec.rend()); /// rbegin et rend permettent d'inverser l'ordre return vec; } vector<size_t> Network::neighbors(const size_t& _n) const { vector<size_t> neighbors; for(pair<size_t, size_t> elem : links) { if (elem.first == _n) { neighbors.push_back(elem.second); } } return neighbors; }
[ "nass@INTRANET.EPFL.CH@SV-UniUbuntu3.intranet.epfl.ch" ]
nass@INTRANET.EPFL.CH@SV-UniUbuntu3.intranet.epfl.ch
348a811e8584b8c7a06b4fb3ba418314252cde84
1089a29cd8db2d2f9aec0aa47c217993f1ab2ca0
/QtCalculator/mainwindow.cpp
7d41f1923a3506c3dcbbd46620d072ad9fc748b5
[]
no_license
bozemanwow/QTCalculatorExperiments
0f5b3fff0bb758c6d908c20cb03de093224d4750
532379132ada69e4aca029d3408cae4f22cac064
refs/heads/master
2020-12-24T19:05:17.058809
2016-05-13T06:02:33
2016-05-13T06:02:33
58,705,106
0
0
null
null
null
null
UTF-8
C++
false
false
2,106
cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QtMath> #include <qmessagebox.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButtonMinus_clicked() { SetBeforeValues(); SetTopValue(ui->doubleTopValue->value() - ui->doubleBottomValue->value()); AddtoTextBox(mBeforeTop+ " - "+mBeforeBottom + " = " +ui->doubleTopValue->text() ); } void MainWindow::on_pushButtonPlus_clicked() { SetBeforeValues(); SetTopValue(ui->doubleTopValue->value() + ui->doubleBottomValue->value()); AddtoTextBox(mBeforeTop+ " + "+mBeforeBottom + " = " +ui->doubleTopValue->text() ); } void MainWindow::on_pushButtonDivide_clicked() { if(ui->doubleBottomValue->value() != 0){ SetBeforeValues(); SetTopValue(ui->doubleTopValue->value() /ui->doubleBottomValue->value()); AddtoTextBox(mBeforeTop+ " / "+mBeforeBottom + " = " +ui->doubleTopValue->text() ); } else QMessageBox::information(this,"Error","Can't divide by zero."); } void MainWindow::on_pushButtonTimes_clicked() { SetBeforeValues(); SetTopValue(ui->doubleTopValue->value() *ui->doubleBottomValue->value()); AddtoTextBox(mBeforeTop+ " * "+mBeforeBottom + " = " +ui->doubleTopValue->text() ); } void MainWindow::on_pushButtonSqrt_clicked() { if(ui->doubleTopValue->value() < 0) { QMessageBox::information(this,"Error","Can't SQRT less than zero."); } else { SetBeforeValues(); SetTopValue(qSqrt( ui->doubleTopValue->value())); AddtoTextBox(" SQRT ( "+mBeforeTop+ ") = " +ui->doubleTopValue->text() ); } } void MainWindow::SetTopValue(double _Value) { ui->doubleTopValue->setValue( _Value); } void MainWindow::AddtoTextBox(QString text ) { ui->plainTextEdit->appendPlainText( QString("Log: "+text)); } void MainWindow::SetBeforeValues() { mBeforeTop = ui->doubleTopValue->text(); mBeforeBottom =ui->doubleBottomValue->text(); }
[ "bozemanwow@fullsail.edu" ]
bozemanwow@fullsail.edu
b2c824430327fe8b56ad0b4f5c223a74dce9f49e
76de6f8d123616e4e2c40425ac931a74a7d2b731
/src/rpcprotocol.cpp
17ae5af5ab05ea4825671247cd73c82bbf165819
[ "MIT" ]
permissive
LordSoylent/Gainercoin
e5d82bd8164934a5a2b804749ec234710a8af109
d268b3b6714b2c5122cd8b086ea0d0f70922bdcb
refs/heads/master
2020-03-28T11:28:40.423055
2018-07-20T06:39:46
2018-07-20T06:39:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,233
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2013 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 "rpcprotocol.h" #include "util.h" #include <stdint.h> #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> #include <boost/bind.hpp> #include <boost/filesystem.hpp> #include <boost/foreach.hpp> #include <boost/iostreams/concepts.hpp> #include <boost/iostreams/stream.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_ptr.hpp> #include "json/json_spirit_writer_template.h" using namespace std; using namespace boost; using namespace boost::asio; using namespace json_spirit; // Number of bytes to allocate and read at most at once in post data const size_t POST_READ_SIZE = 256 * 1024; // // HTTP protocol // // This ain't Apache. We're just using HTTP header for the length field // and to be compatible with other JSON-RPC implementations. // string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeaders) { ostringstream s; s << "POST / HTTP/1.1\r\n" << "User-Agent: GainerCoin-json-rpc/" << FormatFullVersion() << "\r\n" << "Host: 127.0.0.1\r\n" << "Content-Type: application/json\r\n" << "Content-Length: " << strMsg.size() << "\r\n" << "Connection: close\r\n" << "Accept: application/json\r\n"; BOOST_FOREACH(const PAIRTYPE(string, string)& item, mapRequestHeaders) s << item.first << ": " << item.second << "\r\n"; s << "\r\n" << strMsg; return s.str(); } static string rfc1123Time() { return DateTimeStrFormat("%a, %d %b %Y %H:%M:%S +0000", GetTime()); } string HTTPReply(int nStatus, const string& strMsg, bool keepalive) { if (nStatus == HTTP_UNAUTHORIZED) return strprintf("HTTP/1.0 401 Authorization Required\r\n" "Date: %s\r\n" "Server: GainerCoin-json-rpc/%s\r\n" "WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n" "Content-Type: text/html\r\n" "Content-Length: 296\r\n" "\r\n" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n" "\"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n" "<HTML>\r\n" "<HEAD>\r\n" "<TITLE>Error</TITLE>\r\n" "<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>\r\n" "</HEAD>\r\n" "<BODY><H1>401 Unauthorized.</H1></BODY>\r\n" "</HTML>\r\n", rfc1123Time(), FormatFullVersion()); const char *cStatus; if (nStatus == HTTP_OK) cStatus = "OK"; else if (nStatus == HTTP_BAD_REQUEST) cStatus = "Bad Request"; else if (nStatus == HTTP_FORBIDDEN) cStatus = "Forbidden"; else if (nStatus == HTTP_NOT_FOUND) cStatus = "Not Found"; else if (nStatus == HTTP_INTERNAL_SERVER_ERROR) cStatus = "Internal Server Error"; else cStatus = ""; return strprintf( "HTTP/1.1 %d %s\r\n" "Date: %s\r\n" "Connection: %s\r\n" "Content-Length: %u\r\n" "Content-Type: application/json\r\n" "Server: GainerCoin-json-rpc/%s\r\n" "\r\n" "%s", nStatus, cStatus, rfc1123Time(), keepalive ? "keep-alive" : "close", strMsg.size(), FormatFullVersion(), strMsg); } bool ReadHTTPRequestLine(std::basic_istream<char>& stream, int &proto, string& http_method, string& http_uri) { string str; getline(stream, str); // HTTP request line is space-delimited vector<string> vWords; boost::split(vWords, str, boost::is_any_of(" ")); if (vWords.size() < 2) return false; // HTTP methods permitted: GET, POST http_method = vWords[0]; if (http_method != "GET" && http_method != "POST") return false; // HTTP URI must be an absolute path, relative to current host http_uri = vWords[1]; if (http_uri.size() == 0 || http_uri[0] != '/') return false; // parse proto, if present string strProto = ""; if (vWords.size() > 2) strProto = vWords[2]; proto = 0; const char *ver = strstr(strProto.c_str(), "HTTP/1."); if (ver != NULL) proto = atoi(ver+7); return true; } int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto) { string str; getline(stream, str); vector<string> vWords; boost::split(vWords, str, boost::is_any_of(" ")); if (vWords.size() < 2) return HTTP_INTERNAL_SERVER_ERROR; proto = 0; const char *ver = strstr(str.c_str(), "HTTP/1."); if (ver != NULL) proto = atoi(ver+7); return atoi(vWords[1].c_str()); } int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet) { int nLen = 0; while (true) { string str; std::getline(stream, str); if (str.empty() || str == "\r") break; string::size_type nColon = str.find(":"); if (nColon != string::npos) { string strHeader = str.substr(0, nColon); boost::trim(strHeader); boost::to_lower(strHeader); string strValue = str.substr(nColon+1); boost::trim(strValue); mapHeadersRet[strHeader] = strValue; if (strHeader == "content-length") nLen = atoi(strValue.c_str()); } } return nLen; } int ReadHTTPMessage(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet, string& strMessageRet, int nProto, size_t max_size) { mapHeadersRet.clear(); strMessageRet = ""; // Read header int nLen = ReadHTTPHeaders(stream, mapHeadersRet); if (nLen < 0 || (size_t)nLen > max_size) return HTTP_INTERNAL_SERVER_ERROR; // Read message if (nLen > 0) { vector<char> vch; size_t ptr = 0; while (ptr < (size_t)nLen) { size_t bytes_to_read = std::min((size_t)nLen - ptr, POST_READ_SIZE); vch.resize(ptr + bytes_to_read); stream.read(&vch[ptr], bytes_to_read); if (!stream) // Connection lost while reading return HTTP_INTERNAL_SERVER_ERROR; ptr += bytes_to_read; } strMessageRet = string(vch.begin(), vch.end()); } string sConHdr = mapHeadersRet["connection"]; if ((sConHdr != "close") && (sConHdr != "keep-alive")) { if (nProto >= 1) mapHeadersRet["connection"] = "keep-alive"; else mapHeadersRet["connection"] = "close"; } return HTTP_OK; } // // JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility, // but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were // unspecified (HTTP errors and contents of 'error'). // // 1.0 spec: http://json-rpc.org/wiki/specification // 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http // http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx // string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id) { Object request; request.push_back(Pair("method", strMethod)); request.push_back(Pair("params", params)); request.push_back(Pair("id", id)); return write_string(Value(request), false) + "\n"; } Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id) { Object reply; if (error.type() != null_type) reply.push_back(Pair("result", Value::null)); else reply.push_back(Pair("result", result)); reply.push_back(Pair("error", error)); reply.push_back(Pair("id", id)); return reply; } string JSONRPCReply(const Value& result, const Value& error, const Value& id) { Object reply = JSONRPCReplyObj(result, error, id); return write_string(Value(reply), false) + "\n"; } Object JSONRPCError(int code, const string& message) { Object error; error.push_back(Pair("code", code)); error.push_back(Pair("message", message)); return error; }
[ " " ]
 
5693a1617de688b3a39701432867747f51b371c1
6cd1bf6544347c85cabaf672a5ed2dad94a18b63
/ARC/ARC075/F.cpp
2d64f6bf476512570512fb6aeb814d1e39e5c63b
[]
no_license
Shell-Wataru/AtCoder
0a35f12478ac0ab54711171f653ce7bed5189c92
0ba32250f4e4a44459a4cd231ff47a5f46c4fe87
refs/heads/master
2023-01-10T04:21:25.199532
2023-01-09T04:16:30
2023-01-09T04:16:30
89,144,933
0
0
null
null
null
null
UTF-8
C++
false
false
1,952
cpp
#include<iostream> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <map> using namespace std; void addBIT(long long* BIT,int N,int index, long long v){ int i; for(i = index;i < N;i+= i&-i) BIT[i] += v; } long long sumBIT(long long* BIT,int index){ long long retValue = 0; int i; for(i = index;i > 0;i-= i& -i) retValue += BIT[i]; return retValue; } int main() { // 整数の入力 long long i,j,N,K,temp,count,total,D,useQuantity; cin >> D; count = 0; if (D% 9 != 0){ cout << 0 << endl; }else{ string temp = to_string(D/9); vector<long long> remainCount; int zeroCount = 0; if (to_string(D).length() %2 == 0){ count = 1; }else{ count = 10; } for (i = temp.length() -1; i>= 0;i--){ remainCount.push_back(temp[i] - '0'); if (zeroCount == i && temp[i] == '0'){ zeroCount += 1; } } for (i =0; i< zeroCount;i++){ remainCount.push_back(0); } cout << temp << endl; for (i = 0;i< (remainCount.size()+1)/2 ;i++){ if (remainCount[i] >= 0){ useQuantity = remainCount[i]; }else{ useQuantity = (- remainCount[i]/10 + 1)*10 + remainCount[i]; } cout << remainCount[i] << ":"<< useQuantity << endl; count *= 10 - abs(useQuantity) - (i==0); for (j = i; j< remainCount.size()-i;j++){ remainCount[j] -= useQuantity; if (remainCount[j]/10 != 0){ remainCount[j+1] += remainCount[j]/10; remainCount[j] = remainCount[j]%10; } } } for (i = 0;i< remainCount.size() ;i++){ cout << remainCount[i] << endl; } cout << count << endl; } return 0; }
[ "world.excite.8.enjoy@gmail.com" ]
world.excite.8.enjoy@gmail.com
61514c53a1ea233e02118eed9db253b146100250
1e89d671e96c9e9890112ef142a7cad77a53bd7a
/Testing/TestCPolyDrawablecpp.cpp
d4a72463760def28587f1f36ff4d1b12e3571bd5
[]
no_license
Hutecker/The-Canadian-Experience
fbf85c4df13b608064aab8bab655cdc869b0a805
b3b92fd0b629f76ca133a9584373d7960d489091
refs/heads/master
2020-05-17T18:07:47.533929
2014-11-15T21:01:52
2014-11-15T21:01:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,777
cpp
#include "stdafx.h" #include "CppUnitTest.h" #include "PolyDrawable.h" #include "Actor.h" #include "Picture.h" using namespace std; using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace Testing { TEST_CLASS(TestCPolyDrawablecpp) { public: TEST_METHOD(TestCPolyDrawableContructor) { CPolyDrawable polyDrawable(L"Harold"); Assert::AreEqual(std::wstring(L"Harold"), polyDrawable.GetName()); } TEST_METHOD(TestCPolyDrawableDefaultColor) { CPolyDrawable polyDrawable(L"Harold"); Gdiplus::Color black = Gdiplus::Color::Black; Assert::IsTrue(polyDrawable.GetColor().GetA() == black.GetA()); Assert::IsTrue(polyDrawable.GetColor().GetB() == black.GetB()); Assert::IsTrue(polyDrawable.GetColor().GetG() == black.GetG()); Gdiplus::Color test(1, 1, 1); polyDrawable.SetColor(test); Assert::IsTrue(polyDrawable.GetColor().GetA() == test.GetA()); Assert::IsTrue(polyDrawable.GetColor().GetB() == test.GetB()); Assert::IsTrue(polyDrawable.GetColor().GetG() == test.GetG()); } /** This tests that the animation of the rotation of a drawable works */ TEST_METHOD(TestCPolyDrawableAnimation) { // Create a picture object auto picture = make_shared<CPicture>(); // Create an actor and add it to the picture auto actor = make_shared<CActor>(L"Actor"); // Create a drawable for the actor auto drawable = make_shared<CPolyDrawable>(L"Drawable"); actor->SetRoot(drawable); actor->AddDrawable(drawable); picture->AddActor(actor); auto channel = drawable->GetAngleChannel(); // First we will ensure it works with no keyframes set picture->SetAnimationTime(0); drawable->SetRotation(1.33); // The channel should not be valid Assert::IsFalse(channel->IsValid()); // Getting a keyframe should not changle the angle actor->GetKeyframe(); Assert::AreEqual(1.33, drawable->GetRotation(), 0.00001); // Now we'll set one keyframe and see if that works picture->SetAnimationTime(1.5); drawable->SetRotation(2.7); actor->SetKeyframe(); // Change angle drawable->SetRotation(0.3); Assert::AreEqual(0.3, drawable->GetRotation(), 0.00001); // Wherever we move, now, the keyframe angle should be used picture->SetAnimationTime(0); Assert::AreEqual(2.7, drawable->GetRotation(), 0.00001); drawable->SetRotation(0.3); picture->SetAnimationTime(1.5); Assert::AreEqual(2.7, drawable->GetRotation(), 0.00001); drawable->SetRotation(0.3); picture->SetAnimationTime(3); Assert::AreEqual(2.7, drawable->GetRotation(), 0.00001); // We'll set a second keyframe and see if that works picture->SetAnimationTime(3.0); drawable->SetRotation(-1.8); actor->SetKeyframe(); // Test before the keyframes drawable->SetRotation(0.3); picture->SetAnimationTime(0); Assert::AreEqual(2.7, drawable->GetRotation(), 0.00001); // Test at first keyframe drawable->SetRotation(0.3); picture->SetAnimationTime(1.5); Assert::AreEqual(2.7, drawable->GetRotation(), 0.00001); // Test at second keyframe drawable->SetRotation(0.3); picture->SetAnimationTime(3.0); Assert::AreEqual(-1.8, drawable->GetRotation(), 0.00001); // Test after second keyframe drawable->SetRotation(0.3); picture->SetAnimationTime(4); Assert::AreEqual(-1.8, drawable->GetRotation(), 0.00001); // Test between the two keyframs drawable->SetRotation(0.3); picture->SetAnimationTime(2.25); // Halfway between the two keyframes Assert::AreEqual((2.7 + -1.8) / 2, drawable->GetRotation(), 0.00001); drawable->SetRotation(0.3); picture->SetAnimationTime(2.0); // 1/3 between the two keyframes Assert::AreEqual(2.7 + 1.0 / 3.0 * (-1.8 - 2.7), drawable->GetRotation(), 0.00001); } }; }
[ "stephan.hutecker1@gmail.com" ]
stephan.hutecker1@gmail.com
01ee1b6ff224c44b46790bf8f0563a67a7b21612
50a26128f39021189b7d5ffa41d68c5432a5c518
/GGJ2020/Source/GGJ2020/GGJ2020GameModeBase.h
89c571890e62bee78a44c6b909ab712ad8ee2ff5
[]
no_license
s1lence/GGJ2020
cde8776eb80b6e8c88ba1f47876d32f48394be55
15e13e86d33eb2fcb0f198b91dd6f7feda1a179f
refs/heads/master
2020-12-26T20:02:07.573677
2020-02-01T14:53:56
2020-02-01T14:53:56
237,624,548
0
0
null
2020-02-01T14:13:18
2020-02-01T14:13:18
null
UTF-8
C++
false
false
311
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "GameFramework/GameModeBase.h" #include "GGJ2020GameModeBase.generated.h" /** * */ UCLASS() class GGJ2020_API AGGJ2020GameModeBase : public AGameModeBase { GENERATED_BODY() };
[ "Dmytro.Shalimov@ubisoft.com" ]
Dmytro.Shalimov@ubisoft.com
0bf4a71a007623b4742bdec570aaecb3c721e969
67ed24f7e68014e3dbe8970ca759301f670dc885
/win10.19042/SysWOW64/winsta.dll.cpp
ab2de3a96e89a1426508f41f9097e4acb56c0e29
[]
no_license
nil-ref/dll-exports
d010bd77a00048e52875d2a739ea6a0576c82839
42ccc11589b2eb91b1aa82261455df8ee88fa40c
refs/heads/main
2023-04-20T21:28:05.295797
2021-05-07T14:06:23
2021-05-07T14:06:23
401,055,938
1
0
null
2021-08-29T14:00:50
2021-08-29T14:00:49
null
UTF-8
C++
false
false
22,350
cpp
#pragma comment(linker, "/export:LogonIdFromWinStationNameA=\"C:\\Windows\\SysWOW64\\winsta.LogonIdFromWinStationNameA\"") #pragma comment(linker, "/export:LogonIdFromWinStationNameW=\"C:\\Windows\\SysWOW64\\winsta.LogonIdFromWinStationNameW\"") #pragma comment(linker, "/export:RemoteAssistancePrepareSystemRestore=\"C:\\Windows\\SysWOW64\\winsta.RemoteAssistancePrepareSystemRestore\"") #pragma comment(linker, "/export:ServerGetInternetConnectorStatus=\"C:\\Windows\\SysWOW64\\winsta.ServerGetInternetConnectorStatus\"") #pragma comment(linker, "/export:ServerLicensingClose=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingClose\"") #pragma comment(linker, "/export:ServerLicensingDeactivateCurrentPolicy=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingDeactivateCurrentPolicy\"") #pragma comment(linker, "/export:ServerLicensingFreePolicyInformation=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingFreePolicyInformation\"") #pragma comment(linker, "/export:ServerLicensingGetAadInfo=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingGetAadInfo\"") #pragma comment(linker, "/export:ServerLicensingGetAvailablePolicyIds=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingGetAvailablePolicyIds\"") #pragma comment(linker, "/export:ServerLicensingGetPolicy=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingGetPolicy\"") #pragma comment(linker, "/export:ServerLicensingGetPolicyInformationA=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingGetPolicyInformationA\"") #pragma comment(linker, "/export:ServerLicensingGetPolicyInformationW=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingGetPolicyInformationW\"") #pragma comment(linker, "/export:ServerLicensingLoadPolicy=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingLoadPolicy\"") #pragma comment(linker, "/export:ServerLicensingOpenA=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingOpenA\"") #pragma comment(linker, "/export:ServerLicensingOpenW=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingOpenW\"") #pragma comment(linker, "/export:ServerLicensingSetAadInfo=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingSetAadInfo\"") #pragma comment(linker, "/export:ServerLicensingSetPolicy=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingSetPolicy\"") #pragma comment(linker, "/export:ServerLicensingUnloadPolicy=\"C:\\Windows\\SysWOW64\\winsta.ServerLicensingUnloadPolicy\"") #pragma comment(linker, "/export:ServerQueryInetConnectorInformationA=\"C:\\Windows\\SysWOW64\\winsta.ServerQueryInetConnectorInformationA\"") #pragma comment(linker, "/export:ServerQueryInetConnectorInformationW=\"C:\\Windows\\SysWOW64\\winsta.ServerQueryInetConnectorInformationW\"") #pragma comment(linker, "/export:ServerSetInternetConnectorStatus=\"C:\\Windows\\SysWOW64\\winsta.ServerSetInternetConnectorStatus\"") #pragma comment(linker, "/export:WTSRegisterSessionNotificationEx=\"C:\\Windows\\SysWOW64\\winsta.WTSRegisterSessionNotificationEx\"") #pragma comment(linker, "/export:WTSUnRegisterSessionNotificationEx=\"C:\\Windows\\SysWOW64\\winsta.WTSUnRegisterSessionNotificationEx\"") #pragma comment(linker, "/export:WinStationActivateLicense=\"C:\\Windows\\SysWOW64\\winsta.WinStationActivateLicense\"") #pragma comment(linker, "/export:WinStationAutoReconnect=\"C:\\Windows\\SysWOW64\\winsta.WinStationAutoReconnect\"") #pragma comment(linker, "/export:WinStationBroadcastSystemMessage=\"C:\\Windows\\SysWOW64\\winsta.WinStationBroadcastSystemMessage\"") #pragma comment(linker, "/export:WinStationCheckAccess=\"C:\\Windows\\SysWOW64\\winsta.WinStationCheckAccess\"") #pragma comment(linker, "/export:WinStationCheckLoopBack=\"C:\\Windows\\SysWOW64\\winsta.WinStationCheckLoopBack\"") #pragma comment(linker, "/export:WinStationCloseServer=\"C:\\Windows\\SysWOW64\\winsta.WinStationCloseServer\"") #pragma comment(linker, "/export:WinStationConnectA=\"C:\\Windows\\SysWOW64\\winsta.WinStationConnectA\"") #pragma comment(linker, "/export:WinStationConnectAndLockDesktop=\"C:\\Windows\\SysWOW64\\winsta.WinStationConnectAndLockDesktop\"") #pragma comment(linker, "/export:WinStationConnectCallback=\"C:\\Windows\\SysWOW64\\winsta.WinStationConnectCallback\"") #pragma comment(linker, "/export:WinStationConnectEx=\"C:\\Windows\\SysWOW64\\winsta.WinStationConnectEx\"") #pragma comment(linker, "/export:WinStationConnectW=\"C:\\Windows\\SysWOW64\\winsta.WinStationConnectW\"") #pragma comment(linker, "/export:WinStationConsumeCacheSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationConsumeCacheSession\"") #pragma comment(linker, "/export:WinStationCreateChildSessionTransport=\"C:\\Windows\\SysWOW64\\winsta.WinStationCreateChildSessionTransport\"") #pragma comment(linker, "/export:WinStationDisconnect=\"C:\\Windows\\SysWOW64\\winsta.WinStationDisconnect\"") #pragma comment(linker, "/export:WinStationEnableChildSessions=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnableChildSessions\"") #pragma comment(linker, "/export:WinStationEnumerateA=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerateA\"") #pragma comment(linker, "/export:WinStationEnumerateContainerSessions=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerateContainerSessions\"") #pragma comment(linker, "/export:WinStationEnumerateExW=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerateExW\"") #pragma comment(linker, "/export:WinStationEnumerateLicenses=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerateLicenses\"") #pragma comment(linker, "/export:WinStationEnumerateProcesses=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerateProcesses\"") #pragma comment(linker, "/export:WinStationEnumerateW=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerateW\"") #pragma comment(linker, "/export:WinStationEnumerate_IndexedA=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerate_IndexedA\"") #pragma comment(linker, "/export:WinStationEnumerate_IndexedW=\"C:\\Windows\\SysWOW64\\winsta.WinStationEnumerate_IndexedW\"") #pragma comment(linker, "/export:WinStationFreeConsoleNotification=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeConsoleNotification\"") #pragma comment(linker, "/export:WinStationFreeEXECENVDATAEX=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeEXECENVDATAEX\"") #pragma comment(linker, "/export:WinStationFreeGAPMemory=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeGAPMemory\"") #pragma comment(linker, "/export:WinStationFreeMemory=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeMemory\"") #pragma comment(linker, "/export:WinStationFreePropertyValue=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreePropertyValue\"") #pragma comment(linker, "/export:WinStationFreeUserCertificates=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeUserCertificates\"") #pragma comment(linker, "/export:WinStationFreeUserCredentials=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeUserCredentials\"") #pragma comment(linker, "/export:WinStationFreeUserSessionInfo=\"C:\\Windows\\SysWOW64\\winsta.WinStationFreeUserSessionInfo\"") #pragma comment(linker, "/export:WinStationGenerateLicense=\"C:\\Windows\\SysWOW64\\winsta.WinStationGenerateLicense\"") #pragma comment(linker, "/export:WinStationGetAllProcesses=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetAllProcesses\"") #pragma comment(linker, "/export:WinStationGetAllSessionsEx=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetAllSessionsEx\"") #pragma comment(linker, "/export:WinStationGetAllSessionsW=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetAllSessionsW\"") #pragma comment(linker, "/export:WinStationGetAllUserSessions=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetAllUserSessions\"") #pragma comment(linker, "/export:WinStationGetChildSessionId=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetChildSessionId\"") #pragma comment(linker, "/export:WinStationGetConnectionProperty=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetConnectionProperty\"") #pragma comment(linker, "/export:WinStationGetCurrentSessionCapabilities=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetCurrentSessionCapabilities\"") #pragma comment(linker, "/export:WinStationGetCurrentSessionConnectionProperty=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetCurrentSessionConnectionProperty\"") #pragma comment(linker, "/export:WinStationGetCurrentSessionTerminalName=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetCurrentSessionTerminalName\"") #pragma comment(linker, "/export:WinStationGetDeviceId=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetDeviceId\"") #pragma comment(linker, "/export:WinStationGetInitialApplication=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetInitialApplication\"") #pragma comment(linker, "/export:WinStationGetLanAdapterNameA=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetLanAdapterNameA\"") #pragma comment(linker, "/export:WinStationGetLanAdapterNameW=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetLanAdapterNameW\"") #pragma comment(linker, "/export:WinStationGetLastWinlogonNotification=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetLastWinlogonNotification\"") #pragma comment(linker, "/export:WinStationGetLoggedOnCount=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetLoggedOnCount\"") #pragma comment(linker, "/export:WinStationGetMachinePolicy=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetMachinePolicy\"") #pragma comment(linker, "/export:WinStationGetParentSessionId=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetParentSessionId\"") #pragma comment(linker, "/export:WinStationGetProcessSid=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetProcessSid\"") #pragma comment(linker, "/export:WinStationGetRedirectAuthInfo=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetRedirectAuthInfo\"") #pragma comment(linker, "/export:WinStationGetRestrictedLogonInfo=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetRestrictedLogonInfo\"") #pragma comment(linker, "/export:WinStationGetSessionIds=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetSessionIds\"") #pragma comment(linker, "/export:WinStationGetTermSrvCountersValue=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetTermSrvCountersValue\"") #pragma comment(linker, "/export:WinStationGetUserCertificates=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetUserCertificates\"") #pragma comment(linker, "/export:WinStationGetUserCredentials=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetUserCredentials\"") #pragma comment(linker, "/export:WinStationGetUserProfile=\"C:\\Windows\\SysWOW64\\winsta.WinStationGetUserProfile\"") #pragma comment(linker, "/export:WinStationInstallLicense=\"C:\\Windows\\SysWOW64\\winsta.WinStationInstallLicense\"") #pragma comment(linker, "/export:WinStationIsBoundToCacheTerminal=\"C:\\Windows\\SysWOW64\\winsta.WinStationIsBoundToCacheTerminal\"") #pragma comment(linker, "/export:WinStationIsChildSessionsEnabled=\"C:\\Windows\\SysWOW64\\winsta.WinStationIsChildSessionsEnabled\"") #pragma comment(linker, "/export:WinStationIsCurrentSessionRemoteable=\"C:\\Windows\\SysWOW64\\winsta.WinStationIsCurrentSessionRemoteable\"") #pragma comment(linker, "/export:WinStationIsHelpAssistantSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationIsHelpAssistantSession\"") #pragma comment(linker, "/export:WinStationIsSessionPermitted=\"C:\\Windows\\SysWOW64\\winsta.WinStationIsSessionPermitted\"") #pragma comment(linker, "/export:WinStationIsSessionRemoteable=\"C:\\Windows\\SysWOW64\\winsta.WinStationIsSessionRemoteable\"") #pragma comment(linker, "/export:WinStationNameFromLogonIdA=\"C:\\Windows\\SysWOW64\\winsta.WinStationNameFromLogonIdA\"") #pragma comment(linker, "/export:WinStationNameFromLogonIdW=\"C:\\Windows\\SysWOW64\\winsta.WinStationNameFromLogonIdW\"") #pragma comment(linker, "/export:WinStationNegotiateSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationNegotiateSession\"") #pragma comment(linker, "/export:WinStationNtsdDebug=\"C:\\Windows\\SysWOW64\\winsta.WinStationNtsdDebug\"") #pragma comment(linker, "/export:WinStationOpenServerA=\"C:\\Windows\\SysWOW64\\winsta.WinStationOpenServerA\"") #pragma comment(linker, "/export:WinStationOpenServerExA=\"C:\\Windows\\SysWOW64\\winsta.WinStationOpenServerExA\"") #pragma comment(linker, "/export:WinStationOpenServerExW=\"C:\\Windows\\SysWOW64\\winsta.WinStationOpenServerExW\"") #pragma comment(linker, "/export:WinStationOpenServerW=\"C:\\Windows\\SysWOW64\\winsta.WinStationOpenServerW\"") #pragma comment(linker, "/export:WinStationPreCreateGlassReplacementSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationPreCreateGlassReplacementSession\"") #pragma comment(linker, "/export:WinStationPreCreateGlassReplacementSessionEx=\"C:\\Windows\\SysWOW64\\winsta.WinStationPreCreateGlassReplacementSessionEx\"") #pragma comment(linker, "/export:WinStationQueryAllowConcurrentConnections=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryAllowConcurrentConnections\"") #pragma comment(linker, "/export:WinStationQueryCurrentSessionInformation=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryCurrentSessionInformation\"") #pragma comment(linker, "/export:WinStationQueryEnforcementCore=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryEnforcementCore\"") #pragma comment(linker, "/export:WinStationQueryInformationA=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryInformationA\"") #pragma comment(linker, "/export:WinStationQueryInformationW=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryInformationW\"") #pragma comment(linker, "/export:WinStationQueryLicense=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryLicense\"") #pragma comment(linker, "/export:WinStationQueryLogonCredentialsW=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryLogonCredentialsW\"") #pragma comment(linker, "/export:WinStationQuerySessionVirtualIP=\"C:\\Windows\\SysWOW64\\winsta.WinStationQuerySessionVirtualIP\"") #pragma comment(linker, "/export:WinStationQueryUpdateRequired=\"C:\\Windows\\SysWOW64\\winsta.WinStationQueryUpdateRequired\"") #pragma comment(linker, "/export:WinStationRcmShadow2=\"C:\\Windows\\SysWOW64\\winsta.WinStationRcmShadow2\"") #pragma comment(linker, "/export:WinStationRedirectErrorMessage=\"C:\\Windows\\SysWOW64\\winsta.WinStationRedirectErrorMessage\"") #pragma comment(linker, "/export:WinStationRedirectLogonBeginPainting=\"C:\\Windows\\SysWOW64\\winsta.WinStationRedirectLogonBeginPainting\"") #pragma comment(linker, "/export:WinStationRedirectLogonError=\"C:\\Windows\\SysWOW64\\winsta.WinStationRedirectLogonError\"") #pragma comment(linker, "/export:WinStationRedirectLogonMessage=\"C:\\Windows\\SysWOW64\\winsta.WinStationRedirectLogonMessage\"") #pragma comment(linker, "/export:WinStationRedirectLogonStatus=\"C:\\Windows\\SysWOW64\\winsta.WinStationRedirectLogonStatus\"") #pragma comment(linker, "/export:WinStationRegisterConsoleNotification=\"C:\\Windows\\SysWOW64\\winsta.WinStationRegisterConsoleNotification\"") #pragma comment(linker, "/export:WinStationRegisterConsoleNotificationEx=\"C:\\Windows\\SysWOW64\\winsta.WinStationRegisterConsoleNotificationEx\"") #pragma comment(linker, "/export:WinStationRegisterConsoleNotificationEx2=\"C:\\Windows\\SysWOW64\\winsta.WinStationRegisterConsoleNotificationEx2\"") #pragma comment(linker, "/export:WinStationRegisterCurrentSessionNotificationEvent=\"C:\\Windows\\SysWOW64\\winsta.WinStationRegisterCurrentSessionNotificationEvent\"") #pragma comment(linker, "/export:WinStationRegisterNotificationEvent=\"C:\\Windows\\SysWOW64\\winsta.WinStationRegisterNotificationEvent\"") #pragma comment(linker, "/export:WinStationRemoveLicense=\"C:\\Windows\\SysWOW64\\winsta.WinStationRemoveLicense\"") #pragma comment(linker, "/export:WinStationRenameA=\"C:\\Windows\\SysWOW64\\winsta.WinStationRenameA\"") #pragma comment(linker, "/export:WinStationRenameW=\"C:\\Windows\\SysWOW64\\winsta.WinStationRenameW\"") #pragma comment(linker, "/export:WinStationReportLoggedOnCompleted=\"C:\\Windows\\SysWOW64\\winsta.WinStationReportLoggedOnCompleted\"") #pragma comment(linker, "/export:WinStationReportUIResult=\"C:\\Windows\\SysWOW64\\winsta.WinStationReportUIResult\"") #pragma comment(linker, "/export:WinStationReset=\"C:\\Windows\\SysWOW64\\winsta.WinStationReset\"") #pragma comment(linker, "/export:WinStationRevertFromServicesSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationRevertFromServicesSession\"") #pragma comment(linker, "/export:WinStationSendMessageA=\"C:\\Windows\\SysWOW64\\winsta.WinStationSendMessageA\"") #pragma comment(linker, "/export:WinStationSendMessageW=\"C:\\Windows\\SysWOW64\\winsta.WinStationSendMessageW\"") #pragma comment(linker, "/export:WinStationSendWindowMessage=\"C:\\Windows\\SysWOW64\\winsta.WinStationSendWindowMessage\"") #pragma comment(linker, "/export:WinStationServerPing=\"C:\\Windows\\SysWOW64\\winsta.WinStationServerPing\"") #pragma comment(linker, "/export:WinStationSetAutologonPassword=\"C:\\Windows\\SysWOW64\\winsta.WinStationSetAutologonPassword\"") #pragma comment(linker, "/export:WinStationSetInformationA=\"C:\\Windows\\SysWOW64\\winsta.WinStationSetInformationA\"") #pragma comment(linker, "/export:WinStationSetInformationW=\"C:\\Windows\\SysWOW64\\winsta.WinStationSetInformationW\"") #pragma comment(linker, "/export:WinStationSetLastWinlogonNotification=\"C:\\Windows\\SysWOW64\\winsta.WinStationSetLastWinlogonNotification\"") #pragma comment(linker, "/export:WinStationSetPoolCount=\"C:\\Windows\\SysWOW64\\winsta.WinStationSetPoolCount\"") #pragma comment(linker, "/export:WinStationSetRenderHint=\"C:\\Windows\\SysWOW64\\winsta.WinStationSetRenderHint\"") #pragma comment(linker, "/export:WinStationShadow=\"C:\\Windows\\SysWOW64\\winsta.WinStationShadow\"") #pragma comment(linker, "/export:WinStationShadowAccessCheck=\"C:\\Windows\\SysWOW64\\winsta.WinStationShadowAccessCheck\"") #pragma comment(linker, "/export:WinStationShadowStop=\"C:\\Windows\\SysWOW64\\winsta.WinStationShadowStop\"") #pragma comment(linker, "/export:WinStationShadowStop2=\"C:\\Windows\\SysWOW64\\winsta.WinStationShadowStop2\"") #pragma comment(linker, "/export:WinStationShutdownSystem=\"C:\\Windows\\SysWOW64\\winsta.WinStationShutdownSystem\"") #pragma comment(linker, "/export:WinStationSwitchToServicesSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationSwitchToServicesSession\"") #pragma comment(linker, "/export:WinStationSystemShutdownStarted=\"C:\\Windows\\SysWOW64\\winsta.WinStationSystemShutdownStarted\"") #pragma comment(linker, "/export:WinStationSystemShutdownWait=\"C:\\Windows\\SysWOW64\\winsta.WinStationSystemShutdownWait\"") #pragma comment(linker, "/export:WinStationTerminateGlassReplacementSession=\"C:\\Windows\\SysWOW64\\winsta.WinStationTerminateGlassReplacementSession\"") #pragma comment(linker, "/export:WinStationTerminateProcess=\"C:\\Windows\\SysWOW64\\winsta.WinStationTerminateProcess\"") #pragma comment(linker, "/export:WinStationUnRegisterConsoleNotification=\"C:\\Windows\\SysWOW64\\winsta.WinStationUnRegisterConsoleNotification\"") #pragma comment(linker, "/export:WinStationUnRegisterNotificationEvent=\"C:\\Windows\\SysWOW64\\winsta.WinStationUnRegisterNotificationEvent\"") #pragma comment(linker, "/export:WinStationUserLoginAccessCheck=\"C:\\Windows\\SysWOW64\\winsta.WinStationUserLoginAccessCheck\"") #pragma comment(linker, "/export:WinStationVerify=\"C:\\Windows\\SysWOW64\\winsta.WinStationVerify\"") #pragma comment(linker, "/export:WinStationVirtualOpen=\"C:\\Windows\\SysWOW64\\winsta.WinStationVirtualOpen\"") #pragma comment(linker, "/export:WinStationVirtualOpenEx=\"C:\\Windows\\SysWOW64\\winsta.WinStationVirtualOpenEx\"") #pragma comment(linker, "/export:WinStationWaitSystemEvent=\"C:\\Windows\\SysWOW64\\winsta.WinStationWaitSystemEvent\"") #pragma comment(linker, "/export:_NWLogonQueryAdmin=\"C:\\Windows\\SysWOW64\\winsta._NWLogonQueryAdmin\"") #pragma comment(linker, "/export:_NWLogonSetAdmin=\"C:\\Windows\\SysWOW64\\winsta._NWLogonSetAdmin\"") #pragma comment(linker, "/export:_WinStationAnnoyancePopup=\"C:\\Windows\\SysWOW64\\winsta._WinStationAnnoyancePopup\"") #pragma comment(linker, "/export:_WinStationBeepOpen=\"C:\\Windows\\SysWOW64\\winsta._WinStationBeepOpen\"") #pragma comment(linker, "/export:_WinStationBreakPoint=\"C:\\Windows\\SysWOW64\\winsta._WinStationBreakPoint\"") #pragma comment(linker, "/export:_WinStationCallback=\"C:\\Windows\\SysWOW64\\winsta._WinStationCallback\"") #pragma comment(linker, "/export:_WinStationCheckForApplicationName=\"C:\\Windows\\SysWOW64\\winsta._WinStationCheckForApplicationName\"") #pragma comment(linker, "/export:_WinStationFUSCanRemoteUserDisconnect=\"C:\\Windows\\SysWOW64\\winsta._WinStationFUSCanRemoteUserDisconnect\"") #pragma comment(linker, "/export:_WinStationGetApplicationInfo=\"C:\\Windows\\SysWOW64\\winsta._WinStationGetApplicationInfo\"") #pragma comment(linker, "/export:_WinStationNotifyDisconnectPipe=\"C:\\Windows\\SysWOW64\\winsta._WinStationNotifyDisconnectPipe\"") #pragma comment(linker, "/export:_WinStationNotifyLogoff=\"C:\\Windows\\SysWOW64\\winsta._WinStationNotifyLogoff\"") #pragma comment(linker, "/export:_WinStationNotifyLogon=\"C:\\Windows\\SysWOW64\\winsta._WinStationNotifyLogon\"") #pragma comment(linker, "/export:_WinStationNotifyNewSession=\"C:\\Windows\\SysWOW64\\winsta._WinStationNotifyNewSession\"") #pragma comment(linker, "/export:_WinStationOpenSessionDirectory=\"C:\\Windows\\SysWOW64\\winsta._WinStationOpenSessionDirectory\"") #pragma comment(linker, "/export:_WinStationReInitializeSecurity=\"C:\\Windows\\SysWOW64\\winsta._WinStationReInitializeSecurity\"") #pragma comment(linker, "/export:_WinStationReadRegistry=\"C:\\Windows\\SysWOW64\\winsta._WinStationReadRegistry\"") #pragma comment(linker, "/export:_WinStationSessionInitialized=\"C:\\Windows\\SysWOW64\\winsta._WinStationSessionInitialized\"") #pragma comment(linker, "/export:_WinStationShadowTarget=\"C:\\Windows\\SysWOW64\\winsta._WinStationShadowTarget\"") #pragma comment(linker, "/export:_WinStationShadowTarget2=\"C:\\Windows\\SysWOW64\\winsta._WinStationShadowTarget2\"") #pragma comment(linker, "/export:_WinStationShadowTargetSetup=\"C:\\Windows\\SysWOW64\\winsta._WinStationShadowTargetSetup\"") #pragma comment(linker, "/export:_WinStationUpdateClientCachedCredentials=\"C:\\Windows\\SysWOW64\\winsta._WinStationUpdateClientCachedCredentials\"") #pragma comment(linker, "/export:_WinStationUpdateSettings=\"C:\\Windows\\SysWOW64\\winsta._WinStationUpdateSettings\"") #pragma comment(linker, "/export:_WinStationUpdateUserConfig=\"C:\\Windows\\SysWOW64\\winsta._WinStationUpdateUserConfig\"") #pragma comment(linker, "/export:_WinStationWaitForConnect=\"C:\\Windows\\SysWOW64\\winsta._WinStationWaitForConnect\"")
[ "magnus@stubman.eu" ]
magnus@stubman.eu
776a23985ddd25344d8b78f25ee664026fd695fe
ef142ad790366ca1f65da6a0d82583ce8757dd1c
/baald/core/Cfg.cpp
e7def4a5c45f8e774627ce2fa21b0783d359141e
[ "MIT" ]
permissive
shellohunter/blitzd
1242a8794346d67099769c9993ff4ba92dac2792
774a543b619d3332dd40e9cde32aa54948145cb4
refs/heads/master
2021-05-26T14:43:19.775032
2012-12-26T06:01:03
2012-12-26T06:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
883
cpp
#include "Config.h" #include "Cfg.h" #include "text/XmlNode.h" namespace Core { Cfg cfg; void Cfg::Load( const char * filename ) { LOG_INFO(("Loading config.")); Text::XmlNode config(filename); std::auto_ptr<Text::XmlNode> node(config.GetChild("Server")); if(node.get() != NULL) { _BlitzDAddr = node->GetAttrString("BlitzDAddress", "localhost"); _BlitzDPort = node->GetAttrInteger("BlitzDPort", 6112); _TcpPort = node->GetAttrInteger("Port", 6113); _Name = node->GetAttrString("Name", "Baal Realm"); _Description = node->GetAttrString("_Description", "Diablo II Baal Realm"); } node.reset(config.GetChild("Data")); if(node.get() != NULL) { _HashtableSize = node->GetAttrInteger("hashtableSize", 1024); } node.reset(config.GetChild("Dir")); if(node.get() != NULL) { _CfgDir = node->GetAttrString("configDir", "config"); } } }
[ "soarchin@gmail.com" ]
soarchin@gmail.com
78783ce08e02cb4a285c7476df4b67ad9336b1ac
e747571ac7514c785cf83f8d7f0a0a5e36894c15
/CmdS7/cmdhandler.cpp
d05dd332fd2f60b9137dac271162e708f20f2afc
[]
no_license
jbro885/s7-300-simple-emulator-plc
ea659d247d40471bc8da0dea49f292851b84941c
0279c556309aecb376cb194f95fc41bfcc09dc80
refs/heads/master
2023-03-20T01:25:28.245280
2020-05-08T21:22:22
2020-05-08T21:22:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,232
cpp
#include "cmdhandler.h" namespace S7Cmd { CmdHandler::CmdHandler(FPLC::DbHandler & dbHandler): s7Commands(nullptr) { s7Commands = new S7Commands(dbHandler); } CmdHandler::~CmdHandler() { delete s7Commands; } void CmdHandler::processRequest(const std::vector<uint8_t> &input, int clientFd) { //check input 1 if(input.size() <= (sizeof(TPKT_Header) + 1)) // 1 == first field of TPDU header is tpdu-type { //todo: replace with logger return; } //handle COTP uint8_t CR_Pos = sizeof(TPKT_Header) + 1; // 1 == first field of TPDU header is tpdu-type uint8_t tpduType = input[CR_Pos]; std::vector<uint8_t> output; // buffer for answer if(COTP_CR == tpduType) { bool r = sendCOTP_CR_Answer(input, clientFd); if(!r) ;//todo: replace with logger } else if(COTP_DT == tpduType) { //check input 2 size_t off = sizeof(TPKT_Header) + sizeof(DT_TPDU_Header); if(input.size() < (off + sizeof(S7COMM_Header10) + 1)) //+1 => first byte of params { //no s7comm header in COTP packet //todo: replace with logger return; } const S7COMM_Header10* s7Hdr10 = (const S7COMM_Header10*)&input[off]; if(0 == s7Hdr10->parlg) { //todo: replace with logger return; } // get id of function (first byte of params) size_t pos = off + sizeof(S7COMM_Header10); uint8_t pgNum = input[pos]; //init SessionContext sessionCtx.clientFd = clientFd; sessionCtx.seqNum = s7Hdr10->seqNum; // LE originally, don't need to convert sessionCtx.paramLength = ntohs(s7Hdr10->parlg); sessionCtx.dataLength = ntohs(s7Hdr10->datlg); uint16_t cmdId = 0x0000; //handle case with PGRequest. Each subcommand is a separate cmd. if(0x00 == pgNum) { if(input.size() < (pos + sessionCtx.paramLength + sessionCtx.dataLength)) { //todo: replace with logger std::cout<< "Err: input buffer is corrupted 3. " << " \n" <<std::endl; return; } // read params pos = pos - 1; //set pos to the begining of params area uint16_t cmdCode = input[pos + 6]; uint8_t subCmdCode = input[pos + 7]; cmdId = (cmdCode << 8) | subCmdCode; } else { cmdId = pgNum; } // process S7 command std::shared_ptr<Command> cmd = s7Commands->getCommand(cmdId); S7Status st = cmd->Execute(input, output, sessionCtx); if(S7Status::OK == st) sendAnswer(sessionCtx.clientFd, output); else { std::cout<< "Error occured in cmd: "<< cmdId << std::endl; if(S7Status::ErrInput == st) std::cout<< "Wrong input.\n"; else if(S7Status::ErrNoCmd == st) std::cout<< "No such command.\n"; else if(S7Status::ErrNoBlock == st) std::cout<< "No such block.\n"; std::cout<< std::endl; } } //else if } bool CmdHandler::sendCOTP_CR_Answer(const std::vector<uint8_t> & input, int clientFd) { //check input size_t sz = sizeof(TPKT_Header) + sizeof(CR_TPDU_Header); if(input.size() < sz) { //todo: replace with logger return false; } const CR_TPDU_Header* crHdr = (const CR_TPDU_Header*)&input[sizeof(TPKT_Header)]; // make CC packet /* * All fields values below always the same for * DT = 0xE0, therefore just hardcoded here. */ CC_TPDU_Header ccHdr; ccHdr.length = sizeof(CC_TPDU_Header) - 1; // todo: find out why -1 !!! ccHdr.type = 0xD0; ccHdr.dstRef = crHdr->srcRef; ccHdr.srcRef = 0x3144; ccHdr.opts = 0; ccHdr.srcTsapCode = 0xC1; ccHdr.srcTsapLength = 0x02; ccHdr.srcTsapHi = crHdr->srcTsapHi; ccHdr.srcTsapLo = crHdr->srcTsapLo; ccHdr.dstTsapCode = 0xC2; ccHdr.dstTsapLength = 0x02; ccHdr.dstTsapHi = crHdr->dstTsapHi; ccHdr.dstTsapLo = crHdr->dstTsapLo; ccHdr.tpduSizeCode = 0xC0; ccHdr.tpduSizeLength = 0x01; ccHdr.tpduSize = crHdr->tpduSize; TPKT_Header tpkt; tpkt.version = 0x03; tpkt.reserved = 0x00; uint16_t totalPacketLength = sizeof(TPKT_Header) + sizeof(CC_TPDU_Header); tpkt.totalLength = htons(totalPacketLength); //output buff const size_t OUTPUT_SZ = sizeof(TPKT_Header) + sizeof(CC_TPDU_Header); uint8_t output [OUTPUT_SZ]; uint8_t* pos = output; memcpy(pos, &tpkt, sizeof tpkt); pos += sizeof tpkt; memcpy(pos, &ccHdr, sizeof ccHdr); //send COTP answer ptrdiff_t sendedBytes = sendAll(clientFd, (const char*)output, OUTPUT_SZ); return ((ptrdiff_t)OUTPUT_SZ == sendedBytes); } ptrdiff_t CmdHandler::sendAnswer(int client, const std::vector<uint8_t> & buffer) { size_t sz = buffer.size(); ptrdiff_t total = sendAll(client, (const char*)&buffer[0], sz); return total; } ptrdiff_t CmdHandler::sendAll(int fd, const char *buf, size_t len) { size_t total = 0; size_t bytes_left = len; ptrdiff_t n = 0; while(total < len) { n = send(fd, buf+total, bytes_left, 0); // replace with sendmmsg!! send many packeta in one time! if(n == -1) break; total += n; bytes_left -= n; } return n == -1? n: total; // return 0 - success } } // namespace
[ "noreply@github.com" ]
noreply@github.com
180cc24a719733270a370ea20e3e713f719c426d
da19b00e7d3262da46faed8580843f50a7d0ba3c
/Hw3/Texture.hpp
c718e949a4e45250db13ec5c219ae74f2f272884
[]
no_license
zhoulw13/Games101
1cc3add510308ee7ddf0274baaa26125a07aa786
e32578bdca76d49ccd4c7cc29f40a34f3fddbfe8
refs/heads/master
2023-07-12T05:26:33.140870
2021-08-27T10:27:49
2021-08-27T10:27:49
399,074,873
0
0
null
null
null
null
UTF-8
C++
false
false
1,509
hpp
// // Created by LEI XU on 4/27/19. // #ifndef RASTERIZER_TEXTURE_H #define RASTERIZER_TEXTURE_H #include "global.hpp" #include <eigen3/Eigen/Eigen> #include <opencv2/opencv.hpp> class Texture{ private: cv::Mat image_data; public: Texture(const std::string& name) { image_data = cv::imread(name); cv::cvtColor(image_data, image_data, cv::COLOR_RGB2BGR); width = image_data.cols; height = image_data.rows; } int width, height; Eigen::Vector3f getColor(float u, float v) { auto u_img = u * width; auto v_img = (1 - v) * height; auto color = image_data.at<cv::Vec3b>(v_img, u_img); return Eigen::Vector3f(color[0], color[1], color[2]); } Eigen::Vector3f getBilinearColor(float u, float v) { auto u_img = u * width; auto v_img = (1 - v) * height; int u_left = int(u_img); int v_top = int(v_img); float alpha = u_img - u_left; float beta = v_img - v_top; auto color1 = image_data.at<cv::Vec3b>(v_top, u_left); auto color2 = image_data.at<cv::Vec3b>(v_top+1, u_left); auto color3 = image_data.at<cv::Vec3b>(v_top, u_left+1); auto color4 = image_data.at<cv::Vec3b>(v_top+1, u_left+1); auto final_color = (color1 * (1-beta)+ color2 * beta) * (1-alpha) + (color3 * (1-beta)+ color4 * beta) * alpha; return Eigen::Vector3f(final_color[0], final_color[1], final_color[2]); } }; #endif //RASTERIZER_TEXTURE_H
[ "zhoulw063922@gmail.com" ]
zhoulw063922@gmail.com
1b5cc9d5c074c7071e3610e3d590ecb3761955ba
ff4e9d0e28fd7f4184ad4136077c858278f5cea7
/rayCast.h
c9653d0d8a5f182a439939bc5d4c67e0a3a304a0
[]
no_license
drbaird2/CS419RayTracer
26015363b1646e004b0ca3ea411b6d10b1dab13b
e7403c8606d1e1b86db2a098d82df8b15a040fe4
refs/heads/main
2023-04-09T01:27:07.149911
2021-04-09T01:24:05
2021-04-09T01:24:05
348,893,246
0
0
null
null
null
null
UTF-8
C++
false
false
215
h
#ifndef RAYCAST_H #define RAYCAST_H #include "tracer.h" class RayCast: public Tracer { public: RayCast(void); RayCast(Scene* sceneRef); virtual Color trace_ray(const ray& ra) const; }; #endif
[ "drbaird2@illinois.edu" ]
drbaird2@illinois.edu
b580421a2c55096413bb9a2b314d0a58737c53f7
7552f8a92ab30f0d4cc1dcc128266108fae9dd6b
/Client.h
6e16157e5b9282f7a53ef70c4f1602101906a826
[]
no_license
karczewsky/bank_db_interface
b2758f5897355136d31f80a8af234645f2a12713
5526101af1516f31b29e81922dcf63bb44a0db9a
refs/heads/master
2021-10-09T05:38:43.297826
2018-12-21T22:49:58
2018-12-21T22:49:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
797
h
// // Created by jakub on 11/12/18. // #ifndef BANK_CLIENT_H #define BANK_CLIENT_H #include <string> #include "Account.h" using namespace std; enum class Gender { undefined = 0, male = 1, female = 2 }; class Client { private: unsigned int client_id; string first_name; string last_name; Gender gender; string city; string street; string postal_code; string email; void enter_address_data(); void enter_email_data(); void delete_from_db(); void push_update(); void get_summed_accounts_cash(); friend class Account; public: Client(); explicit Client(unsigned int client_id); void print(); void print_sub_accounts(); static void print_all(); static void personal_submenu(); }; #endif //BANK_CLIENT_H
[ "wolpear@users.noreply.github.com" ]
wolpear@users.noreply.github.com
2a8cfb29c0d165fb3d39e75168c0129b98d74a91
398acd399a6e135078611172b5122120147ac11a
/OpenFOAM-8/chapter2/ellipsoidal/0/alpha.water.org
772f65612965989d645d088dbd2824061dcdacf9
[]
no_license
Banbor2020/OpenFOAM_tutorials
8a57a33362ce1342dc2816d989f9b9ad3da1d79d
bca86f40e529ba81e475a9742f9dfe7b5d3eb751
refs/heads/master
2023-04-04T05:11:35.125385
2021-04-27T09:52:08
2021-04-27T09:52:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,221
org
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object alpha; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 1; boundaryField { front { type wedge; } back { type wedge; } fixedWall { type zeroGradient; } bottom { type zeroGradient; } top { type zeroGradient; } axis { type empty; } } // ************************************************************************* //
[ "nima.samkhaniani@gmail.com" ]
nima.samkhaniani@gmail.com
7dbfc2ef333dbc27f611c388b5e06a7d8d2ce0d3
fae551eb54ab3a907ba13cf38aba1db288708d92
/components/performance_manager/v8_memory/v8_detailed_memory_decorator.h
ad2619c4d6495f958f830099dd887c6495107221
[ "BSD-3-Clause" ]
permissive
xtblock/chromium
d4506722fc6e4c9bc04b54921a4382165d875f9a
5fe0705b86e692c65684cdb067d9b452cc5f063f
refs/heads/main
2023-04-26T18:34:42.207215
2021-05-27T04:45:24
2021-05-27T04:45:24
371,258,442
2
1
BSD-3-Clause
2021-05-27T05:36:28
2021-05-27T05:36:28
null
UTF-8
C++
false
false
5,992
h
// Copyright 2020 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 COMPONENTS_PERFORMANCE_MANAGER_V8_MEMORY_V8_DETAILED_MEMORY_DECORATOR_H_ #define COMPONENTS_PERFORMANCE_MANAGER_V8_MEMORY_V8_DETAILED_MEMORY_DECORATOR_H_ #include <memory> #include "base/callback_forward.h" #include "base/sequence_checker.h" #include "base/types/pass_key.h" #include "components/performance_manager/public/graph/graph.h" #include "components/performance_manager/public/graph/graph_registered.h" #include "components/performance_manager/public/graph/node_data_describer.h" #include "components/performance_manager/public/graph/process_node.h" #include "components/performance_manager/public/v8_memory/v8_detailed_memory.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "third_party/blink/public/mojom/performance_manager/v8_detailed_memory_reporter.mojom.h" namespace performance_manager { class FrameNode; namespace v8_memory { class V8DetailedMemoryRequestQueue; // A decorator that queries each renderer process for the amount of memory used // by V8 in each frame. The public interface to create requests for this // decorator is in // //components/performance_manager/public/v8_detailed_memory.h. class V8DetailedMemoryDecorator : public GraphOwned, public GraphRegisteredImpl<V8DetailedMemoryDecorator>, public ProcessNode::ObserverDefaultImpl, public NodeDataDescriberDefaultImpl { public: V8DetailedMemoryDecorator(); ~V8DetailedMemoryDecorator() override; V8DetailedMemoryDecorator(const V8DetailedMemoryDecorator&) = delete; V8DetailedMemoryDecorator& operator=(const V8DetailedMemoryDecorator&) = delete; // GraphOwned implementation. void OnPassedToGraph(Graph* graph) override; void OnTakenFromGraph(Graph* graph) override; // ProcessNodeObserver overrides. void OnProcessNodeAdded(const ProcessNode* process_node) override; void OnBeforeProcessNodeRemoved(const ProcessNode* process_node) override; // NodeDataDescriber overrides. base::Value DescribeFrameNodeData(const FrameNode* node) const override; base::Value DescribeProcessNodeData(const ProcessNode* node) const override; // Returns the next measurement request that should be scheduled. const V8DetailedMemoryRequest* GetNextRequest() const; // Returns the next measurement request with mode kBounded or // kEagerForTesting that should be scheduled. const V8DetailedMemoryRequest* GetNextBoundedRequest() const; // Implementation details below this point. // V8DetailedMemoryRequest objects register themselves with the decorator. // If |process_node| is null, the request will be sent to every renderer // process, otherwise it will be sent only to |process_node|. void AddMeasurementRequest(base::PassKey<V8DetailedMemoryRequest>, V8DetailedMemoryRequest* request, const ProcessNode* process_node = nullptr); void RemoveMeasurementRequest(base::PassKey<V8DetailedMemoryRequest>, V8DetailedMemoryRequest* request); // Internal helper class that can call NotifyObserversOnMeasurementAvailable // when a measurement is received. class ObserverNotifier; void NotifyObserversOnMeasurementAvailable( base::PassKey<ObserverNotifier>, const ProcessNode* process_node) const; // The following functions retrieve data maintained by the decorator. static const V8DetailedMemoryExecutionContextData* GetExecutionContextData( const FrameNode* node); static const V8DetailedMemoryExecutionContextData* GetExecutionContextData( const WorkerNode* node); static const V8DetailedMemoryExecutionContextData* GetExecutionContextData( const execution_context::ExecutionContext* ec); static V8DetailedMemoryExecutionContextData* CreateExecutionContextDataForTesting(const FrameNode* node); static V8DetailedMemoryExecutionContextData* CreateExecutionContextDataForTesting(const WorkerNode* node); static const V8DetailedMemoryProcessData* GetProcessData( const ProcessNode* node); static V8DetailedMemoryProcessData* CreateProcessDataForTesting( const ProcessNode* node); private: using RequestQueueCallback = base::RepeatingCallback<void(V8DetailedMemoryRequestQueue*)>; // Runs the given |callback| for every V8DetailedMemoryRequestQueue (global // and per-process). void ApplyToAllRequestQueues(RequestQueueCallback callback) const; void UpdateProcessMeasurementSchedules() const; Graph* graph_ GUARDED_BY_CONTEXT(sequence_checker_) = nullptr; std::unique_ptr<V8DetailedMemoryRequestQueue> measurement_requests_ GUARDED_BY_CONTEXT(sequence_checker_); SEQUENCE_CHECKER(sequence_checker_); }; ////////////////////////////////////////////////////////////////////////////// // The following internal functions are exposed in the header for testing. namespace internal { // A callback that will bind a V8DetailedMemoryReporter interface to // communicate with the given process. Exposed so that it can be overridden to // implement the interface with a test fake. using BindV8DetailedMemoryReporterCallback = base::RepeatingCallback<void( mojo::PendingReceiver<blink::mojom::V8DetailedMemoryReporter>, RenderProcessHostProxy)>; // Sets a callback that will be used to bind the V8DetailedMemoryReporter // interface. The callback is owned by the caller and must live until this // function is called again with nullptr. void SetBindV8DetailedMemoryReporterCallbackForTesting( BindV8DetailedMemoryReporterCallback* callback); // Destroys the V8DetailedMemoryDecorator. Exposed for testing. void DestroyV8DetailedMemoryDecoratorForTesting(Graph* graph); } // namespace internal } // namespace v8_memory } // namespace performance_manager #endif // COMPONENTS_PERFORMANCE_MANAGER_V8_MEMORY_V8_DETAILED_MEMORY_DECORATOR_H_
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
f5d97da2ade5afd2d3c0d0dc2dbd28c21adab2be
117c990482d1f5724441769a068859f40df70097
/HW6/jja336_hw6_q2.cpp
f2ae9cf668dcbd550ae78f2df5da58d494c3e413
[]
no_license
Fudoshin2596/NYU_Bridge_Homeworks
95770ca783146fce08efb95630fe5b5b331ce221
e3a59bfde0b41396ffb3dac22f8ab7738a810bc2
refs/heads/master
2022-12-03T13:51:14.453823
2020-08-28T00:34:08
2020-08-28T00:34:08
290,912,386
0
0
null
null
null
null
UTF-8
C++
false
false
1,505
cpp
#include <iostream> #include <string> #include <cmath> using namespace std; void printShiftedTriangle(int n, int m, string symbol); //Print an n-line triangle, filled with symbol characters, shifted m spaces from the left // margin. void printPineTree(int n, string symbol); //It prints a sequence of n triangles of increasing sizes (the smallest triangle is a 2-line //triangle), which form the shape of a pine tree. The triangles are filled with the symbol //character. int main() { int n , m; string symbol=""; cout << "Enter an numbner n for the amount of lines in the triangle," << " followed by a number m for how many spaces from the left margin " << "it will be shifted and a symbol to use, such that ( n, m, symbol)." << endl; cin >> n >> m >> symbol; printShiftedTriangle(n, m, symbol); printPineTree(n, symbol); return 0; } void printShiftedTriangle(int n, int m, string symbol) { int lineCount, symbolCount, maxsymbol; string leftmargin ="", space="", numOfSymbol; maxsymbol = 1; for(lineCount = n-1; lineCount >= 0; lineCount--) { for(symbolCount = maxsymbol; symbolCount <= 2 * (n - 1) + 1; symbolCount++) leftmargin = string(m,' '); space = string(lineCount,' '); cout << leftmargin << space; for (int k = 0; k < maxsymbol; k++) {cout << symbol;} cout << space; maxsymbol+=2; cout<<endl; } } void printPineTree(int n, string symbol) { }
[ "fudoshin2596@gmail.com" ]
fudoshin2596@gmail.com
9cbfde4bc769d599014f5f34e234b59c1ddfeaf8
587021a5acc0cb9852fea2ae5484c3e6ed2afeae
/238-Product of Array Except Self/238-Product of Array Except Self.cpp
dfe9ea768b5d550773f4b03cdb2a1287a118b537
[]
no_license
zhanglei1949/LeetCodeSolution
f2cc397aa3ef17af50c7f3813333ecfd88cf0c49
f0d733379806ce073e34188a94251427f394d558
refs/heads/master
2021-01-21T14:52:32.604640
2017-07-19T15:04:26
2017-07-19T15:04:26
95,347,236
0
0
null
null
null
null
UTF-8
C++
false
false
1,272
cpp
#include<iostream> #include<vector> using namespace std; vector<int> productExceptSelf1(vector<int>& nums) { vector<int> res; int len = nums.size(); for (int i = 0; i < len-1; ++i){ res.push_back(nums[i+1]); } res.push_back(nums[0]); for (int i = 1; i < len-1; ++i){ for (int j = 0; j < len; ++j){ res[j] = res[j]*nums[(j+i+1)%len]; //cout<<res[j]<<" "; } //cout<<endl; } return res; } vector<int> productExceptSelf(vector<int>& nums) { // divide the product into two parts, product of elements on the left hand and right hand. vector<int> res(nums.size()); res[0] = 1; int len = nums.size(); for (int i = 1; i < len; ++i){ res[i] = res[i-1] * nums[i-1]; } // for (int i = 0; i < len; ++i){ // cout<<res[i]<<" "; // } // cout<<endl; int tmp = 1; for (int i = len - 2; i >= 0; --i){ tmp = tmp*nums[i+1]; res[i] = res[i]*tmp; } // for (int i = 0; i < len; ++i){ // cout<<res[i]<<" "; // } return res; } int main() { vector<int> nums; int n; cin>>n; int tmp; for (int i = 0; i < n; ++i){ cin>>tmp; nums.push_back(tmp); } productExceptSelf(nums); }
[ "zhanglei1949@sjtu.edu.cn" ]
zhanglei1949@sjtu.edu.cn
60da1d5da852376bf427deab9c43f188c281558a
6f804f5031c09fc67302012cd5209f4fd1a13503
/HelloPhoton/Sprite.cpp
60470ff003fea2c0bd68845eaf2072a04a6938a5
[]
no_license
waihoeh97/tic-tac-toe-multiplayer
f4d353d05ae81d2a72fc076ee0f10931349ba45b
901997df6dfb0931e92f8e65ef8348d3f313f57a
refs/heads/master
2020-05-07T09:53:30.307409
2019-04-09T15:25:47
2019-04-09T15:25:47
180,395,957
0
0
null
null
null
null
UTF-8
C++
false
false
4,406
cpp
#include "Sprite.h" Sprite::Sprite() { m_width = 128; m_height = 128; } Matrix Sprite::SetTranslate(float x, float y) { return Matrix::makeTranslationMatrix(Vector(x, y, 0.0f)); } Matrix Sprite::SetRotate(float rotation) { return Matrix::makeRotateMatrix(rotation, Vector(0.0f, 0.0f, 1.0f)); } Matrix Sprite::SetScale(float x, float y) { return Matrix::makeScaleMatrix(Vector(x, y, 0.0f)); } Sprite::Sprite(const std::string& path) { SetFilePath(path); } Sprite::~Sprite() { } void Sprite::LoadTexture(const char *path, GLuint textureID, unsigned int &width, unsigned int &height) { CBitmap bitmap(path); glBindTexture(GL_TEXTURE_2D, textureID); // Repeat texture in tiles. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Horizontal texture. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Vertical texture. // Bilinear filtering. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Near filter. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Far filter. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmap.GetWidth(), bitmap.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.GetBits()); } void Sprite::DrawSquare(GLuint textureID, int xPos, int yPos, int width, int height, GLubyte r, GLubyte g, GLubyte b) { float halfW = (float)width * 0.5f; float halfH = (float)height * 0.5f; GLfloat vertices[] = { xPos - halfW, yPos - halfH, 0.0f, // bottom left xPos - halfW, yPos + halfH, 0.0f, // top left xPos + halfW, yPos - halfH, 0.0f, // bottom right xPos - halfW, yPos + halfH, 0.0f, // top left xPos + halfW, yPos - halfH, 0.0f, // bottom right xPos + halfW, yPos + halfH, 0.0f // top right }; GLfloat texCoords[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f }; GLubyte colors[] = { r, g, b, r, g, b, r, g, b, r, g, b, r, g, b, r, g, b }; // Enable textures. glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textureID); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glVertexPointer(3, GL_FLOAT, 0, vertices); glTexCoordPointer(2, GL_FLOAT, 0, texCoords); glColorPointer(3, GL_UNSIGNED_BYTE, 0, colors); glDrawArrays(GL_TRIANGLES, 0, 6); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY); } void Sprite::SetFilePath(const std::string & path) { glGenTextures(1, m_textureID); LoadTexture(path.c_str(), m_textureID[0], m_width, m_height); } void Sprite::SetTextureID(GLuint textureID) { m_textureID[0] = textureID; } void Sprite::SetColor(const Color& color) { m_color = color; } void Sprite::SetBlendingMode(BlendMode blend) { m_blendMode = blend; } void Sprite::SetDimension(unsigned int width, unsigned int height) { m_width = width; m_height = height; } void Sprite::Draw() { translateMatrix = SetTranslate(m_transform.position.x, m_transform.position.y); rotateMatrix = SetRotate(m_transform.rotation); scaleMatrix = SetScale(m_transform.scale.x, m_transform.scale.y); Matrix viewMatrix = translateMatrix * rotateMatrix * scaleMatrix; glLoadMatrixf((GLfloat*)viewMatrix.mVal); // enable alpha functions glEnable(GL_BLEND); glEnable(GL_ALPHA_TEST); glDepthMask(true); if (m_blendMode == ADDITIVE) { //glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_SRC_ALPHA, GL_ONE); } else if (m_blendMode == MULTIPLY) { glBlendFunc(GL_ZERO, GL_SRC_COLOR); //glBlendFunc(GL_DST_COLOR, GL_ZERO); glDepthMask(false); } else if (m_blendMode == ALPHA) { } else { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } DrawSquare(m_textureID[0], 0, 0, m_width, m_height, GetColor().R, GetColor().G, GetColor().B); glDepthMask(true); glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); } void Sprite::Draw(float xPos, float yPos, float rotation, float xScale, float yScale) { m_transform.position.x = xPos; m_transform.position.y = yPos; m_transform.rotation = rotation; m_transform.scale.x = xScale; m_transform.scale.y = yScale; Draw(); } void Sprite::Draw(Vector2 position, float rotation, Vector2 scale) { m_transform.position = position; m_transform.rotation = rotation; m_transform.scale = scale; Draw(); } void Sprite::Draw(Transform2D transform) { m_transform = transform; Draw(); }
[ "waihoeh@gmail.com" ]
waihoeh@gmail.com
3ddeb29f8abed10bfdb9bc9363bdd35c95551bb4
e021f4dbcb422035a176c6f2d479e111aa3e8904
/third_party/assimp/include/assimp/vector3.h
22693d4c2a7ac5236ea541e15bc358c0d8bf8bec
[]
no_license
KaplunSergey/opengl_homework_1
eb5266f768aa2e3698deec61f8514ce60953564a
132d8f0ac6825d5a852cdf2b794d28d7702fcbad
refs/heads/master
2021-08-24T10:58:50.838792
2017-11-21T22:31:22
2017-11-21T22:31:22
111,606,832
0
0
null
null
null
null
UTF-8
C++
false
false
4,496
h
/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- Copyright (c) 2006-2016, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the assimp team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the assimp team. 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. --------------------------------------------------------------------------- */ /** @file vector3.h * @brief 3D vector structure, including operators when compiling in C++ */ #ifndef AI_VECTOR3D_H_INC #define AI_VECTOR3D_H_INC #ifdef __cplusplus # include <cmath> #else # include <math.h> #endif #include "assimp/Compiler/pushpack1.h" #ifdef __cplusplus template<typename TReal> class aiMatrix3x3t; template<typename TReal> class aiMatrix4x4t; // --------------------------------------------------------------------------- /** Represents a three-dimensional vector. */ template <typename TReal> class aiVector3t { public: aiVector3t () : x(), y(), z() {} aiVector3t (TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {} explicit aiVector3t (TReal _xyz) : x(_xyz), y(_xyz), z(_xyz) {} aiVector3t (const aiVector3t& o) : x(o.x), y(o.y), z(o.z) {} public: // combined operators const aiVector3t& operator += (const aiVector3t& o); const aiVector3t& operator -= (const aiVector3t& o); const aiVector3t& operator *= (TReal f); const aiVector3t& operator /= (TReal f); // transform vector by matrix aiVector3t& operator *= (const aiMatrix3x3t<TReal>& mat); aiVector3t& operator *= (const aiMatrix4x4t<TReal>& mat); // access a single element TReal operator[](unsigned int i) const; TReal& operator[](unsigned int i); // comparison bool operator== (const aiVector3t& other) const; bool operator!= (const aiVector3t& other) const; bool operator < (const aiVector3t& other) const; bool Equal(const aiVector3t& other, TReal epsilon = 1e-6) const; template <typename TOther> operator aiVector3t<TOther> () const; public: /** @brief Set the components of a vector * @param pX X component * @param pY Y component * @param pZ Z component */ void Set( TReal pX, TReal pY, TReal pZ); /** @brief Get the squared length of the vector * @return Square length */ TReal SquareLength() const; /** @brief Get the length of the vector * @return length */ TReal Length() const; /** @brief Normalize the vector */ aiVector3t& Normalize(); /** @brief Normalize the vector with extra check for zero vectors */ aiVector3t& NormalizeSafe(); /** @brief Componentwise multiplication of two vectors * * Note that vec*vec yields the dot product. * @param o Second factor */ const aiVector3t SymMul(const aiVector3t& o); TReal x, y, z; } PACK_STRUCT; typedef aiVector3t<float> aiVector3D; #else struct aiVector3D { float x, y, z; } PACK_STRUCT; #endif // __cplusplus #include "assimp/Compiler/poppack1.h" #ifdef __cplusplus #endif // __cplusplus #endif // AI_VECTOR3D_H_INC
[ "vladkraevskii@gmail.com" ]
vladkraevskii@gmail.com
e7c01924bff636e85bf4340a79ae1d1def31bf10
27f6415c60087b017ac5adb1800545b31d289fc2
/include/learn_as_you_go.hpp
0568c207316820d7f0fa087c108859289a7325fb
[]
no_license
xyuan/cosmopp
95aceb939abcb09761c8f815957fa4d1ee230f1f
1f17ced1523eb01ab1055a919beeae94ea66038f
refs/heads/master
2020-04-10T07:57:50.516732
2016-11-15T23:35:52
2016-11-15T23:35:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,170
hpp
#ifndef COSMO_PP_LEARN_AS_YOU_GO_HPP #define COSMO_PP_LEARN_AS_YOU_GO_HPP #include <fstream> #include <vector> #include <string> #include <map> #include <macros.hpp> #include <function.hpp> #include <random.hpp> #include <fast_approximator.hpp> #include <fast_approximator_error.hpp> /// Learn as you go approximation class. /// This class evaluates a given function f, and as it goes it builds a training set. For every new call, it checks whether a quick approximation from the already existing set is acceptable and if so, calculates the approximation. Otherwise the exact value of f is calculated and added to the training set. /// This class supports parallelism through MPI. Namely, each process will perform the same task, but all of the processes periodically share their training sets with each other, so the training set for each process includes all of the exact calculations by all of the processes. class LearnAsYouGo { public: /// Constructor. /// \param nIn The dimensionality of the input space. /// \param nOut The dimensionality of the output space. /// \param f The function to be approximated. /// \param errorFunc The function that is used to model the error. errorFunc should take as an input the output of f and return a single real number. /// \minCount The minimum size of the training set before approximation can be performed. /// \precision The error threshold. This is used to decide whether or not the approximation is acceptable. /// \fileName If specified, the training set is continuously saved into this file. Also, if the file exists, the training set will be read in the constructor. So if a file is specified, it will always be read and updated. LearnAsYouGo(int nIn, int nData, const Math::RealFunctionMultiToMulti& f, const Math::RealFunctionMultiDim& errorFunc, unsigned long minCount = 10000, double precision = 0.1, const char* fileName = ""); /// Destructor. ~LearnAsYouGo(); /// Evaluate the function for a given point. The approximated result will be returned if the approximation is acceptable, otherwise the exact value will be calculated and returned. If the exact value is calculated it will be added to the training set. /// \param x The input point. /// \param res The result will be returned here. /// \param error1Sigma If specified (i.e. not NULL), the one sigma upper bound of the absolute error probability distribution will be returned here. /// \param error2Sigma If specified (i.e. not NULL), the two sigma upper bound of the absolute error probability distribution will be returned here. /// \param errorMean If specified (i.e. not NULL), the mean of the error probability distribution will be returned here. /// \param errorVar If specified (i.e. not NULL), the variance of the error probability distribution will be returned here. void evaluate(const std::vector<double>& x, std::vector<double>* res, double *error1Sigma = NULL, double *error2Sigma = NULL, double *errorMean = NULL, double *errorVar = NULL); /// This is similar to evaluate except that it will always calculate the exact value and add to the training set. /// \param x The input point. /// \param res The result will be returned here. void evaluateExact(const std::vector<double>& x, std::vector<double>* res); /// Set the precision for the error model. /// \p The error threshold. This is used to decide whether or not the approximation is acceptable. void setPrecision(double p); /// Save into a file. /// \param fileName The name of the file. void writeIntoFile(const char* fileName) const; /// Read from a file. /// \param fileName The name of the file. /// \return If the operation was successful. bool readFromFile(const char* fileName); /// Set a file to log the progress. Upon every call of evaluate a new row will be added to this log file with the following values: the total number of calls, the number of calls with for which the same input point has been used previously, the number of calls for which the approximation was successful (not counting the cases where the input point was the same as a point in the training set), and the number of calls for which the approximation failed and the exact value of the function was calculated. /// \param fileNameBase The file name base. If only one process is run then the log file name is simply the base followed by ".txt". If multiple MPI processes are run, each will create a log file with the name "fileNameBase_id.txt", where id is the MPI process ID, i.e. a number between 0 and number of processes - 1. void logIntoFile(const char* fileNameBase); /// Get the total number of calls. /// \return The total number of calls. unsigned long getTotalCount() const { return totalCount_; } /// Get the number of successful calls, i.e. calls for which the approximation succeeded. /// \return The number of successful calls. unsigned long getSuccessfulCount() const { return successfulCount_; } private: void construct(); void randomizeErrorSet(); void constructFast(); void log(); void actual(const std::vector<double>& x, std::vector<double>* res); void communicate(); void receive(); void addDataPoint(const std::vector<double>& p, const std::vector<double>& d); void resetPointMap(); private: struct PointComp { bool operator()(const std::vector<double>& a, const std::vector<double>& b) const { check(a.size() == b.size(), ""); check(!a.empty(), ""); for(int i = 0; i < a.size(); ++i) { if(a[i] < b[i]) return true; if(a[i] > b[i]) return false; } return false; } }; private: int nPoints_, nData_; const Math::RealFunctionMultiToMulti& f_; const Math::RealFunctionMultiDim& errorFunc_; double precision_; bool updateFile_; std::string fileName_; int nProcesses_; int processId_; unsigned long pointsCount_; unsigned long newPointsCount_; unsigned long newCommunicateCount_; unsigned long updateCount_; unsigned long minCount_; unsigned long communicateCount_; unsigned long testSize_; unsigned long updateErrorThreshold_; int communicateTag_; std::vector<void*> updateRequests_; std::vector<void*> updateReceiveReq_; bool firstUpdateRequested_; std::ofstream* logFile_; Math::UniformRealGenerator gen_; FastApproximator* fa_; FastApproximatorError* fast_; unsigned long totalCount_, successfulCount_, sameCount_; std::vector<std::vector<double> > points_, data_; std::vector<double> tempParams_; std::vector<double> tempData_; std::vector<double> currentParams_; std::vector<double> currentData_; std::vector<double> communicateBuff_; std::vector<std::vector<double> > communicateData_; std::vector<std::vector<double> > receiveBuff_; std::map<std::vector<double>, unsigned long, PointComp> pointMap_; }; #endif
[ "g.aslanyan@auckland.ac.nz" ]
g.aslanyan@auckland.ac.nz
87b775f43c7598edffc1f994300d351113fedf10
d5e9fafbdc265e9ff9002ebf7f83cc2c1c8ef19d
/test/InternalProfile.cpp
44f1a6645b5028802c8e4c8fa36ed1d57d76de35
[]
permissive
RyoTTa/geopm
1061d8f0c2a24d1c77f1fed2c3ae012c647c2933
fb845c64959391f91ce1ba0a23854be4021909f3
refs/heads/master
2020-11-25T20:36:31.406557
2019-11-01T14:50:11
2019-11-11T19:00:51
228,834,383
0
0
BSD-3-Clause
2019-12-18T12:21:06
2019-12-18T12:21:05
null
UTF-8
C++
false
false
4,026
cpp
/* * Copyright (c) 2015, 2016, 2017, 2018, 2019, Intel Corporation * * 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 Intel Corporation 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 LOG OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sstream> #include "InternalProfile.hpp" #include "Exception.hpp" #include "config.h" namespace geopm { InternalProfile &InternalProfile::internal_profile(void) { static InternalProfile instance; return instance; } InternalProfile::InternalProfile() : m_region_stack_colon(std::string::npos) , m_region_map_curr_it(m_region_map.end()) { } void InternalProfile::enter(const std::string &region_name) { if (m_region_stack.size()) { m_region_stack_colon = m_region_stack.size() + 1; m_region_stack += ":" + region_name; } else { m_region_stack = region_name; } m_region_map_curr_it = m_region_map.emplace(std::piecewise_construct, std::forward_as_tuple(m_region_stack), std::forward_as_tuple(M_REGION_ZERO)).first; geopm_time(&(m_region_map_curr_it->second.enter_time)); } void InternalProfile::exit(const std::string &region_name) { struct geopm_time_s curr_time; geopm_time(&curr_time); if (m_region_map_curr_it == m_region_map.end()) { throw Exception("InternalProfile::exit(): Region name has not been previously passed to the enter() method", GEOPM_ERROR_INVALID, __FILE__, __LINE__); } m_region_map_curr_it->second.total_time += geopm_time_diff(&(m_region_map_curr_it->second.enter_time), &curr_time); ++(m_region_map_curr_it->second.count); if (m_region_stack_colon != std::string::npos) { m_region_stack = m_region_stack.substr(0, m_region_stack_colon - 1); m_region_stack_colon = m_region_stack.find(':'); m_region_map_curr_it = m_region_map.find(m_region_stack); } else { m_region_stack = ""; m_region_map_curr_it = m_region_map.end(); } } std::string InternalProfile::report(void) { std::ostringstream result; result << "region-name | time | count \n"; for (auto it = m_region_map.begin(); it != m_region_map.end(); ++it) { result << it->first << " | " << it->second.total_time << " | " << it->second.count << "\n"; } result << "\n"; return result.str(); } }
[ "christopher.m.cantalupo@intel.com" ]
christopher.m.cantalupo@intel.com
35815099bade454eb8f940d7616ded6cf7975cb7
e63ec5449fc47f5ef02218d54219803aec11d2cb
/communication.cpp
a9a3a671801d8053961e629033cd1405a1dae864
[]
no_license
kaushik/AOS_MUTEX
f8034346acdc5c7ab6e7b3f1de9c313d9f33e605
821dde1edb0080df250a7a72b8a1726f24e0dca8
refs/heads/master
2022-02-09T23:58:54.802950
2013-12-02T01:50:03
2013-12-02T01:50:03
14,387,438
0
1
null
2022-01-21T00:31:37
2013-11-14T06:48:20
C++
UTF-8
C++
false
false
7,746
cpp
#include"communication.h" #include <iostream> using namespace std; /*struct AlgoMsg{ int TYPE; // 0: request_token, 1: have-token, 2: release, 3:send-token int ORIGIN; long SEQ; int sender; }__attribute__((packed));*/ /*int main(int argc, char *argv[]) { AlgoMsg message; message.TYPE=1; message.ORIGIN=2; message.SEQ=12121; message.sender=4; communication c; strcpy(c.dest_IP_Address,"10.176.67.65"); printf(c.dest_IP_Address); c.dest_port=1235; c.sendMessage(message); return 0; }*/ void communication::setMapIDtoIP(char **map){ mapIDtoIP = map; } int communication::connectToServer(char dest_IP_Address[15],int dest_port){ int sockfd; struct sockaddr_in servaddr; /* creating a socket */ if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { printf("\n Error in socket"); exit(0); } // printf("Socket created, "); /* configuring server address structure */ bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(dest_port); //printf("Socket configured, "); if (inet_pton(AF_INET, dest_IP_Address, &servaddr.sin_addr) <= 0) { printf("\n Error in inet_pton"); exit(0); } /* connecting to the server */ if (connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) { printf("\nError in connect"); exit(0); } //printf("Socket connected to server \n"); return sockfd; } int communication::writeToSocket(int sockfd, void *buffer, int size){ ssize_t n_send = send(sockfd,(void*) buffer, size, 0); if (n_send < 0) { DieWithError("\nError in Sending\n"); } // printf("message sent"); return n_send; } int communication::readFromSocket(int sockfd, void *buffer, int size){ ssize_t n_recv = recv(sockfd, (void*) buffer, size, 0); if (n_recv < 0) { DieWithError("\nError in Receiving\n"); } cout<<"--->Msg Received "<<buffer<<"---"<<endl; return n_recv; } int communication::closeSocket(int sockfd){ return close(sockfd); } int communication::sendMessage(struct Packet message, char dest_IP_Address[15],int dest_port){ int sockfd = connectToServer(dest_IP_Address,dest_port); writeToSocket(sockfd,(void*)&message,sizeof(message)); return closeSocket(sockfd); } //000 int communication::sendMessageToID(struct Packet message,int id){ printf("--->Sending a message to %d , IP: %s\n",id,mapIDtoIP[id]); return sendMessage(message,mapIDtoIP[id],LISTEN_PORT3); } void communication::DieWithError(string errorMessage)/* Error handling function */ { perror(errorMessage.c_str()); exit(1); } void communication::HandleTCPClient(int clntSocket, wqueue<Packet*>* m_queue) { //printf("Entered handling client"); //char echoBuffer[RCVBUFSIZE] = {'\0'}; /* Buffer for echo string */ int recvMsgSize; /* Size of received message */ Packet message; /* Receive message from client */ /* if ((recvMsgSize = recv(clntSocket, echoBuffer, RCVBUFSIZE, 0)) < 0) DieWithError("recv() failed");*/ if ((recvMsgSize = recv(clntSocket, &message, sizeof(message), 0)) < 0) DieWithError("recv() failed"); //printf("Message type %d\n",message.TYPE); //printf("Message Originator %d\n", message.ORIGIN); //printf("Message Sequ %ld\n", message.SEQ); //printf("Message sender %d\n", message.sender); //if message is an Algorithm message add to queue if(message.TYPE >=0 && message.TYPE <100){ Packet *message1; message1 = (struct Packet *)malloc(sizeof(struct Packet)); message1->TYPE=message.TYPE; message1->ORIGIN=message.ORIGIN; message1->SEQ=message.SEQ; message1->sender=message.sender; //printf("adding to recv queue\n"); m_queue->add(message1); //printf("queue size form listener:%d\n",m_queue->size()); }//is message a technical message else if(message.TYPE >=100 && message.TYPE < 1000 ){ } /* Send received string and receive again until end of transmission */ } int communication::serverListen(int portNum,wqueue<Packet*>* queue) { int servSock; /* Socket descriptor for server */ int clntSock; /* Socket descriptor for client */ struct sockaddr_in echoServAddr; /* Local address */ struct sockaddr_in echoClntAddr; /* Client address */ unsigned short echoServPort; /* Server port */ socklen_t clntLen; /* Length of client address data structure */ echoServPort = portNum; /* First arg: local port */ /* Create socket for incoming connections */ if ((servSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithError("socket() failed"); /* Construct local address structure */ memset(&echoServAddr, 0, sizeof(echoServAddr)); /* Zero out structure */ echoServAddr.sin_family = AF_INET; /* Internet address family */ echoServAddr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ echoServAddr.sin_port = htons(echoServPort); /* Local port */ /* Bind to the local address */ if (bind(servSock, (struct sockaddr *) &echoServAddr, sizeof(echoServAddr)) < 0) DieWithError("bind() failed"); /* Mark the socket so it will listen for incoming connections */ if (listen(servSock, MAXPENDING) < 0) DieWithError("listen() failed"); //int del=0; for (;;) /* Run forever */ { /* Set the size of the in-out parameter */ clntLen = sizeof(echoClntAddr); /* Wait for a client to connect */ if ((clntSock = accept(servSock, (struct sockaddr *) &echoClntAddr,&clntLen)) < 0) DieWithError("accept() failed"); /* clntSock is connected to a client! */ char *client_ip = inet_ntoa(echoClntAddr.sin_addr); //printf("\nA client requested to connect %d, %s\n",clntSock,client_ip); HandleTCPClient(clntSock,queue); //del++; close(clntSock); /* Close client socket */ } return 0; /* NOT REACHED */ } int communication::OpenListener(int& serSock, int portNum){ int servSock; /* Socket descriptor for server */ int clntSock; /* Socket descriptor for client */ close(servSock); struct sockaddr_in echoServAddr; /* Local address */ struct sockaddr_in echoClntAddr; /* Client address */ unsigned short echoServPort; /* Server port */ socklen_t clntLen; /* Length of client address data structure */ echoServPort = portNum; /* First arg: local port */ /* Create socket for incoming connections */ if ((servSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithError("socket() failed"); /* Construct local address structure */ memset(&echoServAddr, 0, sizeof(echoServAddr)); /* Zero out structure */ echoServAddr.sin_family = AF_INET; /* Internet address family */ echoServAddr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ echoServAddr.sin_port = htons(echoServPort); /* Local port */ /* Bind to the local address */ if (bind(servSock, (struct sockaddr *) &echoServAddr, sizeof(echoServAddr)) < 0) DieWithError("bind() failed"); /* Mark the socket so it will listen for incoming connections */ if (listen(servSock, MAXPENDING) < 0) DieWithError("listen() failed"); /* Set the size of the in-out parameter */ clntLen = sizeof(echoClntAddr); /* Wait for a client to connect */ if ((clntSock = accept(servSock, (struct sockaddr *) &echoClntAddr,&clntLen)) < 0) DieWithError("accept() failed"); /* clntSock is connected to a client! */ char *client_ip = inet_ntoa(echoClntAddr.sin_addr); //printf("\nRequesting client socket %d, addlen : %d %s\n",clntSock,sizeof(client_ip),client_ip); serSock = servSock; return clntSock; }
[ "skaushik1990@gmail.com" ]
skaushik1990@gmail.com
5588639271a08b38a83f31ad234aaf62197bc502
f2ae59825fbd3c1f0b6cdd86138a57301c99bc27
/VizServer/GeneratedFiles/Release/moc_VizTypes.cpp
21bd961142371bf268b9b33b9c38b55ead02111f
[]
no_license
leoschmitz/vizserver
a36ffc1c7bce9bf7e88144137c73ad8a2a753b15
a26b1a3f30e52f48f9c7733b79564ef5780b643f
refs/heads/master
2023-01-07T07:09:29.691550
2020-10-24T14:05:33
2020-10-24T14:05:33
306,896,176
0
0
null
null
null
null
UTF-8
C++
false
false
1,913
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'VizTypes.h' ** ** Created: Tue 13. Oct 20:40:45 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.1) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../VizTypes.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'VizTypes.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 61 #error "This file was generated using the moc from 4.5.1. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_viz__EnumHelper[] = { // content: 2, // revision 0, // classname 0, 0, // classinfo 0, 0, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors // enums: name, flags, count, data // enum data: key, value 0 // eod }; static const char qt_meta_stringdata_viz__EnumHelper[] = { "viz::EnumHelper\0" }; const QMetaObject viz::EnumHelper::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_viz__EnumHelper, qt_meta_data_viz__EnumHelper, 0 } }; const QMetaObject *viz::EnumHelper::metaObject() const { return &staticMetaObject; } void *viz::EnumHelper::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_viz__EnumHelper)) return static_cast<void*>(const_cast< EnumHelper*>(this)); return QObject::qt_metacast(_clname); } int viz::EnumHelper::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; return _id; } QT_END_MOC_NAMESPACE
[ "laschmitz@gmail.com" ]
laschmitz@gmail.com
ff8b392a736f55043c873dba99ec338ddd0f3bae
0e6373695dba1e1a6e5c76c990491d3bfeaae263
/Source.cpp
04488fb5cca90f49d99148e3ce71a2d44ffc19f7
[]
no_license
32BITAcademy/LearningGit
61973473974785b22c115d485923665e705b232c
2c3de83ce6263e6118c897893903a81169a72e51
refs/heads/master
2023-04-03T12:09:51.643934
2021-03-26T14:29:32
2021-03-26T14:29:32
351,818,359
0
0
null
null
null
null
UTF-8
C++
false
false
149
cpp
#include <iostream> int main() { system("chcp 1251"); int a, b; scanf_s("%i%i", &a, &b); printf("%i\n", a + b); system("pause"); return 0; }
[ "32bitacademy@gmail.com" ]
32bitacademy@gmail.com
907df0c07f8dfe6d5a25b0251585e3833ce4e021
5cdd9c1b6adb67fec94f6349ad6203ce2702fecb
/third_party/Windows-CalcEngine/src/SpectralAveraging/src/MeasuredSampleData.cpp
0622d1f16f891af4b99b323505f29f99f8b52209
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
NREL/EnergyPlus
9d8fc6936b5a0c81d2469ab9cdabe55405ccb8f2
50b8a5511ce559e5175524b943c26cc5b99d712d
refs/heads/develop
2023-09-04T08:20:29.804559
2023-09-01T13:58:55
2023-09-01T13:58:55
14,620,185
1,013
406
NOASSERTION
2023-09-14T19:52:57
2013-11-22T14:47:34
C++
UTF-8
C++
false
false
8,195
cpp
#include <stdexcept> #include <cassert> #include <utility> #include "MeasuredSampleData.hpp" #include "WCECommon.hpp" using namespace FenestrationCommon; namespace SpectralAveraging { //////////////////////////////////////////////////////////////////////////// //// MeasuredRow //////////////////////////////////////////////////////////////////////////// MeasuredRow::MeasuredRow(double wl, double t, double rf, double rb) : wavelength(wl), T(t), Rf(rf), Rb(rb) {} //////////////////////////////////////////////////////////////////////////// //// SampleData //////////////////////////////////////////////////////////////////////////// SampleData::SampleData() : m_Flipped(false) {} bool SampleData::Flipped() const { return m_Flipped; } void SampleData::Filpped(bool t_Flipped) { m_Flipped = t_Flipped; } //////////////////////////////////////////////////////////////////////////// //// CSpectralSampleData //////////////////////////////////////////////////////////////////////////// CSpectralSampleData::CSpectralSampleData() : SampleData(), m_absCalculated(false) { for(const auto & prop : EnumProperty()) { for(const auto & side : EnumSide()) { m_Property[std::make_pair(prop, side)] = CSeries(); } } } void CSpectralSampleData::addRecord(double const t_Wavelength, double const t_Transmittance, double const t_ReflectanceFront, double const t_ReflectanceBack) { m_Property.at(std::make_pair(Property::T, Side::Front)) .addProperty(t_Wavelength, t_Transmittance); m_Property.at(std::make_pair(Property::T, Side::Back)) .addProperty(t_Wavelength, t_Transmittance); m_Property.at(std::make_pair(Property::R, Side::Front)) .addProperty(t_Wavelength, t_ReflectanceFront); m_Property.at(std::make_pair(Property::R, Side::Back)) .addProperty(t_Wavelength, t_ReflectanceBack); reset(); } CSpectralSampleData::CSpectralSampleData(const std::vector<MeasuredRow> & tValues) : CSpectralSampleData() { m_Property.at(std::make_pair(Property::T, Side::Front)).clear(); m_Property.at(std::make_pair(Property::T, Side::Back)).clear(); m_Property.at(std::make_pair(Property::R, Side::Front)).clear(); m_Property.at(std::make_pair(Property::R, Side::Back)).clear(); for(const auto & val : tValues) { m_Property.at(std::make_pair(Property::T, Side::Front)) .addProperty(val.wavelength, val.T); m_Property.at(std::make_pair(Property::T, Side::Back)) .addProperty(val.wavelength, val.T); m_Property.at(std::make_pair(Property::R, Side::Front)) .addProperty(val.wavelength, val.Rf); m_Property.at(std::make_pair(Property::R, Side::Back)) .addProperty(val.wavelength, val.Rb); } } CSeries & CSpectralSampleData::properties(FenestrationCommon::Property prop, FenestrationCommon::Side side) { calculateProperties(); auto aSide = FenestrationCommon::getSide(side, m_Flipped); return m_Property.at(std::make_pair(prop, aSide)); } std::vector<double> CSpectralSampleData::getWavelengths() const { return m_Property.at(std::make_pair(Property::T, Side::Front)).getXArray(); } // Interpolate current sample data to new wavelengths set void CSpectralSampleData::interpolate(std::vector<double> const & t_Wavelengths) { for(const auto & prop : EnumProperty()) { for(const auto & side : EnumSide()) { m_Property[std::make_pair(prop, side)] = m_Property.at(std::make_pair(prop, side)).interpolate(t_Wavelengths); } } } void CSpectralSampleData::reset() { m_absCalculated = false; } void CSpectralSampleData::calculateProperties() { if(!m_absCalculated) { m_Property.at(std::make_pair(Property::Abs, Side::Front)).clear(); m_Property.at(std::make_pair(Property::Abs, Side::Back)).clear(); const auto wv = m_Property.at(std::make_pair(Property::T, Side::Front)).getXArray(); for(size_t i = 0; i < wv.size(); ++i) { auto RFrontSide = m_Flipped ? Side::Back : Side::Front; auto RBackSide = m_Flipped ? Side::Front : Side::Back; auto value = 1 - m_Property.at(std::make_pair(Property::T, Side::Front))[i].value() - m_Property.at(std::make_pair(Property::R, RFrontSide))[i].value(); m_Property.at(std::make_pair(Property::Abs, Side::Front)).addProperty(wv[i], value); value = 1 - m_Property.at(std::make_pair(Property::T, Side::Back))[i].value() - m_Property.at(std::make_pair(Property::R, RBackSide))[i].value(); m_Property.at(std::make_pair(Property::Abs, Side::Back)).addProperty(wv[i], value); } m_absCalculated = true; } } std::shared_ptr<CSpectralSampleData> CSpectralSampleData::create(const std::vector<MeasuredRow> & tValues) { return std::shared_ptr<CSpectralSampleData>(new CSpectralSampleData(tValues)); } std::shared_ptr<CSpectralSampleData> CSpectralSampleData::create() { return CSpectralSampleData::create({}); } void CSpectralSampleData::cutExtraData(const double minLambda, const double maxLambda) { for(const auto & side : EnumSide()) { m_Property.at(std::make_pair(Property::T, side)).cutExtraData(minLambda, maxLambda); m_Property.at(std::make_pair(Property::R, side)).cutExtraData(minLambda, maxLambda); } } /////////////////////////////////////////////////////////////////////////// /// PhotovoltaicData /////////////////////////////////////////////////////////////////////////// PhotovoltaicSampleData::PhotovoltaicSampleData(const CSpectralSampleData & spectralSampleData) : CSpectralSampleData(spectralSampleData), m_EQE{{Side::Front, CSeries()}, {Side::Back, CSeries()}} {} PhotovoltaicSampleData::PhotovoltaicSampleData(const CSpectralSampleData & spectralSampleData, const CSeries & eqeValuesFront, const CSeries & eqeValuesBack) : CSpectralSampleData(spectralSampleData), m_EQE{{Side::Front, eqeValuesFront}, {Side::Back, eqeValuesBack}} { const auto spectralWl{getWavelengths()}; for(const auto side : FenestrationCommon::EnumSide()) { const auto eqeWavelengths{m_EQE.at(side).getXArray()}; if(spectralWl.size() != eqeWavelengths.size()) { throw std::runtime_error("Measured spectral data do not have same amount of data " "as provided eqe values for the photovoltaic."); } for(size_t i = 0u; i < spectralWl.size(); ++i) { if(spectralWl[i] != eqeWavelengths[i]) { throw std::runtime_error("Measured spectral wavelengths are not matching to " "provided eqe photovoltaic wavelengths."); } } } } void PhotovoltaicSampleData::cutExtraData(double minLambda, double maxLambda) { CSpectralSampleData::cutExtraData(minLambda, maxLambda); for(const auto & side : EnumSide()) { m_EQE.at(side).cutExtraData(minLambda, maxLambda); } } CSeries PhotovoltaicSampleData::eqe(const Side side) const { return m_EQE.at(side); } } // namespace SpectralAveraging
[ "dvvidanovic@lbl.gov" ]
dvvidanovic@lbl.gov
f76f6702d6d394f60dd7f6bee4251acff197c3a5
a546ef4aaf08f407453c169bda38c3c773c388f9
/Concert.cpp
6da4e9bde852cef81cabf2f0689840d4ba497975
[]
no_license
rodgerskei/CIS343-CPlusPlus_Project
bd2193f5ab50b79b52818eaaccd97101fc7289a1
67ede2d7564cb9cab640858b159e8bd435de0d40
refs/heads/master
2021-05-15T21:32:44.829782
2017-10-10T01:43:28
2017-10-10T01:43:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,871
cpp
/********************************************************* * A file that implements the Concert.h * * Created by: Keith Rodgers * Collaborated With: Ryan Walt, Dylan Kernohan, Keith Schmitt **********************************************************/ #include "Concert.h" #include <string> #include <vector> #include <cstdlib> #include <time.h> #include <iostream> #include <algorithm> /************************************************************************************* * Default Constructor *************************************************************************************/ Concert::Concert(){ concertName = ""; friends.clear(); desire = -1; date.tm_year = 2099; date.tm_mon = 1; date.tm_mday = 1; } /************************************************************************************* * Constructor *************************************************************************************/ Concert::Concert(std::string concertName, std::vector<std::string> friends, int desire, std::tm date ){ this -> concertName = concertName; this -> friends = friends; this -> desire = desire; this -> date = date; } // Getters /************************************************************************************* * Get the Concert Name *************************************************************************************/ std::string Concert::getConcertName() const{ return concertName; } /************************************************************************************* * Get the Concert Friend Vector *************************************************************************************/ std::vector<std::string> Concert::getFriends() const{ return friends; } /************************************************************************************* * Get the Concert Desire *************************************************************************************/ int Concert::getDesire() const{ return desire; } /************************************************************************************* * Get the Concert Date *************************************************************************************/ std::tm Concert::getDate() const{ return date; } /************************************************************************************ * < Operator Overload * * Compare a concert by date first * then its desire * * If the concert date is closer, the concert is higher priority (greater than) *************************************************************************************/ bool Concert::operator<(const Concert& other) const{ if (date.tm_year > other.date.tm_year){ return true; } else if (date.tm_year == other.date.tm_year){ if(date.tm_mon > other.date.tm_mon){ return true; } else if(date.tm_mon == other.date.tm_mon){ if(date.tm_mday > other.date.tm_mday) return true; else if(date.tm_mday == other.date.tm_mday){ if(desire < other.desire){ return true; } } } } return false; } /************************************************************************************* * << Operator Overload * * Allows the user to cout<< a Concert object easily *************************************************************************************/ std::ostream& operator<<(std::ostream& out, const Concert& c) { // Gets the date of the concert std::tm date = c.getDate(); // Gets the friends vector of the concert std::vector<std::string> friendsVector = c.getFriends(); // Creates a string that will store all the friends std::string friends = "{"; // Iterates throught he friends vector and stores each friend into the friend string for (int i = 0; i < friendsVector.size(); i++){ // Checks to see if it is the last friend in the vector to add a comma or not if(i != friendsVector.size() - 1) friends += friendsVector[i] + ", "; else friends += friendsVector[i]; } friends += "}"; // Formats the out stream of the Concert object out << '(' << c.getConcertName() << ": " << date.tm_mon << "/" << date.tm_mday << "/" << date.tm_year << " | " << c.getDesire() << " | " << friends << ')' << "\n"; return out; } /************************************************************************************* * Main: * Creates 10 Concerts, * Sorts them using the overloaded < operator * Prints the sorted Concerts (greatest to least) using the overloaded << operator *************************************************************************************/ int main(int argc, char* argv[]){ // Concert 1 - 6 std::tm tempdate1; tempdate1.tm_year = 2018; tempdate1.tm_mon = 3; tempdate1.tm_mday = 1; std::vector<std::string> sample1 {"Dylan", "Ryan", "Keith"}; auto concert_1 = new Concert("Concert 1", sample1, 2, tempdate1); // Concert 2 - 1 std::tm tempdate2; tempdate2.tm_year = 2017; tempdate2.tm_mon = 2; tempdate2.tm_mday = 1; std::vector<std::string> sample2 {"Dylan"}; auto concert_2 = new Concert("Concert 2", sample2, 5, tempdate2); // Concert 3 - 9 std::tm tempdate3; tempdate3.tm_year = 2019; tempdate3.tm_mon = 1; tempdate3.tm_mday = 4; std::vector<std::string> sample3 {"Ryan"}; auto concert_3 = new Concert("Concert 3", sample3, 7, tempdate3); // Concert 4 - 3 std::tm tempdate4; tempdate4.tm_year = 2017; tempdate4.tm_mon = 5; tempdate4.tm_mday = 15; std::vector<std::string> sample4 {"Keith"}; auto concert_4 = new Concert("Concert 4", sample4, 1, tempdate4); // Concert 5 - 2 std::tm tempdate5; tempdate5.tm_year = 2017; tempdate5.tm_mon = 3; tempdate5.tm_mday = 2; std::vector<std::string> sample5 {"Dylan", "Ryan"}; auto concert_5 = new Concert("Concert 5", sample5, 5, tempdate5); // Concert 6 - 8 std::tm tempdate6; tempdate6.tm_year = 2018; tempdate6.tm_mon = 11; tempdate6.tm_mday = 12; std::vector<std::string> sample6 {"Ryan", "Keith"}; auto concert_6 = new Concert("Concert 6", sample6, 9, tempdate6); // Concert 7 - 10 std::tm tempdate7; tempdate7.tm_year = 2019; tempdate7.tm_mon = 7; tempdate7.tm_mday = 20; std::vector<std::string> sample7 {"Dylan", "Keith"}; auto concert_7 = new Concert("Concert 7", sample7, 4, tempdate7); // Concert 8 - 7 std::tm tempdate8; tempdate8.tm_year = 2018; tempdate8.tm_mon = 5; tempdate8.tm_mday = 1; std::vector<std::string> sample8 {"Bob"}; auto concert_8 = new Concert("Concert 8", sample8, 6, tempdate8); // Concert 9 - 4 std::tm tempdate9; tempdate9.tm_year = 2017; tempdate9.tm_mon = 12; tempdate9.tm_mday = 25; std::vector<std::string> sample9 {"Brock", "Ash", "Misty"}; auto concert_9 = new Concert("Concert 9", sample9, 10, tempdate9); // Concert 10 - 5 std::tm tempdate10; tempdate10.tm_year = 2017; tempdate10.tm_mon = 12; tempdate10.tm_mday = 25; std::vector<std::string> sample10 {"Ira", "Dylan", "Programming"}; auto concert_10 = new Concert("Concert 10", sample10, 3, tempdate10); std::vector<Concert> concerts; concerts.push_back(*concert_1); concerts.push_back(*concert_2); concerts.push_back(*concert_3); concerts.push_back(*concert_4); concerts.push_back(*concert_5); concerts.push_back(*concert_6); concerts.push_back(*concert_7); concerts.push_back(*concert_8); concerts.push_back(*concert_9); concerts.push_back(*concert_10); // Sort the concerts vector using the overoaded < operator sort(concerts.begin(), concerts.begin()+10); // Print the sorted concert vector with the overloaded << operator (Backwards so it prints most important concerts to least important concerts {Greates to Least}) std::cout << "\nConcerts in order from most important to least important:\n\n" << concerts[9] << concerts[8] << concerts[7] << concerts[6] << concerts[5] << concerts[4] << concerts[3] << concerts[2] << concerts[1] << concerts[0] << std::endl; }
[ "32454700+rodgerskei@users.noreply.github.com" ]
32454700+rodgerskei@users.noreply.github.com
f5dba65af81218a3580ead9338be4af78109186a
879681c994f1ca9c8d2c905a4e5064997ad25a27
/root-2.3.0/run/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/0.29/alpha.air
780ec679edcdb37d605e4a0857aaaacb6da56880
[]
no_license
MizuhaWatanabe/OpenFOAM-2.3.0-with-Ubuntu
3828272d989d45fb020e83f8426b849e75560c62
daeb870be81275e8a81f5cbac4ca1906a9bc69c0
refs/heads/master
2020-05-17T16:36:41.848261
2015-04-18T09:29:48
2015-04-18T09:29:48
34,159,882
1
0
null
null
null
null
UTF-8
C++
false
false
54,588
air
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.29"; object alpha.air; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 6000 ( 0.6001 0.58395 0.583948 0.583946 0.583945 0.583943 0.583943 0.58394 0.58394 0.583938 0.583946 0.63145 0.671972 0.676375 0.671498 0.673845 0.675025 0.669965 0.621135 0.582332 0.582325 0.582326 0.582327 0.582328 0.582329 0.58233 0.582371 0.582371 0.582372 0.599283 0.648025 0.64495 0.625482 0.614511 0.619269 0.620895 0.615661 0.599861 0.592126 0.622266 0.673442 0.674669 0.677656 0.674716 0.67772 0.674852 0.678046 0.674851 0.677751 0.668327 0.614219 0.590499 0.601651 0.616658 0.618715 0.615603 0.608463 0.620589 0.641575 0.645386 0.639763 0.644953 0.642797 0.6333 0.627103 0.622022 0.607724 0.5923 0.592213 0.668609 0.674645 0.676845 0.674672 0.676745 0.674716 0.676786 0.674852 0.676989 0.674716 0.6766 0.659784 0.590589 0.590678 0.609072 0.618944 0.622773 0.626924 0.637042 0.641574 0.633498 0.59962 0.642186 0.638219 0.636449 0.63363 0.628447 0.610818 0.592542 0.616616 0.674573 0.676523 0.674645 0.676741 0.674672 0.676707 0.674716 0.676838 0.674716 0.676752 0.674672 0.675945 0.611084 0.59077 0.609448 0.625011 0.627394 0.627892 0.632609 0.641206 0.589858 0.536045 0.621895 0.617197 0.612841 0.61779 0.61965 0.608514 0.593286 0.64979 0.67596 0.674573 0.676307 0.674645 0.676387 0.674672 0.67644 0.674716 0.67647 0.674672 0.676303 0.674645 0.641972 0.592465 0.602212 0.611923 0.610441 0.605494 0.614981 0.626533 0.528571 0.489753 0.583138 0.591999 0.572579 0.580365 0.608818 0.613099 0.604032 0.671924 0.674543 0.675729 0.674573 0.675757 0.674645 0.675736 0.674672 0.675868 0.674672 0.675865 0.674645 0.675885 0.665189 0.599863 0.600909 0.586734 0.577825 0.578092 0.595742 0.589242 0.488767 0.467605 0.520822 0.558025 0.533664 0.54156 0.618503 0.627974 0.636317 0.674476 0.675354 0.674543 0.67504 0.674573 0.674994 0.674645 0.675057 0.674672 0.675132 0.674645 0.675176 0.674573 0.674873 0.628388 0.61006 0.579162 0.541731 0.552959 0.569895 0.523861 0.466974 0.458982 0.474528 0.51237 0.495727 0.508438 0.637315 0.649531 0.666948 0.674739 0.674476 0.666404 0.658063 0.654947 0.654558 0.654936 0.655154 0.655369 0.656324 0.66012 0.669137 0.675015 0.674543 0.659328 0.629339 0.599446 0.50467 0.509446 0.525523 0.474679 0.456522 0.459959 0.45846 0.470775 0.466725 0.4985 0.635279 0.663264 0.671368 0.671678 0.645644 0.61009 0.589149 0.581223 0.58002 0.580877 0.581312 0.581609 0.584134 0.59397 0.617365 0.651543 0.673859 0.671559 0.649474 0.618782 0.47744 0.470087 0.478733 0.459017 0.457173 0.470099 0.458406 0.458124 0.458437 0.495229 0.606987 0.652723 0.655011 0.624287 0.565709 0.524022 0.505569 0.499652 0.499083 0.499737 0.500071 0.499997 0.501738 0.509204 0.530827 0.57572 0.632121 0.656304 0.643234 0.597948 0.494976 0.455605 0.455893 0.455719 0.464581 0.485094 0.457483 0.458389 0.457553 0.484372 0.555611 0.606182 0.591223 0.530208 0.483526 0.475457 0.475515 0.475212 0.475514 0.475254 0.475515 0.475236 0.475515 0.475269 0.475555 0.489011 0.539216 0.59438 0.600138 0.557699 0.512196 0.456076 0.455225 0.455892 0.478511 0.484697 0.458414 0.457509 0.526213 0.562057 0.54165 0.542084 0.519479 0.475565 0.474195 0.475511 0.47396 0.475509 0.474026 0.47551 0.474112 0.47551 0.474049 0.475509 0.474166 0.475529 0.475142 0.517103 0.534932 0.534508 0.611722 0.585435 0.456052 0.455253 0.477978 0.48467 0.457395 0.49831 0.722095 0.750321 0.605384 0.601479 0.596963 0.571569 0.523897 0.477783 0.475553 0.473997 0.475539 0.474027 0.475538 0.474073 0.475544 0.474083 0.481319 0.521837 0.568694 0.589522 0.596401 0.629148 0.776963 0.731934 0.498389 0.455943 0.477978 0.484685 0.470123 0.611128 0.785734 0.788435 0.786906 0.774314 0.776876 0.773474 0.747187 0.70576 0.652615 0.620799 0.601136 0.593904 0.592902 0.602743 0.619849 0.654829 0.707408 0.746008 0.773731 0.772697 0.777091 0.788171 0.792555 0.778545 0.556646 0.455485 0.477976 0.465693 0.555665 0.64655 0.787275 0.792337 0.788467 0.794662 0.788467 0.793228 0.788435 0.791362 0.788396 0.789557 0.787225 0.786244 0.785484 0.788079 0.788284 0.790135 0.788238 0.792168 0.788188 0.793814 0.788211 0.794483 0.788182 0.788569 0.604858 0.461954 0.477565 0.471518 0.626859 0.62625 0.764588 0.788467 0.794717 0.788493 0.793974 0.788467 0.792693 0.788435 0.791558 0.788398 0.790581 0.788363 0.790253 0.788328 0.790956 0.788287 0.791984 0.788239 0.793149 0.788211 0.794421 0.788211 0.792294 0.785974 0.631361 0.516019 0.461062 0.563051 0.629078 0.616234 0.716866 0.790285 0.788493 0.794623 0.788493 0.793125 0.788467 0.792045 0.788435 0.791054 0.788398 0.79027 0.788363 0.790585 0.788328 0.791465 0.788287 0.792495 0.788239 0.793726 0.788244 0.794052 0.788211 0.761061 0.609898 0.586236 0.461143 0.602341 0.626989 0.614643 0.664262 0.788467 0.793681 0.788493 0.793521 0.788467 0.792415 0.788435 0.791486 0.788398 0.790553 0.788363 0.790216 0.788328 0.790924 0.788287 0.791891 0.788239 0.792871 0.788211 0.794081 0.788211 0.79048 0.719127 0.592346 0.61255 0.531067 0.604553 0.62856 0.614638 0.618071 0.789002 0.788467 0.794017 0.788467 0.792727 0.788435 0.791811 0.788398 0.790898 0.788363 0.790133 0.788328 0.790439 0.788287 0.791299 0.788239 0.79222 0.788188 0.793285 0.788211 0.792926 0.788182 0.675755 0.583898 0.611786 0.582641 0.588786 0.626989 0.619135 0.582008 0.788435 0.7924 0.788467 0.793084 0.788435 0.792105 0.788398 0.791266 0.788363 0.790359 0.788328 0.790026 0.788287 0.790729 0.788239 0.791657 0.788188 0.792504 0.788182 0.793394 0.788182 0.789038 0.635663 0.582124 0.61298 0.587116 0.567257 0.627352 0.618754 0.559358 0.765373 0.788435 0.793614 0.788435 0.792349 0.788398 0.791576 0.788363 0.790661 0.788328 0.789905 0.788287 0.79021 0.788239 0.791055 0.788188 0.791901 0.788149 0.792863 0.788182 0.791573 0.788149 0.597317 0.582182 0.611786 0.575409 0.55186 0.626989 0.597445 0.540007 0.714366 0.791307 0.788435 0.792651 0.788398 0.791789 0.788363 0.790981 0.788328 0.790093 0.788287 0.789829 0.788239 0.790465 0.788188 0.791365 0.788149 0.792132 0.788149 0.792894 0.788149 0.770605 0.565069 0.583726 0.612006 0.560658 0.538807 0.598352 0.576819 0.528457 0.670213 0.788398 0.793056 0.788398 0.791924 0.788363 0.791246 0.788328 0.790358 0.788287 0.78962 0.788239 0.789921 0.788188 0.790748 0.788149 0.791533 0.788111 0.792439 0.788149 0.7903 0.717636 0.537309 0.573729 0.610327 0.547752 0.528046 0.580973 0.571999 0.524131 0.646433 0.790211 0.788398 0.792089 0.788363 0.791368 0.788328 0.790628 0.788287 0.789767 0.788239 0.78959 0.788188 0.790133 0.788149 0.791005 0.788087 0.791692 0.788111 0.792239 0.788111 0.655309 0.519335 0.555954 0.580627 0.534203 0.520313 0.577386 0.572989 0.521237 0.632647 0.788363 0.792164 0.788363 0.791402 0.788328 0.790838 0.788287 0.789987 0.788239 0.789405 0.788188 0.789566 0.788149 0.790371 0.788085 0.791085 0.788087 0.791827 0.788111 0.789255 0.61017 0.513305 0.542442 0.556602 0.521997 0.510503 0.569109 0.572867 0.519433 0.619164 0.789247 0.788363 0.791477 0.788328 0.790874 0.788287 0.790208 0.788239 0.789385 0.788188 0.789233 0.788149 0.789733 0.788085 0.790576 0.788074 0.791148 0.788087 0.791165 0.788087 0.586334 0.512448 0.53487 0.546752 0.513736 0.495005 0.548889 0.565069 0.515291 0.608907 0.788328 0.791214 0.788328 0.790857 0.788287 0.790367 0.788239 0.789552 0.788188 0.78903 0.788149 0.789147 0.788085 0.789923 0.788048 0.790574 0.788074 0.791176 0.788087 0.788371 0.566761 0.512064 0.532465 0.541522 0.507282 0.477276 0.518121 0.547639 0.509202 0.596403 0.788559 0.788328 0.790872 0.788287 0.790328 0.788239 0.789724 0.788188 0.788945 0.788149 0.788812 0.788085 0.789264 0.78804 0.790081 0.788048 0.7906 0.788074 0.790089 0.771665 0.542592 0.512134 0.530378 0.534526 0.499411 0.463012 0.488771 0.525274 0.503674 0.581698 0.78396 0.790301 0.788287 0.790307 0.788239 0.789835 0.788188 0.789057 0.788149 0.788589 0.788085 0.788667 0.78804 0.7894 0.788018 0.789998 0.788048 0.790533 0.788074 0.729308 0.522063 0.516967 0.525158 0.521607 0.487672 0.455063 0.468646 0.498498 0.497896 0.567242 0.767192 0.788287 0.790189 0.788239 0.789746 0.788188 0.789178 0.788149 0.788471 0.788085 0.788336 0.78804 0.788725 0.787985 0.789503 0.788018 0.789994 0.788048 0.788928 0.682536 0.509453 0.516836 0.515578 0.502127 0.473843 0.45198 0.457555 0.476549 0.488603 0.553971 0.742758 0.789239 0.788239 0.789711 0.788188 0.789231 0.788149 0.788522 0.788085 0.788147 0.78804 0.788138 0.787985 0.788802 0.787979 0.789353 0.788018 0.789596 0.788048 0.646657 0.49955 0.510772 0.500703 0.481336 0.46205 0.451828 0.452219 0.461781 0.475065 0.540649 0.714992 0.788239 0.789246 0.788188 0.789115 0.788149 0.788579 0.788085 0.787513 0.783902 0.784036 0.787488 0.788129 0.78796 0.788841 0.787979 0.789263 0.788018 0.785619 0.618494 0.48991 0.498 0.482749 0.465823 0.454424 0.452627 0.452178 0.45354 0.463888 0.532898 0.678375 0.775219 0.788188 0.78895 0.788149 0.788571 0.788085 0.787596 0.781158 0.775987 0.775988 0.781004 0.787339 0.788127 0.787949 0.788609 0.787979 0.788408 0.765699 0.593144 0.480987 0.482696 0.468151 0.456135 0.450582 0.502129 0.452363 0.453582 0.462019 0.529411 0.621227 0.722306 0.784293 0.788149 0.788342 0.788085 0.786482 0.780033 0.771704 0.767838 0.767705 0.771386 0.779547 0.786498 0.788115 0.787949 0.78828 0.786344 0.730819 0.572382 0.473402 0.468824 0.458134 0.451191 0.450331 0.576384 0.532932 0.482478 0.501274 0.524618 0.522806 0.621997 0.752894 0.784156 0.785233 0.782017 0.776069 0.767927 0.761945 0.759274 0.759127 0.761599 0.76738 0.77613 0.782531 0.785538 0.784665 0.762551 0.690466 0.556069 0.467287 0.458819 0.452273 0.450334 0.450323 0.577962 0.577812 0.545841 0.509469 0.497556 0.482491 0.517315 0.690599 0.761122 0.769692 0.765721 0.760403 0.754968 0.751109 0.748994 0.74888 0.75078 0.754391 0.760213 0.766036 0.769896 0.761813 0.717884 0.647793 0.539224 0.464948 0.453986 0.450357 0.450356 0.450421 0.577962 0.571524 0.547726 0.497174 0.477169 0.473941 0.488607 0.618947 0.721675 0.744477 0.745101 0.743315 0.740484 0.737626 0.735896 0.735802 0.737309 0.739713 0.742626 0.744253 0.743159 0.721027 0.666032 0.600417 0.516725 0.47617 0.455765 0.451247 0.46375 0.508127 0.561872 0.541424 0.515872 0.480393 0.470837 0.470793 0.48308 0.570355 0.676179 0.713256 0.721646 0.723446 0.722471 0.7203 0.71906 0.718903 0.719907 0.721282 0.721997 0.719176 0.709107 0.671332 0.615098 0.557149 0.499921 0.482358 0.469268 0.464411 0.572321 0.59969 0.525785 0.510254 0.486968 0.472383 0.468757 0.471331 0.491205 0.541066 0.63001 0.67549 0.692761 0.698452 0.699601 0.698552 0.697901 0.69752 0.697797 0.697741 0.695737 0.687868 0.666668 0.619433 0.573231 0.532992 0.500077 0.481473 0.472782 0.522194 0.622217 0.600409 0.498113 0.489948 0.475979 0.47038 0.468777 0.475796 0.509021 0.53191 0.58936 0.633253 0.657568 0.667895 0.672138 0.672925 0.67286 0.672144 0.671389 0.66928 0.663266 0.649254 0.619084 0.576935 0.552083 0.530342 0.503383 0.484403 0.473587 0.55867 0.622234 0.571636 0.481713 0.478731 0.472609 0.471683 0.472344 0.488843 0.519305 0.537432 0.566464 0.595874 0.621136 0.635392 0.642996 0.645966 0.646445 0.645493 0.643475 0.638896 0.628496 0.609725 0.58067 0.558513 0.55107 0.534277 0.502472 0.49138 0.473647 0.563878 0.622217 0.54659 0.471191 0.471557 0.470779 0.472936 0.476931 0.512108 0.528857 0.554969 0.564649 0.575479 0.593953 0.608492 0.617713 0.622228 0.623196 0.622333 0.619239 0.612653 0.600056 0.582689 0.565291 0.560476 0.557615 0.539714 0.499654 0.490516 0.481412 0.568903 0.601193 0.530549 0.463924 0.465892 0.468002 0.470263 0.475375 0.525177 0.544261 0.573561 0.570354 0.572511 0.581917 0.592776 0.600803 0.60545 0.606791 0.606331 0.602842 0.595795 0.584974 0.57432 0.566111 0.571414 0.568886 0.540322 0.495021 0.489662 0.520707 0.565764 0.567548 0.516598 0.458182 0.460942 0.464582 0.465479 0.47146 0.524701 0.556656 0.578034 0.578091 0.57469 0.579821 0.586042 0.591344 0.595031 0.596592 0.596577 0.593439 0.58773 0.581465 0.575413 0.573151 0.577999 0.574026 0.535336 0.490028 0.489652 0.540942 0.551538 0.548399 0.506294 0.453757 0.456478 0.46099 0.462804 0.472905 0.518983 0.557426 0.57766 0.57819 0.578254 0.579543 0.582663 0.585036 0.587287 0.588837 0.589062 0.587017 0.583922 0.581475 0.578187 0.578125 0.578063 0.571861 0.522777 0.487012 0.496804 0.540939 0.529273 0.535201 0.497328 0.452961 0.453091 0.456858 0.462039 0.483257 0.512414 0.548485 0.569532 0.577922 0.577637 0.576895 0.577794 0.578011 0.578909 0.580076 0.580161 0.579577 0.579186 0.579446 0.577878 0.578063 0.577999 0.560413 0.506903 0.486987 0.50681 0.539307 0.504144 0.513743 0.48552 0.452956 0.45296 0.453529 0.461747 0.496562 0.511999 0.52892 0.548495 0.568029 0.56984 0.567297 0.567361 0.567076 0.567078 0.567613 0.567527 0.568163 0.5695 0.570559 0.571193 0.574371 0.570392 0.537319 0.495751 0.487082 0.519913 0.538283 0.484463 0.486865 0.4727 0.453005 0.452974 0.454399 0.470292 0.5056 0.512058 0.513418 0.522425 0.544218 0.551236 0.550097 0.550596 0.551606 0.551693 0.551814 0.551924 0.55299 0.55403 0.553699 0.555319 0.558144 0.545322 0.511825 0.494363 0.501035 0.534142 0.535422 0.475951 0.468455 0.464001 0.487186 0.458315 0.464612 0.488582 0.502636 0.510456 0.511346 0.50998 0.518905 0.529227 0.532316 0.533479 0.535928 0.536966 0.537198 0.537614 0.538314 0.537732 0.535755 0.536591 0.533708 0.51571 0.498664 0.494341 0.523297 0.5342 0.525259 0.473553 0.46384 0.463829 0.547548 0.48808 0.473808 0.489485 0.492739 0.504728 0.510523 0.509948 0.51072 0.517373 0.522646 0.524372 0.52661 0.528212 0.528641 0.528985 0.528975 0.527315 0.525085 0.523843 0.515943 0.503172 0.498565 0.498402 0.534292 0.532543 0.504921 0.473815 0.463855 0.463853 0.566252 0.528525 0.475679 0.482208 0.485717 0.495532 0.505661 0.510105 0.512122 0.517068 0.521601 0.523545 0.525121 0.526304 0.5266 0.526536 0.525975 0.524357 0.522715 0.519877 0.512553 0.505026 0.498587 0.506585 0.534219 0.524714 0.486861 0.476558 0.499311 0.512078 0.579936 0.570608 0.476507 0.476608 0.481665 0.486854 0.496273 0.509598 0.513841 0.518242 0.522068 0.52386 0.525207 0.526014 0.526151 0.52587 0.525245 0.524069 0.522935 0.519999 0.513791 0.51095 0.505648 0.518699 0.534405 0.5173 0.483855 0.477839 0.55671 0.56192 0.6022 0.615718 0.481186 0.476645 0.478507 0.48122 0.488227 0.504591 0.51168 0.517443 0.52144 0.522907 0.523731 0.524117 0.52413 0.523739 0.523257 0.522697 0.522309 0.519663 0.514978 0.514037 0.512263 0.534042 0.534219 0.510152 0.485206 0.481643 0.562177 0.562183 0.62908 0.63062 0.525742 0.47669 0.476727 0.479182 0.484985 0.498009 0.506276 0.512441 0.51698 0.518343 0.518533 0.518589 0.518628 0.518325 0.518133 0.51821 0.518695 0.516828 0.51375 0.513164 0.514428 0.534219 0.534356 0.504247 0.486221 0.493826 0.562182 0.558428 0.630621 0.630621 0.596608 0.476746 0.476776 0.480308 0.485042 0.497736 0.505321 0.506856 0.510036 0.511606 0.511844 0.511792 0.511874 0.511754 0.511763 0.512029 0.512654 0.511736 0.51055 0.511247 0.516353 0.534439 0.534219 0.501004 0.487165 0.503238 0.561736 0.54754 0.630618 0.630621 0.630616 0.511066 0.476825 0.483841 0.488262 0.501318 0.510971 0.508451 0.508628 0.508858 0.508966 0.508989 0.509011 0.509033 0.509055 0.509082 0.509102 0.509102 0.509102 0.511219 0.521095 0.534219 0.533795 0.497298 0.48686 0.49702 0.53703 0.535647 0.627203 0.628977 0.630617 0.597312 0.488054 0.483697 0.494662 0.50672 0.521779 0.518984 0.509579 0.508892 0.508927 0.508964 0.509001 0.509039 0.509078 0.509102 0.509102 0.509102 0.509102 0.514269 0.52817 0.534293 0.523797 0.491542 0.486253 0.485814 0.501022 0.522074 0.596201 0.605954 0.614533 0.613208 0.54398 0.483718 0.493504 0.508579 0.52655 0.526666 0.519822 0.513891 0.511218 0.511335 0.512309 0.512687 0.512434 0.511609 0.509947 0.509648 0.515409 0.521604 0.532067 0.534194 0.503973 0.486434 0.485054 0.484694 0.480926 0.507389 0.547097 0.578092 0.576276 0.612961 0.59185 0.4842 0.486081 0.508126 0.526666 0.526785 0.526615 0.525067 0.521807 0.519379 0.51969 0.520159 0.520346 0.520315 0.51922 0.519481 0.524993 0.528752 0.532053 0.527768 0.489885 0.485217 0.485065 0.49742 0.479034 0.497829 0.511263 0.567587 0.540664 0.604658 0.595851 0.500309 0.484364 0.504821 0.526676 0.52668 0.526725 0.52669 0.526597 0.525774 0.524411 0.524796 0.525244 0.526223 0.527503 0.528579 0.530185 0.531405 0.532039 0.515646 0.488769 0.490782 0.484861 0.516095 0.479142 0.496303 0.502859 0.56748 0.529398 0.571825 0.588101 0.535878 0.48438 0.496546 0.526531 0.526775 0.526694 0.526726 0.526693 0.526726 0.525913 0.52592 0.526391 0.52761 0.529635 0.53102 0.531325 0.531394 0.530736 0.508238 0.488746 0.509888 0.485091 0.519304 0.500385 0.504605 0.502859 0.567568 0.529452 0.529642 0.575298 0.569772 0.484367 0.487204 0.523553 0.526694 0.526733 0.526698 0.526696 0.526704 0.526645 0.526071 0.526431 0.527543 0.529476 0.530891 0.531375 0.531386 0.527859 0.508914 0.505598 0.530705 0.484825 0.52274 0.542038 0.517532 0.50721 0.567406 0.539686 0.512489 0.568084 0.570224 0.496629 0.486969 0.515675 0.526725 0.526698 0.526725 0.526694 0.526734 0.5267 0.526201 0.526401 0.527232 0.528629 0.52987 0.531062 0.531008 0.525616 0.514192 0.536779 0.536682 0.488738 0.529606 0.542701 0.520349 0.531872 0.567584 0.556195 0.512533 0.564191 0.570683 0.539334 0.486977 0.506988 0.526255 0.526716 0.526704 0.526709 0.52671 0.526726 0.5266 0.526434 0.526894 0.527448 0.528208 0.529843 0.529395 0.524329 0.519554 0.536934 0.534627 0.514413 0.524904 0.542038 0.518416 0.547564 0.567341 0.564001 0.516222 0.558058 0.570225 0.57063 0.497676 0.504878 0.522308 0.526691 0.526716 0.52671 0.52673 0.526716 0.526717 0.526662 0.526774 0.526651 0.527145 0.528349 0.52727 0.522887 0.520067 0.537265 0.526371 0.532871 0.504059 0.542285 0.513852 0.547263 0.567433 0.562623 0.518433 0.546859 0.570591 0.570225 0.523115 0.504949 0.516604 0.525089 0.52671 0.526723 0.526716 0.526729 0.526722 0.526724 0.526768 0.526455 0.526997 0.527408 0.525676 0.521648 0.520495 0.536934 0.517015 0.53578 0.484568 0.525594 0.507126 0.539143 0.564123 0.551972 0.514981 0.53322 0.570225 0.57081 0.54364 0.506578 0.514543 0.522504 0.526526 0.52671 0.526729 0.526716 0.526719 0.526718 0.526765 0.526458 0.526991 0.526703 0.524344 0.521653 0.526583 0.537218 0.516957 0.535842 0.484532 0.499432 0.498842 0.528408 0.547121 0.532749 0.506497 0.518181 0.570332 0.570225 0.557272 0.518088 0.516011 0.521437 0.525677 0.526709 0.52671 0.526721 0.526716 0.52672 0.526744 0.526567 0.526971 0.52562 0.522901 0.521659 0.537051 0.536934 0.517007 0.534036 0.484566 0.488594 0.491261 0.526023 0.53315 0.517175 0.499749 0.499187 0.564706 0.570623 0.568084 0.535238 0.521196 0.521879 0.524907 0.526696 0.526715 0.52671 0.526713 0.526708 0.526709 0.526702 0.526705 0.524013 0.521899 0.521666 0.536934 0.53719 0.519076 0.526074 0.49942 0.486816 0.485004 0.527224 0.533006 0.508954 0.489272 0.480956 0.544406 0.570225 0.57038 0.546123 0.527908 0.523646 0.524904 0.526678 0.526704 0.52671 0.526705 0.526699 0.526721 0.526713 0.526019 0.52267 0.521665 0.521657 0.537192 0.536934 0.526464 0.519069 0.513268 0.482141 0.477387 0.530588 0.532853 0.497083 0.474164 0.472223 0.515668 0.56903 0.570225 0.54941 0.532078 0.526127 0.525222 0.526544 0.526703 0.526704 0.526694 0.52668 0.526728 0.526653 0.525179 0.522429 0.521671 0.527552 0.536934 0.537194 0.532554 0.517233 0.510616 0.472587 0.468361 0.530504 0.529168 0.479483 0.463985 0.471937 0.49262 0.555552 0.568447 0.549286 0.533514 0.527908 0.525857 0.52649 0.526698 0.5267 0.526669 0.526674 0.526733 0.52646 0.524784 0.52315 0.521679 0.536933 0.537167 0.536934 0.532205 0.51588 0.50166 0.464541 0.464005 0.530419 0.504677 0.464887 0.463956 0.479189 0.481521 0.528081 0.558247 0.547163 0.533893 0.528724 0.526469 0.526532 0.526693 0.526693 0.526598 0.5267 0.526735 0.526337 0.525039 0.525684 0.526423 0.537102 0.536934 0.537013 0.526937 0.511754 0.49221 0.464014 0.463996 0.51983 0.478629 0.463256 0.464558 0.487904 0.481224 0.504011 0.541132 0.541909 0.53359 0.528899 0.526778 0.526589 0.526688 0.526689 0.526519 0.526716 0.526734 0.526445 0.52613 0.529007 0.533297 0.536934 0.536999 0.533607 0.515864 0.50542 0.491286 0.464014 0.46402 0.488087 0.465988 0.463184 0.4957 0.498471 0.481237 0.49539 0.523339 0.53426 0.53173 0.52844 0.52662 0.526538 0.526682 0.526684 0.526491 0.526725 0.526738 0.526742 0.527369 0.530713 0.53587 0.537001 0.535661 0.520659 0.50582 0.502274 0.492043 0.464767 0.50462 0.465227 0.462803 0.463123 0.526283 0.522919 0.493284 0.495336 0.511583 0.52571 0.527616 0.526407 0.525502 0.52595 0.526575 0.526676 0.526489 0.52673 0.526734 0.526678 0.527337 0.530226 0.534855 0.536308 0.527572 0.507138 0.502797 0.502704 0.491567 0.514138 0.603816 0.462797 0.462809 0.481136 0.527315 0.540426 0.526891 0.504443 0.509 0.518553 0.522492 0.523064 0.523291 0.524425 0.52577 0.526514 0.526479 0.526616 0.526357 0.525514 0.525776 0.527212 0.529873 0.528344 0.516846 0.506935 0.506807 0.504091 0.491726 0.55 0.625925 0.462812 0.46283 0.495077 0.517458 0.540963 0.540882 0.52629 0.509051 0.514794 0.519158 0.520737 0.521535 0.52278 0.524572 0.526073 0.526427 0.526095 0.524776 0.522956 0.522398 0.52185 0.521465 0.517064 0.513848 0.512033 0.524133 0.502268 0.49129 0.57733 0.625911 0.496123 0.488549 0.494618 0.505745 0.540882 0.541031 0.540882 0.511157 0.51513 0.519074 0.520895 0.521624 0.522444 0.523996 0.525741 0.526322 0.52532 0.523063 0.521025 0.519965 0.51821 0.5154 0.514215 0.513938 0.53346 0.538408 0.49612 0.491727 0.603787 0.625735 0.586403 0.58139 0.507506 0.505033 0.535169 0.540882 0.541157 0.521677 0.51988 0.521899 0.523537 0.523774 0.523441 0.524233 0.525722 0.526217 0.524896 0.522839 0.521318 0.520506 0.518717 0.514906 0.514262 0.5225 0.541246 0.539243 0.496135 0.500288 0.62514 0.625632 0.594181 0.594056 0.571409 0.505039 0.522028 0.540925 0.540882 0.537259 0.529187 0.528467 0.528779 0.528144 0.526345 0.525402 0.525839 0.526162 0.525033 0.523913 0.523957 0.524188 0.523077 0.518462 0.514337 0.540336 0.541114 0.531839 0.49615 0.572602 0.625086 0.624775 0.575047 0.594284 0.593945 0.507902 0.513429 0.540603 0.541147 0.540882 0.536349 0.534338 0.532932 0.531591 0.529353 0.527163 0.526112 0.526171 0.525812 0.5267 0.528591 0.529996 0.530383 0.527576 0.526801 0.541114 0.541223 0.516475 0.502439 0.624904 0.625033 0.600023 0.528308 0.593946 0.594273 0.530213 0.51344 0.536298 0.540882 0.540981 0.537832 0.536189 0.533975 0.532415 0.530418 0.528305 0.526507 0.526301 0.527038 0.529207 0.531663 0.533459 0.535076 0.535785 0.541114 0.541343 0.541114 0.512603 0.516257 0.624861 0.62186 0.553125 0.49985 0.593943 0.593843 0.559659 0.513453 0.526256 0.54099 0.540882 0.536725 0.535574 0.533392 0.531947 0.530269 0.528535 0.527057 0.526598 0.527896 0.529931 0.532049 0.533771 0.535801 0.538163 0.541255 0.541114 0.535413 0.512675 0.545601 0.624818 0.615114 0.523318 0.513996 0.58762 0.593903 0.570698 0.513467 0.517203 0.540882 0.54088 0.533506 0.532958 0.531259 0.530232 0.529382 0.528371 0.527451 0.526951 0.528108 0.529755 0.531422 0.532886 0.534946 0.537902 0.541114 0.541159 0.521702 0.512441 0.571519 0.622393 0.607553 0.540948 0.570729 0.585519 0.588321 0.559517 0.513779 0.515927 0.537211 0.538774 0.53075 0.529673 0.528842 0.528323 0.528112 0.527876 0.527408 0.52717 0.528028 0.528998 0.529754 0.530585 0.532235 0.536303 0.54116 0.539634 0.519258 0.512676 0.57066 0.615678 0.604608 0.59187 0.604385 0.5907 0.580596 0.539036 0.511827 0.518473 0.530317 0.535441 0.530254 0.528443 0.528152 0.527857 0.527694 0.527543 0.527282 0.52724 0.527866 0.52822 0.528436 0.528792 0.529746 0.533699 0.539732 0.534285 0.519522 0.517023 0.568365 0.608815 0.607677 0.613082 0.604385 0.598688 0.576628 0.541738 0.50815 0.506769 0.518322 0.53224 0.530206 0.528755 0.528651 0.528278 0.528008 0.527739 0.527351 0.52738 0.527927 0.528257 0.528537 0.528984 0.529605 0.531394 0.5331 0.51675 0.506522 0.527772 0.572067 0.599606 0.611636 0.612894 0.604385 0.599979 0.571456 0.546037 0.507842 0.485893 0.496189 0.524424 0.530102 0.529844 0.529835 0.529555 0.528931 0.528476 0.527879 0.52788 0.528388 0.528844 0.529429 0.529588 0.529596 0.529343 0.516875 0.489772 0.489933 0.526324 0.567412 0.587984 0.60993 0.612789 0.604256 0.592229 0.560102 0.534867 0.495376 0.473273 0.476755 0.511524 0.529227 0.529835 0.529828 0.529819 0.529721 0.529308 0.528781 0.528673 0.529078 0.529526 0.52957 0.529579 0.529549 0.525549 0.498958 0.472832 0.476502 0.50526 0.545053 0.570167 0.598918 0.612789 0.603928 0.571327 0.535869 0.504142 0.47551 0.466093 0.468571 0.500151 0.526778 0.528611 0.528895 0.529075 0.529064 0.529088 0.528963 0.528836 0.528845 0.528824 0.528651 0.52836 0.527762 0.521033 0.488071 0.466568 0.466909 0.477655 0.506142 0.540039 0.576134 0.612759 0.597511 0.540329 0.501221 0.475119 0.463314 0.462986 0.466706 0.492798 0.522256 0.523229 0.523829 0.524413 0.525142 0.526563 0.527558 0.527441 0.526319 0.524961 0.524008 0.523196 0.522267 0.516556 0.483017 0.464942 0.462715 0.463232 0.474469 0.500708 0.542417 0.602716 0.566409 0.504722 0.473864 0.461596 0.460075 0.462802 0.467918 0.489722 0.516338 0.516447 0.51687 0.517388 0.518498 0.520892 0.522852 0.522809 0.520862 0.518695 0.51734 0.516307 0.515438 0.512479 0.481542 0.465477 0.462516 0.459565 0.46071 0.472084 0.503389 0.565697 0.521449 0.476324 0.460518 0.457673 0.46003 0.464891 0.472903 0.490526 0.51336 0.514875 0.51495 0.515043 0.515256 0.515855 0.517172 0.51723 0.516361 0.515563 0.515194 0.515028 0.514928 0.511861 0.482262 0.467833 0.464162 0.459504 0.456853 0.459135 0.474275 0.517923 0.484196 0.45999 0.454768 0.457089 0.46258 0.470081 0.484916 0.499903 0.520413 0.527369 0.525261 0.523239 0.520611 0.51808 0.517425 0.51749 0.518629 0.521484 0.523704 0.525657 0.527191 0.519593 0.495284 0.475511 0.467291 0.461463 0.456179 0.453754 0.458696 0.481619 0.460546 0.451197 0.450836 0.455394 0.462413 0.474427 0.507377 0.531175 0.544188 0.55002 0.549297 0.548116 0.54387 0.534336 0.527108 0.52722 0.534088 0.543005 0.54752 0.54941 0.549841 0.542433 0.531963 0.496862 0.469127 0.460999 0.454514 0.450071 0.45042 0.459307 0.448409 0.447156 0.447326 0.45233 0.459099 0.475704 0.531972 0.550038 0.550294 0.550038 0.550296 0.550038 0.550298 0.550038 0.546951 0.546944 0.55028 0.550038 0.550215 0.550038 0.550212 0.550038 0.550206 0.523593 0.469499 0.457734 0.451722 0.446873 0.446823 0.447854 0.447131 0.447125 0.447174 0.453177 0.456473 0.479568 0.54418 0.550216 0.550038 0.550202 0.550038 0.550296 0.550038 0.550296 0.550038 0.550294 0.550038 0.55028 0.550038 0.550189 0.550038 0.550197 0.550038 0.537059 0.472027 0.455297 0.452878 0.446846 0.446797 0.446802 0.447127 0.447173 0.451888 0.461456 0.459962 0.48868 0.53962 0.545494 0.549741 0.549358 0.550133 0.550038 0.55017 0.550038 0.550154 0.550038 0.550159 0.550038 0.550164 0.549935 0.549195 0.54947 0.544954 0.533814 0.480682 0.458493 0.46188 0.451913 0.446855 0.446798 0.44719 0.45478 0.465379 0.47136 0.470625 0.488541 0.514194 0.518573 0.52831 0.529802 0.531939 0.534118 0.535887 0.538438 0.540447 0.540408 0.538345 0.53598 0.534236 0.532033 0.529909 0.527981 0.517528 0.510852 0.482907 0.468767 0.469815 0.465964 0.457719 0.446888 0.460252 0.557641 0.486883 0.471366 0.471343 0.478397 0.483538 0.485161 0.492449 0.496936 0.499586 0.50316 0.506959 0.512199 0.516368 0.516287 0.512178 0.507394 0.503761 0.500168 0.49737 0.492527 0.4845 0.482188 0.47599 0.469705 0.469814 0.488052 0.564036 0.468729 0.592582 0.648634 0.570743 0.480733 0.471367 0.471379 0.471408 0.471491 0.476405 0.479857 0.482239 0.4857 0.489479 0.494199 0.497632 0.497522 0.494093 0.489715 0.486092 0.482626 0.480095 0.476782 0.470705 0.469827 0.46977 0.469746 0.481805 0.572013 0.649909 0.601119 0.66484 0.661913 0.661302 0.578842 0.488954 0.471418 0.471421 0.471465 0.481385 0.484255 0.486468 0.489221 0.49187 0.495089 0.497297 0.497174 0.494917 0.491912 0.489345 0.486643 0.484335 0.481751 0.472325 0.469843 0.469831 0.490592 0.57858 0.656708 0.660625 0.664981 0.665643 0.657386 0.660991 0.66189 0.597939 0.506591 0.473876 0.484165 0.49723 0.501568 0.50377 0.504959 0.505414 0.505649 0.505701 0.505573 0.505407 0.505133 0.504634 0.503508 0.501368 0.497271 0.485852 0.476126 0.509435 0.597551 0.659843 0.662576 0.656431 0.665302 0.665498 0.654306 0.662127 0.660991 0.66155 0.597064 0.520732 0.500966 0.507361 0.512846 0.515636 0.516415 0.516342 0.515535 0.514896 0.514801 0.515306 0.515943 0.516003 0.515207 0.512575 0.507462 0.501685 0.521883 0.596131 0.6607 0.662727 0.662661 0.655151 0.665302 0.665343 0.654404 0.660991 0.66219 0.660991 0.628294 0.555412 0.510499 0.507979 0.511931 0.514711 0.515697 0.515766 0.515227 0.514818 0.514754 0.515054 0.515446 0.515364 0.514402 0.511769 0.508116 0.510182 0.552554 0.623331 0.662651 0.662785 0.662811 0.655126 0.665266 0.665343 0.660205 0.661481 0.660991 0.661207 0.625189 0.562324 0.516455 0.508057 0.509481 0.511484 0.512526 0.512839 0.512868 0.512862 0.512829 0.512797 0.512765 0.512447 0.511478 0.509602 0.508193 0.515675 0.558762 0.620156 0.662079 0.662811 0.662959 0.662441 0.665076 0.665343 0.660072 0.660991 0.661839 0.659352 0.61407 0.560549 0.525082 0.511373 0.512383 0.513219 0.513696 0.514143 0.514435 0.514646 0.514677 0.514575 0.514283 0.513869 0.513462 0.512711 0.511748 0.524127 0.557549 0.610024 0.657555 0.662959 0.663107 0.663621 0.664682 0.665106 0.652248 0.655213 0.660977 0.652002 0.601799 0.55597 0.535864 0.525996 0.525736 0.524905 0.524358 0.524957 0.525989 0.526627 0.526639 0.526272 0.525307 0.524826 0.525384 0.526132 0.526289 0.53492 0.554374 0.600249 0.650445 0.662811 0.656007 0.657076 0.664218 0.663201 0.637018 0.62832 0.649661 0.634864 0.589152 0.551484 0.544305 0.542675 0.542775 0.542205 0.541566 0.541889 0.542679 0.543145 0.543081 0.542773 0.542027 0.541884 0.542527 0.542952 0.542611 0.543439 0.551382 0.589868 0.633916 0.648121 0.62952 0.642306 0.66055 0.651992 0.612141 0.581393 0.60197 0.598189 0.571798 0.548988 0.548062 0.548048 0.548035 0.54802 0.548006 0.547989 0.547975 0.547957 0.547941 0.547923 0.547906 0.547886 0.547868 0.547848 0.547829 0.547837 0.549202 0.573043 0.596328 0.59688 0.584994 0.61804 0.653814 0.622203 0.572615 0.533333 0.538059 0.547693 0.549192 0.547366 0.548047 0.548035 0.54802 0.548006 0.547989 0.547975 0.547957 0.547941 0.547923 0.547906 0.547886 0.547868 0.547847 0.547829 0.547821 0.547828 0.547088 0.548633 0.543389 0.529411 0.538551 0.581658 0.633222 0.569914 0.524102 0.503285 0.507625 0.507965 0.529576 0.543054 0.546676 0.546775 0.546661 0.546574 0.546739 0.546765 0.546668 0.546524 0.546496 0.546622 0.546763 0.546499 0.546379 0.546417 0.54644 0.546209 0.5423 0.5262 0.500977 0.494857 0.502767 0.534273 0.588063 0.513287 0.488363 0.498152 0.503624 0.50356 0.52251 0.536863 0.541627 0.541991 0.541882 0.542091 0.542938 0.54305 0.542666 0.542214 0.542228 0.54267 0.54328 0.542411 0.541945 0.542006 0.54177 0.541122 0.536024 0.518115 0.491326 0.491904 0.484949 0.492019 0.529404 0.480499 0.480146 0.503843 0.505681 0.504317 0.525938 0.536514 0.539837 0.541092 0.541802 0.542581 0.542918 0.542982 0.542914 0.542652 0.542806 0.543127 0.54321 0.542985 0.542526 0.542431 0.54205 0.540547 0.536186 0.522801 0.491389 0.49515 0.482985 0.471832 0.486234 0.471167 0.480092 0.502355 0.515985 0.525281 0.53287 0.538194 0.541559 0.542526 0.542717 0.542786 0.542849 0.54277 0.542507 0.542199 0.542432 0.542621 0.542862 0.542914 0.542811 0.542734 0.542612 0.542231 0.538114 0.531871 0.512771 0.505498 0.488466 0.468388 0.467069 0.471058 0.491987 0.495967 0.516189 0.530379 0.531223 0.53457 0.535983 0.53466 0.532729 0.530502 0.528487 0.527194 0.526325 0.525702 0.525664 0.525806 0.526569 0.527536 0.528656 0.53049 0.532762 0.534926 0.533524 0.530547 0.527909 0.507884 0.486663 0.472348 0.463989 0.473816 0.492068 0.490239 0.505695 0.51571 0.513307 0.512525 0.510014 0.506095 0.501973 0.498003 0.494839 0.493258 0.492171 0.491488 0.49097 0.491245 0.492009 0.49328 0.494836 0.497878 0.502083 0.506933 0.509955 0.511786 0.513006 0.497414 0.480711 0.479241 0.465754 0.494604 0.488163 0.483693 0.486982 0.487637 0.484176 0.481972 0.479844 0.478701 0.478581 0.47865 0.4784 0.478653 0.478336 0.478653 0.478297 0.478651 0.478319 0.478649 0.478392 0.478647 0.478582 0.478796 0.480163 0.481866 0.48432 0.481295 0.478603 0.481677 0.490936 0.553286 0.482711 0.478658 0.478648 0.478539 0.478647 0.478365 0.478646 0.478106 0.478648 0.47807 0.478651 0.47807 0.478657 0.478078 0.478658 0.478089 0.478655 0.478086 0.478649 0.478085 0.478645 0.478152 0.478643 0.47839 0.478644 0.478513 0.478644 0.481641 0.565272 0.591355 0.486706 0.478648 0.478486 0.478646 0.477975 0.478646 0.477964 0.478654 0.484748 0.496824 0.505628 0.513031 0.518083 0.525759 0.531376 0.528194 0.522707 0.517078 0.50863 0.498384 0.486151 0.478651 0.478071 0.478643 0.478133 0.478643 0.478279 0.500935 0.617863 0.591329 0.511828 0.478509 0.478646 0.478004 0.478646 0.477969 0.50422 0.539065 0.562609 0.57283 0.578144 0.579754 0.581323 0.581933 0.582351 0.581971 0.581891 0.581062 0.579493 0.574312 0.565329 0.533508 0.494605 0.478078 0.478643 0.47814 0.478654 0.552341 0.617828 0.591293 0.540919 0.490513 0.478463 0.478646 0.477972 0.53608 0.576545 0.582313 0.582018 0.582593 0.582018 0.582557 0.582018 0.582566 0.582018 0.582574 0.582018 0.582683 0.582018 0.582716 0.582018 0.582273 0.571272 0.513066 0.478087 0.478647 0.50889 0.583014 0.61777 0.590963 0.54452 0.516615 0.487933 0.477981 0.537355 0.581919 0.582248 0.582018 0.582339 0.582018 0.582351 0.582018 0.582256 0.582018 0.582249 0.582018 0.582259 0.582018 0.582426 0.582018 0.582503 0.582018 0.582353 0.577424 0.497464 0.479974 0.536535 0.578436 0.617388 0.546398 0.516821 0.513309 0.497594 0.517636 0.574133 0.58108 0.580208 0.581798 0.582018 0.582071 0.582018 0.582039 0.581744 0.582069 0.58136 0.581201 0.581829 0.582101 0.582018 0.582135 0.582018 0.582097 0.582018 0.582115 0.547937 0.496689 0.527694 0.537075 0.570397 0.473874 0.478444 0.489529 0.491592 0.528714 0.559986 0.557711 0.55757 0.562317 0.563692 0.56359 0.564553 0.562953 0.562871 0.565943 0.561362 0.561292 0.562132 0.567494 0.567421 0.568857 0.571361 0.566263 0.565829 0.565959 0.542316 0.493715 0.497547 0.487072 0.48542 0.471431 0.482244 0.482465 0.48242 0.516434 0.553554 0.563007 0.57048 0.581199 0.581498 0.578406 0.583654 0.591874 0.604417 0.60939 0.600116 0.596002 0.591138 0.589368 0.579115 0.579771 0.585034 0.577539 0.566045 0.546758 0.509895 0.481559 0.480527 0.479821 0.473157 0.602209 0.62666 0.554469 0.556364 0.610847 0.68222 0.712866 0.731431 0.755245 0.757637 0.749031 0.76372 0.786498 0.804773 0.817711 0.807028 0.786954 0.78589 0.771631 0.744049 0.745736 0.748615 0.728163 0.692105 0.651183 0.579102 0.527984 0.524117 0.582355 0.574477 0.868886 0.877845 0.815736 0.815664 0.87108 0.912476 0.923168 0.925741 0.944888 0.948542 0.941094 0.953275 0.961103 0.960528 0.972141 0.969388 0.951375 0.960165 0.956655 0.938734 0.944732 0.943561 0.924138 0.895645 0.882588 0.834543 0.766479 0.766592 0.829605 0.849757 0.98082 0.982932 0.973126 0.973517 0.988994 0.992902 0.992522 0.989374 0.995075 0.99607 0.994537 0.996624 0.996762 0.995613 0.998415 0.998175 0.99301 0.996925 0.997364 0.994167 0.995875 0.995605 0.990335 0.983767 0.986883 0.981742 0.961676 0.960844 0.970878 0.980631 0.997256 0.996925 0.996616 0.997147 0.999366 0.999324 0.999145 0.997989 0.999244 0.999247 0.99925 0.999257 0.99926 0.999294 0.999418 0.99942 0.997958 0.999579 0.999577 0.999526 0.999572 0.999511 0.998353 0.998424 0.999126 0.999065 0.9971 0.995797 0.996079 0.998192 0.997925 0.997204 0.997357 0.998974 0.999366 0.999304 0.999295 0.999103 0.999242 0.999246 0.999249 0.999252 0.999189 0.999418 0.99942 0.999421 0.998764 0.999577 0.999579 0.999577 0.999579 0.999555 0.998608 0.999134 0.999133 0.999134 0.99881 0.997551 0.997386 0.998524 0.99793 0.997199 0.997822 0.998933 0.999071 0.999188 0.999302 0.999308 0.999113 0.999229 0.999227 0.999218 0.999187 0.999419 0.999421 0.999423 0.999251 0.999578 0.999577 0.999579 0.999566 0.999449 0.998603 0.999133 0.999134 0.999133 0.998749 0.997629 0.997631 0.99841 0.998014 0.997587 0.998353 0.998592 0.998793 0.999181 0.999308 0.999212 0.999048 0.999151 0.999218 0.999233 0.999278 0.999421 0.999423 0.999424 0.999426 0.999576 0.999578 0.999577 0.999419 0.999247 0.998618 0.999041 0.999114 0.999027 0.998526 0.997639 0.998003 0.998668 0.998146 0.997628 0.998202 0.998577 0.998849 0.999214 0.999301 0.999143 0.999048 0.999132 0.99921 0.99927 0.999376 0.999421 0.999422 0.999424 0.999417 0.999562 0.999576 0.999546 0.999196 0.999041 0.998643 0.998951 0.999035 0.998906 0.998309 0.997727 0.998109 0.998772 0.998146 0.997453 0.997958 0.998854 0.999024 0.999184 0.999244 0.999194 0.999124 0.999153 0.999178 0.999237 0.999345 0.999421 0.999422 0.999422 0.999341 0.999507 0.999578 0.999538 0.999161 0.99897 0.998804 0.999015 0.999032 0.998952 0.998432 0.997885 0.998077 0.998714 0.998107 0.99745 0.997794 0.99894 0.999201 0.99924 0.999245 0.999193 0.99916 0.999151 0.999106 0.999081 0.999252 0.999384 0.999421 0.99934 0.999339 0.999483 0.999576 0.999576 0.999285 0.999087 0.999104 0.999188 0.999065 0.998894 0.998691 0.998404 0.998222 0.998553 0.998128 0.997507 0.998301 0.999143 0.999181 0.999211 0.999172 0.999056 0.999077 0.999072 0.998943 0.99891 0.999027 0.999216 0.999369 0.999342 0.999363 0.999505 0.999574 0.999575 0.999454 0.999353 0.999491 0.999277 0.99905 0.998722 0.99851 0.998733 0.998731 0.99876 0.998615 0.998532 0.998897 0.999101 0.999127 0.999136 0.99919 0.999056 0.999057 0.998979 0.998936 0.998908 0.998957 0.999152 0.999336 0.999452 0.999529 0.999572 0.999566 0.999559 0.999526 0.999486 0.999564 0.999404 0.999011 0.998558 0.998356 0.998496 0.998853 0.99907 0.999238 0.999189 0.998743 0.998786 0.999133 0.999272 0.999281 0.999148 0.999148 0.999045 0.999034 0.998982 0.999049 0.999253 0.999488 0.99958 0.999583 0.999581 0.999582 0.999563 0.999544 0.999532 0.999562 0.999537 0.999132 0.998652 0.998356 0.998357 0.998619 0.999005 0.999247 0.998979 0.99858 0.998583 0.999175 0.999282 0.999281 0.999247 0.999136 0.999144 0.999148 0.999142 0.999267 0.99947 0.99958 0.999585 0.999581 0.999587 0.999581 0.999583 0.999573 0.999555 0.999545 0.999476 0.999259 0.998966 0.998766 0.998555 0.998639 0.99893 0.999142 0.998955 0.998642 0.998773 0.99924 0.999281 0.999282 0.99918 0.999135 0.999143 0.999181 0.999263 0.999357 0.999502 0.999583 0.999581 0.999587 0.999581 0.999587 0.999582 0.999584 0.999581 0.999545 0.999444 0.999247 0.999114 0.999103 0.99928 0.999306 0.999143 0.99927 0.999166 0.998958 0.999069 0.999254 0.999282 0.9992 0.999141 0.999136 0.999161 0.999201 0.999282 0.999344 0.99946 0.999571 0.999585 0.999581 0.999587 0.999582 0.999588 0.999582 0.999585 0.999563 0.999462 0.999323 0.999238 0.99924 0.999478 0.99956 0.999555 0.999401 0.999235 0.999194 0.999191 0.999175 0.99928 0.999199 0.999211 0.999204 0.999167 0.999248 0.999311 0.999353 0.999433 0.999531 0.999581 0.999586 0.999582 0.999589 0.999582 0.999588 0.999583 0.999583 0.999486 0.999403 0.999359 0.999337 0.999456 0.99956 0.99956 0.99942 0.999335 0.999247 0.999169 0.999167 0.999178 0.999223 0.999224 0.999193 0.999182 0.99929 0.999346 0.999381 0.999424 0.9995 0.999585 0.999581 0.999588 0.999582 0.999589 0.999583 0.999589 0.999583 0.999496 0.999423 0.999426 0.999417 0.999429 0.999542 0.99956 0.999423 0.999328 0.999213 0.999176 0.999176 0.999223 0.999225 0.999222 0.999179 0.999207 0.999268 0.999322 0.999348 0.999369 0.999424 0.999543 0.999588 0.999582 0.999589 0.999583 0.999588 0.999583 0.999589 0.999535 0.999424 0.999429 0.999451 0.999451 0.99948 0.99956 0.999409 0.999332 0.999335 0.99926 0.999172 0.999182 0.999178 0.999175 0.999178 0.999179 0.999178 0.999214 0.999209 0.999174 0.99915 0.999267 0.999529 0.999588 0.999582 0.999587 0.999583 0.999589 0.999583 0.999584 0.999434 0.999429 0.999447 0.999469 0.999485 0.999528 0.999448 0.999438 0.999392 0.999249 0.999182 0.999149 0.99915 0.999163 0.999178 0.999043 0.999029 0.999004 0.998897 0.998695 0.998569 0.998658 0.999227 0.99956 0.999588 0.999582 0.999586 0.999582 0.999588 0.999583 0.999528 0.999437 0.999438 0.99946 0.999492 0.999516 0.999473 0.999457 0.999341 0.999271 0.99919 0.99915 0.999169 0.999171 0.999037 0.998909 0.998854 0.998708 0.99849 0.998422 0.998414 0.998422 0.998717 0.999395 0.999582 0.999586 0.999564 0.999459 0.999324 0.999455 0.999594 0.999594 0.999455 0.999455 0.999486 0.999511 0.999473 0.999394 0.999336 0.99928 0.999229 0.999215 0.999223 0.999126 0.999054 0.998893 0.998652 0.998488 0.998422 0.998413 0.998422 0.998412 0.998469 0.999196 0.999589 0.999582 0.999514 0.999319 0.999241 0.999254 0.999514 0.999617 0.999617 0.999512 0.999493 0.999507 0.999442 0.999391 0.999347 0.999327 0.999328 0.999301 0.999242 0.999236 0.999122 0.998814 0.998578 0.998422 0.998417 0.998422 0.998413 0.998422 0.998475 0.999111 0.999528 0.999586 0.999453 0.999309 0.99924 0.999252 0.999374 0.99954 0.999617 0.999618 0.999565 0.999515 0.999439 0.999413 0.999406 0.999407 0.999392 0.999365 0.999409 0.999352 0.999036 0.998822 0.99859 0.998421 0.998422 0.998417 0.998422 0.998419 0.998632 0.999112 0.999375 0.999507 0.999453 0.999364 0.999273 0.99929 0.999361 0.999446 0.999575 0.999617 0.999617 0.999554 0.999451 0.999451 0.999446 0.999451 0.999467 0.999502 0.999497 0.999239 0.999072 0.998886 0.998632 0.998445 0.99842 0.998422 0.99842 0.998456 0.998945 0.999285 0.999374 0.99945 0.999457 0.99949 0.999436 0.999352 0.999361 0.999414 0.999489 0.999558 0.999611 0.999617 0.999482 0.999464 0.999455 0.9995 0.999505 0.999503 0.999367 0.999283 0.99916 0.998944 0.998762 0.998551 0.998441 0.998425 0.998428 0.998602 0.999159 0.999463 0.999481 0.999476 0.999489 0.999528 0.999609 0.999543 0.999393 0.999396 0.999437 0.999479 0.999525 0.999604 0.999492 0.999449 0.999458 0.999505 0.999504 0.99941 0.99941 0.99936 0.999162 0.999053 0.998952 0.998767 0.998582 0.99852 0.998527 0.99879 0.999314 0.999537 0.99956 0.999552 0.999538 0.999554 0.999609 0.999649 0.999599 0.999421 0.999422 0.999456 0.999488 0.99955 0.999495 0.999448 0.999476 0.9995 0.999434 0.999433 0.999432 0.999295 0.999208 0.999175 0.999141 0.999024 0.998849 0.998762 0.998765 0.998975 0.999309 0.99956 0.999624 0.999593 0.999585 0.999585 0.999603 0.99965 0.999698 0.999535 0.999437 0.999461 0.999497 0.999534 0.999509 0.99945 0.999466 0.999434 0.999434 0.999433 0.999378 0.999286 0.999269 0.999312 0.999305 0.9992 0.999106 0.999045 0.999042 0.999134 0.999304 0.999512 0.999635 0.999635 0.999604 0.999615 0.999608 0.999624 0.999699 0.999702 0.999546 0.999491 0.999514 0.999539 0.99951 0.999428 0.999428 0.999442 0.999444 0.999407 0.999316 0.999297 0.999399 0.999464 0.999386 0.999316 0.999268 0.999239 0.999237 0.999261 0.999316 0.999444 0.999599 0.999636 0.999627 0.999632 0.999626 0.999624 0.999675 0.999704 0.999702 0.999587 0.999532 0.999547 0.999471 0.999429 0.999465 0.999467 0.999432 0.999343 0.999317 0.999432 0.999552 0.999523 0.999458 0.999401 0.999368 0.99935 0.999349 0.999356 0.999368 0.999431 0.999528 0.999636 0.999644 0.999639 0.999643 0.999631 0.999666 0.999702 0.999704 0.999703 0.999612 0.999555 0.99948 0.999502 0.999503 0.999456 0.999364 0.999344 0.999485 0.999571 0.999555 0.999558 0.999514 0.999469 0.999442 0.999426 0.999422 0.999429 0.999442 0.999458 0.999509 0.999589 0.999645 0.999655 0.999656 0.999651 0.999668 0.999705 0.999703 0.999705 0.999703 0.999594 0.999625 0.999572 0.999471 0.999388 0.999372 0.999545 0.999614 0.999571 0.999563 0.999578 0.999546 0.999517 0.999502 0.999488 0.999482 0.99949 0.999508 0.999518 0.999527 0.999566 0.999626 0.999658 0.999667 0.999666 0.999672 0.999703 0.999705 0.999703 0.999705 0.999704 0.99968 0.99954 0.999426 0.999422 0.999612 0.999675 0.999615 0.999571 0.999574 0.999589 0.999565 0.99955 0.999548 0.999542 0.999536 0.99954 0.999571 0.999588 0.999569 0.999575 0.999611 0.999651 0.999668 0.999669 0.999673 0.999691 0.9997 0.999705 0.999703 0.999704 0.999686 0.999553 0.999474 0.999584 0.999742 0.999675 0.999596 0.999572 0.999589 0.9996 0.999583 0.999578 0.999583 0.999584 0.999582 0.999583 0.999601 0.99964 0.999623 0.999599 0.999611 0.999638 0.999662 0.999668 0.999671 0.999678 0.99969 0.999686 0.999683 0.999666 0.999707 0.999626 0.999604 0.999754 0.999743 0.999654 0.999609 0.999599 0.999612 0.999615 0.999607 0.999607 0.999614 0.999618 0.999618 0.999615 0.99962 0.999666 0.99966 0.999619 0.999623 0.99964 0.999662 0.99967 0.999672 0.999678 0.999681 0.99969 0.999722 0.999703 0.999718 0.999685 0.999736 0.999773 0.999736 0.999664 0.999656 0.999654 0.999643 0.999637 0.999638 0.999641 0.999644 0.999647 0.999647 0.99964 0.999637 0.999687 0.999689 0.999636 0.999648 0.999662 0.999678 0.999684 0.999678 0.999687 0.999687 0.999688 0.999745 0.999827 0.999719 0.999717 0.999773 0.999773 0.999737 0.999694 0.999696 0.999688 0.999671 0.999665 0.99967 0.999673 0.999674 0.999673 0.999672 0.999665 0.999661 0.999714 0.999719 0.999658 0.999678 0.9997 0.999708 0.999712 0.999707 0.999699 0.999717 0.999728 0.999761 0.999837 0.999724 0.999773 0.999773 0.999773 0.999729 0.999713 0.999708 0.999697 0.999689 0.999692 0.999697 0.9997 0.9997 0.999696 0.999693 0.99969 0.999692 0.999751 0.999753 0.999692 0.999709 0.999729 0.999731 0.999734 0.999739 0.999742 0.99975 0.999783 0.999809 0.999841 0.999749 0.999773 0.999773 0.999749 0.999725 0.999721 0.999712 0.999704 0.999704 0.999712 0.999717 0.999721 0.999721 0.999713 0.999709 0.999708 0.999718 0.999785 0.999792 0.999725 0.999733 0.999745 0.999745 0.999748 0.999754 0.999767 0.999778 0.99979 0.999823 0.999852 0.999786 0.999772 0.999753 0.999731 0.999727 0.999728 0.999719 0.999714 0.999717 0.999722 0.999728 0.999736 0.999738 0.999725 0.999719 0.99972 0.999735 0.999807 0.99981 0.999758 0.999751 0.999756 0.999758 0.999762 0.999765 0.999773 0.999783 0.999791 0.999809 0.999851 0.999787 0.999766 0.999749 0.999741 0.99974 0.99974 0.999731 0.999726 0.999722 0.999722 0.999728 0.999749 0.999751 0.999731 0.999726 0.999727 0.999742 0.999806 0.99981 0.999788 0.999764 0.999765 0.999768 0.999773 0.999773 0.999777 0.999782 0.999788 0.999805 0.999841 0.999787 0.999771 0.999766 0.999763 0.999758 0.99975 0.999741 0.999731 0.999723 0.999723 0.999729 0.999764 0.999763 0.999733 0.999732 0.999733 0.999742 0.999805 0.99981 0.999797 0.999776 0.999771 0.999772 0.999776 0.999779 0.999779 0.999782 0.999786 0.999805 0.99984 0.999814 0.99979 0.999777 0.999771 0.999764 0.999755 0.999745 0.999731 0.999724 0.999724 0.999736 0.999777 0.999776 0.999737 0.99974 0.999741 0.999745 0.999786 0.99981 0.99981 0.999789 0.999775 0.999774 0.999776 0.99978 0.999781 0.999783 0.999786 0.999807 0.99984 0.999821 0.99979 0.999776 0.999771 0.999765 0.999756 0.999744 0.999729 0.999724 0.999727 0.999764 0.999781 0.999764 0.999744 0.999751 0.999751 0.99975 0.999768 0.999793 0.999811 0.999811 0.999783 0.999774 0.999776 0.999779 0.999781 0.999784 0.999787 0.999808 0.999838 0.999812 0.999782 0.999774 0.999771 0.999765 0.999754 0.999739 0.999727 0.999726 0.999737 0.999782 0.999781 0.999761 0.999754 0.999764 0.999762 0.999757 0.999764 0.999778 0.999796 0.999812 0.999808 0.999777 0.999776 0.999778 0.999782 0.999786 0.999793 0.999811 0.999833 0.999809 0.99978 0.999773 0.999769 0.99976 0.999747 0.999733 0.999727 0.999727 0.999749 0.999782 0.999781 0.999761 0.999767 0.999774 0.999771 0.999766 0.99977 0.999777 0.999782 0.999812 0.999817 0.99979 0.999777 0.999779 0.999783 0.999791 0.9998 0.999814 0.999829 0.999817 0.999783 0.999771 0.999763 0.999752 0.999741 0.99973 0.999728 0.999738 0.999783 0.999783 0.999766 0.999763 0.999785 0.999779 0.999775 0.999778 0.999787 0.999782 0.999782 0.999793 0.999818 0.999818 0.999788 0.999782 0.999787 0.999798 0.999807 0.999814 0.999826 0.999822 0.99978 0.999765 0.999757 0.999748 0.999737 0.999731 0.99974 0.999784 0.999783 0.99976 0.99976 0.999786 0.999804 0.999778 0.999776 0.999789 0.999804 0.999788 0.999782 0.999784 0.999801 0.999818 0.999818 0.999803 0.999804 0.999811 0.999812 0.999814 0.999823 0.999818 0.999773 0.99976 0.999754 0.999745 0.99974 0.999751 0.999795 0.999795 0.999758 0.999758 0.999774 0.999815 0.999813 0.999776 0.999776 0.999795 0.999806 0.999791 0.999784 0.999784 0.99979 0.999809 0.999835 0.99984 0.999831 0.999829 0.99982 0.999815 0.999824 0.999812 0.999775 0.999761 0.999754 0.999749 0.99976 0.999805 0.999805 0.99977 0.999758 0.999758 0.999808 0.999826 0.999813 0.999776 0.999776 0.999799 0.999806 0.999791 0.999784 0.999784 0.999785 0.999798 0.999823 0.999849 0.999849 0.999844 0.999834 0.999818 0.999831 0.999821 0.999782 0.999764 0.999761 0.999776 0.999811 0.999811 0.999782 0.999775 0.999778 0.999792 0.999824 0.999826 0.999812 0.999776 0.999776 0.9998 0.999806 0.999788 0.999784 0.999784 0.999785 0.99979 0.999809 0.999833 0.999844 0.999845 0.999845 0.999826 0.999843 0.999829 0.999783 0.999771 0.999794 0.999821 0.999821 0.999789 0.999785 0.999819 0.999818 0.999807 0.999824 0.999826 0.999813 0.999776 0.999776 0.999799 0.999803 0.999785 0.999784 0.999784 0.999785 0.999786 0.999802 0.999817 0.999824 0.999839 0.999845 0.999843 0.99985 0.999825 0.999785 0.999797 0.999821 0.999821 0.999802 0.999789 0.999826 0.999828 0.999812 0.999806 0.999824 0.999825 0.999817 0.999786 0.999776 0.999794 0.999794 0.999785 0.999784 0.999784 0.999785 0.999785 0.999801 0.999812 0.999814 0.999819 0.999836 0.999852 0.999852 0.999821 0.999791 0.999822 0.999822 0.99981 0.999799 0.999797 0.99983 0.999828 0.9998 0.999804 0.999826 0.999827 0.999822 0.99981 0.999775 0.999789 0.999788 0.999785 0.999784 0.999784 0.999785 0.999786 0.999801 0.999812 0.999814 0.999814 0.999817 0.999839 0.999856 0.999836 0.999822 0.999822 0.999813 0.999808 0.999805 0.99983 0.99983 0.999825 0.999797 0.999806 0.99983 0.99983 0.999824 0.999816 0.9998 0.999789 0.999787 0.999785 0.999785 0.999785 0.999785 0.99979 0.999805 0.999814 0.999816 0.999814 0.999814 0.999821 0.999852 0.999838 0.99983 0.999816 0.999814 0.99981 0.999809 0.99983 0.99983 0.999807 0.999796 0.999814 0.999836 0.999834 0.999824 0.999813 0.999807 0.999794 0.999786 0.999786 0.999785 0.999785 0.999785 0.9998 0.999811 0.999818 0.999819 0.999815 0.999814 0.999824 0.999855 0.999838 0.999819 0.999815 0.999815 0.999808 0.999812 0.99983 0.99983 0.999795 0.999796 0.999825 0.999841 0.99984 0.999823 0.999807 0.999807 0.999802 0.999786 0.999786 0.999785 0.999785 0.99979 0.99981 0.999818 0.999822 0.999822 0.999818 0.999818 0.999831 0.999869 0.999839 0.999818 0.999815 0.999811 0.999802 0.999824 0.99983 0.999821 0.999794 0.999806 0.999834 0.999843 0.999845 0.999825 0.999804 0.999805 0.999807 0.99979 0.999786 0.999786 0.999786 0.999804 0.999816 0.999822 0.999826 0.999825 0.999821 0.999822 0.999835 0.999878 0.999865 0.999824 0.999811 0.999804 0.999802 0.999811 0.99983 0.999828 0.999794 0.999815 0.999838 0.999844 0.999845 0.999831 0.999804 0.999802 0.999807 0.999802 0.999787 0.999787 0.999798 0.999814 0.999817 0.999822 0.999827 0.999827 0.999822 0.999823 0.999837 0.99988 0.999886 0.99982 0.999805 0.999802 0.999802 0.999821 0.99983 0.999821 0.999801 0.999817 0.999839 0.999843 0.999843 0.999833 0.999809 0.999801 0.999805 0.999805 0.999799 0.999801 0.999813 0.999817 0.999817 0.99982 0.999827 0.999827 0.999823 0.999823 0.999837 0.99988 0.999893 0.999815 0.999804 0.999803 0.999802 0.999812 0.99983 0.999829 0.99981 0.999818 0.999839 0.999842 0.99984 0.999827 0.999824 0.999801 0.999801 0.999804 0.999807 0.999811 0.999817 0.999818 0.999818 0.999819 0.999825 0.999827 0.999823 0.999821 0.999835 0.999879 0.999904 0.999821 0.999805 0.999809 0.999807 0.999814 0.99983 0.999831 0.999815 0.99982 0.99984 0.999842 0.999839 0.999823 0.999823 0.999803 0.999795 0.999799 0.999804 0.99981 0.999817 0.999819 0.999818 0.999818 0.999821 0.999824 0.999822 0.99982 0.99983 0.999878 0.999918 0.999835 0.99981 0.999813 0.999819 0.999824 0.999831 0.999831 0.999821 0.999823 0.99984 0.999842 0.999838 0.999813 0.999823 0.999818 0.99979 0.99979 0.999796 0.999806 0.999816 0.999821 0.999818 0.999818 0.999819 0.999821 0.99982 0.999819 0.999827 0.99988 0.999928 0.999844 0.999813 0.999818 0.999831 0.999834 0.99983 0.999831 0.999827 0.999824 0.999835 0.999842 0.999839 0.999813 0.999814 0.999817 0.999791 0.999784 0.999789 0.999801 0.999814 0.999823 0.99982 0.999818 0.999819 0.999819 0.999819 0.999819 0.999826 0.999888 0.999935 0.999851 0.999814 0.999824 0.999845 0.999842 0.99983 0.999832 0.99983 0.999822 0.999821 0.999841 0.999842 0.999813 0.999799 0.999814 0.9998 0.999784 0.999785 0.999798 0.999811 0.999824 0.999825 0.999819 0.999819 0.999819 0.999819 0.999819 0.999828 0.999899 0.999941 0.99986 0.999816 0.999832 0.999859 0.999848 0.999831 0.999833 0.99983 0.999819 0.999806 0.999836 0.999843 0.99982 0.999799 0.999809 0.999791 0.999784 0.999785 0.999798 0.99981 0.999823 0.999828 0.999821 0.999819 0.999819 0.999819 0.999819 0.999832 0.999911 0.99995 0.999871 0.999824 0.999842 0.999868 0.999854 0.999833 0.999833 0.999829 0.999816 0.999799 0.999828 0.999844 0.999822 0.999788 0.999809 0.9998 0.999784 0.999786 0.999801 0.999811 0.999822 0.999828 0.999823 0.99982 0.99982 0.999819 0.999819 0.999838 0.999922 0.999961 0.999888 0.999839 0.999853 0.999874 0.99986 0.999837 0.999833 0.999828 0.999815 0.999799 0.999816 0.999844 0.999823 0.999785 0.999803 0.999802 0.999784 0.999791 0.999807 0.999814 0.99982 0.999824 0.999823 0.999822 0.999823 0.99982 0.999819 0.999848 0.999934 0.999973 0.999909 0.999861 0.999864 0.999878 0.999865 0.999842 0.999833 0.999827 0.999818 0.999798 0.999804 0.999843 0.999825 0.999785 0.999795 0.999802 0.999785 0.999802 0.999816 0.999818 0.999818 0.999819 0.999821 0.999826 0.999835 0.999826 0.999819 0.999865 0.999951 0.999984 0.99993 0.999881 0.999874 0.999881 0.999868 0.999846 0.999834 0.999828 0.999822 0.999798 0.999798 0.999841 0.999829 0.999785 0.999785 0.999802 0.999806 0.999815 0.999823 0.999822 0.999817 0.999816 0.999817 0.999829 0.999847 0.999843 0.999833 0.99989 0.999969 0.999988 0.999941 0.99989 0.999879 0.999882 0.999869 0.999848 0.999835 0.999828 0.999825 0.999801 0.999798 0.99984 0.999832 0.999788 0.999785 0.999797 0.999812 0.999826 0.999827 0.999823 0.999817 0.999816 0.999816 0.999831 0.999851 0.999856 0.999849 0.999909 0.999979 ) ; boundaryField { inlet { type zeroGradient; } outlet { type zeroGradient; } walls { type zeroGradient; } frontAndBackPlanes { type empty; } } // ************************************************************************* //
[ "mizuha.watanabe@gmail.com" ]
mizuha.watanabe@gmail.com
476b2d8863f25b444969dc1aa14cb047cb00f84f
1e2a0bb687106aca04d61b9bd9e70352f4fb069d
/snake/snake/snake_by_C.cpp
25e1eae41d6a903a64f546fc16566a0eb641e312
[ "Apache-2.0" ]
permissive
JasonLGJ/Resume-About-repository
d3d0d8c3536366d178a6ce2bbd3cfd943482db0d
cc44648c3ed8463a589a4355113653f0dacb8ee0
refs/heads/master
2020-03-26T05:37:34.149816
2018-08-13T10:52:14
2018-08-13T10:52:14
144,566,091
0
0
null
null
null
null
GB18030
C++
false
false
7,613
cpp
#include<stdio.h> #include<conio.h> #include<windows.h> #include<stdlib.h> #include<time.h> #define Key_Up 'w' // 向上方向键    #define Key_Down 's' // 向下方向键 #define Key_Right 'd' // 向右方向键 #define Key_Left 'a' // 向左方向键 #define Key_Space ' ' #define R 1 //向右的状态量 #define L 2 //向左的状态量 #define U 3 //向上的状态量 #define D 4 //向下的状态量 typedef struct node { int x; int y; struct node*next; }snake; //////////全局变量 int score=0; int endgamestatus=0; int food_x,food_y; snake*head;//蛇的头结点 snake*p;//遍历蛇身用的指针 int status=R;//蛇状态变量 int key; ///////// void endgame();//退出游戏函数 void Pos(int x,int y);//光标定位函数 void crosswall();//判断蛇是否撞到墙壁 void Creat_Food();//生成食物 int Bit_Self();//判断蛇头是否与蛇身有接触 void Creat_Map();//生成墙 void Init_Snake();//生成蛇 void Snake_Moving();//蛇身移动 void gamecircle();// 游戏循环 void pause();//游戏暂停 //////// void Pos(int x,int y) { COORD pos; HANDLE hOutput; pos.X=x; pos.Y=y; hOutput=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hOutput,pos); } int Bit_Self() { p=head->next; while(p) { if(p->x==head->x&&p->y==head->y) return 1; p=p->next; } return 0; } void Creat_Map() { int i,j; for(i=0;i<=54;i++) for(j=0;j<=24;j++) { Pos(i,0); printf("@"); Pos(i,24); printf("@"); Pos(0,j); printf("@"); Pos(54,j); printf("@"); } } void crosswall() { if(head->x==0||head->y==0||head->x==54||head->y==24) { endgamestatus=1; endgame(); } } void Creat_Food() { srand(time(NULL)); food_x=rand()%50+4; food_y=rand()%20+4; Pos(food_x,food_y); printf("@"); } void Init_Snake() { int i; snake*tail; head=(snake*)malloc(sizeof(snake)); head->x=25; head->y=5; head->next=NULL; for(i=1;i<4;i++) { tail=(snake*)malloc(sizeof(snake)); tail->x=25+i*1; tail->y=5; tail->next=head; head=tail; } while(tail) { Pos(tail->x,tail->y); printf("@"); tail=tail->next; } } void Snake_Moving() { snake*newhead; newhead=(snake*)malloc(sizeof(snake)); crosswall(); if(Bit_Self()) { endgamestatus=2; endgame(); } if(status==R)//向右走 { if(head->x==food_x&&head->y==food_y) { score=score+10; newhead->x=head->x+1; newhead->y=head->y; newhead->next=head; head=newhead; p=head; while(p) { Pos(p->x,p->y); printf("@"); p=p->next; } Creat_Food(); } else { newhead->x=head->x+1; newhead->y=head->y; newhead->next=head; head=newhead; p=head; while(p->next->next) { Pos(p->x,p->y); printf("@"); p=p->next; } Pos(p->next->x,p->next-> y); printf(" "); free(p->next); p->next=NULL; } } if(status==L) { if(head->x==food_x&&head->y==food_y) { score=score+10; newhead->x=head->x-1; newhead->y=head->y; newhead->next=head; head=newhead; p=head; while(p) { Pos(p->x,p->y); printf("@"); p=p->next; } Creat_Food(); } else { newhead->x=head->x-1; newhead->y=head->y; newhead->next=head; head=newhead; p=head; while(p->next->next) { Pos(p->x,p->y); printf("@"); p=p->next; } Pos(p->next->x,p->next-> y); printf(" "); free(p->next); p->next=NULL; } } if(status==D) { if(head->x==food_x&&head->y==food_y) { score=score+10; newhead->x=head->x+1; newhead->y=head->y; newhead->next=head; head=newhead; p=head; while(p) { Pos(p->x,p->y); printf("@"); p=p->next; } Creat_Food(); } else { newhead->x=head->x; newhead->y=head->y+1; newhead->next=head; head=newhead; p=head; while(p->next->next) { Pos(p->x,p->y); printf("@"); p=p->next; } Pos(p->next->x,p->next-> y); printf(" "); free(p->next); p->next=NULL; } } if(status==U) { if(head->x==food_x&&head->y==food_y) { score=score+10; newhead->x=head->x; newhead->y=head->y-1; newhead->next=head; head=newhead; p=head; while(p) { Pos(p->x,p->y); printf("@"); p=p->next; } Creat_Food(); } else { newhead->x=head->x; newhead->y=head->y-1; newhead->next=head; head=newhead; p=head; while(p->next->next) { Pos(p->x,p->y); printf("@"); p=p->next; } Pos(p->next->x,p->next-> y); printf(" "); free(p->next); p->next=NULL; } } } void gamecircle() { Pos(57,4); printf("操作说明"); Pos(57,5); printf("wasd分别对应上左下右"); Pos(57,6); printf("按空格键暂停"); while(1) { Pos(57,7); printf("游戏分数:%d",score); if(kbhit()) key=getch(); switch(key) { case Key_Right: if(status!=L) status=R; break; case Key_Left: if(status!=R) status=L; break; case Key_Up: if(status!=D) status=U; break; case Key_Down: if(status!=U) status=D; break; case Key_Space: pause(); break; default: break; } Sleep(300); Snake_Moving(); } } void pause() { while(1) { if(key=getch()==' ') break; } } void endgame() { system("cls"); Pos(27,13); if(endgamestatus==1) printf("您撞到墙了"); if(endgamestatus==2) printf("您咬到了自己"); Pos(27,14); printf("您的得分为%d",score); exit(0); } void welcome() { Pos(27,13); printf("欢迎来到贪吃蛇游戏\t"); system("pause"); system("cls"); Pos(50,9); printf("欢迎大家对源代码进行修改"); Pos(50,11); printf("开发出更多好玩的玩法"); Pos(50,13); system("pause"); system("cls"); } int main() { welcome(); Creat_Map(); Creat_Food(); Init_Snake(); gamecircle(); return 0; }
[ "li.guangjin@foxmail.com" ]
li.guangjin@foxmail.com
a2577c80057c478fc6335bd8d4ffbe35a3ad25ce
04d2afabdebc6ce4a733f6519088a4dcd76cda03
/devel/include/kinova_msgs/SetNullSpaceModeStateRequest.h
eb4d7ef8e6c62b505f6151a1ca9e9616dbef869e
[ "MIT" ]
permissive
FProgrammerLIU/caster_man_ros
11c3b7d153ab4663903c031006041b8af5672af3
a75b503fad3a470f985072a2b3953e89074f3223
refs/heads/master
2020-09-13T18:47:17.822909
2019-11-20T06:55:32
2019-11-20T06:55:32
222,870,826
0
0
null
null
null
null
UTF-8
C++
false
false
5,691
h
// Generated by gencpp from file kinova_msgs/SetNullSpaceModeStateRequest.msg // DO NOT EDIT! #ifndef KINOVA_MSGS_MESSAGE_SETNULLSPACEMODESTATEREQUEST_H #define KINOVA_MSGS_MESSAGE_SETNULLSPACEMODESTATEREQUEST_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> namespace kinova_msgs { template <class ContainerAllocator> struct SetNullSpaceModeStateRequest_ { typedef SetNullSpaceModeStateRequest_<ContainerAllocator> Type; SetNullSpaceModeStateRequest_() : state(0) { } SetNullSpaceModeStateRequest_(const ContainerAllocator& _alloc) : state(0) { (void)_alloc; } typedef uint16_t _state_type; _state_type state; typedef boost::shared_ptr< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> const> ConstPtr; }; // struct SetNullSpaceModeStateRequest_ typedef ::kinova_msgs::SetNullSpaceModeStateRequest_<std::allocator<void> > SetNullSpaceModeStateRequest; typedef boost::shared_ptr< ::kinova_msgs::SetNullSpaceModeStateRequest > SetNullSpaceModeStateRequestPtr; typedef boost::shared_ptr< ::kinova_msgs::SetNullSpaceModeStateRequest const> SetNullSpaceModeStateRequestConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> & v) { ros::message_operations::Printer< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace kinova_msgs namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False} // {'std_msgs': ['/opt/ros/melodic/share/std_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/melodic/share/geometry_msgs/cmake/../msg'], 'actionlib_msgs': ['/opt/ros/melodic/share/actionlib_msgs/cmake/../msg'], 'kinova_msgs': ['/home/caster/ros_ws/caster/src/kinova-ros/kinova_msgs/msg', '/home/caster/ros_ws/caster/devel/.private/kinova_msgs/share/kinova_msgs/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< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsFixedSize< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct HasHeader< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> const> : FalseType { }; template<class ContainerAllocator> struct MD5Sum< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > { static const char* value() { return "891b541ef99af7889d0f22a062410be8"; } static const char* value(const ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x891b541ef99af788ULL; static const uint64_t static_value2 = 0x9d0f22a062410be8ULL; }; template<class ContainerAllocator> struct DataType< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > { static const char* value() { return "kinova_msgs/SetNullSpaceModeStateRequest"; } static const char* value(const ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > { static const char* value() { return "uint16 state\n" ; } static const char* value(const ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.state); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct SetNullSpaceModeStateRequest_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::kinova_msgs::SetNullSpaceModeStateRequest_<ContainerAllocator>& v) { s << indent << "state: "; Printer<uint16_t>::stream(s, indent + " ", v.state); } }; } // namespace message_operations } // namespace ros #endif // KINOVA_MSGS_MESSAGE_SETNULLSPACEMODESTATEREQUEST_H
[ "995536737@qq.com" ]
995536737@qq.com
1dbee571408d2a9b851d33fb9d7c8be805c8695a
c0d2712a308fe2c61e86b53e74a122ea6d5a4f01
/libym_networks/src/conv_mvn_bdn/EqConv.h
e1f987821a4a41abba9a19ed40324ee5d0370189
[]
no_license
yusuke-matsunaga/ymtools
1b6d1d40c9c509786873ff1ac4230afef17e21e7
82dc54c009b26cba9f3a5f6c652c3be76ccd33e4
refs/heads/master
2020-12-24T08:49:50.628839
2015-11-13T16:43:00
2015-11-13T16:43:00
31,797,792
1
1
null
2015-07-06T14:29:01
2015-03-07T02:08:27
C++
UTF-8
C++
false
false
1,387
h
#ifndef EQCONV_H #define EQCONV_H /// @file EqConv.h /// @brief EqConv のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2005-2011, 2014 Yusuke Matsunaga /// All rights reserved. #include "MvnConv.h" BEGIN_NAMESPACE_YM_NETWORKSBDNCONV ////////////////////////////////////////////////////////////////////// /// @class EqConv EqConv.h "EqConv.h" /// @brief EQ 演算ノードに対する処理を行う MvnConv の派生クラス ////////////////////////////////////////////////////////////////////// class EqConv : public MvnConv { public: /// @brief コンストラクタ EqConv(); /// @brief デストラクタ virtual ~EqConv(); public: ////////////////////////////////////////////////////////////////////// // MvnConv の仮想関数 ////////////////////////////////////////////////////////////////////// /// @brief MvnNode を BdnMgr に変換する. /// @param[in] node ノード /// @param[in] bdnetwork 変換結果の BdnMgr /// @param[in] nodemap ノードの対応関係を表すマップ /// @retval true このクラスで変換処理を行った. /// @retval false このクラスでは変換処理を行わなかった. virtual bool operator()(const MvnNode* node, BdnMgr& bdnetwork, MvnBdnMap& nodemap); }; END_NAMESPACE_YM_NETWORKSBDNCONV #endif // EQCONV_H
[ "yusuke_matsunaga@ieee.org" ]
yusuke_matsunaga@ieee.org
fa6878e267042f037c87cd305d6f826566aa1d9b
edacb4d3dfe0f1101d097e954e600799875e0281
/algo/refine/objectTime.h
708a6d0fa9347339cc31dabbeb026a08a9edaf1e
[]
no_license
jgsimmerman/c-projects
c9ff11813663150e77c73d8236cf543aff7430c2
462052ca8a6d56ff6bed678194348460bdbda2e8
refs/heads/master
2020-07-03T16:54:56.286833
2016-11-19T23:39:24
2016-11-19T23:39:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,023
h
#ifndef OBJECTTIME_H #define OBJECTTIME_H #include <string> #include <vector> #include "question.h" #include "algorithm.h" using namespace std; class ObjectTime { protected: string topic; //location of the topic string answer; string title; /* Question Variables ******************/ Question questions; /*Time Variables************************/ int initTime; int repeatTime; bool repeat; /*Unfinished Mutator Functions*****************************/ public: void setTopic(string address); void setTitle(string t); void setQuestions(string, string, string, string, string); void setInitTime(); void setRepeatTime(int interval); void setRepeat(); int getInitTime(); int getRepeatTime(); bool getRepeat(); /*Need to do Topic and Question Accessor Functions****************/ string getTopic(); string getTitle(); Question getQuestions(); }; #endif
[ "jgsimmerman@gmail.com" ]
jgsimmerman@gmail.com
19384266f16aabf08033646c3822d3c3e4906a64
bddd849e4956208402ffa7748950e0721ce9b62b
/BOJ/boj1713.cpp
a772872e8c4f635d3409234c904f80f4488c7088
[]
no_license
lagoon9024/problem-solving
82a7f1217f5951c8998e7540d1fa4600582d0a30
e34cb4cbc5d990d231e18da7ea584f28a5f67afe
refs/heads/master
2020-11-24T06:02:10.916262
2020-03-19T08:04:30
2020-03-19T08:04:30
227,998,133
0
0
null
null
null
null
UHC
C++
false
false
956
cpp
// boj 1713 후보 추천하기 #include <iostream> #include <vector> #include <algorithm> using namespace std; int n, m; int rec[101]; class candidate { public: int order, num; candidate(int o, int n) { this->order = o; this->num = n; } }; bool comp(candidate a, candidate b) { if (rec[a.num] == rec[b.num]) return a.order > b.order; return rec[a.num] > rec[b.num]; } bool ansc(candidate a, candidate b) { return a.num < b.num; } int main(void) { vector<candidate> v; cin >> n >> m; for (int i = 0; i < m; ++i) { bool ison = false; int num; cin >> num; if (rec[num]) ison = true; ++rec[num]; if (v.size() < n && !ison) v.push_back(candidate(i, num)); else if (v.size() == n && !ison) { sort(v.begin(), v.end(), comp); int idx = v.back().num; v.pop_back(); v.push_back(candidate(i, num)); rec[idx] = 0; } } sort(v.begin(), v.end(), ansc); for (int i = 0; i < v.size(); ++i) cout << v[i].num << " "; }
[ "lagoon9024@gmail.com" ]
lagoon9024@gmail.com
8e7b3299ce30da4cb16108839922593d293f7f43
f2c7eb8f2f8a2f27653d5670600239e42a80d25a
/DragAndDropInterface.h
ce4c2d895e8fff418728c79408a79c4ba878f503
[]
no_license
theoar/OOP-Project
5c935017d3bc32606a15d72c5cb0f633572573ad
016da6b8635b0e0d44fc10ff433623ffb760717d
refs/heads/master
2021-05-28T16:35:42.273254
2015-05-03T14:26:13
2015-05-03T14:26:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
412
h
// // DragAndDropInterface.h // SDL DOMO // // Created by Dawid Hajda on 10.04.2015. // Copyright (c) 2015 Dawid Hajda. All rights reserved. // #ifndef __SDL_DOMO__DragAndDropInterface__ #define __SDL_DOMO__DragAndDropInterface__ #include "Point.h" class DragAndDropInterface { public: virtual void Drag(Point) = 0; virtual void Drop() = 0; }; #endif /* defined(__SDL_DOMO__DragAndDropInterface__) */
[ "dawhaj@gmail.com" ]
dawhaj@gmail.com
5b850f09d8711bf00abba964a5071bdad8108a31
585524868050bf350ba1b00aed333da25a7c4a55
/samples/power2/splitter.cpp
56d2cbc39191a5b9644ad7c3860f59f29014588e
[ "MIT" ]
permissive
MohamedBassem/dTests
4d7dd53d9f76a9b29546bf4582979c76c4df6f5b
3650aea2a4d4387bdfc8cda303013181e691bbe7
refs/heads/master
2021-01-22T21:16:55.717870
2014-07-31T22:43:44
2014-07-31T22:43:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
228
cpp
#include <iostream> #include <fstream> using namespace std; int main(){ freopen("input.in","r",stdin); int t; cin >> t; while(t--){ int x; cin >> x; cout << x << endl; cout << "--split--" << endl; } }
[ "medoox240@gmail.com" ]
medoox240@gmail.com
9acf29564be05474c9f8ef63c6f3bc1f60d66135
ddce82b1d34fb613d0fa251d4aed93ce232703df
/wrappedAlgorithms/HGRAAL/src/LEDA/graph/face_map.h
5ba142e5569c0a59ac18c63a446e17a6a357148c
[]
no_license
waynebhayes/SANA
64906c7a7761a07085e2112a0685fa9fbe7313e6
458cbc5e83d0541717184a5ff0930d7003c3e3ef
refs/heads/SANA2
2023-08-21T20:25:47.376666
2023-08-10T19:54:57
2023-08-10T19:54:57
86,848,250
20
99
null
2023-03-07T19:43:10
2017-03-31T18:21:01
Game Maker Language
UTF-8
C++
false
false
4,289
h
/******************************************************************************* + + LEDA 6.3 + + + face_map.h + + + Copyright (c) 1995-2010 + by Algorithmic Solutions Software GmbH + All rights reserved. + *******************************************************************************/ #ifndef LEDA_FACE_MAP_H #define LEDA_FACE_MAP_H #if !defined(LEDA_ROOT_INCL_ID) #define LEDA_ROOT_INCL_ID 600188 #include <LEDA/internal/PREAMBLE.h> #endif //------------------------------------------------------------------------------ // face maps // // last modified: december 1998 (derived from face_array) // //------------------------------------------------------------------------------ /*{\Manpage {face_map} {E} {Face Maps} }*/ #include <LEDA/graph/graph.h> #include <LEDA/graph/face_array.h> LEDA_BEGIN_NAMESPACE template <class E,class graph_t = graph> class face_map : public face_array<E,graph_t> { typedef typename graph_t::face face; typedef face_array<E,graph_t> base; /*{\Mdefinition An instance of the data type |\Mname| is a map for the faces of a graph $G$, i.e., equivalent to |map<face,E>| (cf. \ref{Maps}). It can be used as a dynamic variant of the data type |face_array| (cf. \ref{Face Arrays}). {\bf New:} Since |\Mname| is derived from |face_array<E>| face maps can be passed (by reference) to functions with face array parameters. In particular, all LEDA graph algorithms expecting a |face_array<E>&| argument can be passed a |face_map<E>| instead. }*/ public: /*{\Mcreation M }*/ face_map() { base::enable_map_access(); } /*{\Mcreate introduces a variable |\Mvar| of type |\Mname| and initializes it to the map with empty domain. }*/ face_map(const graph_t& G) : face_array<E,graph_t>(G) { base::enable_map_access(); } /*{\Mcreate introduces a variable |\Mvar| of type |\Mname| and initializes it with a mapping $m$ from the set of all faces of $G$ into the set of variables of type $E$. The variables in the range of $m$ are initialized by a call of the default constructor of type $E$. }*/ face_map(const graph_t& G, E x) : face_array<E,graph_t>(G,x) { base::enable_map_access(); } /*{\Mcreate introduces a variable |\Mvar| of type |\Mname| and initializes it with a mapping $m$ from the set of all faces of $G$ into the set of variables of type $E$. The variables in the range of $m$ are initialized with a copy of $x$. }*/ face_map(const face_map<E,graph_t>& A) : face_array<E,graph_t>(A) { base::enable_map_access(); } face_map<E,graph_t>& operator=(const face_map<E,graph_t>& A) { face_array<E,graph_t>::operator=(A); return *this; } ~face_map() {} /*{\Moperations 1.3 4.3 }*/ const graph_t& get_graph() const { return face_array<E,graph_t>::get_graph(); } /*{\Mop returns a reference to the graph of |\Mvar|. }*/ void init() { graph_map<graph_t>::init(nil,0,0); } /*{\Mop makes |\Mvar| a face map with empty domain. }*/ void init(const graph_t& G) { face_array<E,graph_t>::init(G); } /*{\Mop makes |\Mvar| a mapping $m$ from the set of all faces of $G$ into the set of variables of type $E$. The variables in the range of $m$ are initialized by a call of the default constructor of type $E$. }*/ void init(const graph_t& G, E x) { face_array<E,graph_t>::init(G,x); } /*{\Mop makes |\Mvar| a mapping $m$ from the set of all faces of $G$ into the set of variables of type $E$. The variables in the range of $m$ are initialized with a copy of $x$. }*/ const E& operator()(face f) const { return LEDA_CONST_ACCESS(E,graph_map<graph_t>::map_read(f)); } const E& operator[](face f) const { return LEDA_CONST_ACCESS(E,graph_map<graph_t>::map_read(f)); } E& operator[](face f) { return LEDA_ACCESS(E,graph_map<graph_t>::map_access(f)); } /*{\Marrop returns the variable $M(v)$. }*/ }; /*{\Mimplementation Face maps are implemented by an efficient hashing method based on the internal numbering of the faces. An access operation takes expected time $O(1)$. }*/ #if LEDA_ROOT_INCL_ID == 600188 #undef LEDA_ROOT_INCL_ID #include <LEDA/internal/POSTAMBLE.h> #endif LEDA_END_NAMESPACE #endif
[ "whayes@uci.edu" ]
whayes@uci.edu
08f3e764c26b82251314ca1273cdb870966f9f8e
ff4fe07752b61aa6404f85a8b4752e21e8a5bac8
/challenge-208/ulrich-rieke/cpp/ch-1.cpp
69a6590dc4573235268fe926027c75c1428b1597
[]
no_license
choroba/perlweeklychallenge-club
7c7127b3380664ca829158f2b6161c2f0153dfd9
2b2c6ec6ece04737ba9a572109d5e7072fdaa14a
refs/heads/master
2023-08-10T08:11:40.142292
2023-08-06T20:44:13
2023-08-06T20:44:13
189,776,839
0
1
null
2019-06-01T20:56:32
2019-06-01T20:56:32
null
UTF-8
C++
false
false
2,547
cpp
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <utility> #include <iterator> #include <map> std::vector<std::string> split( const std::string & startline , const std::string & sep ) { std::vector<std::string> separated ; std::string::size_type start { 0 } ; std::string::size_type pos ; do { pos = startline.find_first_of( sep , start ) ; separated.push_back( startline.substr(start , pos - start )) ; start = pos + 1 ; } while ( pos != std::string::npos ) ; return separated ; } std::map<std::string, int> toIndexPairs( const std::vector<std::string> & words ) { std::map<std::string, int> values ; int i = 0 ; for ( auto s : words ) { values[s] = i ; i++ ; } return values ; } int main( ) { std::cout << "Enter some unique strings, separated by blanks!\n" ; std::string line ; std::getline( std::cin , line ) ; std::vector<std::string> firstWords ( split( line , " " ) ) ; std::cout << "Enter some more unique strings, separated by blanks!\n" ; std::getline( std::cin , line ) ; std::vector<std::string> secondWords ( split( line , " " ) ) ; std::map<std::string, int> firstMap( toIndexPairs( firstWords ) ) ; std::map<std::string , int> secondMap( toIndexPairs( secondWords ) ) ; std::vector<std::string> commonWords ; std::sort( firstWords.begin( ) , firstWords.end( ) ) ; std::sort( secondWords.begin( ) , secondWords.end( ) ) ; std::vector<std::string> result ; std::set_intersection( firstWords.begin( ) , firstWords.end( ) , secondWords.begin( ) , secondWords.end( ) , std::back_inserter( result ) ) ; if ( result.size( ) > 0 ) { std::vector<std::pair<std::string , int>> allIndices ; for ( auto it = result.begin( ) ; it != result.end( ) ; it++ ) { allIndices.push_back( std::make_pair( *it , firstMap[*it] + secondMap[*it] )) ; } std::sort( allIndices.begin( ) , allIndices.end( ) , []( const auto p1 , const auto p2 ){ return p1.second < p2.second ; } ) ; int minimum = allIndices.begin( )->second ; std::vector<std::string> output ; for ( auto & p : allIndices ) { if ( p.second == minimum ) output.push_back( p.first ) ; } std::sort( output.begin( ) , output.end( ) ) ; std::cout << "(" ; std::copy( output.begin( ) , output.end( ) , std::ostream_iterator<std::string>( std::cout , " " )) ; std::cout << ")\n" ; } else std::cout << "()" << std::endl ; return 0 ; }
[ "mohammad.anwar@yahoo.com" ]
mohammad.anwar@yahoo.com
4e3bc31605da87c523bfdd9e116ab5347fa61eee
ebade0c5d9aa64f9bff35518bf611afef28e6bc5
/ZFFramework/src/ZFUIWidget/ZFUIListView.cpp
bfd3c20d9fe42dde22fa2a1c41da223a5357b4dc
[ "MIT" ]
permissive
lyhistory/ZFFramework
e9c58db2efa9428ed51fa58a4f65a88886b8ddfc
a61357a4e5211960fe6769265627ddcf6330e937
refs/heads/master
2021-01-14T08:31:05.709692
2015-12-26T03:17:30
2015-12-26T03:17:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
63,389
cpp
/* ====================================================================== * * Copyright (c) 2010-2015 ZSaberLv0 * home page: http://ZFFramework.com * blog: http://zsaber.com * contact: master@zsaber.com (Chinese and English only) * * * Distributed under MIT license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * ====================================================================== */ #include "ZFPrivate_ZFUIWidget.hh" #include "ZFUIListView.h" ZF_NAMESPACE_GLOBAL_BEGIN ZFSTYLE_DEFAULT_DEFINE(ZFUIListViewStyle, ZFUIScrollViewStyle) // ============================================================ // _ZFP_ZFUIListViewPrivate zfclassNotPOD _ZFP_ZFUIListViewPrivate { public: ZFUIListView *thisView; zfbool childAddOverrideFlag; zfbool scrollContentFrameOverrideFlag; ZFUISize thisViewSize; ZFUIListAdapter *listAdapter; zfbool listReloadRequested; zfbool listItemNeedUpdate; zfindex listItemCount; ZFCoreArrayPOD<zfint> listItemSizeList; ZFCoreArrayPOD<ZFUIView *> listVisibleItem; zfindexRange listVisibleItemIndexRange; /* * left: left most item's x * top: top most item's y * right: right most item's (x + width) * bottom: bottom most item's (y + height) */ zfint listVisibleItemOffset; zfbool listVisibleItemOffsetNeedUpdate; zfbool listReloadByChangeListOrientation; /* * used by scrollListItemToHead/Tail * if activating, we will recursively scrollByPoint until reach desired position * task would be canceled if content frame changed manually */ zfindex scrollListItemIndex; // zfindexMax if not activating zfint scrollListItemOffset; zfbool scrollListItemToHead; zfbool scrollListItemAnimated; zfint scrollListItemDesiredPosSaved; public: _ZFP_ZFUIListViewPrivate(void) : thisView(zfnull) , childAddOverrideFlag(zffalse) , scrollContentFrameOverrideFlag(zffalse) , thisViewSize(ZFUISizeZero) , listAdapter(zfnull) , listReloadRequested(zftrue) , listItemNeedUpdate(zftrue) , listItemCount(0) , listItemSizeList() , listVisibleItem() , listVisibleItemIndexRange(zfindexRangeZero) , listVisibleItemOffset(0) , listVisibleItemOffsetNeedUpdate(zftrue) , listReloadByChangeListOrientation(zftrue) , scrollListItemIndex(zfindexMax) , scrollListItemOffset(0) , scrollListItemToHead(zftrue) , scrollListItemAnimated(zftrue) , scrollListItemDesiredPosSaved(0) { } public: void listBounceUpdate(void) { if(this->thisView->listBounce()) { switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: case ZFUIOrientation::e_Right: this->thisView->scrollBounceVerticalAlwaysSet(zffalse); this->thisView->scrollBounceHorizontalAlwaysSet(zftrue); break; case ZFUIOrientation::e_Top: case ZFUIOrientation::e_Bottom: this->thisView->scrollBounceVerticalAlwaysSet(zftrue); this->thisView->scrollBounceHorizontalAlwaysSet(zffalse); break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ; } } } public: void childAdd(ZF_IN ZFUIView *child) { this->childAddOverrideFlag = zftrue; this->thisView->childAdd(child); this->childAddOverrideFlag = zffalse; } void childAdd(ZF_IN ZFUIView *child, ZFUIViewLayoutParam *layoutParam, ZF_IN zfindex index) { this->childAddOverrideFlag = zftrue; this->thisView->childAdd(child, layoutParam, index); this->childAddOverrideFlag = zffalse; } void childRemoveAtIndex(ZF_IN zfindex index) { this->childAddOverrideFlag = zftrue; this->thisView->childRemoveAtIndex(index); this->childAddOverrideFlag = zffalse; } zfautoObject itemLoadAtIndex(ZF_IN zfindex index) { return this->listAdapter->listItemAtIndex(index); } zfint listItemSizeAtIndex(ZF_IN zfindex index, ZF_IN ZFUIView *item) { zfint ret = this->listAdapter->listItemSizeAtIndex(index, item); if(ret < 0) { switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: case ZFUIOrientation::e_Right: ret = item->layoutMeasure(ZFUISizeMake(-1, this->thisViewSize.height - ZFUIMarginGetY(this->thisView->scrollThumbMargin())), ZFUISizeParamWrapWidthFillHeight).width; break; case ZFUIOrientation::e_Top: case ZFUIOrientation::e_Bottom: ret = item->layoutMeasure(ZFUISizeMake(this->thisViewSize.width - ZFUIMarginGetX(this->thisView->scrollThumbMargin())), ZFUISizeParamFillWidthWrapHeight).height; break; } } return ret; } void removeAll(void) { this->listItemCount = 0; this->listItemSizeList.removeAll(); this->listVisibleItemIndexRange = zfindexRangeZero; this->listVisibleItemOffset = 0; if(!this->listVisibleItem.isEmpty()) { for(zfindex i = this->listVisibleItem.count() - 1; i != zfindexMax; --i) { ZFUIView *view = this->listVisibleItem[i]; this->childRemoveAtIndex(i); if(this->listAdapter != zfnull) { this->listAdapter->listItemOnRecycle(view); } this->thisView->listItemOnDetach(view); zfReleaseWithLeakTest(view); } this->listVisibleItem.removeAll(); } } void itemRemoveBefore(ZF_IN zfindex index) { if(index < this->listVisibleItemIndexRange.start || index == zfindexMax) { return ; } zfindex indexOfVisibleItem = index - this->listVisibleItemIndexRange.start; for(zfindex i = indexOfVisibleItem; i != zfindexMax; --i) { this->childRemoveAtIndex(i); ZFUIView *item = this->listVisibleItem[i]; this->listAdapter->listItemOnRecycle(item); this->thisView->listItemOnDetach(item); zfReleaseWithLeakTest(item); } this->listVisibleItem.remove(0, indexOfVisibleItem + 1); this->listVisibleItemIndexRange.start = index + 1; this->listVisibleItemIndexRange.count = this->listVisibleItem.count(); } void itemRemoveAfter(ZF_IN zfindex index) { if(index >= this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { return ; } zfindex indexOfVisibleItem = index - this->listVisibleItemIndexRange.start; for(zfindex i = this->listVisibleItemIndexRange.count - 1; i != zfindexMax && i >= indexOfVisibleItem; --i) { this->childRemoveAtIndex(i); ZFUIView *item = this->listVisibleItem[i]; this->listAdapter->listItemOnRecycle(item); this->thisView->listItemOnDetach(item); zfReleaseWithLeakTest(item); } this->listVisibleItem.remove(indexOfVisibleItem, zfindexMax); this->listVisibleItemIndexRange.count = this->listVisibleItem.count(); } void updateHeadItemBeforeIndex(ZF_IN zfindex index, ZF_IN const ZFUIRect &itemFrame) { this->scrollContentFrameOverrideFlag = zftrue; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: { zfint offset = itemFrame.point.x + itemFrame.size.width; zfint offsetEnd = -this->thisView->scrollContentFrame().point.x; zfint offsetBegin = offsetEnd + this->thisViewSize.width; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; --index) { if(offset < offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveBefore(index); break; } offset -= this->listItemSizeList[index]; } // skip for( ; index != zfindexMax && offset - this->listItemSizeList[index] > offsetBegin; --index) { offset -= this->listItemSizeList[index]; } // load if(index != zfindexMax) { zfint sizeDelta = 0; for( ; index != zfindexMax && offset >= offsetEnd; --index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset -= this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(0, itemNew); this->listVisibleItemIndexRange.start = index; ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew, zfnull, 0); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); offset -= itemSizeNew; } // update content if(sizeDelta != 0) { ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.point.x -= sizeDelta; contentFrame.size.width += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } if(index == zfindexMax) { this->listVisibleItemOffset = 0; } else { this->listVisibleItemOffset = offset + sizeDelta; } } } break; case ZFUIOrientation::e_Top: { zfint offset = itemFrame.point.y + itemFrame.size.height; zfint offsetEnd = -this->thisView->scrollContentFrame().point.y; zfint offsetBegin = offsetEnd + this->thisViewSize.height; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; --index) { if(offset < offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveBefore(index); break; } offset -= this->listItemSizeList[index]; } // skip for( ; index != zfindexMax && offset - this->listItemSizeList[index] > offsetBegin; --index) { offset -= this->listItemSizeList[index]; } // load if(index != zfindexMax) { zfint sizeDelta = 0; for( ; index != zfindexMax && offset >= offsetEnd; --index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset -= this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(0, itemNew); this->listVisibleItemIndexRange.start = index; ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew, zfnull, 0); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); offset -= itemSizeNew; } // update content if(sizeDelta != 0) { ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.point.y -= sizeDelta; contentFrame.size.height += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } if(index == zfindexMax) { this->listVisibleItemOffset = 0; } else { this->listVisibleItemOffset = offset + sizeDelta; } } } break; case ZFUIOrientation::e_Right: { zfint offset = itemFrame.point.x; zfint offsetEnd = this->thisViewSize.width - this->thisView->scrollContentFrame().point.x; zfint offsetBegin = offsetEnd - this->thisViewSize.width; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; --index) { if(offset > offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveBefore(index); break; } offset += this->listItemSizeList[index]; } // skip for( ; index != zfindexMax && offset + this->listItemSizeList[index] < offsetBegin; --index) { offset += this->listItemSizeList[index]; } // load if(index != zfindexMax) { zfint sizeDelta = 0; for( ; index != zfindexMax && offset <= offsetEnd; --index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset += this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(0, itemNew); this->listVisibleItemIndexRange.start = index; ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew, zfnull, 0); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); offset += itemSizeNew; } // update content if(sizeDelta != 0) { ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.size.width += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } this->listVisibleItemOffset = offset; } } break; case ZFUIOrientation::e_Bottom: { zfint offset = itemFrame.point.y; zfint offsetEnd = this->thisViewSize.height - this->thisView->scrollContentFrame().point.y; zfint offsetBegin = offsetEnd - this->thisViewSize.height; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; --index) { if(offset > offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveBefore(index); break; } offset += this->listItemSizeList[index]; } // skip for( ; index != zfindexMax && offset + this->listItemSizeList[index] < offsetBegin; --index) { offset += this->listItemSizeList[index]; } // load if(index != zfindexMax) { zfint sizeDelta = 0; for( ; index != zfindexMax && offset <= offsetEnd; --index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset += this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(0, itemNew); this->listVisibleItemIndexRange.start = index; ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew, zfnull, 0); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); offset += itemSizeNew; } // update content if(sizeDelta != 0) { ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.size.height += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } this->listVisibleItemOffset = offset; } } break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ; } this->listVisibleItemOffsetNeedUpdate = zffalse; this->scrollContentFrameOverrideFlag = zffalse; } void updateTailItemAfterIndex(ZF_IN zfindex index, ZF_IN const ZFUIRect &itemFrame) { this->scrollContentFrameOverrideFlag = zftrue; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: { zfint offset = itemFrame.point.x; zfint offsetEnd = this->thisViewSize.width - this->thisView->scrollContentFrame().point.x; zfint offsetBegin = offsetEnd - this->thisViewSize.width; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; ++index) { if(offset > offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveAfter(index); break; } offset += this->listItemSizeList[index]; } // skip for( ; index < this->listItemCount && offset + this->listItemSizeList[index] < offsetBegin; ++index) { offset += this->listItemSizeList[index]; } // load if(index < this->listItemCount) { zfint sizeDelta = 0; for( ; index < this->listItemCount && offset <= offsetEnd; ++index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset += this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(itemNew); ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); if(this->listVisibleItemIndexRange.count == 1) { this->listVisibleItemIndexRange.start = index; if(index == 0) { this->listVisibleItemOffset = 0; } else { this->listVisibleItemOffset = offset; } } offset += itemSizeNew; } // update content if(sizeDelta != 0) { ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.size.width += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } } } break; case ZFUIOrientation::e_Top: { zfint offset = itemFrame.point.y; zfint offsetEnd = this->thisViewSize.height - this->thisView->scrollContentFrame().point.y; zfint offsetBegin = offsetEnd - this->thisViewSize.height; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; ++index) { if(offset > offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveAfter(index); break; } offset += this->listItemSizeList[index]; } // skip for( ; index < this->listItemCount && offset + this->listItemSizeList[index] < offsetBegin; ++index) { offset += this->listItemSizeList[index]; } // load if(index < this->listItemCount) { zfint sizeDelta = 0; for( ; index < this->listItemCount && offset <= offsetEnd; ++index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset += this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(itemNew); ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); if(this->listVisibleItemIndexRange.count == 1) { this->listVisibleItemIndexRange.start = index; if(index == 0) { this->listVisibleItemOffset = 0; } else { this->listVisibleItemOffset = offset; } } offset += itemSizeNew; } // update content if(sizeDelta != 0) { ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.size.height += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } } } break; case ZFUIOrientation::e_Right: { zfint offset = itemFrame.point.x + itemFrame.size.width; zfint offsetEnd = -this->thisView->scrollContentFrame().point.x; zfint offsetBegin = offsetEnd + this->thisViewSize.width; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; ++index) { if(offset < offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveAfter(index); break; } offset -= this->listItemSizeList[index]; } // skip for( ; index < this->listItemCount && offset - this->listItemSizeList[index] > offsetBegin; ++index) { offset -= this->listItemSizeList[index]; } // load if(index < this->listItemCount) { zfint sizeDelta = 0; for( ; index < this->listItemCount && offset >= offsetEnd; ++index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset -= this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(itemNew); ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); if(this->listVisibleItemIndexRange.count == 1) { this->listVisibleItemOffset = offset; } offset -= itemSizeNew; } // update content if(sizeDelta != 0) { this->listVisibleItemOffset += sizeDelta; ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.point.x -= sizeDelta; contentFrame.size.width += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } } } break; case ZFUIOrientation::e_Bottom: { zfint offset = itemFrame.point.y + itemFrame.size.height; zfint offsetEnd = -this->thisView->scrollContentFrame().point.y; zfint offsetBegin = offsetEnd + this->thisViewSize.height; // remove items exceeds visible range for( ; index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count; ++index) { if(offset < offsetEnd) { this->listItemNeedUpdate = zftrue; this->itemRemoveAfter(index); break; } offset -= this->listItemSizeList[index]; } // skip for( ; index < this->listItemCount && offset - this->listItemSizeList[index] > offsetBegin; ++index) { offset -= this->listItemSizeList[index]; } // load if(index < this->listItemCount) { zfint sizeDelta = 0; for( ; index < this->listItemCount && offset >= offsetEnd; ++index) { if(index >= this->listVisibleItemIndexRange.start && index < this->listVisibleItemIndexRange.start + this->listVisibleItemIndexRange.count) { offset -= this->listItemSizeList[index]; continue; } this->listItemNeedUpdate = zftrue; ZFUIView *itemNew = zfRetainWithLeakTest(this->itemLoadAtIndex(index).to<ZFUIView *>()); zfint itemSizeNew = this->listItemSizeAtIndex(index, itemNew); if(itemSizeNew != this->listItemSizeList[index]) { sizeDelta += itemSizeNew - this->listItemSizeList[index]; this->listItemSizeList[index] = itemSizeNew; } this->listVisibleItem.add(itemNew); ++(this->listVisibleItemIndexRange.count); this->childAdd(itemNew); this->thisView->listItemOnAttach(itemNew); this->listAdapter->listItemOnUpdate(index, itemNew); if(this->listVisibleItemIndexRange.count == 1) { this->listVisibleItemOffset = offset; } offset -= itemSizeNew; } // update content if(sizeDelta != 0) { this->listVisibleItemOffset += sizeDelta; ZFUIRect contentFrame = this->thisView->scrollContentFrame(); contentFrame.point.y -= sizeDelta; contentFrame.size.height += sizeDelta; this->thisView->scrollContentFrameSetWhileAnimating(contentFrame); } } } break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ; } this->listVisibleItemOffsetNeedUpdate = zffalse; this->scrollContentFrameOverrideFlag = zffalse; } void updateFromFirstItem(void) { if(this->listItemCount == 0) { return ; } zfint itemSize = this->listItemSizeList[0]; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: this->updateTailItemAfterIndex(0, ZFUIRectMake( 0, 0, itemSize, this->thisViewSize.height)); break; case ZFUIOrientation::e_Top: this->updateTailItemAfterIndex(0, ZFUIRectMake( 0, 0, this->thisViewSize.width, itemSize)); break; case ZFUIOrientation::e_Right: this->updateTailItemAfterIndex(0, ZFUIRectMake( this->thisView->scrollContentFrame().size.width - itemSize, 0, itemSize, this->thisViewSize.height)); break; case ZFUIOrientation::e_Bottom: this->updateTailItemAfterIndex(0, ZFUIRectMake( 0, this->thisView->scrollContentFrame().size.height - itemSize, this->thisViewSize.width, itemSize)); break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ; } } ZFUIRect listVisibleItemFrame(ZF_IN zfindex itemIndex) { ZFUIRect ret = ZFUIRectZero; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: ret.point.x = this->listVisibleItemOffset; ret.size.height = this->thisViewSize.height; for(zfindex i = this->listVisibleItemIndexRange.start; ; ++i) { if(i == itemIndex) { ret.size.width = this->listItemSizeList[i]; break; } ret.point.x += this->listItemSizeList[i]; } break; case ZFUIOrientation::e_Top: ret.point.y = this->listVisibleItemOffset; ret.size.width = this->thisViewSize.width; for(zfindex i = this->listVisibleItemIndexRange.start; ; ++i) { if(i == itemIndex) { ret.size.height = this->listItemSizeList[i]; break; } ret.point.y += this->listItemSizeList[i]; } break; case ZFUIOrientation::e_Right: ret.point.x = this->listVisibleItemOffset; ret.size.height = this->thisViewSize.height; for(zfindex i = this->listVisibleItemIndexRange.start; ; ++i) { ret.point.x -= this->listItemSizeList[i]; if(i == itemIndex) { ret.size.width = this->listItemSizeList[i]; break; } } break; case ZFUIOrientation::e_Bottom: ret.point.y = this->listVisibleItemOffset; ret.size.width = this->thisViewSize.width; for(zfindex i = this->listVisibleItemIndexRange.start; ; ++i) { ret.point.y -= this->listItemSizeList[i]; if(i == itemIndex) { ret.size.height = this->listItemSizeList[i]; break; } } break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ZFUIRectZero; } return ret; } void listCheckReload(void) { if(!this->listReloadRequested) { return ; } if(this->listAdapter == zfnull) { this->thisView->layoutRequestOverride(zftrue); this->removeAll(); this->scrollContentFrameOverrideFlag = zftrue; this->thisView->scrollContentFrameSet(ZFUIRectZero); this->scrollContentFrameOverrideFlag = zffalse; this->listReloadRequested = zffalse; this->thisView->listVisibleItemOnChange(); this->thisView->layoutRequestOverride(zffalse); this->thisView->layoutIfNeed(); return ; } this->listItemNeedUpdate = zftrue; this->thisView->layoutRequestOverride(zftrue); this->listItemCount = this->listAdapter->listItemCount(); if(this->listItemSizeList.count() > this->listItemCount) { this->listItemSizeList.remove(this->listItemCount, zfindexMax); } else { zfint listItemSizeHint = zfmMax(this->thisView->listItemSizeHint(), ZFUIGlobalStyle::defaultStyle()->itemSizeHintNormal()); this->listItemSizeList.capacitySet(this->listItemCount); for(zfindex i = this->listItemSizeList.count(); i < this->listItemCount; ++i) { this->listItemSizeList.add(listItemSizeHint); } } zfint totalSize = 0; { const zfint *buf = this->listItemSizeList.arrayBuf(); for(zfindex i = 0, iEnd = this->listItemSizeList.count(); i < iEnd; ++i) { totalSize += *buf; ++buf; } } this->scrollContentFrameOverrideFlag = zftrue; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: case ZFUIOrientation::e_Right: { ZFUIRect scrollContentFrameNew = ZFUIRectMake( this->thisView->scrollContentFrame().point.x, this->thisView->scrollThumbMargin().top, zfmMax(totalSize, this->thisViewSize.width), this->thisViewSize.height); if(this->listReloadByChangeListOrientation) { if(this->thisView->listOrientation() == ZFUIOrientation::e_Left) { scrollContentFrameNew.point.x = 0; } else { scrollContentFrameNew.point.x = this->thisViewSize.width - scrollContentFrameNew.size.width; } } this->thisView->scrollContentFrameSetWhileAnimating(scrollContentFrameNew); } break; case ZFUIOrientation::e_Top: case ZFUIOrientation::e_Bottom: { ZFUIRect scrollContentFrameNew = ZFUIRectMake( this->thisView->scrollThumbMargin().left, this->thisView->scrollContentFrame().point.y, this->thisViewSize.width, zfmMax(totalSize, this->thisViewSize.height)); if(this->listReloadByChangeListOrientation) { if(this->thisView->listOrientation() == ZFUIOrientation::e_Top) { scrollContentFrameNew.point.y = 0; } else { scrollContentFrameNew.point.y = this->thisViewSize.height - scrollContentFrameNew.size.height; } } this->thisView->scrollContentFrameSetWhileAnimating(scrollContentFrameNew); } break; } this->scrollContentFrameOverrideFlag = zffalse; zfindex itemIndex = zfindexMax; if(!this->listVisibleItem.isEmpty()) { itemIndex = this->listVisibleItemIndexRange.start; } this->listVisibleItemIndexRange = zfindexRangeZero; for(zfindex i = this->listVisibleItem.count() - 1; i != zfindexMax; --i) { ZFUIView *view = this->listVisibleItem[i]; this->childRemoveAtIndex(i); this->listAdapter->listItemOnRecycle(view); this->thisView->listItemOnDetach(view); zfReleaseWithLeakTest(view); } this->listVisibleItem.removeAll(); if(itemIndex != zfindexMax && !this->listVisibleItemOffsetNeedUpdate) { ZFUIRect itemFrame = this->listVisibleItemFrame(itemIndex); this->updateHeadItemBeforeIndex(itemIndex, itemFrame); if(!this->listVisibleItem.isEmpty()) { itemIndex = this->listVisibleItemIndexRange.start; itemFrame = this->listVisibleItemFrame(itemIndex); this->updateTailItemAfterIndex(itemIndex, itemFrame); } else { this->updateFromFirstItem(); } } else { this->updateFromFirstItem(); } this->listReloadRequested = zffalse; this->listReloadByChangeListOrientation = zffalse; this->thisView->listVisibleItemOnChange(); // fix content range ZFUIRect scrollContentFrame = this->thisView->scrollContentFrame(); if(scrollContentFrame.point.x > 0) { scrollContentFrame.point.x = 0; } if(scrollContentFrame.point.y > 0) { scrollContentFrame.point.y = 0; } if(scrollContentFrame.size.width > this->thisViewSize.width && scrollContentFrame.point.x + scrollContentFrame.size.width < this->thisViewSize.width) { scrollContentFrame.point.x = this->thisViewSize.width - scrollContentFrame.size.width; } if(scrollContentFrame.size.height > this->thisViewSize.height && scrollContentFrame.point.y + scrollContentFrame.size.height < this->thisViewSize.height) { scrollContentFrame.point.y = this->thisViewSize.height - scrollContentFrame.size.height; } this->thisView->scrollContentFrameSetWhileAnimating(scrollContentFrame); this->thisView->layoutRequestOverride(zffalse); this->thisView->layoutIfNeed(); } void updateItemLayout(void) { if(!this->listItemNeedUpdate) { return ; } this->listItemNeedUpdate = zffalse; const ZFUIMargin &contentMargin = this->thisView->scrollThumbMargin(); zfint offset = 0; zfint fillSize = 0; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: offset = this->listVisibleItemOffset; fillSize = this->thisView->layoutedFrame().size.height - ZFUIMarginGetY(contentMargin); for(zfindex i = 0; i < this->listVisibleItem.count(); ++i) { zfint itemWidth = this->listItemSizeList[this->listVisibleItemIndexRange.start + i]; this->listVisibleItem[i]->layout(ZFUIRectMake( offset, contentMargin.top, itemWidth, fillSize )); offset += itemWidth; } break; case ZFUIOrientation::e_Top: offset = this->listVisibleItemOffset; fillSize = this->thisView->layoutedFrame().size.width - ZFUIMarginGetX(contentMargin); for(zfindex i = 0; i < this->listVisibleItem.count(); ++i) { zfint itemHeight = this->listItemSizeList[this->listVisibleItemIndexRange.start + i]; this->listVisibleItem[i]->layout(ZFUIRectMake( contentMargin.left, offset, fillSize, itemHeight )); offset += itemHeight; } break; case ZFUIOrientation::e_Right: offset = this->listVisibleItemOffset; fillSize = this->thisView->layoutedFrame().size.height - ZFUIMarginGetY(contentMargin); for(zfindex i = 0; i < this->listVisibleItem.count(); ++i) { zfint itemWidth = this->listItemSizeList[this->listVisibleItemIndexRange.start + i]; offset -= itemWidth; this->listVisibleItem[i]->layout(ZFUIRectMake( offset, contentMargin.top, itemWidth, fillSize )); } break; case ZFUIOrientation::e_Bottom: offset = this->listVisibleItemOffset; fillSize = this->thisView->layoutedFrame().size.width - ZFUIMarginGetX(contentMargin); for(zfindex i = 0; i < this->listVisibleItem.count(); ++i) { zfint itemHeight = this->listItemSizeList[this->listVisibleItemIndexRange.start + i]; offset -= itemHeight; this->listVisibleItem[i]->layout(ZFUIRectMake( contentMargin.left, offset, fillSize, itemHeight )); } break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ; } } public: void scrollListItemCheckUpdate(void) { if(this->scrollListItemIndex == zfindexMax) { return ; } zfint desiredPos = this->scrollListItemDesiredPosCalc(); if(!this->scrollListItemAnimated) { while(this->scrollListItemIndex != zfindexMax && desiredPos != this->scrollListItemDesiredPosSaved) { this->scrollListItemScrollToPos(desiredPos, zffalse); } this->scrollListItemIndex = zfindexMax; return ; } if(desiredPos != this->scrollListItemDesiredPosSaved) { this->scrollListItemScrollToPos(desiredPos, zftrue); } else { this->scrollListItemIndex = zfindexMax; } } private: zfint scrollListItemDesiredPosCalc(void) { zfint offset = 0; for(const zfint *p = this->listItemSizeList.arrayBuf(), *pEnd = p + this->scrollListItemIndex; p != pEnd; ++p) { offset += *p; } if(this->scrollListItemToHead) { return this->scrollListItemOffset - offset; } else { if(ZFUIOrientationIsHorizontal(this->thisView->listOrientation())) { return this->thisViewSize.width - (offset + this->listItemSizeList[this->scrollListItemIndex] + this->scrollListItemOffset); } else { return this->thisViewSize.height - (offset + this->listItemSizeList[this->scrollListItemIndex] + this->scrollListItemOffset); } } } void scrollListItemScrollToPos(ZF_IN zfint pos, ZF_IN zfbool animated) { this->scrollListItemDesiredPosSaved = pos; this->thisView->scrollOverrideSet(zftrue); const ZFUIRect &scrollContentFrame = this->thisView->scrollContentFrame(); zfint posX = 0; zfint posY = 0; switch(this->thisView->listOrientation()) { case ZFUIOrientation::e_Left: posX = pos; posY = scrollContentFrame.point.y; break; case ZFUIOrientation::e_Top: posX = scrollContentFrame.point.x; posY = pos; break; case ZFUIOrientation::e_Right: posX = this->thisViewSize.width - pos - scrollContentFrame.size.width; posY = scrollContentFrame.point.y; break; case ZFUIOrientation::e_Bottom: posX = scrollContentFrame.point.x; posY = this->thisViewSize.height - pos - scrollContentFrame.size.height; break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); break; } if(animated) { this->thisView->scrollByPoint(posX, posY); } else { this->thisView->scrollContentFrameSet(ZFUIRectMake(posX, posY, scrollContentFrame.size.width, scrollContentFrame.size.height)); } this->thisView->scrollOverrideSet(zffalse); } }; // ============================================================ // ZFUIListView ZFOBJECT_REGISTER(ZFUIListView) ZFPROPERTY_OVERRIDE_SETTER_DEFINE(ZFUIListView, ZFUIListAdapter *, listAdapter) { if(this->listAdapter() != newValue) { zfsuperI(ZFUIListViewStyle)::listAdapterSet(newValue); d->listAdapter = this->listAdapter(); this->listReload(); } } ZFPROPERTY_OVERRIDE_SETTER_DEFINE(ZFUIListView, ZFUIOrientationEnum, listOrientation) { if(this->listOrientation() != newValue) { zfsuperI(ZFUIListViewStyle)::listOrientationSet(newValue); d->listBounceUpdate(); d->listReloadByChangeListOrientation = zftrue; this->listReload(); } } ZFPROPERTY_OVERRIDE_SETTER_DEFINE(ZFUIListView, zfint, listItemSizeHint) { if(this->listItemSizeHint() != newValue) { zfsuperI(ZFUIListViewStyle)::listItemSizeHintSet(newValue); this->listReload(); } } ZFPROPERTY_OVERRIDE_SETTER_DEFINE(ZFUIListView, zfbool, listBounce) { if(this->listBounce() != newValue) { zfsuperI(ZFUIListViewStyle)::listBounceSet(newValue); d->listBounceUpdate(); } } // ============================================================ ZFObject *ZFUIListView::objectOnInit(void) { zfsuper::objectOnInit(); d = zfprivateNew(_ZFP_ZFUIListViewPrivate); d->thisView = this; d->listBounceUpdate(); return this; } void ZFUIListView::objectOnDealloc(void) { zfprivateDelete(_ZFP_ZFUIListViewPrivate, d); zfsuper::objectOnDealloc(); } void ZFUIListView::objectOnDeallocPrepare(void) { d->childAddOverrideFlag = zftrue; this->listAdapterSet(zfnull); zfsuper::objectOnDeallocPrepare(); d->childAddOverrideFlag = zffalse; } ZFSerializable::PropertyType ZFUIListView::serializableOnCheckPropertyType(ZF_IN const ZFProperty *property) { if(property == ZFPropertyAccess(ZFUIScrollView, scrollContentFrame) || property == ZFPropertyAccess(ZFUIScrollView, scrollBounceVertical) || property == ZFPropertyAccess(ZFUIScrollView, scrollBounceHorizontal) || property == ZFPropertyAccess(ZFUIScrollView, scrollBounceVerticalAlways) || property == ZFPropertyAccess(ZFUIScrollView, scrollBounceHorizontalAlways) ) { return ZFSerializable::PropertyTypeNotSerializable; } else { return zfsuperI(ZFSerializable)::serializableOnCheckPropertyType(property); } } ZFUISize ZFUIListView::layoutOnMeasure(ZF_IN const ZFUISize &sizeHint, ZF_IN const ZFUISize &sizeParam) { return ZFUISizeMake(zfmMax(sizeHint.width, 0), zfmMax(sizeHint.height, 0)); } void ZFUIListView::layoutOnLayoutPrepare(ZF_IN const ZFUIRect &bounds) { if(!this->listReloadRequested() && this->layoutedFrame().size != this->layoutedFramePrev().size) { this->listReload(); } if(d->listReloadRequested && d->listAdapter != zfnull) { // update list adapter's settings d->listAdapter->listOrientationSet(this->listOrientation()); d->listAdapter->listItemSizeHintSet(this->listItemSizeHint()); d->thisViewSize = ZFUISizeMake( bounds.size.width - ZFUIMarginGetX(this->scrollThumbMargin()), bounds.size.height - ZFUIMarginGetY(this->scrollThumbMargin())); d->listAdapter->listContainerSizeSet(d->thisViewSize); } zfsuper::layoutOnLayoutPrepare(bounds); d->listCheckReload(); } void ZFUIListView::layoutOnLayout(ZF_IN const ZFUIRect &bounds) { d->updateItemLayout(); } void ZFUIListView::viewChildOnAdd(ZF_IN ZFUIView *child, ZF_IN ZFUIViewChildLayerEnum layer) { zfsuper::viewChildOnAdd(child, layer); if(layer == ZFUIViewChildLayer::e_Normal && !d->childAddOverrideFlag) { zfCoreCriticalErrorPrepare(); zfCoreLog(zfTextA("you must not add child to a list view")); zfCoreCriticalError(); } } void ZFUIListView::viewChildOnRemove(ZF_IN ZFUIView *child, ZF_IN ZFUIViewChildLayerEnum layer) { if(layer == ZFUIViewChildLayer::e_Normal && !d->childAddOverrideFlag) { zfCoreCriticalErrorPrepare(); zfCoreLog(zfTextA("you must not remove child from a list view")); zfCoreCriticalError(); } zfsuper::viewChildOnRemove(child, layer); } void ZFUIListView::scrollThumbMarginOnChange(void) { zfsuper::scrollThumbMarginOnChange(); this->listReload(); } void ZFUIListView::scrollContentFrameOnChange(void) { zfsuper::scrollContentFrameOnChange(); if(d->scrollContentFrameOverrideFlag) { return ; } d->listCheckReload(); if(d->listAdapter == zfnull) { return ; } this->layoutRequestOverride(zftrue); if(!d->listVisibleItem.isEmpty() && !d->listVisibleItemOffsetNeedUpdate) { zfindex itemIndex = d->listVisibleItemIndexRange.start + d->listVisibleItemIndexRange.count - 1; ZFUIRect itemFrame = d->listVisibleItemFrame(itemIndex); d->updateHeadItemBeforeIndex(itemIndex, itemFrame); if(!d->listVisibleItem.isEmpty()) { itemIndex = d->listVisibleItemIndexRange.start; itemFrame = d->listVisibleItemFrame(itemIndex); d->updateTailItemAfterIndex(itemIndex, itemFrame); } else { d->updateFromFirstItem(); } } else { d->updateFromFirstItem(); } this->layoutRequestOverride(zffalse); zfbool changed = d->listItemNeedUpdate; this->layoutIfNeed(); if(changed) { this->listVisibleItemOnChange(); } } void ZFUIListView::scrollOnScrolledByUser(void) { zfsuper::scrollOnScrolledByUser(); // cancel scrollListItemToHead/Tail task d->scrollListItemIndex = zfindexMax; } void ZFUIListView::scrollOnScrollEnd(void) { zfsuper::scrollOnScrollEnd(); // cancel scrollListItemToHead/Tail task d->scrollListItemIndex = zfindexMax; } // ============================================================ void ZFUIListView::listReload(void) { if(!d->listReloadRequested) { d->listReloadRequested = zftrue; d->listItemNeedUpdate = zftrue; d->listVisibleItemOffsetNeedUpdate = zftrue; this->layoutRequest(); } } zfbool ZFUIListView::listReloadRequested(void) { return d->listReloadRequested; } void ZFUIListView::listReloadItemAtIndex(ZF_IN zfindex index) { if(d->listReloadRequested || !zfindexRangeContain(d->listVisibleItemIndexRange, index)) { return ; } d->listItemNeedUpdate = zftrue; this->layoutRequestOverride(zftrue); zfindex indexOfVisibleItem = index - d->listVisibleItemIndexRange.start; ZFUIView *itemOld = d->listVisibleItem[indexOfVisibleItem]; ZFUIRect itemOldFrame = d->listVisibleItemFrame(index); ZFUIView *itemNew = zfRetainWithLeakTest(d->itemLoadAtIndex(index).to<ZFUIView *>()); d->listVisibleItem[indexOfVisibleItem] = itemNew; this->childReplaceAtIndex(indexOfVisibleItem, itemNew); d->listAdapter->listItemOnRecycle(itemOld); this->listItemOnDetach(itemOld); this->listItemOnAttach(itemNew); d->listAdapter->listItemOnUpdate(index, itemNew); // update item size at index zfint itemNewSize = d->listItemSizeAtIndex(index, itemNew); d->listItemSizeList[index] = itemNewSize; // update all items after the reloaded one switch(this->listOrientation()) { case ZFUIOrientation::e_Left: case ZFUIOrientation::e_Right: itemOldFrame.size.width = itemNewSize; break; case ZFUIOrientation::e_Top: case ZFUIOrientation::e_Bottom: itemOldFrame.size.height = itemNewSize; break; default: zfCoreCriticalErrorPrepare(); zfCoreLogShouldNotGoHere(); zfCoreCriticalError(); return ; } d->updateTailItemAfterIndex(index, itemOldFrame); this->layoutRequestOverride(zffalse); this->layoutIfNeed(); // finally notify visible item changed this->listVisibleItemOnChange(); } ZFCoreArrayPOD<ZFUIView *> ZFUIListView::listVisibleItem(void) { return ZFCoreArrayPOD<ZFUIView *>(); } zfindexRange ZFUIListView::listVisibleItemIndexRange(void) { return d->listVisibleItemIndexRange; } void ZFUIListView::scrollListItemToHead(ZF_IN zfindex itemIndex, ZF_IN_OPT zfint offset /* = 0 */, ZF_IN_OPT zfbool animated /* = zftrue */) { if(itemIndex >= d->listItemCount) { d->scrollListItemIndex = zfindexMax; } else { d->scrollListItemIndex = itemIndex; } d->scrollListItemOffset = offset; d->scrollListItemAnimated = animated; d->scrollListItemToHead = zftrue; d->scrollListItemDesiredPosSaved = 30000; d->scrollListItemCheckUpdate(); } void ZFUIListView::scrollListItemToTail(ZF_IN zfindex itemIndex, ZF_IN_OPT zfint offset /* = 0 */, ZF_IN_OPT zfbool animated /* = zftrue */) { if(itemIndex >= d->listItemCount) { d->scrollListItemIndex = zfindexMax; } else { d->scrollListItemIndex = itemIndex; } d->scrollListItemOffset = offset; d->scrollListItemAnimated = animated; d->scrollListItemToHead = zffalse; d->scrollListItemDesiredPosSaved = 30000; d->scrollListItemCheckUpdate(); } void ZFUIListView::listVisibleItemOnChange(void) { this->observerNotify(ZFUIListView::EventListVisibleItemOnChange()); if(!this->scrollOverride()) { d->scrollListItemCheckUpdate(); } } ZF_NAMESPACE_GLOBAL_END
[ "z@zsaber.com" ]
z@zsaber.com
71661124b0740cd7fee71527739f83adecb5824a
536656cd89e4fa3a92b5dcab28657d60d1d244bd
/third_party/skia/src/sksl/ir/SkSLForStatement.h
96eaa6ff1c9aac869448eb3cbead844fd007a21f
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
permissive
ECS-251-W2020/chromium
79caebf50443f297557d9510620bf8d44a68399a
ac814e85cb870a6b569e184c7a60a70ff3cb19f9
refs/heads/master
2022-08-19T17:42:46.887573
2020-03-18T06:08:44
2020-03-18T06:08:44
248,141,336
7
8
BSD-3-Clause
2022-07-06T20:32:48
2020-03-18T04:52:18
null
UTF-8
C++
false
false
2,093
h
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SKSL_FORSTATEMENT #define SKSL_FORSTATEMENT #include "src/sksl/ir/SkSLExpression.h" #include "src/sksl/ir/SkSLStatement.h" #include "src/sksl/ir/SkSLSymbolTable.h" namespace SkSL { /** * A 'for' statement. */ struct ForStatement : public Statement { ForStatement(int offset, std::unique_ptr<Statement> initializer, std::unique_ptr<Expression> test, std::unique_ptr<Expression> next, std::unique_ptr<Statement> statement, std::shared_ptr<SymbolTable> symbols) : INHERITED(offset, kFor_Kind) , fSymbols(symbols) , fInitializer(std::move(initializer)) , fTest(std::move(test)) , fNext(std::move(next)) , fStatement(std::move(statement)) {} std::unique_ptr<Statement> clone() const override { return std::unique_ptr<Statement>(new ForStatement(fOffset, fInitializer->clone(), fTest->clone(), fNext->clone(), fStatement->clone(), fSymbols)); } #ifdef SK_DEBUG String description() const override { String result("for ("); if (fInitializer) { result += fInitializer->description(); } result += " "; if (fTest) { result += fTest->description(); } result += "; "; if (fNext) { result += fNext->description(); } result += ") " + fStatement->description(); return result; } #endif // it's important to keep fSymbols defined first (and thus destroyed last) because destroying // the other fields can update symbol reference counts const std::shared_ptr<SymbolTable> fSymbols; std::unique_ptr<Statement> fInitializer; std::unique_ptr<Expression> fTest; std::unique_ptr<Expression> fNext; std::unique_ptr<Statement> fStatement; typedef Statement INHERITED; }; } // namespace #endif
[ "pcding@ucdavis.edu" ]
pcding@ucdavis.edu
cc4c224ab0742ae3574ab8ddecf77d1e35538c51
abaaed318e5306b9ee3bc8fe54dc23b433834bef
/algorithm/pole point.cpp
a57aa7c62f76829f0faaefed9fbd4d6bab04797c
[]
no_license
amy58328/Cplusplus
52615204a26773580b0ffac57f03f78084392b34
4b402f71eede538ab651bab513544e791cc636f5
refs/heads/master
2021-07-14T10:42:58.685365
2020-06-01T16:43:15
2020-06-01T16:43:15
148,657,760
0
0
null
null
null
null
UTF-8
C++
false
false
819
cpp
// 練習struct // 題目網址:https://zerojudge.tw/ShowProblem?problemid=d555 #include<iostream> #include<cstdio> #include<cstring> #include<math.h> #include<algorithm> #define loop(i,n) for(int i=0;i<n;i++) using namespace std; struct point { int x; int y; }; bool cmp(point a , point b) { return a.y>b.y||(a.y==b.y)&&(a.x>b.x); } int main() { int time; for(int n=1;~scanf("%d",&time) ; n++) { point p[time],a; loop(i,time) scanf("%d %d" , &p[i].x , &p[i].y); sort(p,p+time,cmp); int j=0; int ans[1000]; a.x = -1; a.y = 100000; loop(i,time) { if(a.y != p[i].y && a.x < p[i].x) { ans[j] = i; j++; a = p[i]; } } printf("Case %d:\nDominate Point: %d\n",n,j ); loop(i,j) { printf("(%d,%d)\n",p[ans[i]].x,p[ans[i]].y ); } } return 0; }
[ "amy58328@gmail.com" ]
amy58328@gmail.com
e8a17cd6619190c81229e9fd3c02f621a1934021
754988a2062b5065bf15126e69b102d7b7a81a56
/symbian-ui-test-framework/ASE/aseng/inc/AseEngineExtra.h
8b906fbd4758dc578db6155834aa11b9432b3b00
[]
no_license
jcayzac/random-stuff
169482108188a6de32fd3a71e35f956b99c6193f
ebf86d5ed238c79640c0e9cc782214ead3464d3f
refs/heads/master
2021-01-10T19:16:34.463278
2019-08-24T06:32:11
2019-08-24T06:32:11
860,887
2
1
null
null
null
null
UTF-8
C++
false
false
1,230
h
#if !defined(ASEENGINEEXTRA_H_INCLUDED) #define ASEENGINEEXTRA_H_INCLUDED #include <e32std.h> #include <e32base.h> class skString; class MAseObserver; class CAseEngine2Extra: public CBase { public: void ReadConfigL(); void ReadValueL(const TDesC& aName, TInt& aValue); void ReadValueL(const TDesC& aName, skString& aValue); HBufC* ScreenShotFileNameLC(); HBufC* ScreenShotBase() const; void SetScreenShotBase(HBufC*); inline TBool IsRunning() const; inline void SetRunning(TBool aStatus); inline void SetObserver(MAseObserver* aObserver); inline MAseObserver* Observer(); ~CAseEngine2Extra(); private: // Config HBufC* iConfig; // ScreenShotBase HBufC* iScreenShotBase; TInt iScreenShotCounter; // script status TBool iRunning; // observer MAseObserver* iObserver; }; inline TBool CAseEngine2Extra::IsRunning() const { return iRunning; } inline void CAseEngine2Extra::SetRunning(TBool aStatus) { iRunning = aStatus; } inline void CAseEngine2Extra::SetObserver(MAseObserver* aObserver) { iObserver = aObserver; } inline MAseObserver* CAseEngine2Extra::Observer() { return iObserver; } #endif
[ "julien.cayzac@gmail.com" ]
julien.cayzac@gmail.com
f7269d9309ce74b7a7311b1abd669b836ddd32d2
4ecb45de6af70cd4019daeb1702225b14344e815
/tmp/libMidi/src/midi/MidiChannel.h
e5c325f97f18dde795a59b64cfc9c8668a928ae3
[]
no_license
rickonw/midi-test
532e150f1763226cbe52be2e9e09437859d69624
007f895587e60cc9a68cf986d8e1b2b16a0c5642
refs/heads/master
2021-08-24T05:37:42.455908
2017-12-08T07:47:11
2017-12-08T07:47:11
112,481,101
0
0
null
null
null
null
UTF-8
C++
false
false
4,284
h
/* * MidiEditor * Copyright (C) 2010 Markus Schwenk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file midi/MidiChannel.h * * \brief Headerfile. * * Contains the class description for ProtocolStep. */ #ifndef MIDICHANNEL_H_ #define MIDICHANNEL_H_ #include "../protocol/ProtocolEntry.h" #include <multimap> class MidiFile; class MidiEvent; class Color; class MidiTrack; class NoteOnEvent; /** * \class MidiChannel * * \brief Every MidiChannel represents an Instrument. * * In this program there are 18 MidiChannel: the 16 MidiChannels a MidiFile * can describe, the Channel saving general Events (like PitchBend), one channel * for TempoChangeEvents and one for TimeSignatureEvents. * * Every channel can be mutes, visible in the MatrixWidget or playing alone * (solomode). * * Every Channel saves his own Events in a QMultiMap of the format miditick, * Event. */ class MidiChannel : public ProtocolEntry { public: /** * \brief creates a new MidiChannel with number num. * * Sets the channels file to f. */ MidiChannel(MidiFile *f, int num); /** * \brief creates a copy of other. */ MidiChannel(MidiChannel &other); /** * \brief returns the channels file. */ MidiFile *file(); /** * \brief returns the channels number. * * 0-15 are MidiChannels, 16 for general Events, 17 for TempoChanges * and 18 for TimeSignatureEvents. */ int number(); /** * \brief returns the channels color. * * The color only depends on the channel number. */ Color *color(); /** * \brief returns the eventMap of the channel. * * This contains all MidiEvents of the channel. */ multimap<int, MidiEvent*> *eventMap(); /** * \brief inserts a note to this channel. */ NoteOnEvent* insertNote(int note, int startTick, int endTick, int velocity, MidiTrack *track); /** * \brief inserts event into the channels map. */ void insertEvent(MidiEvent *event, int tick); /** * \brief removes event from the eventMap. */ bool removeEvent(MidiEvent *event); /** * \brief returns the program number of the midi program at tick. */ int progAtTick(int tick); /** * \brief returns whether the channel is visible in the MatrixWidget. */ bool visible(); /** * \brief sets the channels visibility to b. */ void setVisible(bool b); /** * \brief returns whether the channel is muted. */ bool mute(); /** * \brief sets the channel mute or makes it loud. */ void setMute(bool b); /** * \brief returns whether the channel is playing in solo mode. * * If the channel is in solo mode, all other channels are muted. */ bool solo(); /** * \brief sets the solo mode to b. */ void setSolo(bool b); /** * \brief removes all events of the channel. */ void deleteAllEvents(); /** * \brief returns the color of the channel with the given number. */ static Color *colorByChannelNumber(int number); /* * The following methods reimplement methods from the superclass * ProtocolEntry */ ProtocolEntry *copy(); void reloadState(ProtocolEntry *entry); protected: /** * \brief the midiFile of this channel. */ MidiFile *_midiFile; /** * \brief the flags solo, mute and visible. */ bool _visible, _mute, _solo; /** * \brief contains all MidiEvents of the channel sorted by their tick. */ multimap<int, MidiEvent*> *_events; /** * \brief the channels color. * * This color is used to paint the channel in the matrix widget. */ Color *_color; /** * \brief the channels number. */ int _num; }; #endif
[ "rickonwong@163.com" ]
rickonwong@163.com
affb7902a43dd1af886bee16137f088d5045dd54
4f0beb1c3c35fa8df7509fbdfdd6a415ea92fef0
/TestProjectFolder/Student.cpp
af0e6ec3f8132b5cdc041a0629d42612653420bb
[]
no_license
spa542/COSC220
99cd9d300c7165c06bcfbf8f788adc9825cb7613
2088f1f5b9cded570372b203cb01ce38cdc3bfc0
refs/heads/master
2021-07-09T22:18:08.381050
2020-12-29T17:12:53
2020-12-29T17:12:53
223,447,007
0
0
null
null
null
null
UTF-8
C++
false
false
3,644
cpp
#include <iostream> #include "Student.h" #include "Courses.h" Student::Student() { name = "Brock"; birthday = "5.8.01"; major = "CoSc"; //this is where this goes right? start = nullptr; }; Student::~Student() { CourseNode *cursor = start; while(cursor) { start = start->next; delete cursor; cursor = start; } }; Student::Student(string Name, string Birthday, string Major) { name = Name; birthday = Birthday; major = Major; }; string Student::getName() // returns student name { return Student::name; } string Student::getBirthday() //takes a month, day, and year { return Student::birthday; } string Student::getMajor() // returns major { return Student::major; } void Student::setName(string newName) // sets name to be input { name = newName; } void Student::setBirthday(string newBirthday) // sets birthday to input { birthday = newBirthday; } void Student::setMajor(string newMajor) //sets major to input { major = newMajor; } void Student::createCourse(string className, string department, string semester, char grade) {//Want to add a class to a specific student CourseNode *newNode = new CourseNode; CourseNode *cursor = start; newNode->c.setClassName(className); newNode->c.setDepartment(department); newNode->c.setSemester(semester); newNode->c.setGrade(grade); newNode->next = nullptr; if(!start) { start = newNode; return; } while(cursor->next) { cursor = cursor->next; // cursor then points to the next value to check. } cursor->next = newNode; delete cursor; } void Student::updateCourse(Courses newOne, int value) { CourseNode *cursor = start; if(!start) { cout << "You dont have any courses in the list!" << endl; return; } for(int i =0; i < value - 1; i++) // travels until cursor points to the node wanted { cursor = cursor->next; } cursor->c = newOne; delete cursor; } void Student::removeCourse(int value) //removes a course { CourseNode *cursor = start; CourseNode *del = cursor; CourseNode *temp = start; if((value-2) < 0) // if value is -1, move head forward and delete 1st spot { start = cursor->next; delete temp; return; } for(int i = 0; i < value - 2; i++) // move to node before value { cursor = cursor->next; } del = cursor->next; cursor->next = cursor->next->next; delete del; } void Student::printCourse(int value) //prints courses { //int i = 10; CourseNode *cursor = start; CourseNode *current = start; //cout << i << ". "; for(int i = 0; i < value - 2; i++) { current = current->next; } while(cursor) { cout << cursor->c.getClassName() << " "; cout << cursor->c.getDepartment() << " "; cout << cursor->c.getSemester() << " "; cout << cursor->c.getGrade() << endl; //i++; //cout << i << ". "; cursor = cursor->next; } if (!start) { cout << "No Courses" << endl; } cout << endl; } //operator overload // void Student::operator=(Courses &other) // { // start = nullptr; // CourseNode *newCursor = other.start; // // while(cursor); // { // createCourse(newCursor->c); // newCursor = newCursor->next; // } // } bool Student::operator==(Student secondSide) { if(name==secondSide.getName() && birthday==secondSide.getBirthday() && major==secondSide.getName()) { return true; } return false; } void Student::operator=(Student *newOne) //sets a new Obj from the user { this->setName(newOne->getName()); this->setBirthday(newOne->getBirthday()); this->setMajor(newOne->getMajor()); }
[ "ryan11291129@gmail.com" ]
ryan11291129@gmail.com
0ecf9f1da5971acc15fec68c0fb3d87c667660d7
1722686f8139aca7d6927ec7a6dfed13a5d319fb
/pc-sdk/controlcenter/whiteboardcenter.cpp
4e09d899fc51196e4fd24cd20009e1b012eea909
[]
no_license
oamates/clientmy
610ca1c825e503e0b477a9a579248d608435a5d0
b3618b2225da198f338a3f2981c841dde010cd8d
refs/heads/main
2022-12-30T14:53:43.037242
2020-10-21T01:01:12
2020-10-21T01:01:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,599
cpp
/******************************************************************************* * Copyright(c) 2000-2019 YM * All rights reserved. * * FileName: whitebaordcenter.h * Description: whitebaord center class * * Author: ccb * Date: 2019/07/30 13:35:00 * Version: V4.5.1 * * History: * <author> <time> <version> <desc> * ccb 2019/07/30 V4.5.1 创建文件 *******************************************************************************/ #include <QPluginLoader> #include "whiteboardcenter.h" #include "./curriculumdata.h" #include "getoffsetimage.h" #include "messagepack.h" #include "messagetype.h" #include "datamodel.h" enum TrailOperation { TRAIL_CLEAR = 1, TRAIL_UNDO, }; WhiteBoardCenter::WhiteBoardCenter(ControlCenter* controlCenter) :m_controlCenter(controlCenter) ,m_whiteBoardCtrl(nullptr) { } WhiteBoardCenter::~WhiteBoardCenter() { uninit(); } void WhiteBoardCenter::init(const QString &pluginPathName) { if(pluginPathName.endsWith("whiteboard.dll", Qt::CaseInsensitive)) { QObject* instance = loadPlugin(pluginPathName); if(instance) { m_whiteBoardCtrl = qobject_cast<IWhiteBoardCtrl *>(instance); if(nullptr == m_whiteBoardCtrl) { qWarning()<< "qobject_cast is failed, pluginPathName is" << pluginPathName; unloadPlugin(instance); return; } m_whiteBoardCtrl->setWhiteBoardCallBack(this); qDebug()<< "qobject_cast is success, pluginPathName is" << pluginPathName; } else { qCritical()<< "load plugin is failed, pluginPathName is" << pluginPathName; } } else { qWarning()<< "plugin is invalid, pluginPathName is" << pluginPathName; } } void WhiteBoardCenter::uninit() { if(m_whiteBoardCtrl) { unloadPlugin((QObject*)m_whiteBoardCtrl); m_whiteBoardCtrl = nullptr; } m_controlCenter = nullptr; } void WhiteBoardCenter::setUserAuth(const QString &userId, int userRole, int trailState) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->setUserAuth(userId, userRole, trailState); } else { qWarning()<< "m_whiteBoardCtrl is null!, set user auth is failed" << userId<< trailState; } } void WhiteBoardCenter::selectShape(int shapeType) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->selectShape(shapeType); } else { qWarning()<< "m_whiteBoardCtrl is null!, select shape is failed" << shapeType; } } void WhiteBoardCenter::setPaintSize(double size) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->setPaintSize(size); } else { qWarning()<< "m_whiteBoardCtrl is null!, set paint size is failed" << size; } } void WhiteBoardCenter::setPaintColor(int color) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->setPaintColor(color); } else { qWarning()<< "m_whiteBoardCtrl is null!, set paint color is failed" << color; } } void WhiteBoardCenter::setErasersSize(double size) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->setErasersSize(size); } else { qWarning()<< "m_whiteBoardCtrl is null!, set eraser size is failed" << size; } } void WhiteBoardCenter::drawImage(const QString &image) { } void WhiteBoardCenter::drawGraph(const QString &graph) { } void WhiteBoardCenter::drawExpression(const QString &expression) { } void WhiteBoardCenter::drawPointerPosition(double xpoint, double ypoint) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->drawPointerPosition(xpoint, ypoint); } else { qWarning()<< "m_whiteBoardCtrl is null!, draw pointer position is failed" ; } } void WhiteBoardCenter::undoTrail() { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->undoTrail(); } else { qWarning()<< "m_whiteBoardCtrl is null!, undo trail is failed" ; } } void WhiteBoardCenter::clearTrails() { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->clearTrails(); } else { qWarning()<< "m_whiteBoardCtrl is null!, clear trails is failed" ; } } void WhiteBoardCenter::drawTrails(const QString &imageUrl, double width, double height, double offsetY, const QString &questionId) { if(nullptr != m_whiteBoardCtrl) { m_whiteBoardCtrl->drawTrails(imageUrl, width, height, offsetY, questionId); } else { qWarning()<< "m_whiteBoardCtrl is null!, draw trails is failed" ; } } bool WhiteBoardCenter::onDrawPolygon(const QJsonObject &polygonObj) { return true; } bool WhiteBoardCenter::onDrawEllipse(const QJsonObject &ellipseObj) { return true; } bool WhiteBoardCenter::onDrawLine(const QJsonObject &lineObj) { if(m_controlCenter != nullptr) { QString s(MessagePack::getInstance()->trailReqMsg(lineObj, DataCenter::getInstance()->m_currentCourse, DataCenter::getInstance()->m_currentPage)); s = s.replace("\r\n", "").replace("\n", "").replace("\r", "").replace("\t", "").replace(" ", ""); m_controlCenter->sendLocalMessage(s, false, false); } else { qWarning() << "draw line is failed, m_controlCenter is null!"; return false; } return true; } bool WhiteBoardCenter::onDrawExpression(const QString &expressionUrl) { return true; } bool WhiteBoardCenter::onScroll(double scrollX,double scrollY) { return true; } bool WhiteBoardCenter::onDrawImage(const QString &mdImageUrl, double pictureWidthRate, double pictureHeihtRate) { return true; } bool WhiteBoardCenter::onDrawPointer(double xPos, double yPos) { qint32 factorValX = 0, factorValY = 0; qint32 factor = 1000000; factorValX = qint32(xPos * factor); factorValY = qint32(yPos * factor); if(nullptr != m_controlCenter) { //发送教鞭命令 QString message = MessagePack::getInstance()->pointReqMsg(factorValX, factorValY); m_controlCenter->syncSendMessage(message); //教鞭不需要重绘画板, 不需要加入重发队列中, 直接发送至服务器 } else { qWarning() << "draw pointer is failed, m_controlCenter is null!"; return false; } return true; } bool WhiteBoardCenter::onUndo() { int totalPage = 0; QString coursewareId = DataCenter::getInstance()->m_currentCourse; if(DataCenter::getInstance()->m_currentCourse == "DEFAULT") { coursewareId = "000000"; } if (DataCenter::getInstance()->m_pages.contains(DataCenter::getInstance()->m_currentCourse)) { totalPage = DataCenter::getInstance()->m_pages[DataCenter::getInstance()->m_currentCourse].size(); } QString msg = MessagePack::getInstance()->operationMsg(TRAIL_UNDO, DataCenter::getInstance()->m_currentPage, totalPage, coursewareId, DataCenter::getInstance()->m_currentPage); if(m_controlCenter) m_controlCenter->sendLocalMessage(msg, true, true); return true; } bool WhiteBoardCenter::onClearTrails() { int totalPage = 0; QString coursewareId = DataCenter::getInstance()->m_currentCourse; if(DataCenter::getInstance()->m_currentCourse == "DEFAULT") { coursewareId = "000000"; } if (DataCenter::getInstance()->m_pages.contains(DataCenter::getInstance()->m_currentCourse)) { totalPage = DataCenter::getInstance()->m_pages[DataCenter::getInstance()->m_currentCourse].size(); } QString msg = MessagePack::getInstance()->operationMsg(TRAIL_CLEAR, DataCenter::getInstance()->m_currentPage, totalPage, coursewareId, DataCenter::getInstance()->m_currentPage); if(m_controlCenter) m_controlCenter->sendLocalMessage(msg, true, true); return true; } bool WhiteBoardCenter::onClearTrails(int type,int pageNo,int totalNum) { int totalPage = 0; QString coursewareId = DataCenter::getInstance()->m_currentCourse; if(DataCenter::getInstance()->m_currentCourse == "DEFAULT") { coursewareId = "000000"; } if (DataCenter::getInstance()->m_pages.contains(DataCenter::getInstance()->m_currentCourse)) { totalPage = DataCenter::getInstance()->m_pages[DataCenter::getInstance()->m_currentCourse].size(); } QString msg = MessagePack::getInstance()->operationMsg(type, DataCenter::getInstance()->m_currentPage, totalPage, coursewareId, DataCenter::getInstance()->m_currentPage); if(m_controlCenter) m_controlCenter->sendLocalMessage(msg, true, true); return true; } bool WhiteBoardCenter::onCurrentImageHeight(double height) { GetOffsetImage::instance()->currrentImageHeight = height; return true; } bool WhiteBoardCenter::onCurrentBeBufferedImage(const QImage &image) { GetOffsetImage::instance()->currentBeBufferedImage = image; return true; } bool WhiteBoardCenter::onCurrentTrailBoardHeight(double height) { GetOffsetImage::instance()->currentTrailBoardHeight = height; return true; } bool WhiteBoardCenter::onCurrentWhiteBoardSize(double width, double height) { StudentData::gestance()->midWidth = width; StudentData::gestance()->midHeight = height; return true; } bool WhiteBoardCenter::onOffSetImage(double offSetY) { GetOffsetImage::instance()->getOffSetImage(offSetY); return true; } bool WhiteBoardCenter::onOffSetImage(const QString &imageUrl, double offSetY) { GetOffsetImage::instance()->getOffSetImage(imageUrl, offSetY); return true; } double WhiteBoardCenter::getCurrentImageHeight() { if(DataCenter::getInstance()->m_pages[DataCenter::getInstance()->m_currentCourse][DataCenter::getInstance()->m_currentPage].bgimg.isEmpty()) { return GetOffsetImage::instance()->currentTrailBoardHeight; } else { return GetOffsetImage::instance()->currrentImageHeight; } } double WhiteBoardCenter::getResetOffsetY(double offsetY, double zoomRate) { return 0; } double WhiteBoardCenter::getMidHeight() { return StudentData::gestance()->midHeight; } QList<WhiteBoardMsg> WhiteBoardCenter::getCurrentTrailsMsg() { QList<WhiteBoardMsg> whiteBoardMsgs; foreach (Msg mess, DataCenter::getInstance()->m_pages[DataCenter::getInstance()->m_currentCourse][DataCenter::getInstance()->m_currentPage].getMsgs()) { WhiteBoardMsg m; m.msg = adjustTrailMsg(mess.msg); m.userId = "temp"; whiteBoardMsgs.append(m); } return whiteBoardMsgs; } QString WhiteBoardCenter::adjustTrailMsg(const QString &trailMsg) { QJsonParseError err; QString translateMsg; QJsonDocument document = QJsonDocument::fromJson(trailMsg.toUtf8(), &err); if (err.error == QJsonParseError::NoError) { QJsonObject tempDocumentObj = document.object(); QJsonObject tempContentObj = tempDocumentObj.take("content").toObject(); QString command = document.object().take("cmd").toString(); QJsonValue contentVal = document.object().take("content"); double factor = 1000000.000000; if (command == "trail") //统一小组与1v1 课轨迹数据结构 { tempDocumentObj.insert("command", QString("trail")); tempDocumentObj.insert("domain", QString("draw")); QJsonObject contentObj = contentVal.toObject(); //调整轨迹宽、鼠标类型数据 int tempType =contentObj.take("type").toInt(); double tempWidth = double((contentObj.take("width").toVariant().toLongLong()) / factor); tempContentObj.insert("type", QString( tempType == 1 ? "pencil" : "eraser")); tempContentObj.insert("width", QString::number(tempWidth, 'f', 6)); QJsonArray trails = contentObj.take("pts").toArray(); double x = 0, y = 0; int size = trails.size(); qint32 factorVal = 0; //调整轨迹坐标数据 QJsonArray arr; for(int i = 0; i < size; ++i) { factorVal = trails.at(i).toInt(); if((i % 2) == 0) { x = factorVal / factor; } if((i % 2) == 1) { y = factorVal / factor; QJsonObject obj; obj.insert("x", QString::number(x, 'f', 6)); obj.insert("y", QString::number(y, 'f', 6)); arr.append(obj); } } tempContentObj.insert("trail", arr); tempDocumentObj.insert("content", tempContentObj); QJsonDocument doc(tempDocumentObj); translateMsg = QString(doc.toJson(QJsonDocument::Compact)); } } else { qWarning() << "json trail msg parse is failed!"; } return translateMsg; } QObject* WhiteBoardCenter::loadPlugin(const QString &pluginPath) { QObject *plugin = nullptr; QFile file(pluginPath); if (!file.exists()) { qWarning()<< pluginPath<< "file is not file"; return plugin; } QPluginLoader loader(pluginPath); plugin = loader.instance(); if (nullptr == plugin) { qCritical()<< pluginPath<< "failed to load plugin" << loader.errorString(); } return plugin; } void WhiteBoardCenter::unloadPlugin(QObject* instance) { if (nullptr == instance) { qWarning()<< "plugin is failed!"; return; } delete instance; }
[ "shaohua.zhang@yimifudao.com" ]
shaohua.zhang@yimifudao.com
9fa1bfe74025cc317c0696c06c296ade0f77843d
899d29e69ec118d8dfdf6c15dfab7ce0c8af220d
/src/miner.cpp
744d5fc6852bb31c4160cff80fa51519955c65d6
[ "MIT" ]
permissive
yangpanit/WaykiChain
6baf8cddc507ffee86adb08474460553d6efe4a7
870440070a47d70876fa62c50e62939ca426c768
refs/heads/master
2020-03-20T03:30:34.403234
2018-06-07T05:48:11
2018-06-07T05:48:11
null
0
0
null
null
null
null
GB18030
C++
false
false
26,000
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2014-2015 The Coin developers // Copyright (c) 2016 The Coin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "miner.h" #include "core.h" #include "main.h" #include "tx.h" #include "net.h" #include "./wallet/wallet.h" extern CWallet* pwalletMain; extern void SetMinerStatus(bool bstatue ); ////////////////////////////////////////////////////////////////////////////// // // CoinMiner // //int static FormatHashBlocks(void* pbuffer, unsigned int len) { // unsigned char* pdata = (unsigned char*) pbuffer; // unsigned int blocks = 1 + ((len + 8) / 64); // unsigned char* pend = pdata + 64 * blocks; // memset(pdata + len, 0, 64 * blocks - len); // pdata[len] = 0x80; // unsigned int bits = len * 8; // pend[-1] = (bits >> 0) & 0xff; // pend[-2] = (bits >> 8) & 0xff; // pend[-3] = (bits >> 16) & 0xff; // pend[-4] = (bits >> 24) & 0xff; // return blocks; //} static const unsigned int pSHA256InitState[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; //void SHA256Transform(void* pstate, void* pinput, const void* pinit) { // SHA256_CTX ctx; // unsigned char data[64]; // // SHA256_Init(&ctx); // // for (int i = 0; i < 16; i++) // ((uint32_t*) data)[i] = ByteReverse(((uint32_t*) pinput)[i]); // // for (int i = 0; i < 8; i++) // ctx.h[i] = ((uint32_t*) pinit)[i]; // // SHA256_Update(&ctx, data, sizeof(data)); // for (int i = 0; i < 8; i++) // ((uint32_t*) pstate)[i] = ctx.h[i]; //} // Some explaining would be appreciated class COrphan { public: const CTransaction* ptx; set<uint256> setDependsOn; double dPriority; double dFeePerKb; COrphan(const CTransaction* ptxIn) { ptx = ptxIn; dPriority = dFeePerKb = 0; } void print() const { LogPrint("INFO","COrphan(hash=%s, dPriority=%.1f, dFeePerKb=%.1f)\n", ptx->GetHash().ToString(), dPriority, dFeePerKb); for (const auto& hash : setDependsOn) LogPrint("INFO", " setDependsOn %s\n", hash.ToString()); } }; uint64_t nLastBlockTx = 0; // 块中交易的总笔数,不含coinbase uint64_t nLastBlockSize = 0; //被创建的块 尺寸 //base on the last 50 blocks int GetElementForBurn(CBlockIndex* pindex) { if (NULL == pindex) { return INIT_FUEL_RATES; } int nBlock = SysCfg().GetArg("-blocksizeforburn", DEFAULT_BURN_BLOCK_SIZE); if (nBlock * 2 >= pindex->nHeight - 1) { return INIT_FUEL_RATES; } else { int64_t nTotalStep(0); int64_t nAverateStep(0); CBlockIndex * pTemp = pindex; for (int ii = 0; ii < nBlock; ii++) { nTotalStep += pTemp->nFuel / pTemp->nFuelRate * 100; pTemp = pTemp->pprev; } nAverateStep = nTotalStep / nBlock; int newFuelRate(0); if (nAverateStep < MAX_BLOCK_RUN_STEP * 0.75) { newFuelRate = pindex->nFuelRate * 0.9; } else if (nAverateStep > MAX_BLOCK_RUN_STEP * 0.85) { newFuelRate = pindex->nFuelRate * 1.1; } else { newFuelRate = pindex->nFuelRate; } if (newFuelRate < MIN_FUEL_RATES) newFuelRate = MIN_FUEL_RATES; LogPrint("fuel", "preFuelRate=%d fuelRate=%d, nHeight=%d\n", pindex->nFuelRate, newFuelRate, pindex->nHeight); return newFuelRate; } } // We want to sort transactions by priority and fee, so: void GetPriorityTx(vector<TxPriority> &vecPriority, int nFuelRate) { vecPriority.reserve(mempool.mapTx.size()); // Priority order to process transactions list<COrphan> vOrphan; // list memory doesn't move double dPriority = 0; for (map<uint256, CTxMemPoolEntry>::iterator mi = mempool.mapTx.begin(); mi != mempool.mapTx.end(); ++mi) { CBaseTransaction *pBaseTx = mi->second.GetTx().get(); if (uint256() == std::move(pTxCacheTip->IsContainTx(std::move(pBaseTx->GetHash())))) { unsigned int nTxSize = ::GetSerializeSize(*pBaseTx, SER_NETWORK, PROTOCOL_VERSION); double dFeePerKb = double(pBaseTx->GetFee() - pBaseTx->GetFuel(nFuelRate))/ (double(nTxSize) / 1000.0); dPriority = 1000.0 / double(nTxSize); vecPriority.push_back(TxPriority(dPriority, dFeePerKb, mi->second.GetTx())); } } } void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce) { // Update nExtraNonce static uint256 hashPrevBlock; if (hashPrevBlock != pblock->GetHashPrevBlock()) { nExtraNonce = 0; hashPrevBlock = pblock->GetHashPrevBlock(); } ++nExtraNonce; // unsigned int nHeight = pindexPrev->nHeight + 1; // Height first in coinbase required for block.version=2 // pblock->vtx[0].vin[0].scriptSig = (CScript() << nHeight << CBigNum(nExtraNonce)) + COINBASE_FLAGS; // assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100); pblock->GetHashMerkleRoot() = pblock->BuildMerkleTree(); } struct CAccountComparator { bool operator()(const CAccount &a, const CAccount&b) { CAccount &a1 = const_cast<CAccount &>(a); CAccount &b1 = const_cast<CAccount &>(b); if (a1.llVotes < b1.llVotes) { return false; } if(a1.llVotes > b1.llVotes) { return true; } if(a1.llValues < b1.llValues) { return false; } if(a1.llValues > b1.llValues) { return false; } return false; } }; uint256 GetAdjustHash(const uint256 TargetHash, const uint64_t nPos, const int nCurHeight) { uint64_t posacc = nPos/COIN; posacc /= SysCfg().GetIntervalPos(); posacc = max(posacc, (uint64_t) 1); arith_uint256 adjusthash = UintToArith256(TargetHash); //adjust nbits arith_uint256 minhash = SysCfg().ProofOfWorkLimit(); while (posacc) { adjusthash = adjusthash << 1; posacc = posacc >> 1; if (adjusthash > minhash) { adjusthash = minhash; break; } } return std::move(ArithToUint256(adjusthash)); } bool GetDelegatesAcctList(vector<CAccount> & vDelegatesAcctList) { CAccountViewCache accview(*pAccountViewTip, true); CTransactionDBCache txCache(*pTxCacheTip, true); CScriptDBViewCache scriptCache(*pScriptDBTip, true); int nDelegateNum = IniCfg().GetDelegatesCfg(); int nIndex = 0; CRegID redId(0,0); vector<unsigned char> vScriptData; vector<unsigned char> vScriptKey = {'d','e','l','e','g','a','t','e','_'}; vector<unsigned char> vDelegatePrdfix = vScriptKey; while(--nDelegateNum >= 0) { CRegID regId(0,0); if(scriptCache.GetScriptData(0, redId, nIndex, vScriptKey, vScriptData)) { nIndex = 1; vector<unsigned char>::iterator iterVotes = find_first_of(vScriptKey.begin(), vScriptKey.end(), vDelegatePrdfix.begin(), vDelegatePrdfix.end()); string strVoltes(iterVotes+9, iterVotes+25); uint64_t llVotes = 0; char *stopstring; llVotes = strtoull(strVoltes.c_str(), &stopstring, 16); vector<unsigned char> vAcctRegId(iterVotes+26, vScriptKey.end()); CRegID acctRegId(vAcctRegId); CAccount account; if(!accview.GetAccount(acctRegId,account)) { assert(0); } uint64_t maxNum = 0xFFFFFFFFFFFFFFFF; if((maxNum-llVotes) != account.llVotes) { LogPrint("ERROR", "llVotes:%lld, account:%s", maxNum-llVotes, account.ToString()); assert(0); } vDelegatesAcctList.push_back(account); } else { assert(0); } } return true; } bool GetCurrentDelegate(const int64_t currentTime, const vector<CAccount> & vDelegatesAcctList, CAccount &delegateAcct) { int64_t snot = currentTime / SysCfg().GetTargetSpacing(); int miner = snot % IniCfg().GetDelegatesCfg(); delegateAcct = vDelegatesAcctList[miner]; // LogPrint("INFO", "currentTime=%lld, snot=%d, miner=%d\n", currentTime, snot, miner); return true; } bool CreatePosTx(const uint64_t currentTime, const CAccount &delegate, CAccountViewCache &view, CBlock *pBlock) { unsigned int nNonce = GetRand(SysCfg().GetBlockMaxNonce()); CBlock preBlock; CBlockIndex* pblockindex = mapBlockIndex[pBlock->GetHashPrevBlock()]; if(pBlock->GetHashPrevBlock() != SysCfg().HashGenesisBlock()) { if(!ReadBlockFromDisk(preBlock, pblockindex)) return ERRORMSG("read block info fail from disk"); CAccount preDelegate; CRewardTransaction *preBlockRewardTx = (CRewardTransaction *) preBlock.vptx[0].get(); if(!view.GetAccount(preBlockRewardTx->account, preDelegate)) { return ERRORMSG("get preblock delegate account info error"); } if(pBlock->GetBlockTime()-preBlock.GetBlockTime() < SysCfg().GetTargetSpacing()) { if(preDelegate.regID == delegate.regID) { return ERRORMSG("one delegate can't produce more than one block at the same solt"); } } } pBlock->SetNonce(nNonce); CRewardTransaction *prtx = (CRewardTransaction *) pBlock->vptx[0].get(); prtx->account = delegate.regID; //记账人账户ID prtx->nHeight = pBlock->GetHeight(); pBlock->SetHashMerkleRoot(pBlock->BuildMerkleTree()); pBlock->SetTime(currentTime); vector<unsigned char> vSign; if (pwalletMain->Sign(delegate.keyID, pBlock->SignatureHash(), vSign, delegate.MinerPKey.IsValid())) { pBlock->SetSignature(vSign); return true; } else { return false; LogPrint("ERROR", "sign fail\r\n"); } return true; } void ShuffleDelegates(const int nCurHeight, vector<CAccount> &vDelegatesList) { int nDelegateCfg = IniCfg().GetDelegatesCfg(); string seedSource = strprintf("%lld", nCurHeight / nDelegateCfg + (nCurHeight % nDelegateCfg > 0 ? 1 : 0)); CHashWriter ss(SER_GETHASH, 0); ss << seedSource; uint256 currendSeed = ss.GetHash(); uint64_t currendTemp(0); for (int i = 0, delCount = nDelegateCfg; i < delCount; i++) { for (int x = 0; x < 4 && i < delCount; i++, x++) { memcpy(&currendTemp, currendSeed.begin()+(x*8), 8); int newIndex = currendTemp % delCount; CAccount accountTemp = vDelegatesList[newIndex]; vDelegatesList[newIndex] = vDelegatesList[i]; vDelegatesList[i] = accountTemp; } ss << currendSeed; currendSeed = ss.GetHash(); } } bool VerifyPosTx( const CBlock *pBlock, CAccountViewCache &accView, CTransactionDBCache &txCache, CScriptDBViewCache &scriptCache, bool bNeedRunTx) { uint64_t maxNonce = SysCfg().GetBlockMaxNonce(); //cacul times vector<CAccount> vDelegatesAcctList; if(!GetDelegatesAcctList(vDelegatesAcctList)) return false; ShuffleDelegates(pBlock->GetHeight(), vDelegatesAcctList); CAccount curDelegate; if(!GetCurrentDelegate(pBlock->GetTime(), vDelegatesAcctList, curDelegate)) { return false; } if (pBlock->GetNonce() > maxNonce) { return ERRORMSG("Nonce is larger than maxNonce"); } if (pBlock->GetHashMerkleRoot() != pBlock->BuildMerkleTree()) { return ERRORMSG("hashMerkleRoot is error"); } CAccountViewCache view(accView, true); CScriptDBViewCache scriptDBView(scriptCache, true); CBlock preBlock; CBlockIndex* pblockindex = mapBlockIndex[pBlock->GetHashPrevBlock()]; if(pBlock->GetHashPrevBlock() != SysCfg().HashGenesisBlock()) { if(!ReadBlockFromDisk(preBlock, pblockindex)) return ERRORMSG("read block info fail from disk"); CAccount preDelegate; CRewardTransaction *preBlockRewardTx = (CRewardTransaction *) preBlock.vptx[0].get(); if(!view.GetAccount(preBlockRewardTx->account, preDelegate)) { return ERRORMSG("get preblock delegate account info error"); } if(pBlock->GetBlockTime()-preBlock.GetBlockTime() < SysCfg().GetTargetSpacing()) { if(preDelegate.regID == curDelegate.regID) { return ERRORMSG("one delegate can't produce more than one block at the same solt"); } } } CAccount account; CRewardTransaction *prtx = (CRewardTransaction *) pBlock->vptx[0].get(); if (view.GetAccount(prtx->account, account)) { if(curDelegate.regID != account.regID) { return ERRORMSG("Verify delegate account error, delegate regid=%s vs reward regid=%s!", curDelegate.regID.ToString(), account.regID.ToString());; } if(!CheckSignScript(pBlock->SignatureHash(), pBlock->GetSignature(), account.PublicKey)) { if (!CheckSignScript(pBlock->SignatureHash(), pBlock->GetSignature(), account.MinerPKey)) { // LogPrint("ERROR", "block verify fail\r\n"); // LogPrint("ERROR", "block hash:%s\n", pBlock->GetHash().GetHex()); // LogPrint("ERROR", "signature block:%s\n", HexStr(pBlock->vSignature.begin(), pBlock->vSignature.end())); return ERRORMSG("Verify miner publickey signature error"); } } } else { return ERRORMSG("AccountView have no the accountid"); } if (prtx->nVersion != nTxVersion1) { return ERRORMSG("CTransaction CheckTransction,tx version is not equal current version, (tx version %d: vs current %d)", prtx->nVersion, nTxVersion1); } if (bNeedRunTx) { int64_t nTotalFuel(0); uint64_t nTotalRunStep(0); for (unsigned int i = 1; i < pBlock->vptx.size(); i++) { shared_ptr<CBaseTransaction> pBaseTx = pBlock->vptx[i]; if (uint256() != txCache.IsContainTx(pBaseTx->GetHash())) { return ERRORMSG("VerifyPosTx duplicate tx hash:%s", pBaseTx->GetHash().GetHex()); } CTxUndo txundo; CValidationState state; if (CONTRACT_TX == pBaseTx->nTxType) { LogPrint("vm", "tx hash=%s VerifyPosTx run contract\n", pBaseTx->GetHash().GetHex()); } pBaseTx->nFuelRate = pBlock->GetFuelRate(); if (!pBaseTx->ExecuteTx(i, view, state, txundo, pBlock->GetHeight(), txCache, scriptDBView)) { return ERRORMSG("transaction UpdateAccount account error"); } nTotalRunStep += pBaseTx->nRunStep; if(nTotalRunStep > MAX_BLOCK_RUN_STEP) { return ERRORMSG("block total run steps exceed max run step"); } nTotalFuel += pBaseTx->GetFuel(pBlock->GetFuelRate()); LogPrint("fuel", "VerifyPosTx total fuel:%d, tx fuel:%d runStep:%d fuelRate:%d txhash:%s \n",nTotalFuel, pBaseTx->GetFuel(pBlock->GetFuelRate()), pBaseTx->nRunStep, pBlock->GetFuelRate(), pBaseTx->GetHash().GetHex()); } if(nTotalFuel != pBlock->GetFuel()) { return ERRORMSG("fuel value at block header calculate error"); } } return true; } CBlockTemplate* CreateNewBlock(CAccountViewCache &view, CTransactionDBCache &txCache, CScriptDBViewCache &scriptCache){ // // Create new block auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate()); if (!pblocktemplate.get()) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience // Create coinbase tx CRewardTransaction rtx; // Add our coinbase tx as first transaction pblock->vptx.push_back(std::make_shared<CRewardTransaction>(rtx)); pblocktemplate->vTxFees.push_back(-1); // updated at end pblocktemplate->vTxSigOps.push_back(-1); // updated at end // Largest block you're willing to create: unsigned int nBlockMaxSize = SysCfg().GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE); // Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity: nBlockMaxSize = max((unsigned int) 1000, min((unsigned int) (MAX_BLOCK_SIZE - 1000), nBlockMaxSize)); // How much of the block should be dedicated to high-priority transactions, // included regardless of the fees they pay unsigned int nBlockPrioritySize = SysCfg().GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE); nBlockPrioritySize = min(nBlockMaxSize, nBlockPrioritySize); // Minimum block size you want to create; block will be filled with free transactions // until there are no more or the block reaches this size: unsigned int nBlockMinSize = SysCfg().GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE); nBlockMinSize = min(nBlockMaxSize, nBlockMinSize); // Collect memory pool transactions into the block int64_t nFees = 0; { LOCK2(cs_main, mempool.cs); CBlockIndex* pIndexPrev = chainActive.Tip(); pblock->SetFuelRate(GetElementForBurn(pIndexPrev)); // This vector will be sorted into a priority queue: vector<TxPriority> vecPriority; GetPriorityTx(vecPriority, pblock->GetFuelRate()); // Collect transactions into block uint64_t nBlockSize = ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION); uint64_t nBlockTx(0); bool fSortedByFee(true); uint64_t nTotalRunStep(0); int64_t nTotalFuel(0); TxPriorityCompare comparer(fSortedByFee); make_heap(vecPriority.begin(), vecPriority.end(), comparer); while (!vecPriority.empty()) { // Take highest priority transaction off the priority queue: double dPriority = vecPriority.front().get<0>(); double dFeePerKb = vecPriority.front().get<1>(); shared_ptr<CBaseTransaction> stx = vecPriority.front().get<2>(); CBaseTransaction *pBaseTx = stx.get(); //const CTransaction& tx = *(vecPriority.front().get<2>()); pop_heap(vecPriority.begin(), vecPriority.end(), comparer); vecPriority.pop_back(); // Size limits unsigned int nTxSize = ::GetSerializeSize(*pBaseTx, SER_NETWORK, PROTOCOL_VERSION); if (nBlockSize + nTxSize >= nBlockMaxSize) continue; // Skip free transactions if we're past the minimum block size: if (fSortedByFee && (dFeePerKb < CTransaction::nMinRelayTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) continue; // Prioritize by fee once past the priority size or we run out of high-priority // transactions: if (!fSortedByFee && ((nBlockSize + nTxSize >= nBlockPrioritySize) || !AllowFree(dPriority))) { fSortedByFee = true; comparer = TxPriorityCompare(fSortedByFee); make_heap(vecPriority.begin(), vecPriority.end(), comparer); } if(uint256() != std::move(txCache.IsContainTx(std::move(pBaseTx->GetHash())))) { LogPrint("INFO","CreateNewBlock duplicate tx\n"); continue; } CTxUndo txundo; CValidationState state; if(pBaseTx->IsCoinBase()){ ERRORMSG("TX type is coin base tx error......"); // assert(0); //never come here } if (CONTRACT_TX == pBaseTx->nTxType) { LogPrint("vm", "tx hash=%s CreateNewBlock run contract\n", pBaseTx->GetHash().GetHex()); } CAccountViewCache viewTemp(view, true); CScriptDBViewCache scriptCacheTemp(scriptCache, true); pBaseTx->nFuelRate = pblock->GetFuelRate(); if (!pBaseTx->ExecuteTx(nBlockTx + 1, viewTemp, state, txundo, pIndexPrev->nHeight + 1, txCache, scriptCacheTemp)) { continue; } // Run step limits if(nTotalRunStep + pBaseTx->nRunStep >= MAX_BLOCK_RUN_STEP) continue; assert(viewTemp.Flush()); assert(scriptCacheTemp.Flush()); nFees += pBaseTx->GetFee(); nBlockSize += stx->GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION); nTotalRunStep += pBaseTx->nRunStep; nTotalFuel += pBaseTx->GetFuel(pblock->GetFuelRate()); nBlockTx++; pblock->vptx.push_back(stx); LogPrint("fuel", "miner total fuel:%d, tx fuel:%d runStep:%d fuelRate:%d txhash:%s\n",nTotalFuel, pBaseTx->GetFuel(pblock->GetFuelRate()), pBaseTx->nRunStep, pblock->GetFuelRate(), pBaseTx->GetHash().GetHex()); } nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; LogPrint("INFO","CreateNewBlock(): total size %u\n", nBlockSize); assert(nFees-nTotalFuel >= 0); ((CRewardTransaction*) pblock->vptx[0].get())->rewardValue = nFees - nTotalFuel; // Fill in header pblock->SetHashPrevBlock(pIndexPrev->GetBlockHash()); UpdateTime(*pblock, pIndexPrev); pblock->SetNonce(0); pblock->SetHeight(pIndexPrev->nHeight + 1); pblock->SetFuel(nTotalFuel); } return pblocktemplate.release(); } bool CheckWork(CBlock* pblock, CWallet& wallet) { //// debug print // LogPrint("INFO","proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex(), hashTarget.GetHex()); pblock->print(*pAccountViewTip); // LogPrint("INFO","generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue)); // Found a solution { LOCK(cs_main); if (pblock->GetHashPrevBlock() != chainActive.Tip()->GetBlockHash()) return ERRORMSG("CoinMiner : generated block is stale"); // Remove key from key pool // reservekey.KeepKey(); // Track how many getdata requests this block gets // { // LOCK(wallet.cs_wallet); // wallet.mapRequestCount[pblock->GetHash()] = 0; // } // Process this block the same as if we had received it from another node CValidationState state; if (!ProcessBlock(state, NULL, pblock)) return ERRORMSG("CoinMiner : ProcessBlock, block not accepted"); } return true; } bool static MiningBlock(CBlock *pblock, CWallet *pwallet,CBlockIndex* pindexPrev,unsigned int nTransactionsUpdatedLast,CAccountViewCache &view, CTransactionDBCache &txCache, CScriptDBViewCache &scriptCache){ int64_t nStart = GetTime(); unsigned int lasttime = 0xFFFFFFFF; while (true) { // Check for stop or if block needs to be rebuilt boost::this_thread::interruption_point(); if (vNodes.empty() && SysCfg().NetworkID() != REGTEST_NET) return false; if (pindexPrev != chainActive.Tip()) return false; //获取时间 同时等待下次时间到 auto GetNextTimeAndSleep = [&]() { while(GetTime() == lasttime || (GetTime()-pindexPrev->GetBlockTime()) < SysCfg().GetTargetSpacing()) { ::MilliSleep(100); } return (lasttime = GetTime()); }; GetNextTimeAndSleep(); // max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime()); vector<CAccount> vDelegatesAcctList; if(!GetDelegatesAcctList(vDelegatesAcctList)) { return false; } int nIndex = 0; for(auto & acct : vDelegatesAcctList) { LogPrint("shuffle","before shuffle index=%d, address=%s\n", nIndex++, acct.keyID.ToAddress()); } ShuffleDelegates(pblock->GetHeight(), vDelegatesAcctList); nIndex = 0; for(auto & acct : vDelegatesAcctList) { LogPrint("shuffle","after shuffle index=%d, address=%s\n", nIndex++, acct.keyID.ToAddress()); } uint64_t currentTime = GetTime(); CAccount minerAcct; if(!GetCurrentDelegate(currentTime, vDelegatesAcctList, minerAcct)) { return false; } // LogPrint("INFO", "Current charger delegate address=%s\n", minerAcct.keyID.ToAddress()); bool increatedfalg = false; { LOCK2(cs_main, pwalletMain->cs_wallet); if((unsigned int)(chainActive.Tip()->nHeight + 1) != pblock->GetHeight()) return false; CKey acctKey; if(pwalletMain->GetKey(minerAcct.keyID.ToAddress(), acctKey, true) || pwalletMain->GetKey(minerAcct.keyID.ToAddress(), acctKey)) { increatedfalg = CreatePosTx(currentTime, minerAcct, view, pblock); } } if (increatedfalg == true) { LogPrint("MINER","CreatePosTx used time :%d ms, miner address=%s\n", GetTimeMillis() - lasttime, minerAcct.keyID.ToAddress()); SetThreadPriority(THREAD_PRIORITY_NORMAL); { int64_t lasttime1 = GetTimeMillis(); CheckWork(pblock, *pwallet); LogPrint("MINER","CheckWork used time :%d ms\n", GetTimeMillis() - lasttime1); } SetThreadPriority(THREAD_PRIORITY_LOWEST); return true; } if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast || GetTime() - nStart > 60) return false; } return false; } void static CoinMiner(CWallet *pwallet,int targetConter) { LogPrint("INFO","Miner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); RenameThread("Coin-miner"); auto CheckIsHaveMinerKey = [&]() { LOCK2(cs_main, pwalletMain->cs_wallet); set<CKeyID> setMineKey; setMineKey.clear(); pwalletMain->GetKeys(setMineKey, true); return !setMineKey.empty(); }; if (!CheckIsHaveMinerKey()) { LogPrint("INFO", "CoinMiner terminated\n"); ERRORMSG("ERROR:%s ", "no key for minering\n"); return ; } auto getcurhigh = [&]() { LOCK(cs_main); return chainActive.Height(); }; targetConter = targetConter+getcurhigh(); try { SetMinerStatus(true); while (true) { if (SysCfg().NetworkID() != REGTEST_NET) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. while (vNodes.empty() || (chainActive.Tip() && chainActive.Tip()->nHeight>1 && GetAdjustedTime()-chainActive.Tip()->nTime > 60*60)) MilliSleep(1000); } // // Create new block // unsigned int LastTrsa = mempool.GetTransactionsUpdated(); CBlockIndex* pindexPrev = chainActive.Tip(); CAccountViewCache accview(*pAccountViewTip, true); CTransactionDBCache txCache(*pTxCacheTip, true); CScriptDBViewCache ScriptDbTemp(*pScriptDBTip, true); int64_t lasttime1 = GetTimeMillis(); shared_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(accview, txCache, ScriptDbTemp)); if (!pblocktemplate.get()){ throw runtime_error("Create new block fail."); } LogPrint("MINER", "CreateNewBlock tx count:%d used time :%d ms\n", pblocktemplate.get()->block.vptx.size(), GetTimeMillis() - lasttime1); CBlock *pblock = &pblocktemplate.get()->block; MiningBlock(pblock, pwallet, pindexPrev, LastTrsa, accview, txCache, ScriptDbTemp); if (SysCfg().NetworkID() != MAIN_NET) if(targetConter <= getcurhigh()) { throw boost::thread_interrupted(); } } } catch (...) { LogPrint("INFO","CoinMiner terminated\n"); SetMinerStatus(false); throw; } } void GenerateCoinBlock(bool fGenerate, CWallet* pwallet, int targetHigh) { static boost::thread_group* minerThreads = NULL; if (minerThreads != NULL) { minerThreads->interrupt_all(); // minerThreads->join_all(); delete minerThreads; minerThreads = NULL; } if(targetHigh <= 0 && fGenerate == true) { // assert(0); ERRORMSG("targetHigh, fGenerate value error"); return ; } if (!fGenerate) return; //in pos system one thread is enough marked by ranger.shi minerThreads = new boost::thread_group(); minerThreads->create_thread(boost::bind(&CoinMiner, pwallet,targetHigh)); // minerThreads->join_all(); }
[ "walker@iblocktech.com" ]
walker@iblocktech.com