hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
588 values
lang
stringclasses
305 values
max_stars_repo_path
stringlengths
3
363
max_stars_repo_name
stringlengths
5
118
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:00:35
2022-03-31 23:43:49
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 12:37:38
2022-03-31 23:59:52
max_issues_repo_path
stringlengths
3
363
max_issues_repo_name
stringlengths
5
118
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
363
max_forks_repo_name
stringlengths
5
135
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:02
2022-03-31 23:27:27
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 08:55:07
2022-03-31 23:59:24
content
stringlengths
5
1.05M
avg_line_length
float64
1.13
1.04M
max_line_length
int64
1
1.05M
alphanum_fraction
float64
0
1
8fefe7769ded8864ccf5cca30da866299b3d01ca
868
h
C
src/tests/system/kernel/file_corruption/CheckSum.h
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
1,338
2015-01-03T20:06:56.000Z
2022-03-26T13:49:54.000Z
src/tests/system/kernel/file_corruption/CheckSum.h
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
15
2015-01-17T22:19:32.000Z
2021-12-20T12:35:00.000Z
src/tests/system/kernel/file_corruption/CheckSum.h
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
350
2015-01-08T14:15:27.000Z
2022-03-21T18:14:35.000Z
/* * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef CHECK_SUM_H #define CHECK_SUM_H #include <string.h> #include <SHA256.h> struct CheckSum { const uint8* Data() const { return fData; } bool IsZero() const { for (size_t i = 0; i < sizeof(fData); i++) { if (fData[i] != 0) return false; } return true; } CheckSum& operator=(const CheckSum& other) { memcpy(fData, other.fData, sizeof(fData)); return *this; } CheckSum& operator=(const void* buffer) { memcpy(fData, buffer, sizeof(fData)); return *this; } bool operator==(const void* buffer) const { return memcmp(fData, buffer, sizeof(fData)) == 0; } bool operator!=(const void* buffer) const { return !(*this == buffer); } private: uint8 fData[SHA_DIGEST_LENGTH]; }; #endif // CHECK_SUM_H
14.965517
55
0.653226
3754dd54ada44a76bbd951f17978eab43ce30849
706
h
C
Classes/RootViewController.h
tomkidd/latest-chatty-ios
2adabfa0d3a23ebb84e8054fe2e206b90b1acc1b
[ "MIT" ]
10
2015-01-15T07:28:55.000Z
2017-11-09T07:00:26.000Z
Classes/RootViewController.h
tomkidd/latest-chatty-ios
2adabfa0d3a23ebb84e8054fe2e206b90b1acc1b
[ "MIT" ]
6
2015-11-12T03:31:45.000Z
2018-12-29T20:21:18.000Z
Classes/RootViewController.h
tomkidd/latest-chatty-ios
2adabfa0d3a23ebb84e8054fe2e206b90b1acc1b
[ "MIT" ]
6
2015-04-04T16:06:44.000Z
2018-11-12T19:11:55.000Z
// // RootViewController.h // LatestChatty2 // // Created by Alex Wayne on 4/10/09. // Copyright 2009. All rights reserved. // #import "RootCell.h" #import "Model.h" #import "Message.h" #import "StoriesViewController.h" #import "ChattyViewController.h" #import "MessagesViewController.h" #import "SearchViewController.h" #import "IIViewDeckController.h" #import "SloppySwiper.h" @interface RootViewController : UITableViewController <ModelLoadingDelegate, IIViewDeckControllerDelegate> { ModelLoader *messageLoader; BOOL initialPhoneLoad; NSIndexPath *selectedIndex; } @property (nonatomic, strong) NSIndexPath *selectedIndex; @property (strong, nonatomic) SloppySwiper *swiper; @end
22.774194
108
0.764873
edb3043df4b721535a7403b72c70cf3538574b9b
1,264
h
C
microc/include/ipv6/ucIpv6PacketAllocation.h
wojtex/whip6-pub
7aca863e45199f4f1354f24b1c88afd8cb34c2ba
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "Intel", "BSD-3-Clause" ]
1
2017-02-21T16:44:56.000Z
2017-02-21T16:44:56.000Z
microc/include/ipv6/ucIpv6PacketAllocation.h
wojtex/whip6-pub
7aca863e45199f4f1354f24b1c88afd8cb34c2ba
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "Intel", "BSD-3-Clause" ]
9
2017-02-21T16:43:31.000Z
2021-06-10T19:28:41.000Z
microc/include/ipv6/ucIpv6PacketAllocation.h
wojtex/whip6-pub
7aca863e45199f4f1354f24b1c88afd8cb34c2ba
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause-Clear", "Intel", "BSD-3-Clause" ]
12
2016-12-19T12:04:17.000Z
2020-09-17T14:44:39.000Z
/* * whip6: Warsaw High-performance IPv6. * * Copyright (c) 2012-2017 Konrad Iwanicki * All rights reserved. * * This file is distributed under the terms in the attached LICENSE * files. */ #ifndef __WHIP6_MICROC_IPV6_IPV6_PACKET_ALLOCATION_H__ #define __WHIP6_MICROC_IPV6_IPV6_PACKET_ALLOCATION_H__ /** * @file * @author Konrad Iwanicki * * This file contains IPv6 packet allocation * routines. */ #include <ipv6/ucIpv6PacketTypes.h> /** * Allocates an IPv6 packet with a given payload. * @param payloadLength The length of the payload, * that is, the portion of the packet without * the basic IPv6 header. * @return A pointer to the allocated packet or * NULL if the allocation has failed. */ WHIP6_MICROC_PRIVATE_DECL_PREFIX ipv6_packet_t MCS51_STORED_IN_RAM * whip6_ipv6AllocatePacket( ipv6_payload_length_t payloadLength ) WHIP6_MICROC_PRIVATE_DECL_SUFFIX; /** * Frees an IPv6 packet. * @param packet A packet to be freed. * Must not be NULL. */ WHIP6_MICROC_PRIVATE_DECL_PREFIX void whip6_ipv6FreePacket( ipv6_packet_t MCS51_STORED_IN_RAM * packet ) WHIP6_MICROC_PRIVATE_DECL_SUFFIX; #include <ipv6/detail/ucIpv6PacketAllocationImpl.h> #endif /* __WHIP6_MICROC_IPV6_IPV6_PACKET_ALLOCATION_H__ */
25.795918
94
0.762658
726fb3f11762c974ef4538fa971a9302683d36b0
1,541
h
C
extensions/third_party/perfetto/protos/perfetto/trace/extension_descriptor.pbzero.h
blockspacer/chromium_base_conan
b4749433cf34f54d2edff52e2f0465fec8cb9bad
[ "Apache-2.0", "BSD-3-Clause" ]
6
2020-12-22T05:48:31.000Z
2022-02-08T19:49:49.000Z
extensions/third_party/perfetto/protos/perfetto/trace/extension_descriptor.pbzero.h
blockspacer/chromium_base_conan
b4749433cf34f54d2edff52e2f0465fec8cb9bad
[ "Apache-2.0", "BSD-3-Clause" ]
4
2020-05-22T18:36:43.000Z
2021-05-19T10:20:23.000Z
extensions/third_party/perfetto/protos/perfetto/trace/extension_descriptor.pbzero.h
blockspacer/chromium_base_conan
b4749433cf34f54d2edff52e2f0465fec8cb9bad
[ "Apache-2.0", "BSD-3-Clause" ]
2
2019-12-06T11:48:16.000Z
2021-09-16T04:44:47.000Z
// Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT. #ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_EXTENSION_DESCRIPTOR_PROTO_H_ #define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_EXTENSION_DESCRIPTOR_PROTO_H_ #include <stddef.h> #include <stdint.h> #include "perfetto/protozero/message.h" #include "perfetto/protozero/packed_repeated_fields.h" #include "perfetto/protozero/proto_decoder.h" #include "perfetto/protozero/proto_utils.h" namespace perfetto { namespace protos { namespace pbzero { class FileDescriptorSet; class ExtensionDescriptor_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/1, /*HAS_NONPACKED_REPEATED_FIELDS=*/false> { public: ExtensionDescriptor_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {} explicit ExtensionDescriptor_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {} explicit ExtensionDescriptor_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {} bool has_extension_set() const { return at<1>().valid(); } ::protozero::ConstBytes extension_set() const { return at<1>().as_bytes(); } }; class ExtensionDescriptor : public ::protozero::Message { public: using Decoder = ExtensionDescriptor_Decoder; enum : int32_t { kExtensionSetFieldNumber = 1, }; template <typename T = FileDescriptorSet> T* set_extension_set() { return BeginNestedMessage<T>(1); } }; } // Namespace. } // Namespace. } // Namespace. #endif // Include guard.
34.244444
143
0.76963
c29ff075f0a918d3a2031539457cfd1374d83436
307
c
C
install_dependencies/xianyi-OpenBLAS-6d2da63/driver/level3/CMakeFiles/strsm_LNLN.c
lanl/DnMFkCPP
a6bca290bf7d57be07f7a80d049d6b7714fbdc61
[ "BSD-3-Clause", "Unlicense" ]
1
2021-07-29T21:56:02.000Z
2021-07-29T21:56:02.000Z
install_dependencies/xianyi-OpenBLAS-6d2da63/driver/level3/CMakeFiles/strsm_LNLN.c
rvangara/DnMFk
a6bca290bf7d57be07f7a80d049d6b7714fbdc61
[ "BSD-3-Clause", "Unlicense" ]
null
null
null
install_dependencies/xianyi-OpenBLAS-6d2da63/driver/level3/CMakeFiles/strsm_LNLN.c
rvangara/DnMFk
a6bca290bf7d57be07f7a80d049d6b7714fbdc61
[ "BSD-3-Clause", "Unlicense" ]
2
2021-07-29T21:55:33.000Z
2021-08-02T21:30:15.000Z
#define ASMNAME strsm_LNLN #define ASMFNAME strsm_LNLN_ #define NAME strsm_LNLN_ #define CNAME strsm_LNLN #define CHAR_NAME "strsm_LNLN_" #define CHAR_CNAME "strsm_LNLN" #include "/lustre/scratch3/turquoise/rvangara/RD100/distnnmfkcpp_Src/install_dependencies/xianyi-OpenBLAS-6d2da63/driver/level3/trsm_L.c"
43.857143
137
0.850163
32e35a6281eefd9f2932a462cc8c8065831bc02b
384
h
C
Code/Lib/templates.h
ejthomas/CMakeCatch2PHAS0100
11f4452838b68750ce338f0b195bf11bf9bacf70
[ "BSD-3-Clause" ]
null
null
null
Code/Lib/templates.h
ejthomas/CMakeCatch2PHAS0100
11f4452838b68750ce338f0b195bf11bf9bacf70
[ "BSD-3-Clause" ]
null
null
null
Code/Lib/templates.h
ejthomas/CMakeCatch2PHAS0100
11f4452838b68750ce338f0b195bf11bf9bacf70
[ "BSD-3-Clause" ]
null
null
null
#ifndef templates_h #define templates_h template <typename T> T sum(T a, T b) { T result; result = a + b; return result; } template <typename TElement, typename TList> TList RemoveMatching(TElement element, TList l) { TList newList; for (TElement t: l) { if (t != element) { newList.push_back(t); } } return newList; } #endif
16
47
0.606771
fc92cc3fe5ae226cc51f958d320f668056fbeae4
2,815
c
C
snort-2.9.15.1/src/dynamic-preprocessors/reputation/reputation_utils.c
wenze1367/snort-2.9.15-read-annotation
d5c76ec0e699b173caabd917b921412c03233149
[ "BSD-2-Clause" ]
null
null
null
snort-2.9.15.1/src/dynamic-preprocessors/reputation/reputation_utils.c
wenze1367/snort-2.9.15-read-annotation
d5c76ec0e699b173caabd917b921412c03233149
[ "BSD-2-Clause" ]
null
null
null
snort-2.9.15.1/src/dynamic-preprocessors/reputation/reputation_utils.c
wenze1367/snort-2.9.15-read-annotation
d5c76ec0e699b173caabd917b921412c03233149
[ "BSD-2-Clause" ]
null
null
null
/**************************************************************************** * Copyright (C) 2014-2019 Cisco and/or its affiliates. All rights reserved. * Copyright (C) 2011-2013 Sourcefire, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License Version 2 as * published by the Free Software Foundation. You may not use, modify or * distribute this program under any other version of the GNU General * Public License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * **************************************************************************** * Provides convenience functions. * * 6/11/2011 - Initial implementation ... Hui Cao <hcao@sourcefire.com> * ****************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "reputation_utils.h" #include <stdio.h> #include <limits.h> #define MAX_ADDR_LINE_LENGTH 8192 /******************************************************************** * Function: Reputation_IsEmptyStr() * * Checks if string is NULL, empty or just spaces. * String must be 0 terminated. * * Arguments: * char * - string to check * * Returns: * 1 if string is NULL, empty or just spaces * 0 otherwise * ********************************************************************/ int Reputation_IsEmptyStr(char *str) { char *end; if (str == NULL) return 1; end = str + strlen(str); while ((str < end) && isspace((int)*str)) str++; if (str == end) return 1; return 0; } /******************************************************************** * Function: numLinesInFile() * * Number of lines in the file * * Arguments: * fname: file name * * Returns: * uint32_t number of lines * ********************************************************************/ int numLinesInFile(char *fname) { FILE *fp; uint32_t numlines = 0; char buf[MAX_ADDR_LINE_LENGTH]; fp = fopen(fname, "rb"); if (NULL == fp) return 0; while((fgets(buf, MAX_ADDR_LINE_LENGTH, fp)) != NULL) { if (buf[0] != '#') { numlines++; if (numlines == INT_MAX) { fclose(fp); return INT_MAX; } } } fclose(fp); return numlines; }
26.556604
82
0.520426
fd367b324b7218e3c2b9765850e64d664253f32d
129
h
C
Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/util/string_apple.h
MrsTrier/RememberArt
90314d1f05a1d63b9885ebb17d37bab5134a24f3
[ "MIT" ]
null
null
null
Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/util/string_apple.h
MrsTrier/RememberArt
90314d1f05a1d63b9885ebb17d37bab5134a24f3
[ "MIT" ]
null
null
null
Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/util/string_apple.h
MrsTrier/RememberArt
90314d1f05a1d63b9885ebb17d37bab5134a24f3
[ "MIT" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:786476e613e78f5eace76567477ad6f2f5e1a1a714add324fb45b59295d9d36e size 3522
32.25
75
0.883721
597e6ae7929ddea672c6cc2b9493cf23dee744d4
6,116
c
C
main/mpu6050_raw.c
ted99tw/UControl
ba7a52e0c2edc06a9b65c31c7e0baae419485e49
[ "Apache-2.0" ]
null
null
null
main/mpu6050_raw.c
ted99tw/UControl
ba7a52e0c2edc06a9b65c31c7e0baae419485e49
[ "Apache-2.0" ]
null
null
null
main/mpu6050_raw.c
ted99tw/UControl
ba7a52e0c2edc06a9b65c31c7e0baae419485e49
[ "Apache-2.0" ]
null
null
null
/* i2c/mpu6050 - Example For other examples please check: https://github.com/espressif/esp-idf/tree/master/examples This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #include <stdio.h> #include "driver/i2c.h" #define BUFF_SIZE 6 #define DELAY_TIME_BETWEEN_ITEMS_MS 500 /*!< delay time between different test items */ #define I2C_MASTER_SCL_IO 18 /*!< gpio number for I2C master clock */ #define I2C_MASTER_SDA_IO 19 /*!< gpio number for I2C master data */ #define I2C_MASTER_NUM I2C_NUM_1 /*!< I2C port number for master dev */ #define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master do not need buffer */ #define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master do not need buffer */ #define I2C_MASTER_FREQ_HZ 100000 /*!< I2C master clock frequency */ #define MPU6050_ADDR 0x68 /*!< slave address for MPU6050 */ #define WRITE_BIT I2C_MASTER_WRITE /*!< I2C master write */ #define READ_BIT I2C_MASTER_READ /*!< I2C master read */ #define ACK_CHECK_EN 0x1 /*!< I2C master will check ack from slave*/ #define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */ #define ACK_VAL 0x0 /*!< I2C ack value */ #define NACK_VAL 0x1 /*!< I2C nack value */ #define ACCE_START_ADD 0x3B /*!< Register address to start reading raw acce values */ #define GYRO_START_ADD 0x43 /*!< Register address to start reading raw gyro values */ xSemaphoreHandle print_mux; int MAXVALUE = 16384; //uint8_t data_rd[BUFF_SIZE]; /** * @brief function to show buffer */ void disp_buf(uint8_t* buf, int len) { int i; int16_t temp; for(i = 0; i < len; i++) { temp = ((buf[i] << 8) + buf[i +1]); printf("%d ", temp); i++; } printf("\n"); } /** * @brief mpu6050_init, inittialize MPU6050 */ esp_err_t mpu6050_init(i2c_port_t i2c_num) { i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, ( MPU6050_ADDR << 1 ) | WRITE_BIT, ACK_CHECK_EN); i2c_master_write_byte(cmd, 0x6B, ACK_CHECK_EN); //Power register address i2c_master_write_byte(cmd, 0x00, ACK_CHECK_EN); //Power on internal chip i2c_master_stop(cmd); esp_err_t ret = i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); i2c_cmd_link_delete(cmd); return ret; } /** * @brief mpu6050_read_acce Read raw acce values */ esp_err_t mpu6050_read_acce(i2c_port_t i2c_num, uint8_t* data_rd, size_t size) { //printf("mpu6050_read_acce ***********\n"); if (size == 0) { return ESP_OK; } i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, ( MPU6050_ADDR << 1 ) | WRITE_BIT, ACK_CHECK_EN); i2c_master_write_byte(cmd, ACCE_START_ADD, ACK_CHECK_EN); i2c_master_start(cmd); i2c_master_write_byte(cmd, ( MPU6050_ADDR << 1 ) | READ_BIT, ACK_CHECK_EN); if (size > 1) { i2c_master_read(cmd, data_rd, size - 1, ACK_VAL); } i2c_master_read_byte(cmd, data_rd + size - 1, NACK_VAL); i2c_master_stop(cmd); esp_err_t ret = i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); i2c_cmd_link_delete(cmd); //disp_buf(data_rd, BUFF_SIZE); return ret; } /** * @brief impu6050_read_gyro Read raw gyro values */ esp_err_t mpu6050_read_gyro(i2c_port_t i2c_num, uint8_t* data_rd, size_t size) { if (size == 0) { return ESP_OK; } i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, ( MPU6050_ADDR << 1 ) | WRITE_BIT, ACK_CHECK_EN); i2c_master_write_byte(cmd, GYRO_START_ADD, ACK_CHECK_EN); i2c_master_start(cmd); i2c_master_write_byte(cmd, ( MPU6050_ADDR << 1 ) | READ_BIT, ACK_CHECK_EN); if (size > 1) { i2c_master_read(cmd, data_rd, size - 1, ACK_VAL); } i2c_master_read_byte(cmd, data_rd + size - 1, NACK_VAL); i2c_master_stop(cmd); esp_err_t ret = i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); i2c_cmd_link_delete(cmd); return ret; } /** * @brief impu6050_read_gyro Read raw gyro values */ esp_err_t mpu6050_set4g(i2c_port_t i2c_num) { i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, ( MPU6050_ADDR << 1 ) | WRITE_BIT, ACK_CHECK_EN); i2c_master_write_byte(cmd, 0x1C, ACK_CHECK_EN); //i2c_master_write(cmd, 0b11101111, 1, ACK_CHECK_EN); // set +/- 4g i2c_master_stop(cmd); esp_err_t ret = i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); i2c_cmd_link_delete(cmd); return ret; } /** * @brief i2c master initialization */ void i2c_master_init() { printf("i2c master init ***********\n"); int i2c_master_port = I2C_MASTER_NUM; i2c_config_t conf; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = I2C_MASTER_SDA_IO; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; conf.scl_io_num = I2C_MASTER_SCL_IO; conf.scl_pullup_en = GPIO_PULLUP_ENABLE; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; i2c_param_config(i2c_master_port, &conf); i2c_driver_install(i2c_master_port, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0); } //void mpu6050_test_raw(void* arg) void mpu6050_test_raw() { printf("mpu6050_test_raw ***********\n"); int ret; ret = mpu6050_init(I2C_MASTER_NUM); /*keep retrying until initialzation is successful*/ while(ret != ESP_OK) { printf("INIT FAILED... Retry\n"); vTaskDelay(100/ portTICK_RATE_MS); ret = mpu6050_init(I2C_MASTER_NUM); } printf("INIT SUCCESS...\n"); vTaskDelay(100/ portTICK_RATE_MS); //Delay to init power on mpu6050 } void mpu6050_myinit() { //print_mux = xSemaphoreCreateMutex(); i2c_master_init(); mpu6050_test_raw(); //mpu6050_set4g(I2C_MASTER_NUM); //xTaskCreate(mpu6050_test_raw, "mpu6050_test_raw", 1024 * 2, NULL, 10, NULL); }
33.790055
108
0.691956
d37758617e6c1ad07697a6059fc7c75b313f6331
9,885
c
C
util/pma.c
suuyaoo/nessdb
31299984dfd268e4d7aaea3a8245f773a4b63027
[ "BSD-3-Clause-Attribution" ]
370
2015-01-08T11:57:35.000Z
2022-03-26T07:04:53.000Z
util/pma.c
suuyaoo/nessdb
31299984dfd268e4d7aaea3a8245f773a4b63027
[ "BSD-3-Clause-Attribution" ]
5
2017-07-03T07:17:09.000Z
2021-05-11T02:38:06.000Z
util/pma.c
suuyaoo/nessdb
31299984dfd268e4d7aaea3a8245f773a4b63027
[ "BSD-3-Clause-Attribution" ]
84
2015-01-03T14:16:21.000Z
2022-02-17T14:16:36.000Z
/* * Copyright (c) 2012-2015 The nessDB Project Developers. All rights reserved. * Code is licensed with BSD. * * unrolled packed memory array with Fine-Grained Lock */ #include "u.h" #define UNROLLED_LIMIT (256) /* * EFFECT: * - binary search with upper-bound * - find the 1st idx which array[idx] > e * RETURN: * - return 0 when e < array[0] * - return -1 when e > array[max] */ static inline int _array_find_greater_than(struct array *a, void *k, compare_func f, void *extra) { int lo = 0; int hi = a->used - 1; int best = -1; while (lo <= hi) { /* we assume that mid never overflow */ int mid = (lo + hi) / 2; int cmp = f(a->elems[mid], k, extra); if (cmp > 0) { best = mid; hi = mid - 1; } else { lo = mid + 1; } } return best; } /* * EFFECT: * - binary search with upper-bound * - find the 1st idx which array[idx] * RETURN: * - return -1 when e < array[0] * - return max idx when array[max] < e */ static inline int _array_find_less_than(struct array *a, void *k, compare_func f, void *extra) { int lo = 0; int hi = a->used - 1; int best = -1; nassert(a); while (lo <= hi) { int mid = (hi + lo) / 2; int cmp = f(a->elems[mid], k, extra); if (cmp < 0) { best = mid; lo = mid + 1; } else { hi = mid - 1; } } return best; } /* * EFFECT: * - binary search * - find the 1st idx which e == array[idx] */ static inline int _array_find_zero(struct array *a, void *k, compare_func f, void *extra, int *found) { int lo = 0; int hi = a->used - 1; int best = hi; nassert(a); while (lo <= hi) { int mid = (hi + lo) / 2; int cmp = f(a->elems[mid], k, extra); if (cmp > 0) { best = mid; hi = mid - 1; } else if (cmp == 0) { *found = 1; break; } else { lo = mid + 1; } } return best; } static inline void _array_extend(struct array *a) { if ((a->used + 1) >= a->size) { /* make sure no readers on this array */ a->size *= 2; a->elems = xrealloc(a->elems, a->size * sizeof(void*)); } } static void _array_insertat(struct array *a, void *e, int i) { _array_extend(a); if (i < a->used) { xmemmove(a->elems + i + 1, a->elems + i, (a->used - i) * sizeof(void*)); } a->elems[i] = e; a->used++; } struct array *_array_new(int reverse) { struct array *a = xcalloc(1, sizeof(*a)); a->used = 0; a->size = reverse; a->elems = xcalloc(a->size, sizeof(void*)); ness_mutex_init(&a->mtx); ness_rwlock_init(&a->rwlock, &a->mtx); ness_spinlock_init(&a->r_spinlock); ness_spinlock_init(&a->w_spinlock); return a; } static void _array_free(struct array *a) { xfree(a->elems); xfree(a); } static inline void _slots_extend(struct pma *p) { if ((p->used + 1) >= p->size) { p->size *= 2; p->slots = xrealloc(p->slots, p->size * sizeof(void*)); } } static void _slots_insertat(struct pma *p, struct array *a, int i) { _slots_extend(p); if (i < p->used) { xmemmove(p->slots + i + 1, p->slots + i, (p->used - i) * sizeof(void*)); } p->slots[i] = a; p->used++; } /* * EFFECT: * - binary search with lower-bound * - find the 1st idx which array[idx] <= e * RETURN: * - return 0 when e < array[0] * - return max when e > array[max] */ static inline int _slots_find_lowerbound(struct pma *p, void *k, compare_func f, void *extra) { int lo = 0; int hi = p->used - 1; int best = hi; struct array **slots = p->slots; if (hi == 0) return 0; while (lo <= hi) { int cmp; int mid = (hi + lo) / 2; struct array *a; a = slots[mid]; /* make sure no extending on this array */ ness_spinlock_waitfree(&a->w_spinlock); ness_spinrlock(&a->r_spinlock); cmp = f(*(a->elems), k, extra); ness_spinrunlock(&a->r_spinlock); if (cmp <= 0) { best = mid; lo = mid + 1; } else { hi = mid - 1; } } return best; } void _array_unrolled(struct pma *p, int slot_idx) { int half; struct array *old_array; struct array *new_array; ness_rwlock_write_lock(&p->slots_rwlock); old_array = p->slots[slot_idx]; if (old_array->used < UNROLLED_LIMIT) { /* some one has unrolled before us */ ness_rwlock_write_unlock(&p->slots_rwlock); return; } nassert(old_array->used >= UNROLLED_LIMIT); half = old_array->used / 2; new_array = _array_new(old_array->size); new_array->used = old_array->used - half; memcpy(new_array->elems, old_array->elems + half, new_array->used * sizeof(void*)); old_array->used = half; _slots_insertat(p, new_array, slot_idx + 1); ness_rwlock_write_unlock(&p->slots_rwlock); } struct pma *pma_new(int reverse) { struct pma *p = xcalloc(1, sizeof(*p)); p->size = reverse; p->slots = xcalloc(p->size, sizeof(struct array*)); ness_mutex_init(&p->mtx); ness_rwlock_init(&p->slots_rwlock, &p->mtx); p->slots[0] = _array_new(UNROLLED_LIMIT); p->used++; return p; } void pma_free(struct pma *p) { int i; for (i = 0; i < p->used; i++) _array_free(p->slots[i]); ness_mutex_destroy(&p->mtx); xfree(p->slots); xfree(p); } void pma_insert(struct pma *p, void *k, compare_func f, void *extra) { int array_idx = 0; int slot_idx = 0; int array_used = 0; struct array *arr; ness_rwlock_read_lock(&p->slots_rwlock); slot_idx = _slots_find_lowerbound(p, k, f, extra); arr = p->slots[slot_idx]; ness_spinwlock(&arr->w_spinlock); ness_spinlock_waitfree(&arr->r_spinlock); array_used = arr->used; array_idx = _array_find_greater_than(arr, k, f, extra); /* if array_idx is -1, means that we got the end of the array */ if (nessunlikely(array_idx == -1)) array_idx = arr->used; _array_insertat(arr, k, array_idx); atomic_fetch_and_inc(&p->count); ness_spinwunlock(&arr->w_spinlock); ness_rwlock_read_unlock(&p->slots_rwlock); if ((array_used + 1) > UNROLLED_LIMIT) _array_unrolled(p, slot_idx); } void pma_append(struct pma *p, void *k, compare_func f, void *extra) { int array_idx = 0; int slot_idx = 0; int array_used = 0; struct array *arr; (void)f; (void)extra; ness_rwlock_read_lock(&p->slots_rwlock); if (p->used > 0) slot_idx = p->used - 1; arr = p->slots[slot_idx]; array_used = arr->used; if (array_used > 0) array_idx = array_used - 1; _array_insertat(arr, k, array_idx); atomic_fetch_and_inc(&p->count); ness_rwlock_read_unlock(&p->slots_rwlock); if (array_used > UNROLLED_LIMIT) _array_unrolled(p, slot_idx); } uint32_t pma_count(struct pma *p) { uint32_t c = 0; ness_mutex_lock(&p->mtx); c = p->count; ness_mutex_unlock(&p->mtx); return c; } int pma_find_minus(struct pma *p, void *k, compare_func f, void *extra, void **retval, struct pma_coord *coord) { int slot_idx = 0; int array_idx = 0; int ret = NESS_NOTFOUND; struct array *arr; memset(coord, 0, sizeof(*coord)); try_again: ness_rwlock_read_lock(&p->slots_rwlock); slot_idx = _slots_find_lowerbound(p, k, f, extra); arr = p->slots[slot_idx]; if (!ness_rwlock_try_read_lock(&arr->rwlock)) { ness_rwlock_read_unlock(&p->slots_rwlock); goto try_again; } array_idx = _array_find_less_than(arr, k, f, extra); if (nessunlikely(array_idx == -1)) { if (slot_idx > 0) { slot_idx -= 1; arr = p->slots[slot_idx]; if (arr->used > 0) { *retval = arr->elems[arr->used - 1]; array_idx = arr->used - 1; ret = NESS_OK; } } } else { *retval = arr->elems[array_idx]; ret = NESS_OK; } coord->slot_idx = slot_idx; coord->array_idx = array_idx == -1 ? 0 : array_idx; ness_rwlock_read_unlock(&arr->rwlock); ness_rwlock_read_unlock(&p->slots_rwlock); return ret; } int pma_find_plus(struct pma *p, void *k, compare_func f, void *extra, void **retval, struct pma_coord *coord) { int slot_idx = 0; int array_idx = 0; int ret = NESS_NOTFOUND; struct array *arr; memset(coord, 0, sizeof(*coord)); try_again: ness_rwlock_read_lock(&p->slots_rwlock); slot_idx = _slots_find_lowerbound(p, k, f, extra); arr = p->slots[slot_idx]; if (!ness_rwlock_try_read_lock(&arr->rwlock)) { ness_rwlock_read_unlock(&p->slots_rwlock); goto try_again; } array_idx = _array_find_greater_than(arr, k, f, extra); if (nessunlikely(array_idx == -1)) { if (slot_idx < (p->used - 1)) { slot_idx += 1; arr = p->slots[slot_idx]; if (arr->used > 0) { *retval = arr->elems[0]; array_idx = 0; ret = NESS_OK; } } } else { *retval = arr->elems[array_idx]; ret = NESS_OK; } coord->slot_idx = slot_idx; coord->array_idx = array_idx == -1 ? arr->used : array_idx; ness_rwlock_read_unlock(&arr->rwlock); ness_rwlock_read_unlock(&p->slots_rwlock); return ret; } int pma_find_zero(struct pma *p, void *k, compare_func f, void *extra, void **retval, struct pma_coord *coord) { int found = 0; int slot_idx = 0; int array_idx = 0; int ret = NESS_NOTFOUND; struct array *arr; memset(coord, 0, sizeof(*coord)); try_again: ness_rwlock_read_lock(&p->slots_rwlock); slot_idx = _slots_find_lowerbound(p, k, f, extra); arr = p->slots[slot_idx]; if (!ness_rwlock_try_read_lock(&arr->rwlock)) { ness_rwlock_read_unlock(&p->slots_rwlock); goto try_again; } array_idx = _array_find_zero(arr, k, f, extra, &found); /* got one value */ if (found) { *retval = arr->elems[array_idx]; ret = NESS_OK; } else { coord->slot_idx = slot_idx; coord->array_idx = array_idx; } ness_rwlock_read_unlock(&arr->rwlock); ness_rwlock_read_unlock(&p->slots_rwlock); return ret; }
20.89852
93
0.603945
d30969cac4e70a2cfb8069073a396b5d3778ede4
621
h
C
Project27_CollectionViewAlbum/CollectionViewController/ViewController.h
hayasilin/30DaysOBJC
3f4d20a1b7bee273a1d38ed615aaa161f4804fe6
[ "MIT" ]
18
2016-09-21T02:02:56.000Z
2022-03-09T05:55:51.000Z
Project27_CollectionViewAlbum/CollectionViewController/ViewController.h
hayasilin/30DaysOBJC
3f4d20a1b7bee273a1d38ed615aaa161f4804fe6
[ "MIT" ]
null
null
null
Project27_CollectionViewAlbum/CollectionViewController/ViewController.h
hayasilin/30DaysOBJC
3f4d20a1b7bee273a1d38ed615aaa161f4804fe6
[ "MIT" ]
5
2016-09-24T03:03:06.000Z
2022-02-19T14:19:57.000Z
// // ViewController.h // CollectionViewController // // Created by Kuan-Wei Lin on 9/19/16. // Copyright © 2016 Kuan-Wei Lin. All rights reserved. // #import <UIKit/UIKit.h> #import "AssetsLibrary/AssetsLibrary.h" #import "MyCell.h" #import "Photos/Photos.h" @interface ViewController : UIViewController <UICollectionViewDelegate, UICollectionViewDataSource> @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; @property (strong, nonatomic) ALAssetsLibrary *library; @property (strong, nonatomic) NSMutableArray *imageArray; @property (strong, nonatomic) NSMutableArray *phImageArray; @end
24.84
99
0.771337
2010d1eae1bb6ffbd6fc4609730b3527a6613c0b
2,879
h
C
L1Trigger/TrackFindingTracklet/interface/L1TStub.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
6
2017-09-08T14:12:56.000Z
2022-03-09T23:57:01.000Z
L1Trigger/TrackFindingTracklet/interface/L1TStub.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
545
2017-09-19T17:10:19.000Z
2022-03-07T16:55:27.000Z
L1Trigger/TrackFindingTracklet/interface/L1TStub.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
14
2017-10-04T09:47:21.000Z
2019-10-23T18:04:45.000Z
#ifndef L1Trigger_TrackFindingTracklet_interface_L1TStub_h #define L1Trigger_TrackFindingTracklet_interface_L1TStub_h #include <iostream> #include <fstream> #include <cassert> #include <cmath> #include <vector> namespace trklet { class L1TStub { public: L1TStub(); L1TStub(int eventid, std::vector<int> tps, int iphi, int iz, int layer, int ladder, int module, int strip, double x, double y, double z, double sigmax, double sigmaz, double pt, double bend, int isPSmodule, int isFlipped); ~L1TStub() = default; void write(std::ofstream& out); void write(std::ostream& out); double diphi(); double iphiouter(); double diz(); unsigned int layer() const { return layer_; } int disk() const { if (z_ < 0.0) { return -module_; } return module_; } unsigned int ladder() const { return ladder_; } unsigned int module() const { return module_; } double x() const { return x_; } double y() const { return y_; } double z() const { return z_; } double r() const { return std::hypot(x_, y_); } double pt() const { return pt_; } double r2() const { return x_ * x_ + y_ * y_; } double bend() const { return bend_; } double phi() const { return atan2(y_, x_); } unsigned int iphi() const { return iphi_; } unsigned int iz() const { return iz_; } void setiphi(int iphi) { iphi_ = iphi; } void setiz(int iz) { iz_ = iz; } double sigmax() const { return sigmax_; } double sigmaz() const { return sigmaz_; } bool operator==(const L1TStub& other) const; void lorentzcor(double shift); int eventid() const { return eventid_; } std::vector<int> tps() const { return tps_; } void setAllStubIndex(unsigned int index) { allstubindex_ = index; } unsigned int allStubIndex() const { return allstubindex_; } unsigned int strip() const { return strip_; } double alpha(double pitch) const; //Scaled to go between -1 and +1 double alphanorm() const; void setXY(double x, double y); unsigned int isPSmodule() const { return isPSmodule_; } unsigned int isFlipped() const { return isFlipped_; } bool isTilted() const; bool tpmatch(int tp) const; private: int eventid_; std::vector<int> tps_; unsigned int iphi_; unsigned int iz_; unsigned int layer_; unsigned int ladder_; unsigned int module_; unsigned int strip_; double x_; double y_; double z_; double sigmax_; double sigmaz_; double pt_; double bend_; unsigned int allstubindex_; unsigned int isPSmodule_; unsigned int isFlipped_; }; }; // namespace trklet #endif
23.406504
71
0.604724
2014b762d916b653035646bd4fea59fef9050c3e
1,029
h
C
src/path.h
nmandery/rhizofs
f2563b7a8eb3d0cfaedcbfc76a03f5abb972a2d0
[ "BSD-3-Clause" ]
3
2018-03-16T11:36:34.000Z
2021-09-21T02:04:44.000Z
src/path.h
nmandery/rhizofs
f2563b7a8eb3d0cfaedcbfc76a03f5abb972a2d0
[ "BSD-3-Clause" ]
null
null
null
src/path.h
nmandery/rhizofs
f2563b7a8eb3d0cfaedcbfc76a03f5abb972a2d0
[ "BSD-3-Clause" ]
null
null
null
#ifndef __util_path_h__ #define __util_path_h__ #include <string.h> #include <stdlib.h> /** * join two paths * * p1: first path * p2: second path * pjoined: pointer to the string to write the joined path to * memory will be allocated * * returns 0 on success */ int path_join(const char *, const char *, char **); int path_join_real(const char *, const char *, char **); /** * return the basename of the path * * this function, in contrary to the libc functions, * will not modify its arguments * * returns NULL on error, returns a newly allocated * string on success. the caller is responsible for freeing this * string */ char * path_basename(const char * inpath); /** * return the dirname of the path * * this function, in contrary to the libc functions, * will not modify its arguments * * returns NULL on error, returns a newly allocated * string on success. the caller is responsible for freeing this * string */ char * path_dirname(const char * inpath); #endif /* __util_path_h__ */
21.4375
64
0.70068
e3e70ce095adbded521844a5d1c4e9d96ce91b88
732
h
C
OpenGLSandbox/src/Engine/Rendering/CubeMap.h
conholo/OpenGLSandbox
c8c35f275dacd9c873c78aa003b840822db719a8
[ "MIT" ]
null
null
null
OpenGLSandbox/src/Engine/Rendering/CubeMap.h
conholo/OpenGLSandbox
c8c35f275dacd9c873c78aa003b840822db719a8
[ "MIT" ]
null
null
null
OpenGLSandbox/src/Engine/Rendering/CubeMap.h
conholo/OpenGLSandbox
c8c35f275dacd9c873c78aa003b840822db719a8
[ "MIT" ]
null
null
null
#pragma once #include "Engine/Core/Memory.h" #include "Engine/Rendering/TextureUtils.h" #include "Engine/Rendering/VertexArray.h" #include "Engine/Rendering/Shader.h" #include "Engine/Rendering/Texture.h" #include <vector> #include <string> #include <stdint.h> #include <glm/glm.hpp> namespace Engine { class CubeMap { public: CubeMap(const Ref<TextureCube>& textureCube, const Ref<Shader>& shader); ~CubeMap(); void Submit(const glm::mat4& viewProjection); const Ref<TextureCube> GetTexture3D() const { return m_Texture3D; } private: void ConstructPipelinePrimitives(); private: uint32_t m_ID; Ref<TextureCube> m_Texture3D; Ref<Shader> m_Shader; Ref<VertexArray> m_VAO; Ref<VertexBuffer> m_VBO; }; }
20.914286
74
0.740437
2d5db8a99e7d0c58e1f377c89f313c1f72b1594f
7,045
h
C
source/og-core/geo/VirtualGlobeRenderer.h
OpenWebGlobe/Application-SDK
b819ca8ccb44b70815f6c5332cfb041ea23dab61
[ "MIT" ]
4
2015-12-20T01:38:05.000Z
2019-07-02T11:01:29.000Z
source/og-core/geo/VirtualGlobeRenderer.h
OpenWebGlobe/Application-SDK
b819ca8ccb44b70815f6c5332cfb041ea23dab61
[ "MIT" ]
null
null
null
source/og-core/geo/VirtualGlobeRenderer.h
OpenWebGlobe/Application-SDK
b819ca8ccb44b70815f6c5332cfb041ea23dab61
[ "MIT" ]
6
2015-01-20T09:18:39.000Z
2021-02-06T08:19:30.000Z
/******************************************************************************* Project : i3D OpenWebGlobe SDK - Reference Implementation Version : 1.0 Author : Martin Christen, martin.christen@fhnw.ch Copyright : (c) 2006-2011 by FHNW/IVGI. All Rights Reserved $License$ *******************************************************************************/ #ifndef _VIRTUALGLOBE_RENDERER_H #define _VIRTUALGLOBE_RENDERER_H //----------------------------------------------------------------------------- #include "og.h" #include <math/vec2.h> #include <math/vec3.h> #include <math/mat4.h> #include <math/viewfrustum.h> #include "renderer/IRenderEngine.h" #include "geo/VirtualGlobeRenderOptions.h" #include "geo/VirtualGlobeCache.h" #include "geo/MercatorQuadtree.h" #include "scenegraph/PickResult.h" #include "geo/layer/IImageLayer.h" #include <boost/shared_ptr.hpp> #include <boost/shared_array.hpp> #include <vector> #include <ctime> class OPENGLOBE_API VirtualGlobeRenderer { public: VirtualGlobeRenderer(); virtual ~VirtualGlobeRenderer(); void SetLayers(std::vector< boost::shared_ptr<IImageLayer> >& lstImageLayers); void Render(IRenderEngine* pEngine, const mat4<double>& mView, const mat4<double>& mModel, const mat4<double>& mModelView, const mat4<double>& mProjection, unsigned int nWidth, unsigned int nHeight, const VirtualGlobeRenderOptions& oRenderOptions); protected: void _Divide(); void _Optimize(); void _SubDivideElement(std::list<boost::shared_ptr<VirtualGlobeTerrainBlock> >::iterator& it); bool _CalcErrorMetric(const boost::shared_ptr<VirtualGlobeTerrainBlock>& qBlock); bool _FrustumTest(const aabb3<double>& oBoundingBox, const vec3<double>& hitPoint); bool _SurfaceNormalTest(const boost::shared_ptr<VirtualGlobeTerrainBlock>& qBlock); std::list<boost::shared_ptr<VirtualGlobeTerrainBlock> > _lstFrustum; // Terrain Blocks in frustum! // bool _TestLayers(); boost::shared_ptr<VirtualGlobeCache> _pCache; boost::shared_ptr<MercatorQuadtree> _quadtree; std::vector< boost::shared_ptr<IImageLayer> > _lstImageLayers; std::vector< boost::shared_ptr<IElevationLayer> > _lstElevationLayers; boost::shared_ptr<VirtualGlobeTerrainBlock> _block[256]; unsigned int _nMaxLod; private: mat4<double> _mView; mat4<double> _mModel; mat4<double> _mModelView; mat4<double> _mProjection; mat4<double> _mModelViewProjection; vec3<double> _vCameraPosition; vec3<double> _vCameraPositionWGS84; vec2<double> _vCameraPositionMercator; unsigned int _nWidth; // Screen/Window Width unsigned int _nHeight; // Screen/Window Height double _dQuality; ViewFrustum<double> _oFrustum; bool _bOverlay; }; //----------------------------------------------------------------------------- /*class OPENGLOBE_API VirtualGlobeRenderer { public: VirtualGlobeRenderer(); virtual ~VirtualGlobeRenderer(); void SetQuadtree(boost::shared_ptr<MercatorQuadtree>& qQuadtree); //void SetChannels(const std::list<boost::shared_ptr<TreeListNode> >& lstElevations, const std::list<boost::shared_ptr<TreeListNode> >& lstImages, unsigned int nCacheSize, int nForceThreads); void Render(const mat4<double>& mView, const mat4<double>& mModel, const mat4<double>& mModelView, const mat4<double>& mProjection, unsigned int nWidth, unsigned int nHeight, const VirtualGlobeRenderOptions& oRenderOptions); void SetQualityParameter(double dQuality){_dQuality = dQuality;} void EnableOverlay(bool bEnable){_bOverlay = bEnable;} void OnTerrainPickTest(vec3<double>& vPos, vec3<double>& vDir, TerrainPickResult& oResult); void OnTerrainGetLod(double lng, double lat, int& lod); void SetElevationInterpolation(bool bInterpolation){_bElevationInterpolation = bInterpolation;} //static size_t GetNumBlocks() {return _numBlocks;} protected: void _Divide(); void _Optimize(); void _SubDivideElement(std::list<boost::shared_ptr<VirtualGlobeTerrainBlock> >::iterator& it); bool _CalcErrorMetric(const boost::shared_ptr<VirtualGlobeTerrainBlock>& qBlock); bool _TestVisibility(const aabb3<double>& oBoundingBox, const vec3<double>& hitPoint); //std::list<boost::shared_ptr<TreeListNode> > _lstImages; //std::list<boost::shared_ptr<TreeListNode> > _lstElevations; //std::list<boost::shared_ptr<ImageTileFileSystemReader> > _lstTileReader; //std::list<boost::shared_ptr<ElevationTileFileSystemReader> > _lstElevationReader; std::list<boost::shared_ptr<VirtualGlobeTerrainBlock> > _lstFrustum; mat4<double> _mView; mat4<double> _mModel; mat4<double> _mModelView; mat4<double> _mProjection; mat4<double> _mModelViewProjection; vec3<double> _vCameraPosition; vec3<double> _vCameraPositionWGS84; vec2<double> _vCameraPositionMercator; unsigned int _nWidth; // Screen/Window Width unsigned int _nHeight; // Screen/Window Height double _dQuality; ViewFrustum<double> _oFrustum; bool _bOverlay; bool _bElevationInterpolation; //static size_t _numBlocks; private: boost::shared_ptr<VirtualGlobeCache> _qCache; boost::shared_ptr<MercatorQuadtree> _qQuadtree; unsigned int _lasttick; }; */ //----------------------------------------------------------------------------- #endif
46.966667
264
0.52917
2df32ecc58bcd7f1bd6033f19245499da002d23f
282
h
C
src/pyconcrete_ext/pyconcrete.h
AltimateAI/pyconcrete
ae222327c729c382caa2d9d62b4ca2b6a866d440
[ "Apache-2.0" ]
515
2015-05-29T20:47:38.000Z
2022-03-29T05:40:32.000Z
src/pyconcrete_ext/pyconcrete.h
AltimateAI/pyconcrete
ae222327c729c382caa2d9d62b4ca2b6a866d440
[ "Apache-2.0" ]
81
2016-08-26T14:16:04.000Z
2022-03-14T21:27:53.000Z
src/pyconcrete_ext/pyconcrete.h
AltimateAI/pyconcrete
ae222327c729c382caa2d9d62b4ca2b6a866d440
[ "Apache-2.0" ]
120
2015-12-25T11:07:00.000Z
2022-02-16T07:17:19.000Z
#ifndef PYCONCRETE_H #define PYCONCRETE_H extern PyObject* g_PyConcreteError; PyObject * fnEncryptFile(PyObject* self, PyObject* args); PyObject * fnDecryptFile(PyObject* self, PyObject* args); PyObject * fnDecryptBuffer(PyObject* self, PyObject* args); #endif // PYCONCRETE_H
23.5
59
0.783688
f6a60dd895f1a6cca799c73b46bb20ab8fc3f416
213
c
C
mud/bin/soul/lightbulb.c
shentino/simud
644b7d4f56bf8d4695442b8efcfd56e0a561fe21
[ "Apache-2.0" ]
3
2015-07-18T00:19:51.000Z
2016-02-20T17:25:37.000Z
mud/bin/soul/lightbulb.c
shentino/simud
644b7d4f56bf8d4695442b8efcfd56e0a561fe21
[ "Apache-2.0" ]
2
2021-03-04T19:24:03.000Z
2021-03-08T10:17:34.000Z
mud/bin/soul/lightbulb.c
shentino/simud
644b7d4f56bf8d4695442b8efcfd56e0a561fe21
[ "Apache-2.0" ]
2
2015-12-22T06:16:53.000Z
2016-11-18T16:32:50.000Z
#include <emote.h> EMOTE ( "A lightbulb appears over ~npos head.@@receiving inspiration.", "~Name ~verbshow ~targ the lightbulb above ~poss head.@@receiving inspiration." ) EMOTE_ATTRIBUTE( ATT_VISUAL )
30.428571
89
0.71831
bced46b124ef55356ade69b43b8f1bc82eec382d
3,191
c
C
src/coap/tc_iot_coap_code_map.c
yougaliu007/tencent-cloud-iotsuite-package-for-rtt
e91acc7918ca65d91c4fc7c2c9a32c0712aa0350
[ "MIT" ]
8
2018-11-02T08:06:55.000Z
2019-06-02T17:19:49.000Z
src/coap/tc_iot_coap_code_map.c
yougaliu007/tencent-cloud-iotsuite-package-for-rtt
e91acc7918ca65d91c4fc7c2c9a32c0712aa0350
[ "MIT" ]
2
2019-05-03T09:21:25.000Z
2019-05-05T02:22:31.000Z
src/coap/tc_iot_coap_code_map.c
yougaliu007/tencent-cloud-iotsuite-package-for-rtt
e91acc7918ca65d91c4fc7c2c9a32c0712aa0350
[ "MIT" ]
5
2018-11-13T06:11:19.000Z
2019-09-17T09:06:18.000Z
#include "tc_iot_inc.h" static tc_iot_code_map _tc_iot_coap_message_type_map[] = { {COAP_CON,"CON"}, {COAP_NON,"NON"}, {COAP_ACK,"ACK"}, {COAP_RST,"RST"}, }; const char * tc_iot_coap_get_message_type_str(int type) { if (type <= COAP_RST) { return _tc_iot_coap_message_type_map[type].str; } else { return ""; } } static tc_iot_code_map _tc_iot_coap_message_code_map[] = { {COAP_CODE_001_GET,"0.01-GET"}, {COAP_CODE_002_POST,"0.02-POST"}, {COAP_CODE_003_PUT,"0.03-PUT"}, {COAP_CODE_004_DELETE,"0.04-DELETE"}, {COAP_CODE_201_CREATED,"2.01-CREATED"}, {COAP_CODE_202_DELETED,"2.02-DELETED"}, {COAP_CODE_203_VALID,"2.03-VALID"}, {COAP_CODE_204_CHANGED,"2.04-CHANGED"}, {COAP_CODE_205_CONTENT,"2.05-CONTENT"}, {COAP_CODE_400_BAD_REQUEST,"4.00-BAD_REQUEST"}, {COAP_CODE_401_UNAUTHORIZED,"4.01-UNAUTHORIZED"}, {COAP_CODE_402_BAD_OPTION,"4.02-BAD_OPTION"}, {COAP_CODE_403_FORBIDDEN,"4.03-FORBIDDEN"}, {COAP_CODE_404_NOT_FOUND,"4.04-NOT_FOUND"}, {COAP_CODE_405_METHOD_NOT_ALLOWED,"4.05-METHOD_NOT_ALLOWED"}, {COAP_CODE_406_NOT_ACCEPTABLE,"4.06-NOT_ACCEPTABLE"}, {COAP_CODE_412_PRECONDITION_FAILED,"4.12-PRECONDITION_FAILED"}, {COAP_CODE_413_REQUEST_ENTITY_TOO_LARGE,"4.13-REQUEST_ENTITY_TOO_LARGE"}, {COAP_CODE_415_UNSUPPORTED_CONTENT_FORMAT,"4.15-UNSUPPORTED_CONTENT_FORMAT"}, {COAP_CODE_500_INTERNAL_SERVER_ERROR,"5.00-INTERNAL_SERVER_ERROR"}, {COAP_CODE_501_NOT_IMPLEMENTED,"5.01-NOT_IMPLEMENTED"}, {COAP_CODE_502_BAD_GATEWAY,"5.02-BAD_GATEWAY"}, {COAP_CODE_503_SERVICE_UNAVAILABLE,"5.03-SERVICE_UNAVAILABLE"}, {COAP_CODE_504_GATEWAY_TIMEOUT,"5.04-GATEWAY_TIMEOUT"}, {COAP_CODE_505_PROXYING_NOT_SUPPORTED,"5.05-PROXYING_NOT_SUPPORTED"}, }; const char * tc_iot_coap_get_message_code_str(int code) { int i = 0; int map_size = sizeof(_tc_iot_coap_message_code_map)/sizeof(tc_iot_code_map); for (i = 0; i < map_size; i++) { if (code == _tc_iot_coap_message_code_map[i].code) { return _tc_iot_coap_message_code_map[i].str; } } return ""; } static tc_iot_code_map _tc_iot_coap_option_number_map[] = { {COAP_OPTION_IF_MATCH,"1-IF_MATCH"}, {COAP_OPTION_URI_HOST,"3-URI_HOST"}, {COAP_OPTION_ETAG,"4-ETAG"}, {COAP_OPTION_IF_NONE_MATCH,"5-IF_NONE_MATCH"}, {COAP_OPTION_URI_PORT,"7-URI_PORT"}, {COAP_OPTION_LOCATION_PATH,"8-LOCATION_PATH"}, {COAP_OPTION_URI_PATH,"11-URI_PATH"}, {COAP_OPTION_CONTENT_FORMAT,"12-CONTENT_FORMAT"}, {COAP_OPTION_MAX_AGE,"14-MAX_AGE"}, {COAP_OPTION_URI_QUERY,"15-URI_QUERY"}, {COAP_OPTION_ACCEPT,"17-ACCEPT"}, {COAP_OPTION_LOCATION_QUERY,"20-LOCATION_QUERY"}, {COAP_OPTION_PROXY_URI,"35-PROXY_URI"}, {COAP_OPTION_PROXY_SCHEME,"39-PROXY_SCHEME"}, {COAP_OPTION_SIZE1,"60-SIZE1"}, }; const char * tc_iot_coap_get_option_number_str(int number) { int i = 0; int map_size = sizeof(_tc_iot_coap_option_number_map)/sizeof(tc_iot_code_map); for (i = 0; i < map_size; i++) { if (number == _tc_iot_coap_option_number_map[i].code) { return _tc_iot_coap_option_number_map[i].str; } } return ""; }
35.853933
81
0.717017
407ca3bc2afee01afd98415bab7e06b897abc533
364
h
C
SimpleViewerImageSubView.h
navjottomer/SimpleCap-1.2
b337037275a4aa5dc7294bac12a70b3943511a0d
[ "Unlicense" ]
null
null
null
SimpleViewerImageSubView.h
navjottomer/SimpleCap-1.2
b337037275a4aa5dc7294bac12a70b3943511a0d
[ "Unlicense" ]
null
null
null
SimpleViewerImageSubView.h
navjottomer/SimpleCap-1.2
b337037275a4aa5dc7294bac12a70b3943511a0d
[ "Unlicense" ]
null
null
null
// // SimpleViewerImageSubView.h // SimpleCap // // Created by - on 09/01/04. // Copyright 2009 Hiroshi Hashiguchi. All rights reserved. // #import <Cocoa/Cocoa.h> @interface SimpleViewerImageSubView : NSView { NSImage* _image; NSImageInterpolation _interpolation; } - (void)setImage:(NSImage*)image; - (NSImage*)image; - (CGFloat)reductionRatio; @end
15.826087
59
0.717033
7ba6c15871353ecccf391e3e5396b09b3c76fb6a
3,796
c
C
firmware/uart.c
lxrobotics/arduinoio
afcb5404ffe373086130149fb1a403d28bab39a7
[ "BSD-3-Clause" ]
null
null
null
firmware/uart.c
lxrobotics/arduinoio
afcb5404ffe373086130149fb1a403d28bab39a7
[ "BSD-3-Clause" ]
null
null
null
firmware/uart.c
lxrobotics/arduinoio
afcb5404ffe373086130149fb1a403d28bab39a7
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2016, Alexander Entinger / LXRobotics * 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 motor-controller-highpower-motorshield 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. */ #include "uart.h" #include <avr/io.h> #include <avr/interrupt.h> #define BUF_SIZE (256) static volatile uint8_t rx_rd_ptr = 0, rx_wr_ptr = 0, rx_cnt = 0; static volatile uint8_t rx_buf[BUF_SIZE]; static volatile uint8_t tx_rd_ptr = 0, tx_wr_ptr = 0, tx_cnt = 0; static volatile uint8_t tx_buf[BUF_SIZE]; /** * @brief init uart interface to 115200, 8, N, 1 */ void initUart() { // baudrate = 230400, error = -3.5 % UBRR0 = 8; UCSR0A = (1<<U2X0); // enable rx complete interrupt and // enable reseiver and transmitter UCSR0B = (1<<RXCIE0) | (1<<RXEN0) | (1<<TXEN0); } /** * @brief put data into the tx ringbuffer * @param data data to put in the tx buffer */ void sendByte(uint8_t const data) { cli(); if(tx_cnt < BUF_SIZE) { // buffer not full tx_buf[tx_wr_ptr] = data; tx_wr_ptr = (tx_wr_ptr + 1) & (BUF_SIZE-1); tx_cnt++; UCSR0B |= (1<<UDRIE0); // activate uart data register empty interrupt } sei(); } /** * @brief put data into the tx ringbuffer * @param data pointer to data array to put in the tx buffer * @param size number of elements to put into the tx ringbuffer */ void sendByteArray(uint8_t *data, uint8_t const size) { for(uint8_t i=0; i<size; i++) { sendByte(data[i]); } } /** * @brief reads a data byte from the uart * @param data pointer where to save the read data */ void readByte(uint8_t *data) { cli(); if(rx_cnt > 0) { // buffer not empty yet *data = rx_buf[rx_rd_ptr]; rx_rd_ptr = (rx_rd_ptr + 1) & (BUF_SIZE-1); rx_cnt--; } sei(); } /** * @brief checks if data for reading is available * @return 0 if false, number of bytes otherwise */ uint8_t uartDataAvailable() { cli(); uint8_t tmp = rx_cnt; sei(); return tmp; } /** * @brief uart receive complete ISR */ ISR(USART_RX_vect) { if(rx_cnt < BUF_SIZE) { // buffer not full rx_buf[rx_wr_ptr] = UDR0; rx_wr_ptr = (rx_wr_ptr + 1) & (BUF_SIZE-1); rx_cnt++; } } /** * @brief uart data register empty ISR */ ISR(USART_UDRE_vect) { if(tx_cnt > 0) { // buffer not empty yet UDR0 = tx_buf[tx_rd_ptr]; tx_rd_ptr = (tx_rd_ptr + 1) & (BUF_SIZE-1); tx_cnt--; if(tx_cnt == 0) UCSR0B &= ~(1<<UDRIE0); // deactivate that interrupt } }
28.328358
84
0.701791
7bb59e4a9921c719fd35a0ed08062cfb0d790828
2,355
h
C
sdk/ANCustomAdapter.h
herrernst/mobile-sdk-ios
7c69e243a7c728a520fe12f3a5953ba716b20c83
[ "Apache-2.0" ]
1
2019-04-23T12:26:07.000Z
2019-04-23T12:26:07.000Z
sdk/ANCustomAdapter.h
herrernst/mobile-sdk-ios
7c69e243a7c728a520fe12f3a5953ba716b20c83
[ "Apache-2.0" ]
null
null
null
sdk/ANCustomAdapter.h
herrernst/mobile-sdk-ios
7c69e243a7c728a520fe12f3a5953ba716b20c83
[ "Apache-2.0" ]
null
null
null
/* Copyright 2013 APPNEXUS INC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import "ANTargetingParameters.h" #import "ANAdConstants.h" @protocol ANCustomAdapterDelegate <NSObject> - (void)didFailToLoadAd:(ANAdResponseCode)errorCode; - (void)adWasClicked; - (void)willPresentAd; - (void)didPresentAd; - (void)willCloseAd; - (void)didCloseAd; - (void)willLeaveApplication; @end @protocol ANCustomAdapter <NSObject> @property (nonatomic, readwrite, weak) id<ANCustomAdapterDelegate> delegate; @end @protocol ANCustomAdapterBannerDelegate; @protocol ANCustomAdapterBanner <ANCustomAdapter> - (void)requestBannerAdWithSize:(CGSize)size rootViewController:(UIViewController *)rootViewController serverParameter:(NSString *)parameterString adUnitId:(NSString *)idString targetingParameters:(ANTargetingParameters *)targetingParameters; @property (nonatomic, readwrite, weak) id<ANCustomAdapterBannerDelegate, ANCustomAdapterDelegate> delegate; @end @protocol ANCustomAdapterInterstitialDelegate; @protocol ANCustomAdapterInterstitial <ANCustomAdapter> - (void)requestInterstitialAdWithParameter:(NSString *)parameterString adUnitId:(NSString *)idString targetingParameters:(ANTargetingParameters *)targetingParameters; - (void)presentFromViewController:(UIViewController *)viewController; - (BOOL)isReady; @property (nonatomic, readwrite, weak) id<ANCustomAdapterInterstitialDelegate, ANCustomAdapterDelegate> delegate; @end @protocol ANCustomAdapterBannerDelegate <ANCustomAdapterDelegate> - (void)didLoadBannerAd:(UIView *)view; @end @protocol ANCustomAdapterInterstitialDelegate <ANCustomAdapterDelegate> - (void)didLoadInterstitialAd:(id<ANCustomAdapterInterstitial>)adapter; - (void)failedToDisplayAd; @end
26.761364
113
0.768577
7bdb49b86ead1f0346a200a1a65fae922b21491f
6,035
h
C
platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa/crypto_extra.h
Eric-A-Marks/mbed-os
4ba07d9413fbf7bae2db97a06e4eb4f275063d93
[ "Apache-2.0" ]
1
2021-04-12T14:01:02.000Z
2021-04-12T14:01:02.000Z
platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa/crypto_extra.h
Eric-A-Marks/mbed-os
4ba07d9413fbf7bae2db97a06e4eb4f275063d93
[ "Apache-2.0" ]
1
2021-07-01T18:20:13.000Z
2021-07-01T18:20:13.000Z
platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa/crypto_extra.h
Eric-A-Marks/mbed-os
4ba07d9413fbf7bae2db97a06e4eb4f275063d93
[ "Apache-2.0" ]
1
2018-01-11T13:11:16.000Z
2018-01-11T13:11:16.000Z
/* * Copyright (c) 2018-2020, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * */ /** * \file psa/crypto_extra.h * * \brief PSA cryptography module: vendor extensions * * \note This file may not be included directly. Applications must * include psa/crypto.h. * * This file is reserved for vendor-specific definitions. */ #ifndef PSA_CRYPTO_EXTRA_H #define PSA_CRYPTO_EXTRA_H #include "psa/crypto_compat.h" #include "platform/mbed_toolchain.h" #ifdef __cplusplus extern "C" { #endif /** \addtogroup crypto_types * @{ */ /** DSA public key. * * The import and export format is the * representation of the public key `y = g^x mod p` as a big-endian byte * string. The length of the byte string is the length of the base prime `p` * in bytes. */ #define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t)0x4002) /** DSA key pair (private and public key). * * The import and export format is the * representation of the private key `x` as a big-endian byte string. The * length of the byte string is the private key size in bytes (leading zeroes * are not stripped). * * Determinstic DSA key derivation with psa_generate_derived_key follows * FIPS 186-4 &sect;B.1.2: interpret the byte string as integer * in big-endian order. Discard it if it is not in the range * [0, *N* - 2] where *N* is the boundary of the private key domain * (the prime *p* for Diffie-Hellman, the subprime *q* for DSA, * or the order of the curve's base point for ECC). * Add 1 to the resulting integer and use this as the private key *x*. * */ #define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t)0x7002) /**@}*/ #if defined(MBEDTLS_ECP_C) #include <mbedtls/ecp.h> /** Convert an ECC curve identifier from the Mbed TLS encoding to PSA. * * \note This function is provided solely for the convenience of * Mbed TLS and may be removed at any time without notice. * * \param grpid An Mbed TLS elliptic curve identifier * (`MBEDTLS_ECP_DP_xxx`). * \param[out] bits On success, the bit size of the curve. * * \return The corresponding PSA elliptic curve identifier * (`PSA_ECC_FAMILY_xxx`). * \return \c 0 on failure (\p grpid is not recognized). */ static inline psa_ecc_family_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grpid, size_t *bits ) { switch( grpid ) { case MBEDTLS_ECP_DP_SECP192R1: *bits = 192; return( PSA_ECC_FAMILY_SECP_R1 ); case MBEDTLS_ECP_DP_SECP224R1: *bits = 224; return( PSA_ECC_FAMILY_SECP_R1 ); case MBEDTLS_ECP_DP_SECP256R1: *bits = 256; return( PSA_ECC_FAMILY_SECP_R1 ); case MBEDTLS_ECP_DP_SECP384R1: *bits = 384; return( PSA_ECC_FAMILY_SECP_R1 ); case MBEDTLS_ECP_DP_SECP521R1: *bits = 521; return( PSA_ECC_FAMILY_SECP_R1 ); case MBEDTLS_ECP_DP_BP256R1: *bits = 256; return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 ); case MBEDTLS_ECP_DP_BP384R1: *bits = 384; return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 ); case MBEDTLS_ECP_DP_BP512R1: *bits = 512; return( PSA_ECC_FAMILY_BRAINPOOL_P_R1 ); case MBEDTLS_ECP_DP_CURVE25519: *bits = 255; return( PSA_ECC_FAMILY_MONTGOMERY ); case MBEDTLS_ECP_DP_SECP192K1: *bits = 192; return( PSA_ECC_FAMILY_SECP_K1 ); case MBEDTLS_ECP_DP_SECP224K1: *bits = 224; return( PSA_ECC_FAMILY_SECP_K1 ); case MBEDTLS_ECP_DP_SECP256K1: *bits = 256; return( PSA_ECC_FAMILY_SECP_K1 ); case MBEDTLS_ECP_DP_CURVE448: *bits = 448; return( PSA_ECC_FAMILY_MONTGOMERY ); default: *bits = 0; return( 0 ); } } #endif /* MBEDTLS_ECP_C */ /** \brief Declare the enrollment algorithm for a key. * * An operation on a key may indifferently use the algorithm set with * psa_set_key_algorithm() or with this function. * * \param[out] attributes The attribute structure to write to. * \param alg2 A second algorithm that the key may be used * for, in addition to the algorithm set with * psa_set_key_algorithm(). * * \deprecated This is for backward compatibility only. * Setting an enrollment algorithm is not recommended, because * using the same key with different algorithms can allow some * attacks based on arithmetic relations between different * computations made with the same key, or can escalate harmless * side channels into exploitable ones. Use this function only * if it is necessary to support a protocol for which it has been * verified that the usage of the key with multiple algorithms * is safe. */ MBED_DEPRECATED("Setting enrollment algorithm is for backward compatibility and not recommended.") static inline void psa_set_key_enrollment_algorithm( psa_key_attributes_t *attributes, psa_algorithm_t alg2) { attributes->alg2 = alg2; } /** Retrieve the enrollment algorithm policy from key attributes. * * \param[in] attributes The key attribute structure to query. * * \return The enrollment algorithm stored in the attribute structure. * \deprecated This is for backward compatibility only. * Deprecated along with psa_set_key_enrollment_algorithm(). */ MBED_DEPRECATED("Getting enrollment algorithm is for backward compatibility and not recommended.") static inline psa_algorithm_t psa_get_key_enrollment_algorithm( const psa_key_attributes_t *attributes) { return attributes->alg2; } #ifdef __cplusplus } #endif #endif /* PSA_CRYPTO_EXTRA_H */
33.715084
98
0.650041
f44c64941e0ffbf115481d7435b3dd6207bf079e
1,723
h
C
shell/common/gin_converters/base_converter.h
Sandip7677/electron
f17e8996ac169e3e92f732594cf4a14ddd177ef4
[ "MIT" ]
4
2020-03-22T03:02:30.000Z
2021-06-26T11:10:52.000Z
shell/common/gin_converters/base_converter.h
Mohamed-Abdelgaber/electron
2b25e737a74c689a9965ed61574ef22ba237ee02
[ "MIT" ]
21
2021-05-02T05:12:23.000Z
2022-02-02T07:58:12.000Z
shell/common/gin_converters/base_converter.h
Mohamed-Abdelgaber/electron
2b25e737a74c689a9965ed61574ef22ba237ee02
[ "MIT" ]
1
2021-12-03T19:19:54.000Z
2021-12-03T19:19:54.000Z
// Copyright (c) 2020 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_BASE_CONVERTER_H_ #define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_BASE_CONVERTER_H_ #include "base/process/kill.h" #include "gin/converter.h" namespace gin { template <> struct Converter<base::TerminationStatus> { static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const base::TerminationStatus& status) { switch (status) { case base::TERMINATION_STATUS_NORMAL_TERMINATION: return gin::ConvertToV8(isolate, "clean-exit"); case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: return gin::ConvertToV8(isolate, "abnormal-exit"); case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: return gin::ConvertToV8(isolate, "killed"); case base::TERMINATION_STATUS_PROCESS_CRASHED: return gin::ConvertToV8(isolate, "crashed"); case base::TERMINATION_STATUS_STILL_RUNNING: return gin::ConvertToV8(isolate, "still-running"); case base::TERMINATION_STATUS_LAUNCH_FAILED: return gin::ConvertToV8(isolate, "launch-failed"); case base::TERMINATION_STATUS_OOM: return gin::ConvertToV8(isolate, "oom"); #if defined(OS_WIN) case base::TERMINATION_STATUS_INTEGRITY_FAILURE: return gin::ConvertToV8(isolate, "integrity-failure"); #endif case base::TERMINATION_STATUS_MAX_ENUM: NOTREACHED(); return gin::ConvertToV8(isolate, ""); } NOTREACHED(); return gin::ConvertToV8(isolate, ""); } }; } // namespace gin #endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_BASE_CONVERTER_H_
35.895833
75
0.71155
21b89af8738a51df076374c0e635d361104339a0
13,475
c
C
components/provisioning/config.c
charrea6/homething
6490b1819b865ffd861bec047be8e25ad03e8ac9
[ "MIT" ]
2
2019-04-11T21:37:41.000Z
2020-04-01T19:31:57.000Z
components/provisioning/config.c
charrea6/homething
6490b1819b865ffd861bec047be8e25ad03e8ac9
[ "MIT" ]
null
null
null
components/provisioning/config.c
charrea6/homething
6490b1819b865ffd861bec047be8e25ad03e8ac9
[ "MIT" ]
null
null
null
#include <esp_log.h> #include <esp_system.h> #include <esp_http_server.h> #include <nvs_flash.h> #include "freertos/FreeRTOS.h" #include "freertos/timers.h" #include "provisioning.h" #include "provisioning_int.h" #include "captdns.h" #include "wifi.h" #include "iot.h" #include "utils.h" #include "cbor.h" #define MAX_CONTENT_LENGTH 1024 typedef enum FieldType { FT_USERNAME = 0, FT_PASSWORD, FT_HOSTNAME, FT_PORT, FT_CHECKBOX, FT_DEVICE_ID, FT_STRING, FT_CHOICE, FT_MAX } FieldType; struct variable { const char *name; FieldType type; }; struct setting { const char *name; int nrofVariables; struct variable *variables; }; #include "provisioningSettings.h" const char *TAG="CONFIG"; static void reboot(TimerHandle_t xTimer); static bool getVariables(nvs_handle handle, struct setting *setting, CborEncoder *encoder); static char *setVariables(nvs_handle handle, struct setting *setting, CborValue *it); typedef bool (*cborTypeTest)(const CborValue *); static const cborTypeTest fieldTypeToCborType[FT_MAX] = { cbor_value_is_text_string, cbor_value_is_text_string, cbor_value_is_text_string, cbor_value_is_unsigned_integer, cbor_value_is_boolean, cbor_value_is_text_string, cbor_value_is_text_string, cbor_value_is_integer }; esp_err_t provisioningConfigPostHandler(httpd_req_t *req) { char *buf = NULL; char *errorMsg = NULL; ESP_LOGI(TAG, "/config handler read content length %d", req->content_len); if (req->content_len > MAX_CONTENT_LENGTH) { errorMsg = "config content length too big"; goto error; } nvs_handle handle; size_t off = 0; int ret; buf = malloc(req->content_len); if (!buf) { errorMsg = "failed to allocate buffer"; goto error; } while (off < req->content_len) { /* Read data received in the request */ ret = httpd_req_recv(req, buf + off, req->content_len - off); if (ret <= 0) { if (ret == HTTPD_SOCK_ERR_TIMEOUT) { httpd_resp_send_408(req); } free (buf); return ESP_FAIL; } off += ret; ESP_LOGI(TAG, "/config handler recv length %d", ret); } CborParser parser; CborValue it; CborError err = cbor_parser_init((uint8_t*)buf, req->content_len, 0, &parser, &it); if (err || (cbor_value_get_type(&it) != CborMapType)) { errorMsg = "Failed to parse payload as CBOR or not a map type"; goto error; } err = cbor_value_enter_container(&it, &it); if (err) { errorMsg = "Failed to enter container"; goto error; } while (!cbor_value_at_end(&it)) { CborError err; char *key; size_t keyLen; int i; if (cbor_value_get_type(&it) != CborTextStringType) { errorMsg = "Invalid key in map"; goto error; } err = cbor_value_dup_text_string(&it, &key, &keyLen, &it); if (err) { errorMsg = "Failed to extract key"; goto error; } struct setting *foundSetting = NULL; for (i=0; i < nrofSettings; i++) { if (strcmp(key, settings[i].name) == 0) { foundSetting = &settings[i]; break; } } if (foundSetting == NULL) { ESP_LOGE(TAG, "Unexpected key \"%s\"", key); free(key); errorMsg = "Unexpected key"; goto error; } free(key); ESP_LOGI(TAG, "Processing variables for %s", foundSetting->name); if (cbor_value_get_type(&it) != CborMapType) { errorMsg = "Key value not a map type"; goto error; } err = nvs_open(foundSetting->name, NVS_READWRITE, &handle); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to open %s error %d", foundSetting->name, err); errorMsg = "Failed to open NVS"; goto error; } CborValue variableIt; err = cbor_value_enter_container(&it, &variableIt); if (err == CborNoError) { errorMsg = setVariables(handle, foundSetting, &variableIt); } nvs_close(handle); if (errorMsg) { goto error; } err = cbor_value_leave_container(&it, &variableIt); if (err != CborNoError) { errorMsg = "Leave variable container failed"; goto error; } } ESP_LOGI(TAG, "Finished processing settings, will now reboot"); httpd_send(req, "Saved", 5); xTimerStart(xTimerCreate("REBOOT", 10000 / portTICK_RATE_MS, pdTRUE, NULL, reboot), 0); free(buf); return ESP_FAIL; error: ESP_LOGE(TAG, "ERROR: %s", errorMsg); httpd_resp_set_status(req, HTTPD_400); httpd_resp_send(req, errorMsg, -1); if (buf) { free(buf); } return ESP_FAIL; } esp_err_t provisioningConfigGetHandler(httpd_req_t *req) { char *errorMsg = NULL; int i; uint8_t *buf = NULL; esp_err_t err; nvs_handle handle; CborEncoder encoder, settingEncoder; CborError cborErr; buf = malloc(MAX_CONTENT_LENGTH); if (buf == NULL) { errorMsg = "Failed to allocate cbor buffer"; goto error; } cbor_encoder_init(&encoder, buf, MAX_CONTENT_LENGTH, 0); cborErr = cbor_encoder_create_map(&encoder, &settingEncoder, CborIndefiniteLength); if (cborErr != CborNoError) { errorMsg = "Failed to create settings encoder"; goto error; } for (i=0; i < nrofSettings; i++) { CborEncoder variablesEncoder; err = nvs_open(settings[i].name, NVS_READONLY, &handle); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to open %s error %d", settings[i].name, err); err = ESP_OK; continue; } cborErr = cbor_encode_text_stringz(&settingEncoder, settings[i].name); if (cborErr != CborNoError) { errorMsg = "Failed to add setting to map"; goto variableError; } cborErr = cbor_encoder_create_map(&settingEncoder, &variablesEncoder, CborIndefiniteLength); if (cborErr != CborNoError) { errorMsg = "Failed to create variables encoder"; goto variableError; } if (!getVariables(handle, &settings[i], &variablesEncoder)) { errorMsg = "Failed to add variables"; goto variableError; } cborErr = cbor_encoder_close_container(&settingEncoder, &variablesEncoder); if (cborErr != CborNoError) { errorMsg = "Failed to close variable container"; } variableError: nvs_close(handle); if (errorMsg) { goto error; } } cborErr = cbor_encoder_close_container(&encoder, &settingEncoder); if (cborErr != CborNoError) { errorMsg = "Failed to close settings container"; goto error; } provisioningSetContentType(req, CT_CBOR); httpd_resp_send(req, (const char*)buf, cbor_encoder_get_buffer_size(&encoder, buf)); free(buf); return ESP_OK; error: ESP_LOGE(TAG, "ERROR: %s", errorMsg); httpd_resp_set_status(req, HTTPD_400); httpd_resp_send(req, errorMsg, -1); if (buf) { free(buf); } return ESP_FAIL; } static void reboot(TimerHandle_t xTimer) { esp_restart(); } static char *setVariables(nvs_handle handle, struct setting *setting, CborValue *it) { esp_err_t err = ESP_OK; char *errorMsg = NULL; while (!cbor_value_at_end(it)) { CborError cborErr; char *key; size_t keyLen; int i; if (cbor_value_get_type(it) != CborTextStringType) { ESP_LOGE(TAG, "Was execting string got %d", cbor_value_get_type(it)); errorMsg = "Invalid variable key in map"; goto error; } cborErr = cbor_value_dup_text_string(it, &key, &keyLen, it); if (cborErr) { errorMsg = "Failed to extract variable key"; goto error; } struct variable *foundVariable = NULL; for (i=0; i < setting->nrofVariables; i ++) { if (strcmp(key, setting->variables[i].name) == 0) { foundVariable = &setting->variables[i]; break; } } free(key); if (foundVariable == NULL) { errorMsg = "Unexpected variable key"; goto error; } if (!fieldTypeToCborType[foundVariable->type](it)) { ESP_LOGE(TAG, "Unexpected variable type for %s, expected FT type %d got Cbor type %d", foundVariable->name, foundVariable->type, cbor_value_get_type(it)); errorMsg = "Unexpected variable type"; goto error; } switch(foundVariable->type) { case FT_STRING: case FT_USERNAME: case FT_PASSWORD: case FT_HOSTNAME: { char *value; size_t valueLen; cborErr = cbor_value_dup_text_string(it, &value, &valueLen, it); if (cborErr) { errorMsg = "Failed to extract string variable value"; goto error; } ESP_LOGI(TAG,"Setting %s to \"%s\" (len %u)", foundVariable->name, value, valueLen); err = nvs_set_str(handle, foundVariable->name, value); free(value); } break; case FT_PORT: { uint64_t value; cborErr = cbor_value_get_uint64(it, &value); if (cborErr) { errorMsg = "Failed to extract int variable value"; goto error; } cbor_value_advance(it); ESP_LOGI(TAG,"Setting %s to %u", foundVariable->name, (uint16_t)value); err = nvs_set_u16(handle, foundVariable->name, (uint16_t)value); } break; case FT_CHECKBOX: { bool value; cborErr = cbor_value_get_boolean(it, &value); if (cborErr) { errorMsg = "Failed to extract bool variable value"; goto error; } cbor_value_advance(it); ESP_LOGI(TAG,"Setting %s to %s", foundVariable->name, value ? "true":"false"); err = nvs_set_u8(handle, foundVariable->name, value); } break; case FT_DEVICE_ID: break; case FT_CHOICE: { int64_t value; cborErr = cbor_value_get_int64(it, &value); if (cborErr) { errorMsg = "Failed to extract int variable value"; goto error; } cbor_value_advance(it); ESP_LOGI(TAG,"Setting %s to %d", foundVariable->name, (uint32_t)value); err = nvs_set_i32(handle, foundVariable->name, (int32_t)value); } break; default: err = ESP_FAIL; break; } if (err != ESP_OK) { ESP_LOGW(TAG, "setVariable failed for variable %s type %d err %d", foundVariable->name, foundVariable->type, err); } } error: return errorMsg; } static bool getVariables(nvs_handle handle, struct setting *setting, CborEncoder *encoder) { int n; for (n = 0; n < setting->nrofVariables; n++) { esp_err_t err = ESP_OK; CborError cborErr = CborNoError; struct variable *var = &setting->variables[n]; CborEncoder beforeVariable = *encoder; cborErr = cbor_encode_text_stringz(encoder, var->name); if (cborErr != CborNoError) { goto error; } switch(var->type) { case FT_STRING: case FT_USERNAME: case FT_HOSTNAME: { char *value; err = nvs_get_str_alloc(handle, var->name, &value); if (err == ESP_OK) { cborErr = cbor_encode_text_string(encoder, value, strlen(value)); free(value); } } break; case FT_PASSWORD: cborErr = cbor_encode_text_string(encoder, "", 0); break; case FT_PORT: { uint16_t value; err = nvs_get_u16(handle, var->name, &value); if (err == ESP_OK) { cborErr = cbor_encode_uint(encoder, (uint64_t)value); } } break; case FT_CHECKBOX: { uint8_t value; err = nvs_get_u8(handle, var->name, &value); if (err == ESP_OK) { cborErr = cbor_encode_boolean(encoder, value?true:false); } } break; case FT_DEVICE_ID: { uint8_t mac[6]; esp_read_mac(mac, ESP_MAC_WIFI_STA); cborErr = cbor_encode_byte_string(encoder, mac, sizeof(mac)); } break; case FT_CHOICE: { int32_t value; err = nvs_get_i32(handle, var->name, &value); if (err == ESP_OK) { cborErr = cbor_encode_int(encoder, (int64_t)value); } } break; default: err = ESP_FAIL; break; } if (err != ESP_OK) { ESP_LOGW(TAG, "addVariable failed for variable %s type %d err %d", var->name, var->type, err); *encoder = beforeVariable; } if (cborErr != CborNoError) { goto error; } } return true; error: return false; }
30.349099
166
0.568163
bcb9616bad79d766856debdf62be68a3d49ddf24
492
h
C
searchcore/src/vespa/searchcore/proton/server/i_move_operation_limiter.h
amahussein/vespa
29d266ae1e5c95e25002b97822953fdd02b1451e
[ "Apache-2.0" ]
1
2020-06-02T13:28:29.000Z
2020-06-02T13:28:29.000Z
searchcore/src/vespa/searchcore/proton/server/i_move_operation_limiter.h
amahussein/vespa
29d266ae1e5c95e25002b97822953fdd02b1451e
[ "Apache-2.0" ]
1
2021-01-21T01:37:37.000Z
2021-01-21T01:37:37.000Z
searchcore/src/vespa/searchcore/proton/server/i_move_operation_limiter.h
amahussein/vespa
29d266ae1e5c95e25002b97822953fdd02b1451e
[ "Apache-2.0" ]
1
2020-02-01T07:21:28.000Z
2020-02-01T07:21:28.000Z
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <memory> namespace search { class IDestructorCallback; } namespace proton { /** * Interface used to limit the number of outstanding move operations a blockable maintenance job can have. */ struct IMoveOperationLimiter { virtual ~IMoveOperationLimiter() {} virtual std::shared_ptr<search::IDestructorCallback> beginOperation() = 0; }; }
25.894737
118
0.756098
29a8d09e8c933cadf18df2d9522ddac05ec6e386
581
h
C
STRemoteTable.h
tomwhipple/STRemoteResources
623da587af37a1e5cf8fc5333d2207a83f06de8e
[ "BSD-3-Clause" ]
1
2021-08-08T13:34:11.000Z
2021-08-08T13:34:11.000Z
STRemoteTable.h
tomwhipple/STRemoteResources
623da587af37a1e5cf8fc5333d2207a83f06de8e
[ "BSD-3-Clause" ]
null
null
null
STRemoteTable.h
tomwhipple/STRemoteResources
623da587af37a1e5cf8fc5333d2207a83f06de8e
[ "BSD-3-Clause" ]
null
null
null
// // RemoteTable.h // // Created by Tom Whipple on 9/30/10. // Copyright 2010 Smartovation Technologies, LLC. All rights reserved. // #import <Foundation/Foundation.h> #import "STRemoteObject.h" #define RemoteTableDidUpdate kRemoteObjectUpdatedNotification @protocol STRemoteItem -(id) initWithDictionary:(NSDictionary*) dict; @end @interface STRemoteTable : STRemoteObject { @protected NSMutableArray* array; NSString* className; } @property (nonatomic,readonly) NSArray* array; -(id) initWithFile:(NSString*)f baseURL:(NSURL*)url className:(NSString*)cn; @end
17.606061
76
0.753873
4e722a0186599ff09d2c8270df610193906a5e80
13,152
c
C
syslinux/com32/chain/options.c
TooDumbForAName/modern-boot-floppy
c0f4352ee356aab3f31d214af73d2462bde28198
[ "BSD-2-Clause" ]
null
null
null
syslinux/com32/chain/options.c
TooDumbForAName/modern-boot-floppy
c0f4352ee356aab3f31d214af73d2462bde28198
[ "BSD-2-Clause" ]
null
null
null
syslinux/com32/chain/options.c
TooDumbForAName/modern-boot-floppy
c0f4352ee356aab3f31d214af73d2462bde28198
[ "BSD-2-Clause" ]
null
null
null
/* ----------------------------------------------------------------------- * * * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin * Copyright 2010 Shao Miller * Copyright 2010-2012 Michal Soltys * * 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 <syslinux/movebits.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "chain.h" #include "partiter.h" #include "utility.h" #include "options.h" struct options opt; static int soi_s2n(char *ptr, addr_t *seg, addr_t *off, addr_t *ip, addr_t def) { addr_t segval, offval, ipval, val; char *p; /* defaults */ segval = 0; offval = def; ipval = def; segval = strtoul(ptr, &p, 0); if (p[0] == ':' && p[1] && p[1] != ':') offval = strtoul(p+1, &p, 0); if (p[0] == ':' && p[1] && p[1] != ':') ipval = strtoul(p+1, NULL, 0); /* verify if load address is within [dosmin, dosmax) */ val = (segval << 4) + offval; if (val < dosmin || val >= dosmax) { error("Invalid seg:off:* address specified."); goto bail; } /* * verify if jump address is within [dosmin, dosmax) and offset is 16bit * sane */ val = (segval << 4) + ipval; if (ipval > 0xFFFE || val < dosmin || val >= dosmax) { error("Invalid seg:*:ip address specified."); goto bail; } if (seg) *seg = segval; if (off) *off = offval; if (ip) *ip = ipval; return 0; bail: return -1; } static void usage(void) { size_t i; static const char *const usage[] = { "Usage:", "", " disk + partition selection:", " chain.c32 [options]", " chain.c32 hd#[,#] [options]", " chain.c32 fd#[,#] [options]", " chain.c32 mbr=<id>[,#] [options]", " chain.c32 guid=<guid>[,#] [options]", " chain.c32 boot[,#] [options]", "", " direct partition selection:", " chain.c32 guid=<guid> [options]", " chain.c32 label=<label> [options]", " chain.c32 fs [options]", "", "You can use ':' instead of '=' and ' ' instead of ','.", "The default is 'boot,0'.", "", "Options:", " sect[=<s[:o[:i]]>] Load sector at <s:o>, jump to <s:i>", " - defaults to 0:0x7C00:0x7C00", " - omitted o/i values default to 0", " maps Map loaded sector into real memory", " setbpb Fix BPB fields in loaded sector", " filebpb Apply 'setbpb' to loaded file", " save Write adjusted sector back to disk", " hand Prepare handover area", " hptr Force ds:si and ds:bp to point to handover area", " swap Swap drive numbers, if bootdisk is not fd0/hd0", " nohide Disable all hide variations (default)", " hide Hide primary partitions, unhide selected partition", " hideall Hide *all* partitions, unhide selected partition", " unhide Unhide primary partitions", " unhideall Unhide *all* partitions", " fixchs Walk *all* partitions and fix E/MBRs' CHS values", " keeppxe Keep the PXE and UNDI stacks in memory (PXELINUX)", " warn Wait for a keypress to continue chainloading", " break Don't chainload", " relax Relax sanity checks", " prefmbr On hybrid MBR/GPT disks, prefer legacy layout", "", " file=<file> Load and execute <file>", " seg=<s[:o[:i]]> Load file at <s:o>, jump to <s:i>", " - defaults to 0:0x7C00:0x7C00", " - omitted o/i values default to 0", " isolinux=<loader> Load another version of ISOLINUX", " ntldr=<loader> Load Windows NTLDR, SETUPLDR.BIN or BOOTMGR", " reactos=<loader> Load ReactOS's loader", " cmldr=<loader> Load Recovery Console of Windows NT/2K/XP/2003", " freedos=<loader> Load FreeDOS KERNEL.SYS", " msdos=<loader> Load MS-DOS 2.xx - 6.xx IO.SYS", " msdos7=<loader> Load MS-DOS 7+ IO.SYS", " pcdos=<loader> Load PC-DOS IBMBIO.COM", " drmk=<loader> Load DRMK DELLBIO.BIN", " grub=<loader> Load GRUB Legacy stage2", " grubcfg=<config> Set alternative config filename for GRUB Legacy", " grldr=<loader> Load GRUB4DOS grldr", " bss=<sectimage> Emulate syslinux's BSS", " bs=<sectimage> Emulate syslinux's BS", "", "Please see doc/chain.txt for the detailed documentation." }; for (i = 0; i < sizeof(usage)/sizeof(usage[0]); i++) { if (i % 20 == 19) { puts("Press any key..."); wait_key(); } puts(usage[i]); } } void opt_set_defs(void) { memset(&opt, 0, sizeof opt); opt.sect = true; /* by def. load sector */ opt.maps = true; /* by def. map sector */ opt.hand = true; /* by def. prepare handover */ opt.brkchain = false; /* by def. do chainload */ opt.foff = opt.soff = opt.fip = opt.sip = 0x7C00; opt.drivename = "boot"; #ifdef DEBUG opt.warn = true; #endif } int opt_parse_args(int argc, char *argv[]) { int i; size_t v; char *p; for (i = 1; i < argc; i++) { if (!strncmp(argv[i], "file=", 5)) { opt.file = argv[i] + 5; } else if (!strcmp(argv[i], "nofile")) { opt.file = NULL; } else if (!strncmp(argv[i], "seg=", 4)) { if (soi_s2n(argv[i] + 4, &opt.fseg, &opt.foff, &opt.fip, 0)) goto bail; } else if (!strncmp(argv[i], "bss=", 4)) { opt.file = argv[i] + 4; opt.bss = true; opt.maps = false; opt.setbpb = true; } else if (!strncmp(argv[i], "bs=", 3)) { opt.file = argv[i] + 3; opt.sect = false; opt.filebpb = true; } else if (!strncmp(argv[i], "isolinux=", 9)) { opt.file = argv[i] + 9; opt.isolinux = true; opt.hand = false; opt.sect = false; } else if (!strncmp(argv[i], "ntldr=", 6)) { opt.fseg = 0x2000; /* NTLDR wants this address */ opt.foff = 0; opt.fip = 0; opt.file = argv[i] + 6; opt.setbpb = true; opt.hand = false; } else if (!strncmp(argv[i], "reactos=", 8)) { /* * settings based on commit * ad4cf1470977f648ee1dd45e97939589ccb0393c * note, conflicts with: * http://reactos.freedoors.org/Reactos%200.3.13/ReactOS-0.3.13-REL-src/boot/freeldr/notes.txt */ opt.fseg = 0; opt.foff = 0x8000; opt.fip = 0x8100; opt.file = argv[i] + 8; opt.setbpb = true; opt.hand = false; } else if (!strncmp(argv[i], "cmldr=", 6)) { opt.fseg = 0x2000; /* CMLDR wants this address */ opt.foff = 0; opt.fip = 0; opt.file = argv[i] + 6; opt.cmldr = true; opt.setbpb = true; opt.hand = false; } else if (!strncmp(argv[i], "freedos=", 8)) { opt.fseg = 0x60; /* FREEDOS wants this address */ opt.foff = 0; opt.fip = 0; opt.sseg = 0x1FE0; opt.file = argv[i] + 8; opt.setbpb = true; opt.hand = false; } else if ( (v = 6, !strncmp(argv[i], "msdos=", v) || !strncmp(argv[i], "pcdos=", v)) || (v = 7, !strncmp(argv[i], "msdos7=", v)) ) { opt.fseg = 0x70; /* MS-DOS 2.00 .. 6.xx wants this address */ opt.foff = 0; opt.fip = v == 7 ? 0x200 : 0; /* MS-DOS 7.0+ wants this ip */ opt.sseg = 0x8000; opt.file = argv[i] + v; opt.setbpb = true; opt.hand = false; } else if (!strncmp(argv[i], "drmk=", 5)) { opt.fseg = 0x70; /* DRMK wants this address */ opt.foff = 0; opt.fip = 0; opt.sseg = 0x2000; opt.soff = 0; opt.sip = 0; opt.file = argv[i] + 5; /* opt.drmk = true; */ opt.setbpb = true; opt.hand = false; } else if (!strncmp(argv[i], "grub=", 5)) { opt.fseg = 0x800; /* stage2 wants this address */ opt.foff = 0; opt.fip = 0x200; opt.file = argv[i] + 5; opt.grub = true; opt.hand = false; opt.sect = false; } else if (!strncmp(argv[i], "grubcfg=", 8)) { opt.grubcfg = argv[i] + 8; } else if (!strncmp(argv[i], "grldr=", 6)) { opt.file = argv[i] + 6; opt.grldr = true; opt.hand = false; opt.sect = false; } else if (!strcmp(argv[i], "keeppxe")) { opt.keeppxe = 3; } else if (!strcmp(argv[i], "nokeeppxe")) { opt.keeppxe = 0; } else if (!strcmp(argv[i], "maps")) { opt.maps = true; } else if (!strcmp(argv[i], "nomaps")) { opt.maps = false; } else if (!strcmp(argv[i], "hand")) { opt.hand = true; } else if (!strcmp(argv[i], "nohand")) { opt.hand = false; } else if (!strcmp(argv[i], "hptr")) { opt.hptr = true; } else if (!strcmp(argv[i], "nohptr")) { opt.hptr = false; } else if (!strcmp(argv[i], "swap")) { opt.swap = true; } else if (!strcmp(argv[i], "noswap")) { opt.swap = false; } else if (!strcmp(argv[i], "nohide")) { opt.hide = HIDE_OFF; } else if (!strcmp(argv[i], "hide")) { opt.hide = HIDE_ON; } else if (!strcmp(argv[i], "hideall")) { opt.hide = HIDE_ON | HIDE_EXT; } else if (!strcmp(argv[i], "unhide")) { opt.hide = HIDE_ON | HIDE_REV; } else if (!strcmp(argv[i], "unhideall")) { opt.hide = HIDE_ON | HIDE_EXT | HIDE_REV; } else if (!strcmp(argv[i], "setbpb")) { opt.setbpb = true; } else if (!strcmp(argv[i], "nosetbpb")) { opt.setbpb = false; } else if (!strcmp(argv[i], "filebpb")) { opt.filebpb = true; } else if (!strcmp(argv[i], "nofilebpb")) { opt.filebpb = false; } else if (!strncmp(argv[i], "sect=", 5) || !strcmp(argv[i], "sect")) { if (argv[i][4]) { if (soi_s2n(argv[i] + 5, &opt.sseg, &opt.soff, &opt.sip, 0)) goto bail; } opt.sect = true; } else if (!strcmp(argv[i], "nosect")) { opt.sect = false; opt.maps = false; } else if (!strcmp(argv[i], "save")) { opt.save = true; } else if (!strcmp(argv[i], "nosave")) { opt.save = false; } else if (!strcmp(argv[i], "fixchs")) { opt.fixchs = true; } else if (!strcmp(argv[i], "nofixchs")) { opt.fixchs = false; } else if (!strcmp(argv[i], "relax")) { opt.piflags |= PIF_RELAX; } else if (!strcmp(argv[i], "norelax")) { opt.piflags &= ~PIF_RELAX; } else if (!strcmp(argv[i], "warn")) { opt.warn = true; } else if (!strcmp(argv[i], "nowarn")) { opt.warn = false; } else if (!strcmp(argv[i], "prefmbr")) { opt.piflags |= PIF_PREFMBR; } else if (!strcmp(argv[i], "noprefmbr")) { opt.piflags &= ~PIF_PREFMBR; } else if (!strcmp(argv[i], "nobreak")) { opt.brkchain = false; } else if (!strcmp(argv[i], "break")) { opt.brkchain = true; opt.file = NULL; opt.maps = false; opt.hand = false; } else if (((argv[i][0] == 'h' || argv[i][0] == 'f') && argv[i][1] == 'd') || !strncmp(argv[i], "mbr:", 4) || !strncmp(argv[i], "mbr=", 4) || !strncmp(argv[i], "guid:", 5) || !strncmp(argv[i], "guid=", 5) || !strncmp(argv[i], "label:", 6) || !strncmp(argv[i], "label=", 6) || !strcmp(argv[i], "boot") || !strncmp(argv[i], "boot,", 5) || !strcmp(argv[i], "fs")) { opt.drivename = argv[i]; if (strncmp(argv[i], "label", 5)) p = strchr(opt.drivename, ','); else p = NULL; if (p) { *p = '\0'; opt.partition = p + 1; } else if (argv[i + 1] && argv[i + 1][0] >= '0' && argv[i + 1][0] <= '9') { opt.partition = argv[++i]; } } else { usage(); goto bail; } } if (opt.grubcfg && !opt.grub) { error("grubcfg=<filename> must be used together with grub=<loader>."); goto bail; } if (opt.filebpb && !opt.file) { error("Option 'filebpb' requires a file."); goto bail; } if (opt.save && !opt.sect) { error("Option 'save' requires a sector."); goto bail; } if (opt.setbpb && !opt.sect) { error("Option 'setbpb' requires a sector."); goto bail; } if (opt.maps && !opt.sect) { error("Option 'maps' requires a sector."); goto bail; } return 0; bail: return -1; } /* vim: set ts=8 sts=4 sw=4 noet: */
31.539568
101
0.548206
665a0f9ebfdef25b77dae59809b7c43b4d516721
1,899
h
C
gnuradio-3.7.13.4/gr-atsc/include/gnuradio/atsc/basic_trellis_encoder_impl.h
v1259397/cosmic-gnuradio
64c149520ac6a7d44179c3f4a38f38add45dd5dc
[ "BSD-3-Clause" ]
1
2021-03-09T07:32:37.000Z
2021-03-09T07:32:37.000Z
gnuradio-3.7.13.4/gr-atsc/include/gnuradio/atsc/basic_trellis_encoder_impl.h
v1259397/cosmic-gnuradio
64c149520ac6a7d44179c3f4a38f38add45dd5dc
[ "BSD-3-Clause" ]
null
null
null
gnuradio-3.7.13.4/gr-atsc/include/gnuradio/atsc/basic_trellis_encoder_impl.h
v1259397/cosmic-gnuradio
64c149520ac6a7d44179c3f4a38f38add45dd5dc
[ "BSD-3-Clause" ]
null
null
null
/* -*- c++ -*- */ /* * Copyright 2002 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef _ATSC_BASIC_TRELLIS_ENCODER_H_ #define _ATSC_BASIC_TRELLIS_ENCODER_H_ #include <gnuradio/atsc/api.h> #include <assert.h> /*! * \brief ATSC trellis encoder building block. * * Note this is NOT the 12x interleaved interface. * * This implements a single instance of the ATSC trellis encoder. * This is a rate 2/3 encoder (really a constraint length 3, rate 1/2 * encoder with the top bit passed through unencoded. This does not * implement the "precoding" of the top bit, because the NTSC rejection * filter is not supported. */ class ATSC_API atsci_basic_trellis_encoder { private: int state; // two bit state; public: atsci_basic_trellis_encoder () : state (0) {} /*! * Encode two bit INPUT into 3 bit return value. Domain is [0,3], * Range is [0,7]. The mapping to bipolar levels is not done. */ int encode (unsigned int input); //! reset encoder state void reset () { state = 0; } static const unsigned char next_state[32]; static const unsigned char out_symbol[32]; }; #endif /* _ATSC_BASIC_TRELLIS_ENCODER_H_ */
30.142857
71
0.71722
6125e3cea105cb52f6109b955be7abe8bdb978d7
1,112
h
C
Module/LKChatMoreItemView.h
FULANS/LKChatBar
65dad9a69f0cd5f06b92d2907383a9efde79a101
[ "MIT" ]
1
2021-08-24T02:23:59.000Z
2021-08-24T02:23:59.000Z
Module/LKChatMoreItemView.h
FULANS/LKChatBar
65dad9a69f0cd5f06b92d2907383a9efde79a101
[ "MIT" ]
null
null
null
Module/LKChatMoreItemView.h
FULANS/LKChatBar
65dad9a69f0cd5f06b92d2907383a9efde79a101
[ "MIT" ]
1
2022-03-24T15:13:12.000Z
2022-03-24T15:13:12.000Z
// // LKChatMoreItemView.h // LiemsMobile70 // // Created by WZheng on 2020/4/8. // Copyright © 2020 Luculent. All rights reserved. // #import <UIKit/UIKit.h> typedef NS_ENUM(NSUInteger, LKChatMoreViewItemType) { LKChatMoreViewItemTypeDefault = 0, /**< 默认未知类型 */ LKChatMoreViewItemTypeTakePicture = 1, /**< 拍照 */ LKChatMoreViewItemTypePhotoAlbum = 2, /**< 相册 */ LKChatMoreViewItemTypeVideo = 3, /**< 短视频 */ LKChatMoreViewItemTypeLocation = 4, /**< 地理位置 */ }; NS_ASSUME_NONNULL_BEGIN @interface LKChatMoreViewItem : NSObject @property (nonatomic, copy) NSString *pluginTitle; @property (nonatomic, strong) UIImage *pluginIconImage; @end @interface LKChatMoreItemView : UIView @property (nonatomic,assign, readonly) LKChatMoreViewItemType pluginType; - (void)fillWithPluginTitle:(NSString *)pluginTitle pluginIconImage:(UIImage *)pluginIconImage itemTyp:(LKChatMoreViewItemType)pluginType; @property (copy, nonatomic) void (^pluginDidClicked)(LKChatMoreViewItemType pluginType); @end NS_ASSUME_NONNULL_END
27.121951
88
0.706835
e85ab97b90fcd39552b15005f328af0d116ee4ae
5,190
h
C
zones.h
Maciej-Mudita/utz
9b8236e4c760e7828fb5f5aa73622fb379630a98
[ "MIT" ]
23
2017-01-23T09:35:32.000Z
2022-02-03T06:12:20.000Z
zones.h
troky/utz
e41d3a18e933b96b9fc54cebf85fbd5de75bee6d
[ "MIT" ]
5
2017-09-26T07:58:36.000Z
2020-09-26T12:50:46.000Z
zones.h
troky/utz
e41d3a18e933b96b9fc54cebf85fbd5de75bee6d
[ "MIT" ]
15
2017-10-02T22:21:12.000Z
2022-02-23T06:31:42.000Z
#ifndef _ZONES_H #define _ZONES_H const urule_packed_t zone_rules[50]; const char zone_abrevs[209]; #define MAX_ABREV_FORMATTER_LEN 7 const uzone_packed_t zone_defns[46]; #define UTZ_ADELAIDE &zone_defns[ 31] #define UTZ_AHMEDABAD &zone_defns[ 24] #define UTZ_ANCHORAGE &zone_defns[ 4] #define UTZ_ANKARA &zone_defns[ 39] #define UTZ_ATLANTA &zone_defns[ 12] #define UTZ_AUCKLAND &zone_defns[ 42] #define UTZ_BANGALORE &zone_defns[ 24] #define UTZ_BANGKOK &zone_defns[ 18] #define UTZ_BARCELONA &zone_defns[ 37] #define UTZ_BEIJING &zone_defns[ 27] #define UTZ_BELGRADE &zone_defns[ 37] #define UTZ_BELO_HORIZONTE &zone_defns[ 16] #define UTZ_BERLIN &zone_defns[ 37] #define UTZ_BOSTON &zone_defns[ 12] #define UTZ_BRAZZAVILLE &zone_defns[ 1] #define UTZ_BRISBANE &zone_defns[ 32] #define UTZ_BUENOS_AIRES &zone_defns[ 5] #define UTZ_CAIRO &zone_defns[ 0] #define UTZ_CALCUTTA &zone_defns[ 24] #define UTZ_CHANGZHOU &zone_defns[ 27] #define UTZ_CHENGDU &zone_defns[ 27] #define UTZ_CHENNAI &zone_defns[ 24] #define UTZ_CHICAGO &zone_defns[ 6] #define UTZ_CHONGQING &zone_defns[ 27] #define UTZ_DALLASFORT_WORTH &zone_defns[ 6] #define UTZ_DARWIN &zone_defns[ 33] #define UTZ_DELHI &zone_defns[ 24] #define UTZ_DENVER &zone_defns[ 7] #define UTZ_DUBAI &zone_defns[ 19] #define UTZ_GUADALAJARA &zone_defns[ 11] #define UTZ_GUAM &zone_defns[ 43] #define UTZ_GUANGZHOU &zone_defns[ 27] #define UTZ_HALIFAX &zone_defns[ 8] #define UTZ_HAMBURG &zone_defns[ 37] #define UTZ_HANGZHOU &zone_defns[ 27] #define UTZ_HARARE &zone_defns[ 2] #define UTZ_HELSINKI &zone_defns[ 38] #define UTZ_HOBART &zone_defns[ 34] #define UTZ_HONG_KONG &zone_defns[ 20] #define UTZ_HONOLULU &zone_defns[ 44] #define UTZ_HOUSTON &zone_defns[ 6] #define UTZ_HYDERABAD &zone_defns[ 24] #define UTZ_INLAND_EMPIRE &zone_defns[ 9] #define UTZ_ISTANBUL &zone_defns[ 39] #define UTZ_JERUSALEM &zone_defns[ 21] #define UTZ_JINAN &zone_defns[ 27] #define UTZ_KARACHI &zone_defns[ 22] #define UTZ_KATMANDU &zone_defns[ 23] #define UTZ_KOLKATA &zone_defns[ 24] #define UTZ_KUWAIT &zone_defns[ 25] #define UTZ_LAHORE &zone_defns[ 22] #define UTZ_LONDON &zone_defns[ 40] #define UTZ_LOS_ANGELES &zone_defns[ 9] #define UTZ_MADRID &zone_defns[ 37] #define UTZ_MANAUS &zone_defns[ 10] #define UTZ_MEXICO_CITY &zone_defns[ 11] #define UTZ_MIAMI &zone_defns[ 12] #define UTZ_MIDWAY &zone_defns[ 45] #define UTZ_MILAN &zone_defns[ 37] #define UTZ_MOSCOW &zone_defns[ 41] #define UTZ_MUMBAI &zone_defns[ 24] #define UTZ_MUNICH &zone_defns[ 37] #define UTZ_NAGOYA &zone_defns[ 29] #define UTZ_NAIROBI &zone_defns[ 3] #define UTZ_NANCHANG &zone_defns[ 27] #define UTZ_NANJING &zone_defns[ 27] #define UTZ_NEW_YORK &zone_defns[ 12] #define UTZ_OSAKA &zone_defns[ 29] #define UTZ_PERTH &zone_defns[ 35] #define UTZ_PHILADELPHIA &zone_defns[ 12] #define UTZ_PHOENIX &zone_defns[ 13] #define UTZ_PUNE &zone_defns[ 24] #define UTZ_QINGDAO &zone_defns[ 27] #define UTZ_RANGOON &zone_defns[ 30] #define UTZ_REGINA &zone_defns[ 14] #define UTZ_RHINERUHR &zone_defns[ 37] #define UTZ_RIO_DE_JANEIRO &zone_defns[ 16] #define UTZ_ROME &zone_defns[ 37] #define UTZ_SAN_FRANCISCO &zone_defns[ 9] #define UTZ_SANTIAGO &zone_defns[ 15] #define UTZ_SAO_PAULO &zone_defns[ 16] #define UTZ_SARAJEVO &zone_defns[ 37] #define UTZ_SEOUL &zone_defns[ 26] #define UTZ_SHANGHAI &zone_defns[ 27] #define UTZ_SHENYANG &zone_defns[ 27] #define UTZ_SHENZHEN &zone_defns[ 27] #define UTZ_ST_JOHNS &zone_defns[ 17] #define UTZ_STUTTGART &zone_defns[ 37] #define UTZ_SURAT &zone_defns[ 24] #define UTZ_SYDNEY &zone_defns[ 36] #define UTZ_TAIPEI &zone_defns[ 27] #define UTZ_TEHRAN &zone_defns[ 28] #define UTZ_TIANJIN &zone_defns[ 27] #define UTZ_TIJUANA &zone_defns[ 9] #define UTZ_TOKYO &zone_defns[ 29] #define UTZ_WASHINGTON_DC &zone_defns[ 12] #define UTZ_WENZHOU &zone_defns[ 27] #define UTZ_WUHAN &zone_defns[ 27] #define UTZ_XIAN &zone_defns[ 27] #define UTZ_ZHENGZHOU &zone_defns[ 27] #define NUM_ZONE_NAMES 100 #define MAX_ZONE_NAME_LEN 17 const unsigned char zone_names[961]; #endif /* _ZONES_H */
45.130435
48
0.611753
b26d868e856d16acec6687d723cfe9545294cae2
2,073
h
C
include/vcml/common/thctl.h
nbosb/vcml
5b946a32b024cbba8da6928971ffc2a4f9b712f1
[ "Apache-2.0" ]
36
2018-01-29T12:20:37.000Z
2022-03-29T06:14:59.000Z
include/vcml/common/thctl.h
nbosb/vcml
5b946a32b024cbba8da6928971ffc2a4f9b712f1
[ "Apache-2.0" ]
9
2018-12-04T10:37:14.000Z
2021-11-16T16:57:29.000Z
include/vcml/common/thctl.h
nbosb/vcml
5b946a32b024cbba8da6928971ffc2a4f9b712f1
[ "Apache-2.0" ]
18
2018-10-14T11:30:43.000Z
2022-01-08T07:12:56.000Z
/****************************************************************************** * * * Copyright 2018 Jan Henrik Weinstock * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * ******************************************************************************/ #ifndef VCML_THCTL_H #define VCML_THCTL_H #include "vcml/common/types.h" #include "vcml/common/systemc.h" namespace vcml { bool thctl_is_sysc_thread(); bool thctl_is_in_critical(); void thctl_enter_critical(); void thctl_exit_critical(); void thctl_suspend(); class thctl_guard { private: bool m_locking; public: thctl_guard(); ~thctl_guard(); }; inline thctl_guard::thctl_guard(): m_locking(!thctl_is_sysc_thread() && !thctl_is_in_critical()) { if (m_locking) thctl_enter_critical(); } inline thctl_guard::~thctl_guard() { if (m_locking) thctl_exit_critical(); } } #endif
35.741379
80
0.429812
589fccae0e306ced494703c29b665b5fc1d51e13
32,026
h
C
include/nostd/string_view.h
atframework/atframe_utils
070eb63570e8094eeb4d03bf9761fd0311eb1ef3
[ "MIT" ]
55
2016-07-27T10:35:57.000Z
2022-03-27T13:46:26.000Z
include/nostd/string_view.h
atframework/atframe_utils
070eb63570e8094eeb4d03bf9761fd0311eb1ef3
[ "MIT" ]
19
2021-05-29T07:30:04.000Z
2022-03-25T15:13:15.000Z
include/nostd/string_view.h
atframework/atframe_utils
070eb63570e8094eeb4d03bf9761fd0311eb1ef3
[ "MIT" ]
18
2016-07-27T11:39:20.000Z
2021-08-17T06:33:44.000Z
// Copyright 2021 atframework // Created by owent on 2021-07-22 #pragma once #include <algorithm> #include <cassert> #include <cstddef> #include <cstring> #include <ios> #include <iosfwd> #include <iterator> #include <limits> #include <string> #ifdef __cpp_impl_three_way_comparison # include <compare> #endif #include "config/atframe_utils_build_feature.h" #if defined(LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW) && LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW # include <string_view> #endif #ifdef max # undef max #endif #if (defined(__GNUC__) && !defined(__clang__)) # define UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP __builtin_memcmp #elif defined(__clang__) # if __has_builtin(__builtin_memcmp) # define UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP __builtin_memcmp # endif #endif #if !defined(UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP) # define UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP memcmp #endif #if defined(__cplusplus) && __cplusplus >= 201402L # define UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR constexpr #elif defined(_MSVC_LANG) && _MSVC_LANG >= 201402L # define UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR constexpr #else # define UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR #endif namespace util { namespace nostd { template <class CharT, class Traits = std::char_traits<CharT> > class LIBATFRAME_UTILS_API_HEAD_ONLY basic_string_view { public: using traits_type = Traits; using value_type = CharT; using pointer = CharT*; using const_pointer = const CharT*; using reference = CharT&; using const_reference = const CharT&; using const_iterator = const CharT*; using iterator = const_iterator; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using reverse_iterator = const_reverse_iterator; using size_type = size_t; using difference_type = std::ptrdiff_t; static constexpr const size_type npos = std::basic_string<CharT, Traits>::npos; public: // Null `basic_string_view` constructor constexpr basic_string_view() noexcept : ptr_(nullptr), length_(0) {} template <typename Allocator> basic_string_view( // NOLINT(runtime/explicit) const std::basic_string<CharT, Traits, Allocator>& str) noexcept // This is implemented in terms of `basic_string_view(p, n)` so `str.size()` // doesn't need to be reevaluated after `ptr_` is set. : basic_string_view(str.data(), str.size()) {} // Implicit constructor of a `basic_string_view` from NUL-terminated `str`. When // accepting possibly null strings. constexpr basic_string_view(const_pointer str) // NOLINT(runtime/explicit) : ptr_(str), length_(str ? _strlen_internal(str) : 0) {} // Implicit constructor of a `basic_string_view` from a `const_pointer` and length. constexpr basic_string_view(const_pointer data, size_type len) : ptr_(data), length_(len) {} // Just like std::basic_string_view in C++20, but it's more simple template <class It, class End, typename std::enable_if<!std::is_convertible<End, std::size_t>::value && std::is_same<CharT, typename std::iterator_traits<It>::value_type>::value, bool>::type = true> constexpr basic_string_view(It first, End last) : ptr_(first), length_(last - first) {} // Just like std::basic_string_view in C++23 constexpr basic_string_view(std::nullptr_t) = delete; #if defined(LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW) && LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW constexpr basic_string_view( // NOLINT(runtime/explicit) const std::basic_string_view<CharT, Traits>& stl_string_view) noexcept // This is implemented in terms of `basic_string_view(p, n)` so `str.size()` // doesn't need to be reevaluated after `ptr_` is set. : basic_string_view(stl_string_view.data(), stl_string_view.size()) {} #endif // NOTE: Harmlessly omitted to work around gdb bug. // constexpr basic_string_view(const basic_string_view&) noexcept = default; // basic_string_view& operator=(const basic_string_view&) noexcept = default; // Iterators // basic_string_view::begin() // // Returns an iterator pointing to the first character at the beginning of the // `basic_string_view`, or `end()` if the `basic_string_view` is empty. constexpr const_iterator begin() const noexcept { return ptr_; } // basic_string_view::end() // // Returns an iterator pointing just beyond the last character at the end of // the `basic_string_view`. This iterator acts as a placeholder; attempting to // access it results in undefined behavior. constexpr const_iterator end() const noexcept { return ptr_ + length_; } // basic_string_view::cbegin() // // Returns a const iterator pointing to the first character at the beginning // of the `basic_string_view`, or `end()` if the `basic_string_view` is empty. constexpr const_iterator cbegin() const noexcept { return begin(); } // basic_string_view::cend() // // Returns a const iterator pointing just beyond the last character at the end // of the `basic_string_view`. This pointer acts as a placeholder; attempting to // access its element results in undefined behavior. constexpr const_iterator cend() const noexcept { return end(); } // basic_string_view::rbegin() // // Returns a reverse iterator pointing to the last character at the end of the // `basic_string_view`, or `rend()` if the `basic_string_view` is empty. const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } // basic_string_view::rend() // // Returns a reverse iterator pointing just before the first character at the // beginning of the `basic_string_view`. This pointer acts as a placeholder; // attempting to access its element results in undefined behavior. const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } // basic_string_view::crbegin() // // Returns a const reverse iterator pointing to the last character at the end // of the `basic_string_view`, or `crend()` if the `basic_string_view` is empty. const_reverse_iterator crbegin() const noexcept { return rbegin(); } // basic_string_view::crend() // // Returns a const reverse iterator pointing just before the first character // at the beginning of the `basic_string_view`. This pointer acts as a placeholder; // attempting to access its element results in undefined behavior. const_reverse_iterator crend() const noexcept { return rend(); } // Capacity Utilities // basic_string_view::size() // // Returns the number of characters in the `basic_string_view`. constexpr size_type size() const noexcept { return length_; } // basic_string_view::length() // // Returns the number of characters in the `basic_string_view`. Alias for `size()`. constexpr size_type length() const noexcept { return size(); } // basic_string_view::max_size() // // Returns the maximum number of characters the `basic_string_view` can hold. constexpr size_type max_size() const noexcept { return kMaxSize; } // basic_string_view::empty() // // Checks if the `basic_string_view` is empty (refers to no characters). constexpr bool empty() const noexcept { return length_ == 0; } // basic_string_view::operator[] // // Returns the ith element of the `basic_string_view` using the array operator. // Note that this operator does not perform any bounds checking. constexpr const_reference operator[](size_type i) const { return ptr_[i]; } // basic_string_view::at() // // Returns the ith element of the `basic_string_view`. Bounds checking is performed, // and an exception of type `std::out_of_range` will be thrown on invalid // access. constexpr const_reference at(size_type i) const { return ptr_[i]; } // basic_string_view::front() // // Returns the first element of a `basic_string_view`. constexpr const_reference front() const { return ptr_[0]; } // basic_string_view::back() // // Returns the last element of a `basic_string_view`. constexpr const_reference back() const { return ptr_[size() - 1]; } // basic_string_view::data() // // Returns a pointer to the underlying character array (which is of course // stored elsewhere). Note that `basic_string_view::data()` may contain embedded nul // characters, but the returned buffer may or may not be NUL-terminated; // therefore, do not pass `data()` to a routine that expects a NUL-terminated // string. constexpr const_pointer data() const noexcept { return ptr_; } // Modifiers // basic_string_view::remove_prefix() // // Removes the first `n` characters from the `basic_string_view`. Note that the // underlying string is not changed, only the view. UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR void remove_prefix(size_type n) { if (n <= length_) { ptr_ += n; length_ -= n; } else { ptr_ += length_; length_ = 0; } } // basic_string_view::remove_suffix() // // Removes the last `n` characters from the `basic_string_view`. Note that the // underlying string is not changed, only the view. UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR void remove_suffix(size_type n) { if (n <= length_) { length_ -= n; } else { length_ = 0; } } // basic_string_view::swap() // // Swaps this `basic_string_view` with another `basic_string_view`. UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR void swap(basic_string_view& s) noexcept { auto t = *this; *this = s; s = t; } // Converts to `std::basic_string`. template <typename A> explicit operator std::basic_string<value_type, traits_type, A>() const { if (!data()) return {}; return std::basic_string<value_type, traits_type, A>(data(), size()); } #if defined(LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW) && LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW explicit operator std::basic_string_view<CharT, Traits>() const { if (!data()) return {}; return std::basic_string_view<CharT, Traits>(data(), size()); } #endif // basic_string_view::copy() // // Copies the contents of the `basic_string_view` at offset `pos` and length `n` // into `buf`. size_type copy(value_type* buf, size_type n, size_type pos = 0) const { if (pos > length_) { return 0; } size_type rlen = Min(length_ - pos, n); if (rlen > 0) { const CharT* start = ptr_ + pos; traits_type::copy(buf, start, rlen); } return rlen; } // basic_string_view::substr() // // Returns a "substring" of the `basic_string_view` (at offset `pos` and length // `n`) as another basic_string_view. This function throws `std::out_of_bounds` if // `pos > size`. constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const { return pos > length_ ? basic_string_view() : basic_string_view(ptr_ + pos, Min(n, length_ - pos)); } // basic_string_view::compare() // // Performs a lexicographical comparison between this `basic_string_view` and // another `basic_string_view` `x`, returning a negative value if `*this` is less // than `x`, 0 if `*this` is equal to `x`, and a positive value if `*this` // is greater than `x`. constexpr int compare(basic_string_view x) const noexcept { return _compare_impl(length_, x.length_, Min(length_, x.length_) == 0 ? 0 : UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP(ptr_, x.ptr_, Min(length_, x.length_))); } // Overload of `basic_string_view::compare()` for comparing a substring of the // 'basic_string_view` and another `basic_string_view`. constexpr int compare(size_type pos1, size_type count1, basic_string_view v) const { return substr(pos1, count1).compare(v); } // Overload of `basic_string_view::compare()` for comparing a substring of the // `basic_string_view` and a substring of another `Basic_string_view`. constexpr int compare(size_type pos1, size_type count1, basic_string_view v, size_type pos2, size_type count2) const { return substr(pos1, count1).compare(v.substr(pos2, count2)); } // Overload of `basic_string_view::compare()` for comparing a `basic_string_view` and a // a different C-style string `s`. constexpr int compare(const CharT* s) const { return compare(basic_string_view(s)); } // Overload of `basic_string_view::compare()` for comparing a substring of the // `basic_string_view` and a different string C-style string `s`. constexpr int compare(size_type pos1, size_type count1, const CharT* s) const { return substr(pos1, count1).compare(basic_string_view(s)); } // Overload of `basic_string_view::compare()` for comparing a substring of the // `basic_string_view` and a substring of a different C-style string `s`. constexpr int compare(size_type pos1, size_type count1, const CharT* s, size_type count2) const { return substr(pos1, count1).compare(basic_string_view(s, count2)); } // Find Utilities // basic_string_view::find() // // Finds the first occurrence of the substring `s` within the `basic_string_view`, // returning the position of the first character's match, or `npos` if no // match was found. size_type find(basic_string_view s, size_type pos = 0) const noexcept { if (empty() || pos > length_) { if (empty() && pos == 0 && s.empty()) return 0; return npos; } const CharT* result = reinterpret_cast<const CharT*>( _memmatch(reinterpret_cast<const unsigned char*>(ptr_ + pos), (length_ - pos) * sizeof(CharT), reinterpret_cast<const unsigned char*>(s.ptr_), s.length_ * sizeof(CharT))); return result ? result - ptr_ : npos; } // Overload of `basic_string_view::find()` for finding the given character `c` // within the `basic_string_view`. size_type find(CharT c, size_type pos = 0) const noexcept { if (empty() || pos >= length_) { return npos; } auto result = std::find(ptr_ + pos, ptr_ + length_, c); if (result == ptr_ + length_) { return npos; } return result - ptr_; } // Overload of `basic_string_view::find()` for finding a substring of a different // C-style string `s` within the `basic_string_view`. size_type find(const CharT* s, size_type pos, size_type count) const { return find(basic_string_view(s, count), pos); } // Overload of `basic_string_view::find()` for finding a different C-style string // `s` within the `basic_string_view`. size_type find(const CharT* s, size_type pos = 0) const { return find(basic_string_view(s), pos); } // basic_string_view::rfind() // // Finds the last occurrence of a substring `s` within the `basic_string_view`, // returning the position of the first character's match, or `npos` if no // match was found. size_type rfind(basic_string_view s, size_type pos = npos) const noexcept { if (length_ < s.length_) return npos; if (s.empty()) return Min(length_, pos); const CharT* last = ptr_ + Min(length_ - s.length_, pos) + s.length_; const CharT* result = std::find_end(ptr_, last, s.ptr_, s.ptr_ + s.length_); return result != last ? result - ptr_ : npos; } // Overload of `basic_string_view::rfind()` for finding the last given character `c` // within the `basic_string_view`. size_type rfind(CharT c, size_type pos = npos) const noexcept { if (empty()) return npos; for (size_type i = Min(pos, length_ - 1);; --i) { if (ptr_[i] == c) { return i; } if (i == 0) break; } return npos; } // Overload of `basic_string_view::rfind()` for finding a substring of a different // C-style string `s` within the `basic_string_view`. size_type rfind(const CharT* s, size_type pos, size_type count) const { return rfind(basic_string_view(s, count), pos); } // Overload of `basic_string_view::rfind()` for finding a different C-style string // `s` within the `basic_string_view`. size_type rfind(const CharT* s, size_type pos = npos) const { return rfind(basic_string_view(s), pos); } private: static constexpr size_type kMaxSize = (std::numeric_limits<difference_type>::max)(); static constexpr size_type _strlen_internal(const CharT* str) { #if defined(_MSC_VER) && _MSC_VER >= 1910 && !defined(__clang__) // MSVC 2017+ can evaluate this at compile-time. const CharT* begin = str; while (*str != '\0') ++str; return str - begin; #elif (defined(__GNUC__) && !defined(__clang__)) // GCC has __builtin_strlen according to // https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Other-Builtins.html return __builtin_strlen(str); #elif defined(__clang__) # if __has_builtin(__builtin_strlen) return __builtin_strlen(str); # else return str ? strlen(str) : 0; # endif #else return str ? strlen(str) : 0; #endif } static constexpr size_t Min(size_type length_a, size_type length_b) { return length_a < length_b ? length_a : length_b; } static constexpr int _compare_impl(size_type length_a, size_type length_b, int compare_result) { return compare_result == 0 ? static_cast<int>(length_a > length_b) - static_cast<int>(length_a < length_b) : (compare_result < 0 ? -1 : 1); } static const unsigned char* _memmatch(const unsigned char* phaystack, size_t haylen, const unsigned char* pneedle, size_t neelen) { if (0 == neelen) { return phaystack; // even if haylen is 0 } if (haylen < neelen) return nullptr; const unsigned char* match; const unsigned char* hayend = phaystack + haylen - neelen + 1; // A static cast is used here to work around the fact that memchr returns // a void* on Posix-compliant systems and const void* on Windows. do { match = static_cast<const unsigned char*>(memchr(phaystack, pneedle[0], hayend - phaystack)); if (nullptr == match) { break; } if (UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP(match, pneedle, neelen) == 0) return match; else phaystack = match + 1; } while (true); return nullptr; } private: const_pointer ptr_; size_type length_; }; #if !((defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)) template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr const typename basic_string_view<CharT, Traits>::size_type basic_string_view<CharT, Traits>::npos; #endif #if ((defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) # if defined(_MSC_VER) && _MSC_VER < 1920 # define UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE 0 # else # define UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE 1 # endif #else # define UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE 0 #endif #if defined(_MSC_VER) # if ((defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) // _HAS_CXX20 # define UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT 0 # else # define UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT 1 # endif #else # define UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT 1 #endif #if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator==(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { return x.size() == y.size() && (x.empty() || UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP(x.data(), y.data(), x.size()) == 0); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator==( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { return x.size() == y.size() && (x.empty() || UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP(x.data(), y.data(), x.size()) == 0); } # endif #endif #if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 #else template <class CharT, class Traits> #endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator==( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { return x.size() == y.size() && (x.empty() || UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP(x.data(), y.data(), x.size()) == 0); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator==(std::nullptr_t, basic_string_view<CharT, Traits> y) noexcept { return y.empty(); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator==(basic_string_view<CharT, Traits> x, std::nullptr_t) noexcept { return x.empty(); } #ifdef __cpp_impl_three_way_comparison # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr std::strong_ordering operator<=>(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { auto result = x.compare(y); return result < 0 ? std::strong_ordering::less : (result > 0 ? std::strong_ordering::greater : std::strong_ordering::equal); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr std::strong_ordering operator<=>( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { auto result = x.compare(y); return result < 0 ? std::strong_ordering::less : (result > 0 ? std::strong_ordering::greater : std::strong_ordering::equal); } # endif # endif # if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr std::strong_ordering operator<=>( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { auto result = x.compare(y); return result < 0 ? std::strong_ordering::less : (result > 0 ? std::strong_ordering::greater : std::strong_ordering::equal); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr std::strong_ordering operator<=>(std::nullptr_t, basic_string_view<CharT, Traits> y) noexcept { return basic_string_view<CharT, Traits>() <=> y; } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr std::strong_ordering operator<=>(basic_string_view<CharT, Traits> x, std::nullptr_t) noexcept { return x <=> basic_string_view<CharT, Traits>(); } #else # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator!=(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { return !(x == y); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator!=( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { return !(x == y); } # endif # endif # if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator!=( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { return !(x == y); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator!=(basic_string_view<CharT, Traits> x, std::nullptr_t) noexcept { return !(x == basic_string_view<CharT, Traits>()); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator!=(std::nullptr_t, basic_string_view<CharT, Traits> y) noexcept { return !(basic_string_view<CharT, Traits>() == y); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { return x.compare(y) < 0; } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { return x.compare(y) < 0; } # endif # endif # if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { return x.compare(y) < 0; } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<(std::nullptr_t, basic_string_view<CharT, Traits> y) noexcept { return basic_string_view<CharT, Traits>().compare(y) < 0; } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<(basic_string_view<CharT, Traits> x, std::nullptr_t) noexcept { return x.compare(basic_string_view<CharT, Traits>()) < 0; } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { return y < x; } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { return y < x; } # endif # endif # if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { return y < x; } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>(std::nullptr_t x, basic_string_view<CharT, Traits> y) noexcept { return y < x; } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>(basic_string_view<CharT, Traits> x, std::nullptr_t y) noexcept { return y < x; } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<=(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { return !(y < x); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<=( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { return !(y < x); } # endif # endif # if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<=( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { return !(y < x); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<=(std::nullptr_t x, basic_string_view<CharT, Traits> y) noexcept { return !(y < x); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator<=(basic_string_view<CharT, Traits> x, std::nullptr_t y) noexcept { return !(y < x); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>=(basic_string_view<CharT, Traits> x, basic_string_view<CharT, Traits> y) noexcept { return !(x < y); } # if UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT # if defined(_MSC_VER) template <class CharT, class Traits, int = 1> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>=( typename std::common_type<basic_string_view<CharT, Traits> >::type x, basic_string_view<CharT, Traits> y) noexcept { return !(x < y); } # endif # endif # if defined(_MSC_VER) template <class CharT, class Traits, int = 2> // TRANSITION, VSO-409326 # else template <class CharT, class Traits> # endif LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>=( basic_string_view<CharT, Traits> x, typename std::common_type<basic_string_view<CharT, Traits> >::type y) noexcept { return !(x < y); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>=(std::nullptr_t x, basic_string_view<CharT, Traits> y) noexcept { return !(x < y); } template <class CharT, class Traits> LIBATFRAME_UTILS_API_HEAD_ONLY constexpr bool operator>=(basic_string_view<CharT, Traits> x, std::nullptr_t y) noexcept { return !(x < y); } #endif // IO Insertion Operator template <class CharT, class Traits = std::char_traits<CharT> > LIBATFRAME_UTILS_API_HEAD_ONLY std::basic_ostream<CharT, Traits>& operator<<( std::basic_ostream<CharT, Traits>& os, basic_string_view<CharT, Traits> const& spn) { typename std::basic_ostream<CharT, Traits>::sentry sentry(os); if (!os) return os; const std::streamsize length = static_cast<std::streamsize>(spn.size()); // Write span characters os.rdbuf()->sputn(spn.begin(), length); return os; } // Alias using string_view = basic_string_view<char>; using wstring_view = basic_string_view<wchar_t>; } // namespace nostd } // namespace util #undef UTIL_NOSTD_STRING_VIEW_CXX14_CONSTEXPR #undef UTIL_NOSTD_INTERNAL_STRING_VIEW_MEMCMP #undef UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE #undef UTIL_NOSTD_INTERNAL_STRING_VIEW_USE_COMMON_TYPE_TRANSITION_LEFT
38.678744
120
0.703928
d79391b436f42e9664f58c1cd54abca3b61db92a
7,949
h
C
Atomic/AtWebRequestHandler.h
denisbider/Atomic
8e8e979a6ef24d217a77f17fa81a4129f3506952
[ "MIT" ]
4
2019-11-10T21:56:40.000Z
2021-12-11T20:10:55.000Z
Atomic/AtWebRequestHandler.h
denisbider/Atomic
8e8e979a6ef24d217a77f17fa81a4129f3506952
[ "MIT" ]
null
null
null
Atomic/AtWebRequestHandler.h
denisbider/Atomic
8e8e979a6ef24d217a77f17fa81a4129f3506952
[ "MIT" ]
1
2019-11-11T08:38:59.000Z
2019-11-11T08:38:59.000Z
#pragma once #include "AtCrypt.h" #include "AtEntityStore.h" #include "AtException.h" #include "AtHttpRequest.h" #include "AtPinStore.h" #include "AtRp.h" #include "AtStr.h" #include "AtVec.h" namespace At { enum class ReqResult { Invalid, Done, Continue, BadRequest = HttpStatus::BadRequest, Unauthorized = HttpStatus::Unauthorized, Forbidden = HttpStatus::Forbidden, NotFound = HttpStatus::NotFound, MethodNotAllowed = HttpStatus::MethodNotAllowed, TooManyRequests = HttpStatus::TooManyRequests, }; inline bool ReqResult_IsStatus(ReqResult v) { return ((int) v) >= 100; } inline HttpStatus::E ReqResult_GetStatus(ReqResult v) { return (HttpStatus::E) v; } class WebRequestHandler : public RefCountable { private: static SymCrypt s_symCrypt; public: // Initializes s_symCrypt static object. // Must be called after the application has initialized At::Crypt. static void StaticInit(); WebRequestHandler(); virtual ~WebRequestHandler(); bool m_abortTxOnSuccess {}; HTTP_RESPONSE m_response; PinStore m_pinStore; Vec<HANDLE> m_responseHandles; Vec<HTTP_DATA_CHUNK> m_responseBodyChunks; Vec<HTTP_UNKNOWN_HEADER> m_responseUnknownHeaders; void SetAbortTxOnSuccess() { m_abortTxOnSuccess = true; } bool AbortTxOnSuccess() const { return m_abortTxOnSuccess; } Seq AddResponseStr (Seq s) { return m_pinStore.AddStr(s); } void AddResponseHandle (HANDLE h) { m_responseHandles.Add(h); } void AddResponseBodyChunk (Seq s) { Seq added = AddResponseStr(s); AddResponseBodyChunk_NoCopy(added); } void AddResponseBodyChunk_NoCopy (Seq s); // DO NOT CLOSE file handle after adding it. It will be closed when WebRequestHandler is destroyed. void AddResponseBodyChunk(HANDLE hFile, uint64 startingOffset = 0, uint64 length = HTTP_BYTE_RANGE_TO_EOF); // The result of AddCfmCookie is a confirmation cookie token, and should be used as value of a "&cfm=" parameter in a URL. // CheckCfmCookie returns true if a valid confirmation cookie is found corresponding to a "&cfm=" query parameter. // If CheckCfmCookie returns true, it will initialize CfmNvp in HttpRequest. enum { MaxCfmCookieAgeSeconds = 300, MaxCfmContextBytes = 1000, MaxCfmPairs = 100, MaxCfmNameBytes = 100, MaxCfmValueBytes = 1000 }; Str AddCfmCookie(HttpRequest& req) { return AddCfmCookie(req, InsensitiveNameValuePairs()); } Str AddCfmCookie(HttpRequest& req, Seq name, Seq value); Str AddCfmCookie(HttpRequest& req, Seq name1, Seq value1, Seq name2, Seq value2); Str AddCfmCookie(HttpRequest& req, Seq name1, Seq value1, Seq name2, Seq value2, Seq name3, Seq value3); Str AddCfmCookie(HttpRequest& req, InsensitiveNameValuePairsBase const& nvp) { return AddCfmCookieWithContext(req, typeid(*this).name(), nvp); } template <class DerivedWrh> Str AddCfmCookieFor(HttpRequest& req, InsensitiveNameValuePairsBase const& nvp) { return AddCfmCookieWithContext(req, typeid(DerivedWrh).name(), nvp); } Str AddCfmCookieWithContext(HttpRequest& req, Seq context, InsensitiveNameValuePairsBase const& nvp); bool CheckCfmCookie(HttpRequest& req); void AddSessionCookie (HttpRequest& req, Seq n, Seq v, Seq d, Seq p) { AddCookie(n, v, d, p, req.GetCookieSecure_Strict(), req.GetCookieHttpOnly(), 0 ); } void AddSavedCookie (HttpRequest& req, Seq n, Seq v, Seq d, Seq p, int expSecs) { AddCookie(n, v, d, p, req.GetCookieSecure_Strict(), req.GetCookieHttpOnly(), expSecs ); } void AddEncryptedSessionCookie (HttpRequest& req, Seq n, Seq v, Seq d, Seq p) { AddEncryptedCookie(n, v, d, p, req.GetCookieSecure_Strict(), req.GetCookieHttpOnly(), 0 ); } void AddEncryptedSavedCookie (HttpRequest& req, Seq n, Seq v, Seq d, Seq p, int expSecs) { AddEncryptedCookie(n, v, d, p, req.GetCookieSecure_Strict(), req.GetCookieHttpOnly(), expSecs ); } bool DecryptCookie(Seq encoded, Enc& value); // Decrypt a cookie value set with AddEncrypted***Cookie void RemoveCookie(Seq name, Seq domain, Seq path) { AddCookie(name, "", domain, path, CookieSecure::Yes, CookieHttpOnly::Yes, -1); AddCookie(name, "", domain, path, CookieSecure::No, CookieHttpOnly::Yes, -1); AddCookie(name, "", domain, path, CookieSecure::Yes, CookieHttpOnly::No, -1); AddCookie(name, "", domain, path, CookieSecure::No, CookieHttpOnly::No, -1); } void SetResponseStatus(uint statusCode) { m_response.StatusCode = (USHORT) statusCode; } void SetResponseContentType(Seq s); void SetRedirectResponse (uint statusCode, Seq uri); void SetFileResponse (Seq fullPath, Seq contentType); public: // Should process the HTTP request. Can optionally generate the response to send in m_response, and return ReqResult::Done. // If no response is generated, method should return ReqResult::Continue, and then GenResponse will be called outside of transaction. // Any strings that are referenced from within m_response must be added to m_pinStore. // This method is called from within a datastore transaction created by the request handling thread. // If the method completes successfully, the request handling thread will attempt to commit the transaction. // If the transaction was committed, the request handling thread will either: // - if return result is ReqResult::Done, send the generated response // - if return result is ReqResult::Continue, call GenResponse() to generate the response, and then send it // If the commit attempt failed with the RetryTransaction exception, the Process() method will be called again. // If the method causes any side effects outside of the datastore, it MUST be resilient to being called again. // If the method throws an exception deriving from std::exception, an "internal server error" response will be sent. virtual ReqResult Process(EntityStore& store, HttpRequest& req) = 0; // Called if Process() returned with ReqResult::Continue. Called outside of datastore transaction. virtual void GenResponse(HttpRequest& req) = 0; private: void UpdateResponseEntityChunksPtr(); void AddCookie (Seq name, Seq value, Seq domain, Seq path, CookieSecure::E secure, CookieHttpOnly::E httpOnly, int expiresSeconds); void AddEncryptedCookie (Seq name, Seq value, Seq domain, Seq path, CookieSecure::E secure, CookieHttpOnly::E httpOnly, int expiresSeconds); void SetKnownResponseHeader (HTTP_HEADER_ID hdrId, Seq s); void SetUnknownResponseHeader (Seq name, Seq value); void SetResponseHeader_ContentType (Seq s) { SetKnownResponseHeader (HttpHeaderContentType, s); } void SetResponseHeader_Location (Seq s) { SetKnownResponseHeader (HttpHeaderLocation, s); } void SetResponseHeader_SetCookie (Seq s) { SetUnknownResponseHeader("Set-Cookie", s); } void SetResponseHeader_XContentTypeOptions (Seq s) { SetUnknownResponseHeader("X-Content-Type-Options", s); } void SetResponseHeader_XFrameOptions (Seq s) { SetUnknownResponseHeader("X-Frame-Options", s); } public: void SetResponseHeader_ContentDisposition (Seq s) { SetUnknownResponseHeader("Content-Disposition", s); } void SetResponseHeader_ContentSecurityPolicy (Seq s) { SetUnknownResponseHeader("Content-Security-Policy", s); } void SetResponseHeader_Refresh (Seq s) { SetUnknownResponseHeader("Refresh", s); } void SetResponseHeader_StrictTransportSecurity (Seq s) { SetUnknownResponseHeader("Strict-Transport-Security", s); } void SetResponseHeader_CacheControl (Seq s) { SetKnownResponseHeader (HttpHeaderCacheControl, s); } }; }
55.587413
194
0.710655
ba7ba4d78dcbb8a5a68d6c51bcf56be924060c07
505
h
C
07_berkley/include/TimeSlave.h
klingerjonathan/klinger
90bceb64aabf1471d6a0c006067652e85659cf8c
[ "BSL-1.0" ]
null
null
null
07_berkley/include/TimeSlave.h
klingerjonathan/klinger
90bceb64aabf1471d6a0c006067652e85659cf8c
[ "BSL-1.0" ]
null
null
null
07_berkley/include/TimeSlave.h
klingerjonathan/klinger
90bceb64aabf1471d6a0c006067652e85659cf8c
[ "BSL-1.0" ]
null
null
null
/* * auth: Jonathan Klinger * file: TimeSlave.h * date: 12/20 * desc: Exercise 10 - berkely */ #pragma once #include <string> using namespace std; #include "channel.h" #include "clock.h" class TimeSlave { private: Clock clock; string name; Channel channel; public: TimeSlave(std::string name, int hours, int minutes, int seconds) : clock(name + "_name", hours, minutes, seconds) { this->name = name; }; Channel *get_channel() { return &channel; } void operator()(); };
15.78125
66
0.651485
c958fa0a925b3469392ef9b5af6a8e2841627955
8,595
c
C
html-node.c
michaelrsweet/htmlcss
5bff8a19b25be594bc5fbf40949e241c63b59674
[ "Apache-2.0" ]
37
2019-01-25T16:17:51.000Z
2021-12-11T13:53:06.000Z
html-node.c
michaelrsweet/htmlcss
5bff8a19b25be594bc5fbf40949e241c63b59674
[ "Apache-2.0" ]
9
2018-12-08T13:35:04.000Z
2021-12-11T23:54:44.000Z
html-node.c
michaelrsweet/htmlcss
5bff8a19b25be594bc5fbf40949e241c63b59674
[ "Apache-2.0" ]
6
2020-03-27T08:30:46.000Z
2022-03-10T09:39:07.000Z
/* * HTML node functions for HTMLCSS library. * * https://github.com/michaelrsweet/htmlcss * * Copyright © 2018 by Michael R Sweet. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. */ /* * Include necessary headers... */ #include "html-private.h" /* * Local functions... */ static void html_delete(hc_node_t *node); static hc_node_t *html_new(hc_node_t *parent, hc_element_t element, const char *s); static void html_remove(hc_node_t *node); /* * 'hcNodeDelete()' - Delete a HTML node from a document. */ void hcNodeDelete(hc_html_t *html, /* I - HTML document */ hc_node_t *node) /* I - HTML node */ { hc_node_t *current, /* Current node */ *next; /* Next node */ if (!html || !node) return; if (node == html->root) html->root = NULL; html_remove(node); for (current = node->value.element.first_child; current; current = next) { /* * Get the next node... */ if ((next = hcNodeGetFirstChildNode(current)) != NULL) { /* * Free parent nodes after child nodes have been freed... */ current->value.element.first_child = NULL; continue; } if ((next = current->next_sibling) == NULL) { /* * Next node is the parent, which we'll free as needed... */ if ((next = current->parent) == node) next = NULL; } /* * Free child... */ html_delete(current); } /* * Then free the memory used by the parent node... */ html_delete(node); } /* * 'hcNodeGetComment()' - Get a HTML node's comment value, if any. */ const char * /* O - Comment value */ hcNodeGetComment(hc_node_t *node) /* I - HTML node */ { return (node && node->element == HC_ELEMENT_COMMENT ? node->value.comment : NULL); } /* * 'hcHTMLGetDOCTYPE()' - Get a HTML document's DOCTYPE value, if any. */ const char * /* O - DOCTYPE value */ hcHTMLGetDOCTYPE(hc_html_t *html) /* I - HTML document */ { return (html && html->root ? hcNodeAttrGetNameValue(html->root, "") : NULL); } /* * 'hcNodeGetElement()' - Get a HTML node's element/type. */ hc_element_t /* O - Node element/type */ hcNodeGetElement(hc_node_t *node) /* I - HTML node */ { return (node ? node->element : HC_ELEMENT_WILDCARD); } /* * 'hcNodeGetFirstChildNode()' - Get a HTML node's first child node, if any. */ hc_node_t * /* O - First child node or `NULL` if none */ hcNodeGetFirstChildNode(hc_node_t *node)/* I - HTML node */ { return (node && node->element >= HC_ELEMENT_DOCTYPE ? node->value.element.first_child : NULL); } /* * 'hcNodeGetLastChildNode()' - Get a HTML node's last child node, if any. */ hc_node_t * /* O - Last child node or `NULL` if none */ hcNodeGetLastChildNode(hc_node_t *node) /* I - HTML node */ { return (node && node->element >= HC_ELEMENT_DOCTYPE ? node->value.element.last_child : NULL); } /* * 'hcNodeGetNextSiblingNode()' - Get a HTML node's next sibling node, if any. */ hc_node_t * /* O - Next sibling node or `NULL` if none */ hcNodeGetNextSiblingNode( hc_node_t *node) /* I - HTML node */ { return (node ? node->next_sibling : NULL); } /* * 'hcNodeGetParentNode()' - Get a HTML node's parent node, if any. */ hc_node_t * /* O - Parent node or `NULL` if none */ hcNodeGetParentNode(hc_node_t *node) /* I - HTML node */ { return (node ? node->parent : NULL); } /* * 'hcNodeGetPrevSiblingNode()' - Get a HTML node's previous sibling node, if any. */ hc_node_t * /* O - Previous sibling node or `NULL` if none */ hcNodeGetPrevSiblingNode( hc_node_t *node) /* I - HTML node */ { return (node ? node->prev_sibling : NULL); } /* * 'hcHTMLGetRootNode()' - Get the root node for a document. */ hc_node_t * /* O - Root node or `NULL` if none */ hcHTMLGetRootNode(hc_html_t *html) /* I - HTML document */ { return (html ? html->root : NULL); } /* * 'hcNodeGetString()' - Get a HTML node's string value, if any. */ const char * /* O - String value */ hcNodeGetString(hc_node_t *node) /* I - HTML node */ { return (node && node->element == HC_ELEMENT_STRING ? node->value.string : NULL); } /* * 'hcNodeNewComment()' - Create a new HTML comment node. */ hc_node_t * /* O - New HTML comment node */ hcNodeNewComment(hc_node_t *parent, /* I - Parent node */ const char *c) /* I - Comment value */ { if (!parent || !c) return (NULL); return (html_new(parent, HC_ELEMENT_COMMENT, c)); } /* * 'hcNodeNewElement()' - Create a new HTML element node. */ hc_node_t * /* O - New HTML element node */ hcNodeNewElement(hc_node_t *parent, /* I - Parent node */ hc_element_t element) /* I - HTML element */ { if (!parent || element <= HC_ELEMENT_DOCTYPE || element >= HC_ELEMENT_MAX) return (NULL); return (html_new(parent, element, NULL)); } /* * 'hcHTMLNewRootNode()' - Create a new root node. */ hc_node_t * /* O - New root node */ hcHTMLNewRootNode(hc_html_t *html, /* I - HTML document */ const char *doctype) /* I - DOCTYPE value */ { hc_node_t *node; /* New node */ if (!html || html->root || !doctype) return (NULL); if ((node = html_new(NULL, HC_ELEMENT_DOCTYPE, NULL)) != NULL) { html->root = node; node->value.element.html = html; hcNodeAttrSetNameValue(node, "", doctype); } return (node); } /* * 'hcNodeNewString()' - Create a new HTML string node. */ hc_node_t * /* O - New HTML string node */ hcNodeNewString(hc_node_t *parent, /* I - Parent node */ const char *s) /* I - String value */ { if (!parent || !s) return (NULL); return (html_new(parent, HC_ELEMENT_STRING, s)); } /* * '_hcNodeNewUnknown()' - Create a new unknown HTML element or processing * directive node. */ hc_node_t * /* O - New HTML unknown node */ _hcNodeNewUnknown(hc_node_t *parent, /* I - Parent node */ const char *unk) /* I - Unknown value (excluding "<>") */ { if (!parent || !unk) return (NULL); return (html_new(parent, HC_ELEMENT_UNKNOWN, unk)); } /* * 'html_delete()' - Free a HTML node. */ static void html_delete(hc_node_t *node) /* I - HTML node */ { if (node->element >= HC_ELEMENT_DOCTYPE) hcDictDelete(node->value.element.attrs); free(node); } /* * 'html_new()' - Create a new HTML node. */ static hc_node_t * /* O - New node or `NULL` on error */ html_new(hc_node_t *parent, /* I - Parent node or `NULL` if root node */ hc_element_t element, /* I - Element/node type */ const char *s) /* I - String, if any */ { hc_node_t *node; /* New node */ size_t nodesize; /* Node size */ size_t slen = s ? strlen(s) : 0; /* Length of string */ if (parent && parent->element < HC_ELEMENT_DOCTYPE) return (NULL); if (element < HC_ELEMENT_DOCTYPE) nodesize = sizeof(hc_node_t) - sizeof(node->value) + slen + 1; else nodesize = sizeof(hc_node_t); if ((node = (hc_node_t *)calloc(1, nodesize)) != NULL) { node->element = element; node->parent = parent; if (s && slen > 0) { if (element == HC_ELEMENT_STRING) memcpy(node->value.string, s, slen); else if (element == HC_ELEMENT_COMMENT) memcpy(node->value.comment, s, slen); else if (element == HC_ELEMENT_UNKNOWN) memcpy(node->value.unknown, s, slen); } if (parent) { if (element > HC_ELEMENT_DOCTYPE) node->value.element.html = parent->value.element.html; if (parent->value.element.last_child) { node->prev_sibling = parent->value.element.last_child; parent->value.element.last_child->next_sibling = node; parent->value.element.last_child = node; } else { parent->value.element.first_child = node; parent->value.element.last_child = node; } } } return (node); } /* * 'html_remove()' - Remove a HTML node from its parent. */ static void html_remove(hc_node_t *node) /* I - HTML node */ { if (node->parent) { if (node->prev_sibling) node->prev_sibling->next_sibling = node->next_sibling; else node->parent->value.element.first_child = node->next_sibling; if (node->next_sibling) node->next_sibling->prev_sibling = node->prev_sibling; else node->parent->value.element.last_child = node->prev_sibling; node->parent = NULL; node->prev_sibling = NULL; node->next_sibling = NULL; } }
22.209302
96
0.605701
b56a69d8668eaa2268b2e8ff0159237f022a5f9e
218
h
C
GKStatusBar/Test/GKViewController.h
QuintGao/GKStatusBar
7a46eae16ccf2314745a96cdc84956c063e2bd26
[ "MIT" ]
1
2017-07-03T09:12:41.000Z
2017-07-03T09:12:41.000Z
GKStatusBar/Test/GKViewController.h
QuintGao/GKStatusBar
7a46eae16ccf2314745a96cdc84956c063e2bd26
[ "MIT" ]
null
null
null
GKStatusBar/Test/GKViewController.h
QuintGao/GKStatusBar
7a46eae16ccf2314745a96cdc84956c063e2bd26
[ "MIT" ]
null
null
null
// // ViewController.h // GKStatusBar // // Created by 高坤 on 2017/3/9. // Copyright © 2017年 高坤. All rights reserved. // #import "GKBaseViewController.h" @interface GKViewController : GKBaseViewController @end
13.625
50
0.701835
416336d6ccff9cc3365da6ea24521c2b5adc2cd4
230
h
C
src/device.h
OllieDay/liborvibo
2d11d289c22d2e29ae2ccfb192750f791a233105
[ "BSD-3-Clause" ]
null
null
null
src/device.h
OllieDay/liborvibo
2d11d289c22d2e29ae2ccfb192750f791a233105
[ "BSD-3-Clause" ]
null
null
null
src/device.h
OllieDay/liborvibo
2d11d289c22d2e29ae2ccfb192750f791a233105
[ "BSD-3-Clause" ]
null
null
null
#ifndef ORVIBO_DEVICE_H #define ORVIBO_DEVICE_H #include <sys/types.h> #include <net/ethernet.h> #include <stdbool.h> #define ORVIBO_SOCKET_PORT 10000 bool is_orvibo_mac(const unsigned char mac[static ETHER_ADDR_LEN]); #endif
16.428571
62
0.795652
27f14e21159ff5b63cf0977b72dec0b8ad0da84e
293
c
C
mylib.c
chandangope/python-cpp
8654e19cb722e9f113e8d428c384fd859c56bf5b
[ "Apache-2.0" ]
2
2020-04-05T21:14:31.000Z
2020-08-29T14:10:24.000Z
mylib.c
chandangope/python-cpp
8654e19cb722e9f113e8d428c384fd859c56bf5b
[ "Apache-2.0" ]
null
null
null
mylib.c
chandangope/python-cpp
8654e19cb722e9f113e8d428c384fd859c56bf5b
[ "Apache-2.0" ]
null
null
null
#include "mylib.h" #include <math.h> int isPrime(int n) { for (int i=2; i<=sqrt(n); i++) { if(n%i == 0) return 0; } return 1; } int getPrimes(int* ints, int numInts, int* outInts) { for(int i=0; i<numInts; i++) { outInts[i] = isPrime(ints[i]); } return 0; }
11.72
51
0.532423
5f2e2277253d70e6a2548e5a93a0d0ed05ec8d60
804
c
C
pyhand/kinematics/pinky_prox_index_prox_bend_1.c
jsupancic/libhand-public
da9b92fa5440d06fdd4ba72c2327c50c88a1d469
[ "CC-BY-3.0" ]
19
2015-11-28T03:49:10.000Z
2021-04-12T13:19:26.000Z
pyhand/kinematics/pinky_prox_index_prox_bend_1.c
jsupancic/libhand-public
da9b92fa5440d06fdd4ba72c2327c50c88a1d469
[ "CC-BY-3.0" ]
4
2015-12-24T08:53:10.000Z
2017-11-08T10:58:16.000Z
pyhand/kinematics/pinky_prox_index_prox_bend_1.c
jsupancic/libhand-public
da9b92fa5440d06fdd4ba72c2327c50c88a1d469
[ "CC-BY-3.0" ]
7
2015-12-16T05:27:22.000Z
2020-08-24T07:59:29.000Z
/****************************************************************************** * Code generated with sympy 0.7.6 * * * * See http://www.sympy.org/ for more information. * * * * This file is part of 'project' * ******************************************************************************/ #include "pinky_prox_index_prox_bend_1.h" #include <math.h> double pinky_prox_index_prox_bend_1() { double pinky_prox_index_prox_bend_1_result; pinky_prox_index_prox_bend_1_result = 0; return pinky_prox_index_prox_bend_1_result; }
44.666667
80
0.353234
831e0884823a9f0df6ecc3f8e0f8b43abfa99705
313
h
C
src/ipc/tcp_serveripc.h
lburgey/oidc-agent
a827a2de863eb203696007b30b399e2e38fc3860
[ "MIT" ]
null
null
null
src/ipc/tcp_serveripc.h
lburgey/oidc-agent
a827a2de863eb203696007b30b399e2e38fc3860
[ "MIT" ]
null
null
null
src/ipc/tcp_serveripc.h
lburgey/oidc-agent
a827a2de863eb203696007b30b399e2e38fc3860
[ "MIT" ]
1
2021-05-14T12:39:36.000Z
2021-05-14T12:39:36.000Z
#ifndef IPC_TCP_SERVER_H #define IPC_TCP_SERVER_H #include "connection.h" #include "utils/oidc_error.h" #include <stdarg.h> #include <time.h> oidc_error_t ipc_tcp_server_init(struct connection* con, unsigned short port); int ipc_tcp_bindAndListen(struct connection* con); #endif // IPC_TCP_SERVER_H
22.357143
78
0.773163
7eef9371851f825f6bf3302382f66c505a9c7da1
484
h
C
src/exception/date_exception.h
bdmendes/feup-aeda-project
09d4fa484bc2be176992139fc925524cbaa6766d
[ "MIT" ]
null
null
null
src/exception/date_exception.h
bdmendes/feup-aeda-project
09d4fa484bc2be176992139fc925524cbaa6766d
[ "MIT" ]
9
2020-11-15T01:03:41.000Z
2020-11-20T21:12:06.000Z
src/exception/date_exception.h
bdmendes/feup-aeda-project
09d4fa484bc2be176992139fc925524cbaa6766d
[ "MIT" ]
2
2021-02-08T23:36:03.000Z
2021-02-09T19:40:32.000Z
#ifndef FEUP_AEDA_PROJECT_DATE_EXCEPTIONS_H #define FEUP_AEDA_PROJECT_DATE_EXCEPTIONS_H #include <stdexcept> #include "model/date/date.h" /** * Class relative to the exception of an invalid date. */ class InvalidDate : public std::logic_error{ public: /** * Creates a new InvalidDate exception object. * * @param completeDate the complete date */ explicit InvalidDate(const std::string& completeDate); }; #endif //FEUP_AEDA_PROJECT_DATE_EXCEPTIONS_H
22
58
0.737603
7df00640978f4f28e06940248f2fb0d2029fdc27
3,480
c
C
firmware/target/hosted/ibasso/powermgmt-ibasso.c
Rockbox-Chinese-Community/Rockbox-RCC
a701aefe45f03ca391a8e2f1a6e3da1b8774b2f2
[ "BSD-3-Clause" ]
24
2015-03-10T08:43:56.000Z
2022-01-05T14:09:46.000Z
firmware/target/hosted/ibasso/powermgmt-ibasso.c
Rockbox-Chinese-Community/Rockbox-RCC
a701aefe45f03ca391a8e2f1a6e3da1b8774b2f2
[ "BSD-3-Clause" ]
4
2015-07-04T18:15:33.000Z
2018-05-18T05:33:33.000Z
firmware/target/hosted/ibasso/powermgmt-ibasso.c
Rockbox-Chinese-Community/Rockbox-RCC
a701aefe45f03ca391a8e2f1a6e3da1b8774b2f2
[ "BSD-3-Clause" ]
15
2015-01-21T13:58:13.000Z
2020-11-04T04:30:22.000Z
/*************************************************************************** * __________ __ ___ * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 * Copyright (C) 2014 by Mario Basister: iBasso DX90 port * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include <stdio.h> #include "config.h" #include "debug.h" #include "panic.h" #include "debug-ibasso.h" #include "sysfs-ibasso.h" /* Based on batterymonitor with PISEN and Samsung SIII battery. */ const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { 3600 }; const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = { 3500 }; /* Averages at percent of running time from five measuremnts with PISEN and Samsung SIII battery during normal usage. Mongo default values (?) < 3660 (0%), < 3730 (1% - 10%), < 3780 (11% - 20%), < 3830 (21% - 40%), < 3950 (41% - 60%), < 4080 (61% - 80%), > 4081 (81% - 100%) */ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = { { 3522, 3660, 3720, 3752, 3784, 3827, 3896, 3978, 4072, 4168, 4255 } }; /* Copied from percent_to_volt_discharge. */ const unsigned short percent_to_volt_charge[11] = { 3500, 3544, 3578, 3623, 3660, 3773, 3782, 3853, 3980, 4130, 4360 }; static int _battery_present = -1; int _battery_voltage(void) { /*TRACE;*/ if( (_battery_present == -1) && (! sysfs_get_int(SYSFS_BATTERY_PRESENT, &_battery_present))) { /* This check is only done once at startup. */ DEBUGF("ERROR %s: Can not get current battery availabilty.", __func__); _battery_present = 1; } int val; if(_battery_present == 1) { /* Battery is present. */ /* /sys/class/power_supply/battery/voltage_now Voltage in microvolt. */ if(! sysfs_get_int(SYSFS_BATTERY_VOLTAGE_NOW, &val)) { DEBUGF("ERROR %s: Can not get current battery voltage.", __func__); return 0; } } else { /* No battery, so we have to be running solely from USB power. This will prevent Rockbox from forcing shutdown due to low power. */ /* /sys/class/power_supply/usb/voltage_now Voltage in microvolt. */ if(! sysfs_get_int(SYSFS_USB_POWER_VOLTAGE_NOW, &val)) { DEBUGF("ERROR %s: Can not get current USB voltage.", __func__); return 0; } } return(val / 1000); }
28.292683
97
0.567816
47d34840ad233964284ed6a4419c9bb6c7db9df2
1,543
c
C
src/mpool.c
arhiv6/cmtos
69beed8e2ddf08017fe5c1d4acc43981b0336a4b
[ "MIT" ]
null
null
null
src/mpool.c
arhiv6/cmtos
69beed8e2ddf08017fe5c1d4acc43981b0336a4b
[ "MIT" ]
null
null
null
src/mpool.c
arhiv6/cmtos
69beed8e2ddf08017fe5c1d4acc43981b0336a4b
[ "MIT" ]
null
null
null
#include <stdint.h> #include <assert.h> #include "mpool.h" /* Memory pool Реализация пула памяти на связанных списках. Идея взята из статьи "Alternatives to malloc and new" http://www.spuify.co.uk/?p=454 Занимает вего один указатель - на голову этого списка. Всё остальное (ссылки на следующие элементы) хранится в пустых сегментах пула. */ void *mp_alloc(mpool_t *pool) { if (!pool) { return NULL; } if (!pool->head) { return NULL; // Места в пуле нет } void *currPtr = pool->head; // Указатель на голову отдадим pool->head = (*((void **)(pool->head))); return currPtr; } void mp_free(mpool_t *pool, void *ptr) { #ifdef SAFE // TODO кратно chunk_size в границах mem #endif if (!pool || !ptr) { return; } *((void **)ptr) = pool->head; pool->head = (void *)ptr; } void mp_init(mpool_t *pool, size_t size, size_t chunk_size, void *mem) { assert(chunk_size >= sizeof(void *)); if (!pool || !mem || !size || !chunk_size) { return; } const size_t chunk_count = (size / chunk_size) - 1; for (size_t chunk_index = 0; chunk_index < chunk_count; ++chunk_index) { uint8_t *currChunk = (uint8_t *)mem + (chunk_index * chunk_size); *((uint8_t **)currChunk) = currChunk + chunk_size; } *((void **)&((uint8_t *)mem)[chunk_count * chunk_size]) = NULL; /* terminating NULL */ pool->head = mem; }
22.362319
91
0.569021
e0f6e81af821115863fd1a2c436c189a748cfe21
325
h
C
CreativeAnimationDemo/CreativeAnimationDemo/Source/BIIntroPageAnimateProtocol.h
ProfessionalIsFunny/CreativeAnimation
70b1d463bdb0113f7703f1af52070e2e3864bd19
[ "MIT" ]
2
2016-01-26T06:58:01.000Z
2016-06-04T03:22:07.000Z
CreativeAnimationDemo/CreativeAnimationDemo/Source/BIIntroPageAnimateProtocol.h
ProfessionalIsFunny/CreativeAnimation
70b1d463bdb0113f7703f1af52070e2e3864bd19
[ "MIT" ]
null
null
null
CreativeAnimationDemo/CreativeAnimationDemo/Source/BIIntroPageAnimateProtocol.h
ProfessionalIsFunny/CreativeAnimation
70b1d463bdb0113f7703f1af52070e2e3864bd19
[ "MIT" ]
null
null
null
// // BIIntroPageAnimateProtocol.h // GuidePageDemo // // Created by AugustRush on 15/11/2. // Copyright © 2015年 AugustRush. All rights reserved. // #import <Foundation/Foundation.h> @protocol BIIntroPageAnimateProtocol <NSObject> - (void)animateForOffset:(CGFloat)offset; - (void)preparedKeyFramesForScrolling; @end
19.117647
54
0.753846
4637f95e0d0fb5c5044da7f02ccc2ada51d81892
6,260
c
C
cabi.c
Team-ARG-Museum/Cabi
f7f4b0d23b0eeaa43ca6e8ebf1f6b9e0c62fcf20
[ "MIT" ]
1
2021-03-15T04:56:03.000Z
2021-03-15T04:56:03.000Z
cabi.c
increpare/Cabi
131419e79831221f99aafd39f9490a250a60966d
[ "MIT" ]
null
null
null
cabi.c
increpare/Cabi
131419e79831221f99aafd39f9490a250a60966d
[ "MIT" ]
1
2020-06-22T16:44:17.000Z
2020-06-22T16:44:17.000Z
/* abe.c arduboy encoder monochrome rle encoding by zep License: CC-0 cabi in.png [array_name_prefix] */ #include <stdlib.h> #include <stdio.h> #include <memory.h> #include "lodepng.h" // alternative pixel order mapping //#define READING_ORDER 1 int reading_order = 0; typedef unsigned char uint8_t; #ifndef WIDTH #define WIDTH 128 #define HEIGHT 64 #define PROGMEM #endif // one byte encodes a 1x8 stick; low byte at top // for testing void draw_sprite_ascii(const uint8_t *dat, int w, int h) { int x, y; int row, bit; int rows; rows = (h+7)/8; for (y = 0; y < h; y ++) { row = y/8; bit = y&7; for (x = 0; x < w; x++) { if (dat[x + (row*w)] & (1 << bit)) printf("#"); else printf("."); } printf("\n"); } } // ---------------------------------------------------------------------------- // :: Decompress // ---------------------------------------------------------------------------- // compression / decompression session state typedef struct CSESSION{ int byte; int bit; const uint8_t *src; uint8_t *dest; int src_pos; int out_pos; int w, h; }CSESSION; static CSESSION cs; // get an n-bit number from the compressed data stream static int getval(int bits) { int val = 0; int i; for (i = 0; i < bits; i++) { if (cs.bit == 0x100) { cs.bit = 0x1; cs.byte = cs.src[cs.src_pos]; cs.src_pos ++; } if (cs.byte & cs.bit) val += (1 << i); cs.bit <<= 1; } return val; } // decompress_rle // if not NULL, w and h give back the size of the sprite. void draw_compressed_sprite_ascii(const uint8_t *src) { int col; int pos; int bl, len; int i; int w, h; int x, y; int total = 0; memset(&cs, 0, sizeof(cs)); cs.src = src; cs.bit = 0x100; cs.src_pos = 0; // header w = getval(8) + 1; h = getval(8) + 1; col = getval(1); // starting colour x = y = 0; while (y < h) { bl = 1; while (!getval(1)) bl += 2; len = getval(bl)+1; // span length for (i = 0; i < len; i++) { //if ((x%8) == 0) // every 8th bit (format test) printf("%s", col ? "#":"."); if (col) total++; x++; if (x >= w) { printf("\n"); y ++; x = 0; } //if ((x+y*w)%(w*8) == 0) printf("\n"); // print every 8th line (format test) } col = 1-col; // toggle } printf("\ntotal: %d\n", total); } #if 0 #endif // ---------------------------------------------------------------------------- // :: Compress // ---------------------------------------------------------------------------- /* getcol pos is the index of the pixel: 0 .. w*h-1 */ static int getcol(int pos) { int x, y; // display order if (reading_order == 0) { if (cs.src[pos/8] & (1 << (pos&7))) return 1; return 0; } // reading order (compresses slightly better but harder to optimize sprite blit) // or use this after loading png into display order (no need for extra conversion) x = (pos % cs.w); y = (pos / cs.w); if (cs.src[x + ((y/8)*cs.w)] & (1 << (y&7))) return 1; return 0; } static int find_rlen(int pos, int plen) { int col; int pos0; col = getcol(pos); pos0 = pos; while(getcol(pos) == col && pos < plen) pos ++; return pos-pos0; } // write a bit to the stream. non-zero val means 1, otherwise 0. static void putbit(int val) { if (val) cs.byte |= cs.bit; cs.bit <<= 1; if (cs.bit == 0x100) { //output byte if (cs.out_pos != 0) printf(","); if (cs.out_pos % 16 == 0) printf("\n"); printf("0x%02x", cs.byte); cs.out_pos ++; cs.bit = 0x1; cs.byte = 0; } } // write an n-bit (bits) number (val) to the output steam static void putval(int val, int bits) { int i; if (bits <= 0) return; for (i = 0; i < bits; i++) putbit(val & (1 << i)); } // write a span length // a string of bits encoding the number of bits needed to encode the length, // and then the length. static int putsplen(int len) { int blen = 1; // how bits needed to encode length while ((1 << blen) <= len) blen += 2; // write number of bits (1-terminated string of zeroes) putval(0,(blen-1)/2); putval(1,1); // terminator // write length putval(len, blen); } /* comp compress plen 1-bit pixels from src to dest */ int compress_rle(const uint8_t *src, int w, int h, char *prefix, char *suffix) { int pos; int rlen; int len; printf("const uint8_t PROGMEM %s%s[] = {", prefix, suffix); fflush(stdout); memset(&cs, 0, sizeof(cs)); cs.src = src; cs.bit = 1; cs.w = w; cs.h = h; // header putval(w-1, 8); putval(h-1, 8); putval(getcol(0), 1); // first colour pos = 0; // span data while (pos < w*h) { rlen = find_rlen(pos, w*h); pos += rlen; putsplen(rlen-1); } // pad with zeros and flush while (cs.bit != 0x1) putbit(0); printf("\n};\n"); return cs.out_pos; // bytes } int main(int argc, char **argv) { int compressed_len; int pixels; int w,h; unsigned char *bmp = NULL; unsigned char *bmp0 = NULL; unsigned char *bmp1 = NULL; int result; int rawlen; int x, y; int row,bit; char prefix[256] = "out"; if (argc < 2) { printf("usage: cabi in.png [array_name_prefix]\n"); } if (argc >= 3) strcpy(prefix, argv[2]); result = lodepng_decode_file(&bmp, &w, &h, argv[1], 6, 8); if (result != 0) { printf("could not load %s\n", argv[1]); exit(0); } // generate sprite and mask rawlen = w * (h+7) / 8; bmp0 = malloc(rawlen); memset(bmp0, 0, rawlen); bmp1 = malloc(rawlen); memset(bmp1, 0, rawlen); printf("// %s width: %d height: %d\n", argv[1], w, h); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { row = y/8; bit = y&7; if (bmp[(x+y*w)*4 + 3] > 128) // need to be opaque to count if (bmp[(x+y*w)*4 + 0] > 128) { // set sprite bmp0[x + (row*w)] |= (1 << bit); } if (bmp[(x+y*w)*4 + 3] > 128) { // set mask bmp1[x + (row*w)] |= (1 << bit); } } } compressed_len = compress_rle(bmp0, w, h, prefix, ""); printf("// bytes:%d ratio: %3.3f\n\n", compressed_len, (float)(compressed_len * 8)/ (float)(w*h)); compressed_len = compress_rle(bmp1, w, h, prefix, "_mask"); printf("// bytes:%d ratio: %3.3f\n\n", compressed_len, (float)(compressed_len * 8)/ (float)(w*h)); free(bmp0); free(bmp1); return 0; }
16.737968
99
0.53722
7062edcf757911c3c7827399eaad365068bca2df
4,231
h
C
ArcGISRuntimeSDKQt_CppSamples/UtilityNetwork/DisplayContentOfUtilityNetworkContainer/DisplayContentOfUtilityNetworkContainer.h
cmboling/arcgis-runtime-samples-qt
fc3869beb32c690b724fc781bf8e7d60f6b6cde7
[ "Apache-2.0" ]
117
2016-07-19T00:44:18.000Z
2022-03-29T19:15:03.000Z
ArcGISRuntimeSDKQt_CppSamples/UtilityNetwork/DisplayContentOfUtilityNetworkContainer/DisplayContentOfUtilityNetworkContainer.h
cmboling/arcgis-runtime-samples-qt
fc3869beb32c690b724fc781bf8e7d60f6b6cde7
[ "Apache-2.0" ]
417
2016-06-22T03:07:24.000Z
2022-03-30T21:49:46.000Z
ArcGISRuntimeSDKQt_CppSamples/UtilityNetwork/DisplayContentOfUtilityNetworkContainer/DisplayContentOfUtilityNetworkContainer.h
cmboling/arcgis-runtime-samples-qt
fc3869beb32c690b724fc781bf8e7d60f6b6cde7
[ "Apache-2.0" ]
179
2016-06-17T17:51:49.000Z
2022-03-26T23:25:29.000Z
// [WriteFile Name=DisplayContentOfUtilityNetworkContainer, Category=UtilityNetwork] // [Legal] // Copyright 2021 Esri. // 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. // [Legal] #ifndef DISPLAYCONTENTOFUTILITYNETWORKCONTAINER_H #define DISPLAYCONTENTOFUTILITYNETWORKCONTAINER_H namespace Esri { namespace ArcGISRuntime { class Credential; class GraphicsOverlay; class IdentifyLayerResult; class Map; class MapQuickView; class SubtypeFeatureLayer; class Symbol; class UtilityAssociation; class UtilityElement; class UtilityNetwork; } } class SymbolImageProvider; #include <QObject> #include <QMouseEvent> #include "TaskWatcher.h" #include "Viewpoint.h" class DisplayContentOfUtilityNetworkContainer : public QObject { Q_OBJECT Q_PROPERTY(Esri::ArcGISRuntime::MapQuickView* mapView READ mapView WRITE setMapView NOTIFY mapViewChanged) Q_PROPERTY(bool showContainerView READ showContainerView WRITE setShowContainerView NOTIFY showContainerViewChanged) Q_PROPERTY(QString attachmentSymbolUrl READ attachmentSymbolUrl NOTIFY attachmentSymbolUrlChanged) Q_PROPERTY(QString connectivitySymbolUrl READ connectivitySymbolUrl NOTIFY connectivitySymbolUrlChanged) Q_PROPERTY(QString boundingBoxSymbolUrl READ boundingBoxSymbolUrl NOTIFY boundingBoxSymbolUrlChanged) Q_PROPERTY(QString messageBoxText READ messageBoxText WRITE setMessageBoxText NOTIFY messageBoxTextChanged) public: explicit DisplayContentOfUtilityNetworkContainer(QObject* parent = nullptr); ~DisplayContentOfUtilityNetworkContainer(); static void init(); signals: void mapViewChanged(); void showContainerViewChanged(); void attachmentSymbolUrlChanged(); void connectivitySymbolUrlChanged(); void boundingBoxSymbolUrlChanged(); void messageBoxTextChanged(); private: Esri::ArcGISRuntime::MapQuickView* mapView() const; void createConnections(); bool showContainerView() const; void identifyFeaturesAtMouseClick(QMouseEvent& mouseEvent); void getUtilityAssociationsOfFeature(QUuid, QList<Esri::ArcGISRuntime::IdentifyLayerResult*> identifyResult); void displayFeaturesAndGetAssociations(QUuid); void getFeaturesForElementsOfUtilityAssociations(QList<Esri::ArcGISRuntime::UtilityAssociation*> containmentAssociations); void showAttachmentAndConnectivitySymbols(QList<Esri::ArcGISRuntime::UtilityAssociation*> containmentAssociations); void setMapView(Esri::ArcGISRuntime::MapQuickView* mapView); void setShowContainerView(bool showContainerView); void setMessageBoxText(const QString& message); QString messageBoxText() const; void createLegend(); QString attachmentSymbolUrl() const; QString connectivitySymbolUrl() const; QString boundingBoxSymbolUrl() const; Esri::ArcGISRuntime::Credential* m_cred = nullptr; Esri::ArcGISRuntime::Geometry m_boundingBox; Esri::ArcGISRuntime::GraphicsOverlay* m_containerGraphicsOverlay = nullptr; Esri::ArcGISRuntime::Map* m_map = nullptr; Esri::ArcGISRuntime::MapQuickView* m_mapView = nullptr; Esri::ArcGISRuntime::TaskWatcher m_taskWatcher; Esri::ArcGISRuntime::UtilityElement* m_containerElement = nullptr; Esri::ArcGISRuntime::UtilityNetwork* m_utilityNetwork = nullptr; Esri::ArcGISRuntime::Viewpoint m_previousViewpoint; bool m_showContainerView = false; bool m_setBoundingBox = false; QString m_messageBoxText = ""; QString m_attachmentSymbolUrl = ""; QString m_connectivitySymbolUrl = ""; QString m_boundingBoxSymbolUrl = ""; Esri::ArcGISRuntime::Symbol* m_attachmentSymbol = nullptr; Esri::ArcGISRuntime::Symbol* m_connectivitySymbol = nullptr; Esri::ArcGISRuntime::Symbol* m_boundingBoxSymbol = nullptr; SymbolImageProvider* m_symbolImageProvider = nullptr; }; #endif // DISPLAYCONTENTOFUTILITYNETWORKCONTAINER_H
38.816514
124
0.815174
7d4d51f76c1c445fcaa75e100aeefe61ba85ab90
16,640
c
C
snort-2.9.15.1/src/dynamic-preprocessors/ssl_common/ssl.c
wenze1367/snort-2.9.15-read-annotation
d5c76ec0e699b173caabd917b921412c03233149
[ "BSD-2-Clause" ]
null
null
null
snort-2.9.15.1/src/dynamic-preprocessors/ssl_common/ssl.c
wenze1367/snort-2.9.15-read-annotation
d5c76ec0e699b173caabd917b921412c03233149
[ "BSD-2-Clause" ]
null
null
null
snort-2.9.15.1/src/dynamic-preprocessors/ssl_common/ssl.c
wenze1367/snort-2.9.15-read-annotation
d5c76ec0e699b173caabd917b921412c03233149
[ "BSD-2-Clause" ]
2
2020-11-26T13:27:14.000Z
2022-03-20T02:12:55.000Z
/* * Copyright (C) 2014-2019 Cisco and/or its affiliates. All rights reserved. * Copyright (C) 1998-2013 Sourcefire, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License Version 2 as * published by the Free Software Foundation. You may not use, modify or * distribute this program under any other version of the GNU General * Public License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ /* * Adam Keeton * ssl.c * 10/09/07 */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifndef WIN32 #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #endif #include "sf_snort_packet.h" #include "ssl.h" #include "sf_types.h" #define THREE_BYTE_LEN(x) (x[2] | x[1] << 8 | x[0] << 16) static uint32_t SSL_decode_version_v3(uint8_t major, uint8_t minor) { /* Should only be called internally and by functions which have previously * validated their arguments */ if(major == 3) { /* Minor version */ switch(minor) { case 0: return SSL_VER_SSLV3_FLAG; break; case 1: return SSL_VER_TLS10_FLAG; break; case 2: return SSL_VER_TLS11_FLAG; break; case 3: return SSL_VER_TLS12_FLAG; break; default: return SSL_BAD_VER_FLAG; }; } /* This is a special case. Technically, major == 0, minor == 2 is SSLv2. * But if this traffic was SSLv2, this code path would not have been * exercised. */ else if(minor == 2) { return SSL_BAD_VER_FLAG; } return SSL_BAD_VER_FLAG; } static uint32_t SSL_decode_handshake_v3(const uint8_t *pkt , int size, uint32_t cur_flags, uint32_t pkt_flags) { SSL_handshake_t *handshake; SSL_handshake_hello_t *hello; uint32_t hs_len; uint32_t retval = 0; while (size > 0) { if (size < (int)SSL_HS_PAYLOAD_OFFSET) { retval |= SSL_TRUNCATED_FLAG; break; } /* Note, handhshake version field is optional depending on type */ /* Will recast to different type as necessary. */ handshake = (SSL_handshake_t *)pkt; pkt += SSL_HS_PAYLOAD_OFFSET; size -= SSL_HS_PAYLOAD_OFFSET; /* The code below effectively implements the following: * hs_len = 0; * memcpy(&hs_len, handshake->length, 3); * hs_len = ntohl(hs_len); * It was written this way for performance */ hs_len = THREE_BYTE_LEN(handshake->length); switch(handshake->type) { case SSL_HS_CHELLO: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_BOGUS_HS_DIR_FLAG; else retval |= SSL_CLIENT_HELLO_FLAG | SSL_CUR_CLIENT_HELLO_FLAG; /* This type of record contains a version string. */ /* Make sure there is room for a version. */ if (size < (int)sizeof(uint16_t)) { retval |= SSL_TRUNCATED_FLAG; break; } hello = (SSL_handshake_hello_t *)handshake; retval |= SSL_decode_version_v3(hello->major, hello->minor); /* Compare version of record with version of handshake */ if((cur_flags & SSL_VERFLAGS) != (retval & SSL_VERFLAGS)) retval |= SSL_BAD_VER_FLAG; break; case SSL_HS_SHELLO: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_SERVER_HELLO_FLAG | SSL_CUR_SERVER_HELLO_FLAG; else retval |= SSL_BOGUS_HS_DIR_FLAG; /* This type of record contains a version string. */ if (size < (int)sizeof(uint16_t)) { retval |= SSL_TRUNCATED_FLAG; break; } hello = (SSL_handshake_hello_t *)handshake; retval |= SSL_decode_version_v3(hello->major, hello->minor); /* Compare version of record with version of handshake */ if((cur_flags & SSL_VERFLAGS) != (retval & SSL_VERFLAGS)) retval |= SSL_BAD_VER_FLAG; break; case SSL_HS_SHELLO_DONE: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_HS_SDONE_FLAG; else retval |= SSL_BOGUS_HS_DIR_FLAG; break; case SSL_HS_SKEYX: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_SERVER_KEYX_FLAG | SSL_CUR_SERVER_KEYX_FLAG; else retval |= SSL_BOGUS_HS_DIR_FLAG; break; case SSL_HS_CKEYX: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_BOGUS_HS_DIR_FLAG; else retval |= SSL_CLIENT_KEYX_FLAG | SSL_CUR_CLIENT_KEYX_FLAG; break; case SSL_HS_CERT: retval |= SSL_CERTIFICATE_FLAG; break; /* The following types are not presently of interest */ case SSL_HS_HELLO_REQ: case SSL_HS_CERT_VERIFY: case SSL_HS_CERT_REQ: case SSL_CERT_URL: /* RFC 3546 */ case SSL_CERT_STATUS: /* RFC 3546 */ break; /* Will never see this since it's always encrypted */ case SSL_HS_FINISHED: default: /* Could be either a bad type or an encrypted handshake record */ /* If the record is encrypted, the type will likely appear bogus. */ return SSL_POSSIBLE_HS_FLAG | SSL_POSSIBLY_ENC_FLAG; } size -= hs_len; pkt += hs_len; } if (size < 0) retval |= SSL_TRUNCATED_FLAG; return retval; } static uint32_t SSL_decode_v3(const uint8_t *pkt, int size, uint32_t pkt_flags, uint8_t *alert_flags, uint16_t *partial_rec_len, int max_hb_len) { SSL_record_t *record; uint32_t retval = 0; uint16_t reclen; uint16_t hblen; int ccs = 0; /* Set if we see a Change Cipher Spec and reset after the next record */ SSL_heartbeat *heartbeat; uint16_t psize = 0; if( size && partial_rec_len && *partial_rec_len > 0) { if(size < (int)(*partial_rec_len)) { *partial_rec_len = *partial_rec_len - size; retval |= SSL_TRUNCATED_FLAG; return retval; } else { pkt += *partial_rec_len; size -= *partial_rec_len; } *partial_rec_len = 0; } while(size > 0) { if (size < (int)SSL_REC_PAYLOAD_OFFSET) { retval |= SSL_TRUNCATED_FLAG; break; } record = (SSL_record_t*)pkt; pkt += SSL_REC_PAYLOAD_OFFSET; size -= SSL_REC_PAYLOAD_OFFSET; retval |= SSL_decode_version_v3(record->major, record->minor); reclen = ntohs(record->length); psize = (size < reclen)? (reclen - size) : 0; switch (record->type) { case SSL_CHANGE_CIPHER_REC: retval |= SSL_CHANGE_CIPHER_FLAG; /* If there is another record, mark it as possibly encrypted */ if((size - (int)reclen) > 0) retval |= SSL_POSSIBLY_ENC_FLAG; ccs = 1; break; case SSL_ALERT_REC: retval |= SSL_ALERT_FLAG; ccs = 0; break; case SSL_HEARTBEAT_REC: retval |= SSL_HEARTBEAT_SEEN; ccs = 0; if((size < 0) || ((unsigned int)size < sizeof(SSL_heartbeat)) || !max_hb_len || !alert_flags) break; heartbeat = (SSL_heartbeat*)pkt; if((heartbeat->type) == SSL_HEARTBEAT_REQUEST) { hblen = ntohs(heartbeat->length); if(hblen > max_hb_len) *alert_flags = SSL_HEARTBLEED_REQUEST; } else if((heartbeat->type) == SSL_HEARTBEAT_RESPONSE) { if(reclen > max_hb_len ) *alert_flags = SSL_HEARTBLEED_RESPONSE; } else if (!(retval & SSL_BAD_VER_FLAG)) { if(reclen > max_hb_len ) *alert_flags = SSL_HEARTBLEED_UNKNOWN; } break; case SSL_HANDSHAKE_REC: /* If the CHANGE_CIPHER_FLAG is set, the following handshake * record should be encrypted */ if(!(retval & SSL_CHANGE_CIPHER_FLAG)) { int hsize = size < (int)reclen ? size : (int)reclen; retval |= SSL_decode_handshake_v3(pkt, hsize, retval, pkt_flags); } else if (ccs) { /* If we just got a change cipher spec, the next record must * be a finished encrypted, which has no type, so it will fall * into this default case, but it's good and we still need to * see client and server app data */ retval |= SSL_HS_SDONE_FLAG; } ccs = 0; break; case SSL_APPLICATION_REC: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_SAPP_FLAG; else retval |= SSL_CAPP_FLAG; ccs = 0; break; default: retval |= SSL_BAD_TYPE_FLAG; ccs = 0; break; }; size -= reclen; pkt += reclen; } if (size < 0) retval |= SSL_TRUNCATED_FLAG; if(!(retval & SSL_VERFLAGS) || (retval & SSL_BAD_VER_FLAG)) { psize = 0; retval = retval | SSL_UNKNOWN_FLAG; } if(partial_rec_len) *partial_rec_len = psize; return retval; } // See RFCs 6101, 2246, 4346 and 5246 for SSL 3.0, TLS 1.0, 1.1 and 1.2 respectively // Appendix E. Backward Compatibility With SSL static inline bool SSL_v3_back_compat_v2(SSLv2_chello_t *chello) { if ((chello->major == 3) && (chello->minor <= 3)) return true; return false; } static uint32_t SSL_decode_v2(const uint8_t *pkt, int size, uint32_t pkt_flags) { uint16_t reclen; SSLv2_chello_t *chello; SSLv2_shello_t *shello; uint32_t retval = 0; SSLv2_record_t *record = (SSLv2_record_t*)pkt; while (size > 0) { if(size < SSL_V2_MIN_LEN) { retval |= SSL_TRUNCATED_FLAG | SSL_UNKNOWN_FLAG; break; } /* Note: top bit has special meaning and is not included * with the length */ reclen = ntohs(record->length) & 0x7fff; switch(record->type) { case SSL_V2_CHELLO: if(pkt_flags & FLAG_FROM_SERVER) retval |= SSL_BOGUS_HS_DIR_FLAG; else retval |= SSL_CLIENT_HELLO_FLAG | SSL_CUR_CLIENT_HELLO_FLAG ; if (size < (int)sizeof(SSLv2_chello_t)) { retval |= SSL_TRUNCATED_FLAG | SSL_UNKNOWN_FLAG; break; } chello = (SSLv2_chello_t*)pkt; // Check for SSLv3/TLS backward compatibility if (SSL_v3_back_compat_v2(chello)) retval |= SSL_V3_BACK_COMPAT_V2; else if (chello->minor != 2) retval |= SSL_BAD_VER_FLAG | SSL_UNKNOWN_FLAG; break; case SSL_V2_SHELLO: if(pkt_flags & FLAG_FROM_CLIENT) retval |= SSL_BOGUS_HS_DIR_FLAG; else retval |= SSL_SERVER_HELLO_FLAG | SSL_CUR_SERVER_HELLO_FLAG; if (size < (int)sizeof(SSLv2_shello_t)) { retval |= SSL_TRUNCATED_FLAG | SSL_UNKNOWN_FLAG; break; } shello = (SSLv2_shello_t*)pkt; if (shello->minor != 2) { retval |= SSL_BAD_VER_FLAG | SSL_UNKNOWN_FLAG; break; } break; case SSL_V2_CKEY: retval |= SSL_CLIENT_KEYX_FLAG | SSL_CUR_CLIENT_KEYX_FLAG; break; default: return retval | SSL_BAD_TYPE_FLAG | SSL_UNKNOWN_FLAG; } size -= (reclen + 2); pkt += (reclen + 2); } if (size < 0) retval |= SSL_TRUNCATED_FLAG; return retval | SSL_VER_SSLV2_FLAG; } uint32_t SSL_decode(const uint8_t *pkt, int size, uint32_t pkt_flags, uint32_t prev_flags, uint8_t *alert_flags, uint16_t *partial_rec_len, int max_hb_len) { SSL_record_t *record; uint16_t reclen; uint32_t datalen; if(!pkt || !size) return SSL_ARG_ERROR_FLAG; if (size < (int)SSL_REC_PAYLOAD_OFFSET) return SSL_TRUNCATED_FLAG | SSL_UNKNOWN_FLAG; if(!( prev_flags & SSL_HS_SDONE_FLAG )) { /* Determine the protocol type. */ /* Only SSL v2 will have these bits set */ if(((pkt[0] & 0x80) || (pkt[0] & 0x40)) && !(partial_rec_len && *partial_rec_len)) return SSL_decode_v2(pkt, size, pkt_flags); /* If this packet is only 5 bytes, it inconclusive whether its SSLv2 or TLS. * If it is v2, it's definitely truncated anyway. By decoding a 5 byte * SSLv2 as TLS,the decoder will either catch a bad type, bad version, or * indicate that it is truncated. */ if(size == 5) return SSL_decode_v3(pkt, size, pkt_flags, alert_flags, partial_rec_len, max_hb_len); /* At this point, 'size' has to be > 5 */ /* If the field below contains a 2, it's either an SSLv2 client hello or * it is TLS and is containing a server hello. */ if(pkt[4] == 2) { /* This could be a TLS server hello. Check for a TLS version string */ if(size >= 10) { if(pkt[9] == 3) { /* Saw a TLS version, but this could also be an SSHv2 length. * If it is, check if a hypothetical TLS record-data length agress * with its record length */ datalen = THREE_BYTE_LEN( (pkt+6) ); record = (SSL_record_t*)pkt; reclen = ntohs(record->length); /* If these lengths match, it's v3 */ /* Otherwise, it's v2 */ if(reclen - SSL_HS_PAYLOAD_OFFSET != datalen) return SSL_decode_v2(pkt, size, pkt_flags); } } } /* Check if it's possibly a SSLv2 server-hello, in which case the version * is at byte 7 */ else if(size >= 8 && pkt[7] == 2) { /* A version of '2' at byte 7 overlaps with TLS record-data length. * Check if a hypothetical TLS record-data length agress with its * record length */ datalen = THREE_BYTE_LEN( (pkt+6) ); record = (SSL_record_t*)pkt; reclen = ntohs(record->length); /* If these lengths match, it's v3 */ /* Otherwise, it's v2 */ if(reclen - SSL_HS_PAYLOAD_OFFSET != datalen) return SSL_decode_v2(pkt, size, pkt_flags); } } return SSL_decode_v3(pkt, size, pkt_flags, alert_flags, partial_rec_len, max_hb_len); }
32.436647
155
0.528846
0448bd0c870e8066d2684b2c7e9d8eba385edc37
3,292
h
C
src/thirdparty/taglib2/taglib/dsf/dsfproperties.h
billlin0904/xamp2
c11ada6138a5c8427523543bb7035f2ac2cff8d5
[ "MIT" ]
2
2020-02-09T04:55:36.000Z
2022-01-08T08:50:50.000Z
src/thirdparty/taglib2/taglib/dsf/dsfproperties.h
billlin0904/xamp2
c11ada6138a5c8427523543bb7035f2ac2cff8d5
[ "MIT" ]
1
2022-02-16T10:14:05.000Z
2022-02-16T10:14:05.000Z
src/thirdparty/taglib2/taglib/dsf/dsfproperties.h
billlin0904/xamp2
c11ada6138a5c8427523543bb7035f2ac2cff8d5
[ "MIT" ]
2
2019-09-23T15:21:27.000Z
2021-04-12T09:00:37.000Z
/*************************************************************************** copyright : (C) 2013 by Stephen F. Booth email : me@sbooth.org ***************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License version * * 2.1 as published by the Free Software Foundation. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * * 02110-1301 USA * * * * Alternatively, this file is available under the Mozilla Public * * License Version 1.1. You may obtain a copy of the License at * * http://www.mozilla.org/MPL/ * ***************************************************************************/ #ifndef TAGLIB_DSFPROPERTIES_H #define TAGLIB_DSFPROPERTIES_H #include "audioproperties.h" namespace TagLib { namespace DSF { class File; //! An implementation of audio property reading for DSF /*! * This reads the data from a DSF stream found in the AudioProperties * API. */ class TAGLIB_EXPORT AudioProperties : public TagLib::AudioProperties { public: /*! * Create an instance of DSF::AudioProperties with the data read from the * ByteVector \a data. */ AudioProperties(const ByteVector &data, ReadStyle style); /*! * Destroys this DSF::AudioProperties instance. */ virtual ~AudioProperties(); // Reimplementations. virtual int length() const; virtual int lengthInSeconds() const; virtual int lengthInMilliseconds() const; virtual int bitrate() const; virtual int sampleRate() const; virtual int channels() const; int formatVersion() const; int formatID() const; /*! * Channel type values: 1 = mono, 2 = stereo, 3 = 3 channels, * 4 = quad, 5 = 4 channels, 6 = 5 channels, 7 = 5.1 channels */ int channelType() const; int bitsPerSample() const; long long sampleCount() const; int blockSizePerChannel() const; private: AudioProperties(const AudioProperties &); AudioProperties &operator=(const AudioProperties &); void read(const ByteVector &data); class PropertiesPrivate; PropertiesPrivate *d; }; } } #endif
35.782609
79
0.509417
a877fe1f49cc5730380255172fa4124d0987dc1f
2,544
h
C
src/utilities/debug.h
agustingianni/retools
0df67fe6f21895644936c5896a33770431d86a1d
[ "MIT" ]
80
2017-08-08T08:42:12.000Z
2022-03-03T13:12:05.000Z
src/utilities/debug.h
agustingianni/retools
0df67fe6f21895644936c5896a33770431d86a1d
[ "MIT" ]
16
2017-08-02T14:17:07.000Z
2021-04-30T10:17:01.000Z
src/utilities/debug.h
agustingianni/retools
0df67fe6f21895644936c5896a33770431d86a1d
[ "MIT" ]
6
2017-10-02T07:47:46.000Z
2020-08-18T22:03:48.000Z
#ifndef __debug_h__ #define __debug_h__ #include <stdio.h> #include <errno.h> #include <string.h> #define RESET "\033[0m" #define BLACK "\033[30m" /* Black */ #define RED "\033[31m" /* Red */ #define GREEN "\033[32m" /* Green */ #define YELLOW "\033[33m" /* Yellow */ #define BLUE "\033[34m" /* Blue */ #define MAGENTA "\033[35m" /* Magenta */ #define CYAN "\033[36m" /* Cyan */ #define WHITE "\033[37m" /* White */ #define BOLDBLACK "\033[1m\033[30m" /* Bold Black */ #define BOLDRED "\033[1m\033[31m" /* Bold Red */ #define BOLDGREEN "\033[1m\033[32m" /* Bold Green */ #define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */ #define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */ #define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */ #define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */ #define BOLDWHITE "\033[1m\033[37m" /* Bold White */ #ifdef NDEBUG #define LOG_DEBUG(M, ...) #else #define LOG_DEBUG(M, ...) fprintf(stdout, BOLDBLUE "[DBG] %20s -> " M "\n" RESET, __FUNCTION__, ##__VA_ARGS__) #endif #define LOG_RED(M, ...) fprintf(stderr, BOLDRED "[LOG] " M "\n" RESET, ##__VA_ARGS__) #define LOG_GREEN(M, ...) fprintf(stderr, BOLDGREEN "[LOG] " M "\n" RESET, ##__VA_ARGS__) #define LOG_YELLOW(M, ...) fprintf(stderr, BOLDYELLOW "[LOG] " M "\n" RESET, ##__VA_ARGS__) #define LOG_BLUE(M, ...) fprintf(stderr, BOLDBLUE "[LOG] " M "\n" RESET, ##__VA_ARGS__) #define LOG_MAGENTA(M, ...) fprintf(stderr, BOLDMAGENTA "[LOG] " M "\n" RESET, ##__VA_ARGS__) #define LOG_CYAN(M, ...) fprintf(stderr, BOLDCYAN "[LOG] " M "\n" RESET, ##__VA_ARGS__) #define LOG_WHITE(M, ...) fprintf(stderr, BOLDWHITE "[LOG] " M "\n" RESET, ##__VA_ARGS__) #ifndef FUZZING // Enable basic logging for regular builds. #define CLEAN_ERRNO() (errno == 0 ? "None" : (const char *) strerror(errno)) #define LOG_ERR(M, ...) fprintf(stderr, BOLDRED "[ERR] (errno: %s) " M "\n" RESET, CLEAN_ERRNO(), ##__VA_ARGS__) #define LOG_WARN(M, ...) fprintf(stderr, BOLDYELLOW "[WRN] (errno: %s) " M "\n" RESET, CLEAN_ERRNO(), ##__VA_ARGS__) #define LOG_INFO(M, ...) fprintf(stderr, BOLDGREEN "[NFO] " M "\n" RESET, ##__VA_ARGS__) #define LOG_ABORT(M, ...) fprintf(stderr, BOLDRED "[ABORT] (errno: %s) " M "\n" RESET, CLEAN_ERRNO(), ##__VA_ARGS__); abort() #else // Disable all logging on fuzzing builds. #define CLEAN_ERRNO() #define LOG_DEBUG(M, ...) #define LOG_ERR(M, ...) #define LOG_WARN(M, ...) #define LOG_INFO(M, ...) #define LOG_ABORT(M, ...) #endif #endif
43.862069
125
0.622642
13de69c7a1cc708e2eac6d1accd64b57abb69bd0
1,842
c
C
util/stats.c
4LT/GI
b86545582caae08a9ce16b44d68e621cb11e6b79
[ "MIT" ]
1
2017-12-27T10:52:00.000Z
2017-12-27T10:52:00.000Z
util/stats.c
4LT/GI
b86545582caae08a9ce16b44d68e621cb11e6b79
[ "MIT" ]
null
null
null
util/stats.c
4LT/GI
b86545582caae08a9ce16b44d68e621cb11e6b79
[ "MIT" ]
null
null
null
#include "stats.h" #include <string.h> #include <math.h> #include "ops.h" double kth_simple_get(const void *values, int index) { return ((double *)values)[index]; } static void swap_values( const void *values, size_t ai, size_t bi, size_t type_sz) { char *a = (char *)values + ai*type_sz; char *b = (char *)values + bi*type_sz; char *tmp[type_sz]; memcpy(tmp, a, type_sz); memcpy(a, b, type_sz); memcpy(b, tmp, type_sz); } double kth_select(const void *values, int start, int end, int k, kth_accessor_fp get, size_t type_sz) { int length = end - start + 1; int pivot_i = rand() % length + start; double pivot = get(values, pivot_i); swap_values(values, pivot_i, end, type_sz); int l = start, r = end-1; enum { SCAN_LTR, SCAN_RTL } dir = SCAN_LTR; while (l <= r) { if (dir == SCAN_LTR) { if (get(values, l) < pivot) l++; else dir = SCAN_RTL; } else { if (get(values, r) >= pivot) r--; else { swap_values(values, l, r, type_sz); l++; r--; dir = SCAN_LTR; } } } swap_values(values, l, end, type_sz); if (l < k) return kth_select(values, l+1, end, k, get, type_sz); else if (l > k) return kth_select(values, start, l-1, k, get, type_sz); else return get(values, l); } double stats_mad(void *values, int count, kth_accessor_fp get, size_t type_sz) { double deviations[count]; double median = stats_median(values, count, get, type_sz); for (int i = 0; i < count; i++) { deviations[i] = fabs(median - get(values, i)); } return stats_median(deviations, count, kth_simple_get, sizeof(double)); }
26.695652
78
0.549403
9e85bd5b0ac1d02f05f98a314453b68151408166
434
h
C
kernel/drivers/huawei_platform/usb/pd/fsc/core/version.h
wonderful666/marx-10.1.0
a8be8880fe31bff4f94d6e3fad17c455666ff60f
[ "MIT" ]
null
null
null
kernel/drivers/huawei_platform/usb/pd/fsc/core/version.h
wonderful666/marx-10.1.0
a8be8880fe31bff4f94d6e3fad17c455666ff60f
[ "MIT" ]
null
null
null
kernel/drivers/huawei_platform/usb/pd/fsc/core/version.h
wonderful666/marx-10.1.0
a8be8880fe31bff4f94d6e3fad17c455666ff60f
[ "MIT" ]
null
null
null
#ifdef FSC_DEBUG #ifndef __FSC_VERSION_H__ #define __FSC_VERSION_H__ #include "platform.h" /* Program Revision constant. When updating firmware, change this. */ #define FSC_TYPEC_CORE_FW_REV_UPPER 3 #define FSC_TYPEC_CORE_FW_REV_MIDDLE 3 #define FSC_TYPEC_CORE_FW_REV_LOWER 3 FSC_U8 core_get_rev_lower(void); FSC_U8 core_get_rev_middle(void); FSC_U8 core_get_rev_upper(void); #endif // __FSC_VERSION_H_ #endif // FSC_DEBUG
21.7
71
0.81106
7fe8944bccaba7fcb9a61e6478421db643de2ea2
538
c
C
ext/numo/narray/gen/tmpl/extract.c
orlando-labs/numo-narray
6f5c91250c0cb948f6b811385d384c3f15af4dcd
[ "BSD-3-Clause" ]
235
2018-01-15T09:26:04.000Z
2022-03-20T08:33:37.000Z
ext/numo/narray/gen/tmpl/extract.c
orlando-labs/numo-narray
6f5c91250c0cb948f6b811385d384c3f15af4dcd
[ "BSD-3-Clause" ]
114
2018-01-15T09:14:08.000Z
2022-02-20T05:42:54.000Z
ext/numo/narray/gen/tmpl/extract.c
orlando-labs/numo-narray
6f5c91250c0cb948f6b811385d384c3f15af4dcd
[ "BSD-3-Clause" ]
26
2018-03-27T14:50:40.000Z
2022-03-04T13:51:58.000Z
/* Extract an element only if self is a dimensionless NArray. @overload extract @return [Numeric,Numo::NArray] --- Extract element value as Ruby Object if self is a dimensionless NArray, otherwise returns self. */ static VALUE <%=c_func(0)%>(VALUE self) { volatile VALUE v; char *ptr; narray_t *na; GetNArray(self,na); if (na->ndim==0) { ptr = na_get_pointer_for_read(self) + na_get_offset(self); v = m_extract(ptr); na_release_lock(self); return v; } return self; }
22.416667
77
0.637546
3653f44f93f92f41fe1344858b3b739e48769cd3
3,489
h
C
sokoban/boxes.h
tintor/mono
396edd39e45f536cac91b1fa6524f019244e4549
[ "Apache-2.0" ]
1
2020-09-27T05:07:20.000Z
2020-09-27T05:07:20.000Z
sokoban/boxes.h
tintor/mono
396edd39e45f536cac91b1fa6524f019244e4549
[ "Apache-2.0" ]
null
null
null
sokoban/boxes.h
tintor/mono
396edd39e45f536cac91b1fa6524f019244e4549
[ "Apache-2.0" ]
null
null
null
#pragma once #include "core/array_bool.h" #include "core/bits.h" #include "core/exception.h" #include "core/murmur3.h" #include "core/fmt.h" #include "sokoban/cell.h" #include "sokoban/common.h" using Agent = uint; inline bool equal(const vector<char>& a, const vector<char>& b) { size_t m = std::min(a.size(), b.size()); if (!std::equal(a.begin(), a.begin() + m, b.begin())) return false; for (size_t i = m; i < a.size(); i++) if (a[i]) return false; for (size_t i = m; i < b.size(); i++) if (b[i]) return false; return true; } inline bool contains(const vector<char>& a, const vector<char>& b) { for (int i = 0; i < b.size(); i++) { if (b[i] && (i >= a.size() || !a[i])) return false; } return true; } inline size_t hash(const vector<char>& a) { size_t hash = 0; for (size_t i = 0; i < a.size(); i++) if (a[i]) hash ^= size_t(1) << (i % 64); return hash; } struct DynamicBoxes { bool operator[](const Cell* a) const { return operator[](a->id); } void add(const Cell* a) { set(a->id); } void remove(const Cell* a) { reset(a->id); } void move(const Cell* a, const Cell* b) { remove(a); add(b); } void add(uint index) { set(index); } void remove(uint index) { reset(index); } bool operator[](uint index) const { return index < data.size() && data[index]; } void set(uint index) { if (index >= data.size()) data.resize(index + 1); data[index] = 1; } void reset(uint index) { if (index < data.size()) data[index] = 0; } void reset() { data.clear(); } size_t hash() const { return ::hash(data); } bool operator==(const DynamicBoxes& o) const { return equal(data, o.data); } bool contains(const DynamicBoxes& o) const { return ::contains(data, o.data); } template <typename Boxes> operator Boxes() const { Boxes out; for (uint i = 0; i < data.size(); i++) if (data[i]) out.set(i); return out; } void print() {} private: vector<char> data; }; template <int Words> struct DenseBoxes { bool operator[](const Cell* a) const { return operator[](a->id); } void add(const Cell* a) { set(a->id); } void remove(const Cell* a) { reset(a->id); } void move(const Cell* a, const Cell* b) { remove(a); add(b); } void add(uint index) { set(index); } void remove(uint index) { reset(index); } operator DynamicBoxes() { DynamicBoxes out; for (uint i = 0; i < data.size(); i++) if (data[i]) out.set(i); return out; } bool operator[](uint index) const { return index < data.size() && data[index]; } void set(uint index) { if (index >= data.size()) THROW(runtime_error, "out of range {} : {}", index, data.size()); data.set(index); } void reset(uint index) { if (index >= data.size()) THROW(runtime_error, "out of range"); data.reset(index); } void reset() { data.reset(); } bool operator==(const DenseBoxes& o) const { return data == o.data; } auto hash() const { return std::hash<decltype(data)>()(data); } bool contains(const DenseBoxes& o) const { return data.contains(o.data); } void print() {} private: array_bool<32 * Words> data; }; using BigBoxes = DenseBoxes<32>; namespace std { template <typename T, size_t Size> struct hash<array<T, Size>> { size_t operator()(const array<T, Size>& a) const { return MurmurHash3_x64_128(&a, sizeof(a), 0); } }; } // namespace std
30.605263
102
0.585555
d26f2e37367429224547c8bdd8f219a9bb29ce51
11,819
h
C
eth-pop3.h
litanparida1991/C_Communications_Ethernet_TCP_IP_Driver
6d0e9a139fbbefdaf7b6517d351e6fee68beb959
[ "MIT" ]
35
2015-02-06T19:33:50.000Z
2021-06-27T20:12:36.000Z
eth-pop3.h
ibexuk/C_Communications_Ethernet_TCP_IP_Driver
6d0e9a139fbbefdaf7b6517d351e6fee68beb959
[ "MIT" ]
null
null
null
eth-pop3.h
ibexuk/C_Communications_Ethernet_TCP_IP_Driver
6d0e9a139fbbefdaf7b6517d351e6fee68beb959
[ "MIT" ]
21
2016-03-31T09:55:18.000Z
2021-09-15T09:33:46.000Z
/* IBEX UK LTD http://www.ibexuk.com Electronic Product Design Specialists RELEASED SOFTWARE The MIT License (MIT) Copyright (c) 2013, IBEX UK Ltd, http://ibexuk.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. */ //Project Name: TCP/IP DRIVER //POP3 (POST OFFICE PROTOCOL) C CODE HEADER FILE //################################## //################################## //########## USING DRIVER ########## //################################## //################################## //############################# //##### TO RECEIVE EMAILS ##### //############################# /* //------------------------------- //----- START EMAIL RECEIVE ----- //------------------------------- //If POP3_USING_CONST_ROM_SETTINGS is commented out load the byte arrays your using for the following string defines: POP3_SERVER_STRING POP3_USERNAME_STRING POP3_PASSWORD_STRING email_start_receive(); //Trigger receiving email //---------------------------------------------------------------- //----- FUNCTION TO PROCESS EACH LINE OF EACH RECEIVED EMAIL ----- //---------------------------------------------------------------- BYTE process_pop3_received_email_line (BYTE status, BYTE *string, BYTE *sender_email_address) { BYTE count; BYTE *p_dest; if (status == 0) { //----- START OF A NEW EMAIL - THIS IS THE SUBJECT ----- //Process as desired return(0); } else if (status == 1) { //----- NEXT LINE OF THIS EMAIL ----- //Process as desired return(0); } else { //----- END OF EMAIL ----- return(1); //0x01 = delete email, 0x00 = don't delete this email } } */ //########################################################## //##### TO INDICATE RECEIVE EMAIL PROGRESS TO THE USER ##### //########################################################## /* //Include the DO_POP3_PROGRESS_STRING define to enable these messages //Edit the strings in eth-pop3.h as desired if (email_is_receive_active()) { //----- WE ARE RECEIVING EMAIL ----- //CHECK FOR UPDATE USER DISPLAY if (pop3_email_progress_string_update) { //RECEIVE EMAIL STATUS HAS CHANGED - UPDATE DISPLAY pop3_email_progress_string_update = 0; //... = &pop3_email_progress_string[0]; //Display the status null terminated string to the user on our screen } } */ //For further information please see the project technical manual //******************************** //******************************** //********** DO DEFINES ********** //******************************** //******************************** #ifndef ETH_POP3_C_INIT //Do only once the first time this file is used #define ETH_POP3_C_INIT #include "eth-main.h" #include "eth-tcp.h" //----- USE USER INTERFACE PROGRESS STRINGS? ----- //(See later in this file for details) #define DO_POP3_PROGRESS_STRING //Comment out if not required. The strings may optionally be used to provide the //user with the current state of the send mail process //----- FUNCTION TO PROCESS RECEIVED EMAILS ----- //The function name in your application that will be called with each line of received emails #define POP3_PROCESS_RECEIVED_EMAIL_LINE_FUNCTION process_pop3_received_email_line //Your function definition needs to be: // BYTE my_function_name (BYTE status, BYTE *string, BYTE *sender_email_address) //status: // 0 = this is the start of a new email received. The string contains the contents of the subject line. Return value is don't care // 1 = this is the next line of the email body (excluding the trailing <CR><LF>). Return value is don't care. // 2 = End of email. string is null. Return 1 to delete email, return 0 to leave email in mailbox. //sender_email_address // Pointer to string included to allow your function to identify the sender and optionally store the sender if you will reply with an email. //You need to #include the file that contains your function definition at the top of eth-pop3.c for the compiler //----- EMAIL CONFIGURATION ----- #define POP3_RECEIVE_MESSAGE_STRING_MAX_LEN 81 //Max length of each received line in an email header or body (including terminating null) (extra characters will be dumped) //Smaller value to reduce ram requirement, bigger value to avoid issues with truncated lines. #define POP3_REPLY_TO_STRING_LEN 36 //Max length of the 'reply to' email address (the senders email) (including terminating null) //Smaller value to reduce ram requirement, but ensure its big enough to hold the maximum expected email address. //TIMEOUTS #define EMAIL_DO_DNS_TIMEOUT_x100MS 250 #define EMAIL_DO_ARP_TIMEOUT_x100MS 250 #define EMAIL_WAIT_TCP_CONNECTION_TIMEOUT_x100MS 350 #define EMAIL_WAIT_SERVER_MESSAGE_TIMEOUT_x100MS 600 //This needs to be long to deal with servers that are busy and take a long time to give a welcome message etc. //If too short then we can FIN a connection and start a new connection, but the new connection will never work //as each time the server will have cached the last FIN request and when it finally responds with its welcome //message it will then process the previous FIN request and close the conneciton. //TCP PORTS #define POP3_REMOTE_PORT 110 //POP3 TASK STATE MACHINE STATES typedef enum _POP3_STATE { SM_POP3_IDLE, SM_POP3_GET_EMAIL, SM_POP3_WAITING_DNS_RESPONSE, SM_POP3_SEND_ARP_REQUEST, SM_POP3_WAIT_FOR_ARP_RESPONSE, SM_POP3_OPEN_TCP_CONNECTION, SM_POP3_WAIT_FOR_TCP_CONNECTION, SM_POP3_WAIT_FOR_POP3_SERVER_GREETING, SM_POP3_SEND_POP3_USERNAME, SM_POP3_WAIT_FOR_POP3_USER_RESPONSE, SM_POP3_SEND_POP3_PASSWORD, SM_POP3_WAIT_FOR_POP3_PASS_RESPONSE, SM_POP3_SEND_POP3_STAT_REQUEST, SM_POP3_WAIT_FOR_POP3_STAT_RESPONSE, SM_POP3_WAIT_GET_NEXT_EMAIL, SM_POP3_WAIT_GET_NEXT_EMAIL_RESPONSE, SM_POP3_WAIT_GET_NEXT_EMAIL_RECEIVE, SM_POP3_DO_DELETE, SM_POP3_DO_DELETE_RESPONSE, SM_POP3_DO_QUIT, SM_POP3_WAIT_FOR_POP3_QUIT_RESPONSE, SM_POP3_FAILED } POP3_STATE; #endif //--------------------------------- //----- POP3 ACCOUNT SETTINGS ----- //--------------------------------- #ifdef ETH_POP3_C //----- SERVER SETTINGS ----- //USE HARD CODED ROM STRINGS OR VARAIBLE STRINGS? //#define POP3_USING_CONST_ROM_SETTINGS //Comment out if using variables to store the settings #ifdef POP3_USING_CONST_ROM_SETTINGS //DEFINE HARD CODED CONSTANT STRINGS IF USED CONSTANT BYTE POP3_SERVER_STRING[] = {"pop.yahoo.co.uk"}; CONSTANT BYTE POP3_USERNAME_STRING[] = {"embedded-code"}; CONSTANT BYTE POP3_PASSWORD_STRING[] = {"ourpassword"}; #else //DEFINE VARIABLE STRINGS IF BEING USED - MUST BE BYTE ARRAYS AND NULL TERMINATED (0X00 REQUIRED AFTER LAST CHARACTER - IF YOU FORGET THIS EXPECT HORRIBLE BUGS!) #define POP3_SERVER_STRING our_pop3_server #define POP3_USERNAME_STRING our_pop3_username #define POP3_PASSWORD_STRING our_pop3_password #endif //----- USER INTERFACE PROGRESS STRINGS ----- //If enabled the driver will load the pointer pop3_email_progress_string_pointer with each string and set pop3_email_progress_string_update each time the status changes //You may edit the strings as desired #ifdef DO_POP3_PROGRESS_STRING CONSTANT BYTE pop3_email_progress_string_null[] = {" "}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_dns_resp[] = {"Getting POP3 DNS"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_arp_resp[] = {"Getting POP3 ARP"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_tcp_conn[] = {"Getting POP3 TCP con"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_greeting[] = {"Waiting POP3 hello"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_user[] = {"Sent POP3 username"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_password[] = {"Sent POP3 password"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_stat[] = {"Waiting POP3 count"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_header[] = {"Reading emails"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_delete[] = {"Deleting email to me"}; CONSTANT BYTE pop3_email_progress_string_wait_pop3_quit[] = {"Logging off POP3"}; CONSTANT BYTE pop3_email_progress_string_complete[] = {"Receive email complete"}; CONSTANT BYTE pop3_email_progress_string_failed[] = {"Receive email failed!"}; #endif //DRIVER STRINGS CONSTANT BYTE pop3_reply_to_string[] = {"from:"}; //Use 'from:' as this must occur in an email header whereas 'reply-to:' does not always occur CONSTANT BYTE pop3_subject_string[] = {"subject:"}; #endif //******************************* //******************************* //********** FUNCTIONS ********** //******************************* //******************************* #ifdef ETH_POP3_C //----------------------------------- //----- INTERNAL ONLY FUNCTIONS ----- //----------------------------------- void email_return_pop3_url (BYTE *string_pointer, BYTE max_length); void email_return_pop3_username (BYTE *string_pointer, BYTE max_length); void email_return_pop3_password (BYTE *string_pointer, BYTE max_length); //----------------------------------------- //----- INTERNAL & EXTERNAL FUNCTIONS ----- //----------------------------------------- //(Also defined below as extern) BYTE email_start_receive (void); BYTE email_is_receive_active (void); void email_process_pop3 (void); #else //------------------------------ //----- EXTERNAL FUNCTIONS ----- //------------------------------ extern BYTE email_start_receive (void); extern BYTE email_is_receive_active (void); extern void email_process_pop3 (void); #endif //**************************** //**************************** //********** MEMORY ********** //**************************** //**************************** #ifdef ETH_POP3_C //-------------------------------------------- //----- INTERNAL ONLY MEMORY DEFINITIONS ----- //-------------------------------------------- BYTE pop3_tcp_socket = TCP_INVALID_SOCKET; DEVICE_INFO pop3_server_node; WORD pop3_100ms_timeout_timer; BYTE pop3_receive_message_string[POP3_RECEIVE_MESSAGE_STRING_MAX_LEN]; BYTE pop3_receive_message_string_len; //-------------------------------------------------- //----- INTERNAL & EXTERNAL MEMORY DEFINITIONS ----- //-------------------------------------------------- //(Also defined below as extern) BYTE sm_pop3 = SM_POP3_IDLE; BYTE email_reply_to_string[POP3_REPLY_TO_STRING_LEN]; #ifdef DO_POP3_PROGRESS_STRING CONSTANT BYTE *pop3_email_progress_string_pointer; BYTE pop3_email_progress_string_update; #endif #else //--------------------------------------- //----- EXTERNAL MEMORY DEFINITIONS ----- //--------------------------------------- extern BYTE sm_pop3; extern BYTE email_reply_to_string[POP3_REPLY_TO_STRING_LEN]; #ifdef DO_POP3_PROGRESS_STRING extern CONSTANT BYTE *pop3_email_progress_string_pointer; extern BYTE pop3_email_progress_string_update; #endif #endif
36.591331
173
0.662577
3c2f0c0685a72d3d73d7696028b3f3bb953af144
2,075
h
C
NFComm/NFKernelPlugin/NFCEventModule.h
sosan/NoahGameFrame
38c54014c5c4620b784b2c1d2cab256f42bae186
[ "Apache-2.0" ]
null
null
null
NFComm/NFKernelPlugin/NFCEventModule.h
sosan/NoahGameFrame
38c54014c5c4620b784b2c1d2cab256f42bae186
[ "Apache-2.0" ]
null
null
null
NFComm/NFKernelPlugin/NFCEventModule.h
sosan/NoahGameFrame
38c54014c5c4620b784b2c1d2cab256f42bae186
[ "Apache-2.0" ]
1
2017-12-29T06:49:20.000Z
2017-12-29T06:49:20.000Z
// ------------------------------------------------------------------------- // @FileName : NFCEventModule.h // @Author : LvSheng.Huang // @Date : 2012-12-15 // @Module : NFCEventModule // // ------------------------------------------------------------------------- #ifndef NFC_EVENT_MODULE_H #define NFC_EVENT_MODULE_H #include <iostream> #include "NFComm/NFCore/NFIObject.h" #include "NFComm/NFPluginModule/NFGUID.h" #include "NFComm/NFPluginModule/NFIEventModule.h" #include "NFComm/NFPluginModule/NFIKernelModule.h" class NFCEventModule : public NFIEventModule { public: NFCEventModule(NFIPluginManager* p) { pPluginManager = p; } virtual ~NFCEventModule() { } virtual bool Init(); virtual bool AfterInit(); virtual bool BeforeShut(); virtual bool Shut(); virtual bool Execute(); virtual bool DoEvent(const NFEventDefine nEventID, const NFDataList& valueList); virtual bool ExistEventCallBack(const NFEventDefine nEventID); virtual bool RemoveEventCallBack(const NFEventDefine nEventID); ////////////////////////////////////////////////////////// virtual bool DoEvent(const NFGUID self, const NFEventDefine nEventID, const NFDataList& valueList); virtual bool ExistEventCallBack(const NFGUID self, const NFEventDefine nEventID); virtual bool RemoveEventCallBack(const NFGUID self, const NFEventDefine nEventID); virtual bool RemoveEventCallBack(const NFGUID self); protected: virtual bool AddEventCallBack(const NFEventDefine nEventID, const MODULE_EVENT_FUNCTOR_PTR cb); virtual bool AddEventCallBack(const NFGUID self, const NFEventDefine nEventID, const OBJECT_EVENT_FUNCTOR_PTR cb); private: NFIKernelModule* m_pKernelodule; private: // for module NFList<NFEventDefine> mModuleRemoveListEx; NFMapEx<NFEventDefine, NFList<MODULE_EVENT_FUNCTOR_PTR>> mModuleEventInfoMapEx; //for object NFList<NFGUID> mObjectRemoveListEx; NFMapEx<NFGUID, NFMapEx<NFEventDefine, NFList<OBJECT_EVENT_FUNCTOR_PTR>>> mObjectEventInfoMapEx; }; #endif
29.225352
115
0.681928
82d479249ea7b424361e810b87327096067045bf
33,810
c
C
grlib/fonts/fontcmsc42.c
astroesteban/tivaware
379dad8248c0ffe110cbc2819c7456d241e90bd0
[ "BSD-3-Clause" ]
null
null
null
grlib/fonts/fontcmsc42.c
astroesteban/tivaware
379dad8248c0ffe110cbc2819c7456d241e90bd0
[ "BSD-3-Clause" ]
null
null
null
grlib/fonts/fontcmsc42.c
astroesteban/tivaware
379dad8248c0ffe110cbc2819c7456d241e90bd0
[ "BSD-3-Clause" ]
1
2022-02-23T06:19:48.000Z
2022-02-23T06:19:48.000Z
//***************************************************************************** // // fontcmsc42.c - Font definition for the 42pt Cmsc font. // // Copyright (c) 2011-2020 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2.2.0.295 of the Tiva Graphics Library. // //***************************************************************************** //***************************************************************************** // // This file is generated by ftrasterize; DO NOT EDIT BY HAND! // //***************************************************************************** #include <stdint.h> #include <stdbool.h> #include "grlib/grlib.h" //***************************************************************************** // // Details of this font: // Characters: 32 to 126 inclusive // Style: cmsc // Size: 42 point // Bold: no // Italic: no // Memory usage: 5796 bytes // //***************************************************************************** //***************************************************************************** // // The compressed data for the 42 point Cmsc font. // Contains characters 32 to 126 inclusive. // //***************************************************************************** static const uint8_t g_pui8Cmsc42Data[5595] = { 5, 17, 0, 91, 48, 34, 8, 146, 84, 68, 68, 68, 68, 68, 68, 68, 82, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 240, 240, 130, 84, 68, 68, 82, 0, 11, 80, 33, 18, 0, 6, 115, 98, 100, 84, 85, 69, 69, 69, 82, 17, 67, 17, 129, 129, 129, 129, 129, 129, 113, 129, 114, 113, 129, 114, 98, 114, 0, 63, 112, 115, 36, 0, 15, 50, 145, 240, 146, 130, 240, 145, 146, 240, 130, 145, 240, 146, 130, 240, 146, 130, 240, 145, 146, 240, 130, 130, 240, 146, 130, 240, 145, 146, 240, 130, 145, 240, 146, 130, 240, 146, 130, 240, 145, 146, 207, 15, 2, 242, 130, 240, 145, 145, 240, 146, 145, 240, 146, 130, 240, 146, 130, 240, 145, 145, 240, 146, 130, 255, 15, 2, 194, 145, 240, 146, 130, 240, 146, 130, 240, 145, 146, 240, 130, 145, 240, 146, 130, 240, 146, 130, 240, 130, 145, 240, 146, 130, 240, 146, 130, 240, 145, 146, 240, 130, 145, 240, 146, 130, 240, 146, 130, 0, 15, 112, 81, 21, 240, 225, 240, 81, 240, 40, 178, 49, 66, 130, 65, 97, 98, 81, 97, 82, 97, 83, 66, 97, 68, 66, 97, 68, 67, 81, 82, 83, 81, 211, 65, 213, 33, 232, 233, 218, 217, 232, 209, 52, 209, 68, 193, 83, 82, 81, 98, 68, 65, 98, 68, 65, 98, 67, 81, 98, 65, 113, 97, 97, 97, 82, 97, 97, 81, 129, 81, 66, 146, 49, 35, 199, 240, 33, 240, 81, 0, 25, 16, 122, 36, 84, 240, 49, 178, 50, 240, 18, 162, 82, 227, 147, 99, 179, 163, 97, 19, 116, 178, 129, 55, 33, 179, 129, 178, 179, 129, 162, 195, 129, 146, 211, 129, 146, 211, 129, 130, 227, 129, 114, 240, 18, 129, 113, 240, 35, 97, 114, 240, 50, 97, 98, 240, 66, 81, 98, 240, 98, 49, 114, 240, 131, 114, 145, 240, 130, 130, 18, 240, 98, 98, 81, 240, 66, 114, 97, 240, 34, 114, 113, 240, 18, 130, 129, 242, 115, 129, 226, 131, 129, 210, 147, 129, 210, 147, 129, 194, 163, 129, 178, 179, 129, 162, 210, 113, 178, 211, 97, 162, 242, 82, 146, 240, 34, 50, 162, 240, 52, 0, 41, 64, 96, 34, 240, 240, 227, 240, 227, 33, 240, 195, 50, 240, 178, 81, 240, 163, 81, 240, 163, 81, 240, 163, 81, 240, 163, 81, 240, 163, 65, 240, 179, 65, 240, 179, 49, 240, 211, 33, 240, 211, 17, 240, 228, 169, 179, 212, 243, 210, 244, 209, 241, 35, 177, 241, 51, 161, 241, 83, 145, 225, 99, 129, 225, 131, 98, 210, 132, 81, 211, 147, 65, 227, 163, 33, 243, 166, 161, 68, 164, 177, 83, 180, 161, 99, 145, 20, 129, 132, 82, 68, 66, 183, 134, 0, 47, 96, 19, 9, 240, 211, 84, 85, 69, 82, 17, 129, 129, 129, 113, 114, 113, 98, 0, 32, 48, 46, 15, 146, 194, 194, 194, 194, 210, 194, 210, 194, 210, 195, 194, 195, 195, 195, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 210, 211, 195, 195, 210, 211, 195, 210, 211, 210, 226, 211, 210, 226, 226, 226, 64, 46, 14, 1, 210, 210, 210, 210, 194, 210, 195, 194, 195, 179, 194, 195, 179, 179, 195, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 178, 194, 179, 179, 178, 194, 179, 178, 194, 178, 193, 194, 178, 178, 178, 193, 208, 47, 20, 114, 240, 50, 240, 50, 240, 50, 193, 82, 81, 83, 66, 67, 83, 50, 51, 131, 18, 19, 195, 18, 240, 18, 240, 19, 18, 179, 34, 35, 100, 50, 52, 67, 66, 82, 178, 240, 50, 240, 50, 240, 50, 0, 63, 112, 93, 34, 0, 27, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 63, 15, 240, 50, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 240, 240, 34, 0, 32, 20, 9, 0, 30, 67, 84, 85, 69, 84, 129, 129, 129, 113, 129, 113, 114, 113, 240, 240, 64, 9, 16, 0, 44, 12, 76, 0, 38, 64, 12, 8, 0, 27, 18, 84, 68, 68, 82, 0, 11, 80, 89, 21, 242, 240, 66, 240, 65, 240, 66, 240, 66, 240, 65, 240, 66, 240, 66, 240, 50, 240, 66, 240, 65, 240, 66, 240, 66, 240, 65, 240, 66, 240, 66, 240, 50, 240, 66, 240, 66, 240, 50, 240, 66, 240, 65, 240, 66, 240, 66, 240, 50, 240, 66, 240, 66, 240, 50, 240, 66, 240, 65, 240, 66, 240, 66, 240, 65, 240, 66, 240, 66, 240, 50, 240, 66, 240, 65, 240, 66, 240, 66, 240, 65, 240, 66, 240, 66, 240, 64, 63, 22, 0, 9, 6, 227, 67, 178, 130, 146, 162, 130, 162, 115, 163, 98, 194, 98, 194, 83, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 67, 195, 82, 194, 99, 178, 99, 163, 114, 162, 131, 131, 146, 130, 179, 67, 230, 0, 31, 64, 61, 19, 0, 8, 17, 240, 19, 229, 165, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 240, 19, 245, 159, 0, 26, 80, 65, 22, 0, 8, 119, 225, 84, 162, 131, 145, 148, 113, 180, 97, 180, 83, 180, 68, 164, 68, 164, 68, 164, 82, 180, 240, 52, 240, 36, 240, 52, 240, 36, 240, 51, 240, 51, 240, 51, 240, 51, 240, 50, 240, 66, 240, 66, 240, 66, 161, 130, 177, 114, 178, 98, 193, 111, 1, 111, 1, 95, 2, 0, 30, 112, 62, 21, 0, 8, 85, 226, 67, 177, 115, 145, 147, 114, 147, 115, 132, 100, 116, 100, 116, 114, 132, 240, 35, 240, 51, 240, 35, 240, 50, 240, 35, 230, 240, 83, 240, 68, 240, 52, 240, 36, 240, 52, 240, 36, 82, 164, 68, 148, 68, 148, 68, 147, 83, 148, 97, 163, 131, 84, 198, 0, 30, 16, 70, 24, 0, 10, 97, 240, 114, 240, 99, 240, 99, 240, 84, 240, 65, 19, 240, 65, 19, 240, 49, 35, 240, 33, 51, 240, 33, 51, 240, 17, 67, 241, 83, 241, 83, 225, 99, 210, 99, 209, 115, 193, 131, 178, 131, 177, 147, 161, 163, 146, 163, 159, 5, 240, 19, 240, 99, 240, 99, 240, 99, 240, 99, 240, 99, 240, 43, 0, 33, 80, 60, 22, 0, 11, 46, 141, 155, 177, 23, 209, 240, 97, 240, 97, 240, 97, 240, 97, 240, 97, 240, 97, 54, 193, 18, 83, 163, 115, 146, 147, 240, 68, 240, 67, 240, 68, 240, 52, 240, 52, 67, 180, 68, 164, 68, 164, 67, 179, 81, 196, 97, 179, 129, 147, 162, 84, 214, 0, 31, 80, 64, 23, 0, 9, 102, 243, 67, 179, 129, 163, 116, 146, 132, 131, 132, 115, 147, 131, 240, 68, 240, 67, 240, 83, 240, 68, 54, 164, 33, 83, 132, 17, 115, 117, 147, 101, 163, 84, 179, 84, 180, 68, 180, 68, 180, 68, 180, 83, 180, 83, 180, 83, 179, 115, 163, 130, 147, 147, 115, 194, 83, 245, 0, 33, 63, 23, 0, 11, 81, 240, 127, 3, 79, 3, 95, 2, 98, 210, 97, 210, 113, 209, 129, 193, 240, 98, 240, 82, 240, 82, 240, 97, 240, 98, 240, 97, 240, 98, 240, 98, 240, 83, 240, 82, 240, 83, 240, 83, 240, 83, 240, 68, 240, 68, 240, 68, 240, 68, 240, 68, 240, 68, 240, 82, 0, 33, 64, 62, 23, 0, 9, 70, 226, 99, 178, 146, 146, 178, 129, 210, 98, 210, 98, 210, 99, 194, 100, 162, 133, 130, 134, 98, 167, 50, 201, 240, 23, 240, 25, 194, 56, 146, 103, 114, 149, 98, 181, 66, 227, 66, 227, 66, 242, 66, 242, 66, 242, 82, 225, 99, 194, 115, 162, 163, 98, 231, 0, 32, 112, 66, 23, 0, 9, 70, 242, 82, 195, 114, 163, 146, 147, 147, 115, 163, 115, 179, 84, 179, 84, 179, 84, 180, 68, 180, 68, 180, 68, 180, 68, 180, 83, 165, 84, 149, 99, 129, 20, 115, 113, 20, 131, 66, 36, 165, 67, 240, 83, 240, 83, 240, 67, 131, 147, 116, 131, 132, 130, 148, 114, 178, 99, 231, 0, 33, 16, 19, 8, 0, 13, 18, 84, 68, 68, 82, 0, 9, 98, 84, 68, 68, 82, 0, 11, 80, 27, 9, 0, 14, 99, 100, 69, 84, 83, 0, 10, 115, 100, 69, 84, 84, 129, 129, 129, 113, 129, 114, 113, 113, 240, 240, 64, 56, 31, 0, 38, 2, 240, 196, 240, 164, 240, 149, 240, 148, 240, 164, 240, 164, 240, 164, 240, 164, 240, 148, 240, 164, 240, 164, 240, 179, 240, 228, 240, 228, 240, 228, 240, 229, 240, 228, 240, 228, 240, 228, 240, 228, 240, 228, 240, 229, 240, 228, 240, 226, 0, 35, 48, 13, 33, 0, 70, 31, 14, 0, 29, 63, 14, 0, 70, 80, 56, 31, 0, 34, 114, 240, 228, 240, 229, 240, 228, 240, 228, 240, 228, 240, 228, 240, 229, 240, 228, 240, 228, 240, 228, 240, 228, 240, 227, 240, 180, 240, 149, 240, 148, 240, 164, 240, 164, 240, 164, 240, 149, 240, 148, 240, 164, 240, 164, 240, 164, 240, 194, 0, 38, 64, 54, 19, 0, 7, 87, 162, 99, 113, 162, 83, 147, 68, 131, 68, 131, 82, 147, 240, 18, 240, 19, 243, 243, 240, 18, 240, 18, 240, 33, 240, 49, 240, 33, 240, 49, 240, 49, 240, 49, 240, 49, 240, 49, 0, 9, 35, 244, 245, 228, 240, 19, 0, 27, 48, 108, 33, 0, 13, 104, 240, 115, 115, 240, 66, 194, 242, 242, 210, 240, 49, 178, 118, 113, 161, 99, 66, 98, 129, 99, 113, 97, 113, 99, 145, 97, 97, 83, 179, 49, 97, 83, 179, 49, 81, 83, 195, 65, 65, 83, 195, 65, 65, 83, 195, 65, 65, 83, 195, 65, 65, 83, 195, 65, 65, 83, 195, 65, 65, 83, 195, 65, 81, 83, 179, 65, 81, 83, 179, 65, 82, 83, 148, 49, 113, 99, 113, 19, 49, 114, 99, 66, 51, 33, 130, 118, 84, 162, 240, 240, 34, 240, 240, 50, 240, 19, 211, 164, 240, 74, 0, 46, 112, 91, 34, 0, 6, 2, 240, 240, 34, 240, 240, 20, 240, 244, 240, 244, 240, 230, 240, 209, 20, 240, 209, 20, 240, 194, 36, 240, 177, 52, 240, 177, 67, 240, 162, 68, 240, 145, 84, 240, 145, 99, 240, 130, 100, 240, 113, 116, 240, 98, 132, 240, 82, 132, 240, 81, 148, 240, 66, 164, 240, 63, 1, 240, 49, 180, 240, 34, 196, 240, 17, 212, 240, 17, 227, 242, 228, 225, 244, 225, 240, 19, 210, 240, 20, 180, 244, 137, 156, 0, 47, 32, 65, 30, 0, 11, 47, 4, 243, 164, 211, 196, 179, 212, 163, 212, 163, 228, 147, 228, 147, 228, 147, 228, 147, 212, 163, 211, 179, 195, 195, 163, 238, 240, 19, 180, 195, 211, 179, 212, 163, 228, 147, 243, 147, 244, 131, 244, 131, 244, 131, 244, 131, 244, 131, 228, 147, 212, 163, 196, 179, 180, 143, 5, 0, 42, 64, 82, 31, 0, 13, 23, 113, 212, 99, 50, 179, 178, 34, 163, 213, 131, 240, 20, 116, 240, 35, 115, 240, 51, 99, 240, 82, 84, 240, 82, 84, 240, 82, 83, 240, 113, 68, 240, 196, 240, 196, 240, 196, 240, 196, 240, 196, 240, 196, 240, 211, 240, 113, 84, 240, 97, 84, 240, 97, 99, 240, 97, 115, 240, 65, 132, 240, 49, 148, 240, 17, 180, 225, 227, 178, 240, 36, 98, 240, 104, 0, 44, 16, 86, 33, 0, 12, 63, 4, 240, 51, 164, 240, 19, 211, 227, 227, 211, 243, 195, 240, 19, 179, 240, 20, 163, 240, 35, 163, 240, 36, 147, 240, 36, 147, 240, 51, 147, 240, 52, 131, 240, 52, 131, 240, 52, 131, 240, 52, 131, 240, 52, 131, 240, 52, 131, 240, 52, 131, 240, 52, 131, 240, 51, 147, 240, 36, 147, 240, 35, 163, 240, 35, 163, 240, 19, 179, 243, 195, 227, 211, 211, 227, 180, 191, 4, 0, 47, 16, 80, 30, 0, 11, 47, 9, 164, 181, 164, 211, 164, 226, 164, 241, 164, 241, 164, 241, 164, 240, 17, 148, 129, 113, 148, 129, 240, 36, 129, 240, 36, 129, 240, 36, 114, 240, 45, 240, 36, 99, 240, 36, 114, 240, 36, 129, 240, 36, 129, 240, 36, 129, 129, 132, 240, 33, 132, 240, 33, 132, 240, 17, 148, 240, 17, 148, 240, 17, 148, 242, 148, 242, 148, 227, 148, 196, 111, 9, 0, 42, 64, 28, 0, 10, 79, 8, 148, 180, 148, 211, 132, 226, 132, 226, 132, 241, 132, 241, 132, 241, 132, 241, 132, 129, 97, 132, 129, 244, 129, 244, 129, 244, 114, 253, 244, 99, 244, 114, 244, 129, 244, 129, 244, 129, 244, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 93, 0, 40, 48, 85, 34, 0, 14, 24, 113, 240, 19, 99, 66, 227, 177, 35, 211, 213, 179, 240, 20, 179, 240, 35, 163, 240, 51, 147, 240, 82, 147, 240, 82, 132, 240, 82, 132, 240, 82, 116, 240, 113, 116, 240, 244, 240, 244, 240, 244, 240, 244, 240, 244, 240, 244, 221, 84, 240, 52, 132, 240, 52, 147, 240, 52, 148, 240, 36, 163, 240, 36, 179, 240, 20, 195, 229, 212, 193, 19, 244, 115, 50, 240, 56, 113, 0, 47, 80, 65, 33, 0, 12, 60, 92, 132, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 207, 6, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 196, 212, 140, 92, 0, 45, 112, 36, 18, 0, 6, 110, 148, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 158, 0, 25, 32, 62, 21, 0, 8, 91, 243, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 240, 51, 131, 115, 117, 99, 117, 99, 117, 83, 147, 99, 161, 99, 199, 0, 30, 32, 85, 35, 0, 13, 28, 153, 148, 229, 196, 242, 228, 226, 244, 210, 240, 20, 194, 240, 36, 178, 240, 52, 162, 240, 68, 146, 240, 84, 130, 240, 100, 114, 240, 116, 98, 240, 132, 84, 240, 116, 70, 240, 100, 49, 36, 240, 100, 33, 68, 240, 86, 85, 240, 69, 116, 240, 68, 148, 240, 52, 149, 240, 36, 164, 240, 36, 180, 240, 20, 196, 244, 196, 244, 212, 228, 228, 212, 229, 196, 230, 124, 139, 0, 48, 80, 65, 28, 0, 10, 77, 240, 68, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 240, 148, 241, 132, 241, 132, 241, 132, 225, 148, 225, 148, 225, 148, 210, 148, 210, 148, 195, 148, 165, 95, 8, 0, 39, 16, 120, 39, 0, 14, 88, 240, 72, 132, 240, 68, 193, 19, 240, 33, 19, 193, 19, 240, 33, 19, 193, 19, 240, 33, 19, 193, 35, 241, 35, 193, 35, 241, 35, 193, 51, 209, 51, 193, 51, 209, 51, 193, 51, 209, 51, 193, 67, 177, 67, 193, 67, 177, 67, 193, 83, 145, 83, 193, 83, 145, 83, 193, 83, 145, 83, 193, 99, 113, 99, 193, 99, 113, 99, 193, 100, 81, 115, 193, 115, 81, 115, 193, 115, 81, 115, 193, 131, 49, 131, 193, 131, 49, 131, 193, 132, 17, 147, 193, 147, 17, 147, 193, 147, 17, 147, 193, 163, 163, 193, 163, 163, 180, 131, 163, 137, 113, 123, 0, 54, 16, 86, 32, 0, 12, 8, 185, 132, 227, 181, 225, 193, 20, 209, 193, 36, 193, 193, 36, 193, 193, 52, 177, 193, 68, 161, 193, 68, 161, 193, 84, 145, 193, 100, 129, 193, 100, 129, 193, 116, 113, 193, 132, 97, 193, 132, 97, 193, 148, 81, 193, 164, 65, 193, 164, 65, 193, 180, 49, 193, 196, 33, 193, 196, 33, 193, 212, 17, 193, 229, 193, 229, 193, 244, 193, 240, 19, 193, 240, 19, 179, 240, 18, 137, 225, 0, 45, 86, 33, 0, 13, 103, 240, 131, 100, 240, 51, 179, 243, 211, 211, 243, 179, 240, 35, 148, 240, 36, 131, 240, 67, 116, 240, 68, 100, 240, 68, 99, 240, 99, 84, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 84, 240, 83, 100, 240, 68, 100, 240, 68, 115, 240, 67, 132, 240, 36, 148, 240, 19, 179, 243, 211, 211, 244, 163, 240, 52, 84, 240, 135, 0, 47, 32, 62, 29, 0, 10, 127, 3, 243, 164, 195, 195, 179, 211, 163, 227, 147, 228, 131, 228, 131, 228, 131, 228, 131, 228, 131, 227, 147, 211, 163, 195, 179, 164, 206, 243, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 124, 0, 42, 113, 33, 0, 13, 103, 240, 132, 99, 240, 67, 163, 243, 211, 211, 243, 180, 240, 19, 163, 240, 36, 131, 240, 67, 131, 240, 68, 100, 240, 68, 100, 240, 83, 84, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 68, 240, 100, 84, 240, 83, 100, 240, 68, 115, 240, 68, 116, 240, 51, 147, 116, 99, 179, 81, 66, 67, 195, 49, 97, 51, 227, 33, 113, 18, 240, 53, 99, 240, 122, 113, 240, 131, 97, 240, 146, 97, 240, 146, 82, 240, 147, 51, 240, 152, 240, 183, 240, 182, 240, 212, 0, 13, 32, 83, 34, 0, 12, 111, 2, 240, 99, 147, 240, 67, 179, 240, 35, 195, 240, 19, 196, 243, 212, 227, 212, 227, 212, 227, 212, 227, 212, 227, 196, 243, 195, 240, 19, 179, 240, 35, 147, 240, 77, 240, 99, 132, 240, 67, 148, 240, 51, 164, 240, 35, 180, 240, 19, 180, 240, 19, 180, 240, 19, 180, 240, 19, 180, 240, 19, 181, 243, 181, 243, 181, 97, 131, 196, 97, 131, 212, 65, 105, 198, 0, 47, 64, 65, 24, 0, 9, 102, 81, 162, 98, 49, 131, 148, 115, 179, 114, 195, 99, 210, 99, 210, 99, 225, 100, 209, 100, 209, 116, 240, 87, 240, 58, 253, 205, 235, 240, 55, 240, 69, 240, 100, 65, 244, 65, 240, 19, 65, 240, 19, 66, 243, 66, 243, 67, 226, 84, 194, 101, 163, 98, 50, 114, 129, 103, 0, 34, 32, 74, 32, 0, 12, 15, 13, 79, 13, 68, 132, 132, 66, 164, 162, 66, 164, 162, 65, 180, 177, 65, 180, 177, 65, 180, 177, 65, 180, 177, 65, 180, 177, 240, 20, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 212, 240, 198, 240, 111, 1, 0, 45, 32, 68, 32, 0, 12, 12, 121, 132, 227, 180, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 196, 241, 211, 225, 228, 209, 243, 193, 240, 35, 177, 240, 51, 130, 240, 84, 82, 240, 150, 0, 45, 96, 92, 36, 0, 13, 76, 185, 133, 240, 20, 195, 240, 50, 212, 240, 33, 228, 240, 18, 244, 241, 240, 20, 241, 240, 36, 210, 240, 36, 209, 240, 52, 194, 240, 68, 177, 240, 84, 162, 240, 100, 145, 240, 116, 145, 240, 116, 130, 240, 132, 113, 240, 148, 98, 240, 164, 81, 240, 180, 81, 240, 180, 66, 240, 196, 49, 240, 212, 34, 240, 228, 17, 240, 244, 17, 240, 240, 21, 240, 240, 20, 240, 240, 36, 240, 240, 50, 240, 240, 66, 0, 51, 112, 123, 48, 0, 18, 12, 91, 121, 132, 197, 197, 164, 212, 225, 211, 212, 225, 212, 196, 210, 212, 212, 193, 243, 197, 193, 244, 181, 177, 240, 20, 162, 20, 161, 240, 35, 161, 36, 161, 240, 36, 145, 36, 145, 240, 52, 130, 52, 129, 240, 68, 113, 68, 129, 240, 68, 113, 83, 113, 240, 84, 97, 100, 97, 240, 100, 81, 100, 97, 240, 100, 81, 115, 81, 240, 116, 65, 132, 65, 240, 132, 49, 132, 65, 240, 132, 49, 147, 49, 240, 148, 33, 164, 33, 240, 164, 17, 164, 33, 240, 164, 17, 181, 240, 181, 197, 240, 196, 197, 240, 196, 211, 240, 211, 227, 240, 226, 227, 240, 226, 241, 0, 68, 16, 85, 35, 0, 13, 28, 122, 166, 165, 244, 195, 240, 36, 178, 240, 53, 146, 240, 84, 145, 240, 116, 114, 240, 117, 82, 240, 148, 81, 240, 180, 49, 240, 197, 18, 240, 214, 240, 244, 240, 240, 36, 240, 240, 21, 240, 245, 240, 226, 20, 240, 194, 37, 240, 177, 68, 240, 161, 100, 240, 130, 101, 240, 98, 132, 240, 97, 164, 240, 66, 165, 240, 34, 196, 240, 33, 228, 242, 229, 197, 214, 138, 156, 0, 48, 80, 86, 35, 0, 13, 28, 169, 118, 244, 181, 243, 212, 242, 244, 225, 240, 21, 194, 240, 36, 178, 240, 68, 161, 240, 84, 146, 240, 100, 129, 240, 132, 97, 240, 148, 82, 240, 164, 65, 240, 180, 50, 240, 196, 18, 240, 229, 240, 245, 240, 240, 19, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 240, 35, 240, 219, 0, 49, 112, 66, 26, 0, 9, 127, 6, 85, 181, 83, 197, 98, 212, 114, 197, 113, 212, 129, 196, 145, 181, 145, 180, 240, 100, 240, 101, 240, 100, 240, 100, 240, 101, 240, 100, 240, 100, 240, 116, 240, 100, 240, 100, 177, 164, 177, 148, 193, 133, 193, 132, 209, 116, 210, 101, 210, 100, 211, 84, 212, 69, 182, 79, 7, 0, 36, 32, 45, 10, 166, 66, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 134, 64, 33, 18, 0, 7, 18, 114, 98, 113, 129, 129, 113, 129, 129, 113, 129, 129, 129, 129, 129, 19, 65, 18, 85, 69, 69, 69, 84, 84, 98, 114, 0, 63, 80, 45, 10, 166, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 70, 64, 17, 15, 0, 6, 33, 212, 162, 19, 130, 66, 98, 98, 65, 145, 0, 64, 32, 11, 8, 240, 162, 84, 68, 68, 82, 0, 35, 80, 19, 9, 240, 242, 97, 129, 113, 113, 129, 129, 129, 18, 85, 69, 84, 98, 0, 32, 16, 61, 27, 0, 31, 97, 240, 163, 240, 147, 240, 147, 240, 129, 19, 240, 113, 19, 240, 113, 20, 240, 81, 51, 240, 81, 51, 240, 66, 52, 240, 49, 83, 240, 49, 83, 240, 33, 115, 240, 17, 115, 242, 116, 237, 225, 147, 210, 148, 193, 179, 193, 179, 178, 195, 147, 180, 119, 121, 0, 37, 80, 48, 24, 0, 30, 15, 195, 131, 163, 147, 147, 163, 131, 163, 131, 163, 131, 163, 131, 163, 131, 147, 147, 115, 188, 195, 131, 163, 163, 131, 163, 131, 179, 115, 179, 115, 179, 115, 179, 115, 163, 131, 163, 131, 132, 111, 1, 0, 34, 58, 25, 0, 32, 39, 81, 163, 98, 34, 131, 161, 18, 115, 195, 99, 226, 98, 242, 83, 242, 82, 240, 33, 67, 240, 33, 67, 240, 115, 240, 115, 240, 115, 240, 115, 240, 130, 240, 33, 83, 240, 17, 98, 240, 17, 99, 225, 131, 193, 163, 162, 195, 98, 240, 23, 0, 35, 80, 49, 26, 0, 32, 79, 227, 131, 195, 162, 179, 178, 163, 194, 147, 195, 131, 195, 131, 211, 115, 211, 115, 211, 115, 211, 115, 211, 115, 211, 115, 211, 115, 211, 115, 210, 131, 195, 131, 194, 147, 178, 163, 162, 179, 131, 159, 0, 37, 16, 52, 24, 0, 30, 15, 3, 147, 147, 147, 162, 147, 177, 147, 178, 131, 193, 131, 97, 81, 131, 97, 227, 97, 227, 82, 234, 227, 82, 227, 97, 227, 97, 227, 97, 97, 115, 193, 131, 193, 131, 193, 131, 193, 131, 178, 131, 148, 95, 4, 0, 33, 80, 50, 23, 0, 28, 111, 3, 131, 147, 131, 162, 131, 177, 131, 177, 131, 177, 131, 177, 131, 97, 66, 115, 97, 211, 97, 211, 82, 218, 211, 82, 211, 97, 211, 97, 211, 97, 211, 240, 83, 240, 83, 240, 83, 240, 83, 240, 42, 0, 33, 32, 55, 27, 0, 34, 103, 81, 195, 98, 34, 163, 164, 147, 195, 131, 211, 130, 242, 115, 242, 114, 240, 33, 99, 240, 33, 99, 240, 147, 240, 147, 240, 147, 240, 147, 170, 82, 243, 115, 227, 130, 227, 131, 211, 147, 195, 163, 164, 195, 99, 18, 232, 65, 0, 37, 112, 51, 26, 0, 32, 73, 73, 115, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 175, 1, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 121, 73, 0, 36, 32, 29, 13, 0, 16, 41, 115, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 121, 0, 18, 48, 34, 17, 0, 21, 105, 195, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 114, 83, 99, 83, 99, 83, 99, 67, 129, 67, 165, 0, 24, 80, 58, 27, 0, 33, 105, 119, 115, 179, 163, 178, 179, 162, 195, 145, 227, 129, 243, 113, 240, 19, 97, 240, 35, 66, 240, 51, 52, 240, 35, 38, 240, 19, 18, 35, 240, 21, 67, 244, 84, 227, 115, 227, 131, 211, 132, 195, 148, 179, 163, 179, 164, 163, 165, 105, 104, 0, 37, 80, 50, 22, 0, 27, 74, 243, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 240, 67, 177, 115, 177, 115, 177, 115, 162, 115, 162, 115, 146, 131, 116, 95, 2, 0, 30, 112, 87, 32, 0, 40, 6, 247, 116, 228, 161, 18, 209, 19, 161, 19, 193, 19, 161, 19, 193, 19, 161, 34, 177, 35, 161, 35, 161, 35, 161, 50, 145, 51, 161, 51, 129, 51, 161, 51, 113, 67, 161, 66, 113, 67, 161, 67, 97, 67, 161, 82, 81, 83, 161, 83, 65, 83, 161, 83, 49, 99, 161, 98, 49, 99, 161, 99, 33, 99, 161, 114, 17, 115, 161, 116, 115, 161, 115, 131, 147, 114, 131, 119, 82, 89, 0, 44, 64, 64, 26, 0, 32, 70, 151, 116, 163, 149, 161, 161, 19, 161, 161, 35, 145, 161, 36, 129, 161, 51, 129, 161, 67, 113, 161, 68, 97, 161, 84, 81, 161, 99, 81, 161, 115, 65, 161, 116, 49, 161, 131, 49, 161, 147, 33, 161, 148, 17, 161, 165, 161, 180, 161, 195, 161, 195, 147, 194, 119, 177, 0, 36, 80, 58, 26, 0, 33, 70, 240, 50, 99, 210, 162, 178, 194, 147, 195, 130, 227, 99, 227, 98, 240, 18, 83, 240, 19, 67, 240, 19, 67, 240, 19, 67, 240, 19, 67, 240, 19, 67, 240, 19, 83, 242, 99, 227, 99, 227, 115, 195, 147, 178, 179, 131, 211, 99, 240, 38, 0, 37, 32, 48, 23, 0, 28, 111, 179, 116, 147, 147, 131, 162, 131, 163, 115, 163, 115, 163, 115, 163, 115, 162, 131, 147, 131, 131, 156, 179, 240, 83, 240, 83, 240, 83, 240, 83, 240, 83, 240, 83, 240, 83, 240, 83, 240, 41, 0, 33, 48, 78, 26, 0, 33, 71, 240, 35, 83, 211, 146, 179, 178, 147, 195, 130, 227, 99, 227, 98, 240, 18, 83, 240, 19, 67, 240, 19, 67, 240, 19, 67, 240, 19, 67, 240, 19, 67, 240, 19, 82, 240, 19, 83, 227, 99, 227, 115, 83, 82, 147, 49, 49, 50, 179, 33, 65, 18, 228, 67, 240, 40, 81, 240, 66, 65, 240, 67, 34, 240, 71, 240, 70, 240, 101, 240, 115, 0, 17, 55, 27, 0, 33, 109, 240, 35, 99, 243, 131, 211, 146, 211, 147, 195, 147, 195, 147, 195, 146, 211, 131, 211, 114, 250, 240, 35, 83, 240, 19, 99, 243, 115, 227, 115, 227, 116, 211, 116, 211, 116, 211, 116, 81, 115, 117, 65, 115, 132, 49, 89, 117, 0, 37, 112, 47, 19, 0, 24, 38, 49, 114, 82, 18, 98, 131, 97, 162, 82, 162, 82, 177, 82, 177, 83, 161, 100, 248, 202, 185, 230, 240, 20, 240, 19, 65, 194, 65, 194, 65, 194, 66, 177, 83, 146, 85, 98, 97, 70, 0, 27, 16, 56, 25, 0, 31, 47, 6, 67, 99, 99, 66, 115, 114, 65, 131, 129, 65, 131, 129, 65, 131, 129, 65, 131, 129, 211, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 115, 240, 59, 0, 35, 64, 51, 26, 0, 32, 73, 103, 115, 179, 147, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 163, 193, 179, 161, 195, 161, 211, 129, 243, 82, 240, 54, 0, 37, 32, 60, 28, 0, 35, 8, 151, 100, 211, 147, 210, 164, 193, 195, 193, 196, 161, 227, 161, 227, 145, 240, 19, 129, 240, 19, 129, 240, 20, 97, 240, 51, 97, 240, 52, 65, 240, 83, 65, 240, 83, 50, 240, 99, 33, 240, 115, 33, 240, 117, 240, 148, 240, 147, 240, 178, 240, 178, 0, 40, 48, 90, 37, 0, 46, 40, 88, 102, 100, 148, 147, 147, 148, 161, 163, 163, 161, 164, 147, 146, 179, 133, 129, 195, 129, 19, 129, 211, 113, 19, 114, 211, 98, 35, 97, 227, 97, 51, 97, 243, 81, 51, 81, 240, 19, 66, 67, 65, 240, 19, 65, 83, 65, 240, 35, 49, 83, 49, 240, 51, 33, 115, 33, 240, 52, 17, 115, 33, 240, 67, 17, 115, 17, 240, 84, 148, 240, 84, 148, 240, 99, 147, 240, 114, 178, 240, 129, 178, 0, 52, 64, 59, 28, 0, 35, 24, 103, 149, 132, 196, 130, 244, 113, 240, 35, 98, 240, 36, 66, 240, 68, 49, 240, 99, 33, 240, 133, 240, 132, 240, 164, 240, 148, 240, 134, 240, 113, 36, 240, 81, 67, 240, 66, 68, 240, 49, 100, 240, 17, 132, 225, 163, 210, 164, 180, 149, 119, 137, 0, 39, 56, 29, 0, 36, 41, 151, 116, 196, 164, 178, 211, 177, 228, 146, 244, 129, 240, 35, 113, 240, 52, 82, 240, 68, 65, 240, 99, 49, 240, 116, 18, 240, 133, 240, 163, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 179, 240, 137, 0, 41, 48, 52, 21, 0, 26, 63, 1, 84, 132, 82, 148, 97, 163, 113, 148, 113, 132, 129, 131, 240, 36, 240, 20, 240, 35, 240, 36, 240, 20, 240, 35, 240, 36, 113, 132, 129, 131, 145, 116, 145, 100, 161, 99, 162, 84, 147, 68, 148, 79, 2, 0, 29, 48, 8, 26, 0, 65, 15, 7, 0, 72, 12, 48, 0, 120, 15, 15, 14, 0, 127, 240, 240, 224, 23, 18, 0, 7, 19, 83, 115, 83, 100, 68, 99, 83, 99, 83, 114, 98, 114, 98, 129, 113, 0, 73, 16, 15, 19, 0, 7, 68, 113, 102, 66, 97, 71, 97, 116, 0, 86, 48, }; //***************************************************************************** // // The font definition for the 42 point Cmsc font. // //***************************************************************************** const tFont g_sFontCmsc42 = { // // The format of the font. // FONT_FMT_PIXEL_RLE, // // The maximum width of the font. // 43, // // The height of the font. // 43, // // The baseline of the font. // 32, // // The offset to each character in the font. // { 0, 5, 39, 72, 187, 268, 390, 486, 505, 551, 597, 644, 737, 757, 766, 778, 867, 930, 991, 1056, 1118, 1188, 1248, 1312, 1375, 1437, 1503, 1522, 1549, 1605, 1618, 1674, 1728, 1836, 1927, 1992, 2074, 2160, 2240, 2304, 2389, 2454, 2490, 2552, 2637, 2702, 2822, 2908, 2994, 3056, 3169, 3252, 3317, 3391, 3459, 3551, 3674, 3759, 3845, 3911, 3956, 3989, 4034, 4051, 4062, 4081, 4142, 4190, 4248, 4297, 4349, 4399, 4454, 4505, 4534, 4568, 4626, 4676, 4763, 4827, 4885, 4933, 5011, 5066, 5113, 5169, 5220, 5280, 5370, 5429, 5485, 5537, 5545, 5557, 5580, }, // // A pointer to the actual font data // g_pui8Cmsc42Data };
58.902439
81
0.475096
328f79401d360d3c0265dc96e2d3b6a97de09ac1
292
h
C
TinyEngine/src/math/Math.h
Kimau/KhronosSandbox
e06caed3ab85e620ac2c5860fd31cef6ed6418c3
[ "Apache-2.0" ]
68
2020-04-14T11:03:26.000Z
2020-06-11T16:17:29.000Z
TinyEngine/src/math/Math.h
Kimau/KhronosSandbox
e06caed3ab85e620ac2c5860fd31cef6ed6418c3
[ "Apache-2.0" ]
5
2020-05-16T05:32:16.000Z
2020-05-21T11:09:52.000Z
TinyEngine/src/math/Math.h
Kimau/KhronosSandbox
e06caed3ab85e620ac2c5860fd31cef6ed6418c3
[ "Apache-2.0" ]
1
2021-03-19T22:47:00.000Z
2021-03-19T22:47:00.000Z
#ifndef MATH_MATH_H_ #define MATH_MATH_H_ #include <cmath> #include "glm_include.h" #include "SphericalCoordinate.h" #include "Random.h" #include "Sample.h" #include "Projection.h" #include "Aabb.h" #include "Plane.h" #include "Sphere.h" #include "Frustum.h" #endif /* MATH_MATH_H_ */
13.904762
32
0.722603
1909b153a50ef0879a35123b1b0963ee895df889
1,053
h
C
include/compute/reducesum/reducesum_internal.h
sedrickkeh/magmadnn
16185287250a9a5bd6789ef98824f676f5378a16
[ "MIT" ]
null
null
null
include/compute/reducesum/reducesum_internal.h
sedrickkeh/magmadnn
16185287250a9a5bd6789ef98824f676f5378a16
[ "MIT" ]
null
null
null
include/compute/reducesum/reducesum_internal.h
sedrickkeh/magmadnn
16185287250a9a5bd6789ef98824f676f5378a16
[ "MIT" ]
null
null
null
#pragma once #include "tensor/tensor.h" #include "utilities_internal.h" #include "cblas.h" #if defined(_HAS_CUDA_) #include "magma.h" #endif namespace magmadnn { namespace internal { template <typename T> void tensor_reducesum_full(Tensor<T> *x, unsigned int axis, Tensor<T> *out); #if defined(_HAS_CUDA_) template <typename T> void tensor_reducesum_full_device(Tensor<T> *x, unsigned int axis, Tensor<T> *out); #endif /** Col Reduce. * @tparam T * @param x * @param out */ template <typename T> void col_reducesum_full(Tensor<T> *x, Tensor<T> *ones, Tensor<T> *out); /** Row reduce. * @tparam T * @param x * @param out */ template <typename T> void row_reducesum_full(Tensor<T> *x, Tensor<T> *ones, Tensor<T> *out); /** Sum of all elements. * @tparam T * @param x * @param out */ template <typename T> void reducesum_full(Tensor<T> *x, Tensor<T> *out); #if defined(_HAS_CUDA_) template <typename T> void reducesum_full_device(Tensor<T> *x, Tensor<T> *out); #endif } // namespace internal } // namespace magmadnn
18.155172
83
0.688509
303fbda69374a57830cec1ff2535423e440357bd
950
h
C
Solutions/EA_LPC2478/DeviceCode/Interop/Microsoft_SPOT_MP3Decoder/NativeCode/MP3Decoder/Mp3Decoder.h
valoni/STM32F103
75f0cb8be593ca287a08f5992d1f5d3c3bb12bfc
[ "Apache-2.0" ]
1
2020-06-09T02:16:43.000Z
2020-06-09T02:16:43.000Z
Solutions/EA_LPC2478/DeviceCode/Interop/Microsoft_SPOT_MP3Decoder/NativeCode/MP3Decoder/Mp3Decoder.h
valoni/STM32F103
75f0cb8be593ca287a08f5992d1f5d3c3bb12bfc
[ "Apache-2.0" ]
null
null
null
Solutions/EA_LPC2478/DeviceCode/Interop/Microsoft_SPOT_MP3Decoder/NativeCode/MP3Decoder/Mp3Decoder.h
valoni/STM32F103
75f0cb8be593ca287a08f5992d1f5d3c3bb12bfc
[ "Apache-2.0" ]
1
2019-12-03T05:37:43.000Z
2019-12-03T05:37:43.000Z
//----------------------------------------------------------------------------- // // ** DO NOT EDIT THIS FILE! ** // This file was generated by a tool // re-running the tool will overwrite this file. // //----------------------------------------------------------------------------- #ifndef _MP3DECODER_H_ #define _MP3DECODER_H_ #include <TinyCLR_Interop.h> struct Library_Mp3Decoder_NXP_Interop_MP3Decoder { static const int FIELD__inBuffer = 1; static const int FIELD__bytesLeft = 2; static const int FIELD__readIndex = 3; TINYCLR_NATIVE_DECLARE(FindNextFrameStart___VOID__SZARRAY_U1); TINYCLR_NATIVE_DECLARE(NativeMP3Decode___VOID__SZARRAY_U1__BYREF_I2); TINYCLR_NATIVE_DECLARE(InitHelixDecoder___VOID); TINYCLR_NATIVE_DECLARE(UninitHelixDecoder___VOID); //--// }; extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_Mp3Decoder; #endif //_MP3DECODER_H_
27.941176
80
0.616842
cf4506b4db3e497bb984a7a33e8b9020495d5cbc
1,700
h
C
src/unilib/uninorms.h
frolosofsky/unit-e
d3d12508b915986841bd19c4dee9e50dd662a112
[ "MIT" ]
36
2019-04-17T18:58:51.000Z
2022-01-18T12:16:27.000Z
src/unilib/uninorms.h
frolosofsky/unit-e
d3d12508b915986841bd19c4dee9e50dd662a112
[ "MIT" ]
109
2019-04-17T17:19:45.000Z
2019-06-19T15:16:37.000Z
src/unilib/uninorms.h
frolosofsky/unit-e
d3d12508b915986841bd19c4dee9e50dd662a112
[ "MIT" ]
16
2019-04-17T17:35:42.000Z
2020-01-09T17:51:05.000Z
// This file is part of UniLib <http://github.com/ufal/unilib/>. // // Copyright 2014 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // // UniLib version: 3.1.2-devel // Unicode version: 8.0.0 #ifndef UNILIB_UNINORMS_H #define UNILIB_UNINORMS_H #include <cstdint> #include <string> namespace ufal { namespace unilib { class uninorms { public: static void nfc(std::u32string& str); static void nfd(std::u32string& str); static void nfkc(std::u32string& str); static void nfkd(std::u32string& str); private: static void compose(std::u32string& str); static void decompose(std::u32string& str, bool kanonical); static const char32_t CHARS = 0x110000; struct Hangul { // Hangul decomposition and composition static const char32_t SBase = 0xAC00, LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7; static const char32_t LCount = 19, VCount = 21, TCount = 28, NCount = VCount * TCount, SCount = LCount * NCount; }; static const uint8_t ccc_index[CHARS >> 8]; static const uint8_t ccc_block[][256]; static const uint8_t composition_index[CHARS >> 8]; static const uint16_t composition_block[][257]; static const char32_t composition_data[]; static const uint8_t decomposition_index[CHARS >> 8]; static const uint16_t decomposition_block[][257]; static const char32_t decomposition_data[]; }; } // namespace unilib } // namespace ufal #endif // UNILIB_UNINORMS_H
29.824561
116
0.726471
5cd62e1a8682bb9edee4fce201222394f5377b4a
5,405
h
C
SRC/TEST/SCENARIO_PLAYER/sp_3gpp_23.003_xml.h
ncl427/openair-cn
d024c80a98fb8a806546bc42c4182fd924fe363a
[ "Apache-2.0" ]
null
null
null
SRC/TEST/SCENARIO_PLAYER/sp_3gpp_23.003_xml.h
ncl427/openair-cn
d024c80a98fb8a806546bc42c4182fd924fe363a
[ "Apache-2.0" ]
null
null
null
SRC/TEST/SCENARIO_PLAYER/sp_3gpp_23.003_xml.h
ncl427/openair-cn
d024c80a98fb8a806546bc42c4182fd924fe363a
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2015, EURECOM (www.eurecom.fr) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of the FreeBSD Project. */ #ifndef FILE_SP_3GPP_23_003_XML_SEEN #define FILE_SP_3GPP_23_003_XML_SEEN #include "sp_xml_load.h" //============================================================================== // 2 Identification of mobile subscribers //============================================================================== //------------------------------------------------------------------------------ // 2.2 Composition of IMSI //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // 2.4 Structure of TMSI //------------------------------------------------------------------------------ SP_NUM_FROM_XML_PROTOTYPE(tmsi); //------------------------------------------------------------------------------ // 2.8 Globally Unique Temporary UE Identity (GUTI) //------------------------------------------------------------------------------ bool sp_m_tmsi_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, tmsi_t * const m_tmsi); SP_NUM_FROM_XML_PROTOTYPE(mme_code); SP_NUM_FROM_XML_PROTOTYPE(mme_gid); bool sp_gummei_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, gummei_t * const gummei); bool sp_guti_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, guti_t * const guti); //------------------------------------------------------------------------------ // 2.9 Structure of the S-Temporary Mobile Subscriber Identity (S-TMSI) //------------------------------------------------------------------------------ bool sp_s_tmsi_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, s_tmsi_t * const s_tmsi); //============================================================================== // 4 Identification of location areas and base stations //============================================================================== //------------------------------------------------------------------------------ // 4.7 Closed Subscriber Group //------------------------------------------------------------------------------ bool sp_csg_id_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, csg_id_t * const csg_id); //============================================================================== // 6 International Mobile Station Equipment Identity and Software Version Number //============================================================================== //------------------------------------------------------------------------------ // 6.2.1 Composition of IMEI //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // 6.2.2 Composition of IMEISV //------------------------------------------------------------------------------ //============================================================================== // 19 Numbering, addressing and identification for the Evolved Packet Core (EPC) //============================================================================== //------------------------------------------------------------------------------ // 19.6 E-UTRAN Cell Identity (ECI) and E-UTRAN Cell Global Identification (ECGI) //------------------------------------------------------------------------------ bool sp_eci_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, eci_t * const eci); bool sp_ecgi_from_xml ( scenario_t * const scenario, scenario_player_msg_t * const msg, ecgi_t * const ecgi); #endif /* FILE_SP_3GPP_23_003_XML_SEEN */
46.594828
82
0.471415
5cf28e09b5cff08d0efe9e364b67ac67d695f90c
1,317
h
C
qqtw/qqheaders7.2/QZJPhotoCategoryOpReq.h
onezens/QQTweak
04b9efd1d93eba8ef8fec5cf9a20276637765777
[ "MIT" ]
5
2018-02-20T14:24:17.000Z
2020-08-06T09:31:21.000Z
qqtw/qqheaders7.2/QZJPhotoCategoryOpReq.h
onezens/QQTweak
04b9efd1d93eba8ef8fec5cf9a20276637765777
[ "MIT" ]
1
2020-06-10T07:49:16.000Z
2020-06-12T02:08:35.000Z
qqtw/qqheaders7.2/QZJPhotoCategoryOpReq.h
onezens/SmartQQ
04b9efd1d93eba8ef8fec5cf9a20276637765777
[ "MIT" ]
null
null
null
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "JceObjectV2.h" @class NSDictionary; @interface QZJPhotoCategoryOpReq : JceObjectV2 { } + (id)jceType; - (id)init; // Remaining properties @property(nonatomic, getter=jce_op_uin, setter=setJce_op_uin:) unsigned int jcev2_p_0_o_op_uin; // @dynamic jcev2_p_0_o_op_uin; @property(nonatomic, getter=jce_op, setter=setJce_op:) long long jcev2_p_1_o_op; // @dynamic jcev2_p_1_o_op; @property(retain, nonatomic, getter=jce_groupid_photos, setter=setJce_groupid_photos:) NSDictionary *jcev2_p_2_o_groupid_photos__b0x9i_M09ONSStringVOQZJFeedsSPicdata; // @dynamic jcev2_p_2_o_groupid_photos__b0x9i_M09ONSStringVOQZJFeedsSPicdata; @property(retain, nonatomic, getter=jce_groupid_confirm_info, setter=setJce_groupid_confirm_info:) NSDictionary *jcev2_p_3_o_groupid_confirm_info__b0x9i_M09ONSStringOQZJPhotoCategoryFaceConfirmInfo; // @dynamic jcev2_p_3_o_groupid_confirm_info__b0x9i_M09ONSStringOQZJPhotoCategoryFaceConfirmInfo; @property(retain, nonatomic, getter=jce_category_groupids, setter=setJce_category_groupids:) NSDictionary *jcev2_p_4_o_category_groupids__b0x9i_M09ONSStringVONSString; // @dynamic jcev2_p_4_o_category_groupids__b0x9i_M09ONSStringVONSString; @end
48.777778
296
0.83675
5a003a2ebd967cfe6a9e202ea9a1ae7f1ddf1aba
3,048
c
C
linux-imx6/lib/strncpy_from_user.c
ub-rms/rushmore
9e6c06e94420349f94fa9c1529e1817efd547c7d
[ "BSD-2-Clause" ]
1
2022-02-21T07:09:11.000Z
2022-02-21T07:09:11.000Z
linux-imx6/lib/strncpy_from_user.c
ub-rms/rushmore
9e6c06e94420349f94fa9c1529e1817efd547c7d
[ "BSD-2-Clause" ]
null
null
null
linux-imx6/lib/strncpy_from_user.c
ub-rms/rushmore
9e6c06e94420349f94fa9c1529e1817efd547c7d
[ "BSD-2-Clause" ]
null
null
null
#include <linux/compiler.h> #include <linux/export.h> #include <linux/uaccess.h> #include <linux/kernel.h> #include <linux/errno.h> #include <asm/byteorder.h> #include <asm/word-at-a-time.h> #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS #define IS_UNALIGNED(src, dst) 0 #else #define IS_UNALIGNED(src, dst) \ (((long) dst | (long) src) & (sizeof(long) - 1)) #endif /* * Do a strncpy, return length of string without final '\0'. * 'count' is the user-supplied count (return 'count' if we * hit it), 'max' is the address space maximum (and we return * -EFAULT if we hit it). */ static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max) { const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; long res = 0; /* * Truncate 'max' to the user-specified limit, so that * we only have one limit we need to check in the loop */ if (max > count) max = count; if (IS_UNALIGNED(src, dst)) goto byte_at_a_time; while (max >= sizeof(unsigned long)) { unsigned long c, data; /* Fall back to byte-at-a-time if we get a page fault */ unsafe_get_user(c, (unsigned long __user *)(src+res), byte_at_a_time); *(unsigned long *)(dst+res) = c; if (has_zero(c, &data, &constants)) { data = prep_zero_mask(c, data, &constants); data = create_zero_mask(data); return res + find_zero(data); } res += sizeof(unsigned long); max -= sizeof(unsigned long); } byte_at_a_time: while (max) { char c; unsafe_get_user(c,src+res, efault); dst[res] = c; if (!c) return res; res++; max--; } /* * Uhhuh. We hit 'max'. But was that the user-specified maximum * too? If so, that's ok - we got as much as the user asked for. */ if (res >= count) return res; /* * Nope: we hit the address space limit, and we still had more * characters the caller would have wanted. That's an EFAULT. */ efault: return -EFAULT; } /** * strncpy_from_user: - Copy a NUL terminated string from userspace. * @dst: Destination address, in kernel space. This buffer must be at * least @count bytes long. * @src: Source address, in user space. * @count: Maximum number of bytes to copy, including the trailing NUL. * * Copies a NUL-terminated string from userspace to kernel space. * * On success, returns the length of the string (not including the trailing * NUL). * * If access to userspace fails, returns -EFAULT (some data may have been * copied). * * If @count is smaller than the length of the string, copies @count bytes * and returns @count. */ long strncpy_from_user(char *dst, const char __user *src, long count) { unsigned long max_addr, src_addr; if (unlikely(count <= 0)) return 0; max_addr = user_addr_max(); src_addr = (unsigned long)src; if (likely(src_addr < max_addr)) { unsigned long max = max_addr - src_addr; long retval; user_access_begin(); retval = do_strncpy_from_user(dst, src, count, max); user_access_end(); return retval; } return -EFAULT; } EXPORT_SYMBOL(strncpy_from_user);
25.4
105
0.684055
d69b1184983021fe923bbb667f530aa47332e49a
17,825
h
C
lib/dpdk-stable-19.08.2/lib/librte_meter/rte_meter.h
mjlee34/poseidonos
8eff75c5ba7af8090d3ff4ac51d7507b37571f9b
[ "BSD-3-Clause" ]
2
2021-08-13T08:09:20.000Z
2021-11-02T09:13:36.000Z
lib/dpdk-stable-19.08.2/lib/librte_meter/rte_meter.h
mjlee34/poseidonos
8eff75c5ba7af8090d3ff4ac51d7507b37571f9b
[ "BSD-3-Clause" ]
null
null
null
lib/dpdk-stable-19.08.2/lib/librte_meter/rte_meter.h
mjlee34/poseidonos
8eff75c5ba7af8090d3ff4ac51d7507b37571f9b
[ "BSD-3-Clause" ]
null
null
null
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2010-2014 Intel Corporation */ #ifndef __INCLUDE_RTE_METER_H__ #define __INCLUDE_RTE_METER_H__ #ifdef __cplusplus extern "C" { #endif /** * @file * RTE Traffic Metering * * Traffic metering algorithms: * 1. Single Rate Three Color Marker (srTCM): defined by IETF RFC 2697 * 2. Two Rate Three Color Marker (trTCM): defined by IETF RFC 2698 * 3. Two Rate Three Color Marker (trTCM): defined by IETF RFC 4115 * ***/ #include <stdint.h> #include "rte_compat.h" /* * Application Programmer's Interface (API) * ***/ /** * Color */ enum rte_color { RTE_COLOR_GREEN = 0, /**< Green */ RTE_COLOR_YELLOW, /**< Yellow */ RTE_COLOR_RED, /**< Red */ RTE_COLORS /**< Number of colors */ }; /** srTCM parameters per metered traffic flow. The CIR, CBS and EBS parameters only count bytes of IP packets and do not include link specific headers. At least one of the CBS or EBS parameters has to be greater than zero. */ struct rte_meter_srtcm_params { uint64_t cir; /**< Committed Information Rate (CIR). Measured in bytes per second. */ uint64_t cbs; /**< Committed Burst Size (CBS). Measured in bytes. */ uint64_t ebs; /**< Excess Burst Size (EBS). Measured in bytes. */ }; /** trTCM parameters per metered traffic flow. The CIR, PIR, CBS and PBS parameters only count bytes of IP packets and do not include link specific headers. PIR has to be greater than or equal to CIR. Both CBS or EBS have to be greater than zero. */ struct rte_meter_trtcm_params { uint64_t cir; /**< Committed Information Rate (CIR). Measured in bytes per second. */ uint64_t pir; /**< Peak Information Rate (PIR). Measured in bytes per second. */ uint64_t cbs; /**< Committed Burst Size (CBS). Measured in bytes. */ uint64_t pbs; /**< Peak Burst Size (PBS). Measured in bytes. */ }; /** trTCM parameters per metered traffic flow. The CIR, EIR, CBS and EBS parameters only count bytes of IP packets and do not include link specific headers. The CBS and EBS need to be greater than zero if CIR and EIR are none-zero respectively.*/ struct rte_meter_trtcm_rfc4115_params { uint64_t cir; /**< Committed Information Rate (CIR). Measured in bytes per second. */ uint64_t eir; /**< Excess Information Rate (EIR). Measured in bytes per second. */ uint64_t cbs; /**< Committed Burst Size (CBS). Measured in bytes. */ uint64_t ebs; /**< Excess Burst Size (EBS). Measured in bytes. */ }; /** * Internal data structure storing the srTCM configuration profile. Typically * shared by multiple srTCM objects. */ struct rte_meter_srtcm_profile; /** * Internal data structure storing the trTCM configuration profile. Typically * shared by multiple trTCM objects. */ struct rte_meter_trtcm_profile; /** * Internal data structure storing the trTCM RFC4115 configuration profile. * Typically shared by multiple trTCM objects. */ struct rte_meter_trtcm_rfc4115_profile; /** Internal data structure storing the srTCM run-time context per metered traffic flow. */ struct rte_meter_srtcm; /** Internal data structure storing the trTCM run-time context per metered traffic flow. */ struct rte_meter_trtcm; /** * Internal data structure storing the trTCM RFC4115 run-time context per * metered traffic flow. */ struct rte_meter_trtcm_rfc4115; /** * srTCM profile configuration * * @param p * Pointer to pre-allocated srTCM profile data structure * @param params * srTCM profile parameters * @return * 0 upon success, error code otherwise */ int rte_meter_srtcm_profile_config(struct rte_meter_srtcm_profile *p, struct rte_meter_srtcm_params *params); /** * trTCM profile configuration * * @param p * Pointer to pre-allocated trTCM profile data structure * @param params * trTCM profile parameters * @return * 0 upon success, error code otherwise */ int rte_meter_trtcm_profile_config(struct rte_meter_trtcm_profile *p, struct rte_meter_trtcm_params *params); /** * @warning * @b EXPERIMENTAL: this API may change without prior notice * * trTCM RFC 4115 profile configuration * * @param p * Pointer to pre-allocated trTCM profile data structure * @param params * trTCM profile parameters * @return * 0 upon success, error code otherwise */ __rte_experimental int rte_meter_trtcm_rfc4115_profile_config( struct rte_meter_trtcm_rfc4115_profile *p, struct rte_meter_trtcm_rfc4115_params *params); /** * srTCM configuration per metered traffic flow * * @param m * Pointer to pre-allocated srTCM data structure * @param p * srTCM profile. Needs to be valid. * @return * 0 upon success, error code otherwise */ int rte_meter_srtcm_config(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p); /** * trTCM configuration per metered traffic flow * * @param m * Pointer to pre-allocated trTCM data structure * @param p * trTCM profile. Needs to be valid. * @return * 0 upon success, error code otherwise */ int rte_meter_trtcm_config(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p); /** * @warning * @b EXPERIMENTAL: this API may change without prior notice * * trTCM RFC 4115 configuration per metered traffic flow * * @param m * Pointer to pre-allocated trTCM data structure * @param p * trTCM profile. Needs to be valid. * @return * 0 upon success, error code otherwise */ __rte_experimental int rte_meter_trtcm_rfc4115_config(struct rte_meter_trtcm_rfc4115 *m, struct rte_meter_trtcm_rfc4115_profile *p); /** * srTCM color blind traffic metering * * @param m * Handle to srTCM instance * @param p * srTCM profile specified at srTCM object creation time * @param time * Current CPU time stamp (measured in CPU cycles) * @param pkt_len * Length of the current IP packet (measured in bytes) * @return * Color assigned to the current IP packet */ static inline enum rte_color rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, uint32_t pkt_len); /** * srTCM color aware traffic metering * * @param m * Handle to srTCM instance * @param p * srTCM profile specified at srTCM object creation time * @param time * Current CPU time stamp (measured in CPU cycles) * @param pkt_len * Length of the current IP packet (measured in bytes) * @param pkt_color * Input color of the current IP packet * @return * Color assigned to the current IP packet */ static inline enum rte_color rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, uint32_t pkt_len, enum rte_color pkt_color); /** * trTCM color blind traffic metering * * @param m * Handle to trTCM instance * @param p * trTCM profile specified at trTCM object creation time * @param time * Current CPU time stamp (measured in CPU cycles) * @param pkt_len * Length of the current IP packet (measured in bytes) * @return * Color assigned to the current IP packet */ static inline enum rte_color rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, uint32_t pkt_len); /** * trTCM color aware traffic metering * * @param m * Handle to trTCM instance * @param p * trTCM profile specified at trTCM object creation time * @param time * Current CPU time stamp (measured in CPU cycles) * @param pkt_len * Length of the current IP packet (measured in bytes) * @param pkt_color * Input color of the current IP packet * @return * Color assigned to the current IP packet */ static inline enum rte_color rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, uint32_t pkt_len, enum rte_color pkt_color); /** * @warning * @b EXPERIMENTAL: this API may change without prior notice * * trTCM RFC4115 color blind traffic metering * * @param m * Handle to trTCM instance * @param p * trTCM profile specified at trTCM object creation time * @param time * Current CPU time stamp (measured in CPU cycles) * @param pkt_len * Length of the current IP packet (measured in bytes) * @return * Color assigned to the current IP packet */ __rte_experimental static inline enum rte_color rte_meter_trtcm_rfc4115_color_blind_check( struct rte_meter_trtcm_rfc4115 *m, struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len); /** * @warning * @b EXPERIMENTAL: this API may change without prior notice * * trTCM RFC4115 color aware traffic metering * * @param m * Handle to trTCM instance * @param p * trTCM profile specified at trTCM object creation time * @param time * Current CPU time stamp (measured in CPU cycles) * @param pkt_len * Length of the current IP packet (measured in bytes) * @param pkt_color * Input color of the current IP packet * @return * Color assigned to the current IP packet */ __rte_experimental static inline enum rte_color rte_meter_trtcm_rfc4115_color_aware_check( struct rte_meter_trtcm_rfc4115 *m, struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, enum rte_color pkt_color); /* * Inline implementation of run-time methods * ***/ struct rte_meter_srtcm_profile { uint64_t cbs; /**< Upper limit for C token bucket */ uint64_t ebs; /**< Upper limit for E token bucket */ uint64_t cir_period; /**< Number of CPU cycles for each update of C and E token buckets */ uint64_t cir_bytes_per_period; /**< Number of bytes to add to C and E token buckets on each update */ }; /* Internal data structure storing the srTCM run-time context per metered traffic flow. */ struct rte_meter_srtcm { uint64_t time; /* Time of latest update of C and E token buckets */ uint64_t tc; /* Number of bytes currently available in the committed (C) token bucket */ uint64_t te; /* Number of bytes currently available in the excess (E) token bucket */ }; struct rte_meter_trtcm_profile { uint64_t cbs; /**< Upper limit for C token bucket */ uint64_t pbs; /**< Upper limit for P token bucket */ uint64_t cir_period; /**< Number of CPU cycles for one update of C token bucket */ uint64_t cir_bytes_per_period; /**< Number of bytes to add to C token bucket on each update */ uint64_t pir_period; /**< Number of CPU cycles for one update of P token bucket */ uint64_t pir_bytes_per_period; /**< Number of bytes to add to P token bucket on each update */ }; /** * Internal data structure storing the trTCM run-time context per metered * traffic flow. */ struct rte_meter_trtcm { uint64_t time_tc; /**< Time of latest update of C token bucket */ uint64_t time_tp; /**< Time of latest update of P token bucket */ uint64_t tc; /**< Number of bytes currently available in committed(C) token bucket */ uint64_t tp; /**< Number of bytes currently available in the peak(P) token bucket */ }; struct rte_meter_trtcm_rfc4115_profile { uint64_t cbs; /**< Upper limit for C token bucket */ uint64_t ebs; /**< Upper limit for E token bucket */ uint64_t cir_period; /**< Number of CPU cycles for one update of C token bucket */ uint64_t cir_bytes_per_period; /**< Number of bytes to add to C token bucket on each update */ uint64_t eir_period; /**< Number of CPU cycles for one update of E token bucket */ uint64_t eir_bytes_per_period; /**< Number of bytes to add to E token bucket on each update */ }; /** * Internal data structure storing the trTCM RFC4115 run-time context per * metered traffic flow. */ struct rte_meter_trtcm_rfc4115 { uint64_t time_tc; /**< Time of latest update of C token bucket */ uint64_t time_te; /**< Time of latest update of E token bucket */ uint64_t tc; /**< Number of bytes currently available in committed(C) token bucket */ uint64_t te; /**< Number of bytes currently available in the excess(E) token bucket */ }; static inline enum rte_color rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, uint32_t pkt_len) { uint64_t time_diff, n_periods, tc, te; /* Bucket update */ time_diff = time - m->time; n_periods = time_diff / p->cir_period; m->time += n_periods * p->cir_period; /* Put the tokens overflowing from tc into te bucket */ tc = m->tc + n_periods * p->cir_bytes_per_period; te = m->te; if (tc > p->cbs) { te += (tc - p->cbs); if (te > p->ebs) te = p->ebs; tc = p->cbs; } /* Color logic */ if (tc >= pkt_len) { m->tc = tc - pkt_len; m->te = te; return RTE_COLOR_GREEN; } if (te >= pkt_len) { m->tc = tc; m->te = te - pkt_len; return RTE_COLOR_YELLOW; } m->tc = tc; m->te = te; return RTE_COLOR_RED; } static inline enum rte_color rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, uint32_t pkt_len, enum rte_color pkt_color) { uint64_t time_diff, n_periods, tc, te; /* Bucket update */ time_diff = time - m->time; n_periods = time_diff / p->cir_period; m->time += n_periods * p->cir_period; /* Put the tokens overflowing from tc into te bucket */ tc = m->tc + n_periods * p->cir_bytes_per_period; te = m->te; if (tc > p->cbs) { te += (tc - p->cbs); if (te > p->ebs) te = p->ebs; tc = p->cbs; } /* Color logic */ if ((pkt_color == RTE_COLOR_GREEN) && (tc >= pkt_len)) { m->tc = tc - pkt_len; m->te = te; return RTE_COLOR_GREEN; } if ((pkt_color != RTE_COLOR_RED) && (te >= pkt_len)) { m->tc = tc; m->te = te - pkt_len; return RTE_COLOR_YELLOW; } m->tc = tc; m->te = te; return RTE_COLOR_RED; } static inline enum rte_color rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, uint32_t pkt_len) { uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp; /* Bucket update */ time_diff_tc = time - m->time_tc; time_diff_tp = time - m->time_tp; n_periods_tc = time_diff_tc / p->cir_period; n_periods_tp = time_diff_tp / p->pir_period; m->time_tc += n_periods_tc * p->cir_period; m->time_tp += n_periods_tp * p->pir_period; tc = m->tc + n_periods_tc * p->cir_bytes_per_period; if (tc > p->cbs) tc = p->cbs; tp = m->tp + n_periods_tp * p->pir_bytes_per_period; if (tp > p->pbs) tp = p->pbs; /* Color logic */ if (tp < pkt_len) { m->tc = tc; m->tp = tp; return RTE_COLOR_RED; } if (tc < pkt_len) { m->tc = tc; m->tp = tp - pkt_len; return RTE_COLOR_YELLOW; } m->tc = tc - pkt_len; m->tp = tp - pkt_len; return RTE_COLOR_GREEN; } static inline enum rte_color rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, uint32_t pkt_len, enum rte_color pkt_color) { uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp; /* Bucket update */ time_diff_tc = time - m->time_tc; time_diff_tp = time - m->time_tp; n_periods_tc = time_diff_tc / p->cir_period; n_periods_tp = time_diff_tp / p->pir_period; m->time_tc += n_periods_tc * p->cir_period; m->time_tp += n_periods_tp * p->pir_period; tc = m->tc + n_periods_tc * p->cir_bytes_per_period; if (tc > p->cbs) tc = p->cbs; tp = m->tp + n_periods_tp * p->pir_bytes_per_period; if (tp > p->pbs) tp = p->pbs; /* Color logic */ if ((pkt_color == RTE_COLOR_RED) || (tp < pkt_len)) { m->tc = tc; m->tp = tp; return RTE_COLOR_RED; } if ((pkt_color == RTE_COLOR_YELLOW) || (tc < pkt_len)) { m->tc = tc; m->tp = tp - pkt_len; return RTE_COLOR_YELLOW; } m->tc = tc - pkt_len; m->tp = tp - pkt_len; return RTE_COLOR_GREEN; } __rte_experimental static inline enum rte_color rte_meter_trtcm_rfc4115_color_blind_check( struct rte_meter_trtcm_rfc4115 *m, struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len) { uint64_t time_diff_tc, time_diff_te, n_periods_tc, n_periods_te, tc, te; /* Bucket update */ time_diff_tc = time - m->time_tc; time_diff_te = time - m->time_te; n_periods_tc = time_diff_tc / p->cir_period; n_periods_te = time_diff_te / p->eir_period; m->time_tc += n_periods_tc * p->cir_period; m->time_te += n_periods_te * p->eir_period; tc = m->tc + n_periods_tc * p->cir_bytes_per_period; if (tc > p->cbs) tc = p->cbs; te = m->te + n_periods_te * p->eir_bytes_per_period; if (te > p->ebs) te = p->ebs; /* Color logic */ if (tc >= pkt_len) { m->tc = tc - pkt_len; m->te = te; return RTE_COLOR_GREEN; } if (te >= pkt_len) { m->tc = tc; m->te = te - pkt_len; return RTE_COLOR_YELLOW; } /* If we end up here the color is RED */ m->tc = tc; m->te = te; return RTE_COLOR_RED; } __rte_experimental static inline enum rte_color rte_meter_trtcm_rfc4115_color_aware_check( struct rte_meter_trtcm_rfc4115 *m, struct rte_meter_trtcm_rfc4115_profile *p, uint64_t time, uint32_t pkt_len, enum rte_color pkt_color) { uint64_t time_diff_tc, time_diff_te, n_periods_tc, n_periods_te, tc, te; /* Bucket update */ time_diff_tc = time - m->time_tc; time_diff_te = time - m->time_te; n_periods_tc = time_diff_tc / p->cir_period; n_periods_te = time_diff_te / p->eir_period; m->time_tc += n_periods_tc * p->cir_period; m->time_te += n_periods_te * p->eir_period; tc = m->tc + n_periods_tc * p->cir_bytes_per_period; if (tc > p->cbs) tc = p->cbs; te = m->te + n_periods_te * p->eir_bytes_per_period; if (te > p->ebs) te = p->ebs; /* Color logic */ if ((pkt_color == RTE_COLOR_GREEN) && (tc >= pkt_len)) { m->tc = tc - pkt_len; m->te = te; return RTE_COLOR_GREEN; } if ((pkt_color != RTE_COLOR_RED) && (te >= pkt_len)) { m->tc = tc; m->te = te - pkt_len; return RTE_COLOR_YELLOW; } /* If we end up here the color is RED */ m->tc = tc; m->te = te; return RTE_COLOR_RED; } #ifdef __cplusplus } #endif #endif /* __INCLUDE_RTE_METER_H__ */
26.174743
91
0.708107
10f1b9805c3c0de40eb954d16c7ec3b757af58c7
465
h
C
include/vsg/platform/ios/iOS_ViewController.h
wadivision/VulkanSceneGraph
62756591b549bed2f006880b67688ce9970728df
[ "MIT" ]
20
2018-09-18T01:10:42.000Z
2018-11-08T15:04:49.000Z
include/vsg/platform/ios/iOS_ViewController.h
wadivision/VulkanSceneGraph
62756591b549bed2f006880b67688ce9970728df
[ "MIT" ]
null
null
null
include/vsg/platform/ios/iOS_ViewController.h
wadivision/VulkanSceneGraph
62756591b549bed2f006880b67688ce9970728df
[ "MIT" ]
7
2018-10-24T03:14:10.000Z
2018-11-05T16:47:01.000Z
#include <UIKit/UIKit.h> #include <vsg/viewer/WindowTraits.h> #include <vsg/viewer/Window.h> #pragma mark - #pragma mark vsg_iOS_View @interface vsg_iOS_View : UIView @end #pragma mark - #pragma mark vsg_iOS_ViewController @interface vsg_iOS_ViewController : UIViewController @property vsg::ref_ptr<vsg::Window> vsgWindow; - (instancetype)initWithTraits:(vsg::ref_ptr<vsg::WindowTraits>)traits andVsgViewer:(vsg::ref_ptr<vsg::Viewer>) vsgViewer; @end
23.25
126
0.767742
3430d983c31819fb376d965cbc483bd5551d64b2
108
c
C
misc/myclang/test/main.c
rsms/co2
74df84df1fac37af09861b3c37e946db3c0be6f1
[ "0BSD" ]
43
2021-03-30T16:16:49.000Z
2021-09-29T20:05:50.000Z
misc/myclang/test/main.c
rsms/co2
74df84df1fac37af09861b3c37e946db3c0be6f1
[ "0BSD" ]
1
2021-10-16T09:16:03.000Z
2021-10-16T09:16:03.000Z
misc/myclang/test/main.c
rsms/colang
74df84df1fac37af09861b3c37e946db3c0be6f1
[ "0BSD" ]
2
2021-06-05T20:47:06.000Z
2021-06-09T17:18:50.000Z
#include <stdio.h> int main(int argc, const char* argv[argc+1]) { printf("Hello world!\n"); return 0; }
18
46
0.638889
43aa68154f1514c630a2a832debad6205d708e3d
19,349
c
C
WiFi_BLE_MQTT_EXAMPLE/WiFi_BLE_MQTT_EXAMPLE/src/main21.c
sivagurunathan1989/Battery-Status-through-WiFi-BLE
0eb4dd645aff4cf51a4448e0ffe32cfa77be52a7
[ "CC0-1.0" ]
null
null
null
WiFi_BLE_MQTT_EXAMPLE/WiFi_BLE_MQTT_EXAMPLE/src/main21.c
sivagurunathan1989/Battery-Status-through-WiFi-BLE
0eb4dd645aff4cf51a4448e0ffe32cfa77be52a7
[ "CC0-1.0" ]
null
null
null
WiFi_BLE_MQTT_EXAMPLE/WiFi_BLE_MQTT_EXAMPLE/src/main21.c
sivagurunathan1989/Battery-Status-through-WiFi-BLE
0eb4dd645aff4cf51a4448e0ffe32cfa77be52a7
[ "CC0-1.0" ]
null
null
null
/** * * \file * * \brief WINC1500 MQTT chat example. * * Copyright (c) 2015 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ /** \mainpage * \section intro Introduction * This example demonstrates the use of the SAMW25 Xplained Pro board * along with BTLC1000 XPlained Pro board to implement an MQTT based chat. * It uses the following hardware: * - the SAMW25 Xplained Pro. * - the BTLC1000 Xplained Pro on EXT1. * * \section files Main Files * - main.c : Initialize the WINC1500, connect to MQTT broker and chat with the other devices. * - mqtt.h : Implementation of MQTT 3.1 * * \section usage Usage * -# Configure below code in the main.h for AP information to be connected. * \code * #define MAIN_WLAN_SSID "DEMO_AP" * #define MAIN_WLAN_AUTH M2M_WIFI_SEC_WPA_PSK * #define MAIN_WLAN_PSK "12345678" * \endcode * -# Build the program and download it into the board. * \section contactinfo Contact Information * For further information, visit * <A href="http://www.atmel.com">Atmel</A>.\n */ #include "asf.h" #include "main.h" #include "driver/include/m2m_wifi.h" #include "iot/mqtt/mqtt.h" #include "iot/sw_timer.h" #include "socket/include/socket.h" #include "battery.h" #include "at_ble_api.h" #include "ble_manager.h" #include "timer_hw.h" /* === GLOBALS ============================================================ */ #define BATTERY_UPDATE_INTERVAL (1) //1 second #define BATTERY_MAX_LEVEL (100) #define BATTERY_MIN_LEVEL (0) uint8_t db_mem[1024] = {0}; bat_gatt_service_handler_t bas_service_handler; bool volatile timer_cb_done = false; bool volatile flag = true; bool volatile battery_flag = true; at_ble_handle_t bat_connection_handle; /* Application instruction phrase. */ #define STRING_EOL "\r\n" #define STRING_HEADER "-- WINC1500 Wi-Fi MQTT chat example --"STRING_EOL \ "-- "BOARD_NAME " --"STRING_EOL \ "-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL /** UART module for debug. */ static struct usart_module cdc_uart_module; /** Instance of Timer module. */ struct sw_timer_module swt_module_inst; /** User name of chat. */ char mqtt_user[64] = ""; /* Instance of MQTT service. */ static struct mqtt_module mqtt_inst; /* Receive buffer of the MQTT service. */ static char mqtt_buffer[MAIN_MQTT_BUFFER_SIZE]; /** UART buffer. */ static char uart_buffer[MAIN_CHAT_BUFFER_SIZE]; /** Written size of UART buffer. */ static int uart_buffer_written = 0; /** A buffer of character from the serial. */ static uint16_t uart_ch_buffer; /** * \Timer callback handler called on timer expiry */ static void timer_callback_handler(void) { //Timer call back timer_cb_done = true; } /* Advertisement data set and Advertisement start */ static at_ble_status_t battery_service_advertise(void) { at_ble_status_t status = AT_BLE_FAILURE; if((status = ble_advertisement_data_set()) != AT_BLE_SUCCESS) { //printf("advertisement data set failed reason :%d",status); return status; } /* Start of advertisement */ if((status = at_ble_adv_start(AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_ADV_GEN_DISCOVERABLE, NULL, AT_BLE_ADV_FP_ANY, APP_BAS_FAST_ADV, APP_BAS_ADV_TIMEOUT, 0)) == AT_BLE_SUCCESS) { //printf("BLE Started Adv"); LED_On(LED0); return AT_BLE_SUCCESS; } else { //printf("BLE Adv start Failed reason :%d",status); } return status; } /* Callback registered for AT_BLE_PAIR_DONE event from stack */ static at_ble_status_t ble_paired_app_event(void *param) { timer_cb_done = false; hw_timer_start(BATTERY_UPDATE_INTERVAL); ALL_UNUSED(param); return AT_BLE_SUCCESS; } /* Callback registered for AT_BLE_DISCONNECTED event from stack */ static at_ble_status_t ble_disconnected_app_event(void *param) { timer_cb_done = false; flag = true; hw_timer_stop(); battery_service_advertise(); ALL_UNUSED(param); return AT_BLE_SUCCESS; } static at_ble_status_t ble_connected_app_event(void *param) { at_ble_connected_t *connected = (at_ble_connected_t *)param; bat_connection_handle = connected->handle; #if !BLE_PAIR_ENABLE ble_paired_app_event(param); #else ALL_UNUSED(param); #endif return AT_BLE_SUCCESS; } /* Callback registered for AT_BLE_NOTIFICATION_CONFIRMED event from stack */ static at_ble_status_t ble_notification_confirmed_app_event(void *param) { at_ble_cmd_complete_event_t *notification_status = (at_ble_cmd_complete_event_t *)param; if(!notification_status->status) { flag = true; //printf("sending notification to the peer success"); } return AT_BLE_SUCCESS; } /* Callback registered for AT_BLE_CHARACTERISTIC_CHANGED event from stack */ static at_ble_status_t ble_char_changed_app_event(void *param) { at_ble_characteristic_changed_t *char_handle = (at_ble_characteristic_changed_t *)param; return bat_char_changed_event(char_handle->conn_handle,&bas_service_handler, char_handle, &flag); } static const ble_event_callback_t battery_app_gap_cb[] = { NULL, NULL, NULL, NULL, NULL, ble_connected_app_event, ble_disconnected_app_event, NULL, NULL, ble_paired_app_event, NULL, NULL, NULL, NULL, ble_paired_app_event, NULL, NULL, NULL, NULL }; static const ble_event_callback_t battery_app_gatt_server_cb[] = { ble_notification_confirmed_app_event, NULL, ble_char_changed_app_event, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; /** * \brief Callback of USART input. * * \param[in] module USART module structure. */ static void uart_callback(const struct usart_module *const module) { /* If input string is bigger than buffer size limit, ignore the excess part. */ if (uart_buffer_written < MAIN_CHAT_BUFFER_SIZE) { uart_buffer[uart_buffer_written++] = uart_ch_buffer & 0xFF; } } /** * \brief Callback to get the Wi-Fi status update. * * \param[in] msg_type type of Wi-Fi notification. Possible types are: * - [M2M_WIFI_RESP_CURRENT_RSSI](@ref M2M_WIFI_RESP_CURRENT_RSSI) * - [M2M_WIFI_RESP_CON_STATE_CHANGED](@ref M2M_WIFI_RESP_CON_STATE_CHANGED) * - [M2M_WIFI_RESP_CONNTION_STATE](@ref M2M_WIFI_RESP_CONNTION_STATE) * - [M2M_WIFI_RESP_SCAN_DONE](@ref M2M_WIFI_RESP_SCAN_DONE) * - [M2M_WIFI_RESP_SCAN_RESULT](@ref M2M_WIFI_RESP_SCAN_RESULT) * - [M2M_WIFI_REQ_WPS](@ref M2M_WIFI_REQ_WPS) * - [M2M_WIFI_RESP_IP_CONFIGURED](@ref M2M_WIFI_RESP_IP_CONFIGURED) * - [M2M_WIFI_RESP_IP_CONFLICT](@ref M2M_WIFI_RESP_IP_CONFLICT) * - [M2M_WIFI_RESP_P2P](@ref M2M_WIFI_RESP_P2P) * - [M2M_WIFI_RESP_AP](@ref M2M_WIFI_RESP_AP) * - [M2M_WIFI_RESP_CLIENT_INFO](@ref M2M_WIFI_RESP_CLIENT_INFO) * \param[in] pvMsg A pointer to a buffer containing the notification parameters * (if any). It should be casted to the correct data type corresponding to the * notification type. Existing types are: * - tstrM2mWifiStateChanged * - tstrM2MWPSInfo * - tstrM2MP2pResp * - tstrM2MAPResp * - tstrM2mScanDone * - tstrM2mWifiscanResult */ static void wifi_callback(uint8 msg_type, void *msg_data) { tstrM2mWifiStateChanged *msg_wifi_state; uint8 *msg_ip_addr; switch (msg_type) { case M2M_WIFI_RESP_CON_STATE_CHANGED: msg_wifi_state = (tstrM2mWifiStateChanged *)msg_data; if (msg_wifi_state->u8CurrState == M2M_WIFI_CONNECTED) { /* If Wi-Fi is connected. */ //printf("Wi-Fi connected\r\n"); m2m_wifi_request_dhcp_client(); } else if (msg_wifi_state->u8CurrState == M2M_WIFI_DISCONNECTED) { /* If Wi-Fi is disconnected. */ //printf("Wi-Fi disconnected\r\n"); m2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL); /* Disconnect from MQTT broker. */ /* Force close the MQTT connection, because cannot send a disconnect message to the broker when network is broken. */ mqtt_disconnect(&mqtt_inst, 1); } break; case M2M_WIFI_REQ_DHCP_CONF: msg_ip_addr = (uint8 *)msg_data; //printf("Wi-Fi IP is %u.%u.%u.%u\r\n",msg_ip_addr[0], msg_ip_addr[1], msg_ip_addr[2], msg_ip_addr[3]); /* Try to connect to MQTT broker when Wi-Fi was connected. */ mqtt_connect(&mqtt_inst, main_mqtt_broker); break; default: break; } } /** * \brief Callback to get the Socket event. * * \param[in] Socket descriptor. * \param[in] msg_type type of Socket notification. Possible types are: * - [SOCKET_MSG_CONNECT](@ref SOCKET_MSG_CONNECT) * - [SOCKET_MSG_BIND](@ref SOCKET_MSG_BIND) * - [SOCKET_MSG_LISTEN](@ref SOCKET_MSG_LISTEN) * - [SOCKET_MSG_ACCEPT](@ref SOCKET_MSG_ACCEPT) * - [SOCKET_MSG_RECV](@ref SOCKET_MSG_RECV) * - [SOCKET_MSG_SEND](@ref SOCKET_MSG_SEND) * - [SOCKET_MSG_SENDTO](@ref SOCKET_MSG_SENDTO) * - [SOCKET_MSG_RECVFROM](@ref SOCKET_MSG_RECVFROM) * \param[in] msg_data A structure contains notification informations. */ static void socket_event_handler(SOCKET sock, uint8_t msg_type, void *msg_data) { mqtt_socket_event_handler(sock, msg_type, msg_data); } /** * \brief Callback of gethostbyname function. * * \param[in] doamin_name Domain name. * \param[in] server_ip IP of server. */ static void socket_resolve_handler(uint8_t *doamin_name, uint32_t server_ip) { mqtt_socket_resolve_handler(doamin_name, server_ip); } /** * \brief Callback to get the MQTT status update. * * \param[in] conn_id instance id of connection which is being used. * \param[in] type type of MQTT notification. Possible types are: * - [MQTT_CALLBACK_SOCK_CONNECTED](@ref MQTT_CALLBACK_SOCK_CONNECTED) * - [MQTT_CALLBACK_CONNECTED](@ref MQTT_CALLBACK_CONNECTED) * - [MQTT_CALLBACK_PUBLISHED](@ref MQTT_CALLBACK_PUBLISHED) * - [MQTT_CALLBACK_SUBSCRIBED](@ref MQTT_CALLBACK_SUBSCRIBED) * - [MQTT_CALLBACK_UNSUBSCRIBED](@ref MQTT_CALLBACK_UNSUBSCRIBED) * - [MQTT_CALLBACK_DISCONNECTED](@ref MQTT_CALLBACK_DISCONNECTED) * - [MQTT_CALLBACK_RECV_PUBLISH](@ref MQTT_CALLBACK_RECV_PUBLISH) * \param[in] data A structure contains notification informations. @ref mqtt_data */ static void mqtt_callback(struct mqtt_module *module_inst, int type, union mqtt_data *data) { switch (type) { case MQTT_CALLBACK_SOCK_CONNECTED: { /* * If connecting to broker server is complete successfully, Start sending CONNECT message of MQTT. * Or else retry to connect to broker server. */ if (data->sock_connected.result >= 0) { mqtt_connect_broker(module_inst, 1, NULL, NULL, mqtt_user, NULL, NULL, 0, 0, 0); } else { //printf("Connect fail to server(%s)! retry it automatically.\r\n", main_mqtt_broker); mqtt_connect(module_inst, main_mqtt_broker); /* Retry that. */ } } break; case MQTT_CALLBACK_CONNECTED: if (data->connected.result == MQTT_CONN_RESULT_ACCEPT) { LED_On(LED0); /* Subscribe chat topic. */ //mqtt_subscribe(module_inst, MAIN_CHAT_TOPIC "#", 0); /* Enable USART receiving callback. */ //printf("Preparation of the chat has been completed.\r\n"); } else { /* Cannot connect for some reason. */ //printf("MQTT broker decline your access! error code %d\r\n", data->connected.result); LED_Off(LED0); } break; case MQTT_CALLBACK_RECV_PUBLISH: /* You received publish message which you had subscribed. */ if (data->recv_publish.topic != NULL && data->recv_publish.msg != NULL) { if (!strncmp(data->recv_publish.topic, MAIN_MQTT_TOPIC, strlen(MAIN_MQTT_TOPIC))) { /* Print user name and message */ for (int i = strlen(MAIN_MQTT_TOPIC); i < data->recv_publish.topic_size; i++) { //printf("%c", data->recv_publish.topic[i]); } //printf(" >> "); for (int i = 0; i < data->recv_publish.msg_size; i++) { //printf("%c", data->recv_publish.msg[i]); } //printf("\r\n"); } } break; case MQTT_CALLBACK_DISCONNECTED: /* Stop timer and USART callback. */ //printf("MQTT disconnected\r\n"); LED_Off(LED0); break; } } /** * \brief Configure UART console. */ static void configure_console(void) { struct usart_config usart_conf; usart_get_config_defaults(&usart_conf); usart_conf.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING; usart_conf.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0; usart_conf.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1; usart_conf.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2; usart_conf.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3; usart_conf.baudrate = 115200; stdio_serial_init(&cdc_uart_module, EDBG_CDC_MODULE, &usart_conf); /* Register USART callback for receiving user input. */ usart_register_callback(&cdc_uart_module, (usart_callback_t)uart_callback, USART_CALLBACK_BUFFER_RECEIVED); usart_enable(&cdc_uart_module); } /** * \brief Configure Timer module. */ static void configure_timer(void) { struct sw_timer_config swt_conf; sw_timer_get_config_defaults(&swt_conf); sw_timer_init(&swt_module_inst, &swt_conf); sw_timer_enable(&swt_module_inst); } /** * \brief Configure MQTT service. */ static void configure_mqtt(void) { struct mqtt_config mqtt_conf; int result; mqtt_get_config_defaults(&mqtt_conf); /* To use the MQTT service, it is necessary to always set the buffer and the timer. */ mqtt_conf.timer_inst = &swt_module_inst; mqtt_conf.recv_buffer = mqtt_buffer; mqtt_conf.recv_buffer_size = MAIN_MQTT_BUFFER_SIZE; result = mqtt_init(&mqtt_inst, &mqtt_conf); if (result < 0) { //printf("MQTT initialization failed. Error code is (%d)\r\n", result); while (1) { } } result = mqtt_register_callback(&mqtt_inst, mqtt_callback); if (result < 0) { //printf("MQTT register callback failed. Error code is (%d)\r\n", result); while (1) { } } } /** * \brief Checking the USART buffer. * * Finding the new line character(\n or \r\n) in the USART buffer. * If buffer was overflowed, Sending the buffer. */ static void check_usart_buffer(char *topic) { int i; /* Publish the input string when newline was received or input string is bigger than buffer size limit. */ if (uart_buffer_written >= MAIN_CHAT_BUFFER_SIZE) { mqtt_publish(&mqtt_inst, topic, uart_buffer, MAIN_CHAT_BUFFER_SIZE, 0, 0); uart_buffer_written = 0; } else { for (i = 0; i < uart_buffer_written; i++) { /* Find newline character ('\n' or '\r\n') and publish the previous string . */ if (uart_buffer[i] == '\n') { mqtt_publish(&mqtt_inst, topic, uart_buffer, (i > 0 && uart_buffer[i - 1] == '\r') ? i - 1 : i, 0, 0); /* Move remain data to start of the buffer. */ if (uart_buffer_written > i + 1) { memmove(uart_buffer, uart_buffer + i + 1, uart_buffer_written - i - 1); uart_buffer_written = uart_buffer_written - i - 1; } else { uart_buffer_written = 0; } break; } } } } /** * \brief Main application function. * * Application entry point. * * \return program return value. */ int main(void) { tstrWifiInitParam param; int8_t ret, ret_ble; char topic[strlen(MAIN_MQTT_TOPIC) + MAIN_CHAT_USER_NAME_SIZE + 1],msg[5]; uint8_t battery_level = BATTERY_MIN_LEVEL; /* Initialize the board. */ system_init(); /* Initialize the UART console. */ //configure_console(); /* Output example information */ //printf(STRING_HEADER); /* Initialize the Timer. */ configure_timer(); /* Initialize the MQTT service. */ configure_mqtt(); /* Initialize the hardware timer */ hw_timer_init(); /* Register the callback */ hw_timer_register_callback(timer_callback_handler); /* Initialize the BSP. */ nm_bsp_init(); /* initialize the ble chip and Set the device mac address */ ble_device_init(NULL); /* Initialize the battery service */ bat_init_service(&bas_service_handler, &battery_level); /* Define the primary service in the GATT server database */ if((ret = bat_primary_service_define(&bas_service_handler))!= AT_BLE_SUCCESS) { //printf("defining battery service failed %d", ret); } battery_service_advertise(); /* Register callbacks for gap related events */ ble_mgr_events_callback_handler(REGISTER_CALL_BACK, BLE_GAP_EVENT_TYPE, battery_app_gap_cb); /* Register callbacks for gatt server related events */ ble_mgr_events_callback_handler(REGISTER_CALL_BACK, BLE_GATT_SERVER_EVENT_TYPE, battery_app_gatt_server_cb); /* Setup user name first */ sprintf(mqtt_user,"%s", MAIN_MQTT_TOPIC_NAME); sprintf(topic, "%s%s", MAIN_MQTT_TOPIC,MAIN_MQTT_TOPIC_NAME); /* Initialize Wi-Fi parameters structure. */ memset((uint8_t *)&param, 0, sizeof(tstrWifiInitParam)); /* Initialize Wi-Fi driver with data and status callbacks. */ param.pfAppWifiCb = wifi_callback; /* Set Wi-Fi event callback. */ ret = m2m_wifi_init(&param); if (M2M_SUCCESS != ret) { //printf("main: m2m_wifi_init call error!(%d)\r\n", ret); while (1) { /* Loop forever. */ } } /* Initialize socket interface. */ socketInit(); registerSocketCallback(socket_event_handler, socket_resolve_handler); /* Connect to router. */ m2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL); while (1) { /* Handle pending events from network controller. */ m2m_wifi_handle_events(NULL); /* BLE Event Task */ ble_event_task(); /* Checks the timer timeout. */ sw_timer_task(&swt_module_inst); /* Checks the USART buffer. */ if (timer_cb_done) { timer_cb_done = false; /* send the notification and Update the battery level */ if(flag == true){ ret_ble = bat_update_char_value(bat_connection_handle,&bas_service_handler, battery_level, &flag); sprintf((char*) msg, "%d",battery_level); mqtt_publish(&mqtt_inst, topic, msg, strlen((char *)msg), 0, 0); LED_Toggle(LED0); if (ret_ble == AT_BLE_SUCCESS) { DBG_LOG("Battery Level:%d%%", battery_level); } else { LED_Off(LED0); //printf("main: failed to send status report error!\r\n"); } } if(battery_level == BATTERY_MAX_LEVEL) { battery_flag = false; } else if(battery_level == BATTERY_MIN_LEVEL) { battery_flag = true; } if(battery_flag) { battery_level= battery_level+1; } else { battery_level= battery_level-1; } } } }
29.952012
174
0.727945
43f298dbc8db9241b35838ce1eb24e41ad545361
434
h
C
include/CppUtil/Engine/AllBSDFs.h
Ubpa/RenderLab_bk_20200303
7babfa0fbea3e9e6a3d21005080757509afe4777
[ "MIT" ]
1
2021-11-01T02:16:48.000Z
2021-11-01T02:16:48.000Z
include/CppUtil/Engine/AllBSDFs.h
huangx916/RenderLab
a0059705d5694146bbe51442e0cabdcbcd750fe7
[ "MIT" ]
null
null
null
include/CppUtil/Engine/AllBSDFs.h
huangx916/RenderLab
a0059705d5694146bbe51442e0cabdcbcd750fe7
[ "MIT" ]
null
null
null
#ifndef _ENGINE_ALL_BSDFS_H_ #define _ENGINE_ALL_BSDFS_H_ #include <CppUtil/Engine/BSDF_Diffuse.h> #include <CppUtil/Engine/BSDF_Emission.h> #include <CppUtil/Engine/BSDF_Glass.h> #include <CppUtil/Engine/BSDF_Mirror.h> #include <CppUtil/Engine/BSDF_CookTorrance.h> #include <CppUtil/Engine/BSDF_MetalWorkflow.h> #include <CppUtil/Engine/BSDF_FrostedGlass.h> #include <CppUtil/Engine/BSDF_Frostbite.h> #endif//!_ENGINE_ALL_BSDFS_H_
31
46
0.822581
2e8659dea31c582b1bf5c6a10e53bfbab6eb1721
388
h
C
src/sdk_midwares_table.h
wotsen/learning_platform_server
38b3483ae5496927acec53c179a78f86f403e2d3
[ "MIT" ]
null
null
null
src/sdk_midwares_table.h
wotsen/learning_platform_server
38b3483ae5496927acec53c179a78f86f403e2d3
[ "MIT" ]
null
null
null
src/sdk_midwares_table.h
wotsen/learning_platform_server
38b3483ae5496927acec53c179a78f86f403e2d3
[ "MIT" ]
1
2020-02-16T09:57:01.000Z
2020-02-16T09:57:01.000Z
/** * @file sdk_midwares_table.h * @author 余王亮 (wotsen@outlook.com) * @brief * @version 0.1 * @date 2020-04-04 * * @copyright Copyright (c) 2020 * */ #ifndef __wotsenLearnPlatSrv_SDK_MIDWARE_TABLE_H__ #define __wotsenLearnPlatSrv_SDK_MIDWARE_TABLE_H__ namespace wotsen { // 注册在中间件 void register_sdk_midwares(void); } #endif // !__wotsenLearnPlatSrv_SDK_MIDWARE_TABLE_H__
16.166667
53
0.747423
c8791ddef31d551d07c30b87778729db9f89b986
10,290
h
C
EasySFTP/MainWnd.h
jet2jet/EasySFTP
331ee9f8c7b40aa8938409c791f5664d90ee3c9c
[ "BSD-3-Clause" ]
2
2018-10-20T08:56:40.000Z
2018-10-20T09:08:08.000Z
EasySFTP/MainWnd.h
jet2jet/EasySFTP
331ee9f8c7b40aa8938409c791f5664d90ee3c9c
[ "BSD-3-Clause" ]
null
null
null
EasySFTP/MainWnd.h
jet2jet/EasySFTP
331ee9f8c7b40aa8938409c791f5664d90ee3c9c
[ "BSD-3-Clause" ]
2
2018-10-20T08:56:32.000Z
2018-10-20T12:43:43.000Z
/* EasySFTP - Copyright (C) 2010 Kuri-Applications MainWnd.h - declarations of CMainWindow, etc. */ #pragma once #include "AddrCBox.h" #include "LFileVw.h" //#include "SFileVw.h" #include "CommndUI.h" #ifndef CWM_GETISHELLBROWSER #define CWM_GETISHELLBROWSER (WM_USER + 7) #endif #define MY_WM_BROWSE_VIEW (WM_USER + 600) //#define MY_WM_SOCKETMESSAGE (WM_USER + 601) //#define MY_WM_SENDQUEUE (WM_USER + 602) #define MY_WM_UPDATESETMENU (WM_USER + 603) #define MY_WM_CHANGENOTIFY (WM_USER + 604) #define TIMERID_KEEP_CONNECTION 101 #define KEEP_CONNECTION_TIME_SPAN 12000 #define TIMERID_TRANSFER_CHECK 102 #define TRANSFER_CHECK_TIME_SPAN 500 class CMainWindow : public CMyWindow, public IEasySFTPListener { public: CMainWindow(); virtual ~CMainWindow(); HWND CreateEx(); virtual void PostNcDestroy(); virtual bool PreTranslateMessage(LPMSG lpMsg); // called from CMainApplication bool OnIdle(long lCount); // IEasySFTPListener public: STDMETHOD(ChangeLocalDirectory)(LPCWSTR lpszPath); public: // IUnknown STDMETHOD(QueryInterface)(REFIID riid, void** ppv); STDMETHOD_(ULONG, AddRef)() { return InternalAddRef(); } STDMETHOD_(ULONG, Release)() { return InternalRelease(); } ULONG InternalAddRef(); ULONG InternalRelease(); class CBrowser : public CMyWindow, public IShellBrowser, #ifdef _EASYSFTP_USE_ICOMMDLGBROWSER public ICommDlgBrowser, #endif public IServiceProvider, public IInternetHostSecurityManager { public: CBrowser() { } virtual CMainWindow* This() const = 0; STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppv); STDMETHOD_(ULONG, AddRef)(); STDMETHOD_(ULONG, Release)(); // IOleWindow STDMETHOD(GetWindow)(HWND* phWnd); STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode); // IShellBrowser STDMETHOD(InsertMenusSB)(HMENU hMenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths); STDMETHOD(SetMenuSB)(HMENU hMenuShared, HOLEMENU hOleMenuRes, HWND hWndActiveObject); STDMETHOD(RemoveMenusSB)(HMENU hMenuShared); STDMETHOD(SetStatusTextSB)(LPCWSTR pszStatusText); STDMETHOD(EnableModelessSB)(BOOL fEnable); STDMETHOD(TranslateAcceleratorSB)(LPMSG lpMsg, WORD wID); //STDMETHOD(BrowseObject)(PCUIDLIST_RELATIVE pidl, UINT wFlags); //STDMETHOD(GetViewStateStream)(DWORD grfMode, IStream** ppStrm); STDMETHOD(GetControlWindow)(UINT uID, HWND* phWnd); STDMETHOD(SendControlMsg)(UINT uID, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pRet); //STDMETHOD(QueryActiveShellView)(IShellView** ppshv); //STDMETHOD(OnViewWindowActive)(IShellView* pshv); STDMETHOD(SetToolbarItems)(LPTBBUTTONSB lpButtons, UINT nButtons, UINT uFlags); // IServiceProvider STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void FAR* FAR* ppvObject); // IInternetHostSecurityManager STDMETHOD(GetSecurityId)(BYTE* pbSecurityId, DWORD* pcbSecurityId, DWORD_PTR dwReserved); STDMETHOD(ProcessUrlAction)(DWORD dwAction, BYTE* pPolicy, DWORD cbPolicy, BYTE* pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved); STDMETHOD(QueryCustomPolicy)(REFGUID guidKey, BYTE** ppPolicy, DWORD* pcbPolicy, BYTE* pContext, DWORD cbContext, DWORD dwReserved); protected: LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); }; class CBrowserLocal : public CBrowser { public: inline virtual CMainWindow* This() const { return (CMainWindow*) (((DWORD_PTR) this) - (DWORD_PTR) offsetof(CMainWindow, m_xBrowserForLocal)); } // IShellBrowser STDMETHOD(BrowseObject)(PCUIDLIST_RELATIVE pidl, UINT wFlags); STDMETHOD(GetViewStateStream)(DWORD grfMode, IStream** ppStrm); STDMETHOD(QueryActiveShellView)(IShellView** ppshv); STDMETHOD(OnViewWindowActive)(IShellView* pshv); #ifdef _EASYSFTP_USE_ICOMMDLGBROWSER // ICommDlgBrowser STDMETHOD(OnDefaultCommand)(IShellView* ppshv); STDMETHOD(OnStateChange)(IShellView* ppshv, ULONG uChange); STDMETHOD(IncludeObject)(IShellView* ppshv, PCUITEMID_CHILD pidl); #endif } m_xBrowserForLocal; class CBrowserServer : public CBrowser { public: inline virtual CMainWindow* This() const { return (CMainWindow*) (((DWORD_PTR) this) - (DWORD_PTR) offsetof(CMainWindow, m_xBrowserForServer)); } // only for CBrowserServer STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppv) { if (IsEqualIID(riid, IID_IEasySFTPListener)) return This()->QueryInterface(riid, ppv); return CBrowser::QueryInterface(riid, ppv); } // IShellBrowser STDMETHOD(BrowseObject)(PCUIDLIST_RELATIVE pidl, UINT wFlags); STDMETHOD(GetViewStateStream)(DWORD grfMode, IStream** ppStrm); STDMETHOD(QueryActiveShellView)(IShellView** ppshv); STDMETHOD(OnViewWindowActive)(IShellView* pshv); #ifdef _EASYSFTP_USE_ICOMMDLGBROWSER // ICommDlgBrowser STDMETHOD(OnDefaultCommand)(IShellView* ppshv); STDMETHOD(OnStateChange)(IShellView* ppshv, ULONG uChange); STDMETHOD(IncludeObject)(IShellView* ppshv, PCUITEMID_CHILD pidl); #endif } m_xBrowserForServer; public: ULONG m_uRef; HACCEL m_hAccel; HMENU m_hMenu; HMENU m_hMenuReturnMode; int m_nSplitterWidth; int m_nAddrButtonsWidth; int m_nToolBarHeight; int m_nStatusHeight; CMyStringW m_strToolTipTextKeep; CMyStringW m_strStatusText; HICON m_hIconSecure; HWND m_hWndFocusSaved; HWND m_hWndLastFocus; bool m_bWindowCreated; bool m_bNoRespondToDDE; bool m_bUpdateSetMenu; HMENU m_hMenuSet; HWND m_hWndViewForMenu; HFONT m_hFontWindow; UINT m_uIDChangeNotify; UINT m_uDpi; CMyWindow m_wndAddrButtons; CAddressComboBox m_wndAddress; CShellFolderFileView m_wndListViewLocal; CMyWindow m_wndSplitter; CMyWindow m_wndServerAddrButtons; //CVirtualAddressComboBox m_wndServerAddress; CAddressComboBox m_wndServerAddress; CShellFolderFileView m_wndListViewServer; CMyWindow m_wndToolBar; CMyWindow m_wndStatusBar; bool m_bLocalAddressSelChanged; bool m_bServerAddressSelChanged; UINT m_uLastStatusTextModeID; void UpdateCurrentFolder(PCUIDLIST_RELATIVE lpidl); void UpdateCurrentFolderAbsolute(PCUIDLIST_ABSOLUTE lpidl); void UpdateCurrentFolderAbsolute(LPCWSTR lpszPath); //void UpdateServerFolder(LPCWSTR lpszPath); void UpdateServerFolder(PCUIDLIST_RELATIVE lpidl); void UpdateServerFolderAbsolute(PCUIDLIST_ABSOLUTE lpidl); void UpdateServerFolderAbsolute(LPCWSTR lpszPath); void SetServerListenerToMe(); void OnChangeServerFolderFailed(); void NavigateParentFolder(); void NavigateServerParentFolder(); HRESULT QueryActiveShellView(bool bServer, IShellView** ppshv); void OnViewWindowActive(bool bServer, IShellView* pView); //void DoHostConnect(); void DoHostConnect(bool bServer); void DoConnect(); //void DoCloseConnection(bool bForce = false); void DoCloseConnection(bool bServer, bool bForce = false); //char DoRetryAuthentication(const char* pszAuthListMultiStr = NULL, bool bFirstAttempt = false); void DoDownload(); void DoUpload(); void DoDownloadAll(); void DoUploadAll(); void DeleteSelection(); void ShowOption(); void SetStatusText(LPCWSTR lpszStatusText); void SetStatusText(UINT uStatusID, LPCWSTR lpszStatusText); void SetStatusSecureIcon(bool bSecure); protected: void ShowAboutDialog(); void OnResize(); void UpdateUIItem(CCommandUIItem* pUIItem); void UpdateFonts(); void UpdateToolBarEnable(); void UpdateToolBarIcons(); void UpdateStatusParts(); void UpdateFileSelection(); void UpdateViewStatus(HWND hWndFocus); void CheckFileTypes(CShellFolderFileView* pViewCur, CShellFolderFileView* pViewOther, PIDLIST_ABSOLUTE* ppidlItems, int nCount, int& nTextCount, int& nDirCount); void _SetTransferMode(LONG nTransferMode); void _SetTextMode(bool bServer, LONG nTextMode); bool CanConnect(bool bServer); bool CanDisconnect(bool bServer); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnCreate(WPARAM wParam, LPARAM lParam); LRESULT OnClose(WPARAM wParam, LPARAM lParam); LRESULT OnDestroy(WPARAM wParam, LPARAM lParam); LRESULT OnSize(WPARAM wParam, LPARAM lParam); LRESULT OnCommand(WPARAM wParam, LPARAM lParam); LRESULT OnInitMenuPopup(WPARAM wParam, LPARAM lParam); LRESULT OnMenuSelect(WPARAM wParam, LPARAM lParam); LRESULT OnContextMenu(WPARAM wParam, LPARAM lParam); LRESULT OnActivate(WPARAM wParam, LPARAM lParam); LRESULT OnSettingChange(WPARAM wParam, LPARAM lParam); LRESULT OnDpiChanged(WPARAM wParam, LPARAM lParam); LRESULT OnToolTipDispInfoA(WPARAM wParam, LPARAM lParam); LRESULT OnToolTipDispInfoW(WPARAM wParam, LPARAM lParam); LRESULT OnToolBarDropDown(WPARAM wParam, LPARAM lParam); void OnLocalAddressTextReturn(LPCWSTR lpszText); LRESULT OnLocalAddressEndEditA(WPARAM wParam, LPARAM lParam); LRESULT OnLocalAddressEndEditW(WPARAM wParam, LPARAM lParam); LRESULT OnLocalAddressSelChange(WPARAM wParam, LPARAM lParam); LRESULT OnLocalAddressCloseUp(WPARAM wParam, LPARAM lParam); void OnServerAddressTextReturn(LPCWSTR lpszText); LRESULT OnServerAddressEndEditA(WPARAM wParam, LPARAM lParam); LRESULT OnServerAddressEndEditW(WPARAM wParam, LPARAM lParam); LRESULT OnServerAddressSelChange(WPARAM wParam, LPARAM lParam); LRESULT OnServerAddressCloseUp(WPARAM wParam, LPARAM lParam); //LRESULT OnServerListViewDblClick(WPARAM wParam, LPARAM lParam); //LRESULT OnServerListViewReturn(WPARAM wParam, LPARAM lParam); //LRESULT OnServerListViewBeginLabelEdit(WPARAM wParam, LPARAM lParam); //LRESULT OnServerListViewEndLabelEdit(WPARAM wParam, LPARAM lParam); //LRESULT OnSocketMessage(WPARAM wParam, LPARAM lParam); //LRESULT OnTimer(WPARAM wParam, LPARAM lParam); //LRESULT OnSendQueue(WPARAM wParam, LPARAM lParam); LRESULT OnBrowseView(WPARAM wParam, LPARAM lParam); LRESULT OnUpdateSetMenu(WPARAM wParam, LPARAM lParam); LRESULT OnChangeNotify(WPARAM wParam, LPARAM lParam); LRESULT OnSplitterTrack(WPARAM wParam, LPARAM lParam); LRESULT OnSplitterTracking(WPARAM wParam, LPARAM lParam); LRESULT OnDDEInitialize(WPARAM wParam, LPARAM lParam); LRESULT OnDDETerminate(WPARAM wParam, LPARAM lParam); LRESULT OnDDEExecute(WPARAM wParam, LPARAM lParam); };
35.979021
108
0.771914
4e4ca21bf72a7641f1195c817f6973625a8d0a39
942
h
C
ONTWallet/ONTWallet/ONTSDK/ONTCore/ONT.h
AlleniCode/ONTWallet
e9172f48e2ac0a5c6ad151982bb3a03cec870543
[ "MIT" ]
1
2018-08-14T09:07:52.000Z
2018-08-14T09:07:52.000Z
ONTWallet/ONTWallet/ONTSDK/ONTCore/ONT.h
AlleniCode/ONTWallet
e9172f48e2ac0a5c6ad151982bb3a03cec870543
[ "MIT" ]
2
2018-07-18T20:16:34.000Z
2019-03-16T00:49:36.000Z
ONTWallet/ONTWallet/ONTSDK/ONTCore/ONT.h
AlleniCode/ONTWallet
e9172f48e2ac0a5c6ad151982bb3a03cec870543
[ "MIT" ]
2
2018-10-10T11:02:57.000Z
2018-10-24T09:09:18.000Z
// // ONT.h // ONTWallet // // Created by zhangyutao on 2018/8/4. // Copyright © 2018年 zhangyutao. All rights reserved. // #ifndef ONT_h #define ONT_h #define kONTMainNet NO // MainNet or TestNet #define kONTRpcURL kONTMainNet?@"http://dappnode1.ont.io:20336":@"http://polaris1.ont.io:20336" #define kONTRestfulURL kONTMainNet?@"http://dappnode1.ont.io:20334":@"http://polaris1.ont.io:20334" //#define kONTRpcURL @"http://192.168.2.176:20336" //#define kONTRestfulURL @"http://192.168.2.176:20334" #define kONTScanTxURL(hash) kONTMainNet?[NSString stringWithFormat:@"https://explorer.ont.io/transaction/%@",hash]:[NSString stringWithFormat:@"https://explorer.ont.io/transaction/%@/testnet",hash] #define kONTExplorerBaseURL(version) kONTMainNet?[NSString stringWithFormat:@"https://explorer.ont.io/api/v%@/explorer",version]:[NSString stringWithFormat:@"https://polarisexplorer.ont.io/api/v%@/explorer",version] #endif /* ONT_h */
39.25
215
0.739915
0823ad2f1eda4bb42f90a7776157be40299428e1
4,818
c
C
src/app/platform/win/input-win.c
septag/darkhammer
dd7e32737059ce6dba0aa79f1ae4a59137db06a7
[ "BSD-2-Clause" ]
68
2015-01-06T08:38:32.000Z
2022-01-20T15:26:17.000Z
src/app/platform/win/input-win.c
septag/darkhammer
dd7e32737059ce6dba0aa79f1ae4a59137db06a7
[ "BSD-2-Clause" ]
null
null
null
src/app/platform/win/input-win.c
septag/darkhammer
dd7e32737059ce6dba0aa79f1ae4a59137db06a7
[ "BSD-2-Clause" ]
12
2015-10-31T11:30:15.000Z
2020-04-13T18:31:17.000Z
/*********************************************************************************** * Copyright (c) 2013, Sepehr Taghdisian * 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. * ***********************************************************************************/ #if defined(_D3D_) #include "dhcore/core.h" #include "dhcore/win.h" #include "win-keycodes.h" #include "input.h" void input_make_keymap_platform(uint keymap[INPUT_KEY_CNT]) { keymap[0] = KEY_ESC; keymap[1] = KEY_F1; keymap[2] = KEY_F2; keymap[3] = KEY_F3; keymap[4] = KEY_F4; keymap[5] = KEY_F5; keymap[6] = KEY_F6; keymap[7] = KEY_F7; keymap[8] = KEY_F8; keymap[9] = KEY_F9; keymap[10] = KEY_F10; keymap[11] = KEY_F11; keymap[12] = KEY_F12; keymap[13] = KEY_PRINTSCREEN; keymap[14] = KEY_BREAK; keymap[15] = KEY_TILDE; keymap[16] = KEY_1; keymap[17] = KEY_2; keymap[18] = KEY_3; keymap[19] = KEY_4; keymap[20] = KEY_5; keymap[21] = KEY_6; keymap[22] = KEY_7; keymap[23] = KEY_8; keymap[24] = KEY_9; keymap[25] = KEY_0; keymap[26] = KEY_DASH; keymap[27] = KEY_EQUAL; keymap[28] = KEY_BACKSPACE; keymap[29] = KEY_TAB; keymap[30] = KEY_Q; keymap[31] = KEY_W; keymap[32] = KEY_E; keymap[33] = KEY_R; keymap[34] = KEY_T; keymap[35] = KEY_Y; keymap[36] = KEY_U; keymap[37] = KEY_I; keymap[38] = KEY_O; keymap[39] = KEY_P; keymap[40] = KEY_BRACKET_OPEN; keymap[41] = KEY_BEACKET_CLOSE; keymap[42] = KEY_BACKSLASH; keymap[43] = KEY_CAPS; keymap[44] = KEY_A; keymap[45] = KEY_S; keymap[46] = KEY_D; keymap[47] = KEY_F; keymap[48] = KEY_G; keymap[49] = KEY_H; keymap[50] = KEY_J; keymap[51] = KEY_K; keymap[52] = KEY_L; keymap[53] = KEY_SEMICOLON; keymap[54] = KEY_QUOTE; keymap[55] = KEY_ENTER; keymap[56] = KEY_LSHIFT; keymap[57] = KEY_Z; keymap[58] = KEY_X; keymap[59] = KEY_C; keymap[60] = KEY_V; keymap[61] = KEY_B; keymap[62] = KEY_N; keymap[63] = KEY_M; keymap[64] = KEY_COMMA; keymap[65] = KEY_DOT; keymap[66] = KEY_SLASH; keymap[67] = KEY_RSHIFT; keymap[68] = KEY_LCTRL; keymap[69] = KEY_LALT; keymap[70] = KEY_SPACE; keymap[71] = KEY_RALT; keymap[72] = KEY_RCTRL; keymap[73] = KEY_DELETE; keymap[74] = KEY_INSERT; keymap[75] = KEY_HOME; keymap[76] = KEY_END; keymap[77] = KEY_PGUP; keymap[78] = KEY_PGDWN; keymap[79] = KEY_UP; keymap[80] = KEY_DOWN; keymap[81] = KEY_LEFT; keymap[82] = KEY_RIGHT; keymap[83] = KEY_NUM_DIVIDE; keymap[84] = KEY_NUM_MULTIPLY; keymap[85] = KEY_NUM_SUBTRACT; keymap[86] = KEY_NUM_ADD; keymap[87] = KEY_NUM_ENTER; keymap[88] = KEY_NUM_DOT; keymap[89] = KEY_NUM_1; keymap[90] = KEY_NUM_2; keymap[91] = KEY_NUM_3; keymap[92] = KEY_NUM_4; keymap[93] = KEY_NUM_5; keymap[94] = KEY_NUM_6; keymap[95] = KEY_NUM_7; keymap[96] = KEY_NUM_8; keymap[97] = KEY_NUM_9; keymap[98] = KEY_NUM_0; keymap[99] = KEY_NUM_LOCK; } void input_mouse_getpos_platform(HWND hwnd, OUT int* x, OUT int* y) { POINT pt; GetCursorPos(&pt); ScreenToClient(hwnd, &pt); *x = pt.x; *y = pt.y; } void input_mouse_setpos_platform(HWND hwnd, int x, int y) { POINT pt = {x, y}; ClientToScreen(hwnd, &pt); SetCursorPos(pt.x, pt.y); } int input_mouse_getkey_platform(HWND hwnd, enum input_mouse_key mkey) { int vkey = 0; switch (mkey) { case INPUT_MOUSEKEY_LEFT: vkey = VK_LBUTTON; break; case INPUT_MOUSEKEY_RIGHT: vkey = VK_RBUTTON; break; case INPUT_MOUSEKEY_MIDDLE: vkey = VK_MBUTTON; break; case INPUT_MOUSEKEY_PGUP: vkey = VK_XBUTTON1; break; case INPUT_MOUSEKEY_PGDOWN: vkey = VK_XBUTTON2; break; } return (GetAsyncKeyState(vkey)&0x8000); } int input_kb_getkey_platform(HWND hwnd, const uint keymap[INPUT_KEY_CNT], enum input_key key) { int keycode = (int)keymap[(uint)key]; return (GetAsyncKeyState(keycode)&0x8000) >> 15; } #endif
27.375
94
0.583022
ec8129f6c57aac5e477a724e30d9969e86926979
5,437
c
C
Kernel Project/OS_Callback.c
pic32/NexOS
c9660a7deda36990fce00a25fb95c23c4e37a4ba
[ "MIT" ]
null
null
null
Kernel Project/OS_Callback.c
pic32/NexOS
c9660a7deda36990fce00a25fb95c23c4e37a4ba
[ "MIT" ]
null
null
null
Kernel Project/OS_Callback.c
pic32/NexOS
c9660a7deda36990fce00a25fb95c23c4e37a4ba
[ "MIT" ]
null
null
null
/* NexOS Kernel Version v1.01.00 Copyright (c) 2022 brodie 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 "../NexOS/Kernel/OS_Callback.h" /* * This intent of this file is to show the user the different callbacks, their * names, and the arguments they take depending on the configuration of the * RTOS. This file does not need to be included in the build if the user decides * to implement the callbacks in their own files. Otherwise, if callbacks are * used, include this file to avoid linking errors and implement your callback * code in each desired function. */ // Kernel.c Callbacks //---------------------------------------------------------------------------------------------------------------------------------------------------------- #if (USING_TASK_CHECK_IN_USER_CALLBACK == 1) BOOL TaskCheckInUserCallback(TASK *Task) { return TRUE; } #endif // end of #if(USING_TASK_CHECK_IN_USER_CALLBACK == 1) #if (USING_CONTEXT_SWITCH_USER_CALLBACK == 1) void ContextSwitchUserCallback(void) { } #endif // end of #if(USING_CONTEXT_SWITCH_USER_CALLBACK == 1) #if (USING_OS_TICK_UPDATE_USER_CALLBACK == 1) void OSTickUpdateUserCallback(UINT32 CurrentTickCount) { } #endif // end of #if (USING_OS_TICK_UPDATE_USER_CALLBACK == 1) #if (USING_ENTER_DEVICE_SLEEP_MODE_USER_CALLBACK == 1) void EnterDeviceSleepModeUserCallback(void) { } #endif // end of #if (USING_ENTER_DEVICE_SLEEP_MODE_USER_CALLBACK == 1) #if (USING_EXIT_DEVICE_SLEEP_MODE_USER_CALLBACK == 1) void ExitDeviceSleepModeUserCallback(void) { } #endif // end of #if (USING_EXIT_DEVICE_SLEEP_MODE_USER_CALLBACK == 1) #if (USING_OS_GENERAL_EXCEPTION_HANDLER == 1) BOOL GeneralExceptionHandlerUserCallback(TASK *CurrentTask, OS_EXCEPTION_CODE ExceptionCode, UINT32 ExceptionAddress, BOOL UserCodeCurrentlyExecuting) { return TRUE; } #endif // end of #if (USING_OS_GENERAL_EXCEPTION_HANDLER == 1) //---------------------------------------------------------------------------------------------------------------------------------------------------------- // Memory.c Callbacks //---------------------------------------------------------------------------------------------------------------------------------------------------------- #if (USING_MEMORY_WARNING_USER_CALLBACK == 1) void MemoryWarningUserCallback(UINT32 HeapUsageInBytes) { } #endif // end of #if (USING_MEMORY_WARNING_USER_CALLBACK == 1) #if (USING_MEMORY_WARNING_CLEAR_USER_CALLBACK == 1) void MemoryWarningClearUserCallback(void) { } #endif // end of #if (USING_MEMORY_WARNING_CLEAR_USER_CALLBACK == 1) //---------------------------------------------------------------------------------------------------------------------------------------------------------- // KernelTasks.c Callbacks //---------------------------------------------------------------------------------------------------------------------------------------------------------- // this method does not have to return, but it still cannot block! #if (USING_IDLE_TASK_USER_CALLBACK == 1) void IdleTaskUserCallback(void *Args) { //DeviceEnterSleepMode(); } #endif // end of #if (USING_IDLE_TASK_USER_CALLBACK == 1) #if (USING_MAINTENANCE_TASK_USER_CALLBACK == 1) void MaintenanceTaskUserCallback(void *Args) { } #endif // end of #if (USING_MAINTENANCE_TASK_USER_CALLBACK == 1) #if (USING_IO_BUFFER_TASK_USER_CALLBACK == 1) void IOBufferTaskUserCallback(void *Args) { } #endif // end of #if (USING_IO_BUFFER_TASK_USER_CALLBACK == 1) //---------------------------------------------------------------------------------------------------------------------------------------------------------- // IOBuffer.c Callbacks //---------------------------------------------------------------------------------------------------------------------------------------------------------- #if (USING_IO_BUFFER_OVERFLOW_CALLBACK == 1) #include "../NexOS/IOBuffer/IOBuffer.h" void IOBufferOverflowCallback(IO_BUFFER_ID IOBufferID) { } #endif // end of #if (USING_IO_BUFFER_OVERFLOW_CALLBACK == 1) //----------------------------------------------------------------------------------------------------------------------------------------------------------
39.977941
156
0.559868
aebd833c9182af247d7afc66ce323b11d3ef222e
33,690
h
C
Firmware/ardupilot/modules/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.h
eanswer/LearningToFly
8d1eeb5a99b185358ec94ba65afceb6747d6438d
[ "MIT" ]
24
2019-08-13T02:39:01.000Z
2022-03-03T15:44:54.000Z
Firmware/ardupilot/modules/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.h
eanswer/LearningToFly
8d1eeb5a99b185358ec94ba65afceb6747d6438d
[ "MIT" ]
4
2020-11-16T02:03:09.000Z
2021-08-19T08:16:48.000Z
Firmware/ardupilot/modules/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.h
eanswer/LearningToFly
8d1eeb5a99b185358ec94ba65afceb6747d6438d
[ "MIT" ]
11
2019-07-28T09:11:40.000Z
2022-03-17T08:08:27.000Z
/* ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio 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. */ /** * @file STM32F0xx/hal_lld.h * @brief STM32F0xx HAL subsystem low level driver header. * @pre This module requires the following macros to be defined in the * @p board.h file: * - STM32_LSECLK. * - STM32_LSEDRV. * - STM32_LSE_BYPASS (optionally). * - STM32_HSECLK. * - STM32_HSE_BYPASS (optionally). * . * One of the following macros must also be defined: * - STM32F030x6, STM32F030x8, STM32F030xC, STM32F070x6, * STM32F070xB for Value Line devices. * - STM32F031x6, STM32F051x8, STM32F071xB, STM32F091xC * for Access Line devices. * - STM32F042x6, STM32F072xB for USB Line devices. * - STM32F038xx, STM32F048xx, STM32F058xx, STM32F078xx, * STM32F098xx for Low Voltage Line devices. * . * * @addtogroup HAL * @{ */ #ifndef HAL_LLD_H #define HAL_LLD_H /* * Registry definitions. */ #include "stm32_registry.h" /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ /** * @name Platform identification macros * @{ */ #if defined(STM32F030x6) || defined(__DOXYGEN__) #define PLATFORM_NAME "STM32F030x6 Entry Level Value Line devices" #elif defined(STM32F030x8) #define PLATFORM_NAME "STM32F030x8 Entry Level Value Line devices" #elif defined(STM32F030xC) #define PLATFORM_NAME "STM32F030xC Entry Level Value Line devices" #elif defined(STM32F070x6) #define PLATFORM_NAME "STM32F070x6 Entry Level Value Line devices" #elif defined(STM32F070xB) #define PLATFORM_NAME "STM32F070xB Entry Level Value Line devices" #elif defined(STM32F031x6) #define PLATFORM_NAME "STM32F031x6 Entry Level Access Line devices" #elif defined(STM32F051x8) #define PLATFORM_NAME "STM32F051x8 Entry Level Access Line devices" #elif defined(STM32F071xB) #define PLATFORM_NAME "STM32F071xB Entry Level Access Line devices" #elif defined(STM32F091xC) #define PLATFORM_NAME "STM32F091xC Entry Level Access Line devices" #elif defined(STM32F042x6) #define PLATFORM_NAME "STM32F042x6 Entry Level USB Line devices" #elif defined(STM32F072xB) #define PLATFORM_NAME "STM32F072xB Entry Level USB Line devices" #elif defined(STM32F038xx) #define PLATFORM_NAME "STM32F038xx Entry Level Low Voltage Line devices" #elif defined(STM32F048xx) #define PLATFORM_NAME "STM32F048xx Entry Level Low Voltage Line devices" #elif defined(STM32F058xx) #define PLATFORM_NAME "STM32F058xx Entry Level Low Voltage Line devices" #elif defined(STM32F078xx) #define PLATFORM_NAME "STM32F078xx Entry Level Low Voltage Line devices" #elif defined(STM32F098xx) #define PLATFORM_NAME "STM32F098xx Entry Level Low Voltage Line devices" #else #error "STM32F0xx device unsupported or not specified" #endif /** @} */ /** * @name Absolute Maximum Ratings * @{ */ /** * @brief Maximum system clock frequency. */ #define STM32_SYSCLK_MAX 48000000 /** * @brief Maximum HSE clock frequency. */ #define STM32_HSECLK_MAX 32000000 /** * @brief Minimum HSE clock frequency. */ #define STM32_HSECLK_MIN 1000000 /** * @brief Maximum LSE clock frequency. */ #define STM32_LSECLK_MAX 1000000 /** * @brief Minimum LSE clock frequency. */ #define STM32_LSECLK_MIN 32768 /** * @brief Maximum PLLs input clock frequency. */ #define STM32_PLLIN_MAX 25000000 /** * @brief Minimum PLLs input clock frequency. */ #define STM32_PLLIN_MIN 1000000 /** * @brief Maximum PLL output clock frequency. */ #define STM32_PLLOUT_MAX 48000000 /** * @brief Minimum PLL output clock frequency. */ #define STM32_PLLOUT_MIN 16000000 /** * @brief Maximum APB clock frequency. */ #define STM32_PCLK_MAX 48000000 /** @} */ /** * @name Internal clock sources * @{ */ #define STM32_HSICLK 8000000 /**< High speed internal clock. */ #define STM32_HSI14CLK 14000000 /**< 14MHz speed internal clock.*/ #define STM32_HSI48CLK 48000000 /**< 48MHz speed internal clock.*/ #define STM32_LSICLK 40000 /**< Low speed internal clock. */ /** @} */ /** * @name PWR_CR register bits definitions * @{ */ #define STM32_PLS_MASK (7 << 5) /**< PLS bits mask. */ #define STM32_PLS_LEV0 (0 << 5) /**< PVD level 0. */ #define STM32_PLS_LEV1 (1 << 5) /**< PVD level 1. */ #define STM32_PLS_LEV2 (2 << 5) /**< PVD level 2. */ #define STM32_PLS_LEV3 (3 << 5) /**< PVD level 3. */ #define STM32_PLS_LEV4 (4 << 5) /**< PVD level 4. */ #define STM32_PLS_LEV5 (5 << 5) /**< PVD level 5. */ #define STM32_PLS_LEV6 (6 << 5) /**< PVD level 6. */ #define STM32_PLS_LEV7 (7 << 5) /**< PVD level 7. */ /** @} */ /** * @name RCC_CFGR register bits definitions * @{ */ #define STM32_SW_HSI (0 << 0) /**< SYSCLK source is HSI. */ #define STM32_SW_HSE (1 << 0) /**< SYSCLK source is HSE. */ #define STM32_SW_PLL (2 << 0) /**< SYSCLK source is PLL. */ #define STM32_SW_HSI48 (3 << 0) /**< SYSCLK source is HSI48. */ #define STM32_HPRE_DIV1 (0 << 4) /**< SYSCLK divided by 1. */ #define STM32_HPRE_DIV2 (8 << 4) /**< SYSCLK divided by 2. */ #define STM32_HPRE_DIV4 (9 << 4) /**< SYSCLK divided by 4. */ #define STM32_HPRE_DIV8 (10 << 4) /**< SYSCLK divided by 8. */ #define STM32_HPRE_DIV16 (11 << 4) /**< SYSCLK divided by 16. */ #define STM32_HPRE_DIV64 (12 << 4) /**< SYSCLK divided by 64. */ #define STM32_HPRE_DIV128 (13 << 4) /**< SYSCLK divided by 128. */ #define STM32_HPRE_DIV256 (14 << 4) /**< SYSCLK divided by 256. */ #define STM32_HPRE_DIV512 (15 << 4) /**< SYSCLK divided by 512. */ #define STM32_PPRE_DIV1 (0 << 8) /**< HCLK divided by 1. */ #define STM32_PPRE_DIV2 (4 << 8) /**< HCLK divided by 2. */ #define STM32_PPRE_DIV4 (5 << 8) /**< HCLK divided by 4. */ #define STM32_PPRE_DIV8 (6 << 8) /**< HCLK divided by 8. */ #define STM32_PPRE_DIV16 (7 << 8) /**< HCLK divided by 16. */ #define STM32_PLLSRC_HSI_DIV2 (0 << 15) /**< PLL clock source is HSI/2. */ #define STM32_PLLSRC_HSI (1 << 15) /**< PLL clock source is HSI */ #define STM32_PLLSRC_HSE (2 << 15) /**< PLL clock source is HSE. */ #define STM32_PLLSRC_HSI48 (3 << 15) /**< PLL clock source is HSI48. */ #define STM32_MCOSEL_NOCLOCK (0 << 24) /**< No clock on MCO pin. */ #define STM32_MCOSEL_HSI14 (1 << 24) /**< HSI14 clock on MCO pin. */ #define STM32_MCOSEL_LSI (2 << 24) /**< LSI clock on MCO pin. */ #define STM32_MCOSEL_LSE (3 << 24) /**< LSE clock on MCO pin. */ #define STM32_MCOSEL_SYSCLK (4 << 24) /**< SYSCLK on MCO pin. */ #define STM32_MCOSEL_HSI (5 << 24) /**< HSI clock on MCO pin. */ #define STM32_MCOSEL_HSE (6 << 24) /**< HSE clock on MCO pin. */ #define STM32_MCOSEL_PLLDIV2 (7 << 24) /**< PLL/2 clock on MCO pin. */ #define STM32_MCOSEL_HSI48 (8 << 24) /**< HSI48 clock on MCO pin. */ #define STM32_MCOPRE_DIV1 (0 << 28) /**< MCO divided by 1. */ #define STM32_MCOPRE_DIV2 (1 << 28) /**< MCO divided by 2. */ #define STM32_MCOPRE_DIV4 (2 << 28) /**< MCO divided by 4. */ #define STM32_MCOPRE_DIV8 (3 << 28) /**< MCO divided by 8. */ #define STM32_MCOPRE_DIV16 (4 << 28) /**< MCO divided by 16. */ #define STM32_MCOPRE_DIV32 (5 << 28) /**< MCO divided by 32. */ #define STM32_MCOPRE_DIV64 (6 << 28) /**< MCO divided by 64. */ #define STM32_MCOPRE_DIV128 (7 << 28) /**< MCO divided by 128. */ #define STM32_PLLNODIV_MASK (1 << 31) /**< MCO PLL divider mask. */ #define STM32_PLLNODIV_DIV2 (0 << 31) /**< MCO PLL is divided by two. */ #define STM32_PLLNODIV_DIV1 (1 << 31) /**< MCO PLL is divided by one. */ /** @} */ /** * @name RCC_CFGR2 register bits definitions * @{ */ #define STM32_PRE_DIV1 (0 << 0) /**< PLLSRC divided by 1. */ #define STM32_PRE_DIV2 (1 << 0) /**< SYSCLK divided by 2. */ #define STM32_PRE_DIV3 (2 << 0) /**< SYSCLK divided by 3. */ #define STM32_PRE_DIV4 (3 << 0) /**< PLLSRC divided by 4. */ #define STM32_PRE_DIV5 (4 << 0) /**< SYSCLK divided by 5. */ #define STM32_PRE_DIV6 (5 << 0) /**< SYSCLK divided by 6. */ #define STM32_PRE_DIV7 (6 << 0) /**< PLLSRC divided by 7. */ #define STM32_PRE_DIV8 (7 << 0) /**< SYSCLK divided by 8. */ #define STM32_PRE_DIV9 (8 << 0) /**< SYSCLK divided by 9. */ #define STM32_PRE_DIV10 (9 << 0) /**< PLLSRC divided by 10. */ #define STM32_PRE_DIV11 (10 << 0) /**< SYSCLK divided by 11. */ #define STM32_PRE_DIV12 (11 << 0) /**< SYSCLK divided by 12. */ #define STM32_PRE_DIV13 (12 << 0) /**< PLLSRC divided by 13. */ #define STM32_PRE_DIV14 (13 << 0) /**< SYSCLK divided by 14. */ #define STM32_PRE_DIV15 (14 << 0) /**< SYSCLK divided by 15. */ #define STM32_PRE_DIV16 (15 << 0) /**< PLLSRC divided by 16. */ /** @} */ /** * @name RCC_CFGR3 register bits definitions * @{ */ #define STM32_USART1SW_MASK (3 << 0) /**< USART1 clock source mask. */ #define STM32_USART1SW_PCLK (0 << 0) /**< USART1 clock is PCLK. */ #define STM32_USART1SW_SYSCLK (1 << 0) /**< USART1 clock is SYSCLK. */ #define STM32_USART1SW_LSE (2 << 0) /**< USART1 clock is LSE. */ #define STM32_USART1SW_HSI (3 << 0) /**< USART1 clock is HSI. */ #define STM32_I2C1SW_MASK (1 << 4) /**< I2C clock source mask. */ #define STM32_I2C1SW_HSI (0 << 4) /**< I2C clock is HSI. */ #define STM32_I2C1SW_SYSCLK (1 << 4) /**< I2C clock is SYSCLK. */ #define STM32_CECSW_MASK (1 << 6) /**< CEC clock source mask. */ #define STM32_CECSW_HSI (0 << 6) /**< CEC clock is HSI/244. */ #define STM32_CECSW_LSE (1 << 6) /**< CEC clock is LSE. */ #define STM32_CECSW_OFF 0xFFFFFFFF /**< CEC clock is not required. */ #define STM32_USBSW_MASK (1 << 7) /**< USB clock source mask. */ #define STM32_USBSW_HSI48 (0 << 7) /**< USB clock is HSI48. */ #define STM32_USBSW_PCLK (1 << 7) /**< USB clock is PCLK. */ /** @} */ /** * @name RCC_BDCR register bits definitions * @{ */ #define STM32_RTCSEL_MASK (3 << 8) /**< RTC clock source mask. */ #define STM32_RTCSEL_NOCLOCK (0 << 8) /**< No clock. */ #define STM32_RTCSEL_LSE (1 << 8) /**< LSE used as RTC clock. */ #define STM32_RTCSEL_LSI (2 << 8) /**< LSI used as RTC clock. */ #define STM32_RTCSEL_HSEDIV (3 << 8) /**< HSE divided by 32 used as RTC clock. */ /** @} */ /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ /** * @name Configuration options * @{ */ /** * @brief Disables the PWR/RCC initialization in the HAL. */ #if !defined(STM32_NO_INIT) || defined(__DOXYGEN__) #define STM32_NO_INIT FALSE #endif /** * @brief Enables or disables the programmable voltage detector. */ #if !defined(STM32_PVD_ENABLE) || defined(__DOXYGEN__) #define STM32_PVD_ENABLE FALSE #endif /** * @brief Sets voltage level for programmable voltage detector. */ #if !defined(STM32_PLS) || defined(__DOXYGEN__) #define STM32_PLS STM32_PLS_LEV0 #endif /** * @brief Enables or disables the HSI clock source. */ #if !defined(STM32_HSI_ENABLED) || defined(__DOXYGEN__) #define STM32_HSI_ENABLED TRUE #endif /** * @brief Enables or disables the HSI14 clock source. */ #if !defined(STM32_HSI14_ENABLED) || defined(__DOXYGEN__) #define STM32_HSI14_ENABLED TRUE #endif /** * @brief Enables or disables the HSI48 clock source. */ #if !defined(STM32_HSI48_ENABLED) || defined(__DOXYGEN__) #define STM32_HSI48_ENABLED FALSE #endif /** * @brief Enables or disables the LSI clock source. */ #if !defined(STM32_LSI_ENABLED) || defined(__DOXYGEN__) #define STM32_LSI_ENABLED FALSE #endif /** * @brief Enables or disables the HSE clock source. */ #if !defined(STM32_HSE_ENABLED) || defined(__DOXYGEN__) #define STM32_HSE_ENABLED TRUE #endif /** * @brief Enables or disables the LSE clock source. */ #if !defined(STM32_LSE_ENABLED) || defined(__DOXYGEN__) #define STM32_LSE_ENABLED FALSE #endif /** * @brief Main clock source selection. * @note If the selected clock source is not the PLL then the PLL is not * initialized and started. * @note The default value is calculated for a 48MHz system clock from * a 8MHz crystal using the PLL. */ #if !defined(STM32_SW) || defined(__DOXYGEN__) #define STM32_SW STM32_SW_PLL #endif /** * @brief Clock source for the PLL. * @note This setting has only effect if the PLL is selected as the * system clock source. * @note The default value is calculated for a 48MHz system clock from * a 8MHz crystal using the PLL. */ #if !defined(STM32_PLLSRC) || defined(__DOXYGEN__) #define STM32_PLLSRC STM32_PLLSRC_HSE #endif /** * @brief Crystal PLL pre-divider. * @note This setting has only effect if the PLL is selected as the * system clock source. * @note The default value is calculated for a 72MHz system clock from * a 8MHz crystal using the PLL. */ #if !defined(STM32_PREDIV_VALUE) || defined(__DOXYGEN__) #define STM32_PREDIV_VALUE 1 #endif /** * @brief PLL multiplier value. * @note The allowed range is 2...16. * @note The default value is calculated for a 48MHz system clock from * a 8MHz crystal using the PLL. */ #if !defined(STM32_PLLMUL_VALUE) || defined(__DOXYGEN__) #define STM32_PLLMUL_VALUE 6 #endif /** * @brief AHB prescaler value. * @note The default value is calculated for a 48MHz system clock from * a 8MHz crystal using the PLL. */ #if !defined(STM32_HPRE) || defined(__DOXYGEN__) #define STM32_HPRE STM32_HPRE_DIV1 #endif /** * @brief APB1 prescaler value. */ #if !defined(STM32_PPRE) || defined(__DOXYGEN__) #define STM32_PPRE STM32_PPRE_DIV1 #endif /** * @brief MCO pin setting. */ #if !defined(STM32_MCOSEL) || defined(__DOXYGEN__) #define STM32_MCOSEL STM32_MCOSEL_NOCLOCK #endif /** * @brief MCO divider setting. */ #if !defined(STM32_MCOPRE) || defined(__DOXYGEN__) #define STM32_MCOPRE STM32_MCOPRE_DIV1 #endif /** * @brief MCO PLL divider setting. */ #if !defined(STM32_PLLNODIV) || defined(__DOXYGEN__) #define STM32_PLLNODIV STM32_PLLNODIV_DIV2 #endif /** * @brief USB Clock source. */ #if !defined(STM32_USBSW) || defined(__DOXYGEN__) #define STM32_USBSW STM32_USBSW_HSI48 #endif /** * @brief CEC clock source. */ #if !defined(STM32_CECSW) || defined(__DOXYGEN__) #define STM32_CECSW STM32_CECSW_HSI #endif /** * @brief I2C1 clock source. */ #if !defined(STM32_I2C1SW) || defined(__DOXYGEN__) #define STM32_I2C1SW STM32_I2C1SW_HSI #endif /** * @brief USART1 clock source. */ #if !defined(STM32_USART1SW) || defined(__DOXYGEN__) #define STM32_USART1SW STM32_USART1SW_PCLK #endif /** * @brief RTC clock source. */ #if !defined(STM32_RTCSEL) || defined(__DOXYGEN__) #define STM32_RTCSEL STM32_RTCSEL_LSI #endif /** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ /* * Configuration-related checks. */ #if !defined(STM32F0xx_MCUCONF) #error "Using a wrong mcuconf.h file, STM32F0xx_MCUCONF not defined" #endif /* * HSI related checks. */ #if STM32_HSI_ENABLED #if (STM32_SW == STM32_SW_PLL) && \ (STM32_PLLSRC == STM32_PLLSRC_HSI) && !STM32_HAS_HSI_PREDIV #error "STM32_PLLSRC_HSI not available on this platform. Select STM32_PLLSRC_HSI_DIV2 instead." #endif #else /* !STM32_HSI_ENABLED */ #if STM32_SW == STM32_SW_HSI #error "HSI not enabled, required by STM32_SW" #endif #if STM32_CECSW == STM32_CECSW_HSI #error "HSI not enabled, required by STM32_CECSW" #endif #if STM32_I2C1SW == STM32_I2C1SW_HSI #error "HSI not enabled, required by STM32_I2C1SW" #endif #if STM32_USART1SW == STM32_USART1SW_HSI #error "HSI not enabled, required by STM32_USART1SW" #endif #if (STM32_SW == STM32_SW_PLL) && \ (STM32_PLLSRC == STM32_PLLSRC_HSI_DIV2) || \ (STM32_PLLSRC == STM32_PLLSRC_HSI) #error "HSI not enabled, required by STM32_SW and STM32_PLLSRC" #endif #if (STM32_MCOSEL == STM32_MCOSEL_HSI) || \ ((STM32_MCOSEL == STM32_MCOSEL_PLLDIV2) && \ ((STM32_PLLSRC == STM32_PLLSRC_HSI_DIV2) || \ (STM32_PLLSRC == STM32_PLLSRC_HSI))) #error "HSI not enabled, required by STM32_MCOSEL" #endif #endif /* !STM32_HSI_ENABLED */ /* * HSI14 related checks. */ #if STM32_HSI14_ENABLED #else /* !STM32_HSI14_ENABLED */ #if STM32_MCOSEL == STM32_MCOSEL_HSI14 #error "HSI14 not enabled, required by STM32_MCOSEL" #endif #endif /* !STM32_HSI14_ENABLED */ /* * HSI48 related checks. */ #if STM32_HSI48_ENABLED #if !STM32_HAS_HSI48 #error "HSI48 not available on this platform" #endif #else /* !STM32_HSI48_ENABLED */ #if STM32_SW == STM32_SW_HSI48 #error "HSI48 not enabled, required by STM32_SW" #endif #if (STM32_MCOSEL == STM32_MCOSEL_HSI48) || \ ((STM32_MCOSEL == STM32_MCOSEL_PLLDIV2) && \ ((STM32_PLLSRC == STM32_PLLSRC_HSI_DIV2) || \ (STM32_PLLSRC == STM32_PLLSRC_HSI48))) #error "HSI48 not enabled, required by STM32_MCOSEL" #endif #if (STM32_SW == STM32_SW_PLL) && (STM32_PLLSRC == STM32_PLLSRC_HSI48) #error "HSI48 not enabled, required by STM32_SW and STM32_PLLSRC" #endif #endif /* !STM32_HSI48_ENABLED */ /* * HSE related checks. */ #if STM32_HSE_ENABLED #if STM32_HSECLK == 0 #error "HSE frequency not defined" #elif (STM32_HSECLK < STM32_HSECLK_MIN) || (STM32_HSECLK > STM32_HSECLK_MAX) #error "STM32_HSECLK outside acceptable range (STM32_HSECLK_MIN...STM32_HSECLK_MAX)" #endif #else /* !STM32_HSE_ENABLED */ #if STM32_SW == STM32_SW_HSE #error "HSE not enabled, required by STM32_SW" #endif #if (STM32_SW == STM32_SW_PLL) && (STM32_PLLSRC == STM32_PLLSRC_HSE) #error "HSE not enabled, required by STM32_SW and STM32_PLLSRC" #endif #if (STM32_MCOSEL == STM32_MCOSEL_HSE) || \ ((STM32_MCOSEL == STM32_MCOSEL_PLLDIV2) && \ (STM32_PLLSRC == STM32_PLLSRC_HSE)) #error "HSE not enabled, required by STM32_MCOSEL" #endif #if STM32_RTCSEL == STM32_RTCSEL_HSEDIV #error "HSE not enabled, required by STM32_RTCSEL" #endif #endif /* !STM32_HSE_ENABLED */ /* * LSI related checks. */ #if STM32_LSI_ENABLED #else /* !STM32_LSI_ENABLED */ #if STM32_RTCSEL == STM32_RTCSEL_LSI #error "LSI not enabled, required by STM32_RTCSEL" #endif #endif /* !STM32_LSI_ENABLED */ /* * LSE related checks. */ #if STM32_LSE_ENABLED #if (STM32_LSECLK == 0) #error "LSE frequency not defined" #endif #if (STM32_LSECLK < STM32_LSECLK_MIN) || (STM32_LSECLK > STM32_LSECLK_MAX) #error "STM32_LSECLK outside acceptable range (STM32_LSECLK_MIN...STM32_LSECLK_MAX)" #endif #if !defined(STM32_LSEDRV) #error "STM32_LSEDRV not defined" #endif #if (STM32_LSEDRV >> 3) > 3 #error "STM32_LSEDRV outside acceptable range ((0<<3)...(3<<3))" #endif #else /* !STM32_LSE_ENABLED */ #if STM32_CECSW == STM32_CECSW_LSE #error "LSE not enabled, required by STM32_CECSW" #endif #if STM32_USART1SW == STM32_USART1SW_LSE #error "LSE not enabled, required by STM32_USART1SW" #endif #if STM32_RTCSEL == STM32_RTCSEL_LSE #error "LSE not enabled, required by STM32_RTCSEL" #endif #endif /* !STM32_LSE_ENABLED */ /* PLL activation conditions.*/ #if (STM32_SW == STM32_SW_PLL) || \ (STM32_USBSW == STM32_USBSW_PCLK) || \ (STM32_MCOSEL == STM32_MCOSEL_PLLDIV2) || \ defined(__DOXYGEN__) /** * @brief PLL activation flag. */ #define STM32_ACTIVATE_PLL TRUE #else #define STM32_ACTIVATE_PLL FALSE #endif /* HSE, HSI prescaler setting check.*/ #if ((STM32_PREDIV_VALUE >= 1) || (STM32_PREDIV_VALUE <= 16)) #define STM32_PREDIV ((STM32_PREDIV_VALUE - 1) << 0) #else #error "invalid STM32_PREDIV value specified" #endif /** * @brief PLLMUL field. */ #if ((STM32_PLLMUL_VALUE >= 2) && (STM32_PLLMUL_VALUE <= 16)) || \ defined(__DOXYGEN__) #define STM32_PLLMUL ((STM32_PLLMUL_VALUE - 2) << 18) #else #error "invalid STM32_PLLMUL_VALUE value specified" #endif /** * @brief PLL input clock frequency. */ #if (STM32_PLLSRC == STM32_PLLSRC_HSE) || defined(__DOXYGEN__) #define STM32_PLLCLKIN (STM32_HSECLK / STM32_PREDIV_VALUE) #elif STM32_PLLSRC == STM32_PLLSRC_HSI_DIV2 #define STM32_PLLCLKIN (STM32_HSICLK / 2) #elif STM32_PLLSRC == STM32_PLLSRC_HSI #define STM32_PLLCLKIN (STM32_HSICLK / STM32_PREDIV_VALUE) #elif STM32_PLLSRC == STM32_PLLSRC_HSI48 #define STM32_PLLCLKIN (STM32_HSI48CLK / STM32_PREDIV_VALUE) #else #error "invalid STM32_PLLSRC value specified" #endif /* PLL input frequency range check.*/ #if (STM32_PLLCLKIN < STM32_PLLIN_MIN) || (STM32_PLLCLKIN > STM32_PLLIN_MAX) #error "STM32_PLLCLKIN outside acceptable range (STM32_PLLIN_MIN...STM32_PLLIN_MAX)" #endif /** * @brief PLL output clock frequency. */ #define STM32_PLLCLKOUT (STM32_PLLCLKIN * STM32_PLLMUL_VALUE) /* PLL output frequency range check.*/ #if (STM32_PLLCLKOUT < STM32_PLLOUT_MIN) || (STM32_PLLCLKOUT > STM32_PLLOUT_MAX) #error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)" #endif /** * @brief System clock source. */ #if (STM32_SW == STM32_SW_PLL) || defined(__DOXYGEN__) #define STM32_SYSCLK STM32_PLLCLKOUT #elif (STM32_SW == STM32_SW_HSI) #define STM32_SYSCLK STM32_HSICLK #elif (STM32_SW == STM32_SW_HSI48) #define STM32_SYSCLK STM32_HSI48CLK #elif (STM32_SW == STM32_SW_HSE) #define STM32_SYSCLK STM32_HSECLK #else #error "invalid STM32_SW value specified" #endif /* Check on the system clock.*/ #if STM32_SYSCLK > STM32_SYSCLK_MAX #error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)" #endif /** * @brief AHB frequency. */ #if (STM32_HPRE == STM32_HPRE_DIV1) || defined(__DOXYGEN__) #define STM32_HCLK (STM32_SYSCLK / 1) #elif STM32_HPRE == STM32_HPRE_DIV2 #define STM32_HCLK (STM32_SYSCLK / 2) #elif STM32_HPRE == STM32_HPRE_DIV4 #define STM32_HCLK (STM32_SYSCLK / 4) #elif STM32_HPRE == STM32_HPRE_DIV8 #define STM32_HCLK (STM32_SYSCLK / 8) #elif STM32_HPRE == STM32_HPRE_DIV16 #define STM32_HCLK (STM32_SYSCLK / 16) #elif STM32_HPRE == STM32_HPRE_DIV64 #define STM32_HCLK (STM32_SYSCLK / 64) #elif STM32_HPRE == STM32_HPRE_DIV128 #define STM32_HCLK (STM32_SYSCLK / 128) #elif STM32_HPRE == STM32_HPRE_DIV256 #define STM32_HCLK (STM32_SYSCLK / 256) #elif STM32_HPRE == STM32_HPRE_DIV512 #define STM32_HCLK (STM32_SYSCLK / 512) #else #error "invalid STM32_HPRE value specified" #endif /* AHB frequency check.*/ #if STM32_HCLK > STM32_SYSCLK_MAX #error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)" #endif /** * @brief APB frequency. */ #if (STM32_PPRE == STM32_PPRE_DIV1) || defined(__DOXYGEN__) #define STM32_PCLK (STM32_HCLK / 1) #elif STM32_PPRE == STM32_PPRE_DIV2 #define STM32_PCLK (STM32_HCLK / 2) #elif STM32_PPRE == STM32_PPRE_DIV4 #define STM32_PCLK (STM32_HCLK / 4) #elif STM32_PPRE == STM32_PPRE_DIV8 #define STM32_PCLK (STM32_HCLK / 8) #elif STM32_PPRE == STM32_PPRE_DIV16 #define STM32_PCLK (STM32_HCLK / 16) #else #error "invalid STM32_PPRE value specified" #endif /* APB frequency check.*/ #if STM32_PCLK > STM32_PCLK_MAX #error "STM32_PCLK exceeding maximum frequency (STM32_PCLK_MAX)" #endif /* STM32_PLLNODIV check.*/ #if (STM32_PLLNODIV != STM32_PLLNODIV_DIV2) && \ (STM32_PLLNODIV != STM32_PLLNODIV_DIV1) #error "invalid STM32_PLLNODIV value specified" #endif /** * @brief MCO clock before divider. */ #if (STM32_MCOSEL == STM32_MCOSEL_NOCLOCK) || defined(__DOXYGEN__) #define STM32_MCODIVCLK 0 #elif STM32_MCOSEL == STM32_MCOSEL_HSI14 #define STM32_MCODIVCLK STM32_HSI14CLK #elif STM32_MCOSEL == STM32_MCOSEL_LSI #define STM32_MCODIVCLK STM32_LSICLK #elif STM32_MCOSEL == STM32_MCOSEL_LSE #define STM32_MCODIVCLK STM32_LSECLK #elif STM32_MCOSEL == STM32_MCOSEL_SYSCLK #define STM32_MCODIVCLK STM32_SYSCLK #elif STM32_MCOSEL == STM32_MCOSEL_HSI #define STM32_MCODIVCLK STM32_HSICLK #elif STM32_MCOSEL == STM32_MCOSEL_HSE #define STM32_MCODIVCLK STM32_HSECLK #elif STM32_MCOSEL == STM32_MCOSEL_PLLDIV2 #if STM32_PLLNODIV == STM32_PLLNODIV_DIV2 #define STM32_MCODIVCLK (STM32_PLLCLKOUT / 2) #else #define STM32_MCODIVCLK (STM32_PLLCLKOUT / 1) #endif #elif STM32_MCOSEL == STM32_MCOSEL_HSI48 #define STM32_MCODIVCLK STM32_HSI48CLK #else #error "invalid STM32_MCOSEL value specified" #endif /** * @brief MCO output pin clock. */ #if (STM32_MCOPRE == STM32_MCOPRE_DIV1) || defined(__DOXYGEN__) #define STM32_MCOCLK STM32_MCODIVCLK #elif (STM32_MCOPRE == STM32_MCOPRE_DIV2) && STM32_HAS_MCO_PREDIV #define STM32_MCOCLK (STM32_MCODIVCLK / 2) #elif (STM32_MCOPRE == STM32_MCOPRE_DIV4) && STM32_HAS_MCO_PREDIV #define STM32_MCOCLK (STM32_MCODIVCLK / 4) #elif (STM32_MCOPRE == STM32_MCOPRE_DIV8) && STM32_HAS_MCO_PREDIV #define STM32_MCOCLK (STM32_MCODIVCLK / 8) #elif (STM32_MCOPRE == STM32_MCOPRE_DIV16) && STM32_HAS_MCO_PREDIV #define STM32_MCOCLK (STM32_MCODIVCLK / 16) #elif !STM32_HAS_MCO_PREDIV #error "MCO_PREDIV not available on this platform. Select STM32_MCODIVCLK." #else #error "invalid STM32_MCOPRE value specified" #endif /** * @brief RTC clock. */ #if (STM32_RTCSEL == STM32_RTCSEL_LSE) || defined(__DOXYGEN__) #define STM32_RTCCLK STM32_LSECLK #elif STM32_RTCSEL == STM32_RTCSEL_LSI #define STM32_RTCCLK STM32_LSICLK #elif STM32_RTCSEL == STM32_RTCSEL_HSEDIV #define STM32_RTCCLK (STM32_HSECLK / 32) #elif STM32_RTCSEL == STM32_RTCSEL_NOCLOCK #define STM32_RTCCLK 0 #else #error "invalid source selected for RTC clock" #endif /** * @brief USB frequency. */ #if (STM32_USBSW == STM32_USBSW_HSI48) || defined(__DOXYGEN__) #define STM32_USBCLK STM32_HSI48CLK #elif STM32_USBSW == STM32_USBSW_PCLK #define STM32_USBCLK STM32_PLLCLKOUT #else #error "invalid source selected for USB clock" #endif /** * @brief CEC frequency. */ #if (STM32_CECSW == STM32_CECSW_HSI) || defined(__DOXYGEN__) #define STM32_CECCLK STM32_HSICLK #elif STM32_CECSW == STM32_CECSW_LSE #define STM32_CECCLK STM32_LSECLK #elif STM32_CECSW == STM32_CECSW_OFF #define STM32_CECCLK 0 #else #error "invalid source selected for CEC clock" #endif /** * @brief I2C1 frequency. */ #if (STM32_I2C1SW == STM32_I2C1SW_HSI) || defined(__DOXYGEN__) #define STM32_I2C1CLK STM32_HSICLK #elif STM32_I2C1SW == STM32_I2C1SW_SYSCLK #define STM32_I2C1CLK STM32_SYSCLK #else #error "invalid source selected for I2C1 clock" #endif /** * @brief USART1 frequency. */ #if (STM32_USART1SW == STM32_USART1SW_PCLK) || defined(__DOXYGEN__) #define STM32_USART1CLK STM32_PCLK #elif STM32_USART1SW == STM32_USART1SW_SYSCLK #define STM32_USART1CLK STM32_SYSCLK #elif STM32_USART1SW == STM32_USART1SW_LSE #define STM32_USART1CLK STM32_LSECLK #elif STM32_USART1SW == STM32_USART1SW_HSI #define STM32_USART1CLK STM32_HSICLK #else #error "invalid source selected for USART1 clock" #endif /** * @brief USART2 frequency. */ #define STM32_USART2CLK STM32_PCLK /** * @brief USART3 frequency. */ #define STM32_USART3CLK STM32_PCLK /** * @brief USART4 frequency. */ #define STM32_UART4CLK STM32_PCLK /** * @brief USART5 frequency. */ #define STM32_UART5CLK STM32_PCLK /** * @brief USART6 frequency. */ #define STM32_USART6CLK STM32_PCLK /** * @brief Timers clock. */ #if (STM32_PPRE == STM32_PPRE_DIV1) || defined(__DOXYGEN__) #define STM32_TIMCLK1 (STM32_PCLK * 1) #define STM32_TIMCLK2 (STM32_PCLK * 1) #else #define STM32_TIMCLK1 (STM32_PCLK * 2) #define STM32_TIMCLK2 (STM32_PCLK * 2) #endif /** * @brief Flash settings. */ #if (STM32_HCLK <= 24000000) || defined(__DOXYGEN__) #define STM32_FLASHBITS 0x00000010 #else #define STM32_FLASHBITS 0x00000011 #endif /* * For compatibility with driver assuming a specific PPRE clock. */ #define STM32_PCLK1 STM32_PCLK #define STM32_PCLK2 STM32_PCLK /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ /* Various helpers.*/ #include "nvic.h" #include "stm32_isr.h" #include "stm32_dma.h" #include "stm32_rcc.h" #ifdef __cplusplus extern "C" { #endif void hal_lld_init(void); void stm32_clock_init(void); #ifdef __cplusplus } #endif #endif /* HAL_LLD_H */ /** @} */
33.995964
96
0.589314
d91d7f20322a97e2310424238c5947378d93a33d
958
h
C
source/include/config.h
ndoxx/wcore
8b24519e9a01b0397ba2959507e1e12ea3a3aa44
[ "Apache-2.0" ]
null
null
null
source/include/config.h
ndoxx/wcore
8b24519e9a01b0397ba2959507e1e12ea3a3aa44
[ "Apache-2.0" ]
null
null
null
source/include/config.h
ndoxx/wcore
8b24519e9a01b0397ba2959507e1e12ea3a3aa44
[ "Apache-2.0" ]
null
null
null
#ifndef CONFIG_H #define CONFIG_H #include <map> #include <vector> #include <filesystem> #include <vector> #include "singleton.hpp" #include "value_map.h" #include "wtypes.h" #include "xml_parser.h" namespace fs = std::filesystem; namespace wcore { // Singleton class for holding named global variables class Config: public Singleton<Config>, public ValueMap { private: // Paths fs::path self_path_; fs::path conf_path_; Config(): initialized_(false){} ~Config(){} bool initialized_; public: friend Config& Singleton<Config>::Instance(); friend void Singleton<Config>::Kill(); inline const fs::path& get_root_directory() const { return root_path_; } inline const fs::path& get_config_directory() const { return conf_path_; } // Initialize directory info void init(); #ifdef __DEBUG__ void init_logger_channels(); #endif // __DEBUG__ }; #define CONFIG Config::Instance() } #endif // CONFIG_H
18.075472
78
0.701461
03f41dedc10ca95627b6f489a0b2abe5a7a03956
354
h
C
sorttypes.h
leonore13/All-the-Sorting
613ec8305dea1d12015e379833878aedf471a927
[ "MIT" ]
null
null
null
sorttypes.h
leonore13/All-the-Sorting
613ec8305dea1d12015e379833878aedf471a927
[ "MIT" ]
null
null
null
sorttypes.h
leonore13/All-the-Sorting
613ec8305dea1d12015e379833878aedf471a927
[ "MIT" ]
null
null
null
// // sorttypes.h // All the Sorts // // Created by Sophia Nguyen on 2016-06-19. // Copyright © 2016 Sophia Nguyen. All rights reserved. // #ifndef sorttypes_h #define sorttypes_h void selectionSort(int arr[], int size); void insertionSort(int arr[], int size); #include "selectionsort.cpp" #include "insertionsort.cpp" #endif /* sorttypes_h */
17.7
56
0.706215
644bc489d78145e121337236186f252f2764692b
441
h
C
Archived/v1/WCDistractionFreeXcodePlugin/Headers/PlugIns/IDEInterfaceBuilderKit/IBAccessorizedScrollViewSegmentedCell.h
wokalski/Distraction-Free-Xcode-plugin
54ab4b9d9825e8370855b7985d6ff39d64c19f25
[ "MIT" ]
25
2016-03-03T07:43:56.000Z
2021-09-05T08:47:40.000Z
Archived/v1/WCDistractionFreeXcodePlugin/Headers/PlugIns/IDEInterfaceBuilderKit/IBAccessorizedScrollViewSegmentedCell.h
wokalski/Distraction-Free-Xcode-plugin
54ab4b9d9825e8370855b7985d6ff39d64c19f25
[ "MIT" ]
8
2016-02-23T18:40:20.000Z
2016-08-18T13:21:05.000Z
Archived/v1/WCDistractionFreeXcodePlugin/Headers/PlugIns/IDEInterfaceBuilderKit/IBAccessorizedScrollViewSegmentedCell.h
wokalski/Distraction-Free-Xcode-plugin
54ab4b9d9825e8370855b7985d6ff39d64c19f25
[ "MIT" ]
4
2016-02-24T13:24:27.000Z
2016-06-28T12:50:36.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "DVTFlatSegmentedControlCell.h" @interface IBAccessorizedScrollViewSegmentedCell : DVTFlatSegmentedControlCell { } - (void)drawWithFrame:(struct CGRect)arg1 inView:(id)arg2; - (struct CGRect)boundsOfSegment:(unsigned long long)arg1; - (double)_menuDelayTimeForSegment:(long long)arg1; @end
23.210526
83
0.746032
237bd0476cfab3a6c3d7fe202c8e70df8ed4f2bb
7,455
h
C
src/matrix/cMatrix_test.h
mnmpdadish/ctint
6628ae12d0072e059af66ff9208610dacae1ffee
[ "MIT" ]
null
null
null
src/matrix/cMatrix_test.h
mnmpdadish/ctint
6628ae12d0072e059af66ff9208610dacae1ffee
[ "MIT" ]
null
null
null
src/matrix/cMatrix_test.h
mnmpdadish/ctint
6628ae12d0072e059af66ff9208610dacae1ffee
[ "MIT" ]
null
null
null
#pragma once #include "cMatrix.h" // ---------------------------- testing routines ------------------------------- int test_cCopy(int verbose) { //if(verbose) printf("\n-------------\ntest_cCopy():"); cMatrix A, B, C; init_cMatrix(&A,3); init_cMatrix(&B,0); init_cMatrix(&C,0); double complex * p = A.data; *p++ = 1.0+3.4*I; *p++ = 4.0; *p++ = 0.0+1.4*I; *p++ = 2.0+0.0*I; *p++ = 1.5+1.*I; *p++ = 0.0+3.2*I; *p++ = 0.0+1.1*I; *p++ = 2.0+0.1*I; *p++ = 1.0; transpose_cMatrix(&A); // with this meth of input, we need to transpose if(verbose){ printf("\nA=\n"); print_cMatrix(&A); printf("\nB=\n"); print_cMatrix(&B); printf("%s\n",areEqual_cMatrix(&A,&B)? "B==A": "B!=A"); } copy_cMatrix(&A,&B); if(verbose){ printf("\ncopying\nB=\n"); print_cMatrix(&B); printf("%s\n",areEqual_cMatrix(&A,&B)? "B==A": "B!=A"); } copySub_cMatrix(&A,&C,2); if(verbose){ printf("\ncopying\nC=\n"); print_cMatrix(&C); } // ---------------------------- cVector X,Y; init_cVector(&X,3); init_cVector(&Y,0); p = X.data; *p++ = 1.0+I*1.2; *p++ = 3.3; *p++ = 5.0; if(verbose){ printf("\nX=\n"); print_cVector(&X); printf("\nY=\n"); print_cVector(&Y); printf("%s\n",areEqual_cVector(&X,&Y)? "X==Y": "X!=Y"); } copy_cVector(&X,&Y); if(verbose){ printf("\ncopying\nY=\n"); print_cVector(&Y); printf("%s\n",areEqual_cVector(&X,&Y)? "X==Y": "X!=Y"); } int Nerror = !areEqual_cVector(&X,&Y) + !areEqual_cMatrix(&A,&B); free_cMatrix(&A); free_cMatrix(&B); free_cMatrix(&C); free_cVector(&X); free_cVector(&Y); return Nerror; } int test_cMatrixVectorProduct(int verbose) { //if(verbose) printf("\n-------------\ntest_cMatrixVectorProduct():\n"); cMatrix A; init_cMatrix(&A,3); double complex * p = A.data; *p++ = 1.0+1.0*I; *p++ = 5.0+1.0*I; *p++ = 2.0+0.0*I; *p++ = 4.0+0.0*I; *p++ = 1.0+0.0*I; *p++ = 2.0+4.0*I; *p++ = 3.0+4.0*I; *p++ = 2.0+1.0*I; *p++ = 1.0+0.0*I; if(verbose) {printf("\nA=\n"); print_cMatrix(&A);} cVector X; init_cVector(&X,3); cVector Y; init_cVector(&Y,3); p = X.data; *p++ = 3.1+5*I; *p++ = 2.1+1.0*I; *p++ = 0.1+0.4*I; if(verbose) {printf("\nX=\n"); print_cVector(&X);} cMatrixVectorProduct(&A,&X, 1.0,&Y); if(verbose) {printf("\nmultiplication\nY=A*X=\n"); print_cVector(&Y);} cVector Sol; init_cVector(&Sol,3); p = Sol.data; *p++ = 5.2 + 13.7*I; *p++ = 12.4 + 30.*I; *p++ = 6.5 + 20.8*I; int Nerror = !areEqual_cVector(&Y,&Sol); free_cMatrix(&A); free_cVector(&X); free_cVector(&Y); free_cVector(&Sol); return Nerror; } int test_cDag(int verbose) { //if(verbose) printf("\n-------------\ntest_cTranspose():\n"); cMatrix A, Sol; init_cMatrix(&A,3); init_cMatrix(&Sol,3); double complex * p = A.data; *p++ = 1.0+1*I; *p++ = 0.0+0*I; *p++ = 0.0+5.*I; *p++ = 4.0+3*I; *p++ = 1.0+1*I; *p++ = 0.0+1.1*I; *p++ = 3.0+2*I; *p++ = 2.0+0*I; *p++ = 1.0+0.2*I; if(verbose) {printf("\nA=\n"); print_cMatrix(&A);} dag_cMatrix(&A); if(verbose) {printf("\ndagging\nA=\n"); print_cMatrix(&A);} p = Sol.data; *p++ = 1.0-1*I; *p++ = 4.0-3*I; *p++ = 3.0-2*I; *p++ = 0.0-0*I; *p++ = 1.0-1*I; *p++ = 2.0-0*I; *p++ = 0.0-5*I; *p++ = 0.0-1.1*I; *p++ = 1.0-0.2*I; int Nerror = !areEqual_cMatrix(&Sol,&A); free_cMatrix(&A); free_cMatrix(&Sol); return Nerror; } int test_cMultiply(int verbose) { //if(verbose) printf("\n-------------\ntest_cMultiply():\n"); cMatrix A, B, C, Sol; init_cMatrix(&A,3); init_cMatrix(&B,3); init_cMatrix(&C,0); init_cMatrix(&Sol,3); double complex * p = A.data; *p++ = 1.0+1.0*I; *p++ = 5.0+1.0*I; *p++ = 2.0+0.0*I; *p++ = 4.0+0.0*I; *p++ = 1.0+0.0*I; *p++ = 2.0+4.0*I; *p++ = 3.0+4.0*I; *p++ = 2.0+1.0*I; *p++ = 1.0+0.0*I; //transpose_cMatrix(&A); // with this meth of input, we need to transpose p = B.data; *p++ = 2.0+0.0*I; *p++ = 4.0+4.0*I; *p++ = 4.0+0.1*I; *p++ = 1.0+0.0*I; *p++ = 5.0+0.0*I; *p++ = 1.0+1.0*I; *p++ = 2.1+1.0*I; *p++ = 2.1+2.1*I; *p++ = 5.0+0.5*I; //transpose_cMatrix(&B); // with this meth of input, we need to transpose if(verbose){ printf("\nA=\n"); print_cMatrix(&A); printf("\nB=\n"); print_cMatrix(&B); } cMatrixMatrixMultiplication(&A,&B,&C); if(verbose) { printf("\nC=A*B=\n"); print_cMatrix(&C); } //solution: p = Sol.data; *p++ = 29.6 + 34.3*I; *p++ = 21.9 + 10.2*I; *p++ = 24.1*I; *p++ = 20. + 8.*I; *p++ = 11.0+4.0*I; *p++ = 13. + 21.*I; *p++ = 22.5+33.*I; *p++ = 21.1+15.2*I; *p++ = 5.0+15.1*I; if(verbose) { printf("\nSol=\n"); print_cMatrix(&Sol); } int Nerror = !areEqual_cMatrix(&C,&Sol); free_cMatrix(&A); free_cMatrix(&B); free_cMatrix(&C); free_cMatrix(&Sol); return Nerror; } int test_cInvert(int verbose) { //if(verbose) printf("\n-------------\ntest_cInvert():\n"); cMatrix A, B, C, Sol; init_cMatrix(&A,3); init_cMatrix(&B,3); init_cMatrix(&C,3); init_cMatrix(&Sol,3); double complex * p = A.data; *p++ = 1.0+1.0*I; *p++ = 5.0+1.0*I; *p++ = 2.0+0.0*I; *p++ = 4.0+0.0*I; *p++ = 1.0+0.0*I; *p++ = 2.0+4.0*I; *p++ = 3.0+4.0*I; *p++ = 2.0+1.0*I; *p++ = 1.0+0.0*I; transpose_cMatrix(&A); // with this meth of input, we need to transpose if(verbose) {printf("\nA=\n"); print_cMatrix(&A);} copy_cMatrix(&A,&B); if(verbose) {printf("\ncopying\nB=\n"); print_cMatrix(&B);} invert_cMatrix(&B); if(verbose) {printf("\ninverting\nB=\n"); print_cMatrix(&B);} cMatrixMatrixMultiplication(&A,&B,&C); if(verbose) {printf("\nC=A*B=\n"); print_cMatrix(&C);} //solution: p = Sol.data; *p++ = 1.0; *p++ = 0.0; *p++ = 0.0; *p++ = 0.0; *p++ = 1.0; *p++ = 0.0; *p++ = 0.0; *p++ = 0.0; *p++ = 1.0; transpose_cMatrix(&Sol); // with this meth of input, we need to transpose int Nerror = !areEqual_cMatrix(&C,&Sol); free_cMatrix(&A); free_cMatrix(&B); free_cMatrix(&C); free_cMatrix(&Sol); return Nerror; } int test_cAddition(int verbose) { //if(verbose) printf("\n-------------\ntest_cMultiply():\n"); cMatrix A, B, C, Sol; init_cMatrix(&A,3); init_cMatrix(&B,3); init_cMatrix(&C,0); init_cMatrix(&Sol,3); double complex * p = A.data; *p++ = 1.0+1.0*I; *p++ = 5.0+1.0*I; *p++ = 2.0+0.0*I; *p++ = 4.0+0.0*I; *p++ = 1.0+0.0*I; *p++ = 2.0+4.0*I; *p++ = 3.0+4.0*I; *p++ = 2.0+1.0*I; *p++ = 1.0+0.0*I; //transpose_cMatrix(&A); // with this meth of input, we need to transpose p = B.data; *p++ = 2.0+0.0*I; *p++ = 4.0+4.0*I; *p++ = 4.0+0.1*I; *p++ = 1.0+0.0*I; *p++ = 5.0+0.0*I; *p++ = 1.0+1.0*I; *p++ = 2.1+1.0*I; *p++ = 2.1+2.1*I; *p++ = 5.0+0.5*I; //transpose_cMatrix(&B); // with this meth of input, we need to transpose if(verbose){ printf("\nA=\n"); print_cMatrix(&A); printf("\nB=\n"); print_cMatrix(&B); } cMatrixMatrixAddition(&A,&B,&C, 1.0); // to addition in place, do: cMatrixMatrixAddition(&A,&B,&B, 1.0) if(verbose) { printf("\nC=A+B=\n"); print_cMatrix(&C); } //solution: p = Sol.data; *p++ = 3.0+1.0*I; *p++ = 9.0+5.0*I; *p++ = 6.0+0.1*I; *p++ = 5.0+0.0*I; *p++ = 6.0+0.0*I; *p++ = 3.0+5.0*I; *p++ = 5.1+5.0*I; *p++ = 4.1+3.1*I; *p++ = 6.0+0.5*I; if(verbose) { printf("\nSol=\n"); print_cMatrix(&Sol); } int Nerror = !areEqual_cMatrix(&C,&Sol); free_cMatrix(&A); free_cMatrix(&B); free_cMatrix(&C); free_cMatrix(&Sol); return Nerror; }
26.72043
106
0.512408
fcef64877acb231b631f772b771c72bb711ed302
4,012
h
C
win/include/maya/adskDataChannelSerializer.h
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
10
2018-03-30T16:09:02.000Z
2021-12-07T07:29:19.000Z
win/include/maya/adskDataChannelSerializer.h
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
null
null
null
win/include/maya/adskDataChannelSerializer.h
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
9
2018-06-02T09:18:49.000Z
2021-12-20T09:24:35.000Z
#ifndef adskDataChannelSerializer_h #define adskDataChannelSerializer_h #include <istream> // for std::istream #include <ostream> // for std::ostream #include <string> // for std::string #include <maya/adskCommon.h> #include <maya/adskDataSerializer.h> // for DeclareSerializerFormatType namespace adsk { namespace Data { class Channel; // **************************************************************************** /*! \class adsk::Data::ChannelSerializer \brief Class handling the definition of the format for serialization of data Channels The adsk::Data::Channel class manages channel definitions. They are persisted using a serialization format implemented through the adsk::Data::ChannelSerializer hierarchy. The base class defines the interface and manages the list of available channel serialization formats. */ class METADATA_EXPORT ChannelSerializer { DeclareSerializerFormatType( ChannelSerializer ); public: ChannelSerializer (); virtual ~ChannelSerializer (); /*! \fn Channel* ChannelSerializer::read(std::istream& cSrc, std::string& errors) const; Implement this to parse the serialized form of an adsk::Data::Channel object. Given an input stream containing your serialization of an adsk::Data::Channel object parse the data and create the adsk::Data::Channel object it describes. If there are any problems the detailed error information should be returned in the errors string. The adsk::Data::Channel parsing should also recursively populate any adsk::Data::Streams within the adsk::Data::Channel. This method should be capable of understanding any data your adsk::Data::ChannelSerializer::write() method can provide. \param[in] cSrc Input stream containing serialization of the adsk::Data::Channel object \param[out] errors String containing description of parse errors \return Pointer to the newly created adsk::Data::Channel object */ virtual Channel* read ( std::istream& cSrc, std::string& errors ) const = 0; /*! \fn int ChannelSerializer::write(const Channel& dataToWrite, std::ostream& cDst, std::string& errors) const; Implement this to output the adsk::Data::Channel definition in your serialization format Given an adsk::Data::Channel object and an output stream as destination write out enough information so that you can recreate the adsk::Data::Channel from data in the output stream using your adsk::Data::ChannelSerializer::read() method. This serialization should recursively include all of the adsk::Data::Stream in the adsk::Data::Channel. \param[in] dataToWrite adsk::Data::Channel to be serialized \param[out] cDst Output stream to which the object is to be serialized \param[out] errors String containing description of output errors \return number of errors found during write (0 means success) */ virtual int write ( const Channel& dataToWrite, std::ostream& cDst, std::string& errors) const = 0; /*! \fn void ChannelSerializer::getFormatDescription(std::ostream& info) const; Implement this to provide a description of your adsk::Data::Channel serialization format. Output a textual description of your serialization format into the given stream. \param[out] info Output stream to receive your serialization format description */ virtual void getFormatDescription(std::ostream& info) const = 0; }; } // namespace Data } // namespace adsk //========================================================= //- // Copyright 2015 Autodesk, Inc. All rights reserved. // Use of this software is subject to the terms of the // Autodesk license agreement provided at the time of // installation or download, or which otherwise accompanies // this software in either electronic or hard copy form. //+ //========================================================= #endif // adskDataChannelSerializer_h
36.144144
111
0.695165
d8154a4b5d1831f1ffc4f196bcddbe04936b9c8f
12,728
c
C
thirdparty/netutils-v1.0.0/ntp/ntp.c
shangliyun/lu_xing_xiang_one_os
02b3900bbc2303291ad6b16d59f50df786af4e27
[ "Apache-2.0" ]
2
2021-10-05T02:34:18.000Z
2022-01-18T15:22:41.000Z
thirdparty/netutils-v1.0.0/ntp/ntp.c
shangliyun/lu_xing_xiang_one_os
02b3900bbc2303291ad6b16d59f50df786af4e27
[ "Apache-2.0" ]
1
2021-06-24T04:27:40.000Z
2021-06-24T04:27:40.000Z
thirdparty/netutils-v1.0.0/ntp/ntp.c
shangliyun/lu_xing_xiang_one_os
02b3900bbc2303291ad6b16d59f50df786af4e27
[ "Apache-2.0" ]
2
2021-06-24T04:08:28.000Z
2022-03-07T06:37:24.000Z
/* * * (C) 2014 David Lettier. * (C) 2018 Armink (armink.ztl@gmail.com) * * http://www.lettier.com/ * * NTP client. * * Compiled with gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) (GCC). * * Tested on Linux 3.8.11-200.fc18.x86_64 #1 SMP Wed May 1 19:44:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux. * Tested on RT-Thread 3.0.0+ * * To compile: $ gcc main.c -o ntpClient.out * * Usage: $ ./ntpClient.out * */ #include <os_kernel.h> #ifdef PKG_USING_NTP #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <sys/types.h> #include <os_device.h> #include <arpa/inet.h> #include <sys/socket.h> #include <netdb.h> #if defined(NET_USING_MOLINK) #include <mo_object.h> #elif defined(NET_USING_LWIP) #include <lwip/netif.h> #endif /* NET_USING_MOLINK */ #ifdef OS_USING_RTC #include <rtc.h> #endif /* OS_USING_RTC */ #define DBG_TAG "ntp" #define DBG_LEVEL DBG_INFO #include <os_dbg.h> #ifdef NETUTILS_NTP_TIMEZONE #define NTP_TIMEZONE NETUTILS_NTP_TIMEZONE #endif #ifdef NETUTILS_NTP_HOSTNAME #define NTP_HOSTNAME1 NETUTILS_NTP_HOSTNAME #else #define NTP_HOSTNAME1 NULL #endif #ifdef NETUTILS_NTP_HOSTNAME2 #define NTP_HOSTNAME2 NETUTILS_NTP_HOSTNAME2 #else #define NTP_HOSTNAME2 NULL #endif #ifdef NETUTILS_NTP_HOSTNAME3 #define NTP_HOSTNAME3 NETUTILS_NTP_HOSTNAME3 #else #define NTP_HOSTNAME3 NULL #endif #define NTP_TIMESTAMP_DELTA 2208988800ull #ifndef NTP_TIMEZONE #define NTP_TIMEZONE 8 #endif #define LI(packet) (uint8_t) ((packet.li_vn_mode & 0xC0) >> 6) // (li & 11 000 000) >> 6 #define VN(packet) (uint8_t) ((packet.li_vn_mode & 0x38) >> 3) // (vn & 00 111 000) >> 3 #define MODE(packet) (uint8_t) ((packet.li_vn_mode & 0x07) >> 0) // (mode & 00 000 111) >> 0 // Structure that defines the 48 byte NTP packet protocol. typedef struct { uint8_t li_vn_mode; // Eight bits. li, vn, and mode. // li. Two bits. Leap indicator. // vn. Three bits. Version number of the protocol. // mode. Three bits. Client will pick mode 3 for client. uint8_t stratum; // Eight bits. Stratum level of the local clock. uint8_t poll; // Eight bits. Maximum interval between successive messages. uint8_t precision; // Eight bits. Precision of the local clock. uint32_t rootDelay; // 32 bits. Total round trip delay time. uint32_t rootDispersion; // 32 bits. Max error aloud from primary clock source. uint32_t refId; // 32 bits. Reference clock identifier. uint32_t refTm_s; // 32 bits. Reference time-stamp seconds. uint32_t refTm_f; // 32 bits. Reference time-stamp fraction of a second. uint32_t origTm_s; // 32 bits. Originate time-stamp seconds. uint32_t origTm_f; // 32 bits. Originate time-stamp fraction of a second. uint32_t rxTm_s; // 32 bits. Received time-stamp seconds. uint32_t rxTm_f; // 32 bits. Received time-stamp fraction of a second. uint32_t txTm_s; // 32 bits and the most important field the client cares about. Transmit time-stamp seconds. uint32_t txTm_f; // 32 bits. Transmit time-stamp fraction of a second. } ntp_packet; // Total: 384 bits or 48 bytes. static ntp_packet packet = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static int sendto_ntp_server(int sockfd, const char *host_name, struct sockaddr_in *serv_addr) { struct hostent *server; socklen_t addr_len = sizeof(struct sockaddr_in); /* NTP UDP port number. */ int portno = 123; server = gethostbyname(host_name); if (server == NULL) { LOG_D(DBG_TAG, "No such host(%s)", host_name); return OS_ERROR; } else { /* Zero out the server address structure. */ memset((char *)serv_addr, 0, addr_len); serv_addr->sin_family = AF_INET; /* Convert the port number integer to network big-endian style and save it to the server address structure. */ serv_addr->sin_port = htons(portno); /* Copy the server's IP address to the server address structure. */ memcpy(&serv_addr->sin_addr.s_addr, (char *) server->h_addr, server->h_length); return sendto(sockfd, (char *) &packet, sizeof(ntp_packet), 0, (const struct sockaddr *)serv_addr, addr_len); } } /** * Get the UTC time from NTP server * * @param host_name NTP server host name, NULL: will using default host name * * @note this function is not reentrant * * @return >0: success, current UTC time * =0: get failed */ time_t ntp_get_time(const char *host_name) { /* the delay(ms) between two receive */ #define RECV_TIME_DELAY_MS 10 /* NTP receive timeout(S) */ #define NTP_GET_TIMEOUT 5 /* number of NTP servers */ #define NTP_SERVER_NUM 3 int sockfd, n, i = 0, server_num = 0; struct sockaddr_in serv_addr[NTP_SERVER_NUM]; os_tick_t start = 0; time_t new_time = 0; socklen_t addr_len = sizeof(struct sockaddr_in); const char *const host_name_buf[NTP_SERVER_NUM] = {NTP_HOSTNAME1, NTP_HOSTNAME2, NTP_HOSTNAME3}; /* Create and zero out the packet. All 48 bytes worth. */ memset(&packet, 0, sizeof(ntp_packet)); /* Set the first byte's bits to 00,011,011 for li = 0, vn = 3, and mode = 3. The rest will be left set to zero. Represents 27 in base 10 or 00011011 in base 2. */ *((char *) &packet + 0) = 0x1b; #if defined(NET_USING_MOLINK) || defined(NET_USING_LWIP) { #define NTP_INTERNET 0x02 #define NTP_INTERNET_BUFF_LEN 18 #define NTP_INTERNET_MONTH_LEN 4 #define NTP_INTERNET_DATE_LEN 16 #ifndef SW_VER_NUM #define SW_VER_NUM 0x00000000 #endif const char month[][NTP_INTERNET_MONTH_LEN] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; char date[NTP_INTERNET_DATE_LEN] = {0}; uint8_t send_data[NTP_INTERNET_BUFF_LEN] = {0}; uint8_t index, moth_num = 0; uint16_t check = 0; /* get build moth value*/ os_snprintf(date, NTP_INTERNET_DATE_LEN, "%s", __DATE__); for (index = 0; index < sizeof(month) / NTP_INTERNET_MONTH_LEN; index++) { if (memcmp(date, month[index], NTP_INTERNET_MONTH_LEN - 1) == 0) { moth_num = index + 1; break; } } send_data[0] = NTP_INTERNET; #if 0 /* get hardware address */ { #if defined(NET_USING_LWIP) && !defined(NET_USING_MOLINK) extern struct netif *netif_default; struct netif *dev = netif_default; #else /* TODO: use def_modules_obj instead, or call modules API get hwaddr info */ extern struct nic *g_nic_default; struct nic *dev = g_nic_default; #endif for (index = 0; index < dev->hwaddr_len; index++) { send_data[index + 1] = dev->hwaddr[index] + moth_num; } } #endif send_data[9] = 1; send_data[10] = 2; send_data[11] = 3; send_data[12] = (uint8_t)(SW_VER_NUM >> 24); send_data[13] = (uint8_t)(SW_VER_NUM >> 16); send_data[14] = (uint8_t)(SW_VER_NUM >> 8); send_data[15] = (uint8_t)(SW_VER_NUM & 0xFF); /* get the check value */ for (index = 0; index < NTP_INTERNET_BUFF_LEN - sizeof(check); index++) { check += (uint8_t)send_data[index]; } send_data[NTP_INTERNET_BUFF_LEN - 2] = check >> 8; send_data[NTP_INTERNET_BUFF_LEN - 1] = check & 0xFF; memcpy(((char *)&packet + 4), send_data, NTP_INTERNET_BUFF_LEN); } #endif /* NET_USING_MOLINK || NET_USING_LWIP */ /* Create a UDP socket. */ sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sockfd < 0) { LOG_E(DBG_TAG, "Create socket failed"); return 0; } if (host_name) { /* access the incoming host_name server */ if (sendto_ntp_server(sockfd, host_name, serv_addr) >= 0) { server_num = 1; } } else { /* use the static default NTP server */ for (i = 0; i < NTP_SERVER_NUM; i++) { if (host_name_buf[i] == NULL || strlen(host_name_buf[i]) == 0) continue; if (sendto_ntp_server(sockfd, host_name_buf[i], &serv_addr[server_num]) >= 0) { server_num ++; } } } if (server_num <= 0) { closesocket(sockfd); return 0; } start = os_tick_get(); while (os_tick_get() <= start + NTP_GET_TIMEOUT * OS_TICK_PER_SECOND) { for (i = 0; i < server_num; i++) { /* non-blocking receive the packet back from the server. If n == -1, it failed. */ n = recvfrom(sockfd, (char *) &packet, sizeof(ntp_packet), MSG_DONTWAIT, (struct sockaddr *)&serv_addr[i], &addr_len); if (n <= 0) { LOG_D(DBG_TAG, "Reading from server %s error (%d).", inet_ntoa(serv_addr[i].sin_addr.s_addr), n); } else if (n > 0) { goto __exit; } } os_task_mdelay(RECV_TIME_DELAY_MS); } __exit: if (os_tick_get() <= start + NTP_GET_TIMEOUT * OS_TICK_PER_SECOND) { /* These two fields contain the time-stamp seconds as the packet left the NTP server. The number of seconds correspond to the seconds passed since 1900. ntohl() converts the bit/byte order from the network's to host's "endianness". */ packet.txTm_s = ntohl(packet.txTm_s); // Time-stamp seconds. packet.txTm_f = ntohl(packet.txTm_f); // Time-stamp fraction of a second. /* Extract the 32 bits that represent the time-stamp seconds (since NTP epoch) from when the packet left the server. Subtract 70 years worth of seconds from the seconds since 1900. This leaves the seconds since the UNIX epoch of 1970. (1900)------------------(1970)**************************************(Time Packet Left the Server) */ new_time = (time_t)(packet.txTm_s - NTP_TIMESTAMP_DELTA); } else { LOG_E(DBG_TAG, "Receive the socket from server timeout (%dS).", NTP_GET_TIMEOUT); } closesocket(sockfd); return new_time; } /** * Get the local time from NTP server * * @param host_name NTP server host name, NULL: will using default host name * * @return >0: success, current local time, offset timezone by NTP_TIMEZONE * =0: get failed */ time_t ntp_get_local_time(const char *host_name) { time_t cur_time = ntp_get_time(host_name); if (cur_time) { /* add the timezone offset for set_time/set_date */ cur_time += NTP_TIMEZONE * 3600; } return cur_time; } /** * Sync current local time to RTC by NTP * * @param host_name NTP server host name, NULL: will using default host name * * @return >0: success, current local time, offset timezone by NTP_TIMEZONE * =0: sync failed */ time_t ntp_sync_to_rtc(const char *host_name) { #ifdef OS_USING_RTC struct tm *cur_tm; #endif time_t cur_time = ntp_get_local_time(host_name); if (cur_time) { #ifdef OS_USING_RTC cur_tm = localtime(&cur_time); set_time(cur_tm->tm_hour, cur_tm->tm_min, cur_tm->tm_sec); cur_tm = localtime(&cur_time); set_date(cur_tm->tm_year + 1900, cur_tm->tm_mon + 1, cur_tm->tm_mday); #endif /* OS_USING_RTC */ } return cur_time; } static void ntp_sync(const char *host_name) { time_t cur_time = ntp_sync_to_rtc(host_name); if (cur_time) { os_kprintf("Get local time from NTP server: %s", ctime((const time_t *) &cur_time)); #ifdef OS_USING_RTC os_kprintf("The system time is updated. Timezone is %d.\n", NTP_TIMEZONE); #else os_kprintf("The system time update failed. Please enable OS_USING_RTC.\n"); #endif /* OS_USING_RTC */ } } static void cmd_ntp_sync(int argc, char **argv) { char *host_name = NULL; if (argc > 1) { host_name = argv[1]; } ntp_sync(host_name); } #ifdef OS_USING_SHELL #include <shell.h> SH_CMD_EXPORT(ntp_sync, cmd_ntp_sync, "Update time by NTP(Network Time Protocol): ntp_sync [host_name]"); #endif /* OS_USING_SHELL */ #endif /* PKG_USING_NTP */
30.66988
130
0.60803
9cb0f0609379359bf88621a269d947cf88cce4b0
9,508
c
C
third_party/ffmpeg/libavutil/encryption_info.c
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
third_party/ffmpeg/libavutil/encryption_info.c
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
third_party/ffmpeg/libavutil/encryption_info.c
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
/** * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "encryption_info.h" #include "mem.h" #include "intreadwrite.h" #define FF_ENCRYPTION_INFO_EXTRA 24 // The format of the AVEncryptionInfo side data: // u32be scheme // u32be crypt_byte_block // u32be skip_byte_block // u32be key_id_size // u32be iv_size // u32be subsample_count // u8[key_id_size] key_id // u8[iv_size] iv // { // u32be bytes_of_clear_data // u32be bytes_of_protected_data // }[subsample_count] AVEncryptionInfo *av_encryption_info_alloc(uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size) { AVEncryptionInfo *info; info = av_mallocz(sizeof(*info)); if (!info) return NULL; info->key_id = av_mallocz(key_id_size); info->key_id_size = key_id_size; info->iv = av_mallocz(iv_size); info->iv_size = iv_size; info->subsamples = av_mallocz_array(subsample_count, sizeof(*info->subsamples)); info->subsample_count = subsample_count; // Allow info->subsamples to be NULL if there are no subsamples. if (!info->key_id || !info->iv || (!info->subsamples && subsample_count)) { av_encryption_info_free(info); return NULL; } return info; } AVEncryptionInfo *av_encryption_info_clone(const AVEncryptionInfo *info) { AVEncryptionInfo *ret; if (!info) return NULL; ret = av_encryption_info_alloc(info->subsample_count, info->key_id_size, info->iv_size); if (!ret) return NULL; ret->scheme = info->scheme; ret->crypt_byte_block = info->crypt_byte_block; ret->skip_byte_block = info->skip_byte_block; memcpy(ret->iv, info->iv, info->iv_size); memcpy(ret->key_id, info->key_id, info->key_id_size); memcpy(ret->subsamples, info->subsamples, sizeof(*info->subsamples) * info->subsample_count); return ret; } void av_encryption_info_free(AVEncryptionInfo *info) { if (info) { av_free(info->key_id); av_free(info->iv); av_free(info->subsamples); av_free(info); } } AVEncryptionInfo *av_encryption_info_get_side_data(const uint8_t* buffer, size_t size) { AVEncryptionInfo *info; uint64_t key_id_size, iv_size, subsample_count, i; if (!buffer || size < FF_ENCRYPTION_INFO_EXTRA) return NULL; key_id_size = AV_RB32(buffer + 12); iv_size = AV_RB32(buffer + 16); subsample_count = AV_RB32(buffer + 20); if (size < FF_ENCRYPTION_INFO_EXTRA + key_id_size + iv_size + subsample_count * 8) return NULL; info = av_encryption_info_alloc(subsample_count, key_id_size, iv_size); if (!info) return NULL; info->scheme = AV_RB32(buffer); info->crypt_byte_block = AV_RB32(buffer + 4); info->skip_byte_block = AV_RB32(buffer + 8); memcpy(info->key_id, buffer + 24, key_id_size); memcpy(info->iv, buffer + key_id_size + 24, iv_size); buffer += key_id_size + iv_size + 24; for (i = 0; i < subsample_count; i++) { info->subsamples[i].bytes_of_clear_data = AV_RB32(buffer); info->subsamples[i].bytes_of_protected_data = AV_RB32(buffer + 4); buffer += 8; } return info; } uint8_t *av_encryption_info_add_side_data(const AVEncryptionInfo *info, size_t *size) { uint8_t *buffer, *cur_buffer; uint32_t i; if (UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA < info->key_id_size || UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA - info->key_id_size < info->iv_size || (UINT32_MAX - FF_ENCRYPTION_INFO_EXTRA - info->key_id_size - info->iv_size) / 8 < info->subsample_count) { return NULL; } *size = FF_ENCRYPTION_INFO_EXTRA + info->key_id_size + info->iv_size + (info->subsample_count * 8); cur_buffer = buffer = av_malloc(*size); if (!buffer) return NULL; AV_WB32(cur_buffer, info->scheme); AV_WB32(cur_buffer + 4, info->crypt_byte_block); AV_WB32(cur_buffer + 8, info->skip_byte_block); AV_WB32(cur_buffer + 12, info->key_id_size); AV_WB32(cur_buffer + 16, info->iv_size); AV_WB32(cur_buffer + 20, info->subsample_count); cur_buffer += 24; memcpy(cur_buffer, info->key_id, info->key_id_size); cur_buffer += info->key_id_size; memcpy(cur_buffer, info->iv, info->iv_size); cur_buffer += info->iv_size; for (i = 0; i < info->subsample_count; i++) { AV_WB32(cur_buffer, info->subsamples[i].bytes_of_clear_data); AV_WB32(cur_buffer + 4, info->subsamples[i].bytes_of_protected_data); cur_buffer += 8; } return buffer; } // The format of the AVEncryptionInitInfo side data: // u32be system_id_size // u32be num_key_ids // u32be key_id_size // u32be data_size // u8[system_id_size] system_id // u8[key_id_size][num_key_id] key_ids // u8[data_size] data #define FF_ENCRYPTION_INIT_INFO_EXTRA 16 AVEncryptionInitInfo *av_encryption_init_info_alloc( uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size) { AVEncryptionInitInfo *info; uint32_t i; info = av_mallocz(sizeof(*info)); if (!info) return NULL; info->system_id = av_mallocz(system_id_size); info->system_id_size = system_id_size; info->key_ids = key_id_size ? av_mallocz_array(num_key_ids, sizeof(*info->key_ids)) : NULL; info->num_key_ids = num_key_ids; info->key_id_size = key_id_size; info->data = av_mallocz(data_size); info->data_size = data_size; // Allow pointers to be NULL if the size is 0. if ((!info->system_id && system_id_size) || (!info->data && data_size) || (!info->key_ids && num_key_ids && key_id_size)) { av_encryption_init_info_free(info); return NULL; } if (key_id_size) { for (i = 0; i < num_key_ids; i++) { info->key_ids[i] = av_mallocz(key_id_size); if (!info->key_ids[i]) { av_encryption_init_info_free(info); return NULL; } } } return info; } void av_encryption_init_info_free(AVEncryptionInitInfo *info) { uint32_t i; if (info) { for (i = 0; i < info->num_key_ids; i++) { av_free(info->key_ids[i]); } av_free(info->system_id); av_free(info->key_ids); av_free(info->data); av_free(info); } } AVEncryptionInitInfo *av_encryption_init_info_get_side_data( const uint8_t *side_data, size_t side_data_size) { AVEncryptionInitInfo *info; uint64_t system_id_size, num_key_ids, key_id_size, data_size, i; if (!side_data || side_data_size < FF_ENCRYPTION_INIT_INFO_EXTRA) return NULL; system_id_size = AV_RB32(side_data); num_key_ids = AV_RB32(side_data + 4); key_id_size = AV_RB32(side_data + 8); data_size = AV_RB32(side_data + 12); // UINT32_MAX + UINT32_MAX + UINT32_MAX * UINT32_MAX == UINT64_MAX if (side_data_size - FF_ENCRYPTION_INIT_INFO_EXTRA < system_id_size + data_size + num_key_ids * key_id_size) return NULL; info = av_encryption_init_info_alloc(system_id_size, num_key_ids, key_id_size, data_size); if (!info) return NULL; memcpy(info->system_id, side_data + 16, system_id_size); side_data += system_id_size + 16; for (i = 0; i < num_key_ids; i++) { memcpy(info->key_ids[i], side_data, key_id_size); side_data += key_id_size; } memcpy(info->data, side_data, data_size); return info; } uint8_t *av_encryption_init_info_add_side_data(const AVEncryptionInitInfo *info, size_t *side_data_size) { uint8_t *buffer, *cur_buffer; uint32_t i, max_size; if (UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA < info->system_id_size || UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA - info->system_id_size < info->data_size) { return NULL; } if (info->num_key_ids) { max_size = UINT32_MAX - FF_ENCRYPTION_INIT_INFO_EXTRA - info->system_id_size - info->data_size; if (max_size / info->num_key_ids < info->key_id_size) return NULL; } *side_data_size = FF_ENCRYPTION_INIT_INFO_EXTRA + info->system_id_size + info->data_size + (info->num_key_ids * info->key_id_size); cur_buffer = buffer = av_malloc(*side_data_size); if (!buffer) return NULL; AV_WB32(cur_buffer, info->system_id_size); AV_WB32(cur_buffer + 4, info->num_key_ids); AV_WB32(cur_buffer + 8, info->key_id_size); AV_WB32(cur_buffer + 12, info->data_size); cur_buffer += 16; memcpy(cur_buffer, info->system_id, info->system_id_size); cur_buffer += info->system_id_size; for (i = 0; i < info->num_key_ids; i++) { memcpy(cur_buffer, info->key_ids[i], info->key_id_size); cur_buffer += info->key_id_size; } memcpy(cur_buffer, info->data, info->data_size); return buffer; }
31.799331
114
0.675957
1438f6a3b8a4885af7b7956ef59db7041a826fa2
638
h
C
ZZUIKit/Classes/Ex/ZZUIKitEx.h
Ox8BADFOOD/ZZUIK
a524e1d7125a8a3e58a7654aa763636c5a5283bb
[ "MIT" ]
3
2020-12-18T10:44:38.000Z
2021-06-02T04:48:18.000Z
ZZUIKit/Classes/Ex/ZZUIKitEx.h
Ox8BADFOOD/ZZUIK
a524e1d7125a8a3e58a7654aa763636c5a5283bb
[ "MIT" ]
null
null
null
ZZUIKit/Classes/Ex/ZZUIKitEx.h
Ox8BADFOOD/ZZUIK
a524e1d7125a8a3e58a7654aa763636c5a5283bb
[ "MIT" ]
1
2021-01-28T10:09:25.000Z
2021-01-28T10:09:25.000Z
// // ZZUIKitEx.h // Pods // // Created by Max on 2021/1/7. // #ifndef ZZUIKitEx_h #define ZZUIKitEx_h #import "ZZUIKitTools.h" #import "ZZFrame.h" #import "UIView+ZZFrame.h" #import "UIView+ZZEx.h" #import "UIView+ZZShot.h" #import "UIView+ZZGesture.h" #import "UIImage+ZZEx.h" #import "UIButton+ZZEx.h" #import "UIButton+ZZAnima.h" #import "UIView+ZZCornerRadius.h" #import "ZZThrottleBtn.h" #import "UILabel+Ex.h" #import "UILabel+ZZPadding.h" #import "UILabel+ZZStroke.h" #import "UIViewController+ZZEx.h" #import <ZZFoundation/ZZFoundation.h> #import "UITableView+ZZEx.h" #import "UIView+Shape.h" #endif /* ZZUIKitEx_h */
17.722222
37
0.721003
ca9bd0a4084681667620f0aaa2cdfff2e0f0bfcc
2,229
h
C
chrome/browser/ui/views/extensions/extension_installed_bubble_view.h
nagineni/chromium-crosswalk
5725642f1c67d0f97e8613ec1c3e8107ab53fdf8
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
231
2015-01-08T09:04:44.000Z
2021-12-30T03:03:10.000Z
chrome/browser/ui/views/extensions/extension_installed_bubble_view.h
j4ckfrost/android_external_chromium_org
a1a3dad8b08d1fcf6b6b36c267158ed63217c780
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2017-02-14T21:55:58.000Z
2017-02-14T21:55:58.000Z
chrome/browser/ui/views/extensions/extension_installed_bubble_view.h
j4ckfrost/android_external_chromium_org
a1a3dad8b08d1fcf6b6b36c267158ed63217c780
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
268
2015-01-21T05:53:28.000Z
2022-03-25T22:09:01.000Z
// Copyright 2013 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 CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ #include "base/compiler_specific.h" #include "chrome/browser/ui/extensions/extension_installed_bubble.h" #include "ui/views/bubble/bubble_delegate.h" class Browser; namespace extensions { class Extension; } // Provides feedback to the user upon successful installation of an // extension. Depending on the type of extension, the Bubble will // point to: // OMNIBOX_KEYWORD-> The omnibox. // BROWSER_ACTION -> The browserAction icon in the toolbar. // PAGE_ACTION -> A preview of the pageAction icon in the location // bar which is shown while the Bubble is shown. // GENERIC -> The wrench menu. This case includes pageActions that // don't specify a default icon. class ExtensionInstalledBubbleView : public ExtensionInstalledBubble::Delegate, public views::BubbleDelegateView { public: // Creates the ExtensionInstalledBubbleView and schedules it to be shown once // the extension has loaded. |extension| is the installed extension. |browser| // is the browser window which will host the bubble. |icon| is the install // icon of the extension. static void Show(const extensions::Extension* extension, Browser* browser, const SkBitmap& icon); private: ExtensionInstalledBubbleView(const extensions::Extension* extension, Browser* browser, const SkBitmap& icon); virtual ~ExtensionInstalledBubbleView(); // ExtensionInstalledBubble::Delegate: virtual bool MaybeShowNow() OVERRIDE; // views::WidgetDelegate: virtual void WindowClosing() OVERRIDE; // views::BubbleDelegate: virtual gfx::Rect GetAnchorRect() OVERRIDE; ExtensionInstalledBubble bubble_; DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView); }; #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_
36.540984
80
0.731718
cab46d481f5e6f8b99c21db8301045e2420a350b
46,527
c
C
devel/src/trecrun.c
cyclaero/zettair
13a2ebdeca3da0ac037568f0bca022aea357db68
[ "Unlicense" ]
6
2019-04-12T10:50:44.000Z
2021-03-26T00:07:29.000Z
devel/src/trecrun.c
cyclaero/zettair
13a2ebdeca3da0ac037568f0bca022aea357db68
[ "Unlicense" ]
null
null
null
devel/src/trecrun.c
cyclaero/zettair
13a2ebdeca3da0ac037568f0bca022aea357db68
[ "Unlicense" ]
3
2019-12-18T02:31:18.000Z
2021-03-26T00:07:24.000Z
/* trecrun.c is a tool that answers queries in trec topic files and * outputs the answers in a format suitable for evaluation by the * trec_eval set of scripts * * trec_eval is available from ftp://ftp.cs.cornell.edu/pub/smart/ * or http://trec.nist.gov/trec_eval/ * * written nml 2003-06-06 * */ #include "zettair.h" #include "def.h" #include "getlongopt.h" #include "mlparse_wrap.h" #include "docmap.h" /* needed to set cache values on index load */ #include "index.h" #include "str.h" #include "summarise.h" #include "trec_eval.h" #include "timings.h" #include "zpthread.h" #include <assert.h> #include <ctype.h> #include <errno.h> #include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <stdio.h> #include <stdlib.h> static void print_usage(FILE *output, const char *progname) { const char *name = strrchr(progname, '/'); if (name) { name++; } else { name = progname; } fprintf(output, "usage: '%s index', where index is the name of the index " "to query\n", name); fprintf(output, " query options:\n"); fprintf(output, " -f,--file=[topic_file]: add topic_file to list of " "topic files\n"); fprintf(output, " -F,--file-list=[file]: add files listed in file to " "list of topic files\n"); fprintf(output, " -r,--runid=[run_id]: output run_id as id for this " "evaluation\n"); fprintf(output, " -n,--number-results=[num]: number of results to " "output per query\n"); fprintf(output, " -t,--title: use title in query\n"); fprintf(output, " -d,--description: use description in query\n"); fprintf(output, " -a,--narrative: use narrative in query\n"); fprintf(output, " --print-queries: print topic queries to stderr\n"); fprintf(output, " --timing: print total querying time to stderr\n"); fprintf(output, " (excludes index loading time)\n"); fprintf(output, " --big-and-fast: use more memory\n"); fprintf(output, " --dummy: insert dummy results for topics with no " "results\n"); fprintf(output, " --non-stop: don't halt on empty topics\n"); fprintf(output, " --query-stop=[filename]: use filename as stoplist\n"); fprintf(output, " (or use default if no file give)\n"); fprintf(output, " --qrels=[filename]: evaluate effectiveness using " "the given TREC qrels\n"); fprintf(output, " -h,--help: this message\n"); fprintf(output, " -v,--version: print version\n"); fprintf(output, "\n"); fprintf(output, " query metric options:\n"); fprintf(output, " --anh-impact: evaluate using impact-ordered lists\n" " (must have specified --anh-impact while indexing)\n"); fprintf(output, " -o,--okapi: use Okapi BM25 metric\n"); fprintf(output, " -1,--k1=[double]: set Okapi BM25 k1 value\n"); fprintf(output, " -3,--k3=[double]: set Okapi BM25 k3 value\n"); fprintf(output, " -b,--b=[double]: set Okapi BM25 b value\n"); fprintf(output, " -p,--pivoted-cosine=[double]: use pivoted cosine " "metric, with given pivot\n"); fprintf(output, " -c,--cosine: use cosine metric\n"); fprintf(output, " --hawkapi=[double]: use Dave Hawking's metric, " "with alpha given\n"); fprintf(output, " --dirichlet=[uint]: use Dirichlet-smoothed LM " "metric, with mu given\n"); return; } /* struct to hold arguments */ struct args { char **topic_file; /* topic files containing queries */ unsigned int topic_files; /* number of topic files */ struct index *idx; /* index to query */ char *run_id; /* run_id to output */ unsigned int numresults; /* number of results per topic */ unsigned int numaccumulators; /* accumulator limit for eval */ int title; /* whether to use title */ int descr; /* whether to use description */ int narr; /* whether to use narrative */ enum index_search_opts sopts; /* search options */ struct index_search_opt sopt; /* search options structure */ int lopts; /* index load options */ struct index_load_opt lopt; /* index load options structure */ int print_queries; /* whether to print out queries */ int timing; /* whether to time only */ struct treceval_qrels *qrels; /* qrels structure if we want results * evaluated */ unsigned int memory; /* amount of memory to use */ int phrase; /* whether to run as phrases */ unsigned int sloppiness; /* sloppiness of phrases to run */ unsigned int cutoff; /* phrase must occur within this many * words */ int dummy; /* whether to print dummy results */ int cont; /* whether to continue evaluation * through errors */ int parallel; /* whether to evaluate topics from * different files in parallel */ char *stoplist; /* stop file */ }; static void free_args(struct args *args) { unsigned int i; if (args->topic_file) { for (i = 0; i < args->topic_files; i++) { if (args->topic_file[i]) { free(args->topic_file[i]); args->topic_file[i] = NULL; } } free(args->topic_file); } if (args->stoplist) { free(args->stoplist); } if (args->idx) { index_delete(args->idx); args->idx = NULL; } if (args->run_id) { free(args->run_id); args->run_id = NULL; } if (args->qrels) { treceval_qrels_delete(&args->qrels); } free(args); return; } /* internal function to add a topic file to the args */ static int add_topic_file(struct args *args, const char *file) { void *ptr; struct stat statbuf; if ((stat((const char *) file, &statbuf) == 0) && (ptr = realloc(args->topic_file, sizeof(char*) * (args->topic_files + 1))) && (args->topic_file = ptr) && (args->topic_file[args->topic_files] = str_dup(file))) { args->topic_files++; return 1; } else { return 0; } } /* internal function to add a file of topic files to the args */ static int add_topic_file_file(struct args *args, const char *file) { char filenamebuf[FILENAME_MAX + 1]; char format[50]; FILE *fp; snprintf(format, 50, "%%%ds", FILENAME_MAX); if ((fp = fopen((const char *) file, "rb"))) { while (fscanf(fp, format, filenamebuf) && !feof(fp) && !ferror(fp)) { filenamebuf[FILENAME_MAX] = '\0'; if (!add_topic_file(args, filenamebuf)) { return 0; } } fclose(fp); return 1; } return 0; } /* internal function to load an index from a parameters file */ static struct index *load_index(const char *prefix, unsigned int memory, int lopts, struct index_load_opt * lopt) { char filename[FILENAME_MAX + 1]; struct index *idx; if ((idx = index_load((const char *) prefix, memory, lopts, lopt)) || ((snprintf((char *) filename, FILENAME_MAX, "%s.%s", prefix, INDSUF)) && (idx = index_load((const char *) filename, memory, INDEX_LOAD_NOOPT, NULL)))) { return idx; } else { return NULL; } } enum { OPT_FILE, OPT_FILELIST, OPT_NUMRESULTS, OPT_RUNID, OPT_PRINTQUERIES, OPT_OKAPI, OPT_DIRICHLET, OPT_HAWKAPI, OPT_K1, OPT_K3, OPT_B, OPT_PIVOTED_COSINE, OPT_COSINE, OPT_TITLE, OPT_DESCRIPTION, OPT_NARRATIVE, OPT_HELP, OPT_VERSION, OPT_QRELS, OPT_TIMING, OPT_ACCUMULATOR_LIMIT, OPT_IGNORE_VERSION, OPT_MEMORY, OPT_ANH_IMPACT, OPT_PHRASE, OPT_DUMMY, OPT_CUTOFF, OPT_PARSEBUF, OPT_TABLESIZE, OPT_BIG_AND_FAST, OPT_NONSTOP, OPT_STOP, OPT_PARALLEL, OPT_DYNAMIC, OPT_DYNAMIC_PARAMS }; static struct args *parse_args(unsigned int argc, char **argv, FILE *output) { struct args *args; int err = 0, quiet = 0, id; long int num; /* temporary space for numeric conversion */ char *tmp; /* temporary space */ unsigned int ind; const char *arg; struct getlongopt *parser; enum getlongopt_ret ret = GETLONGOPT_OK; struct getlongopt_opt opts[] = { {"file", 'f', GETLONGOPT_ARG_REQUIRED, OPT_FILE}, {"file-list", 'F', GETLONGOPT_ARG_REQUIRED, OPT_FILELIST}, {"number-results", 'n', GETLONGOPT_ARG_REQUIRED, OPT_NUMRESULTS}, {"runid", 'r', GETLONGOPT_ARG_REQUIRED, OPT_RUNID}, {"print-queries", '\0', GETLONGOPT_ARG_NONE, OPT_PRINTQUERIES}, {"timing", '\0', GETLONGOPT_ARG_NONE, OPT_TIMING}, {"okapi", 'o', GETLONGOPT_ARG_NONE, OPT_OKAPI}, {"dirichlet", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DIRICHLET}, {"hawkapi", '\0', GETLONGOPT_ARG_REQUIRED, OPT_HAWKAPI}, {"k1", '1', GETLONGOPT_ARG_REQUIRED, OPT_K1}, {"k3", '3', GETLONGOPT_ARG_REQUIRED, OPT_K3}, {"b", 'b', GETLONGOPT_ARG_REQUIRED, OPT_B}, {"pivoted-cosine", 'p', GETLONGOPT_ARG_REQUIRED, OPT_PIVOTED_COSINE}, {"cosine", 'c', GETLONGOPT_ARG_NONE, OPT_COSINE}, {"anh-impact", '\0', GETLONGOPT_ARG_NONE, OPT_ANH_IMPACT}, {"metric", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DYNAMIC}, {"metric-parameters", '\0', GETLONGOPT_ARG_REQUIRED, OPT_DYNAMIC_PARAMS}, {"title", 't', GETLONGOPT_ARG_NONE, OPT_TITLE}, {"description", 'd', GETLONGOPT_ARG_NONE, OPT_DESCRIPTION}, {"narrative", 'a', GETLONGOPT_ARG_NONE, OPT_NARRATIVE}, {"qrels", 'q', GETLONGOPT_ARG_REQUIRED, OPT_QRELS}, {"accumulator-limit", 'A', GETLONGOPT_ARG_REQUIRED, OPT_ACCUMULATOR_LIMIT}, {"ignore-version", '\0', GETLONGOPT_ARG_NONE, OPT_IGNORE_VERSION}, {"help", 'h', GETLONGOPT_ARG_NONE, OPT_HELP}, {"version", 'v', GETLONGOPT_ARG_NONE, OPT_VERSION}, {"memory", 'm', GETLONGOPT_ARG_REQUIRED, OPT_MEMORY}, {"parse-buffer", 'm', GETLONGOPT_ARG_REQUIRED, OPT_PARSEBUF}, {"tablesize", 'm', GETLONGOPT_ARG_REQUIRED, OPT_TABLESIZE}, {"big-and-fast", 'm', GETLONGOPT_ARG_NONE, OPT_BIG_AND_FAST}, {"phrase", '\0', GETLONGOPT_ARG_OPTIONAL, OPT_PHRASE}, {"term-cutoff", '\0', GETLONGOPT_ARG_REQUIRED, OPT_CUTOFF}, {"dummy", '\0', GETLONGOPT_ARG_NONE, OPT_DUMMY}, {"non-stop", '\0', GETLONGOPT_ARG_NONE, OPT_NONSTOP}, {"query-stop", '\0', GETLONGOPT_ARG_OPTIONAL, OPT_STOP}, {"parallel", '\0', GETLONGOPT_ARG_OPTIONAL, OPT_PARALLEL}, {NULL, 'V', GETLONGOPT_ARG_NONE, OPT_VERSION} }; if ((args = malloc(sizeof(*args))) && (parser = getlongopt_new(argc - 1, (const char **) &argv[1], opts, sizeof(opts) / sizeof(*opts)))) { /* succeeded, do nothing */ } else { if (args) { free(args); } fprintf(output, "failed to initialise option parsing\n"); return NULL; } args->stoplist = NULL; args->topic_files = 0; args->topic_file = NULL; args->run_id = NULL; args->idx = NULL; args->numresults = 0; args->numaccumulators = 0; args->sopts = INDEX_SEARCH_NOOPT; args->lopts = INDEX_LOAD_NOOPT; args->title = 0; args->descr = 0; args->narr = 0; args->qrels = NULL; args->sopt.u.okapi.k1 = 1.2; args->sopt.u.okapi.k3 = 1e10; args->sopt.u.okapi.b = 0.75; args->lopt.docmap_cache = DOCMAP_CACHE_TRECNO; args->print_queries = args->timing = 0; args->memory = MEMORY_DEFAULT; args->phrase = 0; args->cutoff = 0; args->dummy = 0; args->cont = 0; args->parallel = 0; /* parse arguments */ while (!err && ((ret = getlongopt(parser, &id, &arg)) == GETLONGOPT_OK)) { switch (id) { case OPT_RUNID: /* set run_id */ if (!args->run_id) { if (!(args->run_id = str_dup(arg))) { fprintf(output, "couldn't set run_id '%s': %s\n", arg, strerror(errno)); err = quiet = 1; } } else if (args->run_id) { fprintf(output, "run_id already set to '%s'\n", args->run_id); err = 1; quiet = 0; } break; case OPT_STOP: if (args->stoplist) { err = 1; fprintf(output, "query stoplist specified multiple times\n"); quiet = 0; } else if (!arg || (args->stoplist = str_dup(arg))) { args->lopts |= INDEX_LOAD_QSTOP; args->lopt.qstop_file = args->stoplist; } else { err = quiet = 1; fprintf(output, "can't copy query stoplist name\n"); } break; case OPT_MEMORY: /* set memory */ args->memory = atoi(arg); break; case OPT_PARSEBUF: errno = 0; num = strtol(arg, &tmp, 10); if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) { args->lopts |= INDEX_LOAD_PARSEBUF; args->lopt.parsebuf = num; } else { fprintf(output, "error converting parsebuf value '%s'\n", arg); err = 1; } break; case OPT_TABLESIZE: errno = 0; num = strtol(arg, &tmp, 10); if (!errno && (num > 0) && (num <= UINT_MAX) && !*tmp) { args->lopts |= INDEX_LOAD_TABLESIZE; args->lopt.tablesize = num; } else { fprintf(output, "error converting tablesize value '%s'\n", arg); err = 1; } break; case OPT_PARALLEL: /* they've specified parallel evaluation */ if (!arg || !str_casecmp(arg, "yes") || !str_casecmp(arg, "true")) { args->parallel = 1; } else if (!str_casecmp(arg, "no") || !str_casecmp(arg, "false")) { args->parallel = 0; } else { fprintf(output, "unknown value for parallel option: '%s'\n", arg); err = 1; } break; case OPT_BIG_AND_FAST: /* use big memory options */ if (args->memory == MEMORY_DEFAULT) { args->memory = BIG_MEMORY_DEFAULT; } if (!(args->lopts & INDEX_NEW_PARSEBUF)) { args->lopts |= INDEX_LOAD_PARSEBUF; args->lopt.parsebuf = BIG_PARSE_BUFFER; } if (!(args->lopts & INDEX_NEW_TABLESIZE)) { args->lopts |= INDEX_LOAD_TABLESIZE; args->lopt.tablesize = BIG_TABLESIZE; } break; case OPT_QRELS: /* they want it evaluated against some qrels */ if (!args->qrels) { if ((args->qrels = treceval_qrels_new(arg))) { /* succeeded, do nothing */ } else { fprintf(output, "failed to load qrels from '%s'\n", arg); err = 1; } } else { fprintf(output, "qrels specified multiple times\n"); err = 1; } break; case OPT_IGNORE_VERSION: args->lopts |= INDEX_LOAD_IGNORE_VERSION; break; case OPT_ACCUMULATOR_LIMIT: /* set number of accumulators to use. */ errno = 0; num = strtol(arg, &tmp, 10); if (!errno && !*tmp) { args->sopt.accumulator_limit = num; args->sopts |= INDEX_SEARCH_ACCUMULATOR_LIMIT; } else { fprintf(output, "error converting accumulator limit value '%s'\n", arg); err = 1; } break; case OPT_NONSTOP: args->cont = 1; break; case OPT_DUMMY: args->dummy = 1; break; case OPT_CUTOFF: args->cutoff = atoi(arg); break; case OPT_PHRASE: /* they want to run it as a phrase, optionally sloppy */ args->phrase = 1; if (arg) { char *end; long int tmpnum = strtol(arg, &end, 0); if (!*end && (tmpnum <= UINT_MAX)) { args->sloppiness = tmpnum; } else { fprintf(output, "couldn't convert '%s' to number\n", arg); } } else { args->sloppiness = 0; } break; case OPT_NUMRESULTS: /* set number of results per topic */ if (!args->numresults) { char *end; long int tmpnum = strtol(arg, &end, 0); if (!*end && (tmpnum <= UINT_MAX)) { args->numresults = tmpnum; } else { fprintf(output, "couldn't convert '%s' to number\n", arg); } } else { fprintf(output, "number of results is already set to %u\n", args->numresults); err = 1; } break; case OPT_FILE: /* add topic file */ if (!(add_topic_file(args, arg))) { fprintf(output, "couldn't add file '%s': %s\n", arg, strerror(errno)); err = quiet = 1; } break; case OPT_FILELIST: /* add topic file file */ if (!(add_topic_file_file(args, arg))) { fprintf(output, "couldn't add list '%s': %s\n", arg, strerror(errno)); err = quiet = 1; } break; case OPT_HELP: /* they want help */ err = 1; output = stdout; break; case OPT_VERSION: /* they want version info */ printf("version %s\n", PACKAGE_VERSION); err = quiet = 1; output = stdout; break; case OPT_ANH_IMPACT: args->sopts |= INDEX_SEARCH_ANH_IMPACT_RANK; break; case OPT_HAWKAPI: /* they want to use hawkapi */ args->sopts |= INDEX_SEARCH_HAWKAPI_RANK; if (!sscanf(arg, "%f", &args->sopt.u.hawkapi.alpha)) { fprintf(stderr, "failed to read alpha parameter\n"); err = 1; } break; case OPT_DIRICHLET: /* they want to use dirichlet */ args->sopts |= INDEX_SEARCH_DIRICHLET_RANK; if (!sscanf(arg, "%f", &args->sopt.u.dirichlet.mu)) { fprintf(stderr, "failed to read mu parameter\n"); err = 1; } break; case OPT_DYNAMIC: /* they want to use named metric */ args->sopts |= INDEX_SEARCH_DYNAMIC_RANK; args->sopt.u.dynamic.metric = arg; break; case OPT_DYNAMIC_PARAMS: /* they want to use named metric parameters */ args->sopt.u.dynamic.params = arg; break; case OPT_OKAPI: /* they want to use okapi */ args->sopts |= INDEX_SEARCH_OKAPI_RANK; break; case OPT_K1: /* set okapi k1 parameter */ if (sscanf(arg, "%f", &args->sopt.u.okapi.k1)) { /* do nothing */ } else { fprintf(output, "can't read k1 value '%s'\n", arg); err = 1; } break; case OPT_K3: /* set okapi k3 parameter */ if (sscanf(arg, "%f", &args->sopt.u.okapi.k3)) { /* do nothing */ } else { fprintf(output, "can't read k3 value '%s'\n", arg); err = 1; } break; case OPT_B: /* set okapi b parameter */ if (sscanf(arg, "%f", &args->sopt.u.okapi.b)) { /* do nothing */ } else { fprintf(output, "can't read b value '%s'\n", arg); err = 1; } break; case OPT_TIMING: /* print queries */ args->timing = 1; break; case OPT_PRINTQUERIES: /* print queries */ args->print_queries = 1; break; case OPT_TITLE: /* use title in query */ args->title = 1; break; case OPT_DESCRIPTION: /* use description in query */ args->descr = 1; break; case OPT_NARRATIVE: /* use narrative in query */ args->narr = 1; break; case OPT_PIVOTED_COSINE: /* they want to use pivoted cosine */ if (sscanf(arg, "%f", &args->sopt.u.pcosine.pivot)) { args->sopts |= INDEX_SEARCH_PCOSINE_RANK; /* arrange for weights to be loaded into memory */ args->lopts |= INDEX_LOAD_DOCMAP_CACHE; args->lopt.docmap_cache |= DOCMAP_CACHE_WEIGHT; if (args->sopt.u.pcosine.pivot < 0.0) { fprintf(output, "cosine pivot can't be negative\n"); err = 1; } } else { fprintf(output, "can't read pivot value '%s'\n", arg); err = 1; } break; case OPT_COSINE: /* they want to use the cosine metric */ args->sopts |= INDEX_SEARCH_COSINE_RANK; /* arrange for weights to be loaded into memory */ args->lopts |= INDEX_LOAD_DOCMAP_CACHE; args->lopt.docmap_cache |= DOCMAP_CACHE_WEIGHT; break; default: /* shouldn't happen */ assert(0); } } ind = getlongopt_optind(parser) + 1; getlongopt_delete(parser); if (err || ret == GETLONGOPT_END) { /* succeeded, do nothing */ } else { if (ret == GETLONGOPT_UNKNOWN) { fprintf(stderr, "unknown option '%s'\n", argv[ind]); } else if (ret == GETLONGOPT_MISSING_ARG) { fprintf(stderr, "missing argument to option '%s'\n", argv[ind]); } else { fprintf(stderr, "unexpected error parsing options (around '%s')\n", argv[ind]); } free(args); return NULL; } /* remaining arguments should be index */ while (!err && (ind < (unsigned int) argc)) { if (!args->idx) { if (!(args->idx = load_index(argv[ind], args->memory, args->lopts, &args->lopt))) { fprintf(output, "couldn't load index from '%s': %s\n", argv[ind], strerror(errno)); err = quiet = 1; } } else { fprintf(output, "index already loaded\n"); err = 1; quiet = 0; } ind++; } /* set run_id if they haven't */ if (!err && !args->run_id && !(args->run_id = str_dup(PACKAGE))) { fprintf(output, "couldn't set default run_id: %s\n", strerror(errno)); err = quiet = 1; } /* set number of results if they haven't */ if (!err && !args->numresults) { args->numresults = 1000; } /* set number of accumulators if they haven't */ if (!err && !args->numaccumulators) { args->numaccumulators = ACCUMULATOR_LIMIT; } /* check that they've given a topic file */ if (!err && !args->topic_files) { fprintf(output, "no topic files given\n"); err = 1; } /* check that they've given an index */ if (!err && !args->idx) { fprintf(output, "no index given\n"); err = 1; } if (!(args->title || args->descr || args->narr)) { /* title only run is default */ args->title = 1; } if (err) { if (!quiet) { fprintf(output, "\n"); print_usage(output, *argv); } free_args(args); return NULL; } else { return args; } } /* small function to append a string to a buffer */ static char *strappend(char **buf, unsigned int *len, unsigned int *cap, char *str, unsigned int strvlen) { while (*cap <= *len + strvlen) { void *ptr = realloc(*buf, *cap * 2 + 1); if (ptr) { *buf = ptr; *cap = *cap * 2 + 1; } else { return NULL; } } memcpy(*buf + *len, str, strvlen); *len += strvlen; return *buf; } /* small macro to append a string to the buffer, exiting with an error message * on failure */ #define APPEND(buf, buflen, bufcap, str, strvlen) \ if (!strappend(&buf, &buflen, &bufcap, str, strvlen)) { \ if (buf) { \ free(buf); \ } \ fprintf(stderr, "error allocating memory for query, length %u + %u\n",\ buflen, strvlen); \ return NULL; \ } else /* internal function to parse the topic file and extract a query and * querynum from it */ static char *get_next_query(struct mlparse_wrap *parser, char *querynum, unsigned int querynum_len, int title, int descr, int narr, unsigned int *words, struct args *args) { int innum = 0, /* parsing the topic number */ intitle = 0, /* whether we're parsing the title */ indescr = 0, /* whether we're parsing description */ innarr = 0, /* whether we're parsing narrative */ firstword = 0; /* whether its the first word of a * field */ enum mlparse_ret ret; /* return value from parser */ char *buf = NULL, /* query buffer */ word[TERMLEN_MAX + 1]; /* last word parsed */ unsigned int buflen = 0, /* length of the query */ bufcapacity = 0, /* capacity of the query buffer */ wordlen; /* length of the last word parsed */ *words = 0; do { ret = mlparse_wrap_parse(parser, word, &wordlen, 0); } while (ret != MLPARSE_TAG && ret != MLPARSE_ERR && ret != MLPARSE_EOF); /* check that we got a 'top' tag */ if (ret == MLPARSE_TAG && str_casecmp(word, "top")) { fprintf(stderr, "expected to parse 'top' tag from topic file\n"); return NULL; } else if (ret == MLPARSE_ERR) { fprintf(stderr, "error parsing topic file\n"); return NULL; } else if (ret == MLPARSE_EOF) { return NULL; } else { assert(ret == MLPARSE_TAG); } *querynum = 0; /* set up phrase if requested by user */ if (args->phrase) { APPEND(buf, buflen, bufcapacity, "\"", 1); } /* parse the rest of the top entry */ while ((ret = mlparse_wrap_parse(parser, word, &wordlen, 0)) != MLPARSE_ERR) { switch (ret) { case MLPARSE_TAG: if (!str_casecmp(word, "num")) { /* query number */ innum = 1; intitle = 0; indescr = 0; innarr = 0; firstword = 1; } else if (!str_casecmp(word, "title")) { /* query title */ if (title) { intitle = 1; } else { intitle = 0; } indescr = 0; innarr = 0; innum = 0; firstword = 1; } else if (!str_casecmp(word, "desc")) { /* query description */ if (descr) { indescr = 1; } else { indescr = 0; } intitle = 0; innarr = 0; innum = 0; firstword = 1; } else if (!str_casecmp(word, "narr")) { /* query narrative */ if (narr) { innarr = 1; } else { innarr = 0; } indescr = 0; intitle = 0; innum = 0; firstword = 1; } else if (!str_casecmp(word, "/top")) { /* finished this topic, return the query */ if (*querynum) { if (buf) { /* optionally terminate phrase */ if (args->phrase) { #define TMPBUFLEN 100 char tmpbuf[TMPBUFLEN + 1]; unsigned int n; APPEND(buf, buflen, bufcapacity, "\"", 1); if (args->sloppiness) { n = snprintf(tmpbuf, TMPBUFLEN, " [sloppy:%u] ", args->sloppiness); assert(n < TMPBUFLEN); APPEND(buf, buflen, bufcapacity, tmpbuf, n); /* ensure sloppy directive is processed */ (*words)++; } if (args->cutoff) { n = snprintf(tmpbuf, TMPBUFLEN, " [cutoff:%u] ", args->cutoff); assert(n < TMPBUFLEN); APPEND(buf, buflen, bufcapacity, tmpbuf, n); /* ensure cutoff directive is processed */ (*words)++; } #undef TMPBUFLEN } /* terminate string and return it */ APPEND(buf, buflen, bufcapacity, "\0", 1); return buf; } else { return ""; } } else { fprintf(stderr, "didn't find topic number in topic file\n"); return NULL; } } else { /* unexpected tag, ignore it */ innum = 0; innarr = 0; indescr = 0; intitle = 0; } break; case MLPARSE_EOF: if (*querynum || buf) { fprintf(stderr, "unexpected eof while parsing\n"); } return NULL; /* ignore this stuff */ case MLPARSE_PARAM: case MLPARSE_CONT | MLPARSE_PARAM: case MLPARSE_PARAMVAL: case MLPARSE_CONT | MLPARSE_PARAMVAL: case MLPARSE_CDATA: case MLPARSE_END | MLPARSE_CDATA: case MLPARSE_WHITESPACE: break; /* XXX: comments shouldn't just be ignored (as control flow, the stuff * inside comments should be ignored) */ case MLPARSE_COMMENT | MLPARSE_END: case MLPARSE_COMMENT: break; case MLPARSE_WORD: case MLPARSE_END | MLPARSE_WORD: /* include everything in tags indicated by arguments, except * that TREC topic files often start the topic with 'Topic:', * the description with 'Description:' and narrative with * 'Narrative:' :o( */ if ((intitle && (!firstword || str_nncmp(word, wordlen, "Topic:", strvlen("Topic:")))) || (indescr && (!firstword || str_nncmp(word, wordlen, "Description:", strvlen("Description:")))) || (innarr && (!firstword || str_nncmp(word, wordlen, "Narrative:", strvlen("Narrative:"))))) { /* we have to add the word to the buffer */ (*words)++; APPEND(buf, buflen, bufcapacity, word, wordlen); APPEND(buf, buflen, bufcapacity, " ", 1); } else if (innum && (!firstword || str_nncmp(word, wordlen, "Number:", strvlen("Number:")))) { if (wordlen < querynum_len) { str_ncpy(querynum, word, wordlen); querynum[wordlen] = '\0'; str_toupper(querynum); } else { fprintf(stderr, "querynum '%s' too long\n", word); return NULL; } } firstword = 0; break; case MLPARSE_CONT | MLPARSE_WORD: case MLPARSE_CONT | MLPARSE_TAG: /* ignore (XXX: should also ignore subsequent word as well) */ break; default: /* not expecting anything else */ if (buf) { free(buf); } fprintf(stderr, "error parsing topic file\n"); return NULL; break; } } /* must have received an error */ if (buf) { free(buf); } fprintf(stderr, "error parsing topic file\n"); return NULL; } /* internal function to execute queries from a topic file against an * index and output the results in trec_eval format */ static int process_topic_file(FILE *fp, struct args *args, FILE *output, struct treceval *teresults, zpthread_mutex_t *teresults_mutex) { struct index_stats stats; char *query, *querynum = NULL; struct index_result *results = NULL; unsigned int returned, i; int est; double total_results; struct mlparse_wrap *parser; struct timeval now, then; struct timeval topic_now, topic_then; gettimeofday(&topic_then, NULL); if (!index_stats(args->idx, &stats)) { return 0; } if ((parser = mlparse_wrap_new_file(stats.maxtermlen, LOOKAHEAD, fp, BUFSIZ, 0)) && (results = malloc(sizeof(*results) * args->numresults)) && (querynum = malloc(stats.maxtermlen + 2))) { while ((query = get_next_query(parser, querynum, stats.maxtermlen + 1, args->title, args->descr, args->narr, &args->sopt.word_limit, args))) { /* check that we actually got a query */ if (!strvlen(query)) { fprintf(stderr, "failed to extract query for topic %s\n", querynum); if (atoi((const char *) querynum) == 201) { fprintf(stderr, "looks like it occurred on TREC topics " "201-250, which is probably because you specified a " "title-only run and it doesn't contain titles\n"); } if (args->cont && strvlen(querynum)) { /* continue evaluation */ if (args->dummy) { /* no results, insert dummy result if requested */ fprintf(output, "%s\tQ0\t%s\t%u\t%f\t%s\n", querynum, "XXXX-XXX-XXXXXXX", 1, 0.0, args->run_id); } } else { /* give up evaluation */ free(results); free(querynum); mlparse_wrap_delete(parser); return 0; } } args->sopt.summary_type = INDEX_SUMMARISE_NONE; /* FIXME: detect errors */ gettimeofday(&then, NULL); if (index_search(args->idx, (const char *) query, 0, args->numresults, results, &returned, &total_results, &est, (args->sopts | INDEX_SEARCH_WORD_LIMIT | INDEX_SEARCH_SUMMARY_TYPE), &args->sopt)) { char aux_buf[512]; gettimeofday(&now, NULL); if (args->print_queries) { fprintf(stderr, "query '%s' completed in %lu microseconds\n", query, (unsigned long int) now.tv_usec - then.tv_usec + (now.tv_sec - then.tv_sec) * 1000000); } /* print results */ if (teresults && zpthread_mutex_lock(teresults_mutex) != ZPTHREAD_OK) { fprintf(stderr, "failed to lock results structure\n"); free(results); free(querynum); free(query); mlparse_wrap_delete(parser); return 0; } for (i = 0; i < returned && !args->timing; i++) { char *docno = NULL; /* hack: any document that doesn't have a TREC docno will * inherit the docno of the previous document (until we * find one that has a docno) */ if (results[i].auxilliary && results[i].auxilliary[0]) { strncpy(aux_buf, results[i].auxilliary, sizeof(aux_buf)); docno = aux_buf; } else { int ret = 1; unsigned long int docnum = results[i].docno; unsigned int aux_len = 0; /* retrieve TREC docno for progressively higher docs */ while (ret && (docnum > 0) && !aux_len) { docnum--; ret = index_retrieve_doc_aux(args->idx, docnum, aux_buf, sizeof(aux_buf) - 1, &aux_len); /* XXX assume trec docno always < 512 bytes long */ } if (ret && aux_len) { docno = aux_buf; } } aux_buf[sizeof(aux_buf) - 1] = '\0'; if (teresults && docno && treceval_add_result(teresults, atoi(querynum), docno, (double)results[i].score)) { /* they want evaluated results, stuck it in the results * structure */ } else if (!teresults && docno) { str_toupper(docno); /* print out query_id, iter (ignored - so we print * out number of seconds taken), docno, rank * (ignored), score, run_id */ fprintf(output, "%s\tQ0\t%s\t%u\t%f\t%s\n", querynum, docno, i + 1, results[i].score, args->run_id); } else if (teresults && docno) { fprintf(stderr, "failed to add to treceval results\n"); free(results); free(querynum); free(docno); free(query); mlparse_wrap_delete(parser); if (teresults) { zpthread_mutex_unlock(teresults_mutex); } return 0; } else { /* couldn't copy the docno */ fprintf(stderr, "docno ('%s') copy failed: %s\n", results[i].auxilliary, strerror(errno)); free(query); free(results); free(querynum); mlparse_wrap_delete(parser); if (teresults) { zpthread_mutex_unlock(teresults_mutex); } return 0; } } if (teresults) { zpthread_mutex_unlock(teresults_mutex); } if (returned == 0 && args->dummy) { /* no results, insert dummy result if requested */ fprintf(output, "%s\tQ0\t%s\t%u\t%f\t%s\n", querynum, "XXXX-XXX-XXXXXXX", 1, 0.0, args->run_id); } } else { /* error searching */ fprintf(stderr, "error searching index\n"); free(query); mlparse_wrap_delete(parser); return 0; } free(query); querynum[0] = '\0'; } if (!feof(fp)) { fprintf(stderr, "parser or read error\n"); free(results); free(querynum); mlparse_wrap_delete(parser); return 0; } free(results); free(querynum); gettimeofday(&topic_now, NULL); if (args->timing) { fprintf(stderr, "topic processed in %lu microseconds\n", (unsigned long int) topic_now.tv_usec - topic_then.tv_usec + (topic_now.tv_sec - topic_then.tv_sec) * 1000000); } mlparse_wrap_delete(parser); return 1; } else { if (parser) { if (results) { free(results); } mlparse_wrap_delete(parser); } } return 0; } struct pertopic { FILE *input; FILE *output; struct args *args; zpthread_t pid; struct index_search_opt sopt; struct treceval *teresults; zpthread_mutex_t *teresults_mutex; }; static void *process_topic_file_wrap(void *handle) { struct pertopic *pt = handle; if (process_topic_file(pt->input, pt->args, pt->output, pt->teresults, pt->teresults_mutex)) { return pt; } else { return NULL; } } int main(int argc, char **argv) { struct args *args; unsigned int i; FILE *fp, *output; struct treceval *results = NULL; struct pertopic *pt; zpthread_mutex_t results_mutex = ZPTHREAD_MUTEX_INITIALIZER; if (isatty(STDOUT_FILENO)) { output = stdout; } else { output = stderr; } args = parse_args(argc, argv, output); if (args == NULL) { return EXIT_FAILURE; } if (args->qrels) { if (!(results = treceval_new())) { fprintf(stderr, "failed to initialise results structure\n"); } } if (!(pt = malloc(sizeof(*pt) * args->topic_files))) { fprintf(stderr, "failed to initialise results structure\n"); treceval_delete(&results); zpthread_mutex_destroy(&results_mutex); return EXIT_FAILURE; } if (args) { for (i = 0; i < args->topic_files; i++) { pt[i].args = args; pt[i].sopt = args->sopt; pt[i].teresults = results; pt[i].teresults_mutex = &results_mutex; if (args->parallel) { char output[FILENAME_MAX + 1]; str_lcpy(output, str_basename(args->topic_file[i]), FILENAME_MAX + 1); str_lcat(output, ".out", FILENAME_MAX + 1); if (!(pt[i].output = fopen(output, "wb"))) { fprintf(stderr, "failed to open output file '%s'\n", output); fclose(fp); free_args(args); free(pt); zpthread_mutex_destroy(&results_mutex); return EXIT_FAILURE; } } else { pt[i].output = stdout; } if ((pt[i].input = fopen(args->topic_file[i], "rb")) && zpthread_create(&pt[i].pid, NULL, process_topic_file_wrap, &pt[i]) == ZPTHREAD_OK) { if (!args->parallel) { void *pret; int ret; ret = zpthread_join(pt[i].pid, &pret); assert(ret == ZPTHREAD_OK); } } else { if (!pt[i].input) { fprintf(output, "couldn't open topic file '%s': %s\n", args->topic_file[i], strerror(errno)); } else { fprintf(output, "failed to spawn thread: %s\n", strerror(errno)); } if (results) { treceval_delete(&results); } free_args(args); free(pt); zpthread_mutex_destroy(&results_mutex); return EXIT_FAILURE; } } for (i = 0; i < args->topic_files; i++) { if (args->parallel) { void *pret; int ret; ret = zpthread_join(pt[i].pid, &pret); assert(ret == ZPTHREAD_OK); } fclose(pt[i].input); if (pt[i].output != stdout) { fclose(pt[i].output); } } if (results) { struct treceval_results eval; treceval_evaluate(results, args->qrels, &eval); treceval_print_results(&eval, 1, stdout, 0); treceval_delete(&results); } free_args(args); } free(pt); zpthread_mutex_destroy(&results_mutex); return EXIT_SUCCESS; }
34.747573
80
0.477529
1b0e75efb1dfa9a540e0cfd52933c5ea288bb9db
6,956
c
C
freebsd3/sys/pc98/pc98/pc98_machdep.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
91
2015-01-05T15:18:31.000Z
2022-03-11T16:43:28.000Z
freebsd3/sys/pc98/pc98/pc98_machdep.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
1
2016-02-25T15:57:55.000Z
2016-02-25T16:01:02.000Z
freebsd3/sys/pc98/pc98/pc98_machdep.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
21
2015-02-07T08:23:07.000Z
2021-12-14T06:01:49.000Z
/* * Copyright (c) KATO Takenori, 1996, 1997. * * All rights reserved. Unpublished rights reserved under the copyright * laws of Japan. * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer as * the first lines of this file unmodified. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "opt_pc98.h" #include <sys/param.h> #include <sys/systm.h> #include <cam/cam.h> #include <cam/cam_ccb.h> #include <pc98/pc98/pc98.h> #include <pc98/pc98/pc98_machdep.h> extern int Maxmem; extern int Maxmem_under16M; #ifdef notyet static void init_cpu_accel_mem __P((void)); #endif /* * Initialize DMA controller */ void pc98_init_dmac(void) { outb(0x439, (inb(0x439) & 0xfb)); /* DMA Accsess Control over 1MB */ outb(0x29, (0x0c | 0)); /* Bank Mode Reg. 16M mode */ outb(0x29, (0x0c | 1)); /* Bank Mode Reg. 16M mode */ outb(0x29, (0x0c | 2)); /* Bank Mode Reg. 16M mode */ outb(0x29, (0x0c | 3)); /* Bank Mode Reg. 16M mode */ outb(0x11, 0x50); } #ifdef EPSON_MEMWIN static void init_epson_memwin __P((void)); /* * Disconnect phisical memory in 15-16MB region. * * EPSON PC-486GR, P, SR, SE, HX, HG and HA only. Other system support * this feature with software DIP switch. */ static void init_epson_memwin(void) { if (pc98_machine_type & M_EPSON_PC98) { if (Maxmem > 3840) { if (Maxmem == Maxmem_under16M) { Maxmem = 3840; Maxmem_under16M = 3840; } else if (Maxmem_under16M > 3840) { Maxmem_under16M = 3840; } } /* Disable 15MB-16MB caching. */ switch (epson_machine_id) { case 0x34: /* PC486HX */ case 0x35: /* PC486HG */ case 0x3B: /* PC486HA */ /* Cache control start. */ outb(0x43f, 0x42); outw(0xc40, 0x0033); /* Disable 0xF00000-0xFFFFFF. */ outb(0xc48, 0x49); outb(0xc4c, 0x00); outb(0xc48, 0x48); outb(0xc4c, 0xf0); outb(0xc48, 0x4d); outb(0xc4c, 0x00); outb(0xc48, 0x4c); outb(0xc4c, 0xff); outb(0xc48, 0x4f); outb(0xc4c, 0x00); /* Cache control end. */ outb(0x43f, 0x40); break; case 0x2B: /* PC486GR/GF */ case 0x30: /* PC486P */ case 0x31: /* PC486GRSuper */ case 0x32: /* PC486GR+ */ case 0x37: /* PC486SE */ case 0x38: /* PC486SR */ /* Disable 0xF00000-0xFFFFFF. */ outb(0x43f, 0x42); outb(0x467, 0xe0); outb(0x567, 0xd8); outb(0x43f, 0x40); outb(0x467, 0xe0); outb(0x567, 0xe0); break; } /* Disable 15MB-16MB RAM and enable memory window. */ outb(0x43b, inb(0x43b) & 0xfd); /* Clear bit1. */ } } #endif #ifdef notyet static void init_cpu_accel_mem(void); static void init_cpu_accel_mem(void) { u_int target_page; /* * Certain 'CPU accelerator' supports over 16MB memory on * the machines whose BIOS doesn't store true size. * To support this, we don't trust BIOS values if Maxmem < 4096. */ if (Maxmem < 4096) { for (target_page = ptoa(4096); /* 16MB */ target_page < ptoa(32768); /* 128MB */ target_page += 256 * PAGE_SIZE /* 1MB step */) { u_int tmp, page_bad = FALSE, OrigMaxmem = Maxmem; *(int *)CMAP1 = PG_V | PG_RW | PG_N | target_page; invltlb(); tmp = *(u_int *)CADDR1; /* * Test for alternating 1's and 0's */ *(volatile u_int *)CADDR1 = 0xaaaaaaaa; if (*(volatile u_int *)CADDR1 != 0xaaaaaaaa) { page_bad = TRUE; } /* * Test for alternating 0's and 1's */ *(volatile u_int *)CADDR1 = 0x55555555; if (*(volatile u_int *)CADDR1 != 0x55555555) { page_bad = TRUE; } /* * Test for all 1's */ *(volatile u_int *)CADDR1 = 0xffffffff; if (*(volatile u_int *)CADDR1 != 0xffffffff) { page_bad = TRUE; } /* * Test for all 0's */ *(volatile u_int *)CADDR1 = 0x0; if (*(volatile u_int *)CADDR1 != 0x0) { /* * test of page failed */ page_bad = TRUE; } /* * Restore original value. */ *(u_int *)CADDR1 = tmp; if (page_bad == TRUE) { Maxmem = atop(target_page) + 256; } else break; } *(int *)CMAP1 = 0; invltlb(); } } #endif /* * Get physical memory size */ void pc98_getmemsize(void) { unsigned char under16, over16; /* available protected memory size under 16MB / 128KB */ under16 = PC98_SYSTEM_PARAMETER(0x401); /* available protected memory size over 16MB / 1MB */ over16 = PC98_SYSTEM_PARAMETER(0x594); /* add conventional memory size (1024KB / 128KB = 8) */ under16 += 8; Maxmem = Maxmem_under16M = under16 * 128 * 1024 / PAGE_SIZE; Maxmem += (over16 * 1024 * 1024 / PAGE_SIZE); #ifdef EPSON_MEMWIN init_epson_memwin(); #endif } #include "da.h" #if NDA > 0 /* * Read a geometry information of SCSI HDD from BIOS work area. * * XXX - Before reading BIOS work area, we should check whether * host adapter support it. */ int scsi_da_bios_params(struct ccb_calc_geometry *ccg) { u_char *tmp; int target; int bus; target = ccg->ccb_h.target_id; bus = 0; /* If your really need to know, send a PathInq CCB */ tmp = (u_char *)&PC98_SYSTEM_PARAMETER(0x460 + target*4); if ((PC98_SYSTEM_PARAMETER(0x482) & ((1 << target)&0xff)) != 0) { ccg->secs_per_track = *tmp; ccg->cylinders = ((*(tmp+3)<<8)|*(tmp+2))&0xfff; #if 0 switch (*(tmp + 3) & 0x30) { case 0x00: disk_parms->secsiz = 256; printf("Warning!: not supported.\n"); break; case 0x10: disk_parms->secsiz = 512; break; case 0x20: disk_parms->secsiz = 1024; break; default: disk_parms->secsiz = 512; printf("Warning!: not supported. But force to 512\n"); break; } #endif if (*(tmp+3) & 0x40) { ccg->cylinders += (*(tmp+1)&0xf0)<<8; ccg->heads = *(tmp+1)&0x0f; } else { ccg->heads = *(tmp+1); } return 1; } return 0; } #endif
25.111913
76
0.65138
532dc2a3b8d9c9aa1929e7166467c60b93ac6950
18,616
h
C
contrib/gitian-builder/inputs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSGraphics.h
Phikzel2/haroldcoin-main-MacOS
15c949c8f722d424fd9603fab3c49ec4b2b720eb
[ "MIT" ]
null
null
null
contrib/gitian-builder/inputs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSGraphics.h
Phikzel2/haroldcoin-main-MacOS
15c949c8f722d424fd9603fab3c49ec4b2b720eb
[ "MIT" ]
null
null
null
contrib/gitian-builder/inputs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSGraphics.h
Phikzel2/haroldcoin-main-MacOS
15c949c8f722d424fd9603fab3c49ec4b2b720eb
[ "MIT" ]
1
2021-08-13T21:12:07.000Z
2021-08-13T21:12:07.000Z
/* NSGraphics.h Application Kit Copyright (c) 1994-2018, Apple Inc. All rights reserved. */ #import <Foundation/NSGeometry.h> #import <AppKit/AppKitDefines.h> NS_ASSUME_NONNULL_BEGIN @class NSColor, NSView; /* Operation types for composite operators */ typedef NS_ENUM(NSUInteger, NSCompositingOperation) { /* Porter-Duff compositing operations */ /* http://www.w3.org/TR/2014/CR-compositing-1-20140220/#porterduffcompositingoperators */ NSCompositingOperationClear, NSCompositingOperationCopy, NSCompositingOperationSourceOver, NSCompositingOperationSourceIn, NSCompositingOperationSourceOut, NSCompositingOperationSourceAtop, NSCompositingOperationDestinationOver, NSCompositingOperationDestinationIn, NSCompositingOperationDestinationOut, NSCompositingOperationDestinationAtop, NSCompositingOperationXOR, NSCompositingOperationPlusDarker, NSCompositingOperationHighlight NS_DEPRECATED_MAC(10_0, 10_0, "Use NSCompositingOperationSourceOver instead"), NSCompositingOperationPlusLighter, /* Separable blend-modes */ /* http://www.w3.org/TR/2014/CR-compositing-1-20140220/#blendingseparable */ NSCompositingOperationMultiply NS_AVAILABLE_MAC(10_10), NSCompositingOperationScreen NS_AVAILABLE_MAC(10_10), NSCompositingOperationOverlay NS_AVAILABLE_MAC(10_10), NSCompositingOperationDarken NS_AVAILABLE_MAC(10_10), NSCompositingOperationLighten NS_AVAILABLE_MAC(10_10), NSCompositingOperationColorDodge NS_AVAILABLE_MAC(10_10), NSCompositingOperationColorBurn NS_AVAILABLE_MAC(10_10), NSCompositingOperationSoftLight NS_AVAILABLE_MAC(10_10), NSCompositingOperationHardLight NS_AVAILABLE_MAC(10_10), NSCompositingOperationDifference NS_AVAILABLE_MAC(10_10), NSCompositingOperationExclusion NS_AVAILABLE_MAC(10_10), /* Non-separable blend-modes */ /* http://www.w3.org/TR/2014/CR-compositing-1-20140220/#blendingnonseparable */ NSCompositingOperationHue NS_AVAILABLE_MAC(10_10), NSCompositingOperationSaturation NS_AVAILABLE_MAC(10_10), NSCompositingOperationColor NS_AVAILABLE_MAC(10_10), NSCompositingOperationLuminosity NS_AVAILABLE_MAC(10_10), }; static const NSCompositingOperation NSCompositeClear NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationClear", 10_0, 10_12) = NSCompositingOperationClear; static const NSCompositingOperation NSCompositeCopy NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationCopy", 10_0, 10_12) = NSCompositingOperationCopy; static const NSCompositingOperation NSCompositeSourceOver NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSourceOver", 10_0, 10_12) = NSCompositingOperationSourceOver; static const NSCompositingOperation NSCompositeSourceIn NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSourceIn", 10_0, 10_12) = NSCompositingOperationSourceIn; static const NSCompositingOperation NSCompositeSourceOut NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSourceOut", 10_0, 10_12) = NSCompositingOperationSourceOut; static const NSCompositingOperation NSCompositeSourceAtop NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSourceAtop", 10_0, 10_12) = NSCompositingOperationSourceAtop; static const NSCompositingOperation NSCompositeDestinationOver NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationDestinationOver", 10_0, 10_12) = NSCompositingOperationDestinationOver; static const NSCompositingOperation NSCompositeDestinationIn NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationDestinationIn", 10_0, 10_12) = NSCompositingOperationDestinationIn; static const NSCompositingOperation NSCompositeDestinationOut NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationDestinationOut", 10_0, 10_12) = NSCompositingOperationDestinationOut; static const NSCompositingOperation NSCompositeDestinationAtop NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationDestinationAtop", 10_0, 10_12) = NSCompositingOperationDestinationAtop; static const NSCompositingOperation NSCompositeXOR NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationXOR", 10_0, 10_12) = NSCompositingOperationXOR; static const NSCompositingOperation NSCompositePlusDarker NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationPlusDarker", 10_0, 10_12) = NSCompositingOperationPlusDarker; static const NSCompositingOperation NSCompositeHighlight NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSourceOver", 10_0, 10_0) = NSCompositingOperationHighlight; static const NSCompositingOperation NSCompositePlusLighter NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationPlusLighter", 10_0, 10_12) = NSCompositingOperationPlusLighter; static const NSCompositingOperation NSCompositeMultiply NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationMultiply", 10_0, 10_12) = NSCompositingOperationMultiply; static const NSCompositingOperation NSCompositeScreen NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationScreen", 10_0, 10_12) = NSCompositingOperationScreen; static const NSCompositingOperation NSCompositeOverlay NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationOverlay", 10_0, 10_12) = NSCompositingOperationOverlay; static const NSCompositingOperation NSCompositeDarken NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationDarken", 10_0, 10_12) = NSCompositingOperationDarken; static const NSCompositingOperation NSCompositeLighten NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationLighten", 10_0, 10_12) = NSCompositingOperationLighten; static const NSCompositingOperation NSCompositeColorDodge NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationColorDodge", 10_0, 10_12) = NSCompositingOperationColorDodge; static const NSCompositingOperation NSCompositeColorBurn NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationColorBurn", 10_0, 10_12) = NSCompositingOperationColorBurn; static const NSCompositingOperation NSCompositeSoftLight NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSoftLight", 10_0, 10_12) = NSCompositingOperationSoftLight; static const NSCompositingOperation NSCompositeHardLight NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationHardLight", 10_0, 10_12) = NSCompositingOperationHardLight; static const NSCompositingOperation NSCompositeDifference NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationDifference", 10_0, 10_12) = NSCompositingOperationDifference; static const NSCompositingOperation NSCompositeExclusion NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationExclusion", 10_0, 10_12) = NSCompositingOperationExclusion; static const NSCompositingOperation NSCompositeHue NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationHue", 10_0, 10_12) = NSCompositingOperationHue; static const NSCompositingOperation NSCompositeSaturation NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationSaturation", 10_0, 10_12) = NSCompositingOperationSaturation; static const NSCompositingOperation NSCompositeColor NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationColor", 10_0, 10_12) = NSCompositingOperationColor; static const NSCompositingOperation NSCompositeLuminosity NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSCompositingOperationLuminosity", 10_0, 10_12) = NSCompositingOperationLuminosity; /* Types of window backing stores. */ typedef NS_ENUM(NSUInteger, NSBackingStoreType) { /* NSBackingStoreRetained and NSBackingStoreNonretained have effectively been synonyms of NSBackingStoreBuffered since OS X Mountain Lion. Please switch to the equivalent NSBackingStoreBuffered. */ NSBackingStoreRetained NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSBackingStoreBuffered", 10_0, 10_13) = 0, NSBackingStoreNonretained NS_DEPRECATED_WITH_REPLACEMENT_MAC("NSBackingStoreBuffered", 10_0, 10_13) = 1, NSBackingStoreBuffered = 2, }; /* ways to order windows */ typedef NS_ENUM(NSInteger, NSWindowOrderingMode) { NSWindowAbove = 1, NSWindowBelow = -1, NSWindowOut = 0 }; /* order in which to draw focus ring - above or below graphic or just draw ring */ typedef NS_ENUM(NSUInteger, NSFocusRingPlacement) { NSFocusRingOnly = 0, NSFocusRingBelow = 1, NSFocusRingAbove = 2 }; /* used by NSView and NSCell to configure if and how the control should draw its focus ring */ typedef NS_ENUM(NSUInteger, NSFocusRingType) { NSFocusRingTypeDefault = 0, NSFocusRingTypeNone = 1, NSFocusRingTypeExterior = 2 }; // values interchangeable with CGColorRenderingIntent values typedef NS_ENUM(NSInteger, NSColorRenderingIntent) { NSColorRenderingIntentDefault, // = kCGRenderingIntentDefault, NSColorRenderingIntentAbsoluteColorimetric, // = kCGRenderingIntentAbsoluteColorimetric, NSColorRenderingIntentRelativeColorimetric, // = kCGRenderingIntentRelativeColorimetric, NSColorRenderingIntentPerceptual, // = kCGRenderingIntentPerceptual, NSColorRenderingIntentSaturation // = kCGRenderingIntentSaturation } NS_ENUM_AVAILABLE_MAC(10_5); typedef NSString * NSColorSpaceName NS_TYPED_ENUM; /* Predefined colorspace names. */ APPKIT_EXTERN NSColorSpaceName NSCalibratedWhiteColorSpace; /* 1.0 == white */ APPKIT_EXTERN NSColorSpaceName NSCalibratedRGBColorSpace; APPKIT_EXTERN NSColorSpaceName NSDeviceWhiteColorSpace; /* 1.0 == white */ APPKIT_EXTERN NSColorSpaceName NSDeviceRGBColorSpace; APPKIT_EXTERN NSColorSpaceName NSDeviceCMYKColorSpace; APPKIT_EXTERN NSColorSpaceName NSNamedColorSpace; /* Used for "catalog" colors */ APPKIT_EXTERN NSColorSpaceName NSPatternColorSpace; APPKIT_EXTERN NSColorSpaceName NSCustomColorSpace; /* Used to indicate a custom gstate in images */ /* Prefer colorspaces where 1.0 means white. */ APPKIT_EXTERN NSColorSpaceName NSCalibratedBlackColorSpace /* 1.0 == black */ NS_DEPRECATED_MAC(10_0, 10_6); APPKIT_EXTERN NSColorSpaceName NSDeviceBlackColorSpace /* 1.0 == black */ NS_DEPRECATED_MAC(10_0, 10_6); /* NSWindowDepth defines the values used in setting window depth limits. "0" indicates default depth. Window depths should not be made persistent as they will not be the same across systems. Use the functions NSBitsPerSampleFromDepth(), NSColorSpaceFromDepth(), NSBitsPerPixelFromDepth(), and NSPlanarFromDepth() to extract info from an NSWindowDepth On Mac OS X 10.5 and earlier, use NSBestDepth() to compute window depths. NSBestDepth() will try to accomodate all the parameters (match or better); if there are multiple matches, it gives the closest, with matching colorSpace first, then bps, then planar, then bpp. bpp is "bits per pixel"; 0 indicates default (same as the number of bits per plane, either bps or bps * NSNumberOfColorComponents()); other values maybe used as hints to provide backing stores of different configuration; for instance, 8 bit color. exactMatch is optional and indicates whether all the parameters matched exactly. On Mac OS X 10.6 and later, you can pass one of the explicit bit depths below to -[NSWindow setDepthLimit:]. NSWindowDepthTwentyfourBitRGB is the default. */ typedef NS_ENUM(int32_t, NSWindowDepth) { NSWindowDepthTwentyfourBitRGB = 0x208, NSWindowDepthSixtyfourBitRGB = 0x210, NSWindowDepthOnehundredtwentyeightBitRGB = 0x220 } NS_ENUM_AVAILABLE_MAC(10_6); APPKIT_EXTERN NSWindowDepth NSBestDepth (NSColorSpaceName colorSpace, NSInteger bps, NSInteger bpp, BOOL planar, BOOL * __nullable exactMatch); APPKIT_EXTERN BOOL NSPlanarFromDepth (NSWindowDepth depth); APPKIT_EXTERN NSColorSpaceName __nullable NSColorSpaceFromDepth (NSWindowDepth depth); APPKIT_EXTERN NSInteger NSBitsPerSampleFromDepth(NSWindowDepth depth); APPKIT_EXTERN NSInteger NSBitsPerPixelFromDepth(NSWindowDepth depth); APPKIT_EXTERN NSInteger NSNumberOfColorComponents(NSColorSpaceName colorSpaceName); APPKIT_EXTERN const NSWindowDepth *NSAvailableWindowDepths (void); /* 0 terminated */ /* Standard gray values for the 2-bit deep grayscale colorspace. */ APPKIT_EXTERN const CGFloat NSWhite; APPKIT_EXTERN const CGFloat NSLightGray; APPKIT_EXTERN const CGFloat NSDarkGray; APPKIT_EXTERN const CGFloat NSBlack; /* Approximate color gamut for use by NSScreen and NSWindow */ typedef NS_ENUM(NSInteger, NSDisplayGamut) { NSDisplayGamutSRGB = 1, NSDisplayGamutP3 } NS_ENUM_AVAILABLE_MAC(10_12); /* Keys for deviceDescription dictionaries. */ typedef NSString * NSDeviceDescriptionKey NS_TYPED_EXTENSIBLE_ENUM; APPKIT_EXTERN NSDeviceDescriptionKey NSDeviceResolution; /* NSValue containing NSSize, basically dpi */ APPKIT_EXTERN NSDeviceDescriptionKey NSDeviceColorSpaceName; /* NSString */ APPKIT_EXTERN NSDeviceDescriptionKey NSDeviceBitsPerSample; /* NSValue containing int */ APPKIT_EXTERN NSDeviceDescriptionKey NSDeviceIsScreen; /* "YES" or not there */ APPKIT_EXTERN NSDeviceDescriptionKey NSDeviceIsPrinter; /* "YES" or not there */ APPKIT_EXTERN NSDeviceDescriptionKey NSDeviceSize; /* NSValue containing NSSize */ /* Graphics functions */ APPKIT_EXTERN void NSRectFill(NSRect rect); APPKIT_EXTERN void NSRectFillList(const NSRect *rects, NSInteger count); APPKIT_EXTERN void NSRectFillListWithGrays(const NSRect *rects, const CGFloat *grays, NSInteger num); APPKIT_EXTERN void NSRectFillListWithColors(const NSRect *rects, NSColor * const __nonnull * __nonnull colors, NSInteger num); APPKIT_EXTERN void NSRectFillUsingOperation(NSRect rect, NSCompositingOperation op); APPKIT_EXTERN void NSRectFillListUsingOperation(const NSRect *rects, NSInteger count, NSCompositingOperation op); APPKIT_EXTERN void NSRectFillListWithColorsUsingOperation(const NSRect *rects, NSColor * const __nonnull * __nonnull colors, NSInteger num, NSCompositingOperation op); APPKIT_EXTERN void NSFrameRect(NSRect rect); APPKIT_EXTERN void NSFrameRectWithWidth(NSRect rect, CGFloat frameWidth); APPKIT_EXTERN void NSFrameRectWithWidthUsingOperation(NSRect rect, CGFloat frameWidth, NSCompositingOperation op); APPKIT_EXTERN void NSRectClip(NSRect rect); APPKIT_EXTERN void NSRectClipList(const NSRect *rects, NSInteger count); APPKIT_EXTERN NSRect NSDrawTiledRects(NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, const CGFloat *grays, NSInteger count); APPKIT_EXTERN void NSDrawGrayBezel(NSRect rect, NSRect clipRect); APPKIT_EXTERN void NSDrawGroove(NSRect rect, NSRect clipRect); APPKIT_EXTERN void NSDrawWhiteBezel(NSRect rect, NSRect clipRect); APPKIT_EXTERN void NSDrawButton(NSRect rect, NSRect clipRect); APPKIT_EXTERN void NSEraseRect(NSRect rect); APPKIT_EXTERN NSColor * __nullable NSReadPixel(NSPoint passedPoint) NS_DEPRECATED_MAC(10_0, 10_14, "Use -[NSBitmapImageRep colorAtX:y:] to interrogate pixel values. If necessary, use -[NSView cacheDisplayInRect:toBitmapImageRep:] to snapshot a view hierarchy into an NSBitmapImageRep."); APPKIT_EXTERN void NSDrawBitmap(NSRect rect, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, NSInteger bpp, NSInteger bpr, BOOL isPlanar, BOOL hasAlpha, NSColorSpaceName colorSpaceName, const unsigned char *const __nullable data[__nonnull 5]); APPKIT_EXTERN void NSHighlightRect(NSRect rect) NS_DEPRECATED_MAC(10_0, 10_0); APPKIT_EXTERN void NSBeep(void); /* gets performance stats about window server memory usage */ APPKIT_EXTERN NSInteger NSGetWindowServerMemory(NSInteger context, NSInteger *virtualMemory, NSInteger *windowBackingMemory, NSString * __nonnull * __nonnull windowDumpString) NS_DEPRECATED_MAC(10_0, 10_14, "Doesn't return anything useful since 10.0"); APPKIT_EXTERN NSRect NSDrawColorTiledRects(NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, NSColor * __nonnull * __nonnull colors, NSInteger count); APPKIT_EXTERN void NSDrawDarkBezel(NSRect rect, NSRect clipRect); APPKIT_EXTERN void NSDrawLightBezel(NSRect rect, NSRect clipRect); APPKIT_EXTERN void NSDottedFrameRect(NSRect rect); APPKIT_EXTERN void NSDrawWindowBackground(NSRect rect); APPKIT_EXTERN void NSSetFocusRingStyle(NSFocusRingPlacement placement); APPKIT_EXTERN void NSDisableScreenUpdates(void) NS_DEPRECATED_MAC(10_0, 10_11, "As of 10.11 it is not generally necessary to take explicit action to achieve visual atomicity. +[NSAnimationContext runAnimationGroup:] and other similar methods can be used when a stronger than normal need for visual atomicity is required. The NSAnimationContext methods do not suffer from the same performance problems as NSDisableScreenUpdates."); APPKIT_EXTERN void NSEnableScreenUpdates(void) NS_DEPRECATED_MAC(10_0, 10_11, "As of 10.11 it is not generally necessary to take explicit action to achieve visual atomicity. +[NSAnimationContext runAnimationGroup:] and other similar methods can be used when a stronger than normal need for visual atomicity is required. The NSAnimationContext methods do not suffer from the same performance problems as NSEnableScreenUpdates."); /* Runs one of the standard system animation effects (display and sound). ** 'centerLocation' represents the center, in screen coordinates, to show the effect. ** 'size' specifies how big the effect should be. Use NSZeroSize to get the default size. ** 'animationDelegate' is optionally, an object that wants to know when the effect has completed. ** 'didEndSelector' will be invoked in the animationDelegate when the animation has completed. ** ** The didEndSelector should have the following signature: ** - (void)animationEffectDidEnd:(void *)contextInfo; */ typedef NS_ENUM(NSUInteger, NSAnimationEffect) { // The default effect used to indicate removal of an item from a collection, // such as toolbar (indicates removal, without destroying the underlying data). NSAnimationEffectDisappearingItemDefault = 0, // An effect showing a puff of smoke. NSAnimationEffectPoof = 10 }; APPKIT_EXTERN void NSShowAnimationEffect(NSAnimationEffect animationEffect, NSPoint centerLocation, NSSize size, __nullable id animationDelegate, __nullable SEL didEndSelector, void * __nullable contextInfo); APPKIT_EXTERN void NSCountWindows(NSInteger *count) NS_DEPRECATED_MAC(10_0, 10_6, "Use +[NSWindow windowNumbersWithOptions:] instead"); APPKIT_EXTERN void NSWindowList(NSInteger size, NSInteger list[__nonnull]) NS_DEPRECATED_MAC(10_0, 10_6, "Use +[NSWindow windowNumbersWithOptions:] instead"); APPKIT_EXTERN void NSCountWindowsForContext(NSInteger context, NSInteger *count) NS_DEPRECATED_MAC(10_0, 10_6, "Use +[NSWindow windowNumbersWithOptions:] instead"); APPKIT_EXTERN void NSWindowListForContext(NSInteger context, NSInteger size, NSInteger list[__nonnull]) NS_DEPRECATED_MAC(10_0, 10_6, "Use +[NSWindow windowNumbersWithOptions:] instead"); APPKIT_EXTERN void NSCopyBits(NSInteger srcGState, NSRect srcRect, NSPoint destPoint) NS_DEPRECATED_MAC(10_0, 10_10); NS_ASSUME_NONNULL_END
69.984962
595
0.838472
f4eec0784aff88fe320d9c18c4a0ad54da12cfc0
1,656
h
C
src/gestion_fichier/lecture.h
RSA-DataSafe/RSA-DataSafe
c3efd99989f89740922870a5b6866773e2b5474e
[ "MIT" ]
1
2020-06-01T20:02:41.000Z
2020-06-01T20:02:41.000Z
src/gestion_fichier/lecture.h
RSA-DataSafe/RSA-DataSafe
c3efd99989f89740922870a5b6866773e2b5474e
[ "MIT" ]
1
2020-04-23T14:17:57.000Z
2020-05-22T21:03:46.000Z
src/gestion_fichier/lecture.h
RSA-DataSafe/RSA-DataSafe
c3efd99989f89740922870a5b6866773e2b5474e
[ "MIT" ]
5
2020-04-21T13:39:27.000Z
2021-05-08T13:07:38.000Z
#ifndef _lecture_h #define _lecture_h #include "../structure/structure.h" #include "lecture.h" #include "erreur.h" #include <gmp.h> #include <stdlib.h> #include <stdio.h> #include <string.h> /** * Permet de chercher un utilisateur dans la base de donnée. * @param email : email de l'utilisateur * @param mdp :mot de passe de l'utilisateur * @retourne 0 si l'utilisateur existe sinon un des signaux d'erreur * */ int chercher_utilisateur(char *email, char *mdp); /** * Permet de récupérer la clé publique d'un utilisateur dans le fichier correspondant. * @param email : email d'un utilisateur quelconque * @parm mdp : le mot de passe de l'utilisateur * @param publique : clé publique * @retourne 0 si l'utilisateur existe sinon un des signaux d'erreur * */ int recupere_cle_publique(char *email, char *mdp, cle_publique *publique); /** * Permet de récupérer la clé privée d'un utilisateur dans le fichier correspondant. * @param email : identifiant de l'utilisateur * @param mdp : mot de passe de l'utilisateur * @param prive : clé privée * @retourne 0 si l'utilisateur existe sinon un des signaux d'erreur * */ int recupere_cle_privee(char *email, char *mdp, cle_prive *prive); /** * Permet de lire dans une boite les mails s'y trouvant. * @param email : email de l'utilisateur * @param boite : boite à lire * @return retourne 0 si ça fonctionne, sinon un des signaux d'erreur * */ int lire_boite(char *email, boite *b); /** * Permet de lire dans un fichier * @param chemin : chemin du fichier * @return chaîne de caractère contenant le texte du fichier */ char *lire_fichier(char *chemin); #endif // !_lecture_h
29.571429
86
0.717995
7626117c47aa3ecfb3f12e3dbe13dc87598430c1
153
h
C
malloc/malloc.h
wx-csy/linux-utils
f297c6b3ab5f40c8ca4d9895787d25c7a04738e2
[ "Unlicense" ]
1
2020-11-24T14:43:42.000Z
2020-11-24T14:43:42.000Z
malloc/malloc.h
wx-csy/linux-utils
f297c6b3ab5f40c8ca4d9895787d25c7a04738e2
[ "Unlicense" ]
null
null
null
malloc/malloc.h
wx-csy/linux-utils
f297c6b3ab5f40c8ca4d9895787d25c7a04738e2
[ "Unlicense" ]
null
null
null
#ifndef __MALLOC_H__ #define __MALLOC_H__ #include <stddef.h> void* do_malloc(size_t size); void do_free(void *ptr); #endif /* ifndef __MALLOC_H__ */
15.3
32
0.745098
49441fcd68a7363a4241f4e80483b8b7657308c2
288
h
C
Archive/MyLocations/MyLocations/UIImage+Resize.h
hectoregm/ios_apprentice
5cc62bfd3ff1e2de6880871b03bb9a5d5fb279d6
[ "MIT" ]
null
null
null
Archive/MyLocations/MyLocations/UIImage+Resize.h
hectoregm/ios_apprentice
5cc62bfd3ff1e2de6880871b03bb9a5d5fb279d6
[ "MIT" ]
null
null
null
Archive/MyLocations/MyLocations/UIImage+Resize.h
hectoregm/ios_apprentice
5cc62bfd3ff1e2de6880871b03bb9a5d5fb279d6
[ "MIT" ]
null
null
null
// // UIImage+Resize.h // MyLocations // // Created by Hector Enrique Gomez Morales on 7/2/14. // Copyright (c) 2014 Hector Enrique Gomez Morales. All rights reserved. // #import <UIKit/UIKit.h> @interface UIImage (Resize) - (UIImage *)resizedImageWithBounds:(CGSize)bounds; @end
18
73
0.708333
aa0bd6c9db18d1a1545708a12ed6d7462594802c
5,946
c
C
opencl/sat/misc/anf_array_lib.c
dvdalilue/sat_solver
00c2bc8ffabb0507cb5224632051befbab5a90fe
[ "BSD-3-Clause" ]
null
null
null
opencl/sat/misc/anf_array_lib.c
dvdalilue/sat_solver
00c2bc8ffabb0507cb5224632051befbab5a90fe
[ "BSD-3-Clause" ]
null
null
null
opencl/sat/misc/anf_array_lib.c
dvdalilue/sat_solver
00c2bc8ffabb0507cb5224632051befbab5a90fe
[ "BSD-3-Clause" ]
1
2020-02-14T13:01:32.000Z
2020-02-14T13:01:32.000Z
// // anf_array_lib.c // sat // // Created by David Lilue on 29/06/2018. // #include <stdlib.h> #include <stdio.h> #include "anf_array_lib.h" ANF_Array* empty_anf_array (void) { ANF_Array *anf_a = (ANF_Array *) malloc(sizeof(ANF_Array)); array_new(&anf_a->xors, 7, ANF_BitString*); array_init(anf_a->xors); anf_a->components = 0; return anf_a; } ANF_BitString* new_bitstring (void) { ANF_BitString *bs = (ANF_BitString *) malloc(sizeof(ANF_BitString)); array_new(&bs->bstring, BS_SIZE, char); for (int i = 0; i < BS_SIZE; i++) { index(bs->bstring, i, char) = 0; } bs->bits_on = 0; bs->bstring->size = bs->bstring->capacity; return bs; } ANF_Array* new_anf_array (void) { ANF_Array *anf_a = empty_anf_array(); ANF_BitString *bs = new_bitstring(); add_xor_comp(anf_a, bs); return anf_a; } ANF_Array* one (void) { return new_anf_array(); } ANF_Array* zero (void) { ANF_Array *z = empty_anf_array(); return z; } ANF_Array* new_poly (int var) { ANF_Array *p = new_anf_array(); get_bs_comp(p, 0, var) = 1; get_anf_bs(p, 0)->bits_on++; return p; } ANF_BitString* array_get_xor (Array *array, int i) { if (i >= array->size || i < 0) { printf("Index %d out of bounds for array of size %d\n", i, array->size); exit(1); } return index(array, i, ANF_BitString*); } ANF_BitString* get_anf_bs (ANF_Array *anf, int i) { return array_get_xor(anf->xors, i); } void array_double_capacity_if_full (Array *array) { if (array->size >= array->capacity) { array->capacity *= 2; array->elements = (void *) realloc( array->elements, sizeof(ANF_BitString*) * array->capacity); } } void array_add_xor (Array *array, ANF_BitString *bs) { array_double_capacity_if_full(array); index(array, array->size++, ANF_BitString*) = bs; } void shift_left_from (Array *array, int i) { while (i < array->size - 1) { index(array, i, ANF_BitString *) = index(array, i+1, ANF_BitString *); i++; } } int array_rm_bs (Array *array, ANF_BitString *bs) { for (int i = 0; i < array->size; i++) { switch (compare_bs(array_get_xor(array, i), bs)) { case EQ: array_free(array_get_xor(array, i)->bstring); free(array_get_xor(array, i)); shift_left_from(array, i); array->size--; return 1; } } return 0; } void add_xor_comp (ANF_Array *p, ANF_BitString *bs) { array_add_xor(p->xors, bs); p->components++; } void add_xor_comp_envious (ANF_Array *p, ANF_BitString *bs) { if (array_rm_bs(p->xors, bs)) { array_free(bs->bstring); free(bs); p->components--; } else { array_add_xor(p->xors, bs); p->components++; } } Ordering compare_bs (ANF_BitString *x, ANF_BitString *y) { if (x->bits_on < y->bits_on) { return LT; } else if (x->bits_on > y->bits_on) { return GT; } else { if (x->bits_on == 0) { return EQ; } for (int i = 0; i < x->bstring->size; i++) { if (index(x->bstring, i, char) == 1 && index(y->bstring, i, char) == 0) { return LT; } else if (index(x->bstring, i, char) == 0 && index(y->bstring, i, char) == 1) { return GT; } } } return EQ; } ANF_BitString* copy_bs (ANF_BitString *bs) { ANF_BitString *cp_bs = new_bitstring(); for (int i = 0; i < bs->bstring->size; i++) { index(cp_bs->bstring, i, char) = index(bs->bstring, i, char); } cp_bs->bits_on = bs->bits_on; return cp_bs; } void merge (ANF_Array *p, int a, int b, int c) { int n_ls = b - a + 1; int n_rs = c - b; int i, j, k; ANF_BitString **left = (ANF_BitString **) malloc(sizeof(ANF_BitString*) * n_ls); ANF_BitString **right = (ANF_BitString **) malloc(sizeof(ANF_BitString*) * n_rs); for (i = 0; i < n_ls; i++) left[i] = get_anf_bs(p, a + i); for (j = 0; j < n_rs; j++) right[j] = get_anf_bs(p, b + 1 + j); i = j = 0; k = a; while (i < n_ls && j < n_rs) { switch (compare_bs(left[i], right[j])) { case EQ: case LT: dig_anf_bs(p, k++) = left[i++]; break; case GT: dig_anf_bs(p, k++) = right[j++]; break; } } while (i < n_ls) dig_anf_bs(p, k++) = left[i++]; while (j < n_rs) dig_anf_bs(p, k++) = right[j++]; free(left); free(right); } void merge_sort_aux (ANF_Array *p, int a, int c) { if (a < c) { int b = (a + c) / 2; merge_sort_aux(p, a, b); merge_sort_aux(p, b + 1, c); merge(p, a, b, c); } } void merge_sort_anf (ANF_Array *p) { merge_sort_aux(p, 0, p->xors->size - 1); } void free_anf_array (ANF_Array *p) { array_free(p->xors); free(p); } void free_anf_array_deep (ANF_Array *p) { for (int i = 0; i < p->xors->size; i++) { if (dig_anf_bs(p, i) != NULL) { array_free(dig_anf_bs(p, i)->bstring); free(dig_anf_bs(p, i)); } } free_anf_array(p); } void print_bs (ANF_BitString *bs) { if (bs->bits_on == 0 && index(bs->bstring, 0, char) == 0) { printf("1"); } else { for (int j = 0; j < bs->bstring->size; j++) { if (index(bs->bstring, j, char) != 0) printf("(%d)", j); } } } void print_anf_array (ANF_Array *p) { int i = 0; if (p->components == 0) { printf("0"); } while (i < p->components) { print_bs(get_anf_bs(p, i++)); if (i < p->components) printf(" xor "); } printf("\n"); }
23.409449
78
0.522704
eba8dd282a1983b35e5569d4914ab1923c456c86
1,709
h
C
PrivateFrameworks/GeoServices/GEOUserSessionEntity.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/GeoServices/GEOUserSessionEntity.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/GeoServices/GEOUserSessionEntity.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" #import "NSCopying.h" @class NSNumber, NSString; @interface GEOUserSessionEntity : NSObject <NSCopying> { struct GEOSessionID _sessionID; unsigned int _sequenceNumber; double _sessionCreationTime; double _sessionRelativeTimestamp; } @property(readonly, nonatomic) unsigned int sequenceNumber; // @synthesize sequenceNumber=_sequenceNumber; @property(readonly, nonatomic) double sessionRelativeTimestamp; // @synthesize sessionRelativeTimestamp=_sessionRelativeTimestamp; @property(nonatomic) double sessionCreationTime; // @synthesize sessionCreationTime=_sessionCreationTime; @property(readonly, nonatomic) struct GEOSessionID sessionID; // @synthesize sessionID=_sessionID; - (id)copyWithZone:(struct _NSZone *)arg1; - (void)updateSessionIDFromUUIDString:(id)arg1; - (void)updateWithSessionEntityString:(id)arg1; - (BOOL)_isValidSessionIDHighOrLowString:(id)arg1; @property(readonly, nonatomic) NSString *sessionIDHighString; @property(readonly, nonatomic) NSString *sessionIDLowString; @property(readonly, nonatomic) NSNumber *sessionIDHigh; @property(readonly, nonatomic) NSNumber *sessionIDLow; @property(readonly, nonatomic) NSString *sessionUUIDString; @property(readonly, nonatomic) NSString *sessionIDString; @property(readonly, nonatomic) NSString *sessionEntityString; - (id)description; - (id)initWithSessionEntityString:(id)arg1; - (id)initWithSessionID:(struct GEOSessionID)arg1 sessionCreationTime:(double)arg2 sequenceNumber:(unsigned int)arg3; - (double)sessionRelativeTimestampForEventTime:(double)arg1; @end
39.744186
130
0.799298
9db6496d022a2fa4e336c98c8a54699d141b7220
736
h
C
DirectoriesSynchronizer/src/util/Logger.h
KrystianJonca/Directories-Synchronizer
bb9c010161af6516d907e25275ba0ab680386cb5
[ "MIT" ]
null
null
null
DirectoriesSynchronizer/src/util/Logger.h
KrystianJonca/Directories-Synchronizer
bb9c010161af6516d907e25275ba0ab680386cb5
[ "MIT" ]
null
null
null
DirectoriesSynchronizer/src/util/Logger.h
KrystianJonca/Directories-Synchronizer
bb9c010161af6516d907e25275ba0ab680386cb5
[ "MIT" ]
null
null
null
#pragma once #include <memory> #include "spdlog/spdlog.h" class Logger { public: static void Init(); inline static std::shared_ptr<spdlog::logger>& GetLogger() { return s_Logger; } private: static std::shared_ptr<spdlog::logger> s_Logger; }; #ifdef _DEBUG #define LOG_DEBUG(...) Logger::GetLogger()->debug(__VA_ARGS__) #define LOG_INFO(...) Logger::GetLogger()->info(__VA_ARGS__) #define LOG_WARN(...) Logger::GetLogger()->warn(__VA_ARGS__) #define LOG_ERROR(...) Logger::GetLogger()->error(__VA_ARGS__) #define LOG_CRITICAL(...) Logger::GetLogger()->critical(__VA_ARGS__) #else #define LOG_DEBUG(...) #define LOG_INFO(...) #define LOG_WARN(...) #define LOG_ERROR(...) #define LOG_CRITICAL(...) #endif
27.259259
80
0.690217
8d05e9adc45e89ad498f59268bfd91f599a58643
3,921
h
C
DQM/TrackingMonitor/interface/TrackSplittingMonitor.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
6
2017-09-08T14:12:56.000Z
2022-03-09T23:57:01.000Z
DQM/TrackingMonitor/interface/TrackSplittingMonitor.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
545
2017-09-19T17:10:19.000Z
2022-03-07T16:55:27.000Z
DQM/TrackingMonitor/interface/TrackSplittingMonitor.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
14
2017-10-04T09:47:21.000Z
2019-10-23T18:04:45.000Z
#ifndef TrackSplittingMonitor_H #define TrackSplittingMonitor_H // -*- C++ -*- // // Package: TrackSplittingMonitor // Class: TrackSplittingMonitor // /**\class TrackSplittingMonitor TrackSplittingMonitor.cc DQM/TrackingMonitor/src/TrackSplittingMonitor.cc Monitoring source for general quantities related to tracks. */ // Original Author: Nhan Tran // Created: Thu 28 22:45:30 CEST 2008 #include <memory> #include <fstream> #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "DQMServices/Core/interface/DQMStore.h" #include <DQMServices/Core/interface/DQMEDAnalyzer.h> #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include "Geometry/Records/interface/MuonGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" class TProfile; #include "DataFormats/MuonReco/interface/Muon.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" class TrackSplittingMonitor : public DQMEDAnalyzer { public: explicit TrackSplittingMonitor(const edm::ParameterSet&); ~TrackSplittingMonitor() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; private: void doProfileX(TH2* th2, MonitorElement* me); void doProfileX(MonitorElement* th2m, MonitorElement* me); // ----------member data --------------------------- // unsigned int minTracks_; std::string histname; //for naming the histograms according to algorithm used DQMStore* dqmStore_; edm::ParameterSet conf_; edm::ESHandle<TrackerGeometry> theGeometry; edm::ESHandle<MagneticField> theMagField; edm::ESHandle<DTGeometry> dtGeometry; edm::ESHandle<CSCGeometry> cscGeometry; edm::ESHandle<RPCGeometry> rpcGeometry; edm::InputTag splitTracks_; edm::InputTag splitMuons_; edm::EDGetTokenT<std::vector<reco::Track> > splitTracksToken_; edm::EDGetTokenT<std::vector<reco::Muon> > splitMuonsToken_; bool plotMuons_; int pixelHitsPerLeg_; int totalHitsPerLeg_; double d0Cut_; double dzCut_; double ptCut_; double norchiCut_; // histograms MonitorElement* ddxyAbsoluteResiduals_tracker_; MonitorElement* ddzAbsoluteResiduals_tracker_; MonitorElement* dphiAbsoluteResiduals_tracker_; MonitorElement* dthetaAbsoluteResiduals_tracker_; MonitorElement* dptAbsoluteResiduals_tracker_; MonitorElement* dcurvAbsoluteResiduals_tracker_; MonitorElement* ddxyNormalizedResiduals_tracker_; MonitorElement* ddzNormalizedResiduals_tracker_; MonitorElement* dphiNormalizedResiduals_tracker_; MonitorElement* dthetaNormalizedResiduals_tracker_; MonitorElement* dptNormalizedResiduals_tracker_; MonitorElement* dcurvNormalizedResiduals_tracker_; MonitorElement* ddxyAbsoluteResiduals_global_; MonitorElement* ddzAbsoluteResiduals_global_; MonitorElement* dphiAbsoluteResiduals_global_; MonitorElement* dthetaAbsoluteResiduals_global_; MonitorElement* dptAbsoluteResiduals_global_; MonitorElement* dcurvAbsoluteResiduals_global_; MonitorElement* ddxyNormalizedResiduals_global_; MonitorElement* ddzNormalizedResiduals_global_; MonitorElement* dphiNormalizedResiduals_global_; MonitorElement* dthetaNormalizedResiduals_global_; MonitorElement* dptNormalizedResiduals_global_; MonitorElement* dcurvNormalizedResiduals_global_; }; #endif
35.645455
105
0.805662
a56ab80d08906d2956ff0175373a10b5476c32a9
53,163
h
C
variants/atmelsam/samb11/include/component/uart.h
frankleonrose/framework-cmsis
ca2abc9e661b92c2dd2185c6aa5e01012ba27bcf
[ "Apache-2.0" ]
2
2020-07-14T15:26:01.000Z
2020-11-13T03:43:39.000Z
variants/atmelsam/samb11/include/component/uart.h
frankleonrose/framework-cmsis
ca2abc9e661b92c2dd2185c6aa5e01012ba27bcf
[ "Apache-2.0" ]
1
2020-04-24T23:22:11.000Z
2020-04-24T23:37:37.000Z
variants/atmelsam/samb11/include/component/uart.h
frankleonrose/framework-cmsis
ca2abc9e661b92c2dd2185c6aa5e01012ba27bcf
[ "Apache-2.0" ]
4
2020-04-19T07:21:15.000Z
2020-11-13T03:43:41.000Z
/** * \file * * \brief Component description for UART * * Copyright (c) 2017 Atmel Corporation, a wholly owned subsidiary of Microchip Technology Inc. * * \license_start * * \page License * * 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. * * \license_stop * */ /* file generated from device description version */ #ifndef _SAMB11_UART_COMPONENT_H_ #define _SAMB11_UART_COMPONENT_H_ #define _SAMB11_UART_COMPONENT_ /**< \deprecated Backward compatibility for ASF */ /** \addtogroup SAMB_SAMB11 UART Controller * @{ */ /* ========================================================================== */ /** SOFTWARE API DEFINITION FOR UART */ /* ========================================================================== */ #ifndef COMPONENT_TYPEDEF_STYLE #define COMPONENT_TYPEDEF_STYLE 'N' /**< Defines default style of typedefs for the component header files ('R' = RFO, 'N' = NTO)*/ #endif #define UART_U1234 /**< (UART) Module ID */ #define REV_UART 0x100 /**< (UART) Module revision */ /* -------- UART_TRANSMIT_DATA : (UART Offset: 0x00) (/W 8) Writes one byte to UART Transmit Data FIFO. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t TX_BYTE:8; /**< bit: 0..7 Writes data in transmit FIFO. If byte length is set to 7, the MSB should be set to 0. */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_TRANSMIT_DATA_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_TRANSMIT_DATA_OFFSET (0x00) /**< (UART_TRANSMIT_DATA) Writes one byte to UART Transmit Data FIFO. Offset */ #define UART_TRANSMIT_DATA_RESETVALUE _U_(0x00) /**< (UART_TRANSMIT_DATA) Writes one byte to UART Transmit Data FIFO. Reset Value */ #define UART_TRANSMIT_DATA_TX_BYTE_Pos 0 /**< (UART_TRANSMIT_DATA) Writes data in transmit FIFO. If byte length is set to 7, the MSB should be set to 0. Position */ #define UART_TRANSMIT_DATA_TX_BYTE_Msk (_U_(0xFF) << UART_TRANSMIT_DATA_TX_BYTE_Pos) /**< (UART_TRANSMIT_DATA) Writes data in transmit FIFO. If byte length is set to 7, the MSB should be set to 0. Mask */ #define UART_TRANSMIT_DATA_TX_BYTE(value) (UART_TRANSMIT_DATA_TX_BYTE_Msk & ((value) << UART_TRANSMIT_DATA_TX_BYTE_Pos)) #define UART_TRANSMIT_DATA_MASK _U_(0xFF) /**< \deprecated (UART_TRANSMIT_DATA) Register MASK (Use UART_TRANSMIT_DATA_Msk instead) */ #define UART_TRANSMIT_DATA_Msk _U_(0xFF) /**< (UART_TRANSMIT_DATA) Register Mask */ /* -------- UART_TRANSMIT_STATUS : (UART Offset: 0x04) (R/ 8) Status of the UART transmitter. Each field can generate an interrupt if corresponding bit in the Tx interrupt mask register is set. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t TX_FIFO_NOT_FULL:1; /**< bit: 0 Active High indication when Tx FIFO can still accepts at least one more character. 0: TX FIFO Full. 1: TX FIFO not Full. */ uint8_t TX_FIFO_0P25_EMPTY:1; /**< bit: 1 Active High indication when Tx FIFO is at least quarter empty. Reset when more. */ uint8_t TX_FIFO_0P5_EMPTY:1; /**< bit: 2 Active High indication when Tx FIFO is at least half empty. Reset when more. */ uint8_t TX_FIFO_0P75_EMPTY:1; /**< bit: 3 Active High indication when Tx FIFO is at least three quarters empty. Reset when more. */ uint8_t TX_FIFO_EMPTY:1; /**< bit: 4 Active High indication when Tx FIFO is Empty and has no more character to transmit */ uint8_t CTS_ACTIVE:1; /**< bit: 5 Active High indication when flow control signal "cts" is active. Unaffected by cts enable bit in config register. */ uint8_t :2; /**< bit: 6..7 Reserved */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_TRANSMIT_STATUS_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_TRANSMIT_STATUS_OFFSET (0x04) /**< (UART_TRANSMIT_STATUS) Status of the UART transmitter. Each field can generate an interrupt if corresponding bit in the Tx interrupt mask register is set. Offset */ #define UART_TRANSMIT_STATUS_RESETVALUE _U_(0x00) /**< (UART_TRANSMIT_STATUS) Status of the UART transmitter. Each field can generate an interrupt if corresponding bit in the Tx interrupt mask register is set. Reset Value */ #define UART_TRANSMIT_STATUS_TX_FIFO_NOT_FULL_Pos 0 /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO can still accepts at least one more character. 0: TX FIFO Full. 1: TX FIFO not Full. Position */ #define UART_TRANSMIT_STATUS_TX_FIFO_NOT_FULL_Msk (_U_(0x1) << UART_TRANSMIT_STATUS_TX_FIFO_NOT_FULL_Pos) /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO can still accepts at least one more character. 0: TX FIFO Full. 1: TX FIFO not Full. Mask */ #define UART_TRANSMIT_STATUS_TX_FIFO_NOT_FULL UART_TRANSMIT_STATUS_TX_FIFO_NOT_FULL_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TRANSMIT_STATUS_TX_FIFO_NOT_FULL_Msk instead */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P25_EMPTY_Pos 1 /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is at least quarter empty. Reset when more. Position */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P25_EMPTY_Msk (_U_(0x1) << UART_TRANSMIT_STATUS_TX_FIFO_0P25_EMPTY_Pos) /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is at least quarter empty. Reset when more. Mask */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P25_EMPTY UART_TRANSMIT_STATUS_TX_FIFO_0P25_EMPTY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TRANSMIT_STATUS_TX_FIFO_0P25_EMPTY_Msk instead */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P5_EMPTY_Pos 2 /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is at least half empty. Reset when more. Position */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P5_EMPTY_Msk (_U_(0x1) << UART_TRANSMIT_STATUS_TX_FIFO_0P5_EMPTY_Pos) /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is at least half empty. Reset when more. Mask */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P5_EMPTY UART_TRANSMIT_STATUS_TX_FIFO_0P5_EMPTY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TRANSMIT_STATUS_TX_FIFO_0P5_EMPTY_Msk instead */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P75_EMPTY_Pos 3 /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is at least three quarters empty. Reset when more. Position */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P75_EMPTY_Msk (_U_(0x1) << UART_TRANSMIT_STATUS_TX_FIFO_0P75_EMPTY_Pos) /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is at least three quarters empty. Reset when more. Mask */ #define UART_TRANSMIT_STATUS_TX_FIFO_0P75_EMPTY UART_TRANSMIT_STATUS_TX_FIFO_0P75_EMPTY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TRANSMIT_STATUS_TX_FIFO_0P75_EMPTY_Msk instead */ #define UART_TRANSMIT_STATUS_TX_FIFO_EMPTY_Pos 4 /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is Empty and has no more character to transmit Position */ #define UART_TRANSMIT_STATUS_TX_FIFO_EMPTY_Msk (_U_(0x1) << UART_TRANSMIT_STATUS_TX_FIFO_EMPTY_Pos) /**< (UART_TRANSMIT_STATUS) Active High indication when Tx FIFO is Empty and has no more character to transmit Mask */ #define UART_TRANSMIT_STATUS_TX_FIFO_EMPTY UART_TRANSMIT_STATUS_TX_FIFO_EMPTY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TRANSMIT_STATUS_TX_FIFO_EMPTY_Msk instead */ #define UART_TRANSMIT_STATUS_CTS_ACTIVE_Pos 5 /**< (UART_TRANSMIT_STATUS) Active High indication when flow control signal "cts" is active. Unaffected by cts enable bit in config register. Position */ #define UART_TRANSMIT_STATUS_CTS_ACTIVE_Msk (_U_(0x1) << UART_TRANSMIT_STATUS_CTS_ACTIVE_Pos) /**< (UART_TRANSMIT_STATUS) Active High indication when flow control signal "cts" is active. Unaffected by cts enable bit in config register. Mask */ #define UART_TRANSMIT_STATUS_CTS_ACTIVE UART_TRANSMIT_STATUS_CTS_ACTIVE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TRANSMIT_STATUS_CTS_ACTIVE_Msk instead */ #define UART_TRANSMIT_STATUS_MASK _U_(0x3F) /**< \deprecated (UART_TRANSMIT_STATUS) Register MASK (Use UART_TRANSMIT_STATUS_Msk instead) */ #define UART_TRANSMIT_STATUS_Msk _U_(0x3F) /**< (UART_TRANSMIT_STATUS) Register Mask */ /* -------- UART_TX_INTERRUPT_MASK : (UART Offset: 0x08) (R/W 8) Enable or Disable the generation of interrupts by the tx_status register. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t TX_FIFO_NOT_FULL_MASK:1; /**< bit: 0 Active High Enable of tx_fifo_not_full interrupt */ uint8_t TX_FIFO_0P25_EMPTY_MASK:1; /**< bit: 1 Active High Enable of tx_fifo_0p25_empty interrupt */ uint8_t TX_FIFO_0P5_EMPTY_MASK:1; /**< bit: 2 Active High Enable of tx_fifo_0p5_empty interrupt */ uint8_t TX_FIFO_0P75_EMPTY_MASK:1; /**< bit: 3 Active High Enable of tx_fifo_0p75_empty interrupt */ uint8_t TX_FIFO_EMPTY_MASK:1; /**< bit: 4 Active High Enable of tx_fifo_empty interrupt */ uint8_t CTS_ACTIVE_MASK:1; /**< bit: 5 Active High Enable of cts_active interrupt */ uint8_t :2; /**< bit: 6..7 Reserved */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_TX_INTERRUPT_MASK_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_TX_INTERRUPT_MASK_OFFSET (0x08) /**< (UART_TX_INTERRUPT_MASK) Enable or Disable the generation of interrupts by the tx_status register. Offset */ #define UART_TX_INTERRUPT_MASK_RESETVALUE _U_(0x00) /**< (UART_TX_INTERRUPT_MASK) Enable or Disable the generation of interrupts by the tx_status register. Reset Value */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_NOT_FULL_MASK_Pos 0 /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_not_full interrupt Position */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_NOT_FULL_MASK_Msk (_U_(0x1) << UART_TX_INTERRUPT_MASK_TX_FIFO_NOT_FULL_MASK_Pos) /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_not_full interrupt Mask */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_NOT_FULL_MASK UART_TX_INTERRUPT_MASK_TX_FIFO_NOT_FULL_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TX_INTERRUPT_MASK_TX_FIFO_NOT_FULL_MASK_Msk instead */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P25_EMPTY_MASK_Pos 1 /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_0p25_empty interrupt Position */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P25_EMPTY_MASK_Msk (_U_(0x1) << UART_TX_INTERRUPT_MASK_TX_FIFO_0P25_EMPTY_MASK_Pos) /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_0p25_empty interrupt Mask */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P25_EMPTY_MASK UART_TX_INTERRUPT_MASK_TX_FIFO_0P25_EMPTY_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TX_INTERRUPT_MASK_TX_FIFO_0P25_EMPTY_MASK_Msk instead */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P5_EMPTY_MASK_Pos 2 /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_0p5_empty interrupt Position */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P5_EMPTY_MASK_Msk (_U_(0x1) << UART_TX_INTERRUPT_MASK_TX_FIFO_0P5_EMPTY_MASK_Pos) /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_0p5_empty interrupt Mask */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P5_EMPTY_MASK UART_TX_INTERRUPT_MASK_TX_FIFO_0P5_EMPTY_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TX_INTERRUPT_MASK_TX_FIFO_0P5_EMPTY_MASK_Msk instead */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P75_EMPTY_MASK_Pos 3 /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_0p75_empty interrupt Position */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P75_EMPTY_MASK_Msk (_U_(0x1) << UART_TX_INTERRUPT_MASK_TX_FIFO_0P75_EMPTY_MASK_Pos) /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_0p75_empty interrupt Mask */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_0P75_EMPTY_MASK UART_TX_INTERRUPT_MASK_TX_FIFO_0P75_EMPTY_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TX_INTERRUPT_MASK_TX_FIFO_0P75_EMPTY_MASK_Msk instead */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_EMPTY_MASK_Pos 4 /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_empty interrupt Position */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_EMPTY_MASK_Msk (_U_(0x1) << UART_TX_INTERRUPT_MASK_TX_FIFO_EMPTY_MASK_Pos) /**< (UART_TX_INTERRUPT_MASK) Active High Enable of tx_fifo_empty interrupt Mask */ #define UART_TX_INTERRUPT_MASK_TX_FIFO_EMPTY_MASK UART_TX_INTERRUPT_MASK_TX_FIFO_EMPTY_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TX_INTERRUPT_MASK_TX_FIFO_EMPTY_MASK_Msk instead */ #define UART_TX_INTERRUPT_MASK_CTS_ACTIVE_MASK_Pos 5 /**< (UART_TX_INTERRUPT_MASK) Active High Enable of cts_active interrupt Position */ #define UART_TX_INTERRUPT_MASK_CTS_ACTIVE_MASK_Msk (_U_(0x1) << UART_TX_INTERRUPT_MASK_CTS_ACTIVE_MASK_Pos) /**< (UART_TX_INTERRUPT_MASK) Active High Enable of cts_active interrupt Mask */ #define UART_TX_INTERRUPT_MASK_CTS_ACTIVE_MASK UART_TX_INTERRUPT_MASK_CTS_ACTIVE_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_TX_INTERRUPT_MASK_CTS_ACTIVE_MASK_Msk instead */ #define UART_TX_INTERRUPT_MASK_Msk _U_(0x3F) /**< (UART_TX_INTERRUPT_MASK) Register Mask */ /* -------- UART_RECEIVE_DATA : (UART Offset: 0x10) (R/ 8) Read one byte from UART Receive Data FIFO. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t RX_BYTE:8; /**< bit: 0..7 Oldest data in receive FIFO. If byte length is set to 7, the MSB is set to 0. */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_RECEIVE_DATA_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_RECEIVE_DATA_OFFSET (0x10) /**< (UART_RECEIVE_DATA) Read one byte from UART Receive Data FIFO. Offset */ #define UART_RECEIVE_DATA_RESETVALUE _U_(0x00) /**< (UART_RECEIVE_DATA) Read one byte from UART Receive Data FIFO. Reset Value */ #define UART_RECEIVE_DATA_RX_BYTE_Pos 0 /**< (UART_RECEIVE_DATA) Oldest data in receive FIFO. If byte length is set to 7, the MSB is set to 0. Position */ #define UART_RECEIVE_DATA_RX_BYTE_Msk (_U_(0xFF) << UART_RECEIVE_DATA_RX_BYTE_Pos) /**< (UART_RECEIVE_DATA) Oldest data in receive FIFO. If byte length is set to 7, the MSB is set to 0. Mask */ #define UART_RECEIVE_DATA_RX_BYTE(value) (UART_RECEIVE_DATA_RX_BYTE_Msk & ((value) << UART_RECEIVE_DATA_RX_BYTE_Pos)) #define UART_RECEIVE_DATA_MASK _U_(0xFF) /**< \deprecated (UART_RECEIVE_DATA) Register MASK (Use UART_RECEIVE_DATA_Msk instead) */ #define UART_RECEIVE_DATA_Msk _U_(0xFF) /**< (UART_RECEIVE_DATA) Register Mask */ /* -------- UART_RECEIVE_STATUS : (UART Offset: 0x14) (R/ 8) Status of the UART receiver. Each field can generate an interrupt if corresponding bit in the Rx interrupt mask register is set. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t RX_FIFO_NOT_EMPTY:1; /**< bit: 0 Active High indication when data is available in Rx FIFO. 0: RX FIFO Empty. 1: RX FIFO contains at least one byte of data. */ uint8_t RX_FIFO_0P25_FULL:1; /**< bit: 1 Active High indication when FIFO is at least quarter full. Reset when less. */ uint8_t RX_FIFO_0P5_FULL:1; /**< bit: 2 Active High indication when FIFO is at least half full. Reset when less. */ uint8_t RX_FIFO_0P75_FULL:1; /**< bit: 3 Active High indication when FIFO is at least three quarters full. Reset when less. */ uint8_t TIMEOUT:1; /**< bit: 4 Active High indication when the timeout set in the rx_timeout register has elapsed since the last interaction with the receiver. Reset by reading the status register. */ uint8_t PARITY_ERROR:1; /**< bit: 5 Active High indication when a receive parity error is detected. Reset by reading the status register. */ uint8_t FIFO_OVERRUN:1; /**< bit: 6 Active High indication when character is received but FIFO is full. Reset by reading the status register. */ uint8_t FRAMING_ERROR:1; /**< bit: 7 Active High indication when no stop bit is detected. Reset by reading the status register. */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_RECEIVE_STATUS_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_RECEIVE_STATUS_OFFSET (0x14) /**< (UART_RECEIVE_STATUS) Status of the UART receiver. Each field can generate an interrupt if corresponding bit in the Rx interrupt mask register is set. Offset */ #define UART_RECEIVE_STATUS_RESETVALUE _U_(0x00) /**< (UART_RECEIVE_STATUS) Status of the UART receiver. Each field can generate an interrupt if corresponding bit in the Rx interrupt mask register is set. Reset Value */ #define UART_RECEIVE_STATUS_RX_FIFO_NOT_EMPTY_Pos 0 /**< (UART_RECEIVE_STATUS) Active High indication when data is available in Rx FIFO. 0: RX FIFO Empty. 1: RX FIFO contains at least one byte of data. Position */ #define UART_RECEIVE_STATUS_RX_FIFO_NOT_EMPTY_Msk (_U_(0x1) << UART_RECEIVE_STATUS_RX_FIFO_NOT_EMPTY_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when data is available in Rx FIFO. 0: RX FIFO Empty. 1: RX FIFO contains at least one byte of data. Mask */ #define UART_RECEIVE_STATUS_RX_FIFO_NOT_EMPTY UART_RECEIVE_STATUS_RX_FIFO_NOT_EMPTY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_RX_FIFO_NOT_EMPTY_Msk instead */ #define UART_RECEIVE_STATUS_RX_FIFO_0P25_FULL_Pos 1 /**< (UART_RECEIVE_STATUS) Active High indication when FIFO is at least quarter full. Reset when less. Position */ #define UART_RECEIVE_STATUS_RX_FIFO_0P25_FULL_Msk (_U_(0x1) << UART_RECEIVE_STATUS_RX_FIFO_0P25_FULL_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when FIFO is at least quarter full. Reset when less. Mask */ #define UART_RECEIVE_STATUS_RX_FIFO_0P25_FULL UART_RECEIVE_STATUS_RX_FIFO_0P25_FULL_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_RX_FIFO_0P25_FULL_Msk instead */ #define UART_RECEIVE_STATUS_RX_FIFO_0P5_FULL_Pos 2 /**< (UART_RECEIVE_STATUS) Active High indication when FIFO is at least half full. Reset when less. Position */ #define UART_RECEIVE_STATUS_RX_FIFO_0P5_FULL_Msk (_U_(0x1) << UART_RECEIVE_STATUS_RX_FIFO_0P5_FULL_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when FIFO is at least half full. Reset when less. Mask */ #define UART_RECEIVE_STATUS_RX_FIFO_0P5_FULL UART_RECEIVE_STATUS_RX_FIFO_0P5_FULL_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_RX_FIFO_0P5_FULL_Msk instead */ #define UART_RECEIVE_STATUS_RX_FIFO_0P75_FULL_Pos 3 /**< (UART_RECEIVE_STATUS) Active High indication when FIFO is at least three quarters full. Reset when less. Position */ #define UART_RECEIVE_STATUS_RX_FIFO_0P75_FULL_Msk (_U_(0x1) << UART_RECEIVE_STATUS_RX_FIFO_0P75_FULL_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when FIFO is at least three quarters full. Reset when less. Mask */ #define UART_RECEIVE_STATUS_RX_FIFO_0P75_FULL UART_RECEIVE_STATUS_RX_FIFO_0P75_FULL_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_RX_FIFO_0P75_FULL_Msk instead */ #define UART_RECEIVE_STATUS_TIMEOUT_Pos 4 /**< (UART_RECEIVE_STATUS) Active High indication when the timeout set in the rx_timeout register has elapsed since the last interaction with the receiver. Reset by reading the status register. Position */ #define UART_RECEIVE_STATUS_TIMEOUT_Msk (_U_(0x1) << UART_RECEIVE_STATUS_TIMEOUT_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when the timeout set in the rx_timeout register has elapsed since the last interaction with the receiver. Reset by reading the status register. Mask */ #define UART_RECEIVE_STATUS_TIMEOUT UART_RECEIVE_STATUS_TIMEOUT_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_TIMEOUT_Msk instead */ #define UART_RECEIVE_STATUS_PARITY_ERROR_Pos 5 /**< (UART_RECEIVE_STATUS) Active High indication when a receive parity error is detected. Reset by reading the status register. Position */ #define UART_RECEIVE_STATUS_PARITY_ERROR_Msk (_U_(0x1) << UART_RECEIVE_STATUS_PARITY_ERROR_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when a receive parity error is detected. Reset by reading the status register. Mask */ #define UART_RECEIVE_STATUS_PARITY_ERROR UART_RECEIVE_STATUS_PARITY_ERROR_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_PARITY_ERROR_Msk instead */ #define UART_RECEIVE_STATUS_FIFO_OVERRUN_Pos 6 /**< (UART_RECEIVE_STATUS) Active High indication when character is received but FIFO is full. Reset by reading the status register. Position */ #define UART_RECEIVE_STATUS_FIFO_OVERRUN_Msk (_U_(0x1) << UART_RECEIVE_STATUS_FIFO_OVERRUN_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when character is received but FIFO is full. Reset by reading the status register. Mask */ #define UART_RECEIVE_STATUS_FIFO_OVERRUN UART_RECEIVE_STATUS_FIFO_OVERRUN_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_FIFO_OVERRUN_Msk instead */ #define UART_RECEIVE_STATUS_FRAMING_ERROR_Pos 7 /**< (UART_RECEIVE_STATUS) Active High indication when no stop bit is detected. Reset by reading the status register. Position */ #define UART_RECEIVE_STATUS_FRAMING_ERROR_Msk (_U_(0x1) << UART_RECEIVE_STATUS_FRAMING_ERROR_Pos) /**< (UART_RECEIVE_STATUS) Active High indication when no stop bit is detected. Reset by reading the status register. Mask */ #define UART_RECEIVE_STATUS_FRAMING_ERROR UART_RECEIVE_STATUS_FRAMING_ERROR_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RECEIVE_STATUS_FRAMING_ERROR_Msk instead */ #define UART_RECEIVE_STATUS_MASK _U_(0xFF) /**< \deprecated (UART_RECEIVE_STATUS) Register MASK (Use UART_RECEIVE_STATUS_Msk instead) */ #define UART_RECEIVE_STATUS_Msk _U_(0xFF) /**< (UART_RECEIVE_STATUS) Register Mask */ /* -------- UART_RX_INTERRUPT_MASK : (UART Offset: 0x18) (R/W 8) Enable or Disable the generation of interrupts by the rx_status register. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t RX_FIFO_NOT_EMPTY_MASK:1; /**< bit: 0 Active High Enable of rx_fifo_not_empty interrupt */ uint8_t RX_FIFO_0P25_FULL_MASK:1; /**< bit: 1 Active High Enable of rx_fifo_0p25_full interrupt */ uint8_t RX_FIFO_0P5_FULL_MASK:1; /**< bit: 2 Active High Enable of rx_fifo_0p5_full interrupt */ uint8_t RX_FIFO_0P75_FULL_MASK:1; /**< bit: 3 Active High Enable of rx_fifo_0p75_full interrupt */ uint8_t TIMEOUT_MASK:1; /**< bit: 4 Active High Enable of timeout interrupt */ uint8_t PARITY_ERROR_MASK:1; /**< bit: 5 Active High Enable of parity error interrupt */ uint8_t FIFO_OVERRUN_MASK:1; /**< bit: 6 Active High Enable of FIFO overrun interrupt */ uint8_t FRAMING_ERROR_MASK:1; /**< bit: 7 Active High Enable of framing error interrupt */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_RX_INTERRUPT_MASK_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_RX_INTERRUPT_MASK_OFFSET (0x18) /**< (UART_RX_INTERRUPT_MASK) Enable or Disable the generation of interrupts by the rx_status register. Offset */ #define UART_RX_INTERRUPT_MASK_RESETVALUE _U_(0x00) /**< (UART_RX_INTERRUPT_MASK) Enable or Disable the generation of interrupts by the rx_status register. Reset Value */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_NOT_EMPTY_MASK_Pos 0 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_not_empty interrupt Position */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_NOT_EMPTY_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_RX_FIFO_NOT_EMPTY_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_not_empty interrupt Mask */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_NOT_EMPTY_MASK UART_RX_INTERRUPT_MASK_RX_FIFO_NOT_EMPTY_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_RX_FIFO_NOT_EMPTY_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P25_FULL_MASK_Pos 1 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_0p25_full interrupt Position */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P25_FULL_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_RX_FIFO_0P25_FULL_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_0p25_full interrupt Mask */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P25_FULL_MASK UART_RX_INTERRUPT_MASK_RX_FIFO_0P25_FULL_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_RX_FIFO_0P25_FULL_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P5_FULL_MASK_Pos 2 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_0p5_full interrupt Position */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P5_FULL_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_RX_FIFO_0P5_FULL_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_0p5_full interrupt Mask */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P5_FULL_MASK UART_RX_INTERRUPT_MASK_RX_FIFO_0P5_FULL_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_RX_FIFO_0P5_FULL_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P75_FULL_MASK_Pos 3 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_0p75_full interrupt Position */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P75_FULL_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_RX_FIFO_0P75_FULL_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of rx_fifo_0p75_full interrupt Mask */ #define UART_RX_INTERRUPT_MASK_RX_FIFO_0P75_FULL_MASK UART_RX_INTERRUPT_MASK_RX_FIFO_0P75_FULL_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_RX_FIFO_0P75_FULL_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_TIMEOUT_MASK_Pos 4 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of timeout interrupt Position */ #define UART_RX_INTERRUPT_MASK_TIMEOUT_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_TIMEOUT_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of timeout interrupt Mask */ #define UART_RX_INTERRUPT_MASK_TIMEOUT_MASK UART_RX_INTERRUPT_MASK_TIMEOUT_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_TIMEOUT_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_PARITY_ERROR_MASK_Pos 5 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of parity error interrupt Position */ #define UART_RX_INTERRUPT_MASK_PARITY_ERROR_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_PARITY_ERROR_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of parity error interrupt Mask */ #define UART_RX_INTERRUPT_MASK_PARITY_ERROR_MASK UART_RX_INTERRUPT_MASK_PARITY_ERROR_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_PARITY_ERROR_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_FIFO_OVERRUN_MASK_Pos 6 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of FIFO overrun interrupt Position */ #define UART_RX_INTERRUPT_MASK_FIFO_OVERRUN_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_FIFO_OVERRUN_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of FIFO overrun interrupt Mask */ #define UART_RX_INTERRUPT_MASK_FIFO_OVERRUN_MASK UART_RX_INTERRUPT_MASK_FIFO_OVERRUN_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_FIFO_OVERRUN_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_FRAMING_ERROR_MASK_Pos 7 /**< (UART_RX_INTERRUPT_MASK) Active High Enable of framing error interrupt Position */ #define UART_RX_INTERRUPT_MASK_FRAMING_ERROR_MASK_Msk (_U_(0x1) << UART_RX_INTERRUPT_MASK_FRAMING_ERROR_MASK_Pos) /**< (UART_RX_INTERRUPT_MASK) Active High Enable of framing error interrupt Mask */ #define UART_RX_INTERRUPT_MASK_FRAMING_ERROR_MASK UART_RX_INTERRUPT_MASK_FRAMING_ERROR_MASK_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_RX_INTERRUPT_MASK_FRAMING_ERROR_MASK_Msk instead */ #define UART_RX_INTERRUPT_MASK_Msk _U_(0xFF) /**< (UART_RX_INTERRUPT_MASK) Register Mask */ /* -------- UART_RECEIVE_TIMEOUT : (UART Offset: 0x1c) (R/W 8) Timeout counter configuration. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t TIMEOUT_VALUE:8; /**< bit: 0..7 Timeout counter reload value, after status register is read or character received. Counter decrements at baud rate clock. */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_RECEIVE_TIMEOUT_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_RECEIVE_TIMEOUT_OFFSET (0x1C) /**< (UART_RECEIVE_TIMEOUT) Timeout counter configuration. Offset */ #define UART_RECEIVE_TIMEOUT_RESETVALUE _U_(0x00) /**< (UART_RECEIVE_TIMEOUT) Timeout counter configuration. Reset Value */ #define UART_RECEIVE_TIMEOUT_TIMEOUT_VALUE_Pos 0 /**< (UART_RECEIVE_TIMEOUT) Timeout counter reload value, after status register is read or character received. Counter decrements at baud rate clock. Position */ #define UART_RECEIVE_TIMEOUT_TIMEOUT_VALUE_Msk (_U_(0xFF) << UART_RECEIVE_TIMEOUT_TIMEOUT_VALUE_Pos) /**< (UART_RECEIVE_TIMEOUT) Timeout counter reload value, after status register is read or character received. Counter decrements at baud rate clock. Mask */ #define UART_RECEIVE_TIMEOUT_TIMEOUT_VALUE(value) (UART_RECEIVE_TIMEOUT_TIMEOUT_VALUE_Msk & ((value) << UART_RECEIVE_TIMEOUT_TIMEOUT_VALUE_Pos)) #define UART_RECEIVE_TIMEOUT_MASK _U_(0xFF) /**< \deprecated (UART_RECEIVE_TIMEOUT) Register MASK (Use UART_RECEIVE_TIMEOUT_Msk instead) */ #define UART_RECEIVE_TIMEOUT_Msk _U_(0xFF) /**< (UART_RECEIVE_TIMEOUT) Register Mask */ /* -------- UART_CONFIGURATION : (UART Offset: 0x20) (R/W 8) UART Operation Configuration Register, for both Rx and Tx. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t NUMBER_OF_BITS:1; /**< bit: 0 Number of bits per character, not including parity */ uint8_t PARITY_ENABLE:1; /**< bit: 1 Active High parity checking and generation enable */ uint8_t PARITY_MODE:2; /**< bit: 2..3 Parity Mode Select */ uint8_t STOP_BITS:1; /**< bit: 4 Number of stop bits */ uint8_t CTS_ENABLE:1; /**< bit: 5 Active High Flow Control Enable. When enabled, transmission starts when cts signal is asserted */ uint8_t :2; /**< bit: 6..7 Reserved */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_CONFIGURATION_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_CONFIGURATION_OFFSET (0x20) /**< (UART_CONFIGURATION) UART Operation Configuration Register, for both Rx and Tx. Offset */ #define UART_CONFIGURATION_RESETVALUE _U_(0x00) /**< (UART_CONFIGURATION) UART Operation Configuration Register, for both Rx and Tx. Reset Value */ #define UART_CONFIGURATION_NUMBER_OF_BITS_Pos 0 /**< (UART_CONFIGURATION) Number of bits per character, not including parity Position */ #define UART_CONFIGURATION_NUMBER_OF_BITS_Msk (_U_(0x1) << UART_CONFIGURATION_NUMBER_OF_BITS_Pos) /**< (UART_CONFIGURATION) Number of bits per character, not including parity Mask */ #define UART_CONFIGURATION_NUMBER_OF_BITS UART_CONFIGURATION_NUMBER_OF_BITS_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_CONFIGURATION_NUMBER_OF_BITS_Msk instead */ #define UART_CONFIGURATION_NUMBER_OF_BITS_0_Val _U_(0x0) /**< (UART_CONFIGURATION) 8 bits */ #define UART_CONFIGURATION_NUMBER_OF_BITS_1_Val _U_(0x1) /**< (UART_CONFIGURATION) 7 bits */ #define UART_CONFIGURATION_NUMBER_OF_BITS_0 (UART_CONFIGURATION_NUMBER_OF_BITS_0_Val << UART_CONFIGURATION_NUMBER_OF_BITS_Pos) /**< (UART_CONFIGURATION) 8 bits Position */ #define UART_CONFIGURATION_NUMBER_OF_BITS_1 (UART_CONFIGURATION_NUMBER_OF_BITS_1_Val << UART_CONFIGURATION_NUMBER_OF_BITS_Pos) /**< (UART_CONFIGURATION) 7 bits Position */ #define UART_CONFIGURATION_PARITY_ENABLE_Pos 1 /**< (UART_CONFIGURATION) Active High parity checking and generation enable Position */ #define UART_CONFIGURATION_PARITY_ENABLE_Msk (_U_(0x1) << UART_CONFIGURATION_PARITY_ENABLE_Pos) /**< (UART_CONFIGURATION) Active High parity checking and generation enable Mask */ #define UART_CONFIGURATION_PARITY_ENABLE UART_CONFIGURATION_PARITY_ENABLE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_CONFIGURATION_PARITY_ENABLE_Msk instead */ #define UART_CONFIGURATION_PARITY_ENABLE_0_Val _U_(0x0) /**< (UART_CONFIGURATION) Disable */ #define UART_CONFIGURATION_PARITY_ENABLE_1_Val _U_(0x1) /**< (UART_CONFIGURATION) Enable */ #define UART_CONFIGURATION_PARITY_ENABLE_0 (UART_CONFIGURATION_PARITY_ENABLE_0_Val << UART_CONFIGURATION_PARITY_ENABLE_Pos) /**< (UART_CONFIGURATION) Disable Position */ #define UART_CONFIGURATION_PARITY_ENABLE_1 (UART_CONFIGURATION_PARITY_ENABLE_1_Val << UART_CONFIGURATION_PARITY_ENABLE_Pos) /**< (UART_CONFIGURATION) Enable Position */ #define UART_CONFIGURATION_PARITY_MODE_Pos 2 /**< (UART_CONFIGURATION) Parity Mode Select Position */ #define UART_CONFIGURATION_PARITY_MODE_Msk (_U_(0x3) << UART_CONFIGURATION_PARITY_MODE_Pos) /**< (UART_CONFIGURATION) Parity Mode Select Mask */ #define UART_CONFIGURATION_PARITY_MODE(value) (UART_CONFIGURATION_PARITY_MODE_Msk & ((value) << UART_CONFIGURATION_PARITY_MODE_Pos)) #define UART_CONFIGURATION_PARITY_MODE_0_Val _U_(0x0) /**< (UART_CONFIGURATION) Even Parity */ #define UART_CONFIGURATION_PARITY_MODE_1_Val _U_(0x1) /**< (UART_CONFIGURATION) Odd Parity */ #define UART_CONFIGURATION_PARITY_MODE_2_Val _U_(0x2) /**< (UART_CONFIGURATION) Parity bit is space */ #define UART_CONFIGURATION_PARITY_MODE_3_Val _U_(0x3) /**< (UART_CONFIGURATION) Parity bit is mark */ #define UART_CONFIGURATION_PARITY_MODE_0 (UART_CONFIGURATION_PARITY_MODE_0_Val << UART_CONFIGURATION_PARITY_MODE_Pos) /**< (UART_CONFIGURATION) Even Parity Position */ #define UART_CONFIGURATION_PARITY_MODE_1 (UART_CONFIGURATION_PARITY_MODE_1_Val << UART_CONFIGURATION_PARITY_MODE_Pos) /**< (UART_CONFIGURATION) Odd Parity Position */ #define UART_CONFIGURATION_PARITY_MODE_2 (UART_CONFIGURATION_PARITY_MODE_2_Val << UART_CONFIGURATION_PARITY_MODE_Pos) /**< (UART_CONFIGURATION) Parity bit is space Position */ #define UART_CONFIGURATION_PARITY_MODE_3 (UART_CONFIGURATION_PARITY_MODE_3_Val << UART_CONFIGURATION_PARITY_MODE_Pos) /**< (UART_CONFIGURATION) Parity bit is mark Position */ #define UART_CONFIGURATION_STOP_BITS_Pos 4 /**< (UART_CONFIGURATION) Number of stop bits Position */ #define UART_CONFIGURATION_STOP_BITS_Msk (_U_(0x1) << UART_CONFIGURATION_STOP_BITS_Pos) /**< (UART_CONFIGURATION) Number of stop bits Mask */ #define UART_CONFIGURATION_STOP_BITS UART_CONFIGURATION_STOP_BITS_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_CONFIGURATION_STOP_BITS_Msk instead */ #define UART_CONFIGURATION_STOP_BITS_0_Val _U_(0x0) /**< (UART_CONFIGURATION) One Bit */ #define UART_CONFIGURATION_STOP_BITS_1_Val _U_(0x1) /**< (UART_CONFIGURATION) Two Bits */ #define UART_CONFIGURATION_STOP_BITS_0 (UART_CONFIGURATION_STOP_BITS_0_Val << UART_CONFIGURATION_STOP_BITS_Pos) /**< (UART_CONFIGURATION) One Bit Position */ #define UART_CONFIGURATION_STOP_BITS_1 (UART_CONFIGURATION_STOP_BITS_1_Val << UART_CONFIGURATION_STOP_BITS_Pos) /**< (UART_CONFIGURATION) Two Bits Position */ #define UART_CONFIGURATION_CTS_ENABLE_Pos 5 /**< (UART_CONFIGURATION) Active High Flow Control Enable. When enabled, transmission starts when cts signal is asserted Position */ #define UART_CONFIGURATION_CTS_ENABLE_Msk (_U_(0x1) << UART_CONFIGURATION_CTS_ENABLE_Pos) /**< (UART_CONFIGURATION) Active High Flow Control Enable. When enabled, transmission starts when cts signal is asserted Mask */ #define UART_CONFIGURATION_CTS_ENABLE UART_CONFIGURATION_CTS_ENABLE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use UART_CONFIGURATION_CTS_ENABLE_Msk instead */ #define UART_CONFIGURATION_CTS_ENABLE_0_Val _U_(0x0) /**< (UART_CONFIGURATION) Disable-Transmission starts only when cts signal is asserted */ #define UART_CONFIGURATION_CTS_ENABLE_1_Val _U_(0x1) /**< (UART_CONFIGURATION) Enable-Transmission starts regardless of cts signal */ #define UART_CONFIGURATION_CTS_ENABLE_0 (UART_CONFIGURATION_CTS_ENABLE_0_Val << UART_CONFIGURATION_CTS_ENABLE_Pos) /**< (UART_CONFIGURATION) Disable-Transmission starts only when cts signal is asserted Position */ #define UART_CONFIGURATION_CTS_ENABLE_1 (UART_CONFIGURATION_CTS_ENABLE_1_Val << UART_CONFIGURATION_CTS_ENABLE_Pos) /**< (UART_CONFIGURATION) Enable-Transmission starts regardless of cts signal Position */ #define UART_CONFIGURATION_MASK _U_(0x3F) /**< \deprecated (UART_CONFIGURATION) Register MASK (Use UART_CONFIGURATION_Msk instead) */ #define UART_CONFIGURATION_Msk _U_(0x3F) /**< (UART_CONFIGURATION) Register Mask */ /* -------- UART_BAUD_RATE : (UART Offset: 0x24) (R/W 16) Baud Rate Control Register. Bits 15:3 specify the integral division of the clock (divide by n), and bit 2:0 specify the fractional division. -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint16_t FRACTIONAL_DIVISION:3; /**< bit: 0..2 Fractional Division Part. If non-zero, the integer part must be at least set to 3. */ uint16_t INTEGER_DIVISION:13; /**< bit: 3..15 Integral Division Part. Must be at least set to 2. */ } bit; /**< Structure used for bit access */ uint16_t reg; /**< Type used for register access */ } UART_BAUD_RATE_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_BAUD_RATE_OFFSET (0x24) /**< (UART_BAUD_RATE) Baud Rate Control Register. Bits 15:3 specify the integral division of the clock (divide by n), and bit 2:0 specify the fractional division. Offset */ #define UART_BAUD_RATE_RESETVALUE _U_(0x00) /**< (UART_BAUD_RATE) Baud Rate Control Register. Bits 15:3 specify the integral division of the clock (divide by n), and bit 2:0 specify the fractional division. Reset Value */ #define UART_BAUD_RATE_FRACTIONAL_DIVISION_Pos 0 /**< (UART_BAUD_RATE) Fractional Division Part. If non-zero, the integer part must be at least set to 3. Position */ #define UART_BAUD_RATE_FRACTIONAL_DIVISION_Msk (_U_(0x7) << UART_BAUD_RATE_FRACTIONAL_DIVISION_Pos) /**< (UART_BAUD_RATE) Fractional Division Part. If non-zero, the integer part must be at least set to 3. Mask */ #define UART_BAUD_RATE_FRACTIONAL_DIVISION(value) (UART_BAUD_RATE_FRACTIONAL_DIVISION_Msk & ((value) << UART_BAUD_RATE_FRACTIONAL_DIVISION_Pos)) #define UART_BAUD_RATE_INTEGER_DIVISION_Pos 3 /**< (UART_BAUD_RATE) Integral Division Part. Must be at least set to 2. Position */ #define UART_BAUD_RATE_INTEGER_DIVISION_Msk (_U_(0x1FFF) << UART_BAUD_RATE_INTEGER_DIVISION_Pos) /**< (UART_BAUD_RATE) Integral Division Part. Must be at least set to 2. Mask */ #define UART_BAUD_RATE_INTEGER_DIVISION(value) (UART_BAUD_RATE_INTEGER_DIVISION_Msk & ((value) << UART_BAUD_RATE_INTEGER_DIVISION_Pos)) #define UART_BAUD_RATE_MASK _U_(0xFFFF) /**< \deprecated (UART_BAUD_RATE) Register MASK (Use UART_BAUD_RATE_Msk instead) */ #define UART_BAUD_RATE_Msk _U_(0xFFFF) /**< (UART_BAUD_RATE) Register Mask */ /* -------- UART_CLOCK_SOURCE : (UART Offset: 0x28) (R/W 8) Selects Source of UART Clock -------- */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t CLOCK_SELECT:2; /**< bit: 0..1 Selects one of the four possible clock sources. */ uint8_t :6; /**< bit: 2..7 Reserved */ } bit; /**< Structure used for bit access */ uint8_t reg; /**< Type used for register access */ } UART_CLOCK_SOURCE_Type; #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ #define UART_CLOCK_SOURCE_OFFSET (0x28) /**< (UART_CLOCK_SOURCE) Selects Source of UART Clock Offset */ #define UART_CLOCK_SOURCE_RESETVALUE _U_(0x00) /**< (UART_CLOCK_SOURCE) Selects Source of UART Clock Reset Value */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_Pos 0 /**< (UART_CLOCK_SOURCE) Selects one of the four possible clock sources. Position */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_Msk (_U_(0x3) << UART_CLOCK_SOURCE_CLOCK_SELECT_Pos) /**< (UART_CLOCK_SOURCE) Selects one of the four possible clock sources. Mask */ #define UART_CLOCK_SOURCE_CLOCK_SELECT(value) (UART_CLOCK_SOURCE_CLOCK_SELECT_Msk & ((value) << UART_CLOCK_SOURCE_CLOCK_SELECT_Pos)) #define UART_CLOCK_SOURCE_CLOCK_SELECT_0_Val _U_(0x0) /**< (UART_CLOCK_SOURCE) Clock input 0 */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_1_Val _U_(0x1) /**< (UART_CLOCK_SOURCE) Clock input 1 */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_2_Val _U_(0x2) /**< (UART_CLOCK_SOURCE) Clock input 2 */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_3_Val _U_(0x3) /**< (UART_CLOCK_SOURCE) Clock input 3 */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_0 (UART_CLOCK_SOURCE_CLOCK_SELECT_0_Val << UART_CLOCK_SOURCE_CLOCK_SELECT_Pos) /**< (UART_CLOCK_SOURCE) Clock input 0 Position */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_1 (UART_CLOCK_SOURCE_CLOCK_SELECT_1_Val << UART_CLOCK_SOURCE_CLOCK_SELECT_Pos) /**< (UART_CLOCK_SOURCE) Clock input 1 Position */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_2 (UART_CLOCK_SOURCE_CLOCK_SELECT_2_Val << UART_CLOCK_SOURCE_CLOCK_SELECT_Pos) /**< (UART_CLOCK_SOURCE) Clock input 2 Position */ #define UART_CLOCK_SOURCE_CLOCK_SELECT_3 (UART_CLOCK_SOURCE_CLOCK_SELECT_3_Val << UART_CLOCK_SOURCE_CLOCK_SELECT_Pos) /**< (UART_CLOCK_SOURCE) Clock input 3 Position */ #define UART_CLOCK_SOURCE_MASK _U_(0x03) /**< \deprecated (UART_CLOCK_SOURCE) Register MASK (Use UART_CLOCK_SOURCE_Msk instead) */ #define UART_CLOCK_SOURCE_Msk _U_(0x03) /**< (UART_CLOCK_SOURCE) Register Mask */ #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) #if COMPONENT_TYPEDEF_STYLE == 'R' /** \brief UART hardware registers */ typedef struct { /* UART Controller */ WoReg8 TRANSMIT_DATA; /**< (UART Offset: 0x00) Writes one byte to UART Transmit Data FIFO. */ RoReg8 Reserved1[0x3]; RoReg8 TRANSMIT_STATUS; /**< (UART Offset: 0x04) Status of the UART transmitter. Each field can generate an interrupt if corresponding bit in the Tx interrupt mask register is set. */ RoReg8 Reserved2[0x3]; RwReg8 TX_INTERRUPT_MASK; /**< (UART Offset: 0x08) Enable or Disable the generation of interrupts by the tx_status register. */ RoReg8 Reserved3[0x7]; RoReg8 RECEIVE_DATA; /**< (UART Offset: 0x10) Read one byte from UART Receive Data FIFO. */ RoReg8 Reserved4[0x3]; RoReg8 RECEIVE_STATUS; /**< (UART Offset: 0x14) Status of the UART receiver. Each field can generate an interrupt if corresponding bit in the Rx interrupt mask register is set. */ RoReg8 Reserved5[0x3]; RwReg8 RX_INTERRUPT_MASK; /**< (UART Offset: 0x18) Enable or Disable the generation of interrupts by the rx_status register. */ RoReg8 Reserved6[0x3]; RwReg8 RECEIVE_TIMEOUT; /**< (UART Offset: 0x1C) Timeout counter configuration. */ RoReg8 Reserved7[0x3]; RwReg8 UART_CONFIGURATION; /**< (UART Offset: 0x20) UART Operation Configuration Register, for both Rx and Tx. */ RoReg8 Reserved8[0x3]; RwReg16 UART_BAUD_RATE; /**< (UART Offset: 0x24) Baud Rate Control Register. Bits 15:3 specify the integral division of the clock (divide by n), and bit 2:0 specify the fractional division. */ RoReg8 Reserved9[0x2]; RwReg8 UART_CLOCK_SOURCE; /**< (UART Offset: 0x28) Selects Source of UART Clock */ } Uart; #elif COMPONENT_TYPEDEF_STYLE == 'N' /** \brief UART hardware registers */ typedef struct { /* UART Controller */ __O UART_TRANSMIT_DATA_Type TRANSMIT_DATA; /**< Offset: 0x00 ( /W 8) Writes one byte to UART Transmit Data FIFO. */ __I uint8_t Reserved1[3]; __I UART_TRANSMIT_STATUS_Type TRANSMIT_STATUS; /**< Offset: 0x04 (R/ 8) Status of the UART transmitter. Each field can generate an interrupt if corresponding bit in the Tx interrupt mask register is set. */ __I uint8_t Reserved2[3]; __IO UART_TX_INTERRUPT_MASK_Type TX_INTERRUPT_MASK; /**< Offset: 0x08 (R/W 8) Enable or Disable the generation of interrupts by the tx_status register. */ __I uint8_t Reserved3[7]; __I UART_RECEIVE_DATA_Type RECEIVE_DATA; /**< Offset: 0x10 (R/ 8) Read one byte from UART Receive Data FIFO. */ __I uint8_t Reserved4[3]; __I UART_RECEIVE_STATUS_Type RECEIVE_STATUS; /**< Offset: 0x14 (R/ 8) Status of the UART receiver. Each field can generate an interrupt if corresponding bit in the Rx interrupt mask register is set. */ __I uint8_t Reserved5[3]; __IO UART_RX_INTERRUPT_MASK_Type RX_INTERRUPT_MASK; /**< Offset: 0x18 (R/W 8) Enable or Disable the generation of interrupts by the rx_status register. */ __I uint8_t Reserved6[3]; __IO UART_RECEIVE_TIMEOUT_Type RECEIVE_TIMEOUT; /**< Offset: 0x1C (R/W 8) Timeout counter configuration. */ __I uint8_t Reserved7[3]; __IO UART_CONFIGURATION_Type UART_CONFIGURATION; /**< Offset: 0x20 (R/W 8) UART Operation Configuration Register, for both Rx and Tx. */ __I uint8_t Reserved8[3]; __IO UART_BAUD_RATE_Type UART_BAUD_RATE; /**< Offset: 0x24 (R/W 16) Baud Rate Control Register. Bits 15:3 specify the integral division of the clock (divide by n), and bit 2:0 specify the fractional division. */ __I uint8_t Reserved9[2]; __IO UART_CLOCK_SOURCE_Type UART_CLOCK_SOURCE; /**< Offset: 0x28 (R/W 8) Selects Source of UART Clock */ } Uart; #else /* COMPONENT_TYPEDEF_STYLE */ #error Unknown component typedef style #endif /* COMPONENT_TYPEDEF_STYLE */ #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */ /** @} end of UART Controller */ #endif /* _SAMB11_UART_COMPONENT_H_ */
117.357616
300
0.690311
c4c219294924f9a554ac0fc05a333e42545afd9a
442
h
C
tools/win32/hsed3f/config.h
sharkpp/openhsp
0d412fd8f79a6ccae1d33c13addc06fb623fb1fe
[ "BSD-3-Clause" ]
null
null
null
tools/win32/hsed3f/config.h
sharkpp/openhsp
0d412fd8f79a6ccae1d33c13addc06fb623fb1fe
[ "BSD-3-Clause" ]
null
null
null
tools/win32/hsed3f/config.h
sharkpp/openhsp
0d412fd8f79a6ccae1d33c13addc06fb623fb1fe
[ "BSD-3-Clause" ]
null
null
null
/*------------------------------------------------------------------------------ Header of editor configration routines ------------------------------------------------------------------------------*/ #ifndef __config_h #define __config_h #include <windows.h> #include "classify.h" void LoadConfig(); void SaveConfig(); void DefaultColor(MYCOLOR *); void DefaultFont(LOGFONT *, LOGFONT *); #endif // #ifndef __tabmanager_h
27.625
81
0.457014
4fa773f6eb1f0774e1fc3bc229ad659b3c1f0d05
253
h
C
hihope_neptune-oh_hid/00_src/v0.1/device/winnermicro/neptune/sdk_liteos/include/net/wm_socket.h
dawmlight/vendor_oh_fun
bc9fb50920f06cd4c27399f60076f5793043c77d
[ "Apache-2.0" ]
1
2022-02-15T08:51:55.000Z
2022-02-15T08:51:55.000Z
hihope_neptune-oh_hid/00_src/v0.3/device/winnermicro/neptune/sdk_liteos/include/net/wm_socket.h
dawmlight/vendor_oh_fun
bc9fb50920f06cd4c27399f60076f5793043c77d
[ "Apache-2.0" ]
null
null
null
hihope_neptune-oh_hid/00_src/v0.3/device/winnermicro/neptune/sdk_liteos/include/net/wm_socket.h
dawmlight/vendor_oh_fun
bc9fb50920f06cd4c27399f60076f5793043c77d
[ "Apache-2.0" ]
null
null
null
/** * @file wm_socket.h * * @brief socket Module * * @author dave * * Copyright (c) 2014 Winner Microelectronics Co., Ltd. */ #ifndef WM_SOCKET_H #define WM_SOCKET_H #include "wm_config.h" #include "wm_socket2.0.3.h" #endif
14.055556
55
0.624506
8b082b315d3d7c1168b651f31e1cb9fb4a2f6a97
52,545
h
C
src/frameworks/av/media/libaudioprocessing/audio-resampler/filter_coefficients.h
dAck2cC2/m3e
475b89b59d5022a94e00b636438b25e27e4eaab2
[ "Apache-2.0" ]
null
null
null
src/frameworks/av/media/libaudioprocessing/audio-resampler/filter_coefficients.h
dAck2cC2/m3e
475b89b59d5022a94e00b636438b25e27e4eaab2
[ "Apache-2.0" ]
null
null
null
src/frameworks/av/media/libaudioprocessing/audio-resampler/filter_coefficients.h
dAck2cC2/m3e
475b89b59d5022a94e00b636438b25e27e4eaab2
[ "Apache-2.0" ]
2
2021-07-08T07:42:11.000Z
2021-07-09T21:56:10.000Z
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdlib.h> namespace android { // cmd-line: fir -l 7 -s 48000 -c 23400 -n 16 -b 9.62 const uint32_t up_sampler_filter_coefficients[] __attribute__ ((aligned (32))) = { 0x7ccccccd, 0x0323eb7f, 0xfd086246, 0x02b2aa5c, 0xfda45e2c, 0x01fa5183, 0xfe694e12, 0x0137e672, 0xff1c87d3, 0x009ce6d8, 0xff9a68b0, 0x003d150d, 0xffde727a, 0x00106595, 0xfff93679, 0x00021fc5, 0x7cc9b757, 0x022ac835, 0xfd7e3a71, 0x026b7da1, 0xfdd2b905, 0x01db7c90, 0xfe7db77c, 0x012aa7bf, 0xff24dc32, 0x0097dfc9, 0xff9d4ae9, 0x003b8742, 0xffdf38e5, 0x00100be5, 0xfff959f5, 0x0002144b, 0x7cc0773c, 0x01354bc1, 0xfdf365e8, 0x0224726d, 0xfe011d2e, 0x01bc908b, 0xfe923a2b, 0x011d528d, 0xff2d426f, 0x0092cbc0, 0xffa035cc, 0x0039f42e, 0xffe00236, 0x000fb0d2, 0xfff97dfa, 0x000208b0, 0x7cb10d52, 0x0043843f, 0xfe67d5a8, 0x01dd92df, 0xfe2f83c1, 0x019d9230, 0xfea6d2e5, 0x010fe901, 0xff35b924, 0x008dab9d, 0xffa328d4, 0x00385c1d, 0xffe0ce46, 0x000f5471, 0xfff9a27f, 0x0001fcf5, 0x7c9b7afd, 0xff557f58, 0xfedb7ae9, 0x0196e8fe, 0xfe5de5e3, 0x017e8635, 0xfebb7e75, 0x01026d40, 0xff3e3eed, 0x0088803e, 0xffa6237a, 0x0036bf58, 0xffe19cec, 0x000ef6d4, 0xfff9c77d, 0x0001f11e, 0x7c7fc22f, 0xfe6b4a44, 0xff4e471d, 0x01507eb8, 0xfe8c3cc3, 0x015f714d, 0xfed039a8, 0x00f4e16f, 0xff46d266, 0x00834a83, 0xffa9253b, 0x00351e2d, 0xffe26e01, 0x000e980f, 0xfff9eceb, 0x0001e52e, 0x7c5de56a, 0xfd84f1c8, 0xffc02bf2, 0x010a5de2, 0xfeba819d, 0x01405821, 0xfee5014c, 0x00e747b0, 0xff4f722b, 0x007e0b4b, 0xffac2d8f, 0x003378e7, 0xffe3415d, 0x000e3834, 0xfffa12c0, 0x0001d927, 0x7c35e7bb, 0xfca28234, 0x00311b54, 0x00c49034, 0xfee8adba, 0x01213f58, 0xfef9d232, 0x00d9a226, 0xff581cd8, 0x0078c375, 0xffaf3bf2, 0x0031cfd1, 0xffe416d8, 0x000dd758, 0xfffa38f5, 0x0001cd0d, 0x7c07ccbe, 0xfbc40766, 0x00a1076e, 0x007f1f4b, 0xff16ba71, 0x01022b90, 0xff0ea931, 0x00cbf2f0, 0xff60d10b, 0x007373de, 0xffb24fde, 0x00302337, 0xffe4ee4b, 0x000d758d, 0xfffa5f81, 0x0001c0e1, 0x7bd3989d, 0xfae98cc5, 0x010fe2ab, 0x003a14a6, 0xff44a128, 0x00e3215e, 0xff238322, 0x00be3c2d, 0xff698d62, 0x006e1d66, 0xffb568ce, 0x002e7363, 0xffe5c78d, 0x000d12e6, 0xfffa865d, 0x0001b4a8, 0x7b99500c, 0xfa131d41, 0x017d9fb8, 0xfff579a3, 0xff725b54, 0x00c42551, 0xff385ce3, 0x00b07ff8, 0xff72507e, 0x0068c0e9, 0xffb8863e, 0x002cc0a2, 0xffe6a277, 0x000caf76, 0xfffaad81, 0x0001a863, 0x7b58f84d, 0xf940c355, 0x01ea3184, 0xffb15783, 0xff9fe27d, 0x00a53bed, 0xff4d3358, 0x00a2c06b, 0xff7b18fe, 0x00635f45, 0xffbba7aa, 0x002b0b3d, 0xffe77ee2, 0x000c4b50, 0xfffad4e4, 0x00019c15, 0x7b12972d, 0xf8728902, 0x02558b43, 0xff6db764, 0xffcd303b, 0x008669ae, 0xff620368, 0x0094ff9b, 0xff83e586, 0x005df954, 0xffbecc8d, 0x00295380, 0xffe85ca7, 0x000be687, 0xfffafc7f, 0x00018fc1, 0x7ac63304, 0xf7a877d4, 0x02bfa06d, 0xff2aa243, 0xfffa3e37, 0x0067b303, 0xff76ca02, 0x00873f9b, 0xff8cb4bb, 0x00588ff1, 0xffc1f465, 0x002799b3, 0xffe93b9e, 0x000b812d, 0xfffb244a, 0x0001836a, 0x7a73d2b5, 0xf6e298db, 0x032864c1, 0xfee820f8, 0x00270631, 0x00491c54, 0xff8b841a, 0x0079827a, 0xff958542, 0x005323f7, 0xffc51eaf, 0x0025de22, 0xffea1ba2, 0x000b1b55, 0xfffb4c3e, 0x00017712, 0x7a1b7daa, 0xf620f4b2, 0x038fcc44, 0xfea63c38, 0x005381fa, 0x002aa9fa, 0xffa02eac, 0x006bca44, 0xff9e55c6, 0x004db63c, 0xffc84ae9, 0x00242115, 0xffeafc8b, 0x000ab510, 0xfffb7452, 0x00016abb, 0x79bd3bd8, 0xf5639376, 0x03f5cb46, 0xfe64fc93, 0x007fab77, 0x000c6043, 0xffb4c6b9, 0x005e1900, 0xffa724f0, 0x00484799, 0xffcb7893, 0x002262d6, 0xffebde33, 0x000a4e72, 0xfffb9c80, 0x00015e68, 0x795915bc, 0xf4aa7cce, 0x045a565c, 0xfe246a72, 0x00ab7ca6, 0xffee4372, 0xffc9494b, 0x005070b0, 0xffaff16f, 0x0042d8e1, 0xffcea72c, 0x0020a3ad, 0xffecc075, 0x0009e78c, 0xfffbc4bf, 0x0001521b, 0x78ef1457, 0xf3f5b7e4, 0x04bd6269, 0xfde48e17, 0x00d6ef99, 0xffd057bb, 0xffddb374, 0x0042d353, 0xffb8b9f3, 0x003d6aea, 0xffd1d635, 0x001ee3e1, 0xffeda32a, 0x00098070, 0xfffbed0a, 0x000145d7, 0x787f4134, 0xf3454b6a, 0x051ee498, 0xfda56f9c, 0x0101fe7a, 0xffb2a145, 0xfff2024e, 0x003542e2, 0xffc17d30, 0x0037fe85, 0xffd50530, 0x001d23b9, 0xffee862e, 0x0009192f, 0xfffc1558, 0x0001399e, 0x7809a65e, 0xf2993d95, 0x057ed264, 0xfd6716f2, 0x012ca389, 0xff952429, 0x000632fa, 0x0027c151, 0xffca39dd, 0x00329483, 0xffd833a0, 0x001b637e, 0xffef695c, 0x0008b1db, 0xfffc3da2, 0x00012d72, 0x778e4e68, 0xf1f19421, 0x05dd218f, 0xfd298be0, 0x0156d920, 0xff77e470, 0x001a42a4, 0x001a508e, 0xffd2eeb3, 0x002d2db0, 0xffdb6109, 0x0019a373, 0xfff04c8f, 0x00084a86, 0xfffc65e2, 0x00012155, 0x770d4466, 0xf14e544f, 0x0639c82d, 0xfcecd602, 0x018099b2, 0xff5ae614, 0x002e2e82, 0x000cf281, 0xffdb9a70, 0x0027cada, 0xffde8cf1, 0x0017e3df, 0xfff12fa3, 0x0007e33f, 0xfffc8e11, 0x0001154a, 0x768693ec, 0xf0af82e4, 0x0694bca0, 0xfcb0fcca, 0x01a9dfcc, 0xff3e2d01, 0x0041f3d2, 0xffffa90e, 0xffe43bd5, 0x00226ccb, 0xffe1b6dd, 0x00162507, 0xfff21275, 0x00077c17, 0xfffcb628, 0x00010952, 0x75fa4911, 0xf015242b, 0x06edf595, 0xfc76077b, 0x01d2a615, 0xff21bd11, 0x00558fdc, 0xfff27611, 0xffecd1a6, 0x001d144a, 0xffe4de56, 0x0014672d, 0xfff2f4e0, 0x00071520, 0xfffcde20, 0x0000fd6f, 0x75687068, 0xef7f3bf5, 0x07456a0e, 0xfc3bfd2e, 0x01fae74e, 0xff059a0e, 0x0068fff3, 0xffe55b60, 0xfff55aae, 0x0017c21c, 0xffe802e6, 0x0012aa95, 0xfff3d6c3, 0x0006ae6a, 0xfffd05f3, 0x0000f1a4, 0x74d11703, 0xeeedcd98, 0x079b1158, 0xfc02e4cc, 0x02229e57, 0xfee9c7af, 0x007c4177, 0xffd85ac9, 0xfffdd5b8, 0x00127704, 0xffeb2416, 0x0010ef82, 0xfff4b7fb, 0x00064804, 0xfffd2d9b, 0x0000e5f3, 0x74344a70, 0xee60dbee, 0x07eee314, 0xfbcac510, 0x0249c629, 0xfece499d, 0x008f51cf, 0xffcb7615, 0x00064197, 0x000d33c3, 0xffee4174, 0x000f3633, 0xfff59866, 0x0005e1fe, 0xfffd5511, 0x0000da5c, 0x739218b8, 0xedd86958, 0x0840d732, 0xfb93a486, 0x027059da, 0xfeb3236b, 0x00a22e71, 0xffbeaf06, 0x000e9d1f, 0x0007f915, 0xfff15a8d, 0x000d7eea, 0xfff677e2, 0x00057c68, 0xfffd7c4f, 0x0000cee3, 0x72ea905a, 0xed5477be, 0x0890e5f7, 0xfb5d898c, 0x029654a0, 0xfe98589b, 0x00b4d4dd, 0xffb20754, 0x0016e72c, 0x0002c7b6, 0xfff46ef1, 0x000bc9e6, 0xfff75650, 0x00051750, 0xfffda350, 0x0000c388, 0x723dc051, 0xecd5088e, 0x08df07f6, 0xfb287a4d, 0x02bbb1cc, 0xfe7dec9c, 0x00c7429f, 0xffa580b1, 0x001f1e9b, 0xfffda05c, 0xfff77e31, 0x000a1765, 0xfff8338e, 0x0004b2c7, 0xfffdca0d, 0x0000b84d, 0x718bb80b, 0xec5a1cbc, 0x092b3617, 0xfaf47cc4, 0x02e06ccf, 0xfe63e2cc, 0x00d97550, 0xff991cc9, 0x00274253, 0xfff883be, 0xfffa87df, 0x000867a5, 0xfff90f7c, 0x00044eda, 0xfffdf080, 0x0000ad34, 0x70d4876b, 0xebe3b4c5, 0x09756994, 0xfac196bb, 0x03048139, 0xfe4a3e70, 0x00eb6a95, 0xff8cdd3c, 0x002f513a, 0xfff3728d, 0xfffd8b92, 0x0006bae1, 0xfff9e9fd, 0x0003eb98, 0xfffe16a6, 0x0000a23f, 0x70183ec5, 0xeb71d0ab, 0x09bd9bfb, 0xfa8fcdca, 0x0327eab8, 0xfe3102bd, 0x00fd2022, 0xff80c3a4, 0x00374a40, 0xffee6d78, 0x000088df, 0x00051157, 0xfffac2f0, 0x0003890e, 0xfffe3c76, 0x0000976e, 0x6f56eee1, 0xeb046ffc, 0x0a03c72b, 0xfa5f2755, 0x034aa51b, 0xfe1832d4, 0x010e93b5, 0xff74d194, 0x003f2c57, 0xffe97529, 0x00037f60, 0x00036b3f, 0xfffb9a38, 0x0003274c, 0xfffe61ee, 0x00008cc4, 0x6e90a8f2, 0xea9b91cc, 0x0a47e559, 0xfa2fa890, 0x036cac52, 0xfdffd1bd, 0x011fc31c, 0xff690894, 0x0046f679, 0xffe48a4a, 0x00066eae, 0x0001c8d2, 0xfffc6fb8, 0x0002c65d, 0xfffe8707, 0x00008241, 0x6dc57e9b, 0xea3734bb, 0x0a89f10c, 0xfa015679, 0x038dfc6c, 0xfde7e26f, 0x0130ac31, 0xff5d6a24, 0x004ea7a3, 0xffdfad7f, 0x00095666, 0x00002a4a, 0xfffd4352, 0x00026650, 0xfffeabbd, 0x000077e8, 0x6cf581e8, 0xe9d756f3, 0x0ac9e521, 0xf9d435dc, 0x03ae919a, 0xfdd067ca, 0x01414cdd, 0xff51f7bb, 0x00563edb, 0xffdadf69, 0x000c3627, 0xfffe8fdc, 0xfffe14eb, 0x00020730, 0xfffed00a, 0x00006db9, 0x6c20c550, 0xe97bf627, 0x0b07bcc6, 0xf9a84b50, 0x03ce682d, 0xfdb96498, 0x0151a317, 0xff46b2c7, 0x005dbb29, 0xffd620a6, 0x000f0d91, 0xfffcf9be, 0xfffee466, 0x0001a90b, 0xfffef3ea, 0x000063b5, 0x6b475bb0, 0xe9250f99, 0x0b437380, 0xf97d9b37, 0x03ed7c9a, 0xfda2db8c, 0x0161ace5, 0xff3b9cad, 0x00651b9c, 0xffd171d1, 0x0011dc47, 0xfffb6825, 0xffffb1aa, 0x00014bed, 0xffff1759, 0x000059dd, 0x6a69584a, 0xe8d2a017, 0x0b7d0525, 0xf95429c0, 0x040bcb77, 0xfd8ccf46, 0x01716859, 0xff30b6c8, 0x006c5f4b, 0xffccd380, 0x0014a1ee, 0xfff9db44, 0x00007c9c, 0x0000efe1, 0xffff3a53, 0x00005033, 0x6986cec4, 0xe884a3fb, 0x0bb46de2, 0xf92bfae4, 0x0429517b, 0xfd77424c, 0x0180d397, 0xff260269, 0x00738551, 0xffc84645, 0x00175e2d, 0xfff8534d, 0x00014521, 0x000094f3, 0xffff5cd2, 0x000046b8, 0x689fd324, 0xe83b1731, 0x0be9aa34, 0xf9051266, 0x04460b81, 0xfd62370e, 0x018fecd1, 0xff1b80da, 0x007a8cd0, 0xffc3cab1, 0x001a10ad, 0xfff6d070, 0x00020b23, 0x00003b2e, 0xffff7ed3, 0x00003d6c, 0x67b479cf, 0xe7f5f531, 0x0c1cb6ef, 0xf8df73d6, 0x0461f688, 0xfd4dafe6, 0x019eb246, 0xff113358, 0x008174ef, 0xffbf614e, 0x001cb91a, 0xfff552de, 0x0002ce87, 0xffffe29d, 0xffffa052, 0x00003450, 0x66c4d787, 0xe7b53908, 0x0c4d913a, 0xf8bb228c, 0x047d0fb1, 0xfd39af17, 0x01ad2249, 0xff071b16, 0x00883cdc, 0xffbb0aa3, 0x001f5723, 0xfff3dac3, 0x00038f37, 0xffff8b4b, 0xffffc14b, 0x00002b66, 0x65d10168, 0xe778dd50, 0x0c7c368d, 0xf89821ac, 0x0497543f, 0xfd2636ca, 0x01bb3b37, 0xfefd3941, 0x008ee3cd, 0xffb6c735, 0x0021ea76, 0xfff2684e, 0x00044d1b, 0xffff3540, 0xffffe1bc, 0x000022ad, 0x64d90ce7, 0xe740dc3c, 0x0ca8a4b7, 0xf8767422, 0x04b0c19a, 0xfd134913, 0x01c8fb81, 0xfef38ef6, 0x009568fc, 0xffb29782, 0x002472c8, 0xfff0fba9, 0x0005081f, 0xfffee088, 0x0000019f, 0x00001a28, 0x63dd0fcd, 0xe70d2f8d, 0x0cd2d9d5, 0xf8561ca7, 0x04c9554e, 0xfd00e7ec, 0x01d661a6, 0xfeea1d4c, 0x009bcbab, 0xffae7c06, 0x0026efcc, 0xffef94fe, 0x0005c02c, 0xfffe8d2c, 0x000020f3, 0x000011d5, 0x62dd2039, 0xe6ddd09f, 0x0cfad45a, 0xf8371dbb, 0x04e10d0a, 0xfcef153a, 0x01e36c34, 0xfee0e54e, 0x00a20b23, 0xffaa7538, 0x0029613a, 0xffee3477, 0x0006752d, 0xfffe3b35, 0x00003fb3, 0x000009b6, 0x61d95497, 0xe6b2b862, 0x0d209309, 0xf81979ab, 0x04f7e6a2, 0xfcddd2c7, 0x01f019cb, 0xfed7e7fd, 0x00a826b2, 0xffa6838c, 0x002bc6cd, 0xffecda3b, 0x0007270f, 0xfffdeaaa, 0x00005ddd, 0x000001cc, 0x60d1c3a6, 0xe68bdf5e, 0x0d4414f9, 0xf7fd328c, 0x050de00d, 0xfccd2246, 0x01fc691b, 0xfecf2650, 0x00ae1dae, 0xffa2a770, 0x002e2040, 0xffeb866f, 0x0007d5bf, 0xfffd9b96, 0x00007b6f, 0xfffffa17, 0x5fc68470, 0xe6693db5, 0x0d65598f, 0xf7e24a3c, 0x0522f766, 0xfcbd0551, 0x020858e2, 0xfec6a130, 0x00b3ef73, 0xff9ee150, 0x00306d52, 0xffea3939, 0x0008812a, 0xfffd4dff, 0x00009865, 0xfffff297, 0x5eb7ae46, 0xe64acb24, 0x0d846084, 0xf7c8c267, 0x05372aee, 0xfcad7d6b, 0x0213e7f0, 0xfebe5980, 0x00b99b65, 0xff9b3192, 0x0032adc4, 0xffe8f2bb, 0x0009293e, 0xfffd01ee, 0x0000b4bd, 0xffffeb4c, 0x5da558c5, 0xe6307f05, 0x0da129df, 0xf7b09c7f, 0x054a7909, 0xfc9e8bfd, 0x021f1526, 0xfeb65015, 0x00bf20ee, 0xff979898, 0x0034e15b, 0xffe7b317, 0x0009cdeb, 0xfffcb769, 0x0000d074, 0xffffe438, 0x5c8f9bcb, 0xe61a504f, 0x0dbbb5f6, 0xf799d9c4, 0x055ce03f, 0xfc903258, 0x0229df75, 0xfeae85bb, 0x00c47f7f, 0xff9416c1, 0x003707dc, 0xffe67a6f, 0x000a6f20, 0xfffc6e78, 0x0000eb89, 0xffffdd5a, 0x5b768f7a, 0xe6083599, 0x0dd40571, 0xf7847b3d, 0x056e5f3d, 0xfc8271b4, 0x023445dd, 0xfea6fb32, 0x00c9b691, 0xff90ac66, 0x00392111, 0xffe548e0, 0x000b0cce, 0xfffc2720, 0x000105f9, 0xffffd6b2, 0x5a5a4c32, 0xe5fa2519, 0x0dea1943, 0xf77081be, 0x057ef4d3, 0xfc754b32, 0x023e4772, 0xfe9fb12e, 0x00cec5a1, 0xff8d59dd, 0x003b2cc5, 0xffe41e88, 0x000ba6e5, 0xfffbe169, 0x00011fc3, 0xffffd041, 0x593aea93, 0xe5f014aa, 0x0dfdf2ae, 0xf75dede5, 0x058e9ff8, 0xfc68bfd7, 0x0247e354, 0xfe98a85b, 0x00d3ac38, 0xff8a1f77, 0x003d2ac6, 0xffe2fb83, 0x000c3d59, 0xfffb9d59, 0x000138e4, 0xffffca06, 0x58188376, 0xe5e9f9ca, 0x0e0f9342, 0xf74cc01c, 0x059d5fc5, 0xfc5cd092, 0x025118b8, 0xfe91e159, 0x00d869e1, 0xff86fd81, 0x003f1ae4, 0xffe1dfec, 0x000cd01b, 0xfffb5af3, 0x0001515c, 0xffffc402, 0x56f32fea, 0xe5e7c99e, 0x0e1efcdb, 0xf73cf898, 0x05ab3377, 0xfc517e38, 0x0259e6e1, 0xfe8b5cba, 0x00dcfe32, 0xff83f443, 0x0040fcf3, 0xffe0cbdc, 0x000d5f1f, 0xfffb1a3f, 0x00016928, 0xffffbe35, 0x55cb0935, 0xe5e978f0, 0x0e2c319d, 0xf72e9758, 0x05b81a70, 0xfc46c987, 0x02624d23, 0xfe851b09, 0x00e168c5, 0xff810401, 0x0042d0c9, 0xffdfbf6b, 0x000dea5a, 0xfffadb40, 0x00018048, 0xffffb89f, 0x54a028d0, 0xe5eefc35, 0x0e3733fc, 0xf7219c2a, 0x05c41435, 0xfc3cb323, 0x026a4ae5, 0xfe7f1cc4, 0x00e5a93c, 0xff7e2cfb, 0x0044963d, 0xffdebaaf, 0x000e71c1, 0xfffa9dfa, 0x000196ba, 0xffffb340, 0x5372a862, 0xe5f8478d, 0x0e4006b2, 0xf71606a6, 0x05cf2070, 0xfc333b97, 0x0271df9c, 0xfe79625e, 0x00e9bf43, 0xff7b6f6c, 0x00464d2b, 0xffddbdbd, 0x000ef549, 0xfffa6273, 0x0001ac7d, 0xffffae17, 0x5242a1c1, 0xe6054ec6, 0x0e46acc4, 0xf70bd632, 0x05d93eee, 0xfc2a6356, 0x02790ace, 0xfe73ec40, 0x00edaa88, 0xff78cb8c, 0x0047f571, 0xffdcc8a9, 0x000f74e9, 0xfffa28ad, 0x0001c191, 0xffffa924, 0x51102eec, 0xe616055a, 0x0e4b297c, 0xf7030a01, 0x05e26f9f, 0xfc222abb, 0x027fcc12, 0xfe6ebac6, 0x00f16ac4, 0xff76418b, 0x00498eed, 0xffdbdb84, 0x000ff098, 0xfff9f0ac, 0x0001d5f4, 0xffffa467, 0x4fdb6a09, 0xe62a5e76, 0x0e4d806f, 0xf6fba113, 0x05eab296, 0xfc1a9208, 0x02862311, 0xfe69ce43, 0x00f4ffb6, 0xff73d199, 0x004b1984, 0xffdaf65e, 0x0010684e, 0xfff9ba73, 0x0001e9a7, 0xffff9fe0, 0x4ea46d66, 0xe6424cf8, 0x0e4db575, 0xf6f59a36, 0x05f20809, 0xfc139968, 0x028c0f83, 0xfe6526fe, 0x00f86924, 0xff717bdf, 0x004c951b, 0xffda1948, 0x0010dc05, 0xfff98604, 0x0001fca8, 0xffff9b8f, 0x4d6b536f, 0xe65dc373, 0x0e4bccac, 0xf6f0f407, 0x05f87053, 0xfc0d40ec, 0x0291912f, 0xfe60c533, 0x00fba6da, 0xff6f4083, 0x004e0199, 0xffd9444e, 0x00114bb4, 0xfff95363, 0x00020ef7, 0xffff9773, 0x4c3036b2, 0xe67cb42f, 0x0e47ca78, 0xf6edacf2, 0x05fdebee, 0xfc07888e, 0x0296a7f0, 0xfe5ca913, 0x00feb8ad, 0xff6d1fa5, 0x004f5ee9, 0xffd8777d, 0x0011b757, 0xfff92290, 0x00022095, 0xffff938c, 0x4af331d9, 0xe69f112f, 0x0e41b37c, 0xf6ebc332, 0x06027b78, 0xfc027031, 0x029b53af, 0xfe58d2c5, 0x01019e78, 0xff6b1961, 0x0050acf7, 0xffd7b2e0, 0x00121ee9, 0xfff8f38e, 0x00023181, 0xffff8fd9, 0x49b45fa8, 0xe6c4cc2e, 0x0e398c9f, 0xf6eb34d4, 0x06061fb2, 0xfbfdf79e, 0x029f9466, 0xfe554265, 0x0104581c, 0xff692dd2, 0x0051ebb4, 0xffd6f67f, 0x00128265, 0xfff8c65d, 0x000241bb, 0xffff8c5a, 0x4873daf7, 0xe6edd6a4, 0x0e2f5b0b, 0xf6ebffb2, 0x0608d97c, 0xfbfa1e88, 0x02a36a1e, 0xfe51f802, 0x0106e583, 0xff675d09, 0x00531b12, 0xffd64264, 0x0012e1c8, 0xfff89b00, 0x00025143, 0xffff890e, 0x4731beb7, 0xe71a21c7, 0x0e232425, 0xf6ee217b, 0x060aa9da, 0xfbf6e48c, 0x02a6d4f0, 0xfe4ef3a4, 0x0109469d, 0xff65a718, 0x00543b04, 0xffd59695, 0x00133d0e, 0xfff87176, 0x0002601b, 0xffff85f5, 0x45ee25e7, 0xe7499e8f, 0x0e14ed93, 0xf6f197ad, 0x060b91ee, 0xfbf4492d, 0x02a9d508, 0xfe4c3546, 0x010b7b61, 0xff640c08, 0x00554b83, 0xffd4f316, 0x00139436, 0xfff849c0, 0x00026e41, 0xffff830e, 0x44a92b96, 0xe77c3db4, 0x0e04bd39, 0xf6f65f9b, 0x060b92ff, 0xfbf24bd9, 0x02ac6a9e, 0xfe49bcd9, 0x010d83cb, 0xff628be3, 0x00564c88, 0xffd457ec, 0x0013e73e, 0xfff823dd, 0x00027bb8, 0xffff805a, 0x4362eadc, 0xe7b1efb4, 0x0df29936, 0xf6fc766a, 0x060aae6e, 0xfbf0ebe7, 0x02ae95fb, 0xfe478a42, 0x010f5fe2, 0xff6126a9, 0x00573e0f, 0xffd3c519, 0x00143626, 0xfff7ffce, 0x0002887f, 0xffff7dd6, 0x421b7edf, 0xe7eaa4d4, 0x0dde87e2, 0xf703d912, 0x0608e5c2, 0xfbf02896, 0x02b05779, 0xfe459d5e, 0x01110faf, 0xff5fdc5b, 0x00582016, 0xffd33a9e, 0x001480ec, 0xfff7dd92, 0x00029497, 0xffff7b82, 0x40d302c5, 0xe8264d21, 0x0dc88fd2, 0xf70c8461, 0x06063a9d, 0xfbf00112, 0x02b1af7f, 0xfe43f5ff, 0x01129344, 0xff5eacf3, 0x0058f29f, 0xffd2b87c, 0x0014c792, 0xfff7bd28, 0x0002a002, 0xffff795f, 0x3f8991bd, 0xe864d874, 0x0db0b7d1, 0xf71674fa, 0x0602aec3, 0xfbf0746e, 0x02b29e84, 0xfe4293ec, 0x0113eabb, 0xff5d9867, 0x0059b5ad, 0xffd23eaf, 0x00150a19, 0xfff79e8f, 0x0002aac0, 0xffff776a, 0x3e3f46f2, 0xe8a63671, 0x0d9706e1, 0xf721a756, 0x05fe4414, 0xfbf181a9, 0x02b3250f, 0xfe4176e2, 0x01151632, 0xff5c9eaa, 0x005a6946, 0xffd1cd37, 0x00154883, 0xfff781c5, 0x0002b4d2, 0xffff75a3, 0x3cf43d8f, 0xe8ea568f, 0x0d7b843b, 0xf72e17c4, 0x05f8fc8f, 0xfbf327ab, 0x02b343b5, 0xfe409e95, 0x011615ce, 0xff5bbfaa, 0x005b0d72, 0xffd1640e, 0x001582d3, 0xfff766c8, 0x0002be3b, 0xffff740a, 0x3ba890b9, 0xe9312813, 0x0d5e3749, 0xf73bc26b, 0x05f2da52, 0xfbf56549, 0x02b2fb1a, 0xfe400aae, 0x0116e9bc, 0xff5afb53, 0x005ba23b, 0xffd1032f, 0x0015b90b, 0xfff74d97, 0x0002c6fa, 0xffff729e, 0x3a5c5b8e, 0xe97a9a17, 0x0d3f27ab, 0xf74aa34c, 0x05ebdf97, 0xfbf83941, 0x02b24bf1, 0xfe3fbacd, 0x0117922f, 0xff5a5189, 0x005c27af, 0xffd0aa93, 0x0015eb2f, 0xfff7362f, 0x0002cf12, 0xffff715d, 0x390fb920, 0xe9c69b8c, 0x0d1e5d32, 0xf75ab63f, 0x05e40eb3, 0xfbfba23f, 0x02b136f9, 0xfe3fae87, 0x01180f5d, 0xff59c230, 0x005c9ddc, 0xffd05a33, 0x00161944, 0xfff7208d, 0x0002d684, 0xffff7047, 0x37c2c474, 0xea151b3a, 0x0cfbdfdd, 0xf76bf6f7, 0x05db6a19, 0xfbff9ed7, 0x02afbd02, 0xfe3fe569, 0x01186187, 0xff594d27, 0x005d04d4, 0xffd01205, 0x0016434f, 0xfff70caf, 0x0002dd53, 0xffff6f5c, 0x36759880, 0xea6607c4, 0x0cd7b7dd, 0xf77e6103, 0x05d1f459, 0xfc042d8e, 0x02addee8, 0xfe405ef6, 0x011888f2, 0xff58f249, 0x005d5cab, 0xffcfd1ff, 0x00166956, 0xfff6fa92, 0x0002e37e, 0xffff6e99, 0x35285026, 0xeab94fa9, 0x0cb1ed8c, 0xf791efcb, 0x05c7b01a, 0xfc094cd2, 0x02ab9d96, 0xfe411aa8, 0x011885e7, 0xff58b16c, 0x005da575, 0xffcf9a15, 0x00168b5e, 0xfff6ea31, 0x0002e90a, 0xffff6dff, 0x33db0631, 0xeb0ee148, 0x0c8a8973, 0xf7a69e96, 0x05bca021, 0xfc0efafe, 0x02a8fa03, 0xfe4217ef, 0x011858b9, 0xff588a65, 0x005ddf4c, 0xffcf6a3b, 0x0016a96f, 0xfff6db89, 0x0002edf6, 0xffff6d8d, 0x328dd556, 0xeb66aae0, 0x0c619444, 0xf7bc6889, 0x05b0c74b, 0xfc15365c, 0x02a5f535, 0xfe435633, 0x011801be, 0xff587d03, 0x005e0a48, 0xffcf4262, 0x0016c390, 0xfff6ce97, 0x0002f246, 0xffff6d40, 0x3140d82e, 0xebc09a94, 0x0c3716da, 0xf7d348a4, 0x05a42890, 0xfc1bfd22, 0x02a2903e, 0xfe44d4d3, 0x01178152, 0xff588913, 0x005e2687, 0xffcf227b, 0x0016d9c9, 0xfff6c356, 0x0002f5fc, 0xffff6d1a, 0x2ff42933, 0xec1c9e6d, 0x0c0b1a37, 0xf7eb39cc, 0x0596c6ff, 0xfc234d75, 0x029ecc3c, 0xfe469325, 0x0116d7d7, 0xff58ae5d, 0x005e3427, 0xffcf0a77, 0x0016ec22, 0xfff6b9c1, 0x0002f919, 0xffff6d17, 0x2ea7e2c0, 0xec7aa45b, 0x0bdda783, 0xf80436c0, 0x0588a5bf, 0xfc2b2567, 0x029aaa5a, 0xfe489077, 0x011605b5, 0xff58eca8, 0x005e3347, 0xffcefa44, 0x0016faa5, 0xfff6b1d5, 0x0002fba0, 0xffff6d38, 0x2d5c1f0e, 0xecda9a39, 0x0baec80a, 0xf81e3a25, 0x0579c812, 0xfc3382fb, 0x02962bd1, 0xfe4acc0e, 0x01150b5a, 0xff5943b4, 0x005e240a, 0xffcef1cf, 0x0017055b, 0xfff6ab8c, 0x0002fd94, 0xffff6d7c, 0x2c10f82d, 0xed3c6dce, 0x0b7e853c, 0xf8393e81, 0x056a314b, 0xfc3c6420, 0x029151e3, 0xfe4d4526, 0x0113e937, 0xff59b340, 0x005e0694, 0xffcef106, 0x00170c4f, 0xfff6a6e2, 0x0002fef6, 0xffff6de2, 0x2ac68807, 0xeda00cd1, 0x0b4ce8a8, 0xf8553e3c, 0x0559e4da, 0xfc45c6b6, 0x028c1de0, 0xfe4ffaf6, 0x01129fc5, 0xff5a3b09, 0x005ddb0b, 0xffcef7d4, 0x00170f8a, 0xfff6a3d0, 0x0002ffc9, 0xffff6e67, 0x297ce85a, 0xee0564e8, 0x0b19fbfe, 0xf87233a4, 0x0548e63f, 0xfc4fa88f, 0x02869122, 0xfe52ecab, 0x01112f81, 0xff5adac6, 0x005da198, 0xffcf0623, 0x00170f18, 0xfff6a252, 0x00030010, 0xffff6f0d, 0x283432b9, 0xee6c63ad, 0x0ae5c90b, 0xf89018eb, 0x05373912, 0xfc5a076a, 0x0280ad0f, 0xfe561969, 0x010f98eb, 0xff5b922d, 0x005d5a62, 0xffcf1bde, 0x00170b04, 0xfff6a262, 0x0002ffcd, 0xffff6fd1, 0x26ec8083, 0xeed4f6b0, 0x0ab059bc, 0xf8aee828, 0x0524e100, 0xfc64e0f9, 0x027a7318, 0xfe598050, 0x010ddc8c, 0xff5c60ee, 0x005d0597, 0xffcf38ec, 0x0017035a, 0xfff6a3f9, 0x0002ff03, 0xffff70b2, 0x25a5eae8, 0xef3f0b78, 0x0a79b814, 0xf8ce9b5d, 0x0511e1c6, 0xfc7032de, 0x0273e4b8, 0xfe5d2075, 0x010bfaee, 0xff5d46bb, 0x005ca363, 0xffcf5d36, 0x0016f828, 0xfff6a713, 0x0002fdb4, 0xffff71b0, 0x24608ae2, 0xefaa8f87, 0x0a41ee32, 0xf8ef2c71, 0x04fe3f39, 0xfc7bfaad, 0x026d0374, 0xfe60f8ea, 0x0109f4a2, 0xff5e433e, 0x005c33f6, 0xffcf88a2, 0x0016e979, 0xfff6aba9, 0x0002fbe4, 0xffff72c9, 0x231c7932, 0xf017705a, 0x0a09064e, 0xf9109535, 0x04e9fd3c, 0xfc8835ed, 0x0265d0dd, 0xfe6508b6, 0x0107ca3c, 0xff5f5621, 0x005bb77f, 0xffcfbb17, 0x0016d75b, 0xfff6b1b4, 0x0002f995, 0xffff73fc, 0x21d9ce63, 0xf0859b6e, 0x09cf0ab4, 0xf932cf65, 0x04d51fc6, 0xfc94e216, 0x025e4e8b, 0xfe694edd, 0x01057c57, 0xff607f0b, 0x005b2e31, 0xffcff478, 0x0016c1dc, 0xfff6b92d, 0x0002f6c9, 0xffff7549, 0x2098a2bf, 0xf0f4fe3d, 0x099405c6, 0xf955d4a7, 0x04bfaadf, 0xfca1fc96, 0x02567e22, 0xfe6dca58, 0x01030b8e, 0xff61bd9f, 0x005a9840, 0xffd034ac, 0x0016a90a, 0xfff6c20f, 0x0002f385, 0xffff76ae, 0x1f590e55, 0xf1658649, 0x095801f8, 0xf9799e8f, 0x04a9a29e, 0xfcaf82ca, 0x024e614c, 0xfe727a1f, 0x01007885, 0xff631180, 0x0059f5e1, 0xffd07b95, 0x00168cf2, 0xfff6cc52, 0x0002efca, 0xffff782a, 0x1e1b28f2, 0xf1d72114, 0x091b09d1, 0xf99e269e, 0x04930b2b, 0xfcbd7206, 0x0245f9bf, 0xfe775d1f, 0x00fdc3e0, 0xff647a4b, 0x0059474a, 0xffd0c915, 0x00166da5, 0xfff6d7f0, 0x0002eb9c, 0xffff79bc, 0x1cdf0a20, 0xf249bc2c, 0x08dd27e6, 0xf9c36642, 0x047be8bc, 0xfccbc793, 0x023d4937, 0xfe7c7243, 0x00faee49, 0xff65f79e, 0x00588cb4, 0xffd11d0f, 0x00164b32, 0xfff6e4e1, 0x0002e6fe, 0xffff7b63, 0x1ba4c923, 0xf2bd4523, 0x089e66dd, 0xf9e956da, 0x04643f95, 0xfcda80ad, 0x0234517a, 0xfe81b86d, 0x00f7f86e, 0xff678912, 0x0057c658, 0xffd17764, 0x001625a7, 0xfff6f31d, 0x0002e1f3, 0xffff7d1f, 0x1a6c7cf9, 0xf331a99b, 0x085ed167, 0xfa0ff1b6, 0x044c1409, 0xfce99a86, 0x022b1455, 0xfe872e7c, 0x00f4e2ff, 0xff692e3f, 0x0056f471, 0xffd1d7f5, 0x0015fd15, 0xfff7029f, 0x0002dc7d, 0xffff7eed, 0x19363c54, 0xf3a6d741, 0x081e7241, 0xfa373017, 0x04336a75, 0xfcf91246, 0x0221939d, 0xfe8cd349, 0x00f1aeb2, 0xff6ae6ba, 0x0056173b, 0xffd23ea1, 0x0015d18b, 0xfff7135d, 0x0002d6a0, 0xffff80cd, 0x18021d9d, 0xf41cbbd3, 0x07dd5430, 0xfa5f0b30, 0x041a4744, 0xfd08e50c, 0x0217d12d, 0xfe92a5a7, 0x00ee5c3e, 0xff6cb218, 0x00552ef3, 0xffd2ab47, 0x0015a31b, 0xfff72551, 0x0002d060, 0xffff82bf, 0x16d036eb, 0xf493451f, 0x079b8203, 0xfa877c29, 0x0400aeec, 0xfd190fed, 0x020dcee8, 0xfe98a466, 0x00eaec5e, 0xff6e8fe9, 0x00543bd8, 0xffd31dc7, 0x001571d5, 0xfff73873, 0x0002c9be, 0xffff84c0, 0x15a09e09, 0xf50a610a, 0x0759068f, 0xfab07c1d, 0x03e6a5ee, 0xfd298ff6, 0x02038eb7, 0xfe9ece4f, 0x00e75fd1, 0xff707fbd, 0x00533e29, 0xffd395fd, 0x00153dca, 0xfff74cba, 0x0002c2be, 0xffff86d0, 0x1473686d, 0xf581fd8b, 0x0715ecae, 0xfada0420, 0x03cc30d4, 0xfd3a622b, 0x01f9128a, 0xfea52227, 0x00e3b758, 0xff728121, 0x00523626, 0xffd413c9, 0x0015070b, 0xfff76220, 0x0002bb64, 0xffff88ee, 0x1348ab3a, 0xf5fa08b5, 0x06d23f3d, 0xfb040d3b, 0x03b15431, 0xfd4b8389, 0x01ee5c55, 0xfeab9eb2, 0x00dff3b7, 0xff7493a2, 0x00512412, 0xffd49705, 0x0014cdab, 0xfff7789c, 0x0002b3b3, 0xffff8b19, 0x12207b3e, 0xf67270b1, 0x068e091c, 0xfb2e906f, 0x039614a1, 0xfd5cf105, 0x01e36e14, 0xfeb242ac, 0x00dc15b4, 0xff76b6ca, 0x0050082f, 0xffd51f90, 0x001491b9, 0xfff79026, 0x0002abad, 0xffff8d50, 0x10faecee, 0xf6eb23c6, 0x0649552a, 0xfb5986b6, 0x037a76c7, 0xfd6ea790, 0x01d849c7, 0xfeb90cce, 0x00d81e1a, 0xff78ea20, 0x004ee2c1, 0xffd5ad44, 0x00145349, 0xfff7a8b6, 0x0002a357, 0xffff8f92, 0x0fd81464, 0xf7641059, 0x06042e45, 0xfb84e906, 0x035e7f4e, 0xfd80a411, 0x01ccf173, 0xfebffbd0, 0x00d40db3, 0xff7b2d2d, 0x004db40c, 0xffd63ffe, 0x0014126c, 0xfff7c245, 0x00029ab2, 0xffff91de, 0x0eb80562, 0xf7dd24ef, 0x05be9f49, 0xfbb0b04e, 0x034232e6, 0xfd92e36c, 0x01c16720, 0xfec70e64, 0x00cfe54f, 0xff7d7f76, 0x004c7c55, 0xffd6d798, 0x0013cf36, 0xfff7dcc8, 0x000291c3, 0xffff9434, 0x0d9ad348, 0xf856502d, 0x0578b30e, 0xfbdcd57a, 0x03259644, 0xfda5627e, 0x01b5acdd, 0xfece433a, 0x00cba5bc, 0xff7fe07f, 0x004b3be3, 0xffd773ed, 0x001389b7, 0xfff7f83a, 0x0002888c, 0xffff9691, 0x0c80911b, 0xf8cf80de, 0x05327467, 0xfc095174, 0x0308ae24, 0xfdb81e22, 0x01a9c4bc, 0xfed598fe, 0x00c74fce, 0xff824fca, 0x0049f2fc, 0xffd814d7, 0x00134204, 0xfff81490, 0x00027f11, 0xffff98f5, 0x0b69517e, 0xf948a5f0, 0x04ebee1c, 0xfc361d25, 0x02eb7f44, 0xfdcb132d, 0x019db0d0, 0xfedd0e5c, 0x00c2e457, 0xff84ccdb, 0x0048a1e7, 0xffd8ba31, 0x0012f82e, 0xfff831c3, 0x00027555, 0xffff9b60, 0x0a5526b0, 0xf9c1ae7b, 0x04a52af2, 0xfc633173, 0x02ce0e67, 0xfdde3e6f, 0x01917334, 0xfee4a1fa, 0x00be642f, 0xff875731, 0x004748ed, 0xffd963d4, 0x0012ac48, 0xfff84fcb, 0x00026b5b, 0xffff9dd0, 0x0944228e, 0xfa3a89be, 0x045e359f, 0xfc908746, 0x02b0604f, 0xfdf19cb9, 0x01850e00, 0xfeec527e, 0x00b9d02b, 0xff89ee4d, 0x0045e856, 0xffda1199, 0x00125e66, 0xfff86e9e, 0x00026126, 0xffffa045, 0x08365690, 0xfab32723, 0x041718d2, 0xfcbe1789, 0x029279c4, 0xfe052ad4, 0x01788354, 0xfef41e8c, 0x00b52925, 0xff8c91ad, 0x0044806c, 0xffdac35a, 0x00120e9b, 0xfff88e35, 0x000256b9, 0xffffa2be, 0x072bd3c5, 0xfb2b7641, 0x03cfdf29, 0xfcebdb26, 0x02745f8c, 0xfe18e58c, 0x016bd54f, 0xfefc04c6, 0x00b06ff7, 0xff8f40d0, 0x00431177, 0xffdb78ef, 0x0011bcf9, 0xfff8ae88, 0x00024c18, 0xffffa539, 0x0624aad6, 0xfba366df, 0x03889336, 0xfd19cb0e, 0x02561670, 0xfe2cc9a7, 0x015f0612, 0xff0403cc, 0x00aba57c, 0xff91fb31, 0x00419bc2, 0xffdc3231, 0x00116994, 0xfff8cf8d, 0x00024146, 0xffffa7b7, 0x0520ec00, 0xfc1ae8f2, 0x03413f7b, 0xfd47e035, 0x0237a337, 0xfe40d3ed, 0x015217c0, 0xff0c1a3c, 0x00a6ca90, 0xff94c04f, 0x00401f98, 0xffdceef9, 0x00111480, 0xfff8f13c, 0x00023645, 0xffffaa35, 0x0420a716, 0xfc91eca1, 0x02f9ee68, 0xfd761395, 0x02190aa6, 0xfe550124, 0x01450c7f, 0xff1446b5, 0x00a1e00f, 0xff978fa6, 0x003e9d42, 0xffddaf1e, 0x0010bdcf, 0xfff9138e, 0x00022b19, 0xffffacb4, 0x0323eb7f, 0xfd086246, 0x02b2aa5c, 0xfda45e2c, 0x01fa5183, 0xfe694e12, 0x0137e672, 0xff1c87d3, 0x009ce6d8, 0xff9a68b0, 0x003d150d, 0xffde727a, 0x00106595, 0xfff93679, 0x00021fc5, 0xffffaf33, }; // cmd-line: fir -l 7 -s 44100 -c 19876 -n 16 -b 9.62 const uint32_t dn_sampler_filter_coefficients[] __attribute__ ((aligned (32))) = { 0x736144b5, 0x0c333a22, 0xf4fca390, 0x09424904, 0xf8c92a41, 0x052ac04c, 0xfca4fc64, 0x01ed8cc7, 0xff119cc0, 0x0053ba6e, 0xfff9a80d, 0xffeaeaab, 0x001690d9, 0xfff11dcd, 0x000715d9, 0xfffdb4b9, 0x735ed3aa, 0x0b433de8, 0xf560f0f3, 0x091282c4, 0xf8dd5ccf, 0x0525cb66, 0xfca23e3d, 0x01f33960, 0xff0bc9c2, 0x00586127, 0xfff68603, 0xffecbad5, 0x0015ab8b, 0xfff17c10, 0x0006f71a, 0xfffdbc2f, 0x735780bb, 0x0a55a98f, 0xf5c5b2a1, 0x08e1ea27, 0xf8f25767, 0x0520366d, 0xfc9ff262, 0x01f89c98, 0xff0620a4, 0x005cf349, 0xfff36c0d, 0xffee8913, 0x0014c5dc, 0xfff1db1a, 0x0006d7d7, 0xfffdc3db, 0x734b4c77, 0x096a8a51, 0xf62adb7c, 0x08b086aa, 0xf9081629, 0x051a030f, 0xfc9e186a, 0x01fdb637, 0xff00a1d8, 0x00617065, 0xfff05a84, 0xfff0552d, 0x0013dfed, 0xfff23ada, 0x0006b817, 0xfffdcbba, 0x733a37d2, 0x0881ed1f, 0xf6905e79, 0x087e5fd7, 0xf91e9521, 0x05133308, 0xfc9cafe0, 0x0202860e, 0xfefb4dc7, 0x0065d80c, 0xffed51bc, 0xfff21ee8, 0x0012f9de, 0xfff29b40, 0x000697e0, 0xfffdd3ca, 0x7324441e, 0x079bdea7, 0xf6f62e9d, 0x084b7d43, 0xf935d048, 0x050bc828, 0xfc9bb83e, 0x02070bf9, 0xfef624d8, 0x006a29d6, 0xffea520a, 0xfff3e60f, 0x001213d0, 0xfff2fc3d, 0x00067739, 0xfffddc07, 0x7309730f, 0x06b86b52, 0xf75c3eff, 0x0817e68c, 0xf94dc388, 0x0503c44d, 0xfc9b30f3, 0x020b47dd, 0xfef12766, 0x006e655c, 0xffe75bbe, 0xfff5aa69, 0x00112de1, 0xfff35dc1, 0x00065629, 0xfffde470, 0x72e9c6b8, 0x05d79f40, 0xf7c282cb, 0x07e3a35a, 0xf9666ab7, 0x04fb2969, 0xfc9b195f, 0x020f39ab, 0xfeec55cc, 0x00728a3d, 0xffe46f2a, 0xfff76bc2, 0x00104831, 0xfff3bfbc, 0x000634b6, 0xfffded03, 0x72c5418e, 0x04f98649, 0xf828ed43, 0x07aebb5d, 0xf97fc19e, 0x04f1f97c, 0xfc9b70d6, 0x0212e15c, 0xfee7b059, 0x0076981a, 0xffe18c9a, 0xfff929e3, 0x000f62de, 0xfff4221f, 0x000612e8, 0xfffdf5bc, 0x729be665, 0x041e2bfe, 0xf88f71bf, 0x0779364a, 0xf999c3f4, 0x04e83697, 0xfc9c369c, 0x02163ef1, 0xfee33759, 0x007a8e98, 0xffdeb45b, 0xfffae49b, 0x000e7e08, 0xfff484db, 0x0005f0c4, 0xfffdfe9b, 0x726db871, 0x03459ba4, 0xf8f603ae, 0x07431bdf, 0xf9b46d64, 0x04dde2da, 0xfc9d69eb, 0x02195278, 0xfedeeb11, 0x007e6d61, 0xffdbe6b6, 0xfffc9bb4, 0x000d99cc, 0xfff4e7e1, 0x0005ce51, 0xfffe079b, 0x723abb44, 0x026fe039, 0xf95c9699, 0x070c73dd, 0xf9cfb988, 0x04d30074, 0xfc9f09ee, 0x021c1c06, 0xfedacbbf, 0x00823422, 0xffd923f4, 0xfffe4efd, 0x000cb647, 0xfff54b20, 0x0005ab95, 0xfffe10bc, 0x7202f2d3, 0x019d046d, 0xf9c31e22, 0x06d5460b, 0xf9eba3ef, 0x04c791a4, 0xfca115c5, 0x021e9bbb, 0xfed6d99c, 0x0085e28b, 0xffd66c59, 0xfffffe46, 0x000bd397, 0xfff5ae8c, 0x00058898, 0xfffe19fa, 0x71c6636d, 0x00cd12a4, 0xfa298e07, 0x069d9a31, 0xfa082817, 0x04bb98b5, 0xfca38c83, 0x0220d1bf, 0xfed314da, 0x00897851, 0xffd3c02a, 0x0001a95d, 0x000af1d9, 0xfff61214, 0x0005655e, 0xfffe2354, 0x718511c2, 0x000014f8, 0xfa8fda21, 0x0665781b, 0xfa254176, 0x04af1804, 0xfca66d2e, 0x0222be45, 0xfecf7da3, 0x008cf52d, 0xffd11fa9, 0x00035015, 0x000a1129, 0xfff675ab, 0x000541f0, 0xfffe2cc8, 0x713f02e0, 0xff361534, 0xfaf5f669, 0x062ce795, 0xfa42eb75, 0x04a211f8, 0xfca9b6bf, 0x02246187, 0xfecc141d, 0x009058da, 0xffce8b13, 0x0004f23e, 0x000931a3, 0xfff6d942, 0x00051e52, 0xfffe3652, 0x70f43c32, 0xfe6f1cd7, 0xfb5bd6f4, 0x05f3f06b, 0xfa61216f, 0x04948906, 0xfcad6827, 0x0225bbca, 0xfec8d867, 0x0093a31a, 0xffcc02a8, 0x00068fad, 0x00085362, 0xfff73ccb, 0x0004fa8b, 0xfffe3ff2, 0x70a4c37f, 0xfdab350f, 0xfbc16ff6, 0x05ba9a6b, 0xfa7fdeba, 0x04867fb3, 0xfcb18047, 0x0226cd5b, 0xfec5ca9a, 0x0096d3af, 0xffc986a1, 0x00082835, 0x00077681, 0xfff7a037, 0x0004d6a1, 0xfffe49a4, 0x70509eec, 0xfcea66be, 0xfc26b5c5, 0x0580ed5f, 0xfa9f1e9e, 0x0477f88d, 0xfcb5fdf7, 0x02279691, 0xfec2eaca, 0x0099ea62, 0xffc71738, 0x0009bbab, 0x00069b1b, 0xfff8037a, 0x0004b29a, 0xfffe5367, 0x6ff7d4f8, 0xfc2cba75, 0xfc8b9cda, 0x0546f10f, 0xfabedc5a, 0x0468f62e, 0xfcbae002, 0x022817ca, 0xfec03901, 0x009ce6fe, 0xffc4b4a4, 0x000b49e6, 0x0005c149, 0xfff86686, 0x00048e7c, 0xfffe5d38, 0x6f9a6c7f, 0xfb723876, 0xfcf019cd, 0x050cad3f, 0xfadf1328, 0x04597b40, 0xfcc0252b, 0x0228516f, 0xfebdb547, 0x009fc954, 0xffc25f1a, 0x000cd2bd, 0x0004e926, 0xfff8c94c, 0x00046a4c, 0xfffe6716, 0x6f386cb6, 0xfabae8b2, 0xfd54215c, 0x04d229b1, 0xfaffbe36, 0x04498a72, 0xfcc5cc26, 0x022843f0, 0xfebb5f9b, 0x00a29136, 0xffc016cb, 0x000e5609, 0x000412c9, 0xfff92bc0, 0x00044612, 0xfffe70ff, 0x6ed1dd2e, 0xfa06d2ca, 0xfdb7a869, 0x04976e20, 0xfb20d8ad, 0x04392684, 0xfccbd3a0, 0x0227efc6, 0xfeb937f9, 0x00a53e7b, 0xffbddbe8, 0x000fd3a3, 0x00033e4c, 0xfff98dd6, 0x000421d2, 0xfffe7aef, 0x6e66c5ce, 0xf955fe0c, 0xfe1aa3fc, 0x045c8240, 0xfb425db0, 0x0428523d, 0xfcd23a3a, 0x02275572, 0xfeb73e54, 0x00a7d0ff, 0xffbbae9f, 0x00114b67, 0x00026bc6, 0xfff9ef80, 0x0003fd92, 0xfffe84e7, 0x6df72ed9, 0xf8a87178, 0xfe7d0942, 0x04216dc0, 0xfb64485b, 0x0417106e, 0xfcd8fe8b, 0x0226757e, 0xfeb5729b, 0x00aa48a0, 0xffb98f1c, 0x0012bd30, 0x00019b4e, 0xfffa50b1, 0x0003d957, 0xfffe8ee3, 0x6d8320e6, 0xf7fe33ba, 0xfedecd90, 0x03e63846, 0xfb8693c6, 0x040563f4, 0xfce01f21, 0x0225507c, 0xfeb3d4b7, 0x00aca542, 0xffb77d88, 0x001428db, 0x0000ccfc, 0xfffab15e, 0x0003b527, 0xfffe98e2, 0x6d0aa4e6, 0xf7574b2b, 0xff3fe663, 0x03aae970, 0xfba93b01, 0x03f34fb2, 0xfce79a7f, 0x0223e706, 0xfeb26489, 0x00aee6ca, 0xffb57a0b, 0x00158e47, 0x000000e6, 0xfffb117a, 0x00039108, 0xfffea2e1, 0x6c8dc41f, 0xf6b3bdd3, 0xffa04963, 0x036f88d2, 0xfbcc391d, 0x03e0d697, 0xfcef6f20, 0x022239bc, 0xfeb121ee, 0x00b10d23, 0xffb384ca, 0x0016ed53, 0xffff3721, 0xfffb70fa, 0x00036cfe, 0xfffeacdf, 0x6c0c882a, 0xf6139169, 0xffffec5f, 0x03341df4, 0xfbef8924, 0x03cdfb99, 0xfcf79b75, 0x02204949, 0xfeb00cbf, 0x00b3183c, 0xffb19de7, 0x001845e0, 0xfffe6fc3, 0xfffbcfd2, 0x00034910, 0xfffeb6db, 0x6b86faf8, 0xf576cb4e, 0x005ec552, 0x02f8b055, 0xfc13261f, 0x03bac1b4, 0xfd001de8, 0x021e165d, 0xfeaf24cc, 0x00b50805, 0xffafc584, 0x001997d0, 0xfffdaadf, 0xfffc2df6, 0x00032541, 0xfffec0d2, 0x6afd26cb, 0xf4dd7092, 0x00bcca63, 0x02bd4768, 0xfc370b14, 0x03a72bf0, 0xfd08f4d6, 0x021ba1b2, 0xfeae69e1, 0x00b6dc75, 0xffadfbbe, 0x001ae306, 0xfffce88b, 0xfffc8b5c, 0x00030196, 0xfffecac3, 0x6a6f1638, 0xf44785f1, 0x0119f1e4, 0x0281ea90, 0xfc5b3309, 0x03933d58, 0xfd121e99, 0x0218ec06, 0xfeaddbc4, 0x00b89584, 0xffac40b3, 0x001c2765, 0xfffc28d9, 0xfffce7f8, 0x0002de16, 0xfffed4ab, 0x69dcd425, 0xf3b50fd6, 0x01763256, 0x0246a125, 0xfc7f9902, 0x037ef900, 0xfd1b9980, 0x0215f621, 0xfead7a37, 0x00ba3330, 0xffaa947c, 0x001d64d5, 0xfffb6bdd, 0xfffd43c1, 0x0002bac4, 0xfffede8a, 0x69466bc8, 0xf3261255, 0x01d18265, 0x020b726f, 0xfca43803, 0x036a6201, 0xfd2563d3, 0x0212c0d2, 0xfead44f4, 0x00bbb579, 0xffa8f730, 0x001e9b3a, 0xfffab1a8, 0xfffd9eab, 0x000297a5, 0xfffee85e, 0x68abe8a8, 0xf29a9133, 0x022bd8ee, 0x01d065a8, 0xfcc90b12, 0x03557b7a, 0xfd2f7bd1, 0x020f4cec, 0xfead3bb2, 0x00bd1c63, 0xffa768e6, 0x001fca7d, 0xfff9fa4d, 0xfffdf8ae, 0x000274be, 0xfffef225, 0x680d5698, 0xf2128fde, 0x02852cfc, 0x019581f9, 0xfcee0d33, 0x03404890, 0xfd39dfb4, 0x020b9b4c, 0xfead5e22, 0x00be67f6, 0xffa5e9b1, 0x0020f288, 0xfff945dc, 0xfffe51be, 0x00025214, 0xfffefbde, 0x676ac1bb, 0xf18e1174, 0x02dd75ca, 0x015ace79, 0xfd133970, 0x032acc6d, 0xfd448dae, 0x0207acd4, 0xfeadabef, 0x00bf983d, 0xffa479a2, 0x00221344, 0xfff89465, 0xfffea9d2, 0x00022fa9, 0xffff0587, 0x66c4367d, 0xf10d18bd, 0x0334aac4, 0x0120522f, 0xfd388ad1, 0x03150a3f, 0xfd4f83eb, 0x0203826c, 0xfeae24c1, 0x00c0ad48, 0xffa318c7, 0x00232c9d, 0xfff7e5f9, 0xffff00e1, 0x00020d84, 0xffff0f1f, 0x6619c197, 0xf08fa82f, 0x038ac385, 0x00e6140f, 0xfd5dfc63, 0x02ff0538, 0xfd5ac08e, 0x01ff1d04, 0xfeaec838, 0x00c1a728, 0xffa1c72f, 0x00243e7f, 0xfff73aa7, 0xffff56e3, 0x0001eba8, 0xffff18a4, 0x656b700a, 0xf015c1ee, 0x03dfb7dd, 0x00ac1af9, 0xfd838938, 0x02e8c08e, 0xfd6641b8, 0x01fa7d91, 0xfeaf95f2, 0x00c285f4, 0xffa084e3, 0x002548d9, 0xfff6927e, 0xffffabcd, 0x0001ca18, 0xffff2215, 0x64b94f22, 0xef9f67cb, 0x04337fcb, 0x00726dbb, 0xfda92c63, 0x02d23f7a, 0xfd720581, 0x01f5a50d, 0xfeb08d86, 0x00c349c4, 0xff9f51eb, 0x00264b9a, 0xfff5ed8b, 0xffffff99, 0x0001a8da, 0xffff2b70, 0x64036c6f, 0xef2c9b43, 0x04861383, 0x0039130c, 0xfdcee0ff, 0x02bb8537, 0xfd7e09fc, 0x01f0947a, 0xfeb1ae87, 0x00c3f2b6, 0xff9e2e50, 0x002746b2, 0xfff54bdc, 0x0000523d, 0x000187f0, 0xffff34b6, 0x6349d5c9, 0xeebd5d81, 0x04d76b6b, 0x00001191, 0xfdf4a22a, 0x02a49505, 0xfd8a4d37, 0x01eb4cde, 0xfeb2f884, 0x00c480e9, 0xff9d1a14, 0x00283a12, 0xfff4ad7e, 0x0000a3b3, 0x0001675f, 0xffff3de3, 0x628c994c, 0xee51af5f, 0x0527801d, 0xffc76fd5, 0xfe1a6b08, 0x028d7223, 0xfd96cd3d, 0x01e5cf44, 0xfeb46b07, 0x00c4f480, 0xff9c1539, 0x002925ae, 0xfff4127d, 0x0000f3f1, 0x00014729, 0xffff46f7, 0x61cbc559, 0xede99165, 0x05764a68, 0xff8f344f, 0xfe4036c5, 0x02761fd3, 0xfda3880f, 0x01e01cbe, 0xfeb60596, 0x00c54da2, 0xff9b1fc1, 0x002a0979, 0xfff37ae4, 0x000142f1, 0x00012754, 0xffff4ff1, 0x61076890, 0xed8503c7, 0x05c3c34e, 0xff576560, 0xfe660094, 0x025ea157, 0xfdb07bb0, 0x01da3661, 0xfeb7c7b0, 0x00c58c79, 0xff9a39a9, 0x002ae568, 0xfff2e6bf, 0x000190ac, 0x000107e1, 0xffff58d0, 0x603f91d5, 0xed24066b, 0x060fe408, 0xff20094d, 0xfe8bc3ad, 0x0246f9f3, 0xfdbda61a, 0x01d41d4a, 0xfeb9b0d3, 0x00c5b132, 0xff9962ec, 0x002bb971, 0xfff25619, 0x0001dd1b, 0x0000e8d4, 0xffff6192, 0x5f745049, 0xecc698e6, 0x065aa604, 0xfee92646, 0xfeb17b53, 0x022f2cea, 0xfdcb0546, 0x01cdd297, 0xfebbc078, 0x00c5bbfc, 0xff989b85, 0x002c858d, 0xfff1c8fa, 0x00022837, 0x0000ca30, 0xffff6a38, 0x5ea5b34c, 0xec6cba79, 0x06a402e4, 0xfeb2c261, 0xfed722d0, 0x02173d81, 0xfdd89727, 0x01c7576d, 0xfebdf613, 0x00c5ad0a, 0xff97e36c, 0x002d49b4, 0xfff13f6c, 0x000271fa, 0x0000abf8, 0xffff72be, 0x5dd3ca7a, 0xec166a19, 0x06ebf483, 0xfe7ce399, 0xfefcb57a, 0x01ff2ef9, 0xfde659af, 0x01c0acf5, 0xfec05114, 0x00c58494, 0xff973a96, 0x002e05df, 0xfff0b977, 0x0002ba5f, 0x00008e30, 0xffff7b26, 0x5cfea5aa, 0xebc3a669, 0x073274f1, 0xfe478fd2, 0xff222eac, 0x01e70494, 0xfdf44acc, 0x01b9d45b, 0xfec2d0e8, 0x00c542d1, 0xff96a0f8, 0x002eba0a, 0xfff03724, 0x0003015f, 0x000070d9, 0xffff836d, 0x5c2654ed, 0xeb746dbe, 0x07777e74, 0xfe12ccd1, 0xff4789d1, 0x01cec194, 0xfe026869, 0x01b2ced1, 0xfec574f9, 0x00c4e7fe, 0xff961684, 0x002f6630, 0xffefb87a, 0x000346f6, 0x000053f7, 0xffff8b93, 0x5b4ae88d, 0xeb28be1f, 0x07bb0b8b, 0xfddea042, 0xff6cc25a, 0x01b66936, 0xfe10b06f, 0x01ab9d8b, 0xfec83caa, 0x00c47459, 0xff959b29, 0x00300a4f, 0xffef3d7f, 0x00038b1d, 0x0000378c, 0xffff9398, 0x5a6c7108, 0xeae09544, 0x07fd16eb, 0xfdab0fb6, 0xff91d3c6, 0x019dfeb6, 0xfe1f20c5, 0x01a441c2, 0xfecb275e, 0x00c3e824, 0xff952ed7, 0x0030a665, 0xffeec63a, 0x0003cdd1, 0x00001b9a, 0xffff9b7a, 0x598aff13, 0xea9bf097, 0x083d9b81, 0xfd7820a0, 0xffb6b99f, 0x0185854f, 0xfe2db74f, 0x019cbcb1, 0xfece3472, 0x00c343a4, 0xff94d178, 0x00313a72, 0xffee52b1, 0x00040f0d, 0x00000024, 0xffffa339, 0x58a6a397, 0xea5acd38, 0x087c9471, 0xfd45d856, 0xffdb6f7c, 0x016d0037, 0xfe3c71f1, 0x01950f98, 0xfed16342, 0x00c2871f, 0xff9482f8, 0x0031c677, 0xffede2e7, 0x00044ecb, 0xffffe52d, 0xffffaad3, 0x57bf6fae, 0xea1d27f7, 0x08b9fd18, 0xfd143c12, 0xfffff100, 0x015472a1, 0xfe4b4e8c, 0x018d3bb8, 0xfed4b325, 0x00c1b2e0, 0xff944340, 0x00324a74, 0xffed76e3, 0x00048d0a, 0xffffcab5, 0xffffb249, 0x56d574a2, 0xe9e2fd5b, 0x08f5d10a, 0xfce350f0, 0x002439db, 0x013bdfbc, 0xfe5a4b03, 0x01854258, 0xfed82370, 0x00c0c731, 0xff941236, 0x0032c66e, 0xffed0ea7, 0x0004c9c4, 0xffffb0bf, 0xffffb99a, 0x55e8c3ee, 0xe9ac49a0, 0x09300c14, 0xfcb31bec, 0x004845cc, 0x01234ab4, 0xfe696534, 0x017d24bf, 0xfedbb373, 0x00bfc463, 0xff93efbf, 0x00333a67, 0xffecaa36, 0x000504f6, 0xffff974d, 0xffffc0c5, 0x54f96f37, 0xe97908b8, 0x0968aa3b, 0xfc83a1e5, 0x006c10a0, 0x010ab6b0, 0xfe789b01, 0x0174e437, 0xfedf627d, 0x00beaac6, 0xff93dbc0, 0x0033a665, 0xffec4994, 0x00053e9e, 0xffff7e61, 0xffffc7ca, 0x54078851, 0xe9493649, 0x099fa7bb, 0xfc54e79a, 0x008f9631, 0x00f226d0, 0xfe87ea47, 0x016c820d, 0xfee32fdb, 0x00bd7aae, 0xff93d618, 0x00340a6d, 0xffebecc2, 0x000576b8, 0xffff65fc, 0xffffcea8, 0x53132138, 0xe91ccdb5, 0x09d5010b, 0xfc26f1ad, 0x00b2d26b, 0x00d99e31, 0xfe9750e8, 0x0163ff90, 0xfee71ad4, 0x00bc3470, 0xff93deaa, 0x00346687, 0xffeb93c3, 0x0005ad41, 0xffff4e20, 0xffffd55f, 0x521c4c10, 0xe8f3ca12, 0x0a08b2d9, 0xfbf9c49d, 0x00d5c147, 0x00c11feb, 0xfea6ccc3, 0x015b5e11, 0xfeeb22af, 0x00bad866, 0xff93f552, 0x0034babb, 0xffeb3e96, 0x0005e238, 0xffff36ce, 0xffffdbee, 0x51231b26, 0xe8ce2631, 0x0a3aba09, 0xfbcd64ca, 0x00f85ecf, 0x00a8af0c, 0xfeb65bb9, 0x01529ee3, 0xfeef46b0, 0x00b966e9, 0xff9419ef, 0x00350711, 0xffeaed3c, 0x00061599, 0xffff2007, 0xffffe255, 0x5027a0e9, 0xe8abdc9d, 0x0a6b13bc, 0xfba1d673, 0x011aa71d, 0x00904ea0, 0xfec5fbac, 0x0149c35a, 0xfef3861a, 0x00b7e055, 0xff944c5a, 0x00354b94, 0xffea9fb6, 0x00064764, 0xffff09ce, 0xffffe894, 0x4f29efed, 0xe88ce79a, 0x0a99bd47, 0xfb771db9, 0x013c965b, 0x007801aa, 0xfed5aa7e, 0x0140cccb, 0xfef7e02a, 0x00b6450a, 0xff948c6e, 0x0035884f, 0xffea5602, 0x00067797, 0xfffef421, 0xffffeeaa, 0x4e2a1ae8, 0xe871412a, 0x0ac6b43a, 0xfb4d3e97, 0x015e28c7, 0x005fcb26, 0xfee56614, 0x0137bc8f, 0xfefc541e, 0x00b49568, 0xff94da03, 0x0035bd4e, 0xffea1020, 0x0006a630, 0xfffedf04, 0xfffff498, 0x4d2834b0, 0xe858e30a, 0x0af1f65d, 0xfb243cea, 0x017f5aad, 0x0047ae09, 0xfef52c54, 0x012e93fc, 0xff00e133, 0x00b2d1d1, 0xff9534f0, 0x0035ea9d, 0xffe9ce0d, 0x0006d32f, 0xfffeca76, 0xfffffa5d, 0x4c245038, 0xe843c6b5, 0x0b1b81ad, 0xfafc1c6e, 0x01a0286c, 0x002fad3f, 0xff04fb25, 0x0125546c, 0xff0586a0, 0x00b0faaa, 0xff959d0a, 0x0036104b, 0xffe98fc8, 0x0006fe92, 0xfffeb678, 0xfffffff8, 0x4b1e8091, 0xe831e563, 0x0b435462, 0xfad4e0b9, 0x01c08e78, 0x0017cbae, 0xff14d073, 0x011bff38, 0xff0a439e, 0x00af1059, 0xff961224, 0x00362e66, 0xffe9554c, 0x00072859, 0xfffea30b, 0x0000056a, 0x4a16d8e5, 0xe823380d, 0x0b696ceb, 0xfaae8d43, 0x01e08952, 0x00000c33, 0xff24aa2a, 0x011295bb, 0xff0f1762, 0x00ad1346, 0xff969412, 0x003644fd, 0xffe91e99, 0x00075084, 0xfffe9030, 0x00000ab3, 0x490d6c79, 0xe817b76c, 0x0b8dc9ed, 0xfa89255f, 0x02001593, 0xffe871a0, 0xff348639, 0x0109194f, 0xff140121, 0x00ab03da, 0xff9722a5, 0x00365422, 0xffe8eba8, 0x00077712, 0xfffe7de7, 0x00000fd2, 0x48024ea7, 0xe80f5bfb, 0x0bb06a47, 0xfa64ac3f, 0x021f2fe5, 0xffd0fec1, 0xff446293, 0x00ff8b4f, 0xff19000e, 0x00a8e282, 0xff97bdac, 0x00365be6, 0xffe8bc77, 0x00079c04, 0xfffe6c2f, 0x000014c8, 0x46f592e2, 0xe80a1df5, 0x0bd14d0b, 0xfa4124f2, 0x023dd505, 0xffb9b656, 0xff543d2e, 0x00f5ed15, 0xff1e135b, 0x00a6afa8, 0xff9864f6, 0x00365c5b, 0xffe89101, 0x0007bf5b, 0xfffe5b0b, 0x00001994, 0x45e74cad, 0xe807f55b, 0x0bf07186, 0xfa1e9262, 0x025c01c5, 0xffa29b18, 0xff641402, 0x00ec3ffc, 0xff233a39, 0x00a46bbc, 0xff991851, 0x00365594, 0xffe8693f, 0x0007e116, 0xfffe4a79, 0x00001e37, 0x44d78fa0, 0xe808d9f1, 0x0c0dd738, 0xf9fcf758, 0x0279b30b, 0xff8bafb3, 0xff73e50e, 0x00e2855d, 0xff2873d6, 0x00a2172d, 0xff99d789, 0x003647a5, 0xffe8452d, 0x00080137, 0xfffe3a79, 0x000022b1, 0x43c66f62, 0xe80cc342, 0x0c297dd9, 0xf9dc567b, 0x0296e5d0, 0xff74f6cc, 0xff83ae52, 0x00d8be92, 0xff2dbf61, 0x009fb26c, 0xff9aa268, 0x003632a2, 0xffe824c5, 0x00081fbf, 0xfffe2b0d, 0x00002701, 0x42b3ffa9, 0xe813a89f, 0x0c436557, 0xf9bcb24a, 0x02b39724, 0xff5e72fb, 0xff936dd2, 0x00ceecf5, 0xff331c08, 0x009d3deb, 0xff9b78ba, 0x003616a2, 0xffe807ff, 0x00083cb0, 0xfffe1c32, 0x00002b28, 0x41a05437, 0xe81d8122, 0x0c5b8dd4, 0xf99e0d26, 0x02cfc429, 0xff4826cf, 0xffa3219a, 0x00c511dc, 0xff3888f8, 0x009aba1d, 0xff9c5a47, 0x0035f3b9, 0xffe7eed5, 0x0008580a, 0xfffe0dea, 0x00002f26, 0x408b80d9, 0xe82a43ac, 0x0c71f7a9, 0xf980694a, 0x02eb6a18, 0xff3214c9, 0xffb2c7b6, 0x00bb2e9f, 0xff3e055d, 0x00982778, 0xff9d46d6, 0x0035ca00, 0xffe7d93f, 0x000871cf, 0xfffe0034, 0x000032fb, 0x3f759967, 0xe839e6e9, 0x0c86a361, 0xf963c8cc, 0x03068640, 0xff1c3f63, 0xffc25e3b, 0x00b14493, 0xff439064, 0x0095866f, 0xff9e3e30, 0x0035998d, 0xffe7c735, 0x00088a02, 0xfffdf310, 0x000036a8, 0x3e5eb1bd, 0xe84c6152, 0x0c9991be, 0xf9482da0, 0x03211603, 0xff06a907, 0xffd1e340, 0x00a7550c, 0xff492937, 0x0092d77b, 0xff9f4019, 0x00356279, 0xffe7b8af, 0x0008a0a5, 0xfffde67c, 0x00003a2d, 0x3d46ddc1, 0xe861a92b, 0x0caac3b5, 0xf92d9997, 0x033b16dc, 0xfef15417, 0xffe154e3, 0x009d615d, 0xff4ecf02, 0x00901b11, 0xffa04c57, 0x003524dd, 0xffe7ada5, 0x0008b5ba, 0xfffdda79, 0x00003d89, 0x3c2e315a, 0xe879b487, 0x0cba3a6d, 0xf9140e5e, 0x03548659, 0xfedc42e7, 0xfff0b148, 0x00936ad6, 0xff5480f0, 0x008d51ab, 0xffa162ae, 0x0034e0d3, 0xffe7a60d, 0x0008c944, 0xfffdcf05, 0x000040be, 0x3b14c072, 0xe8947947, 0x0cc7f742, 0xf8fb8d7d, 0x036d621f, 0xfec777be, 0xfffff697, 0x008972c7, 0xff5a3e2c, 0x008a7bc1, 0xffa282e1, 0x00349674, 0xffe7a1de, 0x0008db46, 0xfffdc421, 0x000043cc, 0x39fa9ef3, 0xe8b1ed1c, 0x0cd3fbc0, 0xf8e4185a, 0x0385a7eb, 0xfeb2f4d9, 0x000f22fe, 0x007f7a7c, 0xff6005e1, 0x008799cd, 0xffa3acb4, 0x003445dc, 0xffe7a10d, 0x0008ebc1, 0xfffdb9cb, 0x000046b2, 0x38dfe0c6, 0xe8d2058b, 0x0cde49a8, 0xf8cdb036, 0x039d558e, 0xfe9ebc66, 0x001e34b4, 0x00758341, 0xff65d73a, 0x0084ac48, 0xffa4dfe8, 0x0033ef25, 0xffe7a391, 0x0008fabb, 0xfffdb002, 0x00004972, 0x37c499d0, 0xe8f4b7e9, 0x0ce6e2ea, 0xf8b85631, 0x03b468f1, 0xfe8ad087, 0x002d29f3, 0x006b8e5c, 0xff6bb163, 0x0081b3af, 0xffa61c3e, 0x0033926d, 0xffe7a95f, 0x00090836, 0xfffda6c5, 0x00004c0b, 0x36a8ddf3, 0xe919f961, 0x0cedc9a7, 0xf8a40b44, 0x03cae014, 0xfe773351, 0x003c00fd, 0x00619d15, 0xff719388, 0x007eb07b, 0xffa76176, 0x00332fcf, 0xffe7b26c, 0x00091435, 0xfffd9e13, 0x00004e7f, 0x358cc109, 0xe941bef3, 0x0cf30031, 0xf890d048, 0x03e0b90d, 0xfe63e6cb, 0x004ab81b, 0x0057b0ae, 0xff777cd6, 0x007ba32a, 0xffa8af51, 0x0032c769, 0xffe7bead, 0x00091ebd, 0xfffd95eb, 0x000050cd, 0x347056e3, 0xe96bfd76, 0x0cf6890a, 0xf87ea5f1, 0x03f5f20a, 0xfe50ecf0, 0x00594d9d, 0x004dca68, 0xff7d6c79, 0x00788c36, 0xffaa058d, 0x00325958, 0xffe7ce16, 0x000927d1, 0xfffd8e4d, 0x000052f7, 0x3353b349, 0xe998a999, 0x0cf866e1, 0xf86d8cd1, 0x040a894e, 0xfe3e47ac, 0x0067bfd8, 0x0043eb7f, 0xff83619f, 0x00756c1d, 0xffab63ea, 0x0031e5ba, 0xffe7e09c, 0x00092f75, 0xfffd8735, 0x000054fc, 0x3236e9f7, 0xe9c7b7e3, 0x0cf89c96, 0xf85d8555, 0x041e7d34, 0xfe2bf8de, 0x00760d2a, 0x003a152f, 0xff895b77, 0x0072435b, 0xffacca25, 0x00316cae, 0xffe7f631, 0x000935ad, 0xfffd80a4, 0x000056dd, 0x311a0e9b, 0xe9f91cb9, 0x0cf72d34, 0xf84e8fc9, 0x0431cc31, 0xfe1a0256, 0x008433f9, 0x003048ae, 0xff8f5930, 0x006f126b, 0xffae37fd, 0x0030ee53, 0xffe80eca, 0x00093a7f, 0xfffd7a98, 0x0000589b, 0x2ffd34d4, 0xea2ccc59, 0x0cf41bf7, 0xf840ac57, 0x044474ce, 0xfe0865d7, 0x009232b2, 0x0026872f, 0xff9559fb, 0x006bd9cd, 0xffafad2e, 0x00306ac8, 0xffe82a59, 0x00093ded, 0xfffd750f, 0x00005a36, 0x2ee07030, 0xea62bae0, 0x0cef6c43, 0xf833db04, 0x045675ab, 0xfdf72515, 0x00a007c9, 0x001cd1e4, 0xff9b5d0a, 0x006899fb, 0xffb12976, 0x002fe22c, 0xffe848d3, 0x00093ffe, 0xfffd7008, 0x00005baf, 0x2dc3d429, 0xea9adc49, 0x0ce921ab, 0xf8281bb6, 0x0467cd83, 0xfde641b7, 0x00adb1bb, 0x001329f7, 0xffa16190, 0x00655372, 0xffb2ac90, 0x002f54a1, 0xffe86a29, 0x000940b6, 0xfffd6b81, 0x00005d06, 0x2ca77428, 0xead52471, 0x0ce13feb, 0xf81d6e2e, 0x04787b24, 0xfdd5bd53, 0x00bb2f0b, 0x00099093, 0xffa766c0, 0x006206b1, 0xffb4363a, 0x002ec246, 0xffe88e4d, 0x00094019, 0xfffd6779, 0x00005e3d, 0x2b8b637b, 0xeb118714, 0x0cd7caec, 0xf813d20d, 0x04887d76, 0xfdc59972, 0x00c87e47, 0x000006db, 0xffad6bd0, 0x005eb431, 0xffb5c630, 0x002e2b3c, 0xffe8b532, 0x00093e2e, 0xfffd63ed, 0x00005f52, 0x2a6fb55e, 0xeb4ff7d4, 0x0cccc6bc, 0xf80b46d3, 0x0497d378, 0xfdb5d78f, 0x00d59e03, 0xfff68df1, 0xffb36ff9, 0x005b5c71, 0xffb75c2c, 0x002d8fa4, 0xffe8decb, 0x00093af8, 0xfffd60dd, 0x00006048, 0x29547ced, 0xeb906a35, 0x0cc03797, 0xf803cbdc, 0x04a67c41, 0xfda67913, 0x00e28cdd, 0xffed26f0, 0xffb97271, 0x0057ffec, 0xffb8f7ea, 0x002cefa1, 0xffe90b08, 0x0009367e, 0xfffd5e46, 0x0000611f, 0x2839cd30, 0xebd2d1a1, 0x0cb221de, 0xf7fd6065, 0x04b476fe, 0xfd977f5d, 0x00ef497a, 0xffe3d2f2, 0xffbf7274, 0x00549f1c, 0xffba9927, 0x002c4b53, 0xffe939db, 0x000930c4, 0xfffd5c26, 0x000061d8, 0x271fb90d, 0xec17216b, 0x0ca28a1a, 0xf7f8038c, 0x04c1c2f3, 0xfd88ebb9, 0x00fbd28a, 0xffda930a, 0xffc56f3e, 0x00513a7e, 0xffbc3f9d, 0x002ba2dc, 0xffe96b35, 0x000929d1, 0xfffd5a7c, 0x00006272, 0x2606534e, 0xec5d4ccd, 0x0c9174fa, 0xf7f3b44b, 0x04ce5f7d, 0xfd7abf64, 0x010826c4, 0xffd16848, 0xffcb680e, 0x004dd28c, 0xffbdeb07, 0x002af65f, 0xffe99f08, 0x000921aa, 0xfffd5945, 0x000062f0, 0x24edae9c, 0xeca546eb, 0x0c7ee754, 0xf7f0717e, 0x04da4c10, 0xfd6cfb8e, 0x011444e7, 0xffc853b6, 0xffd15c22, 0x004a67c0, 0xffbf9b21, 0x002a45fe, 0xffe9d545, 0x00091854, 0xfffd5880, 0x00006351, 0x23d5dd81, 0xecef02d5, 0x0c6ae622, 0xf7ee39e2, 0x04e58836, 0xfd5fa157, 0x01202bbe, 0xffbf565a, 0xffd74abe, 0x0046fa93, 0xffc14fa5, 0x002991db, 0xffea0ddc, 0x00090dd6, 0xfffd582a, 0x00006396, 0x22bef262, 0xed3a7388, 0x0c557681, 0xf7ed0c12, 0x04f01392, 0xfd52b1cf, 0x012bda1b, 0xffb67137, 0xffdd3325, 0x00438b7e, 0xffc3084f, 0x0028da1a, 0xffea48be, 0x00090236, 0xfffd5842, 0x000063c0, 0x21a8ff7e, 0xed878bf0, 0x0c3e9db5, 0xf7ece68c, 0x04f9edda, 0xfd462df6, 0x01374eda, 0xffada547, 0xffe3149e, 0x00401af9, 0xffc4c4da, 0x00281edd, 0xffea85dc, 0x0008f57a, 0xfffd58c5, 0x000063d0, 0x209416f2, 0xedd63ee5, 0x0c26611f, 0xf7edc7af, 0x050316e0, 0xfd3a16c0, 0x014288e0, 0xffa4f383, 0xffe8ee72, 0x003ca97b, 0xffc68502, 0x00276046, 0xffeac525, 0x0008e7a7, 0xfffd59b2, 0x000063c6, 0x1f804ab0, 0xee267f35, 0x0c0cc646, 0xf7efadbd, 0x050b8e8a, 0xfd2e6d0d, 0x014d871b, 0xff9c5cdc, 0xffeebfec, 0x0039377a, 0xffc84881, 0x00269e7a, 0xffeb068a, 0x0008d8c4, 0xfffd5b05, 0x000063a3, 0x1e6dac83, 0xee783f9e, 0x0bf1d2d0, 0xf7f296d7, 0x051354d5, 0xfd2331b0, 0x01584883, 0xff93e241, 0xfff48859, 0x0035c56c, 0xffca0f14, 0x0025d99b, 0xffeb49fc, 0x0008c8d7, 0xfffd5cbe, 0x00006368, 0x1d5c4e09, 0xeecb72d1, 0x0bd58c81, 0xf7f68103, 0x051a69d4, 0xfd18656f, 0x0162cc19, 0xff8b8498, 0xfffa470a, 0x003253c6, 0xffcbd876, 0x002511cd, 0xffeb8f6a, 0x0008b7e7, 0xfffd5ed8, 0x00006316, 0x1c4c40b6, 0xef200b76, 0x0bb7f940, 0xf7fb6a29, 0x0520cdb1, 0xfd0e08fb, 0x016d10e9, 0xff8344c4, 0xfffffb51, 0x002ee2fa, 0xffcda463, 0x00244733, 0xffebd6c4, 0x0008a5fa, 0xfffd6154, 0x000062ad, 0x1b3d95d1, 0xef75fc2b, 0x0b991f0f, 0xf8015015, 0x052680ae, 0xfd041cfa, 0x01771608, 0xff7b23a1, 0x0005a483, 0x002b737b, 0xffcf7299, 0x002379ef, 0xffec1ffa, 0x00089316, 0xfffd642d, 0x0000622e, 0x1a305e70, 0xefcd3787, 0x0b79040c, 0xf8083077, 0x052b8320, 0xfcfaa200, 0x0180da94, 0xff732209, 0x000b41fa, 0x002805ba, 0xffd142d3, 0x0022aa26, 0xffec6afc, 0x00087f43, 0xfffd6762, 0x0000619a, 0x1924ab7b, 0xf025b01a, 0x0b57ae75, 0xf81008e2, 0x052fd573, 0xfcf19894, 0x018a5db5, 0xff6b40cb, 0x0010d30e, 0x00249a28, 0xffd314cf, 0x0021d7fa, 0xffecb7b9, 0x00086a86, 0xfffd6af1, 0x000060f1, 0x181a8da5, 0xf07f586e, 0x0b3524a0, 0xf818d6cf, 0x0533782a, 0xfce9012c, 0x01939e9e, 0xff6380b5, 0x00165720, 0x00213134, 0xffd4e84a, 0x00210390, 0xffed0621, 0x000854e6, 0xfffd6ed6, 0x00006035, 0x17121573, 0xf0da230b, 0x0b116cff, 0xf822979b, 0x05366bdc, 0xfce0dc2f, 0x019c9c8b, 0xff5be28d, 0x001bcd8e, 0x001dcb4a, 0xffd6bd01, 0x00202d09, 0xffed5624, 0x00083e6a, 0xfffd7310, 0x00005f66, 0x160b5331, 0xf1360276, 0x0aec8e1c, 0xf82d488c, 0x0538b136, 0xfcd929f4, 0x01a556c1, 0xff546713, 0x002135bd, 0x001a68d8, 0xffd892b4, 0x001f5489, 0xffeda7b1, 0x00082718, 0xfffd779d, 0x00005e84, 0x150656f8, 0xf192e932, 0x0ac68e9b, 0xf838e6c9, 0x053a48fa, 0xfcd1eac3, 0x01adcc91, 0xff4d0f02, 0x00268f13, 0x00170a47, 0xffda6921, 0x001e7a33, 0xffedfab8, 0x00080ef7, 0xfffd7c7a, 0x00005d92, 0x140330a9, 0xf1f0c9c5, 0x0a9f7537, 0xf8456f65, 0x053b3400, 0xfccb1ed7, 0x01b5fd54, 0xff45db10, 0x002bd8fa, 0x0013b003, 0xffdc4007, 0x001d9e2a, 0xffee4f29, 0x0007f60f, 0xfffd81a4, 0x00005c8e, 0x1301efed, 0xf24f96b5, 0x0a7748c0, 0xf852df56, 0x053b7332, 0xfcc4c658, 0x01bde86f, 0xff3ecbea, 0x003112e0, 0x00105a72, 0xffde1726, 0x001cc091, 0xffeea4f2, 0x0007dc65, 0xfffd8719, 0x00005b7b, 0x1202a434, 0xf2af428c, 0x0a4e101f, 0xf861337c, 0x053b0791, 0xfcbee162, 0x01c58d50, 0xff37e23b, 0x00363c35, 0x000d09fc, 0xffdfee3f, 0x001be18a, 0xffeefc04, 0x0007c201, 0xfffd8cd7, 0x00005a58, 0x11055cb4, 0xf30fbfd7, 0x0a23d24e, 0xf870689f, 0x0539f231, 0xfcb97001, 0x01cceb6e, 0xff311ea4, 0x003b546b, 0x0009bf05, 0xffe1c511, 0x001b0138, 0xffef544e, 0x0007a6e9, 0xfffd92db, 0x00005927, 0x100a2864, 0xf371012c, 0x09f8965d, 0xf8807b70, 0x0538343a, 0xfcb47232, 0x01d4024c, 0xff2a81c4, 0x00405afa, 0x000679f2, 0xffe39b60, 0x001a1fbc, 0xffefadc0, 0x00078b24, 0xfffd9923, 0x000057e9, 0x0f111603, 0xf3d2f926, 0x09cc636e, 0xf8916889, 0x0535cee9, 0xfcafe7e2, 0x01dad175, 0xff240c2f, 0x00454f5d, 0x00033b23, 0xffe570ed, 0x00193d3a, 0xfff00849, 0x00076eba, 0xfffd9fac, 0x0000569d, 0x0e1a340d, 0xf4359a6a, 0x099f40b5, 0xf8a32c6e, 0x0532c38c, 0xfcabd0f2, 0x01e15880, 0xff1dbe77, 0x004a310f, 0x000002f9, 0xffe7457c, 0x001859d2, 0xfff063d9, 0x000751b0, 0xfffda675, 0x00005545, 0x0d2590c3, 0xf498d7a5, 0x09713575, 0xf8b5c38d, 0x052f1386, 0xfca82d32, 0x01e7970e, 0xff179926, 0x004eff94, 0xfffcd1d3, 0xffe918ce, 0x001775a7, 0xfff0c060, 0x0007340d, 0xfffdad79, 0x000053e2, 0x0c333a22, 0xf4fca390, 0x09424904, 0xf8c92a41, 0x052ac04c, 0xfca4fc64, 0x01ed8cc7, 0xff119cc0, 0x0053ba6e, 0xfff9a80d, 0xffeaeaab, 0x001690d9, 0xfff11dcd, 0x000715d9, 0xfffdb4b9, 0x00005274, }; }
183.723776
199
0.798535
5b0468480a58f7c0f220ad8e0c24706d64ca66f9
272
h
C
mame/src/lib/expat/intconfig.h
nitrologic/emu
be2c9b72d81c3aea85ad4fd18fa4f731b31f338a
[ "Unlicense" ]
51
2015-11-22T14:53:28.000Z
2021-12-14T07:17:42.000Z
mame/src/lib/expat/intconfig.h
nitrologic/emu
be2c9b72d81c3aea85ad4fd18fa4f731b31f338a
[ "Unlicense" ]
8
2018-01-14T07:19:06.000Z
2021-08-22T15:29:59.000Z
mame/src/lib/expat/intconfig.h
nitrologic/emu
be2c9b72d81c3aea85ad4fd18fa4f731b31f338a
[ "Unlicense" ]
35
2017-02-15T09:39:00.000Z
2021-12-14T07:17:43.000Z
#ifndef INTCONFIG_H #define INTCONFIG_H #include <stdlib.h> #include <string.h> #define XML_NS 1 #define XML_DTD 1 #define XML_CONTEXT_BYTES 1024 #ifdef USE_LSB #define BYTEORDER 1234 #else #define BYTEORDER 4321 #endif #define HAVE_MEMMOVE #endif
13.6
31
0.727941
126f520c66b78968dea8b25277fa2199bba34836
27,107
c
C
common/shadebit.c
luvitred/dallas-sdk
fa2d7aedf79d5977dfadd63696a2a753640ab7a0
[ "MIT" ]
null
null
null
common/shadebit.c
luvitred/dallas-sdk
fa2d7aedf79d5977dfadd63696a2a753640ab7a0
[ "MIT" ]
null
null
null
common/shadebit.c
luvitred/dallas-sdk
fa2d7aedf79d5977dfadd63696a2a753640ab7a0
[ "MIT" ]
null
null
null
//--------------------------------------------------------------------------- // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice 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 DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES // OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // // Except as contained in this notice, the name of Dallas Semiconductor // shall not be used except as stated in the Dallas Semiconductor // Branding Policy. //--------------------------------------------------------------------------- // // shadebit.c - Transaction-level functions for SHA Debits without a // hardware coprocessor. Also, this file contains some // Protocol-level functions to replace their 'hardware-only' // counterparts.. // // Version: 2.10 #include "shaib.h" #define MAX_RETRY_CNT 255 //------------------------------------------------------------------------- // Returns the user's current balance as an int // // 'user' - Structure for holding user token information. // // Return: Current value of the user's balance. // int GetBalance(SHAUser* user) { int balance = -1; if(user->devAN[0]==0x18) balance = BytesToInt(((DebitFile*)user->accountFile)->balanceBytes, 3); else if((user->devAN[0]&0x7F)==0x33) { DebitFile33* acctFile = (DebitFile33*)user->accountFile; if(acctFile->fileLength==RECORD_A_LENGTH) balance = BytesToInt(acctFile->balanceBytes_A, 3); else if(acctFile->fileLength==RECORD_B_LENGTH) balance = BytesToInt(acctFile->balanceBytes_B, 3); else OWERROR(OWERROR_BAD_SERVICE_DATA); } else OWERROR(OWERROR_BAD_SERVICE_DATA); return balance; } //------------------------------------------------------------------------- // Installs new service data on a user token. // // 'copr' - Structure for holding coprocessor information. // 'user' - Structure for holding user token information. // 'secret' - the authentication secret to install on user token. // // Return: If TRUE, new service installation succeeded. // If FALSE, an error occurred. // SMALLINT InstallServiceData(SHACopr* copr, SHAUser* user, uchar* secret, int secret_length, int initialBalance) { short handle; int maxwrite; FileEntry fe; uchar fullBindCode[15]; //make sure user has a file directory structure memcpy(fe.Name, copr->serviceFilename, 4); fe.Ext = copr->serviceFilename[4]; // install master authentication secret if(user->devAN[0]==0x18) { //need to format the device if(!owFormat(user->portnum, user->devAN)) return FALSE; //and create an empty stub for his account information if(!owCreateFile(user->portnum, user->devAN, &maxwrite, &handle, &fe)) return FALSE; //need to know what page the stub is on user->accountPageNumber = fe.Spage; // set the serial number to that of the user owSerialNum(user->portnum, user->devAN, FALSE); OWASSERT( InstallSystemSecret18(user->portnum, user->accountPageNumber, user->accountPageNumber&7, secret, secret_length, FALSE), OWERROR_INSTALL_SECRET_FAILED, FALSE ); } else if((user->devAN[0]&0x7F)==0x33) { // set the serial number to that of the user owSerialNum(user->portnum, user->devAN, FALSE); //because of copy-authorization, we need to install the //secret first on the DS1961S and _then_ format the system OWASSERT( InstallSystemSecret33(user->portnum, 0, 0, secret, secret_length, FALSE), OWERROR_INSTALL_SECRET_FAILED, FALSE ); //need to format the device if(!owFormat(user->portnum, user->devAN)) return FALSE; //and create an empty stub for his account information if(!owCreateFile(user->portnum, user->devAN, &maxwrite, &handle, &fe)) return FALSE; //need to know what page the stub is on user->accountPageNumber = fe.Spage; } else { return FALSE; } // format the bind code properly // first four bytes of bind code memcpy(fullBindCode, copr->bindCode, 4); // followed by the pagenumber fullBindCode[4] = (uchar)user->accountPageNumber; // and 7 bytes of the address of current device memcpy(&fullBindCode[5], user->devAN, 7); // followed by the last 3 bytes of bind code memcpy(&fullBindCode[12], &(copr->bindCode[4]), 3); // create a unique secret for iButton if(user->devAN[0]==0x18) { DebitFile* accountFile = (DebitFile*)user->accountFile; OWASSERT( BindSecretToiButton18(user->portnum, user->accountPageNumber, user->accountPageNumber&7, copr->bindData, fullBindCode, TRUE), OWERROR_BIND_SECRET_FAILED, FALSE ); // do a read just to get value of writecycle counter user->writeCycleCounter = ReadAuthPageSHA18(user->portnum, user->accountPageNumber, user->accountFile, NULL, TRUE); //setup user account file with initial balance IntToBytes(accountFile->balanceBytes,3,initialBalance); // set transaction ID accountFile->transID[0] = 0; accountFile->transID[0] = 0; } else if((user->devAN[0]&0x7F)==0x33) { DebitFile33* accountFile33 = (DebitFile33*)user->accountFile; OWASSERT( BindSecretToiButton33(user->portnum, user->accountPageNumber, 0, copr->bindData, fullBindCode, TRUE), OWERROR_BIND_SECRET_FAILED, FALSE ); // Call VerifyUser just to get the user's secret in wspc if(!VerifyUser(copr, user, TRUE)) return FALSE; //Record A //setup user account file with initial balance IntToBytes(accountFile33->balanceBytes_A,3,initialBalance); // set transaction ID accountFile33->transID_A[0] = 0; accountFile33->transID_A[0] = 0; //Record B //setup user account file with initial balance IntToBytes(accountFile33->balanceBytes_B,3,initialBalance); // set transaction ID accountFile33->transID_B[0] = 0; accountFile33->transID_B[0] = 0; } //sign the data with coprocessor and write it out return UpdateServiceData(copr, user); } //------------------------------------------------------------------------- // Updates service data on a user token. This includes signing the // data if the part is a DS1963S. // // 'copr' - Structure for holding coprocessor information. // 'user' - Structure for holding user token information. // // Return: If TRUE, update succeeded. // If FALSE, an error occurred. // SMALLINT UpdateServiceData(SHACopr* copr, SHAUser* user) { ushort crc16; int i; uchar scratchpad[32]; if(user->devAN[0] == 0x18) { DebitFile* accountFile = (DebitFile*)user->accountFile; // make sure length is right. accountFile->fileLength = 29; // update transaction ID // doesn't matter what it is, just needs to change accountFile->transID[0] += 1; if(accountFile->transID[0]==0) accountFile->transID[1] += 1; // conversion factor - 2 data bytes accountFile->convFactor[0] = (uchar)0x8B; accountFile->convFactor[1] = (uchar)0x48; // clear out the old signature and CRC memcpy(accountFile->signature, copr->initSignature, 20); memset(accountFile->crc16, 0x00, 2); // reset data type code accountFile->dataTypeCode = 1; //file doesn't continue on another page accountFile->contPtr = 0; // --- Set up the scratchpad for signing memset(scratchpad, 0x00, 32); // the write cycle counter +1 (since we are about to write this to it) if(user->writeCycleCounter>0) IntToBytes(&scratchpad[8], 4, user->writeCycleCounter+1); else // user doesn't have write cycle counter (DS1961S) memset(&scratchpad[8], 0x0FF, 4); // the pagenumber scratchpad[12] = (uchar)user->accountPageNumber; // and 7 bytes of the address of current device memcpy(&scratchpad[13], user->devAN, 7); // the coprocessor's signing challenge memcpy(&scratchpad[20], copr->signChlg, 3); OWASSERT( CreateDataSignature(copr, user->accountFile, scratchpad, accountFile->signature, TRUE), OWERROR_SIGN_SERVICE_DATA_FAILED, FALSE ); //add the crc at the end of the data. setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < 30; i++) crc16 = docrc16(user->portnum,user->accountFile[i]); crc16 = ~crc16; accountFile->crc16[0] = (uchar)crc16; accountFile->crc16[1] = (uchar)(crc16>>8); } else if((user->devAN[0]&0x7F)==0x33) { DebitFile33* accountFile33 = (DebitFile33*)user->accountFile; // conversion factor - 2 data bytes accountFile33->convFactor[0] = (uchar)0x8B; accountFile33->convFactor[1] = (uchar)0x48; // reset data type code accountFile33->dataTypeCode = 1; if(accountFile33->fileLength==RECORD_A_LENGTH) { // Switch to Record B accountFile33->fileLength = RECORD_B_LENGTH; // update transaction ID // doesn't matter what it is, just needs to change accountFile33->transID_B[0] += 1; if(accountFile33->transID_B[0]==0) accountFile33->transID_B[1] += 1; //file doesn't continue on another page accountFile33->contPtr_B = 0; // clear out the old CRC memset(accountFile33->crc16_B, 0x00, 2); //add the crc at the end of the data. setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < RECORD_B_LENGTH+1; i++) crc16 = docrc16(user->portnum,user->accountFile[i]); crc16 = ~crc16; accountFile33->crc16_B[0] = (uchar)crc16; accountFile33->crc16_B[1] = (uchar)(crc16>>8); } else { // Switch to Record B accountFile33->fileLength = RECORD_A_LENGTH; // update transaction ID // doesn't matter what it is, just needs to change accountFile33->transID_A[0] += 1; if(accountFile33->transID_A[0]==0) accountFile33->transID_A[1] += 1; //file doesn't continue on another page accountFile33->contPtr_A = 0; // clear out the old CRC memset(accountFile33->crc16_A, 0x00, 2); //add the crc at the end of the data. setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < RECORD_A_LENGTH+1; i++) crc16 = docrc16(user->portnum,user->accountFile[i]); crc16 = ~crc16; accountFile33->crc16_A[0] = (uchar)crc16; accountFile33->crc16_A[1] = (uchar)(crc16>>8); } } // set the serial number to that of the user owSerialNum(user->portnum, user->devAN, FALSE); if(user->devAN[0]==0x18) { //DS1963S - not too tough OWASSERT( WriteDataPageSHA18(user->portnum, user->accountPageNumber, user->accountFile, FALSE), OWERROR_WRITE_DATA_PAGE_FAILED, FALSE ); } else if((user->devAN[0]&0x7F)==0x33) { //DS1961S - a bit tougher //assumes sign_secret for this coprocessor already has //the user's unique secret installed OWASSERT( WriteDataPageSHA33(copr, user), OWERROR_WRITE_DATA_PAGE_FAILED, FALSE ); } else return FALSE; return TRUE; } //---------------------------------------------------------------------- // Writes the contents of the user's account file to the page specified // by the user's account page number for DS1961. // // 'copr' - Structure for holding coprocessor information. // 'user' - Structure for holding user token information. // // Return: TRUE - Write successfull // FALSE - error occurred during write. // SMALLINT WriteDataPageSHA33(SHACopr* copr, SHAUser* user) { uchar pageContents[32], data[32], scratchpad[32], MAC[20]; int addr = user->accountPageNumber << 5; int i; OWASSERT( ReadMemoryPageSHA33(user->portnum, user->accountPageNumber, pageContents, FALSE), OWERROR_READ_MEMORY_PAGE_FAILED, FALSE ); for(i=24; i>=0; i-=8) { if(memcmp(&pageContents[i],&user->accountFile[i],8) != 0) { //PrintHexLabeled("Current Page contents", pageContents, 32); //PrintHexLabeled(" 8 bytes to replace", &pageContents[i], 8); //PrintHexLabeled(" with these 8 bytes", &user->accountFile[i], 8); memcpy(data, pageContents, 28); memcpy(&data[28], &user->accountFile[i], 4); memcpy(&scratchpad[8], &user->accountFile[i+4], 4); scratchpad[12] = (uchar)(user->accountPageNumber&0x3F); memcpy(&scratchpad[13], user->devAN, 7); memset(&scratchpad[20], 0xFF, 3); // this function changes the serial number to that of copr OWASSERT( CreateDataSignature(copr, data, scratchpad, MAC, TRUE), OWERROR_SIGN_SERVICE_DATA_FAILED, FALSE); // set the serial number back to that of the user owSerialNum(user->portnum, user->devAN, FALSE); OWASSERT( WriteScratchpadSHA33(user->portnum, addr+i, &user->accountFile[i], FALSE), OWERROR_WRITE_SCRATCHPAD_FAILED, FALSE ); OWASSERT( CopyScratchpadSHA33(user->portnum, addr+i, MAC, TRUE), OWERROR_COPY_SCRATCHPAD_FAILED, FALSE ); memcpy(&pageContents[i], &user->accountFile[i], 8); } } return TRUE; } //------------------------------------------------------------------------- // Verifies a user token as a valid member of the system. First, a random // challenge is generated. Then, the user must answer that challenge. // The user's response signature is then verified against the proper // response.. // // 'copr' - Structure for holding coprocessor information. // 'user' - Structure for holding user token information. // 'doBind' - if true, the user's unique secret is recreated on the // coprocessor. If this function is called multiple times, // it is acceptable to skip the bind for all calls after // the first on the same user token. // // Return: If TRUE, user was verified. // If FALSE, an error occurred or user verification failed. // SMALLINT VerifyUser(SHACopr* copr, SHAUser* user, SMALLINT doBind) { uchar chlg[3]; OWASSERT( CreateChallenge(copr, 1, chlg, 0), OWERROR_CREATE_CHALLENGE_FAILED, FALSE ); OWASSERT( AnswerChallenge(user, chlg)>=0, OWERROR_ANSWER_CHALLENGE_FAILED, FALSE ); if(!VerifyAuthResponse(copr, user, chlg, doBind)) { OWERROR(OWERROR_VERIFY_AUTH_RESPONSE_FAILED); if((user->devAN[0]&0x7F)==0x33) RefreshPage33(user->portnum, user->accountPageNumber, FALSE); return FALSE; } return TRUE; } //------------------------------------------------------------------------- // Verifies service data on a user token as a valid member of the system. // Pre-condition: must call verify user first. // // 'copr' - Structure for holding coprocessor information. // 'user' - Structure for holding user token information. // // Return: If TRUE, data was verified. // If FALSE, an error occurred or data verification failed. // SMALLINT VerifyData(SHACopr* copr, SHAUser* user) { uchar scratchpad[32]; DebitFile acctFile; ushort lastcrc16, i; // Check the CRC of the file setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < user->accountFile[0]+3; i++) lastcrc16 = docrc16(user->portnum,user->accountFile[i]); if((user->devAN[0]&0x7F)==0x33) { // save the original file length uchar origPtr = user->accountFile[0]; SMALLINT validA = FALSE, validB = FALSE, validPtr = FALSE; // is the file length a valid value if(origPtr==RECORD_A_LENGTH || origPtr==RECORD_B_LENGTH) validPtr = TRUE; // was the crc of the file correct? if(lastcrc16==0xB001) { // if the header points to a valid record, we're done if(validPtr) { // nothing more to check for DS1961S/DS2432, since // it carries no signed data, we're finished return TRUE; } // header points to neither record A nor B, but // crc is absolutely correct. that can only mean // we're looking at something that is the wrong // size from what was expected, but apparently is // exactly what was meant to be written. I'm done. OWERROR(OWERROR_BAD_SERVICE_DATA); return FALSE; } // lets try Record A and check the crc user->accountFile[0] = RECORD_A_LENGTH; setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < user->accountFile[0]+3; i++) lastcrc16 = docrc16(user->portnum,user->accountFile[i]); if(lastcrc16==0xB001) validA = TRUE; // lets try Record B and check the crc user->accountFile[0] = RECORD_B_LENGTH; setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < user->accountFile[0]+3; i++) lastcrc16 = docrc16(user->portnum,user->accountFile[i]); if(lastcrc16==0xB001) validB = TRUE; if(validA && validB) { // Both A & B are valid! And we know that we can only // get here if the pointer or the header was not valid. // That means that B was the last updated one but the // header got hosed and the debit was not finished... // which means A is the last known good value, let's go with A. user->accountFile[0] = RECORD_A_LENGTH; OWASSERT( WriteDataPageSHA33(copr, user), OWERROR_WRITE_DATA_PAGE_FAILED, FALSE ); return TRUE; } else if(validA) { // B is invalid, A is valid. Means A is the last updated one, // but B is the last known good value. The header was not updated // to point to A before debit was aborted. Let's go with B user->accountFile[0] = RECORD_B_LENGTH; // must fix B's CRC setcrc16(user->portnum, user->accountPageNumber); for (i = 0; i < RECORD_B_LENGTH+1; i++) lastcrc16 = docrc16(user->portnum,user->accountFile[i]); lastcrc16 = ~lastcrc16; ((DebitFile33*)user->accountFile)->crc16_B[0] = (uchar)lastcrc16; ((DebitFile33*)user->accountFile)->crc16_B[1] = (uchar)(lastcrc16>>8); OWASSERT( WriteDataPageSHA33(copr, user), OWERROR_WRITE_DATA_PAGE_FAILED, FALSE ); return TRUE; } else if(validB) { // A is invalid, B is valid. Should never ever happen. Something // got completely hosed. What should happen here? user->accountFile[0] = origPtr; OWERROR(OWERROR_BAD_SERVICE_DATA); return FALSE; } // neither record contains a valid CRC. What should happen here? user->accountFile[0] = origPtr; OWERROR(OWERROR_CRC_FAILED); return FALSE; } else { // verify CRC16 is correct OWASSERT( lastcrc16==0xB001, OWERROR_CRC_FAILED, FALSE ); } memset(scratchpad, 0x00, 32); if(user->writeCycleCounter>0) IntToBytes(&scratchpad[8], 4, user->writeCycleCounter); else // user doesn't have write cycle counter (DS1961S) memset(&scratchpad[8], 0x0FF, 4); // the pagenumber scratchpad[12] = (uchar)user->accountPageNumber; // and 7 bytes of the address of current device memcpy(&scratchpad[13], user->devAN, 7); // the coprocessor's signing challenge memcpy(&scratchpad[20], copr->signChlg, 3); // make a copy of the account file memcpy((uchar*)&acctFile, user->accountFile, 32); // clear out the old signature and CRC memcpy(acctFile.signature, copr->initSignature, 20); memset(acctFile.crc16, 0x00, 2); OWASSERT( CreateDataSignature(copr, (uchar*)&acctFile, scratchpad, ((DebitFile*)user->accountFile)->signature, FALSE), OWERROR_SIGN_SERVICE_DATA_FAILED, FALSE ); return TRUE; } //------------------------------------------------------------------------- // Performs debit of service data on a user token, re-signs the data, and // writes it back to the user token. // Pre-condition: must call verify user first. // // 'copr' - Structure for holding coprocessor information. // 'user' - Structure for holding user token information. // 'debitAmount' - the amount of money to debit from balance in cents. // 'verifySuccess' - Paranoid double-check of account write by re-calling // VerifyUser(copr,user) // // Return: If TRUE, data was updated. // If FALSE, an error occurred or couldn't verify success. // SMALLINT ExecuteTransaction(SHACopr* copr, SHAUser* user, int debitAmount, SMALLINT verifySuccess ) { SMALLINT success, dataOK = TRUE; uchar oldAcctData[32], newAcctData[32]; int cnt = MAX_RETRY_CNT; int balance, oldBalance ; memcpy(oldAcctData, user->accountFile, 32); if(user->devAN[0]==0x18) { DebitFile* accountFile = (DebitFile*)user->accountFile; oldBalance = BytesToInt(accountFile->balanceBytes, 3); if(oldBalance<=0) { OWERROR(OWERROR_BAD_SERVICE_DATA); return FALSE; } balance = oldBalance - debitAmount; IntToBytes(accountFile->balanceBytes, 3, balance); } else if((user->devAN[0]&0x7F)==0x33) { DebitFile33* accountFile = (DebitFile33*)user->accountFile; if(accountFile->fileLength==RECORD_A_LENGTH) { oldBalance = BytesToInt(accountFile->balanceBytes_A, 3); if(oldBalance<=0) { OWERROR(OWERROR_BAD_SERVICE_DATA); return FALSE; } balance = oldBalance - debitAmount; IntToBytes(accountFile->balanceBytes_B, 3, balance); } else if(accountFile->fileLength==RECORD_B_LENGTH) { oldBalance = BytesToInt(accountFile->balanceBytes_B, 3); if(oldBalance<=0) { OWERROR(OWERROR_BAD_SERVICE_DATA); return FALSE; } balance = oldBalance - debitAmount; IntToBytes(accountFile->balanceBytes_A, 3, balance); } else { OWERROR(OWERROR_BAD_SERVICE_DATA); return FALSE; } } success = UpdateServiceData(copr, user); //if write didn't succeeded or if we need to perform //a verification step anyways, let's double-check what //the user has on the button. if(verifySuccess || !success) { dataOK = FALSE; //save what the account data is supposed to look like memcpy(newAcctData, user->accountFile, 32); do { //calling verify user re-issues a challenge-response //and reloads the cached account data in the user object. //Does not re-bind the user's unique secret if(VerifyUser(copr,user,FALSE)) { //compare the user's account data against the working //copy and the backup copy. if( memcmp(user->accountFile, newAcctData, 32) == 0 ) { //looks like it worked dataOK = TRUE; } else if( memcmp(user->accountFile, oldAcctData, 32) == 0 ) { //if it matches the backup copy, we didn't write anything //and the data is still okay, but we didn't do a debit dataOK = TRUE; success = FALSE; OWERROR(OWERROR_SERVICE_DATA_NOT_UPDATED); } else { // retry the write success = UpdateServiceData(copr, user); //save what the account data is supposed to look like memcpy(newAcctData, user->accountFile, 32); } } } while(dataOK==FALSE && cnt-->0); } if(!dataOK) { //couldn't fix the data after 255 retries OWERROR(OWERROR_CATASTROPHIC_SERVICE_FAILURE); success = FALSE; } return success; }
36.68065
80
0.572841
eb029a31a01ef44a2c6b63937bab2c14087bcfbd
2,338
h
C
snapgear_linux/user/tinylogin/pwd_grp/config.h
impedimentToProgress/UCI-BlueChip
53e5d48b79079eaf60d42f7cb65bb795743d19fc
[ "MIT" ]
10
2015-02-28T21:05:37.000Z
2021-09-16T04:57:27.000Z
snapgear_linux/user/tinylogin/pwd_grp/config.h
impedimentToProgress/UCI-BlueChip
53e5d48b79079eaf60d42f7cb65bb795743d19fc
[ "MIT" ]
1
2021-02-24T05:16:58.000Z
2021-02-24T05:16:58.000Z
nimbus_source/011_tinylogin-1.4/pwd_grp/config.h
isabella232/wireless-media-drive
ab09fbd1194c8148131cf0a37425419253a137b0
[ "Apache-2.0" ]
5
2018-11-19T16:42:53.000Z
2021-12-07T12:39:23.000Z
/* * config.h - This file is part of the libc-8086/grp package for ELKS, * Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef _CONFIG_GRP_H #define _CONFIG_GRP_H /* * Define GR_SCALE_DYNAMIC if you want grp to dynamically scale its read buffer * so that lines of any length can be used. On very very small systems, * you may want to leave this undefined becasue it will make the grp functions * somewhat larger (because of the inclusion of malloc and the code necessary). * On larger systems, you will want to define this, because grp will _not_ * deal with long lines gracefully (they will be skipped). */ #undef GR_SCALE_DYNAMIC #ifndef GR_SCALE_DYNAMIC /* * If scaling is not dynamic, the buffers will be statically allocated, and * maximums must be chosen. GR_MAX_LINE_LEN is the maximum number of * characters per line in the group file. GR_MAX_MEMBERS is the maximum * number of members of any given group. */ #define GR_MAX_LINE_LEN 128 /* GR_MAX_MEMBERS = (GR_MAX_LINE_LEN-(24+3+6))/9 */ #define GR_MAX_MEMBERS 11 #endif /* !GR_SCALE_DYNAMIC */ /* * Define GR_DYNAMIC_GROUP_LIST to make initgroups() dynamically allocate * space for it's GID array before calling setgroups(). This is probably * unnecessary scalage, so it's undefined by default. */ #undef GR_DYNAMIC_GROUP_LIST #ifndef GR_DYNAMIC_GROUP_LIST /* * GR_MAX_GROUPS is the size of the static array initgroups() uses for * its static GID array if GR_DYNAMIC_GROUP_LIST isn't defined. */ #define GR_MAX_GROUPS 64 #endif /* !GR_DYNAMIC_GROUP_LIST */ #endif /* !_CONFIG_GRP_H */
35.424242
79
0.748075