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
bb0a079ae278ae2aa2a227e54203fd0c48fc9466
268
h
C
pchm/src/header2.h
ivanmurashko/articles
522db3ad21e96084490acd39a146a335763e5beb
[ "MIT" ]
1
2019-09-27T08:59:55.000Z
2019-09-27T08:59:55.000Z
pchm/src/header2.h
ivanmurashko/articles
522db3ad21e96084490acd39a146a335763e5beb
[ "MIT" ]
null
null
null
pchm/src/header2.h
ivanmurashko/articles
522db3ad21e96084490acd39a146a335763e5beb
[ "MIT" ]
null
null
null
#pragma once #include <iostream> //#include "header1.h" void foo2() { #ifdef H1 std::cout << "foo2 (header2) with H1" << std::endl; std::cout << "Macro from H2: " << H1FUN(10) << std::endl; #else std::cout << "foo2 (header2) without H1" << std::endl; #endif }
19.142857
59
0.600746
9bcf1b2b0cf98cf0ede39e819dec66bac22259d2
1,381
h
C
BoxContentSDK/BoxContentSDK/Requests/BOXFolderItemsRequest.h
breezy/box-ios-sdk-v2
2082fd1e37dd212b1e7103c79c7c2765e2507239
[ "MIT" ]
null
null
null
BoxContentSDK/BoxContentSDK/Requests/BOXFolderItemsRequest.h
breezy/box-ios-sdk-v2
2082fd1e37dd212b1e7103c79c7c2765e2507239
[ "MIT" ]
null
null
null
BoxContentSDK/BoxContentSDK/Requests/BOXFolderItemsRequest.h
breezy/box-ios-sdk-v2
2082fd1e37dd212b1e7103c79c7c2765e2507239
[ "MIT" ]
null
null
null
// // BOXFolderItemsRequest.h // BoxContentSDK // // Created by Boris Suvorov on 3/31/15. // Copyright (c) 2015 Box. All rights reserved. // #import "BOXRequestWithSharedLinkHeader.h" @interface BOXFolderItemsRequest : BOXRequestWithSharedLinkHeader @property (nonatomic, readwrite, strong) NSString *folderID; @property (nonatomic, readwrite, assign) BOOL requestAllItemFields; //all paginated requests of this request will have the same data //can be used as a way to link related paginated requests together @property (nonatomic, readwrite, strong) NSData *sharedPaginatedRequestData; /** * The list of fields to exclude from the list of fields requested * This works in conjuntion with requestAllItemFields to exclude fields from the list of all item fields * If requestAllItemFields is NO, fieldsToExclude will not have any effect, * and the response will include default fields from API */ @property (nonatomic, readwrite, strong) NSArray *fieldsToExclude; - (instancetype)initWithFolderID:(NSString *)folderID; //Perform API request and any cache update only if refreshBlock is not nil - (void)performRequestWithCompletion:(BOXItemsBlock)completionBlock; //Perform API request and any cache update only if refreshBlock is not nil - (void)performRequestWithCached:(BOXItemsBlock)cacheBlock refreshed:(BOXItemsBlock)refreshBlock; @end
36.342105
104
0.77987
afd507c62d70e44b85441753f872e238ef0893c4
8,212
c
C
src/thread.c
styxyang/ssearcher
5bf5eaa4f16624dee61f11d85a1e5ed2107e0528
[ "BSD-2-Clause" ]
2
2016-06-22T16:01:50.000Z
2016-09-01T02:55:25.000Z
src/thread.c
styxyang/ssearcher
5bf5eaa4f16624dee61f11d85a1e5ed2107e0528
[ "BSD-2-Clause" ]
null
null
null
src/thread.c
styxyang/ssearcher
5bf5eaa4f16624dee61f11d85a1e5ed2107e0528
[ "BSD-2-Clause" ]
null
null
null
#include "config.h" #include "debug.h" #include "thread.h" #include "magic.h" #include "file.h" #include "match.h" #include "options.h" #include "buffer.h" #include <stdlib.h> #include <assert.h> #include <string.h> #include <sys/stat.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> #include <sched.h> #include <pthread.h> #ifdef ENABLE_FTS #include <fts.h> #endif extern int pipefd[2]; extern int result[NCPU][2]; extern __thread size_t off; /* thread id */ __thread long tid; pthread_mutex_t outmtx; pthread_mutex_t readmtx; /* find the beginning offset of the line which contains * the `mid' position */ static uint32_t begin_of_line(char *fb, uint32_t mid) { while (mid > 0) { if (fb[mid - 1] == '\n') break; mid--; } return mid; } /* write matched data to buffer with line number `linum' and `lastlinum' */ static void worker_writebuffer(char *fb, uint32_t pos, uint32_t linum, uint32_t lastlinum) { static size_t nll = 0; /* `nll' number of chars in last line */ static int cnt; /* `cnt' number of matches in this line */ uint32_t bol = begin_of_line(fb, pos); if (linum != lastlinum) { writef_buffer(LINUM_COLOR "\n%u:" "\e[0m", linum); nll = writeline_color_buffer(fb + bol, 1024, pos - bol, opt.search_patlen); lastlinum = linum; cnt = 1; } else { dprintf(WARN, "another match in the same line"); nll += amendline_color_buffer(nll, pos - bol, opt.search_patlen, cnt); cnt++; } } void *worker_thread(void *arg) { ssize_t n, r; int fd; tid = (long)arg; fileinfo fi; /* init block */ { init_buffer(); kmp_prepare(opt.search_pattern, opt.search_patlen); } /* loop to read opened file descriptors from pipe */ while (1) { /* FIXME use queue to replace the pipe */ pthread_mutex_lock(&readmtx); n = read(pipefd[0], &fi, sizeof(fi)); pthread_mutex_unlock(&readmtx); if (n == 0) break; if (n != sizeof(fi)) { cpu_relax(); continue; } char buf[16]; char *fb; /* `fb' for file buffer */ if ((fb = map_file(&fi)) == NULL) { close(fi.fd); cpu_relax(); continue; } /* `matchpos': the position matched in every iteration * `startpos': the position where every iteration starts */ uint32_t matchpos = 0, startpos = 0; /* `linum': line number of every match result, initial line number is 1 * 'lastlinum': line number of last match, used to mark matches in * the same line */ uint32_t linum = 1; uint32_t lastlinum = 0; /* FIXME opt.search_pattern should be guarenteed to be not null */ /* XXX shall we use likely/unlikely to do branch prediction? */ while (1) { if (!kmp_match(fb + startpos, fi.size - startpos, &linum, &matchpos)) { break; } dprintf(INFO, "T%d <%s> match at %d", tid, fi.filename, matchpos + startpos); memset(buf, 0, sizeof(buf)); worker_writebuffer(fb, matchpos + startpos, linum, lastlinum); /* There should be no exceptions */ /* dprintf(INFO, "write to result pipe\n"); */ /* write(result[tid][1], buf, sizeof(buf)); */ startpos += matchpos + opt.search_patlen; } /* if offset is not zero, buffer contains something to write */ if (off) { /* FIXME abstract as `write_filename' maybe */ pthread_mutex_lock(&outmtx); fprintf(stdout, FNAME_COLOR "%s" "\e[0m\n", fi.filename); if (!opt.list_matching_files) fprintf(stdout, "%s\n", read_buffer()); pthread_mutex_unlock(&outmtx); free(fi.filename); fflush(NULL); } reset_buffer(); unmap_file(&fi); cpu_relax(); } { destroy_buffer(); kmp_finish(); close(result[tid][1]); dprintf(INFO, "result[%ld][1] closed", tid); } return 0; } void *dispatcher_thread(void *arg) { struct stat statbuf; DIR *d; struct dirent *entry; magic_init(); dprintf(INFO, "dispatcher"); #ifndef ENABLE_FTS if ((d = opendir("./")) == NULL) { fprintf(stdout, "opendir failed\n"); return 0; } dprintf(INFO, "open dir: ."); while ((entry = readdir(d)) != NULL) { struct stat st; char fullpath[512]; dprintf(INFO, "filename: %s", entry->d_name); snprintf(fullpath, sizeof(fullpath), "%s/%s", ".", entry->d_name); lstat(fullpath, &st); if (S_ISREG(st.st_mode)) { dprintf(INFO, "%s", entry->d_name); /* pasted from main() */ int fd; if ((fd = open(fullpath, O_RDONLY)) == -1) { dprintf(ERROR, "fail to open file for read: %s", fullpath); return 0; } dprintf(INFO, "open file: %d %s\n", fd, fullpath); /* test whether the file is binary */ /* and close binary file */ if (magic_scan(fd)) { dprintf(WARN, "close binary %s", fullpath); close(fd); continue; } fileinfo fi; memset(&fi, 0, sizeof(fileinfo)); fi.fd = fd; /* memcpy(fi.filename, entry->d_name, strlen(entry->d_name)); */ /* on OS X, should use `strndup(entry->d_name, entry->d_namelen)' */ fi.filename = strdup(entry->d_name); /* if (write(pipefd[1], &fd, sizeof(int)) != sizeof(int)) { */ /* perror("write pipefd\n"); */ /* } */ if (write(pipefd[1], &fi, sizeof(fileinfo)) != sizeof(fileinfo)) { perror("write pipefd\n"); } } cpu_relax(); } if (closedir(d) < 0) { dprintf(ERROR, "closedir failed"); } #else char * const path_argv[] = { ".", NULL}; FTSENT *fts_entry = NULL; FTS *pfts = fts_open(path_argv, FTS_LOGICAL, NULL); dprintf(INFO, "open current directory"); while ((fts_entry = fts_read(pfts))) { if (strcmp(fts_entry->fts_name, ".git") == 0) { fts_set(pfts, fts_entry, FTS_SKIP); goto next_entry; } if (strcmp(fts_entry->fts_name, ".svn") == 0) { fts_set(pfts, fts_entry, FTS_SKIP); goto next_entry; } if (strcmp(fts_entry->fts_name, ".hg") == 0) { fts_set(pfts, fts_entry, FTS_SKIP); goto next_entry; } if (!S_ISREG(fts_entry->fts_statp->st_mode)) { goto next_entry; } int fd; if ((fd = open(fts_entry->fts_path, O_RDONLY)) == -1) { dprintf(ERROR, "fail to open file for read: %s", fts_entry->fts_path); continue; } dprintf(INFO, "open file: %d %s\n", fd, fts_entry->fts_path); /* test whether the file is binary */ /* and close binary file */ if (magic_scan(fd)) { dprintf(WARN, "close binary %s", fts_entry->fts_path); close(fd); continue; } fileinfo fi; memset(&fi, 0, sizeof(fileinfo)); fi.fd = fd; /* memcpy(fi.filename, fts_entry->fts_path, fts_entry->fts_pathlen); */ /* on OS X, should use `strndup(entry->d_name, entry->d_namelen)' */ fi.filename = strndup(fts_entry->fts_path, fts_entry->fts_pathlen); /* if (write(pipefd[1], &fd, sizeof(int)) != sizeof(int)) { */ /* perror("write pipefd\n"); */ /* } */ if (write(pipefd[1], &fi, sizeof(fileinfo)) != sizeof(fileinfo)) { perror("write pipefd\n"); } next_entry: cpu_relax(); } fts_close(pfts); #endif /* FTS */ close(pipefd[1]); magic_fini(); return 0; }
28.814035
83
0.524233
15d84bebead607a01168bddc83f15986a8d88ae4
34,351
h
C
src/core/vl53l1_ll_def.h
rneurink/VL53L1X_FULL_API
ee8097ce27937bdf3b8f08d28fdee7658b4d9039
[ "BSD-3-Clause" ]
2
2020-07-25T20:56:23.000Z
2020-08-25T23:54:21.000Z
src/core/vl53l1_ll_def.h
rneurink/VL53L1X_FULL_API
ee8097ce27937bdf3b8f08d28fdee7658b4d9039
[ "BSD-3-Clause" ]
null
null
null
src/core/vl53l1_ll_def.h
rneurink/VL53L1X_FULL_API
ee8097ce27937bdf3b8f08d28fdee7658b4d9039
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2017, STMicroelectronics - All Rights Reserved * * This file is part of VL53L1 Core and is dual licensed, * either 'STMicroelectronics * Proprietary license' * or 'BSD 3-clause "New" or "Revised" License' , at your option. * ******************************************************************************** * * 'STMicroelectronics Proprietary license' * ******************************************************************************** * * License terms: STMicroelectronics Proprietary in accordance with licensing * terms at www.st.com/sla0081 * * STMicroelectronics confidential * Reproduction and Communication of this document is strictly prohibited unless * specifically authorized in writing by STMicroelectronics. * * ******************************************************************************** * * Alternatively, VL53L1 Core may be distributed under the terms of * 'BSD 3-clause "New" or "Revised" License', in which case the following * provisions apply instead of the ones mentioned above : * ******************************************************************************** * * License terms: BSD 3-clause "New" or "Revised" 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. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ******************************************************************************** * */ /** * @file vl53l1_ll_def.h * * @brief Type definitions for VL53L1 LL Driver. * */ #ifndef _VL53L1_LL_DEF_H_ #define _VL53L1_LL_DEF_H_ #include "vl53l1_ll_device.h" #include "vl53l1_error_codes.h" #include "vl53l1_register_structs.h" #include "../platform/vl53l1_platform_user_config.h" #include "../platform/vl53l1_platform_user_defines.h" #include "vl53l1_error_exceptions.h" #ifdef __cplusplus extern "C" { #endif /** @defgroup VL53L1_globalLLDriverDefine_group VL53L1 Defines * @brief VL53L1 LL Driver Defines * @{ */ /** VL53L1 Low Level Driver IMPLEMENTATION major version */ #define VL53L1_LL_API_IMPLEMENTATION_VER_MAJOR 1 /** VL53L1 Low Level DriverI IMPLEMENTATION minor version */ #define VL53L1_LL_API_IMPLEMENTATION_VER_MINOR 2 /** VL53L1 Low Level DriverI IMPLEMENTATION sub version */ #define VL53L1_LL_API_IMPLEMENTATION_VER_SUB 10 /** VL53L1 Low Level Driver IMPLEMENTATION sub version */ #define VL53L1_LL_API_IMPLEMENTATION_VER_REVISION 1840 #define VL53L1_LL_API_IMPLEMENTATION_VER_STRING "1.2.11.1840" /** VL53L1_FIRMWARE min and max compatible revisions */ #define VL53L1_FIRMWARE_VER_MINIMUM 398 #define VL53L1_FIRMWARE_VER_MAXIMUM 400 /**************************************** * PRIVATE define do not edit ****************************************/ #define VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION 0xECAB0102 /** VL53L1 Calibration Data struct version */ /* Start Patch_ZoneCalDataStructVersion_11854 */ #define VL53L1_LL_ZONE_CALIBRATION_DATA_STRUCT_VERSION 0xECAE0101 /** VL53L1 Zone Calibration Data struct version */ /* End Patch_ZoneCalDataStructVersion_11854 */ #define VL53L1_MAX_OFFSET_RANGE_RESULTS 3 /*!< Sets the maximum number of offset range results required for the offset calibration. Order is RANGE, MM1, MM2 */ #define VL53L1_NVM_MAX_FMT_RANGE_DATA 4 /*!< The number of FMT range data points stored in NVM */ #define VL53L1_NVM_PEAK_RATE_MAP_SAMPLES 25 /*!< The number of samples in the NVM peak rate signal map */ #define VL53L1_NVM_PEAK_RATE_MAP_WIDTH 5 /*!< Array width of NVM peak rate signal map */ #define VL53L1_NVM_PEAK_RATE_MAP_HEIGHT 5 /*!< Array height the NVM peak rate signal map */ /** @defgroup VL53L1_defineExtraError_group Error and Warning code returned by API * The following DEFINE are used to identify the PAL ERROR * @{ */ #define VL53L1_ERROR_DEVICE_FIRMWARE_TOO_OLD ((VL53L1_Error) - 80) /*!< Device Firmware too old .. */ #define VL53L1_ERROR_DEVICE_FIRMWARE_TOO_NEW ((VL53L1_Error) - 85) /*!< Device Firmware too new .. */ #define VL53L1_ERROR_UNIT_TEST_FAIL ((VL53L1_Error) - 90) /*!< Unit Test Fail */ #define VL53L1_ERROR_FILE_READ_FAIL ((VL53L1_Error) - 95) /*!< File Read Fail */ #define VL53L1_ERROR_FILE_WRITE_FAIL ((VL53L1_Error) - 96) /*!< File Write Fail */ /*!< Tells requested functionality has not been implemented yet or * not compatible with the device */ /** @} VL53L1_defineExtraError_group */ /** @brief Defines the parameters of the LL driver Get Version Functions */ typedef struct { uint32_t ll_revision; /*!< revision number */ uint8_t ll_major; /*!< major number */ uint8_t ll_minor; /*!< minor number */ uint8_t ll_build; /*!< build number */ } VL53L1_ll_version_t; /** @brief Reference SPAD Characterization (RefSpadChar) Config */ typedef struct { uint8_t device_test_mode; /*!< Device test mode */ uint8_t vcsel_period; /*!< VCSEL period (register) value */ uint32_t timeout_us; /*!< timeout in [us] */ uint16_t target_count_rate_mcps; /*!< Target reference total count rate in [Mcps] - 9.7 format */ uint16_t min_count_rate_limit_mcps; /*!< Min valid reference rate [Mcps] - 9.7 format */ uint16_t max_count_rate_limit_mcps; /*!< Max valid reference rate [Mcps] - 9.7 format */ } VL53L1_refspadchar_config_t; /** @brief SPAD Self Check (SSC) Config data structure */ typedef struct { VL53L1_DeviceSscArray array_select; /*!< SPAD Array select * 0 - store RTN array count rates \n * 1 - store REF array count rates */ uint8_t vcsel_period; /*!< VCSEL period (register) value */ uint8_t vcsel_start; /*!< VCSEL start register value */ uint8_t vcsel_width; /*!< VCSEL ssc_timeout_us width register value e.g. 2 */ uint32_t timeout_us; /*!< requested Ranging Timeout in [us] e.g 100000us */ uint16_t rate_limit_mcps; /*!< Rate limit for checks either 1.15 or * 9.7 dependent on test_mode */ } VL53L1_ssc_config_t; /** @brief Xtalk Extraction and Paramter Config */ typedef struct { uint32_t algo__crosstalk_compensation_plane_offset_kcps; /*!< Private crosstalk_compensation_plane_offset_kcps (fixed point 9.9) */ int16_t algo__crosstalk_compensation_x_plane_gradient_kcps; /*!< Private crosstalk_compensation_x_plane_gradient_kcps (fixed point 5.11) */ int16_t algo__crosstalk_compensation_y_plane_gradient_kcps; /*!< Private crosstalk_compensation_y_plane_gradient_kcps (fixed point 5.11) */ uint32_t nvm_default__crosstalk_compensation_plane_offset_kcps; /*!< NVm stored crosstalk_compensation_plane_offset_kcps (fixed point 9.9) */ int16_t nvm_default__crosstalk_compensation_x_plane_gradient_kcps; /*!< NVM stored crosstalk_compensation_x_plane_gradient_kcps (fixed point 5.11) */ int16_t nvm_default__crosstalk_compensation_y_plane_gradient_kcps; /*!< NVM stored crosstalk_compensation_y_plane_gradient_kcps (fixed point 5.11) */ uint8_t global_crosstalk_compensation_enable; /*!< Enable switch for crosstalk compensation in all modes */ int16_t lite_mode_crosstalk_margin_kcps; /*!< Additional xtalk factor rate, added to plane_offset value in both * SD mode, applied as a seperate addition at point of * application to the device, plane_offset * value remains unaltered. (fixed point 7.9) */ uint8_t crosstalk_range_ignore_threshold_mult; /*!< User set multiplier for range ignore threshold setting (fixed point 3.5) */ uint16_t crosstalk_range_ignore_threshold_rate_mcps; /*!< Generated range ignore threshold rate in Mcps per spad (fixed * point 3.13) */ } VL53L1_xtalk_config_t; /** @brief TuningParameter Storage * * - Storage structure for any LLD tuning parms * which are dynamically altered by low level functions * mostly when programming directly to the device * *- Added as part of Patch_AddingTuningParmStorage_11821 */ typedef struct { uint16_t tp_tuning_parm_version; /*!< Programmed Global tuning version num for debug */ uint16_t tp_tuning_parm_key_table_version; /*!< Key Table tuning structure \ * version */ uint16_t tp_tuning_parm_lld_version; /*!< Programmed LLD version to ensure matching tuning structure \ * key table */ uint8_t tp_init_phase_rtn_lite_long; /*!< initial phase value for rtn array \ * in Lite Long Ranging Mode */ uint8_t tp_init_phase_rtn_lite_med; /*!< initial phase value for rtn array \ * in Lite Medium Ranging Mode */ uint8_t tp_init_phase_rtn_lite_short; /*!< initial phase value for rtn array \ * in Lite Short Ranging Mode */ uint8_t tp_init_phase_ref_lite_long; /*!< initial phase value for ref array \ * in Lite Long Ranging Mode */ uint8_t tp_init_phase_ref_lite_med; /*!< initial phase value for ref array \ * in Lite Medium Ranging Mode */ uint8_t tp_init_phase_ref_lite_short; /*!< initial phase value for ref array \ * in Lite short Ranging Mode */ uint8_t tp_consistency_lite_phase_tolerance; /*!< Phase tolerance consistency value to be used \ * in Lite modes */ uint8_t tp_phasecal_target; /*!< Phasecal target value */ uint16_t tp_cal_repeat_rate; /*!< Auto VHV/Calibration repeat rate for \ * use in Lite mode */ uint8_t tp_lite_min_clip; /*!< Min Clip value in mm applied to device in Lite \ * modes */ uint16_t tp_lite_long_sigma_thresh_mm; /*!< Sigma threshold limit for Lite Long mode \ * in 14.2 format mm */ uint16_t tp_lite_med_sigma_thresh_mm; /*!< Sigma threshold limit for Lite Medium mode \ * in 14.2 format mm */ uint16_t tp_lite_short_sigma_thresh_mm; /*!< Sigma threshold limit for Lite Short mode \ * in 14.2 format mm */ uint16_t tp_lite_long_min_count_rate_rtn_mcps; /*!< Min count rate level used in lite long mode \ * in 9.7 Mcps format */ uint16_t tp_lite_med_min_count_rate_rtn_mcps; /*!< Min count rate level used in lite medium mode \ * in 9.7 Mcps format */ uint16_t tp_lite_short_min_count_rate_rtn_mcps; /*!< Min count rate level used in lite short mode \ * in 9.7 Mcps format */ uint8_t tp_lite_sigma_est_pulse_width_ns; /*!< Sigma thresholding tunign parm for Lite mode */ uint8_t tp_lite_sigma_est_amb_width_ns; /*!< Sigma thresholding tunign parm for Lite mode */ uint8_t tp_lite_sigma_ref_mm; /*!< Sigma thresholding tunign parm for Lite mode */ uint8_t tp_lite_seed_cfg; /*!< Lite Mode Seed mode switch */ uint8_t tp_timed_seed_cfg; /*!< Timed Mode Seed mode switch */ uint8_t tp_lite_quantifier; /*!< Low level quantifier setting for lite modes */ uint8_t tp_lite_first_order_select; /*!< Low level First order select setting for lite modes */ uint16_t tp_dss_target_lite_mcps; /*!< DSS Target rate in 9.7 format Mcps for lite modes */ uint16_t tp_dss_target_timed_mcps; /*!< DSS Target rate in 9.7 format Mcps for Timed modes */ uint32_t tp_phasecal_timeout_lite_us; /*!< Phasecal timeout in us for lite modes */ uint32_t tp_phasecal_timeout_timed_us; /*!< Phasecal timeout in us for Timed modes */ uint32_t tp_mm_timeout_lite_us; /*!< MM stage timeout in us for Lite modes */ uint32_t tp_mm_timeout_timed_us; /*!< MM stage timeout in us for Timed modes */ uint32_t tp_mm_timeout_lpa_us; /*!< MM stage timeout in us for Low Power Auto modes */ uint32_t tp_range_timeout_lite_us; /*!< Ranging stage timeout in us for Lite modes */ uint32_t tp_range_timeout_timed_us; /*!< Ranging stage timeout in us for Timed modes */ uint32_t tp_range_timeout_lpa_us; /*!< Ranging stage timeout in us for Low Power Auto modes */ } VL53L1_tuning_parm_storage_t; /** @brief Optical Centre data * */ typedef struct { uint8_t x_centre; /*!< Optical x centre : 4.4 format */ uint8_t y_centre; /*!< Optical y centre : 4.4 format */ } VL53L1_optical_centre_t; /** @brief Defines User Zone(ROI) parameters * */ typedef struct { uint8_t x_centre; /*!< Zone x centre : 0-15 range */ uint8_t y_centre; /*!< Zone y centre : 0-15 range */ uint8_t width; /*!< Width of Zone 0 = 1, 7 = 8, 15 = 16 */ uint8_t height; /*!< Height of Zone 0 = 1, 7 = 8, 15 = 16 */ } VL53L1_user_zone_t; /** * @struct VL53L1_GPIO_interrupt_config_t * * @brief Structure to configure conditions when GPIO interrupt is trigerred * */ typedef struct { /*! Distance interrupt mode */ VL53L1_GPIO_Interrupt_Mode intr_mode_distance; /*! Rate interrupt mode */ VL53L1_GPIO_Interrupt_Mode intr_mode_rate; /*! trigger interrupt if a new measurement is ready * __WARNING!__ will override other settings */ uint8_t intr_new_measure_ready; /*! Trigger interrupt if no target found */ uint8_t intr_no_target; /*! If set to 0, interrupts will only be triggered if BOTH rate AND * distance thresholds are triggered (combined mode). If set to 1, * interrupts will be triggered if EITHER rate OR distance thresholds * are triggered (independent mode). */ uint8_t intr_combined_mode; /* -- thresholds -- */ /* The struct holds a copy of the thresholds but they are written when * this structure is set using VL53L1_set_GPIO_interrupt_config/_struct * */ /*! Distance threshold high limit (mm) */ uint16_t threshold_distance_high; /*! Distance threshold low limit (mm) */ uint16_t threshold_distance_low; /*! Rate threshold high limit (9.7 Mcps) */ uint16_t threshold_rate_high; /*! Rate threshold low limit (9.7 Mcps) */ uint16_t threshold_rate_low; } VL53L1_GPIO_interrupt_config_t; /* Start Patch_LowPowerAutoMode */ /** * @struct VL53L1_low_power_auto_data_t * * @brief Structure to hold state, tuning and output variables for the low * power auto mode (Presence) * */ typedef struct { /*! Tuning variable for the VHV loop bound setting in low power auto * mode. This is zero based, so the number of loops in VHV is this + 1. * Please note, the first range will run with default VHV settings. * Only lower 6 bits are allowed */ uint8_t vhv_loop_bound; /*! Indicates if we are or are not in low power auto mode */ uint8_t is_low_power_auto_mode; /*! Used to check if we're running the first range or not. Not to be * used as a stream count */ uint8_t low_power_auto_range_count; /*! saved interrupt config byte to restore */ uint8_t saved_interrupt_config; /*! saved vhv config init byte to restore */ uint8_t saved_vhv_init; /*! saved vhv config timeout byte to restore */ uint8_t saved_vhv_timeout; /*! phase cal resutl from the first range */ uint8_t first_run_phasecal_result; /*! DSS. Total rate per spad given from the current range */ uint32_t dss__total_rate_per_spad_mcps; /*! DSS. Calculated required SPADs value */ uint16_t dss__required_spads; } VL53L1_low_power_auto_data_t; /* End Patch_LowPowerAutoMode */ /** * @struct VL53L1_range_data_t * @brief Internal data structure for storing post processed ranges * */ typedef struct { /* Info size */ uint8_t range_id; /*!< Range Result id e.g 0, 1, 2 */ uint32_t time_stamp; /*!< 32-bit time stamp */ uint16_t width; /*!< VCSEL pulse width in [PLL clocks] 6.4 format */ uint8_t woi; /*!< WOI width in [PLL clocks] */ uint16_t fast_osc_frequency; /*!< Oscillator frequency in 4.12 format */ uint16_t zero_distance_phase; /*!< Zero Distance phase in 5.11 format */ uint16_t actual_effective_spads; /*!< effective SPAD count in 8.8 format */ uint32_t total_periods_elapsed; /*!< Elapsed time in macro periods for readout channel */ uint32_t peak_duration_us; /*!< Peak VCSEL width time in us */ uint32_t woi_duration_us; /*!< WOI duration time in us */ /* Event counts */ uint32_t ambient_window_events; /*!< Return event count for the ambient window */ uint32_t ranging_total_events; /*!< Return ranging event count for the ranging window. This includes both VCSEL and ambient contributions */ int32_t signal_total_events; /*!< Return event count for the ranging window with ambient subtracted, Note it is 32-bit signed register */ /* Rates */ uint16_t peak_signal_count_rate_mcps; /*! Peak signal (VCSEL) Rate in 9.7 format */ uint16_t avg_signal_count_rate_mcps; /*! Average signal (VCSEL) Rate in 9.7 format */ uint16_t ambient_count_rate_mcps; /*! Ambient Rate in 9.7 format */ uint16_t total_rate_per_spad_mcps; /*! Total Rate Per SPAD in 3.13 format */ uint32_t peak_rate_per_spad_kcps; /*! Peak Rate Per SPAD in 13.11 format */ /* Sigma */ uint16_t sigma_mm; /*!< Range sigma Estimate [mm] 9.7 format */ /* Phase */ uint16_t median_phase; /*!< Median Phase in 5.11 format */ /* Range */ int16_t median_range_mm; /*!< Median Range in [mm] by default there are no fractional bits Optionally 1 or 2 fractional can be enabled via the VL53L1_SYSTEM__FRACTIONAL_ENABLE register */ /* Range status */ uint8_t range_status; } VL53L1_range_data_t; /** * @struct VL53L1_range_results_t * @brief Structure for storing the set of range results * */ typedef struct { VL53L1_DeviceState cfg_device_state; /*!< Configuration Device State */ VL53L1_DeviceState rd_device_state; /*!< Read Device State */ uint8_t stream_count; /*!< 8-bit stream count */ uint8_t device_status; /*!< Global device status for result set */ VL53L1_range_data_t data[2]; /*!< Range data each target distance */ } VL53L1_range_results_t; /** * @struct VL53L1_offset_range_data_t * @brief Structure for storing the set of range results * required for the mm1 and mm2 offset calibration * functions * */ typedef struct { uint8_t preset_mode; /*!< Preset Mode use for range */ uint8_t dss_config__roi_mode_control; /*!< Dynamic SPAD selection mode */ uint16_t dss_config__manual_effective_spads_select; /*!< Requested number of manual effective SPAD's */ uint8_t no_of_samples; /*!< Number of ranges */ uint32_t effective_spads; /*!< Average effective SPAD's 8.8 format */ uint32_t peak_rate_mcps; /*!< Average peak rate Mcps 9.7 format */ uint32_t sigma_mm; /*!< Average sigma in [mm] 14.2 format */ int32_t median_range_mm; /*!< Avg of median range over all ranges \ note value is signed */ int32_t range_mm_offset; /*!< The calculated range offset value */ } VL53L1_offset_range_data_t; /** * @struct VL53L1_offset_range_results_t * @brief Structure for storing the set of range results * required for the offset calibration functions * */ typedef struct { int16_t cal_distance_mm; /*!< the calibration distance in [mm]*/ VL53L1_Error cal_status; /*!< Calibration status, check for warning codes */ uint8_t cal_report; /*!< Stage for above cal status - 0 Pre, 1 = MM1, 2 = MM2 */ uint8_t max_results; /*!< Array size for histogram range data i.e. max number of results */ uint8_t active_results; /*!< Number of active measurements */ VL53L1_offset_range_data_t data[VL53L1_MAX_OFFSET_RANGE_RESULTS]; /*!< Range results for each offset measurement */ } VL53L1_offset_range_results_t; /** * @struct VL53L1_additional_offset_cal_data_t * @brief Additional Offset Calibration Data * * Additional offset calibration data. Contains the rate * and effective SPAD counts for the MM inner and outer * calibration steps. */ typedef struct { uint16_t result__mm_inner_actual_effective_spads; /*!< MM Inner actual effective SPADs, 8.8 format */ uint16_t result__mm_outer_actual_effective_spads; /*!< MM Outer actual effective SPADs, 8.8 format */ uint16_t result__mm_inner_peak_signal_count_rtn_mcps; /*!< Mean value of MM Inner return peak rate in [Mcps], 9.7 format */ uint16_t result__mm_outer_peak_signal_count_rtn_mcps; /*!< Mean value of MM Outer return peak rate in [Mcps], 9.7 format */ } VL53L1_additional_offset_cal_data_t; /** * @struct VL53L1_cal_peak_rate_map_t * @brief Structure for storing the calibration peak rate map * Used by DMAX to understand the spatial roll off * in the signal rate map towards the corner of the * SPAD array. */ typedef struct { int16_t cal_distance_mm; /*!< calibration distance in [mm], 14.2 format */ uint16_t max_samples; /*!< Array size for rate map i.e. max number samples */ uint16_t width; /*!< Array width */ uint16_t height; /*!< Array height */ uint16_t peak_rate_mcps[VL53L1_NVM_PEAK_RATE_MAP_SAMPLES]; /*!< Array of rate map samples */ } VL53L1_cal_peak_rate_map_t; /** * @struct VL53L1_gain_calibration_data_t * * @brief Gain calibration data * */ typedef struct { uint16_t standard_ranging_gain_factor; /*!< Standard ranging gain correction factor 1.11 format */ } VL53L1_gain_calibration_data_t; /** * @struct VL53L1_ll_driver_state_t * * @brief Contains the driver state information * */ typedef struct { VL53L1_DeviceState cfg_device_state; /*!< Configuration Device State */ uint8_t cfg_stream_count; /*!< configuration stream count, becomes expected stream count for zone */ uint8_t cfg_gph_id; /*!< Config Grouped Parameter Hold ID */ uint8_t cfg_timing_status; /*!< Timing A or B flag 0 = A, 1 = B */ VL53L1_DeviceState rd_device_state; /*!< Read Device State */ uint8_t rd_stream_count; /*!< rd stream count, used to check actual stream count */ uint8_t rd_gph_id; /*!< Read Grouped Parameter Hold ID */ uint8_t rd_timing_status; /*!< Timing A or B flag 0 = A, 1 = B */ } VL53L1_ll_driver_state_t; /** @brief Run Offset Cal Function (offsetcal) Config */ typedef struct { uint16_t dss_config__target_total_rate_mcps; /*!< DSS Target rate in MCPS (9.7 format) used \ * during run_offset_calibration() */ uint32_t phasecal_config_timeout_us; /*!< Phasecal timeout in us \ * used during run_offset_calibration() */ uint32_t range_config_timeout_us; /*!< Range timeout in us used during \ * run_offset_calibration() */ uint32_t mm_config_timeout_us; /*!< MM timeout in us used during \ * run_offset_calibration() \ * Added as part of Patch_AddedOffsetCalMMTuningParm_11791 */ uint8_t pre_num_of_samples; /*!< Number of Ranging samples used during \ * run_offset_calibration() */ uint8_t mm1_num_of_samples; /*!< Number of MM1 samples used during \ * run_offset_calibration() */ uint8_t mm2_num_of_samples; /*!< Number of MM2 samples used during \ * run_offset_calibration() */ } VL53L1_offsetcal_config_t; /** * @struct VL53L1_LLDriverData_t * * @brief VL53L1 LL Driver ST private data structure \n * */ typedef struct { uint8_t wait_method; /*!< Wait type : blocking or non blocking */ VL53L1_DevicePresetModes preset_mode; /*!< Current preset mode */ VL53L1_DeviceMeasurementModes measurement_mode; /*!< Current measurement mode */ VL53L1_OffsetCalibrationMode offset_calibration_mode; /*!< Current offset calibration mode */ VL53L1_OffsetCorrectionMode offset_correction_mode; /*!< Current offset_ correction mode */ uint32_t phasecal_config_timeout_us; /*!< requested Phase Cal Timeout e.g. 1000us */ uint32_t mm_config_timeout_us; /*!< requested MM Timeout e.g. 2000us */ uint32_t range_config_timeout_us; /*!< requested Ranging Timeout e.g 13000us */ uint32_t inter_measurement_period_ms; /*!< requested Timing mode repeat period e.g 100ms */ uint16_t dss_config__target_total_rate_mcps; /*!< requested DSS Target Total Rate in 9.7 format e.g. 40.0Mcps * - Patch_ChangingPresetModeInputParms_11780 */ uint32_t fw_ready_poll_duration_ms; /*!< FW ready poll duration in ms*/ uint8_t fw_ready; /*!< Result of FW ready check */ uint8_t debug_mode; /*!< Internal Only - read extra debug data */ /*!< version info structure */ VL53L1_ll_version_t version; /*!< version info structure */ VL53L1_ll_driver_state_t ll_state; /*!< decoded GPIO interrupt config */ VL53L1_GPIO_interrupt_config_t gpio_interrupt_config; /*!< public register data structures */ VL53L1_customer_nvm_managed_t customer; VL53L1_cal_peak_rate_map_t cal_peak_rate_map; VL53L1_additional_offset_cal_data_t add_off_cal_data; VL53L1_gain_calibration_data_t gain_cal; VL53L1_user_zone_t mm_roi; VL53L1_optical_centre_t optical_centre; /*!< tuning parameter storage */ VL53L1_tuning_parm_storage_t tuning_parms; /*!< private return good SPAD map */ uint8_t rtn_good_spads[VL53L1_RTN_SPAD_BUFFER_SIZE]; /*!< private internal configuration structures */ VL53L1_refspadchar_config_t refspadchar; VL53L1_ssc_config_t ssc_cfg; VL53L1_xtalk_config_t xtalk_cfg; VL53L1_offsetcal_config_t offsetcal_cfg; /*!< private internal register data structures */ VL53L1_static_nvm_managed_t stat_nvm; VL53L1_static_config_t stat_cfg; VL53L1_general_config_t gen_cfg; VL53L1_timing_config_t tim_cfg; VL53L1_dynamic_config_t dyn_cfg; VL53L1_system_control_t sys_ctrl; VL53L1_system_results_t sys_results; VL53L1_nvm_copy_data_t nvm_copy_data; /*!< Private Offset structure */ VL53L1_offset_range_results_t offset_results; /*!< private debug register data structures */ VL53L1_core_results_t core_results; VL53L1_debug_results_t dbg_results; /* Start Patch_LowPowerAutoMode */ /*!< Low Powr Auto Mode Data */ VL53L1_low_power_auto_data_t low_power_auto_data; /* End Patch_LowPowerAutoMode */ #ifdef PAL_EXTENDED /* Patch Debug Data */ VL53L1_patch_results_t patch_results; VL53L1_shadow_core_results_t shadow_core_results; VL53L1_shadow_system_results_t shadow_sys_results; VL53L1_prev_shadow_core_results_t prev_shadow_core_results; VL53L1_prev_shadow_system_results_t prev_shadow_sys_results; #endif } VL53L1_LLDriverData_t; /** * @struct VL53L1_LLDriverResults_t * * @brief VL53L1 LL Driver ST private results structure * */ typedef struct { /* Private last range results */ VL53L1_range_results_t range_results; } VL53L1_LLDriverResults_t; /** * @struct VL53L1_calibration_data_t * * @brief Per Part calibration data * */ typedef struct { uint32_t struct_version; VL53L1_customer_nvm_managed_t customer; VL53L1_additional_offset_cal_data_t add_off_cal_data; VL53L1_optical_centre_t optical_centre; VL53L1_gain_calibration_data_t gain_cal; VL53L1_cal_peak_rate_map_t cal_peak_rate_map; } VL53L1_calibration_data_t; /** * @struct VL53L1_tuning_parameters_t * * @brief Tuning Parameters Debug data * */ typedef struct { uint16_t vl53l1_tuningparm_version; uint16_t vl53l1_tuningparm_key_table_version; uint16_t vl53l1_tuningparm_lld_version; uint8_t vl53l1_tuningparm_consistency_lite_phase_tolerance; uint8_t vl53l1_tuningparm_phasecal_target; uint16_t vl53l1_tuningparm_lite_cal_repeat_rate; uint16_t vl53l1_tuningparm_lite_ranging_gain_factor; uint8_t vl53l1_tuningparm_lite_min_clip_mm; uint16_t vl53l1_tuningparm_lite_long_sigma_thresh_mm; uint16_t vl53l1_tuningparm_lite_med_sigma_thresh_mm; uint16_t vl53l1_tuningparm_lite_short_sigma_thresh_mm; uint16_t vl53l1_tuningparm_lite_long_min_count_rate_rtn_mcps; uint16_t vl53l1_tuningparm_lite_med_min_count_rate_rtn_mcps; uint16_t vl53l1_tuningparm_lite_short_min_count_rate_rtn_mcps; uint8_t vl53l1_tuningparm_lite_sigma_est_pulse_width; uint8_t vl53l1_tuningparm_lite_sigma_est_amb_width_ns; uint8_t vl53l1_tuningparm_lite_sigma_ref_mm; uint8_t vl53l1_tuningparm_lite_rit_mult; uint8_t vl53l1_tuningparm_lite_seed_config; uint8_t vl53l1_tuningparm_lite_quantifier; uint8_t vl53l1_tuningparm_lite_first_order_select; int16_t vl53l1_tuningparm_lite_xtalk_margin_kcps; uint8_t vl53l1_tuningparm_initial_phase_rtn_lite_long_range; uint8_t vl53l1_tuningparm_initial_phase_rtn_lite_med_range; uint8_t vl53l1_tuningparm_initial_phase_rtn_lite_short_range; uint8_t vl53l1_tuningparm_initial_phase_ref_lite_long_range; uint8_t vl53l1_tuningparm_initial_phase_ref_lite_med_range; uint8_t vl53l1_tuningparm_initial_phase_ref_lite_short_range; uint8_t vl53l1_tuningparm_timed_seed_config; uint8_t vl53l1_tuningparm_vhv_loopbound; uint8_t vl53l1_tuningparm_refspadchar_device_test_mode; uint8_t vl53l1_tuningparm_refspadchar_vcsel_period; uint32_t vl53l1_tuningparm_refspadchar_phasecal_timeout_us; uint16_t vl53l1_tuningparm_refspadchar_target_count_rate_mcps; uint16_t vl53l1_tuningparm_refspadchar_min_countrate_limit_mcps; uint16_t vl53l1_tuningparm_refspadchar_max_countrate_limit_mcps; uint16_t vl53l1_tuningparm_offset_cal_dss_rate_mcps; uint32_t vl53l1_tuningparm_offset_cal_phasecal_timeout_us; uint32_t vl53l1_tuningparm_offset_cal_mm_timeout_us; uint32_t vl53l1_tuningparm_offset_cal_range_timeout_us; uint8_t vl53l1_tuningparm_offset_cal_pre_samples; uint8_t vl53l1_tuningparm_offset_cal_mm1_samples; uint8_t vl53l1_tuningparm_offset_cal_mm2_samples; uint8_t vl53l1_tuningparm_spadmap_vcsel_period; uint8_t vl53l1_tuningparm_spadmap_vcsel_start; uint16_t vl53l1_tuningparm_spadmap_rate_limit_mcps; uint16_t vl53l1_tuningparm_lite_dss_config_target_total_rate_mcps; uint16_t vl53l1_tuningparm_timed_dss_config_target_total_rate_mcps; uint32_t vl53l1_tuningparm_lite_phasecal_config_timeout_us; uint32_t vl53l1_tuningparm_timed_phasecal_config_timeout_us; uint32_t vl53l1_tuningparm_lite_mm_config_timeout_us; uint32_t vl53l1_tuningparm_timed_mm_config_timeout_us; uint32_t vl53l1_tuningparm_lite_range_config_timeout_us; uint32_t vl53l1_tuningparm_timed_range_config_timeout_us; uint8_t vl53l1_tuningparm_lowpowerauto_vhv_loop_bound; uint32_t vl53l1_tuningparm_lowpowerauto_mm_config_timeout_us; uint32_t vl53l1_tuningparm_lowpowerauto_range_config_timeout_us; } VL53L1_tuning_parameters_t; /** * @struct VL53L1_spad_rate_data_t * @brief SPAD Rate Data output by SSC * * Container for the SPAD Rate data output by SPAD select check (SSC) * The data is stored in the buffer in SPAD number order and not * raster order * * Rate data is it either 1.15 or 9.7 fixed point format */ typedef struct { uint8_t spad_type; /*!< Type of rate data stored */ uint16_t buffer_size; /*!< SPAD buffer size : should be at least 256 for EwokPlus25 */ uint16_t rate_data[VL53L1_NO_OF_SPAD_ENABLES]; /*!< word buffer containing the SPAD rates */ uint16_t no_of_values; /*!< Number of bytes used in the buffer */ uint8_t fractional_bits; /*!< Number of fractional bits either 7 or 15 */ uint8_t error_status; /*!< Set if supplied buffer is too small */ } VL53L1_spad_rate_data_t; /* Start Patch_AdditionalDebugData_11823 */ /** * @struct VL53L1_additional_data_t * @brief Additional debug data * * Contains the LL Driver configuration information */ typedef struct { VL53L1_DevicePresetModes preset_mode; /*!< Current preset mode */ VL53L1_DeviceMeasurementModes measurement_mode; /*!< Current measurement mode */ uint32_t phasecal_config_timeout_us; /*!< requested Phase Cal Timeout e.g. 1000us */ uint32_t mm_config_timeout_us; /*!< requested MM Timeout e.g. 2000us */ uint32_t range_config_timeout_us; /*!< requested Ranging Timeout e.g 13000us */ uint32_t inter_measurement_period_ms; /*!< requested Timing mode repeat period e.g 100ms */ uint16_t dss_config__target_total_rate_mcps; /*!< requested DSS Target Total Rate in 9.7 format e.g. 40.0Mcps*/ } VL53L1_additional_data_t; /* End Patch_AdditionalDebugData_11823 */ /** @} VL53L1_globalLLDriverDefine_group */ #define SUPPRESS_UNUSED_WARNING(x) \ ((void) (x)) #define IGNORE_STATUS(__FUNCTION_ID__, __ERROR_STATUS_CHECK__, __STATUS__) \ do { \ DISABLE_WARNINGS(); \ if (__FUNCTION_ID__) { \ if (__STATUS__ == __ERROR_STATUS_CHECK__) { \ __STATUS__ = VL53L1_ERROR_NONE; \ WARN_OVERRIDE_STATUS(__FUNCTION_ID__); \ } \ } \ ENABLE_WARNINGS(); \ } \ while (0) #define VL53L1_COPYSTRING(str, ...) \ (strncpy(str, ##__VA_ARGS__, VL53L1_MAX_STRING_LENGTH-1)) #ifdef __cplusplus } #endif #endif /* _VL53L1_LL_DEF_H_ */
31.256597
85
0.71797
6f76293ce30921fb9316996ef10d1bc2c3c08848
12,975
h
C
mcrouter/stat_list.h
PPC64/mcrouter
76edd6c9c18a291845476a8b1d9a3e2df4716018
[ "BSD-3-Clause" ]
1
2015-06-16T14:58:48.000Z
2015-06-16T14:58:48.000Z
mcrouter/stat_list.h
PPC64/mcrouter
76edd6c9c18a291845476a8b1d9a3e2df4716018
[ "BSD-3-Clause" ]
null
null
null
mcrouter/stat_list.h
PPC64/mcrouter
76edd6c9c18a291845476a8b1d9a3e2df4716018
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ // @nolint #define GROUP mcproxy_stats | detailed_stats STSS(version, MCROUTER_PACKAGE_STRING, 0) STSS(commandargs, "", 0) STSI(child_pid, 0, 0) STSI(parent_pid, 0, 0) STUI(time, 0, 0) #undef GROUP #define GROUP ods_stats | mcproxy_stats | detailed_stats STUI(uptime, 0, 0) STUI(num_servers, 0, 1) STUI(num_servers_new, 0, 1) STUI(num_servers_up, 0, 1) STUI(num_servers_down, 0, 1) STUI(num_servers_closed, 0, 1) STUI(num_clients, 0, 1) STUI(num_suspect_servers, 0, 1) #undef GROUP #define GROUP ods_stats | mcproxy_stats /* Total reqs in mc client yet to be sent to memcache. */ STUI(mcc_txbuf_reqs, 0, 1) /* Total reqs waiting for reply from memcache. */ STUI(mcc_waiting_replies, 0, 1) STAT(destination_batch_size, stat_double, 0, .dbl = 0.0) STUI(asynclog_requests, 0, 1) /* Proxy requests we started routing */ STUI(proxy_reqs_processing, 0, 1) /* Proxy requests queued up and not routed yet */ STUI(proxy_reqs_waiting, 0, 1) STAT(client_queue_notify_period, stat_double, 0, .dbl = 0.0) // STUI(bytes_read, 0) // STUI(bytes_written, 0) // STUI(get_hits, 0) // STUI(get_misses, 0) STAT(rusage_system, stat_double, 0, .dbl = 0.0) STAT(rusage_user, stat_double, 0, .dbl = 0.0) STUI(ps_num_minor_faults, 0, 0) STUI(ps_num_major_faults, 0, 0) STAT(ps_user_time_sec, stat_double, 0, .dbl = 0.0) STAT(ps_system_time_sec, stat_double, 0, .dbl = 0.0) STUI(ps_vsize, 0, 0) STUI(ps_rss, 0, 0) STUI(fibers_allocated, 0, 0) STUI(fibers_pool_size, 0, 0) STUI(fibers_stack_high_watermark, 0, 0) // STUI(failed_client_connections, 0) STUI(successful_client_connections, 0, 1) STUI(cycles_avg, 0, 1) STUI(cycles_min, 0, 1) STUI(cycles_max, 0, 1) STUI(cycles_p01, 0, 1) STUI(cycles_p05, 0, 1) STUI(cycles_p50, 0, 1) STUI(cycles_p95, 0, 1) STUI(cycles_p99, 0, 1) STUI(cycles_num, 0, 1) STAT(duration_us, stat_double, 0, .dbl = 0.0) #undef GROUP #define GROUP ods_stats | detailed_stats | count_stats STUI(rate_limited_log_count, 0, 1) #undef GROUP #define GROUP ods_stats | mcproxy_stats | cmd_all_stats | \ cmd_in_stats | count_stats STUI(cmd_cas_count, 0, 1) STUI(cmd_delete_count, 0, 1) STUI(cmd_get_count, 0, 1) STUI(cmd_gets_count, 0, 1) STUI(cmd_set_count, 0, 1) #undef GROUP #define GROUP ods_stats | mcproxy_stats | cmd_all_stats | \ cmd_out_stats | count_stats | outlier_stats STUI(cmd_cas_outlier_count, 0, 1) STUI(cmd_cas_outlier_failover_count, 0, 1) STUI(cmd_cas_outlier_shadow_count, 0, 1) STUI(cmd_cas_outlier_all_count, 0, 1) STUI(cmd_delete_outlier_count, 0, 1) STUI(cmd_delete_outlier_failover_count, 0, 1) STUI(cmd_delete_outlier_shadow_count, 0, 1) STUI(cmd_delete_outlier_all_count, 0, 1) STUI(cmd_get_outlier_count, 0, 1) STUI(cmd_get_outlier_failover_count, 0, 1) STUI(cmd_get_outlier_shadow_count, 0, 1) STUI(cmd_get_outlier_all_count, 0, 1) STUI(cmd_gets_outlier_count, 0, 1) STUI(cmd_gets_outlier_failover_count, 0, 1) STUI(cmd_gets_outlier_shadow_count, 0, 1) STUI(cmd_gets_outlier_all_count, 0, 1) STUI(cmd_set_outlier_count, 0, 1) STUI(cmd_set_outlier_failover_count, 0, 1) STUI(cmd_set_outlier_shadow_count, 0, 1) STUI(cmd_set_outlier_all_count, 0, 1) STUI(cmd_other_outlier_count, 0, 1) STUI(cmd_other_outlier_failover_count, 0, 1) STUI(cmd_other_outlier_shadow_count, 0, 1) STUI(cmd_other_outlier_all_count, 0, 1) #undef GROUP #define GROUP ods_stats | mcproxy_stats | detailed_stats | cmd_all_stats | \ cmd_in_stats | rate_stats STUIR(cmd_cas, 0, 1) STUIR(cmd_delete, 0, 1) STUIR(cmd_get, 0, 1) STUIR(cmd_gets, 0, 1) STUIR(cmd_set, 0, 1) #undef GROUP #define GROUP ods_stats | mcproxy_stats | detailed_stats | cmd_all_stats | \ cmd_out_stats | rate_stats | outlier_stats STUIR(cmd_cas_outlier, 0, 1) STUIR(cmd_cas_outlier_failover, 0, 1) STUIR(cmd_cas_outlier_shadow, 0, 1) STUIR(cmd_cas_outlier_all, 0, 1) STUIR(cmd_delete_outlier, 0, 1) STUIR(cmd_delete_outlier_failover, 0, 1) STUIR(cmd_delete_outlier_shadow, 0, 1) STUIR(cmd_delete_outlier_all, 0, 1) STUIR(cmd_get_outlier, 0, 1) STUIR(cmd_get_outlier_failover, 0, 1) STUIR(cmd_get_outlier_shadow, 0, 1) STUIR(cmd_get_outlier_all, 0, 1) STUIR(cmd_gets_outlier, 0, 1) STUIR(cmd_gets_outlier_failover, 0, 1) STUIR(cmd_gets_outlier_shadow, 0, 1) STUIR(cmd_gets_outlier_all, 0, 1) STUIR(cmd_set_outlier, 0, 1) STUIR(cmd_set_outlier_failover, 0, 1) STUIR(cmd_set_outlier_shadow, 0, 1) STUIR(cmd_set_outlier_all, 0, 1) STUIR(cmd_other_outlier, 0, 1) STUIR(cmd_other_outlier_failover, 0, 1) STUIR(cmd_other_outlier_shadow, 0, 1) STUIR(cmd_other_outlier_all, 0, 1) #undef GROUP #define GROUP ods_stats | cmd_all_stats | cmd_in_stats | count_stats STUI(cmd_add_count, 0, 1) STUI(cmd_decr_count, 0, 1) STUI(cmd_incr_count, 0, 1) STUI(cmd_lease_get_count, 0, 1) STUI(cmd_lease_set_count, 0, 1) STUI(cmd_meta_count, 0, 1) STUI(cmd_other_count, 0, 1) STUI(cmd_replace_count, 0, 1) STUI(cmd_stats_count, 0, 1) #undef GROUP #define GROUP ods_stats | detailed_stats | cmd_all_stats | cmd_in_stats | \ rate_stats STUIR(cmd_add, 0, 1) STUIR(cmd_decr, 0, 1) STUIR(cmd_incr, 0, 1) STUIR(cmd_lease_get, 0, 1) STUIR(cmd_lease_set, 0, 1) STUIR(cmd_meta, 0, 1) STUIR(cmd_other, 0, 1) STUIR(cmd_replace, 0, 1) STUIR(cmd_stats, 0, 1) #undef GROUP #define GROUP cmd_all_stats | cmd_out_stats | count_stats STUI(cmd_cas_out_count, 0, 1) STUI(cmd_cas_out_failover_count, 0, 1) STUI(cmd_cas_out_shadow_count, 0, 1) STUI(cmd_cas_out_all_count, 0, 1) STUI(cmd_delete_out_count, 0, 1) STUI(cmd_delete_out_failover_count, 0, 1) STUI(cmd_delete_out_shadow_count, 0, 1) STUI(cmd_delete_out_all_count, 0, 1) STUI(cmd_get_out_count, 0, 1) STUI(cmd_get_out_failover_count, 0, 1) STUI(cmd_get_out_shadow_count, 0, 1) STUI(cmd_get_out_all_count, 0, 1) STUI(cmd_gets_out_count, 0, 1) STUI(cmd_gets_out_failover_count, 0, 1) STUI(cmd_gets_out_shadow_count, 0, 1) STUI(cmd_gets_out_all_count, 0, 1) STUI(cmd_set_out_count, 0, 1) STUI(cmd_set_out_failover_count, 0, 1) STUI(cmd_set_out_shadow_count, 0, 1) STUI(cmd_set_out_all_count, 0, 1) STUI(cmd_add_out_count, 0, 1) STUI(cmd_add_out_failover_count, 0, 1) STUI(cmd_add_out_shadow_count, 0, 1) STUI(cmd_add_out_all_count, 0, 1) STUI(cmd_decr_out_count, 0, 1) STUI(cmd_decr_out_failover_count, 0, 1) STUI(cmd_decr_out_shadow_count, 0, 1) STUI(cmd_decr_out_all_count, 0, 1) STUI(cmd_incr_out_count, 0, 1) STUI(cmd_incr_out_failover_count, 0, 1) STUI(cmd_incr_out_shadow_count, 0, 1) STUI(cmd_incr_out_all_count, 0, 1) STUI(cmd_lease_get_out_count, 0, 1) STUI(cmd_lease_get_out_failover_count, 0, 1) STUI(cmd_lease_get_out_shadow_count, 0, 1) STUI(cmd_lease_get_out_all_count, 0, 1) STUI(cmd_lease_set_out_count, 0, 1) STUI(cmd_lease_set_out_failover_count, 0, 1) STUI(cmd_lease_set_out_shadow_count, 0, 1) STUI(cmd_lease_set_out_all_count, 0, 1) STUI(cmd_meta_out_count, 0, 1) STUI(cmd_meta_out_failover_count, 0, 1) STUI(cmd_meta_out_shadow_count, 0, 1) STUI(cmd_meta_out_all_count, 0, 1) STUI(cmd_other_out_count, 0, 1) STUI(cmd_other_out_failover_count, 0, 1) STUI(cmd_other_out_shadow_count, 0, 1) STUI(cmd_other_out_all_count, 0, 1) STUI(cmd_replace_out_count, 0, 1) STUI(cmd_replace_out_failover_count, 0, 1) STUI(cmd_replace_out_shadow_count, 0, 1) STUI(cmd_replace_out_all_count, 0, 1) #undef GROUP #define GROUP ods_stats | detailed_stats | cmd_all_stats | cmd_out_stats | \ rate_stats STUIR(cmd_cas_out, 0, 1) STUIR(cmd_cas_out_failover, 0, 1) STUIR(cmd_cas_out_shadow, 0, 1) STUIR(cmd_cas_out_all, 0, 1) STUIR(cmd_delete_out, 0, 1) STUIR(cmd_delete_out_failover, 0, 1) STUIR(cmd_delete_out_shadow, 0, 1) STUIR(cmd_delete_out_all, 0, 1) STUIR(cmd_get_out, 0, 1) STUIR(cmd_get_out_failover, 0, 1) STUIR(cmd_get_out_shadow, 0, 1) STUIR(cmd_get_out_all, 0, 1) STUIR(cmd_gets_out, 0, 1) STUIR(cmd_gets_out_failover, 0, 1) STUIR(cmd_gets_out_shadow, 0, 1) STUIR(cmd_gets_out_all, 0, 1) STUIR(cmd_set_out, 0, 1) STUIR(cmd_set_out_failover, 0, 1) STUIR(cmd_set_out_shadow, 0, 1) STUIR(cmd_set_out_all, 0, 1) STUIR(cmd_add_out, 0, 1) STUIR(cmd_add_out_failover, 0, 1) STUIR(cmd_add_out_shadow, 0, 1) STUIR(cmd_add_out_all, 0, 1) STUIR(cmd_decr_out, 0, 1) STUIR(cmd_decr_out_failover, 0, 1) STUIR(cmd_decr_out_shadow, 0, 1) STUIR(cmd_decr_out_all, 0, 1) STUIR(cmd_incr_out, 0, 1) STUIR(cmd_incr_out_failover, 0, 1) STUIR(cmd_incr_out_shadow, 0, 1) STUIR(cmd_incr_out_all, 0, 1) STUIR(cmd_lease_get_out, 0, 1) STUIR(cmd_lease_get_out_failover, 0, 1) STUIR(cmd_lease_get_out_shadow, 0, 1) STUIR(cmd_lease_get_out_all, 0, 1) STUIR(cmd_lease_set_out, 0, 1) STUIR(cmd_lease_set_out_failover, 0, 1) STUIR(cmd_lease_set_out_shadow, 0, 1) STUIR(cmd_lease_set_out_all, 0, 1) STUIR(cmd_meta_out, 0, 1) STUIR(cmd_meta_out_failover, 0, 1) STUIR(cmd_meta_out_shadow, 0, 1) STUIR(cmd_meta_out_all, 0, 1) STUIR(cmd_other_out, 0, 1) STUIR(cmd_other_out_failover, 0, 1) STUIR(cmd_other_out_shadow, 0, 1) STUIR(cmd_other_out_all, 0, 1) STUIR(cmd_replace_out, 0, 1) STUIR(cmd_replace_out_failover, 0, 1) STUIR(cmd_replace_out_shadow, 0, 1) STUIR(cmd_replace_out_all, 0, 1) #undef GROUP #define GROUP ods_stats | detailed_stats STUI(config_age, 0, 0) STUI(config_last_attempt, 0, 0) STUI(config_last_success, 0, 0) STUI(config_failures, 0, 0) STUI(start_time, 0, 0) STUI(dev_null_requests, 0, 1) #undef GROUP #define GROUP count_stats STUI(request_sent_count, 0, 1) STUI(request_error_count, 0, 1) STUI(request_success_count, 0, 1) STUI(request_replied_count, 0, 1) #undef GROUP #define GROUP ods_stats | detailed_stats | rate_stats STUIR(request_sent, 0, 1) STUIR(request_error, 0, 1) STUIR(request_success, 0, 1) STUIR(request_replied, 0, 1) STUIR(client_queue_notifications, 0, 1) #undef GROUP #define GROUP ods_stats | count_stats STUI(result_error_count, 0, 1) STUI(result_error_failover_count, 0, 1) STUI(result_error_shadow_count, 0, 1) STUI(result_error_all_count, 0, 1) STUI(result_connect_error_count, 0, 1) STUI(result_connect_error_failover_count, 0, 1) STUI(result_connect_error_shadow_count, 0, 1) STUI(result_connect_error_all_count, 0, 1) STUI(result_connect_timeout_count, 0, 1) STUI(result_connect_timeout_failover_count, 0, 1) STUI(result_connect_timeout_shadow_count, 0, 1) STUI(result_connect_timeout_all_count, 0, 1) STUI(result_data_timeout_count, 0, 1) STUI(result_data_timeout_failover_count, 0, 1) STUI(result_data_timeout_shadow_count, 0, 1) STUI(result_data_timeout_all_count, 0, 1) STUI(result_busy_count, 0, 1) STUI(result_busy_failover_count, 0, 1) STUI(result_busy_shadow_count, 0, 1) STUI(result_busy_all_count, 0, 1) STUI(result_tko_count, 0, 1) STUI(result_tko_failover_count, 0, 1) STUI(result_tko_shadow_count, 0, 1) STUI(result_tko_all_count, 0, 1) STUI(result_local_error_count, 0, 1) STUI(result_local_error_failover_count, 0, 1) STUI(result_local_error_shadow_count, 0, 1) STUI(result_local_error_all_count, 0, 1) #undef GROUP #define GROUP ods_stats | detailed_stats | rate_stats STUIR(result_error, 0, 1) STUIR(result_error_failover, 0, 1) STUIR(result_error_shadow, 0, 1) STUIR(result_error_all, 0, 1) STUIR(result_connect_error, 0, 1) STUIR(result_connect_error_failover, 0, 1) STUIR(result_connect_error_shadow, 0, 1) STUIR(result_connect_error_all, 0, 1) STUIR(result_connect_timeout, 0, 1) STUIR(result_connect_timeout_failover, 0, 1) STUIR(result_connect_timeout_shadow, 0, 1) STUIR(result_connect_timeout_all, 0, 1) STUIR(result_data_timeout, 0, 1) STUIR(result_data_timeout_failover, 0, 1) STUIR(result_data_timeout_shadow, 0, 1) STUIR(result_data_timeout_all, 0, 1) STUIR(result_busy, 0, 1) STUIR(result_busy_failover, 0, 1) STUIR(result_busy_shadow, 0, 1) STUIR(result_busy_all, 0, 1) STUIR(result_tko, 0, 1) STUIR(result_tko_failover, 0, 1) STUIR(result_tko_shadow, 0, 1) STUIR(result_tko_all, 0, 1) STUIR(result_local_error, 0, 1) STUIR(result_local_error_failover, 0, 1) STUIR(result_local_error_shadow, 0, 1) STUIR(result_local_error_all, 0, 1) #undef GROUP #define GROUP detailed_stats STAT(rusage, stat_string_fn, 0, .string_fn = &stat_get_rusage) #undef GROUP #define GROUP memory_stats | ods_stats | detailed_stats #ifndef FBCODE_OPT_BUILD STUI(mc_msg_num_outstanding, 0, 0) #endif STUI(proxy_request_num_outstanding, 0, 1) #undef GROUP #define GROUP memory_stats STUI(mcrouter_queue_entry_num_outstanding, 0, 1) #undef GROUP
35.45082
79
0.74921
6fb7c3ec22c41d8a234e3f9b17f7fd331a73e630
7,817
c
C
blink/main/blink.c
lowkeyinc/esp32dev
b9d2211851bfbb2fc1e33c598bcb77e03aa100ba
[ "Apache-2.0" ]
null
null
null
blink/main/blink.c
lowkeyinc/esp32dev
b9d2211851bfbb2fc1e33c598bcb77e03aa100ba
[ "Apache-2.0" ]
null
null
null
blink/main/blink.c
lowkeyinc/esp32dev
b9d2211851bfbb2fc1e33c598bcb77e03aa100ba
[ "Apache-2.0" ]
null
null
null
#include <stdio.h> #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gpio.h" #include "sdkconfig.h" #include "ble_hidd.c" #include "freertos/queue.h" #define LED_GPIO 32 #define BUTTON_GPIO 5 static bool led_state = false; typedef struct { bool down; uint8_t key;} key_press; static QueueHandle_t key_buffer; #define ifwhile(COND) if(COND)while(COND) void bluetooth_task(void *pvParameters){ #define LOG_NAME "ble_key_buffer_reader" vTaskDelay(1000 / portTICK_PERIOD_MS); key_press key_value; while(1) { vTaskDelay(100 / portTICK_PERIOD_MS); ifwhile(uxQueueMessagesWaiting(key_buffer)){ ESP_LOGI(LOG_NAME, "Send the letter"); xQueueReceive(key_buffer,&key_value,0/*no wait*/); esp_hidd_send_keyboard_value(hid_conn_id, 0, &key_value.key, key_value.down); vTaskDelay(10/portTICK_PERIOD_MS); // for interupts }else{ ESP_LOGI(LOG_NAME, "No Letters, sleeping for a while"); vTaskDelay(1000/portTICK_PERIOD_MS); // TODO: Go into low power sleep for the keys to wake up from. } } #undef LOG_NAME } void setup_ble_hidd(){ esp_err_t ret; // Initialize NVS. ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); } ESP_ERROR_CHECK( ret ); ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT)); esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); ret = esp_bt_controller_init(&bt_cfg); if (ret) { ESP_LOGE(BLE_HID_LOG_NAME, "%s initialize controller failed\n", __func__); return; } ret = esp_bt_controller_enable(ESP_BT_MODE_BLE); if (ret) { ESP_LOGE(BLE_HID_LOG_NAME, "%s enable controller failed\n", __func__); return; } ret = esp_bluedroid_init(); if (ret) { ESP_LOGE(BLE_HID_LOG_NAME, "%s init bluedroid failed\n", __func__); return; } ret = esp_bluedroid_enable(); if (ret) { ESP_LOGE(BLE_HID_LOG_NAME, "%s init bluedroid failed\n", __func__); return; } if((ret = esp_hidd_profile_init()) != ESP_OK) { ESP_LOGE(BLE_HID_LOG_NAME, "%s init bluedroid failed\n", __func__); } ///register the callback function to the gap module esp_ble_gap_register_callback(gap_event_handler); esp_hidd_register_callbacks(hidd_event_callback); /* set the security iocap & auth_req & key size & init key response key parameters to the stack*/ esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND; //bonding with peer device after authentication esp_ble_io_cap_t iocap = ESP_IO_CAP_NONE; //set the IO capability to No output No input uint8_t key_size = 16; //the key size should be 7~16 bytes uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK; uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK; esp_ble_gap_set_security_param(ESP_BLE_SM_AUTHEN_REQ_MODE, &auth_req, sizeof(uint8_t)); esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t)); esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t)); /* If your BLE device act as a Slave, the init_key means you hope which types of key of the master should distribute to you, and the response key means which key you can distribute to the Master; If your BLE device act as a master, the response key means you hope which types of key of the slave should distribute to you, and the init key means which key you can distribute to the slave. */ esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t)); esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t)); xTaskCreate(&bluetooth_task, "hid_task", 2048, NULL, 5, NULL); } void app_main(void){ /* Configure the IOMUX register for pad LED_GPIO (some pads are muxed to GPIO on reset already, but some default to other functions and need to be switched to GPIO. Consult the Technical Reference for a list of pads and their default functions.) */ gpio_pad_select_gpio(LED_GPIO); gpio_pad_select_gpio(BUTTON_GPIO); gpio_set_direction(LED_GPIO, GPIO_MODE_OUTPUT); gpio_set_direction(BUTTON_GPIO, GPIO_MODE_INPUT); // Setup global state. key_buffer = xQueueCreate(1<<7,sizeof(key_press)); // Start bluetooth worker. setup_ble_hidd(); // Main loop bool pressed=false; gpio_set_level(LED_GPIO, led_state); bool toggel=false; while(1) { pressed=!gpio_get_level(BUTTON_GPIO); if(led_state!=pressed){ printf("Turning %s the LED\n",pressed?"on":"off"); gpio_set_level(LED_GPIO, (led_state=pressed)); key_press k; if(pressed)if((toggel=!toggel)){ printf("Sending \"Hello, world!\""); k.key=HID_KEY_RIGHT_SHIFT;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_H;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_H;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_RIGHT_SHIFT;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_E;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_E;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_L;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_L;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_L;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_L;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_O;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_O;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_COMMA;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_COMMA;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_SPACEBAR;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_SPACEBAR;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_W;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_W;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_O;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_O;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_R;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_R;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_L;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_L;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_D;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_D;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_LEFT_SHIFT;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_1;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_1;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_LEFT_SHIFT;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_RETURN;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_RETURN;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); }else{ printf("Clearing \"Hello, world!\""); for(int i=0;i<14;i++){ k.key=HID_KEY_DELETE;k.down=true; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); k.key=HID_KEY_DELETE;k.down=false; xQueueSendToBackFromISR(key_buffer,&k,pdFALSE); } } } vTaskDelay(10 / portTICK_PERIOD_MS); } }
33.986957
130
0.743508
c0edc6ea4adc41c27bd4599c0842188fc441e9ad
1,291
h
C
System/Library/Frameworks/SwiftUI.framework/SwiftUI.ViewGraph.h
lechium/tvOS145Headers
9940da19adb0017f8037853e9cfccbe01b290dd5
[ "MIT" ]
5
2021-04-29T04:31:43.000Z
2021-08-19T18:59:58.000Z
System/Library/Frameworks/SwiftUI.framework/SwiftUI.ViewGraph.h
lechium/tvOS145Headers
9940da19adb0017f8037853e9cfccbe01b290dd5
[ "MIT" ]
null
null
null
System/Library/Frameworks/SwiftUI.framework/SwiftUI.ViewGraph.h
lechium/tvOS145Headers
9940da19adb0017f8037853e9cfccbe01b290dd5
[ "MIT" ]
1
2022-03-19T11:16:23.000Z
2022-03-19T11:16:23.000Z
/* * This header is generated by classdump-dyld 1.5 * on Wednesday, April 28, 2021 at 9:10:16 PM Mountain Standard Time * Operating System: Version 14.5 (Build 18L204) * Image Source: /System/Library/Frameworks/SwiftUI.framework/SwiftUI * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ @interface SwiftUI.ViewGraph : _UKNOWN_SUPERCLASS_ { rootViewType; makeRootView; delegate; centersRootView; rootView; _rootTransform; _zeroPoint; _emptyViewResponders; _proposedSize; _safeAreaInsets; _rootGeometry; _position; _dimensions; _updateSeed; _gestureTime; _gestureEvents; _inheritedPhase; _gestureResetSeed; _failedPhase; _rootPhase; eventSubgraph; _defaultLayoutComputer; _focusedValues; _rootResponders; _rootAccessibilityNodes; _rootLayoutComputer; _rootDisplayList; _rootPlatformItemList; _viewDebugValues; cachedIdealSize; cachedSizeThatFits; sizeThatFitsObserver; requestedOutputs; disabledOutputs; needsFocusUpdate; nextUpdate; preferenceBridge; bridgedPreferences; accessibilityRelationshipScope; } @end
23.472727
130
0.695585
c0eea671409b1085e174b0e2735083fda7542e63
22,871
c
C
modules/Singlediodeparams.c
kanderso-nrel/pysam
a90c24730ad03b2042f6ef9a1deb82d97c620cf7
[ "BSD-3-Clause" ]
null
null
null
modules/Singlediodeparams.c
kanderso-nrel/pysam
a90c24730ad03b2042f6ef9a1deb82d97c620cf7
[ "BSD-3-Clause" ]
null
null
null
modules/Singlediodeparams.c
kanderso-nrel/pysam
a90c24730ad03b2042f6ef9a1deb82d97c620cf7
[ "BSD-3-Clause" ]
1
2019-05-21T23:16:24.000Z
2019-05-21T23:16:24.000Z
#include <Python.h> #include <SAM_Singlediodeparams.h> #include <SAM_api.h> #include "PySAM_utils.h" /* * SingleDiodeModel Group */ static PyTypeObject SingleDiodeModel_Type; static PyObject * SingleDiodeModel_new(SAM_Singlediodeparams data_ptr) { PyObject* new_obj = SingleDiodeModel_Type.tp_alloc(&SingleDiodeModel_Type,0); VarGroupObject* SingleDiodeModel_obj = (VarGroupObject*)new_obj; SingleDiodeModel_obj->data_ptr = (SAM_table)data_ptr; return new_obj; } /* SingleDiodeModel methods */ static PyObject * SingleDiodeModel_assign(VarGroupObject *self, PyObject *args) { PyObject* dict; if (!PyArg_ParseTuple(args, "O:assign", &dict)){ return NULL; } if (!PySAM_assign_from_dict(self->data_ptr, dict, "Singlediodeparams", "SingleDiodeModel")){ return NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * SingleDiodeModel_export(VarGroupObject *self, PyObject *args) { PyTypeObject* tp = &SingleDiodeModel_Type; PyObject* dict = PySAM_export_to_dict((PyObject *) self, tp); return dict; } static PyMethodDef SingleDiodeModel_methods[] = { {"assign", (PyCFunction)SingleDiodeModel_assign, METH_VARARGS, PyDoc_STR("assign() -> None\n Assign attributes from dictionary\n\n``SingleDiodeModel_vals = { var: val, ...}``")}, {"export", (PyCFunction)SingleDiodeModel_export, METH_VARARGS, PyDoc_STR("export() -> dict\n Export attributes into dictionary")}, {NULL, NULL} /* sentinel */ }; static PyObject * SingleDiodeModel_get_Adj_ref(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_Adj_ref_nget, self->data_ptr); } static int SingleDiodeModel_set_Adj_ref(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_Adj_ref_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_I(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_I_nget, self->data_ptr); } static int SingleDiodeModel_set_I(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_I_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_Il_ref(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_Il_ref_nget, self->data_ptr); } static int SingleDiodeModel_set_Il_ref(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_Il_ref_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_Io_ref(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_Io_ref_nget, self->data_ptr); } static int SingleDiodeModel_set_Io_ref(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_Io_ref_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_Rs_ref(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_Rs_ref_nget, self->data_ptr); } static int SingleDiodeModel_set_Rs_ref(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_Rs_ref_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_Rsh_ref(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_Rsh_ref_nget, self->data_ptr); } static int SingleDiodeModel_set_Rsh_ref(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_Rsh_ref_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_T(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_T_nget, self->data_ptr); } static int SingleDiodeModel_set_T(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_T_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_a_ref(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_a_ref_nget, self->data_ptr); } static int SingleDiodeModel_set_a_ref(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_a_ref_nset, self->data_ptr); } static PyObject * SingleDiodeModel_get_alpha_isc(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_SingleDiodeModel_alpha_isc_nget, self->data_ptr); } static int SingleDiodeModel_set_alpha_isc(VarGroupObject *self, PyObject *value, void *closure) { return PySAM_double_setter(value, SAM_Singlediodeparams_SingleDiodeModel_alpha_isc_nset, self->data_ptr); } static PyGetSetDef SingleDiodeModel_getset[] = { {"Adj_ref", (getter)SingleDiodeModel_get_Adj_ref,(setter)SingleDiodeModel_set_Adj_ref, PyDoc_STR("*float*: OC SC temp coeff adjustment [%]\n\n*Required*: True"), NULL}, {"I", (getter)SingleDiodeModel_get_I,(setter)SingleDiodeModel_set_I, PyDoc_STR("*float*: Irradiance [W/m2]\n\n*Required*: True"), NULL}, {"Il_ref", (getter)SingleDiodeModel_get_Il_ref,(setter)SingleDiodeModel_set_Il_ref, PyDoc_STR("*float*: Light current [A]\n\n*Required*: True"), NULL}, {"Io_ref", (getter)SingleDiodeModel_get_Io_ref,(setter)SingleDiodeModel_set_Io_ref, PyDoc_STR("*float*: Saturation current [A]\n\n*Required*: True"), NULL}, {"Rs_ref", (getter)SingleDiodeModel_get_Rs_ref,(setter)SingleDiodeModel_set_Rs_ref, PyDoc_STR("*float*: Series resistance [ohm]\n\n*Required*: True"), NULL}, {"Rsh_ref", (getter)SingleDiodeModel_get_Rsh_ref,(setter)SingleDiodeModel_set_Rsh_ref, PyDoc_STR("*float*: Shunt resistance [ohm]\n\n*Required*: True"), NULL}, {"T", (getter)SingleDiodeModel_get_T,(setter)SingleDiodeModel_set_T, PyDoc_STR("*float*: Temperature [C]\n\n*Required*: True"), NULL}, {"a_ref", (getter)SingleDiodeModel_get_a_ref,(setter)SingleDiodeModel_set_a_ref, PyDoc_STR("*float*: Modified nonideality factor [1/V]\n\n*Required*: True"), NULL}, {"alpha_isc", (getter)SingleDiodeModel_get_alpha_isc,(setter)SingleDiodeModel_set_alpha_isc, PyDoc_STR("*float*: Temp coeff of current at SC [A/'C]\n\n*Required*: True"), NULL}, {NULL} /* Sentinel */ }; static PyTypeObject SingleDiodeModel_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ PyVarObject_HEAD_INIT(NULL, 0) "Singlediodeparams.SingleDiodeModel", /*tp_name*/ sizeof(VarGroupObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ 0, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistofnset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ SingleDiodeModel_methods, /*tp_methods*/ 0, /*tp_members*/ SingleDiodeModel_getset, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictofnset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ 0, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ }; /* * Outputs Group */ static PyTypeObject Outputs_Type; static PyObject * Outputs_new(SAM_Singlediodeparams data_ptr) { PyObject* new_obj = Outputs_Type.tp_alloc(&Outputs_Type,0); VarGroupObject* Outputs_obj = (VarGroupObject*)new_obj; Outputs_obj->data_ptr = (SAM_table)data_ptr; return new_obj; } /* Outputs methods */ static PyObject * Outputs_assign(VarGroupObject *self, PyObject *args) { PyObject* dict; if (!PyArg_ParseTuple(args, "O:assign", &dict)){ return NULL; } if (!PySAM_assign_from_dict(self->data_ptr, dict, "Singlediodeparams", "Outputs")){ return NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * Outputs_export(VarGroupObject *self, PyObject *args) { PyTypeObject* tp = &Outputs_Type; PyObject* dict = PySAM_export_to_dict((PyObject *) self, tp); return dict; } static PyMethodDef Outputs_methods[] = { {"assign", (PyCFunction)Outputs_assign, METH_VARARGS, PyDoc_STR("assign() -> None\n Assign attributes from dictionary\n\n``Outputs_vals = { var: val, ...}``")}, {"export", (PyCFunction)Outputs_export, METH_VARARGS, PyDoc_STR("export() -> dict\n Export attributes into dictionary")}, {NULL, NULL} /* sentinel */ }; static PyObject * Outputs_get_Il(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_Outputs_Il_nget, self->data_ptr); } static PyObject * Outputs_get_Io(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_Outputs_Io_nget, self->data_ptr); } static PyObject * Outputs_get_Rs(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_Outputs_Rs_nget, self->data_ptr); } static PyObject * Outputs_get_Rsh(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_Outputs_Rsh_nget, self->data_ptr); } static PyObject * Outputs_get_a(VarGroupObject *self, void *closure) { return PySAM_double_getter(SAM_Singlediodeparams_Outputs_a_nget, self->data_ptr); } static PyGetSetDef Outputs_getset[] = { {"Il", (getter)Outputs_get_Il,(setter)0, PyDoc_STR("*float*: Light current [A]"), NULL}, {"Io", (getter)Outputs_get_Io,(setter)0, PyDoc_STR("*float*: Saturation current [A]"), NULL}, {"Rs", (getter)Outputs_get_Rs,(setter)0, PyDoc_STR("*float*: Series resistance [ohm]"), NULL}, {"Rsh", (getter)Outputs_get_Rsh,(setter)0, PyDoc_STR("*float*: Shunt resistance [ohm]"), NULL}, {"a", (getter)Outputs_get_a,(setter)0, PyDoc_STR("*float*: Modified nonideality factor [1/V]"), NULL}, {NULL} /* Sentinel */ }; static PyTypeObject Outputs_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ PyVarObject_HEAD_INIT(NULL, 0) "Singlediodeparams.Outputs", /*tp_name*/ sizeof(VarGroupObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ 0, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistofnset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ Outputs_methods, /*tp_methods*/ 0, /*tp_members*/ Outputs_getset, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictofnset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ 0, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ }; /* * Singlediodeparams */ static PyTypeObject Singlediodeparams_Type; static CmodObject * newSinglediodeparamsObject(void* data_ptr) { CmodObject *self; self = PyObject_New(CmodObject, &Singlediodeparams_Type); PySAM_TECH_ATTR("Singlediodeparams", SAM_Singlediodeparams_construct) PyObject* SingleDiodeModel_obj = SingleDiodeModel_new(self->data_ptr); PyDict_SetItemString(attr_dict, "SingleDiodeModel", SingleDiodeModel_obj); Py_DECREF(SingleDiodeModel_obj); PyObject* Outputs_obj = Outputs_new(self->data_ptr); PyDict_SetItemString(attr_dict, "Outputs", Outputs_obj); Py_DECREF(Outputs_obj); return self; } /* Singlediodeparams methods */ static void Singlediodeparams_dealloc(CmodObject *self) { Py_XDECREF(self->x_attr); if (!self->data_owner_ptr) SAM_Singlediodeparams_destruct(self->data_ptr); PyObject_Del(self); } static PyObject * Singlediodeparams_execute(CmodObject *self, PyObject *args) { int verbosity = 0; if (!PyArg_ParseTuple(args, "|i", &verbosity)) return NULL; SAM_error error = new_error(); SAM_Singlediodeparams_execute(self->data_ptr, verbosity, &error); if (PySAM_has_error(error )) return NULL; Py_INCREF(Py_None); return Py_None; } static PyObject * Singlediodeparams_assign(CmodObject *self, PyObject *args) { PyObject* dict; if (!PyArg_ParseTuple(args, "O:assign", &dict)){ return NULL; } if (!PySAM_assign_from_nested_dict((PyObject*)self, self->x_attr, self->data_ptr, dict, "Singlediodeparams")) return NULL; Py_INCREF(Py_None); return Py_None; } static PyObject * Singlediodeparams_export(CmodObject *self, PyObject *args) { return PySAM_export_to_nested_dict((PyObject *) self, self->x_attr); } static PyObject * Singlediodeparams_value(CmodObject *self, PyObject *args) { return CmodObject_value(self, args); } static PyMethodDef Singlediodeparams_methods[] = { {"execute", (PyCFunction)Singlediodeparams_execute, METH_VARARGS, PyDoc_STR("execute(int verbosity) -> None\n Execute simulation with verbosity level 0 (default) or 1")}, {"assign", (PyCFunction)Singlediodeparams_assign, METH_VARARGS, PyDoc_STR("assign(dict) -> None\n Assign attributes from nested dictionary, except for Outputs\n\n``nested_dict = { 'Single Diode Model': { var: val, ...}, ...}``")}, {"export", (PyCFunction)Singlediodeparams_export, METH_VARARGS, PyDoc_STR("export() -> dict\n Export attributes into nested dictionary")}, {"value", (PyCFunction)Singlediodeparams_value, METH_VARARGS, PyDoc_STR("value(name, optional value) -> Union[None, float, dict, sequence, str]\n Get or set by name a value in any of the variable groups.")}, {NULL, NULL} /* sentinel */ }; static PyObject * Singlediodeparams_getattro(CmodObject *self, PyObject *name) { return PySAM_get_attr((PyObject*) self, (PyObject*) self->x_attr, name); } static int Singlediodeparams_setattr(CmodObject *self, const char *name, PyObject *v) { return PySAM_set_attr((PyObject*)self, (PyObject*)self->x_attr, name, v); } static PyTypeObject Singlediodeparams_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ PyVarObject_HEAD_INIT(NULL, 0) "Singlediodeparams", /*tp_name*/ sizeof(CmodObject),/*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)Singlediodeparams_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)Singlediodeparams_setattr, /*tp_setattr*/ 0, /*tp_reserved*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ (getattrofunc)Singlediodeparams_getattro, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ "This class contains all the variable information for running a simulation. Variables are grouped together in the subclasses as properties. If property assignments are the wrong type, an error is thrown.", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistofnset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ Singlediodeparams_methods, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictofnset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ 0, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ }; /* --------------------------------------------------------------------- */ /* Function of no arguments returning new Singlediodeparams object */ static PyObject * Singlediodeparams_new(PyObject *self, PyObject *args) { CmodObject *rv; rv = newSinglediodeparamsObject(0); if (rv == NULL) return NULL; rv->data_owner_ptr = NULL; return (PyObject *)rv; } static PyObject * Singlediodeparams_wrap(PyObject *self, PyObject *args) { CmodObject *rv; long long int ptr = 0; // 64 bit arch if (!PyArg_ParseTuple(args, "L:wrap", &ptr)){ PyErr_BadArgument(); return NULL; } rv = newSinglediodeparamsObject((void*)ptr); if (rv == NULL) return NULL; rv->data_owner_ptr = NULL; return (PyObject *)rv; } static PyObject * Singlediodeparams_default(PyObject *self, PyObject *args) { CmodObject *rv; char* def = 0; if (!PyArg_ParseTuple(args, "s:default", &def)){ PyErr_BadArgument(); return NULL; } rv = newSinglediodeparamsObject(0); if (rv == NULL) return NULL; rv->data_owner_ptr = NULL; PySAM_load_defaults((PyObject*)rv, rv->x_attr, rv->data_ptr, "Singlediodeparams", def); return (PyObject *)rv; } static PyObject * Singlediodeparams_from_existing(PyObject *self, PyObject *args) { CmodObject *rv; PyObject * module = 0; char* def = 0; if (!PyArg_ParseTuple(args, "O|s:from_existing", &module, &def)){ PyErr_BadArgument(); return NULL; } CmodObject *module_obj = (CmodObject *)module; SAM_table ptr = module_obj->data_ptr; // do a rough validity check on the data by checking its size SAM_error error = new_error(); int data_size = SAM_table_size(ptr, &error); if (PySAM_has_error(error)) goto fail; if (data_size < 0) goto fail; rv = newSinglediodeparamsObject((void*)ptr); if (rv == NULL) goto fail; rv->data_owner_ptr = module; if (!def) return (PyObject *)rv; PySAM_load_defaults((PyObject*)rv, rv->x_attr, rv->data_ptr, "Singlediodeparams", def); return (PyObject *)rv; fail: Py_DECREF(module); return NULL; }/* ---------- */ /* List of functions defined in the module */ static PyMethodDef SinglediodeparamsModule_methods[] = { {"new", Singlediodeparams_new, METH_VARARGS, PyDoc_STR("new() -> Singlediodeparams")}, {"default", Singlediodeparams_default, METH_VARARGS, PyDoc_STR("default(config) -> Singlediodeparams\n\nUse financial config-specific default attributes\n" "")}, {"wrap", Singlediodeparams_wrap, METH_VARARGS, PyDoc_STR("wrap(ssc_data_t) -> Singlediodeparams\n\nUse existing PySSC data\n\n.. warning::\n\n Do not call PySSC.data_free on the ssc_data_t provided to ``wrap``")}, {"from_existing", Singlediodeparams_from_existing, METH_VARARGS, PyDoc_STR("from_existing(data, optional config) -> Singlediodeparams\n\nShare underlying data with an existing PySAM class. If config provided, default attributes are loaded otherwise.")}, {NULL, NULL} /* sentinel */ }; PyDoc_STRVAR(module_doc, "Singlediodeparams"); static int SinglediodeparamsModule_exec(PyObject *m) { /* Finalize the type object including setting type of the new type * object; doing it here is required for portability, too. */ if (PySAM_load_lib(m) < 0) goto fail; if (PySAM_init_error(m) < 0) goto fail; Singlediodeparams_Type.tp_dict = PyDict_New(); if (!Singlediodeparams_Type.tp_dict) { goto fail; } /// Add the SingleDiodeModel type object to Singlediodeparams_Type if (PyType_Ready(&SingleDiodeModel_Type) < 0) { goto fail; } PyDict_SetItemString(Singlediodeparams_Type.tp_dict, "SingleDiodeModel", (PyObject*)&SingleDiodeModel_Type); Py_DECREF(&SingleDiodeModel_Type); /// Add the Outputs type object to Singlediodeparams_Type if (PyType_Ready(&Outputs_Type) < 0) { goto fail; } PyDict_SetItemString(Singlediodeparams_Type.tp_dict, "Outputs", (PyObject*)&Outputs_Type); Py_DECREF(&Outputs_Type); /// Add the Singlediodeparams type object to the module if (PyType_Ready(&Singlediodeparams_Type) < 0) { goto fail; } PyModule_AddObject(m, "Singlediodeparams", (PyObject*)&Singlediodeparams_Type); return 0; fail: Py_XDECREF(m); return -1; } static struct PyModuleDef_Slot SinglediodeparamsModule_slots[] = { {Py_mod_exec, SinglediodeparamsModule_exec}, {0, NULL}, }; static struct PyModuleDef SinglediodeparamsModule = { PyModuleDef_HEAD_INIT, "Singlediodeparams", module_doc, 0, SinglediodeparamsModule_methods, SinglediodeparamsModule_slots, NULL, NULL, NULL }; /* Export function for the module */ PyMODINIT_FUNC PyInit_Singlediodeparams(void) { return PyModuleDef_Init(&SinglediodeparamsModule); }
31.942737
225
0.650824
022398cd8dfbabccf151ae5d28ac7b02731a2d64
36,579
c
C
f_util.c
coliveira/xfignew
770930da640cbe140dfefeddfc6075489abf6435
[ "Unlicense" ]
1
2016-05-08T20:54:24.000Z
2016-05-08T20:54:24.000Z
f_util.c
coliveira/xfignew
770930da640cbe140dfefeddfc6075489abf6435
[ "Unlicense" ]
null
null
null
f_util.c
coliveira/xfignew
770930da640cbe140dfefeddfc6075489abf6435
[ "Unlicense" ]
null
null
null
/* * FIG : Facility for Interactive Generation of figures * Copyright (c) 1989-2002 by Brian V. Smith * * Any party obtaining a copy of these files is granted, free of charge, a * full and unrestricted irrevocable, world-wide, paid up, royalty-free, * nonexclusive right and license to deal in this software and documentation * files (the "Software"), including without limitation the rights to use, * copy, modify, merge, publish distribute, sublicense and/or sell copies of * the Software, and to permit persons who receive copies from any such * party to do so, with the only requirement being that the above copyright * and this permission notice remain intact. * */ #include "fig.h" #include "resources.h" #include "object.h" #include "mode.h" #include "f_neuclrtab.h" #include "f_read.h" #include "f_util.h" #include "u_create.h" #include "w_file.h" #include "w_indpanel.h" #include "w_color.h" #include "w_util.h" #include "w_icons.h" #include "w_msgpanel.h" #include "version.h" #include "f_save.h" #include "u_fonts.h" #include "w_cursor.h" /* LOCALS */ int count_colors(void); int count_pixels(void); /* PROCEDURES */ void beep (void); void alloc_imagecolors (int num); void add_all_pixels (void); void remap_image_colormap (void); void extract_cmap (void); void readjust_cmap (void); void free_pixmaps (F_compound *obj); void add_recent_file (char *file); int strain_out (char *name); void finish_update_xfigrc (void); int emptyname(char *name) { if (name == NULL || *name == '\0') { return (1); } else { return (0); } } int emptyname_msg(char *name, char *msg) { int returnval; if (returnval = emptyname(name)) { put_msg("No file name specified, %s command ignored", msg); beep(); } return (returnval); } int emptyfigure(void) { if (objects.texts != NULL) return (0); if (objects.lines != NULL) return (0); if (objects.ellipses != NULL) return (0); if (objects.splines != NULL) return (0); if (objects.arcs != NULL) return (0); if (objects.compounds != NULL) return (0); return (1); } int emptyfigure_msg(char *msg) { int returnval; if (returnval = emptyfigure()) { put_msg("Empty figure, %s command ignored", msg); beep(); } return (returnval); } int change_directory(char *path) { if (path == NULL || *path == '\0') return 0; if (chdir(path) == -1) { file_msg("Can't go to directory %s, : %s", path, strerror(errno)); return 1; } return 0; } int get_directory(char *direct) { #if defined(SYSV) || defined(SVR4) || defined(_POSIX_SOURCE) extern char *getcwd(char *, size_t); #else extern char *getwd(); #endif /* defined(SYSV) || defined(SVR4) || defined(_POSIX_SOURCE) */ #if defined(SYSV) || defined(SVR4) || defined(_POSIX_SOURCE) if (getcwd(direct, PATH_MAX) == NULL) { /* get current working dir */ file_msg("Can't get current directory"); beep(); #else if (getwd(direct) == NULL) { /* get current working dir */ file_msg("%s", direct); /* err msg is in direct var */ beep(); #endif /* defined(SYSV) || defined(SVR4) || defined(_POSIX_SOURCE) */ *direct = '\0'; return 0; } return 1; } #ifndef S_IWUSR #define S_IWUSR 0000200 #endif /* S_IWUSR */ #ifndef S_IWGRP #define S_IWGRP 0000020 #endif /* S_IWGRP */ #ifndef S_IWOTH #define S_IWOTH 0000002 #endif /* S_IWOTH */ int ok_to_write(char *file_name, char *op_name) { struct stat file_status; char string[180]; if (stat(file_name, &file_status) == 0) { /* file exists */ if (file_status.st_mode & S_IFDIR) { put_msg("\"%s\" is a directory", file_name); beep(); return 0; } if (file_status.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) { /* writing is permitted by SOMEONE */ if (access(file_name, W_OK)) { put_msg("Write permission for \"%s\" is denied", file_name); beep(); return 0; } else { if (warnexist) { sprintf(string, "\"%s\" already exists.\nDo you want to overwrite it?", file_name); if (popup_query(QUERY_YESNO, string) != RESULT_YES) { put_msg("%s cancelled", op_name); return 0; } } else { return 1; } } } else { put_msg("\"%s\" is read only", file_name); beep(); return 0; } } else { if (errno != ENOENT) return 0; /* file does exist but stat fails */ } return 1; } /* for systems without basename() (e.g. SunOS 4.1.3) */ /* strip any path from filename */ char * xf_basename(char *filename) { char *p; if (filename == NULL || *filename == '\0') return filename; if (p=strrchr(filename,'/')) { return ++p; } else { return filename; } } static int scol, ncolors; static int num_oldcolors = -1; static Boolean usenet; static int npixels; #define REMAP_MSG "Remapping picture colors..." #define REMAP_MSG2 "Remapping picture colors...Done" /* remap the colors for all the pictures in the picture repository */ void remap_imagecolors(void) { int i; /* if monochrome, return */ if (tool_cells <= 2 || appres.monochrome) return; npixels = 0; /* first see if there are enough colorcells for all image colors */ usenet = False; /* see if the total number of colors will fit without using the neural net */ ncolors = count_colors(); if (ncolors == 0) return; put_msg(REMAP_MSG); set_temp_cursor(wait_cursor); app_flush(); if (ncolors > appres.max_image_colors) { if (appres.DEBUG) fprintf(stderr,"More colors (%d) than allowed (%d), using neural net\n", ncolors,appres.max_image_colors); ncolors = appres.max_image_colors; usenet = True; } /* if this is the first image, allocate the number of colorcells we need */ if (num_oldcolors != ncolors) { if (num_oldcolors != -1) { unsigned long pixels[MAX_USR_COLS]; for (i=0; i<num_oldcolors; i++) pixels[i] = image_cells[i].pixel; if (tool_vclass == PseudoColor) XFreeColors(tool_d, tool_cm, pixels, num_oldcolors, 0); } alloc_imagecolors(ncolors); /* hmm, we couldn't get that number of colors anyway; use the net, Luke */ if (ncolors > avail_image_cols) { usenet = True; if (appres.DEBUG) fprintf(stderr,"More colors (%d) than available (%d), using neural net\n", ncolors,avail_image_cols); } num_oldcolors = avail_image_cols; if (avail_image_cols < 2 && ncolors >= 2) { file_msg("Cannot allocate even 2 colors for pictures"); reset_cursor(); num_oldcolors = -1; reset_cursor(); put_msg(REMAP_MSG2); app_flush(); return; } } reset_cursor(); if (usenet) { int stat; int mult = 1; /* check if user pressed cancel button (in file preview) */ if (check_cancel()) return; /* count total number of pixels in all the pictures */ npixels = count_pixels(); /* check if user pressed cancel button */ if (check_cancel()) return; /* initialize the neural network */ /* -1 means can't alloc memory, -2 or more means must have that many times as many pixels */ set_temp_cursor(wait_cursor); if ((stat=neu_init(npixels)) <= -2) { mult = -stat; npixels *= mult; /* try again with more pixels */ stat = neu_init2(npixels); } if (stat == -1) { /* couldn't alloc memory for network */ fprintf(stderr,"Can't alloc memory for neural network\n"); reset_cursor(); put_msg(REMAP_MSG2); app_flush(); return; } /* now add all pixels to the samples */ for (i=0; i<mult; i++) add_all_pixels(); /* make a new colortable with the optimal colors */ avail_image_cols = neu_clrtab(avail_image_cols); /* now change the color cells with the new colors */ /* clrtab[][] is the colormap produced by neu_clrtab */ for (i=0; i<avail_image_cols; i++) { image_cells[i].red = (unsigned short) clrtab[i][N_RED] << 8; image_cells[i].green = (unsigned short) clrtab[i][N_GRN] << 8; image_cells[i].blue = (unsigned short) clrtab[i][N_BLU] << 8; } YStoreColors(tool_cm, image_cells, avail_image_cols); reset_cursor(); /* check if user pressed cancel button */ if (check_cancel()) return; /* get the new, mapped indices for the image colormap */ remap_image_colormap(); } else { /* * Extract the RGB values from the image's colormap and allocate * the appropriate X colormap entries. */ scol = 0; /* global color counter */ set_temp_cursor(wait_cursor); extract_cmap(); for (i=0; i<scol; i++) { image_cells[i].flags = DoRed|DoGreen|DoBlue; } YStoreColors(tool_cm, image_cells, scol); scol = 0; /* global color counter */ readjust_cmap(); if (appres.DEBUG) fprintf(stderr,"Able to use %d colors without neural net\n",scol); reset_cursor(); } put_msg(REMAP_MSG2); app_flush(); } /* allocate the color cells for the pictures */ void alloc_imagecolors(int num) { int i; /* see if we can get all user wants */ avail_image_cols = num; for (i=0; i<avail_image_cols; i++) { image_cells[i].flags = DoRed|DoGreen|DoBlue; if (!alloc_color_cells(&image_cells[i].pixel, 1)) { break; } } avail_image_cols = i; } /* count the number of colors in all the pictures in the picture repository */ int count_colors(void) { int ncolors; struct _pics *pics; ncolors = 0; for (pics = pictures; pics; pics = pics->next) if (pics->bitmap != NULL) ncolors += pics->numcols; return ncolors; } int count_pixels(void) { int npixels; struct _pics *pics; npixels = 0; for (pics = pictures; pics; pics = pics->next) if (pics->bitmap != NULL && pics->numcols > 0) npixels += pics->bit_size.x * pics->bit_size.y; return npixels; } void readjust_cmap(void) { struct _pics *pics; int i, j; /* first adjust the colormaps in the repository */ for (pics = pictures; pics; pics = pics->next) if (pics->bitmap != NULL && pics->numcols > 0) { for (i=0; i<pics->numcols; i++) { j = pics->cmap[i].pixel; pics->cmap[i].pixel = image_cells[j].pixel; scol++; } } /* now free up all pixmaps in picture objects */ /* start with main list */ free_pixmaps(&objects); } void free_pixmaps(F_compound *obj) { F_line *l; F_compound *c; /* traverse the compounds in this compound */ for (c = obj->compounds; c != NULL; c = c->next) { free_pixmaps(c); } for (l = obj->lines; l != NULL; l = l->next) { if (l->type == T_PICTURE) { if (l->pic->pixmap != (Pixmap) NULL) { if (l->pic->pixmap) XFreePixmap(tool_d, l->pic->pixmap); l->pic->pixmap = 0; /* this will force regeneration of the pixmap */ if (l->pic->mask != 0) XFreePixmap(tool_d, l->pic->mask); l->pic->mask = 0; } } } } void extract_cmap(void) { struct _pics *pics; int i; /* extract the colormaps in the repository */ for (pics = pictures; pics; pics = pics->next) if (pics->bitmap != NULL && pics->numcols > 0) { for (i=0; i<pics->numcols; i++) { image_cells[scol].red = pics->cmap[i].red << 8; image_cells[scol].green = pics->cmap[i].green << 8; image_cells[scol].blue = pics->cmap[i].blue << 8; pics->cmap[i].pixel = scol; scol++; } } /* now free up the pixmaps */ free_pixmaps(&objects); } void add_all_pixels(void) { struct _pics *pics; BYTE col[3]; int i, npix; register unsigned char byte; for (pics = pictures; pics; pics = pics->next) if (pics->bitmap != NULL && pics->numcols > 0) { /* now add each pixel to the sample list */ npix = pics->bit_size.x * pics->bit_size.y; for (i=0; i < npix; i++) { /* check if user pressed cancel button */ if (i%1000==0 && check_cancel()) return; byte = pics->bitmap[i]; col[N_RED] = pics->cmap[byte].red; col[N_GRN] = pics->cmap[byte].green; col[N_BLU] = pics->cmap[byte].blue; neu_pixel(col); } } } void remap_image_colormap(void) { struct _pics *pics; BYTE col[3]; int i; int p; for (pics = pictures; pics; pics = pics->next) if (pics->bitmap != NULL && pics->numcols > 0) { for (i=0; i<pics->numcols; i++) { /* real color from the image */ col[N_RED] = pics->cmap[i].red; col[N_GRN] = pics->cmap[i].green; col[N_BLU] = pics->cmap[i].blue; /* X color index from the mapping */ p = neu_map_pixel(col); pics->cmap[i].pixel = image_cells[p].pixel; } } free_pixmaps(&objects); } /* map the bytes in pic->pic_cache->bitmap to bits for monochrome display */ /* DESTROYS original pic->pic_cache->bitmap */ /* uses a Floyd-Steinberg algorithm from the pbmplus package */ /* Here is the copyright notice: ** ** Copyright (C) 1989 by Jef Poskanzer. ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all copies and that both that ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. ** */ #define FS_SCALE 1024 #define HALF_FS_SCALE 512 #define MAXVAL (256*256) void map_to_mono(F_pic *pic) { unsigned char *dptr = pic->pic_cache->bitmap; /* 8-bit wide data pointer */ unsigned char *bptr; /* 1-bit wide bitmap pointer */ int bitp; int col, row, limitcol; int width, height; long grey, threshval, sum; long *thiserr, *nexterr, *temperr; unsigned char *cP, *bP; Boolean fs_direction; int sbit; width = pic->pic_cache->bit_size.x; height = pic->pic_cache->bit_size.y; /* allocate space for 1-bit bitmap */ if ((bptr = (unsigned char*) malloc(sizeof(unsigned char) * (width+7)/8*height)) == NULL) return; thiserr = (long *) malloc(sizeof(long) * (width+2)); nexterr = (long *) malloc(sizeof(long) * (width+2)); /* initialize random seed */ srandom( (int) (time(0)^getpid()) ); for (col=0; col<width+2; col++) { /* (random errors in [-FS_SCALE/8 .. FS_SCALE/8]) */ thiserr[col] = ( random() % FS_SCALE - HALF_FS_SCALE) / 4; } fs_direction = True; threshval = FS_SCALE/2; /* starting bit for left-hand scan */ sbit = 1 << (7-((width-1)%8)); for (row=0; row<height; row++) { for (col=0; col<width+2; col++) nexterr[col] = 0; if (fs_direction) { col = 0; limitcol = width; cP = &dptr[row*width]; bP = &bptr[row*(int)((width+7)/8)]; bitp = 0x80; } else { col = width - 1; limitcol = -1; cP = &dptr[row*width+col]; bP = &bptr[(row+1)*(int)((width+7)/8) - 1]; bitp = sbit; } do { grey = pic->pic_cache->cmap[*cP].red * 77 + /* 0.30 * 256 */ pic->pic_cache->cmap[*cP].green * 151 + /* 0.59 * 256 */ pic->pic_cache->cmap[*cP].blue * 28; /* 0.11 * 256 */ sum = ( grey * FS_SCALE ) / MAXVAL + thiserr[col+1]; if (sum >= threshval) { *bP |= bitp; /* white bit */ sum = sum - threshval - HALF_FS_SCALE; } else { *bP &= ~bitp; /* black bit */ } if (fs_direction) { bitp >>= 1; if (bitp <= 0) { bP++; bitp = 0x80; } } else { bitp <<= 1; if (bitp > 0x80) { bP--; bitp = 0x01; } } if ( fs_direction ) { thiserr[col + 2] += ( sum * 7 ) / 16; nexterr[col ] += ( sum * 3 ) / 16; nexterr[col + 1] += ( sum * 5 ) / 16; nexterr[col + 2] += ( sum ) / 16; ++col; ++cP; } else { thiserr[col ] += ( sum * 7 ) / 16; nexterr[col + 2] += ( sum * 3 ) / 16; nexterr[col + 1] += ( sum * 5 ) / 16; nexterr[col ] += ( sum ) / 16; --col; --cP; } } while ( col != limitcol ); temperr = thiserr; thiserr = nexterr; nexterr = temperr; fs_direction = ! fs_direction; } free((char *) pic->pic_cache->bitmap); free((char *) thiserr); free((char *) nexterr); pic->pic_cache->bitmap = bptr; /* monochrome */ pic->pic_cache->numcols = 0; return; } void beep(void) { XBell(tool_d,0); } #ifdef NOSTRSTR char *strstr(s1, s2) char *s1, *s2; { int len2; char *stmp; len2 = strlen(s2); for (stmp = s1; *stmp != NULL; stmp++) if (strncmp(stmp, s2, len2)==0) return stmp; return NULL; } #endif /* NOSTRSTR */ /* strncasecmp and strcasecmp by Fred Appelman (Fred.Appelman@cv.ruu.nl) */ #ifdef HAVE_NO_STRNCASECMP int strncasecmp(const char* s1, const char* s2, int n) { char c1,c2; while (--n>=0) { /* Check for end of string, if either of the strings * is ended, we can terminate the test */ if (*s1=='\0' && *s2!='\0') return -1; /* s1 ended premature */ if (*s1!='\0' && *s2=='\0') return +1; /* s2 ended premature */ c1=toupper(*s1++); c2=toupper(*s2++); if (c1<c2) return -1; /* s1 is "smaller" */ if (c1>c2) return +1; /* s2 is "smaller" */ } return 0; } #endif /* HAVE_NO_STRNCASECMP */ #ifdef HAVE_NO_STRCASECMP int strcasecmp(const char* s1, const char* s2) { char c1,c2; while (*s1 && *s2) { c1=toupper(*s1++); c2=toupper(*s2++); if (c1<c2) return -1; /* s1 is "smaller" */ if (c1>c2) return +1; /* s2 is "smaller" */ } /* Check for end of string, if not both the strings ended they are * not the same. */ if (*s1=='\0' && *s2!='\0') return -1; /* s1 ended premature */ if (*s1!='\0' && *s2=='\0') return +1; /* s2 ended premature */ return 0; } #endif /* HAVE_NO_STRCASECMP */ /* this routine will safely copy overlapping strings */ /* p2 is copied to p1 and p1 is returned */ /* p1 must be < p2 */ char * safe_strcpy(char *p1, char *p2) { char *c1; c1 = p1; for ( ; *p2; ) *p1++ = *p2++; *p1 = '\0'; return c1; } /* gunzip file if necessary */ Boolean uncompress_file(char *name) { char plainname[PATH_MAX]; char dirname[PATH_MAX]; char tmpfile[PATH_MAX]; char unc[PATH_MAX+20]; /* temp buffer for uncompress/gunzip command */ char *c; struct stat status; strcpy(tmpfile, name); /* save original name */ strcpy(plainname, name); c = strrchr(plainname, '.'); if (c) { if (strcmp(c, ".gz") == 0 || strcmp(c, ".Z") == 0 || strcmp(c, ".z") == 0) *c = '\0'; } if (stat(name, &status)) { /* first see if file exists AS NAMED */ /* no, try without .gz etc suffix */ strcpy(name, plainname); if (stat(name, &status)) { /* no, try with a .z */ sprintf(name, "%s.z", plainname); if (stat(name, &status)) { /* no, try with .Z suffix */ sprintf(name, "%s.Z", plainname); if (stat(name, &status)) { /* no, try .gz */ sprintf(name, "%s.gz", plainname); if (stat(name, &status)) { /* none of the above, return original name and False status */ strcpy(name, tmpfile); return False; } } } } } /* file doesn't have .gz etc suffix anymore, return modified name */ if (strcmp(name, plainname) == 0) return True; strcpy(dirname, name); c = strrchr(dirname, '/'); if (c) *c = '\0'; else strcpy(dirname, "."); if (access(dirname, W_OK) == 0) { /* OK - the directory is writable */ sprintf(unc, "gunzip -q %s", name); if (system(unc) != 0) file_msg("Couldn't uncompress the file: \"%s\"", unc); strcpy(name, plainname); } else { /* the directory is not writable */ /* create a path to TMPDIR in case we need to uncompress a read-only file to there */ c = strrchr(plainname, '/'); if (c) sprintf(tmpfile, "%s%s", TMPDIR, c); else sprintf(tmpfile, "%s/%s", TMPDIR, plainname); sprintf(unc, "gunzip -q -c %s > %s", name, tmpfile); if (system(unc) != 0) file_msg("Couldn't uncompress the file: \"%s\"", unc); file_msg ("Uncompressing file %s in %s because it is in a read-only directory", name, TMPDIR); strcpy(name, tmpfile); } return True; } /*************************************************************/ /* Read the user's .xfigrc file in his home directory to get */ /* settings from previous session. */ /*************************************************************/ #define RC_BUFSIZ 1000 void read_xfigrc(void) { char line[RC_BUFSIZ+1], *word, *opnd; int i, len; FILE *xfigrc; num_recent_files = 0; max_recent_files = DEF_RECENT_FILES; /* default if none found in .xfigrc */ /* make the filename from the user's home path and ".xfigrc" */ strcpy(xfigrc_name,userhome); strcat(xfigrc_name,"/.xfigrc"); xfigrc = fopen(xfigrc_name,"r"); if (xfigrc == 0) return; /* no .xfigrc file */ /* there must not be any whitespace between word and ":" */ while (fgets(line, RC_BUFSIZ, xfigrc) != NULL) { word = strtok(line, ": \t"); opnd = strtok(NULL, "\n"); /* parse operand and remove newline */ if (!word || !opnd) continue; /* find first non-blank */ for (i=0, len=strlen(opnd); i<len; i++, opnd++) if (*opnd != ' ' && *opnd != '\t') break; /* nothing, do next */ if (i==len) continue; if (strcasecmp(word, "max_recent_files") == 0) max_recent_files = min2(MAX_RECENT_FILES, atoi(opnd)); else if (strcasecmp(word, "file") == 0) add_recent_file(opnd); } fclose(xfigrc); } /* add next token from 'line' to recent file list */ void add_recent_file(char *file) { char *name; if (file == NULL) return; if (num_recent_files >= MAX_RECENT_FILES || num_recent_files >= max_recent_files) return; name = new_string(strlen(file)+3); /* allow for file number (1), blank (1) and NUL */ sprintf(name,"%1d %s",num_recent_files+1,file); recent_files[num_recent_files].name = name; num_recent_files++; } static FILE *xfigrc, *tmpf; static char tmpname[PATH_MAX]; /* rewrite .xfigrc file with current list of recent files */ void update_recent_files(void) { int i; /* copy all lines without the "file" spec into a temp file */ if (strain_out("file") != 0) { if (tmpf != 0) fclose(tmpf); if (xfigrc != 0) fclose(xfigrc); return; /* problem creating temp file */ } /* now append file list */ for (i=0; i<num_recent_files; i++) fprintf(tmpf, "file: %s\n",&recent_files[i].name[2]); /* point past the number */ /* close and rename the files */ finish_update_xfigrc(); } /* update a named entry in the user's .xfigrc file */ void update_xfigrc(char *name, char *string) { /* first copy all lines except the one we want to the temp file */ strain_out(name); /* add the new name/string value to the file */ fprintf(tmpf, "%s: %s\n",name,string); /* close and rename the files */ finish_update_xfigrc(); } /* copy all lines from .xfigrc without the "name" spec into a temp file (global tmpf) */ /* temp file is left open after copy */ int strain_out(char *name) { char line[RC_BUFSIZ+1], *tok; /* make a temp filename in the user's home directory so we can just rename it to .xfigrc after creating it */ sprintf(tmpname, "%s/%s%06d", userhome, "xfig-xfigrc", getpid()); tmpf = fopen(tmpname,"wb"); if (tmpf == 0) { file_msg("Can't make temporary file for .xfigrc - error: %s",strerror(errno)); return -1; } /* read the .xfigrc file and write all to temp file except file names */ xfigrc = fopen(xfigrc_name,"r"); /* does the .xfigrc file exist? */ if (xfigrc == 0) { /* no, create one */ xfigrc = fopen(xfigrc_name,"wb"); if (xfigrc == 0) { file_msg("Can't create ~/.xfigrc - error: %s",strerror(errno)); return -1; } fclose(xfigrc); xfigrc = (FILE *) 0; return 0; } while (fgets(line, RC_BUFSIZ, xfigrc) != NULL) { /* look for sane input */ if (line[0] == '\0') break; /* make copy of line to look for token because strtok modifies the line */ tok = my_strdup(line); if (strcasecmp(strtok(tok, ": \t"), name) == 0) continue; /* match, skip */ fputs(line, tmpf); free(tok); } return 0; } void finish_update_xfigrc(void) { fclose(tmpf); if (xfigrc != 0) fclose(xfigrc); /* delete original .xfigrc and move temp file to .xfigrc */ if (unlink(xfigrc_name) != 0) { file_msg("Can't update your .xfigrc file - error: %s",strerror(errno)); return; } if (rename(tmpname, xfigrc_name) != 0) file_msg("Can't rename %s to .xfigrc - error: %s",tmpname, strerror(errno)); } /************************************************/ /* Copy initial appres settings to current vars */ /************************************************/ void init_settings(void) { /* also initialize print/export grid strings */ minor_grid[0] = major_grid[0] = '\0'; if (appres.startfontsize >= 1.0) cur_fontsize = round(appres.startfontsize); /* allow "Modern" for "Sans Serif" and allow "SansSerif" (no space) */ if (appres.startlatexFont) { if (strcmp(appres.startlatexFont,"Modern")==0 || strcmp(appres.startlatexFont,"SansSerif")==0) cur_latex_font = latexfontnum ("Sans Serif"); } else { cur_latex_font = latexfontnum (appres.startlatexFont); } cur_ps_font = psfontnum (appres.startpsFont); if (appres.startarrowtype >= 0) cur_arrowtype = appres.startarrowtype; if (appres.startarrowthick > 0.0) { use_abs_arrowvals = True; cur_arrowthick = appres.startarrowthick; } if (appres.startarrowwidth > 0.0) { use_abs_arrowvals = True; cur_arrowwidth = appres.startarrowwidth; } if (appres.startarrowlength > 0.0) { use_abs_arrowvals = True; cur_arrowheight = appres.startarrowlength; } if (appres.starttextstep > 0.0) cur_textstep = appres.starttextstep; if (appres.startfillstyle >= 0) cur_fillstyle = min2(appres.startfillstyle,NUMFILLPATS-1); if (appres.startlinewidth >= 0) cur_linewidth = min2(appres.startlinewidth,MAX_LINE_WIDTH); if (appres.startgridmode >= 0) cur_gridmode = min2(appres.startgridmode,GRID_4); if (appres.startposnmode >= 0) cur_pointposn = min2(appres.startposnmode,P_GRID4); /* choose grid units (1/16", 1/10", MM) */ /* default */ grid_unit = FRACT_UNIT; /* if inches is desired set grid unit to user spec (1/16" or 1/10") */ if (appres.INCHES) { /* make sure user specified one */ if (strcasecmp(appres.tgrid_unit, "default") != 0) { if (strcasecmp(appres.tgrid_unit, "tenth") == 0 || strcasecmp(appres.tgrid_unit, "ten") == 0 || strcasecmp(appres.tgrid_unit, "1/10") == 0 || strcasecmp(appres.tgrid_unit, "10") == 0) grid_unit = TENTH_UNIT; else grid_unit = FRACT_UNIT; } } else { grid_unit = MM_UNIT; } /* set current and "old" grid unit */ old_gridunit = cur_gridunit = grid_unit; /* turn off PSFONT_TEXT flag if user specified -latexfonts */ if (appres.latexfonts) cur_textflags = cur_textflags & (~PSFONT_TEXT); if (appres.specialtext) cur_textflags = cur_textflags | SPECIAL_TEXT; if (appres.rigidtext) cur_textflags = cur_textflags | RIGID_TEXT; if (appres.hiddentext) cur_textflags = cur_textflags | HIDDEN_TEXT; /* turn off PSFONT_TEXT flag if user specified -latexfonts */ if (appres.latexfonts) cur_textflags = cur_textflags & (~PSFONT_TEXT); if (appres.userunit) strncpy(cur_fig_units, appres.userunit, sizeof(cur_fig_units)-1); else cur_fig_units[0] = '\0'; strcpy(cur_library_dir, appres.library_dir); strcpy(cur_spellchk, appres.spellcheckcommand); strcpy(cur_image_editor, appres.image_editor); strcpy(cur_browser, appres.browser); strcpy(cur_pdfviewer, appres.pdf_viewer); /* assume color to start */ all_colors_available = True; /* check if monochrome screen */ if (tool_cells == 2 || appres.monochrome) all_colors_available = False; } /* init_settings() */ /* This is called to read a list of Fig files specified in the command line and write them back (renaming the original to xxxx.fig.bak) so that they are updated to the current version. If the file is already in the current version it is untouched. */ int update_fig_files(int argc, char **argv) { fig_settings settings; char file[PATH_MAX]; int i,col; Boolean status; int allstat; /* overall status - if any one file can't be read, return status is 1 */ allstat = 0; update_figs = True; for (i=1; i<argc; i++) { /* skip any other options the user may have given */ if (argv[i][0] == '-') { continue; } strcpy(file,argv[i]); fprintf(stderr,"* Reading %s ... ",file); /* reset user colors */ for (col=0; col<MAX_USR_COLS; col++) n_colorFree[col] = True; /* read Fig file but don't import any images */ status = read_fig(file, &objects, DONT_MERGE, 0, 0, &settings); if (status != 0) { fprintf(stderr," *** Error in reading, not updating this file\n"); allstat = 1; } else { fprintf(stderr,"Ok. Renamed to %s.bak. ",file); /* now rename original file to file.bak */ renamefile(file); fprintf(stderr,"Writing as protocol %s ... ",PROTOCOL_VERSION); /* first update the settings from appres */ appres.landscape = settings.landscape; appres.flushleft = settings.flushleft; appres.INCHES = settings.units; appres.papersize = settings.papersize; appres.magnification = settings.magnification; appres.multiple = settings.multiple; appres.transparent = settings.transparent; /* copy user colors */ for (col=0; col<MAX_USR_COLS; col++) { colorUsed[col] = !n_colorFree[col]; user_colors[col].red = n_user_colors[col].red; user_colors[col].green = n_user_colors[col].green; user_colors[col].blue = n_user_colors[col].blue; } /* now write out the new one */ num_usr_cols = MAX_USR_COLS; write_file(file, False); fprintf(stderr,"Ok\n"); } } return allstat; } /* replace all "%f" in "program" with value in filename */ char * build_command(char *program, char *filename) { char *cmd = new_string(PATH_MAX*2); char cmd2[PATH_MAX*2]; char *c1; Boolean repl = False; if (!cmd) return (char *) NULL; strcpy(cmd,program); while (c1=strstr(cmd,"%f")) { repl = True; strcpy(cmd2, c1+2); /* save tail */ strcpy(c1, filename); /* change %f to filename */ strcat(c1, cmd2); /* append tail */ } /* if no %f was found in the resource, just append the filename to the command */ if (!repl) { strcat(cmd," "); strcat(cmd,filename); } /* append "2> /dev/null" to send stderr to /dev/null and "&" to run in background */ strcat(cmd," 2> /dev/null &"); return cmd; } /* define the strerror() function to return str_errlist[] if the system doesn't have the strerror() function already */ #ifdef NEED_STRERROR char * strerror(e) int e; { return sys_errlist[e]; } #endif /* NEED_STRERROR */ /**************************************************************************/ /* Routine to mimic `my_strdup()' (some machines don't have it) */ /**************************************************************************/ char *my_strdup(char *str) { char *s; if (str==NULL) return NULL; s = new_string(strlen(str)+1); if (s!=NULL) strcpy(s, str); return s; } /* for images with no palette, we'll use neural net to reduce to 256 colors with palette */ Boolean map_to_palette(F_pic *pic) { int w,h,x,y; int mult, neu_stat, size; unsigned char *old; BYTE col[3]; w = pic->pic_cache->bit_size.x; h = pic->pic_cache->bit_size.y; mult = 1; if ((neu_stat=neu_init(w*h)) <= -2) { mult = -neu_stat; /* try again with more pixels */ neu_stat = neu_init2(w*h*mult); } if (neu_stat == -1) { /* couldn't alloc memory for network */ fprintf(stderr,"Can't alloc memory for neural network\n"); free(pic->pic_cache->bitmap); return False; } /* now add all pixels to the samples */ size = w*h*3; for (x=0; x<size;) { col[N_BLU] = pic->pic_cache->bitmap[x++]; col[N_GRN] = pic->pic_cache->bitmap[x++]; col[N_RED] = pic->pic_cache->bitmap[x++]; for (y=0; y<mult; y++) { neu_pixel(col); } } /* make a new colortable with the optimal colors */ pic->pic_cache->numcols = neu_clrtab(256); /* now change the color cells with the new colors */ /* clrtab[][] is the colormap produced by neu_clrtab */ for (x=0; x<pic->pic_cache->numcols; x++) { pic->pic_cache->cmap[x].red = (unsigned short) clrtab[x][N_RED]; pic->pic_cache->cmap[x].green = (unsigned short) clrtab[x][N_GRN]; pic->pic_cache->cmap[x].blue = (unsigned short) clrtab[x][N_BLU]; } /* now alloc a 1-byte/per/pixel array for the final colormapped image */ /* save orig */ old = pic->pic_cache->bitmap; if ((pic->pic_cache->bitmap=malloc(w*(h+2)))==NULL) return False; /* and change the 3-byte pixels to the 1-byte */ for (x=0, y=0; x<size; x+=3, y++) { col[N_BLU] = old[x]; col[N_GRN] = old[x+1]; col[N_RED] = old[x+2]; pic->pic_cache->bitmap[y] = neu_map_pixel(col); } /* free 3-byte/pixel array */ free(old); return True; } /* return pointers to the line components of a dimension line. If passed dimline is not a dimension line, the result is False */ Boolean dimline_components(F_compound *dimline, F_line **line, F_line **tick1, F_line **tick2, F_line **poly) { F_line *l; if (!dimline->comments || strncmp(dimline->comments,"Dimension line:",15) !=0 ) return False; *line = *tick1 = *tick2 = *poly = (F_line *) NULL; for (l = dimline->lines; l; l=l->next) { if (!l->comments) continue; if (strcmp(l->comments,"main dimension line")==0) *line = l; else if (strcmp(l->comments,"text box")==0) *poly = l; else if (strcmp(l->comments,"tick")==0) { if (*tick1 == 0) *tick1 = l; else *tick2 = l; } } return True; } int find_smallest_depth(F_compound *compound) { F_line *l; F_spline *s; F_ellipse *e; F_arc *a; F_text *t; F_compound *c; int smallest, d1; smallest = MAX_DEPTH; for (l = compound->lines; l != NULL; l = l->next) { if (l->depth < smallest) smallest = l->depth; } for (s = compound->splines; s != NULL; s = s->next) { if (s->depth < smallest) smallest = s->depth; } for (e = compound->ellipses; e != NULL; e = e->next) { if (e->depth < smallest) smallest = e->depth; } for (a = compound->arcs; a != NULL; a = a->next) { if (a->depth < smallest) smallest = a->depth; } for (t = compound->texts; t != NULL; t = t->next) { if (t->depth < smallest) smallest = t->depth; } for (c = compound->compounds; c != NULL; c = c->next) { d1 = find_smallest_depth(c); if (d1 < smallest) smallest = d1; } return smallest; } int find_largest_depth(F_compound *compound) { F_line *l; F_spline *s; F_ellipse *e; F_arc *a; F_text *t; F_compound *c; int largest, d1; largest = MIN_DEPTH; for (l = compound->lines; l != NULL; l = l->next) { if (l->depth > largest) largest = l->depth; } for (s = compound->splines; s != NULL; s = s->next) { if (s->depth > largest) largest = s->depth; } for (e = compound->ellipses; e != NULL; e = e->next) { if (e->depth > largest) largest = e->depth; } for (a = compound->arcs; a != NULL; a = a->next) { if (a->depth > largest) largest = a->depth; } for (t = compound->texts; t != NULL; t = t->next) { if (t->depth > largest) largest = t->depth; } for (c = compound->compounds; c != NULL; c = c->next) { d1 = find_largest_depth(c); if (d1 > largest) largest = d1; } return largest; } /* get grid params and assemble into fig2dev parm */ void get_grid_spec(char *grid, Widget minor_grid_panel, Widget major_grid_panel) { char *c1; /* if panel hasn't been up yet */ if (minor_grid_panel == (Widget) 0 || major_grid_panel == (Widget) 0) { sprintf(grid,"%s:%s%s", strlen(minor_grid)==0? "0": minor_grid, strlen(major_grid)==0? "0": major_grid, appres.INCHES? "in":"mm"); return; } /* get minor grid spec from panel */ strcpy(grid, panel_get_value(minor_grid_panel)); if (strcasecmp(grid,"none") == 0) { grid[0]='\0'; } /* now major */ c1 = panel_get_value(major_grid_panel); if (strcasecmp(c1,"none") != 0 && strlen(c1)) { strcat(grid,":"); strcat(grid,c1); } if (strlen(grid)) strcat(grid,appres.INCHES? "in":"mm"); } /* get the timestamp (mtime) of the filename passed */ time_t file_timestamp(char *file) { struct stat file_status; if (stat(file, &file_status) != 0) return -1; return file_status.st_mtime; }
26.071989
101
0.609311
9d44f81acb6a18c8f5644ceea697f739e72d68e9
5,289
h
C
src/debug/wasm/gdb-server/transport.h
EXHades/v8
5fe0aa3bc79c0a9d3ad546b79211f07105f09585
[ "BSD-3-Clause" ]
20,995
2015-01-01T05:12:40.000Z
2022-03-31T21:39:18.000Z
src/debug/wasm/gdb-server/transport.h
Andrea-MariaDB-2/v8
a0f0ebd7a876e8cb2210115adbfcffe900e99540
[ "BSD-3-Clause" ]
333
2020-07-15T17:06:05.000Z
2021-03-15T12:13:09.000Z
src/debug/wasm/gdb-server/transport.h
Andrea-MariaDB-2/v8
a0f0ebd7a876e8cb2210115adbfcffe900e99540
[ "BSD-3-Clause" ]
4,523
2015-01-01T15:12:34.000Z
2022-03-28T06:23:41.000Z
// Copyright 2020 the V8 project 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 V8_DEBUG_WASM_GDB_SERVER_TRANSPORT_H_ #define V8_DEBUG_WASM_GDB_SERVER_TRANSPORT_H_ #include <sstream> #include <vector> #include "src/base/macros.h" #include "src/debug/wasm/gdb-server/gdb-remote-util.h" #if _WIN32 #include <windows.h> #include <winsock2.h> typedef SOCKET SocketHandle; #define CloseSocket closesocket #define InvalidSocket INVALID_SOCKET #define SocketGetLastError() WSAGetLastError() static const int kErrInterrupt = WSAEINTR; typedef int ssize_t; typedef int socklen_t; #else // _WIN32 #include <arpa/inet.h> #include <netdb.h> #include <netinet/tcp.h> #include <sys/select.h> #include <sys/socket.h> #include <unistd.h> #include <string> typedef int SocketHandle; #define CloseSocket close #define InvalidSocket (-1) #define SocketGetLastError() errno static const int kErrInterrupt = EINTR; #endif // _WIN32 namespace v8 { namespace internal { namespace wasm { namespace gdb_server { class SocketTransport; // Acts as a factory for Transport objects bound to a specified TCP port. class SocketBinding { public: // Wrap existing socket handle. explicit SocketBinding(SocketHandle socket_handle); // Bind to the specified TCP port. static SocketBinding Bind(uint16_t tcp_port); bool IsValid() const { return socket_handle_ != InvalidSocket; } // Create a transport object from this socket binding std::unique_ptr<SocketTransport> CreateTransport(); // Get port the socket is bound to. uint16_t GetBoundPort(); private: SocketHandle socket_handle_; }; class V8_EXPORT_PRIVATE TransportBase { public: virtual ~TransportBase() {} // Waits for an incoming connection on the bound port. virtual bool AcceptConnection() = 0; // Read {len} bytes from this transport, possibly blocking until enough data // is available. // {dst} must point to a buffer large enough to contain {len} bytes. // Returns true on success. // Returns false if the connection is closed; in that case the {dst} may have // been partially overwritten. virtual bool Read(char* dst, int32_t len) = 0; // Write {len} bytes to this transport. // Return true on success, false if the connection is closed. virtual bool Write(const char* src, int32_t len) = 0; // Return true if there is data to read. virtual bool IsDataAvailable() const = 0; // If we are connected to a debugger, gracefully closes the connection. // This should be called when a debugging session gets closed. virtual void Disconnect() = 0; // Shuts down this transport, gracefully closing the existing connection and // also closing the listening socket. This should be called when the GDB stub // shuts down, when the program terminates. virtual void Close() = 0; // Blocks waiting for one of these two events to occur: // - A network event (a new packet arrives, or the connection is dropped), // - A thread event is signaled (the execution stopped because of a trap or // breakpoint). virtual void WaitForDebugStubEvent() = 0; // Signal that this transport should leave an alertable wait state because // the execution of the debuggee was stopped because of a trap or breakpoint. virtual bool SignalThreadEvent() = 0; }; class Transport : public TransportBase { public: explicit Transport(SocketHandle s); ~Transport() override; // TransportBase bool Read(char* dst, int32_t len) override; bool Write(const char* src, int32_t len) override; bool IsDataAvailable() const override; void Disconnect() override; void Close() override; static const int kBufSize = 4096; protected: // Copy buffered data to *dst up to len bytes and update dst and len. void CopyFromBuffer(char** dst, int32_t* len); // Read available data from the socket. Return false on EOF or error. virtual bool ReadSomeData() = 0; std::unique_ptr<char[]> buf_; int32_t pos_; int32_t size_; SocketHandle handle_bind_; SocketHandle handle_accept_; }; #if _WIN32 class SocketTransport : public Transport { public: explicit SocketTransport(SocketHandle s); ~SocketTransport() override; SocketTransport(const SocketTransport&) = delete; SocketTransport& operator=(const SocketTransport&) = delete; // TransportBase bool AcceptConnection() override; void Disconnect() override; void WaitForDebugStubEvent() override; bool SignalThreadEvent() override; private: bool ReadSomeData() override; HANDLE socket_event_; HANDLE faulted_thread_event_; }; #else // _WIN32 class SocketTransport : public Transport { public: explicit SocketTransport(SocketHandle s); ~SocketTransport() override; SocketTransport(const SocketTransport&) = delete; SocketTransport& operator=(const SocketTransport&) = delete; // TransportBase bool AcceptConnection() override; void WaitForDebugStubEvent() override; bool SignalThreadEvent() override; private: bool ReadSomeData() override; int faulted_thread_fd_read_; int faulted_thread_fd_write_; }; #endif // _WIN32 } // namespace gdb_server } // namespace wasm } // namespace internal } // namespace v8 #endif // V8_DEBUG_WASM_GDB_SERVER_TRANSPORT_H_
27.262887
79
0.74532
3f42657b8f271d3f091f0299980e70159a21d53b
2,663
h
C
Source/include/ControllerDriver.h
r57zone/OpenVR-Additional-Arduino-Btns
8e55b0212584aff20b1904eb93d8c229697db631
[ "MIT" ]
2
2021-11-09T08:51:41.000Z
2021-11-18T14:14:06.000Z
Source/include/ControllerDriver.h
sxy2069/OpenVR-Additional-Arduino-Btns
0dddbe2991ac5f488cfc52b1582a651998c04b0d
[ "MIT" ]
null
null
null
Source/include/ControllerDriver.h
sxy2069/OpenVR-Additional-Arduino-Btns
0dddbe2991ac5f488cfc52b1582a651998c04b0d
[ "MIT" ]
1
2021-11-09T03:22:14.000Z
2021-11-09T03:22:14.000Z
#pragma once #include <openvr_driver.h> #include <windows.h> using namespace vr; /** This class controls the behavior of the controller. This is where you tell OpenVR what your controller has (buttons, joystick, trackpad, etc.). This is also where you inform OpenVR when the state of your controller changes (for example, a button is pressed). For the methods, take a look at the comment blocks for the ITrackedDeviceServerDriver class too. Those comment blocks have some good information. This example driver will simulate a controller that has a joystick and trackpad on it. It is hardcoded to just return a value for the joystick and trackpad. It will cause the game character to move forward constantly. **/ class ControllerDriver : public ITrackedDeviceServerDriver { public: /** Initialize your controller here. Give OpenVR information about your controller and set up handles to inform OpenVR when the controller state changes. **/ EVRInitError Activate(uint32_t unObjectId); /** Un-initialize your controller here. **/ void Deactivate(); /** Tell your hardware to go into stand-by mode (low-power). **/ void EnterStandby(); /** Take a look at the comment block for this method on ITrackedDeviceServerDriver. So as far as I understand, driver classes like this one can implement lots of functionality that can be categorized into components. This class just acts as an input device, so it will return the IVRDriverInput class, but it could return other component classes if it had more functionality, such as maybe overlays or UI functionality. **/ void* GetComponent(const char* pchComponentNameAndVersion); /** Refer to ITrackedDeviceServerDriver. I think it sums up what this does well. **/ void DebugRequest(const char* pchRequest, char* pchResponseBuffer, uint32_t unResponseBufferSize); /** Returns the Pose for your device. Pose is an object that contains the position, rotation, velocity, and angular velocity of your device. **/ DriverPose_t GetPose(); /** You can retrieve the state of your device here and update OpenVR if anything has changed. This method should be called every frame. **/ void RunFrame(); float joystickX; float joystickY; float trackpadX; float trackpadY; bool aAction; bool bAction; private: uint32_t driverId; VRInputComponentHandle_t joystickYHandle; VRInputComponentHandle_t trackpadYHandle; VRInputComponentHandle_t joystickXHandle; VRInputComponentHandle_t trackpadXHandle; vr::VRInputComponentHandle_t aBtnHandle; vr::VRInputComponentHandle_t bBtnHandle; };
31.329412
102
0.753661
8f6be432ac0958bc0cbb4947c87421d3e045362e
3,666
c
C
ue500/src/dg10.c
JoachimSchneider/MicroEmacs
62a742a371bc128ab9440aea9e94fb24f446cbec
[ "RSA-MD" ]
1
2021-12-07T07:53:48.000Z
2021-12-07T07:53:48.000Z
ue500/src/dg10.c
JoachimSchneider/MicroEmacs
62a742a371bc128ab9440aea9e94fb24f446cbec
[ "RSA-MD" ]
null
null
null
ue500/src/dg10.c
JoachimSchneider/MicroEmacs
62a742a371bc128ab9440aea9e94fb24f446cbec
[ "RSA-MD" ]
null
null
null
/* * The routines in this file provide support for the Data General Model 10 * Microcomputer. */ #define termdef 1 /* don't define "term" external */ #include <stdio.h> #include "estruct.h" #include "eproto.h" #include "edef.h" #include "elang.h" #if DG10 #define NROW 24 /* Screen size. */ #define NCOL 80 /* Edit if you want to. */ #define NPAUSE 100 /* # times thru update to pause */ #define MARGIN 8 /* size of minimim margin and */ #define SCRSIZ 64 /* scroll size for extended lines */ #define BEL 0x07 /* BEL character. */ #define ESC 30 /* DG10 ESC character. */ extern PASCAL NEAR ttopen(); /* Forward references. */ extern PASCAL NEAR ttgetc(); extern PASCAL NEAR ttputc(); extern PASCAL NEAR ttflush(); extern PASCAL NEAR ttclose(); extern PASCAL NEAR dg10kopen(); extern PASCAL NEAR dg10kclose(); extern PASCAL NEAR dg10move(); extern PASCAL NEAR dg10eeol(); extern PASCAL NEAR dg10eeop(); extern PASCAL NEAR dg10beep(); extern PASCAL NEAR dg10open(); extern PASCAL NEAR dg10rev(); extern PASCAL NEAR dg10close(); extern PASCAL NEAR dg10cres(); #if COLOR extern PASCAL NEAR dg10fcol(); extern PASCAL NEAR dg10bcol(); int cfcolor = -1; /* current forground color */ int cbcolor = -1; /* current background color */ int ctrans[] = { /* emacs -> DG10 color translation table */ 0, 4, 2, 6, 1, 5, 3, 7}; #endif /* * Standard terminal interface dispatch table. Most of the fields point into * "termio" code. */ TERM term = { NROW-1, NROW-1, NCOL, NCOL, MARGIN, SCRSIZ, NPAUSE, dg10open, dg10close, dg10kopen, dg10kclose, ttgetc, ttputc, ttflush, dg10move, dg10eeol, dg10eeop, dg10eeop, dg10beep, dg10rev, dg10cres #if COLOR , dg10fcol, dg10bcol #endif }; #if COLOR PASCAL NEAR dg10fcol(color) /* set the current output color */ int color; /* color to set */ { if (color == cfcolor) return; ttputc(ESC); ttputc(0101); ttputc(ctrans[color]); cfcolor = color; } PASCAL NEAR dg10bcol(color) /* set the current background color */ int color; /* color to set */ { if (color == cbcolor) return; ttputc(ESC); ttputc(0102); ttputc(ctrans[color]); cbcolor = color; } #endif PASCAL NEAR dg10move(row, col) { ttputc(16); ttputc(col); ttputc(row); } PASCAL NEAR dg10eeol() { ttputc(11); } PASCAL NEAR dg10eeop() { #if COLOR dg10fcol(gfcolor); dg10bcol(gbcolor); #endif ttputc(ESC); ttputc(0106); ttputc(0106); } PASCAL NEAR dg10rev(state) /* change reverse video state */ int state; /* TRUE = reverse, FALSE = normal */ { #if COLOR if (state == TRUE) { dg10fcol(0); dg10bcol(7); } #else ttputc(ESC); ttputc(state ? 0104: 0105); #endif } PASCAL NEAR dg10cres() /* change screen resolution */ { return(TRUE); } PASCAL NEAR spal() /* change palette string */ { /* Does nothing here */ } PASCAL NEAR dg10beep() { ttputc(BEL); ttflush(); } PASCAL NEAR dg10open() { xstrcpy(sres, "NORMAL"); xstrcpy(os, "DG10); revexist = TRUE; ttopen(); } PASCAL NEAR dg10close() { #if COLOR dg10fcol(7); dg10bcol(0); #endif ttclose(); } PASCAL NEAR dg10kopen() { } PASCAL NEAR dg10kclose() { } #if FLABEL PASCAL NEAR fnclabel(f, n) /* label a function key */ int f,n; /* default flag, numeric argument [unused] */ { /* on machines with no function keys...don't bother */ return(TRUE); } #endif #else dg10hello() { } #endif
17.457143
77
0.609111
eb1df9afc1c261180c494099e357289ceb021443
994
h
C
6/platforms/android-4/arch-x86/usr/include/mtd/mtd-user.h
HelixOS/prebuilts-ndk
6e97ff0d4f69d92c4c81b82340ff3b0b85d77789
[ "Apache-2.0" ]
null
null
null
6/platforms/android-4/arch-x86/usr/include/mtd/mtd-user.h
HelixOS/prebuilts-ndk
6e97ff0d4f69d92c4c81b82340ff3b0b85d77789
[ "Apache-2.0" ]
null
null
null
6/platforms/android-4/arch-x86/usr/include/mtd/mtd-user.h
HelixOS/prebuilts-ndk
6e97ff0d4f69d92c4c81b82340ff3b0b85d77789
[ "Apache-2.0" ]
null
null
null
/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_USER_H__ #define __MTD_USER_H__ #include <stdint.h> #include <mtd/mtd-abi.h> typedef struct mtd_info_user mtd_info_t; typedef struct erase_info_user erase_info_t; typedef struct region_info_user region_info_t; typedef struct nand_oobinfo nand_oobinfo_t; typedef struct nand_ecclayout nand_ecclayout_t; #endif
38.230769
78
0.534205
6b68ef1ccada9c519c4dfc42aba08576b7915215
499
c
C
codes/sample02.c
takeshi-aihana/C_Internals
ac6a77d53eff5ebd5f4bcaa39d8ae81f717facc2
[ "CC0-1.0" ]
null
null
null
codes/sample02.c
takeshi-aihana/C_Internals
ac6a77d53eff5ebd5f4bcaa39d8ae81f717facc2
[ "CC0-1.0" ]
null
null
null
codes/sample02.c
takeshi-aihana/C_Internals
ac6a77d53eff5ebd5f4bcaa39d8ae81f717facc2
[ "CC0-1.0" ]
null
null
null
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * gcc-4.8 -Wall -g3 sample02.c -o do-sample02 * * gcc-4.8 -m32 -S sample02.c -o sample02.s * * $Id: sample02.c $ * $Lastupdate: 2020/06/03 16:04:04 $ */ /* 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 *--------+---------+---------+---------+---------X---------+---------+---------+---------+---------X */ void fun() { int locVar = 0; locVar++; }
24.95
101
0.523046
b1da6061744ec66149e4227aa6bd008892104ac9
3,977
h
C
src/main/jni/include/ca_uwaterloo_JCLCudaAPI_Device.h
sstewart2012/JCLCudaAPI
19dc85c1bc8d7c0381ef0fb95f7ef5b6fb51ba43
[ "Apache-1.1" ]
1
2016-07-13T07:25:19.000Z
2016-07-13T07:25:19.000Z
src/main/jni/include/ca_uwaterloo_JCLCudaAPI_Device.h
sstewart2012/JCLCudaAPI
19dc85c1bc8d7c0381ef0fb95f7ef5b6fb51ba43
[ "Apache-1.1" ]
null
null
null
src/main/jni/include/ca_uwaterloo_JCLCudaAPI_Device.h
sstewart2012/JCLCudaAPI
19dc85c1bc8d7c0381ef0fb95f7ef5b6fb51ba43
[ "Apache-1.1" ]
null
null
null
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class ca_uwaterloo_JCLCudaAPI_Device */ #ifndef _Included_ca_uwaterloo_JCLCudaAPI_Device #define _Included_ca_uwaterloo_JCLCudaAPI_Device #ifdef __cplusplus extern "C" { #endif /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: init * Signature: (Lca/uwaterloo/JCLCudaAPI/Platform;I)V */ JNIEXPORT void JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_init (JNIEnv *, jobject, jobject, jint); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: version * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_version (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: vendor * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_vendor (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: name * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_name (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: type * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_type (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: maxWorkGroupSize * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_maxWorkGroupSize (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: maxWorkItemDimensions * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_maxWorkItemDimensions (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: maxWorkItemSizes * Signature: ()Ljava/util/ArrayList; */ JNIEXPORT jobject JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_maxWorkItemSizes (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: localMemSize * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_localMemSize (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: capabilities * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_capabilities (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: coreClock * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_coreClock (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: computeUnits * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_computeUnits (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: memorySize * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_memorySize (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: maxAllocSize * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_maxAllocSize (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: memoryClock * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_memoryClock (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: memoryBusWidth * Signature: ()J */ JNIEXPORT jlong JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_memoryBusWidth (JNIEnv *, jobject); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: isLocalMemoryValid * Signature: (J)Z */ JNIEXPORT jboolean JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_isLocalMemoryValid (JNIEnv *, jobject, jlong); /* * Class: ca_uwaterloo_JCLCudaAPI_Device * Method: isThreadConfigValid * Signature: (Ljava/util/List;)Z */ JNIEXPORT jboolean JNICALL Java_ca_uwaterloo_JCLCudaAPI_Device_isThreadConfigValid (JNIEnv *, jobject, jobject); #ifdef __cplusplus } #endif #endif
25.170886
82
0.75484
d4d6b5849e49ef98b72da6386f0b566c3aeb138c
10,053
h
C
Source/FSD/Public/ConvertedRobot.h
Dr-Turtle/DRG_ModPresetManager
abd7ff98a820969504491a1fe68cf2f9302410dc
[ "MIT" ]
8
2021-07-10T20:06:05.000Z
2022-03-04T19:03:50.000Z
Source/FSD/Public/ConvertedRobot.h
Dr-Turtle/DRG_ModPresetManager
abd7ff98a820969504491a1fe68cf2f9302410dc
[ "MIT" ]
9
2022-01-13T20:49:44.000Z
2022-03-27T22:56:48.000Z
Source/FSD/Public/ConvertedRobot.h
Dr-Turtle/DRG_ModPresetManager
abd7ff98a820969504491a1fe68cf2f9302410dc
[ "MIT" ]
2
2021-07-10T20:05:42.000Z
2022-03-14T17:05:35.000Z
#pragma once #include "CoreMinimal.h" #include "Templates/SubclassOf.h" #include "EnemyDeepPathfinderCharacter.h" #include "WeaponFireOwner.h" #include "UObject/NoExportTypes.h" #include "EInputKeys.h" #include "Curves/CurveFloat.h" #include "ERobotState.h" #include "ConvertedRobot.generated.h" class USceneComponent; class UOutlineComponent; class UEnemyComponent; class UHitscanComponent; class UPawnStatsComponent; class USingleUsableComponent; class USkeletalMeshComponent; class UPointLightComponent; class USpotLightComponent; class UStaticMeshComponent; class USoundBase; class UAudioComponent; class UDamageComponent; class UParticleSystem; class AActor; class AParasiteEnemy; class AProjectile; class UAnimSequenceBase; class USoundCue; class APlayerCharacter; class APawn; UDELEGATE(BlueprintCallable) DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FConvertedRobotOnShieldChanged, bool, aIsGrowing); UDELEGATE(BlueprintCallable) DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FConvertedRobotOnStateChanged, uint8, aState); UDELEGATE(BlueprintCallable) DECLARE_DYNAMIC_MULTICAST_DELEGATE(FConvertedRobotOnIntroductionStart); UCLASS() class AConvertedRobot : public AEnemyDeepPathfinderCharacter, public IWeaponFireOwner { GENERATED_BODY() public: UPROPERTY(Export, VisibleAnywhere) UEnemyComponent* EnemyComponent; UPROPERTY(Export, VisibleAnywhere) UPawnStatsComponent* PawnStats; UPROPERTY(Export, VisibleAnywhere) UOutlineComponent* outline; UPROPERTY(Export, VisibleAnywhere) UHitscanComponent* HitScan; UPROPERTY(Export, VisibleAnywhere) USingleUsableComponent* Usable; UPROPERTY(Export, VisibleAnywhere) USceneComponent* TurretRoot; UPROPERTY(BlueprintReadOnly, Export, VisibleAnywhere) USkeletalMeshComponent* TurretMesh; UPROPERTY(Export, VisibleAnywhere) UPointLightComponent* MuzzleFlash; UPROPERTY(Export, VisibleAnywhere) USpotLightComponent* SpotLight; UPROPERTY(Export, VisibleAnywhere) UStaticMeshComponent* LightCone; UPROPERTY(Export, VisibleAnywhere) UStaticMeshComponent* LaserBeam; UPROPERTY(Export, VisibleAnywhere) USceneComponent* ShieldRoot; UPROPERTY(Export, VisibleAnywhere) UStaticMeshComponent* InnerShield; UPROPERTY(Export, VisibleAnywhere) UStaticMeshComponent* OuterShield; UPROPERTY(Export, VisibleAnywhere) UAudioComponent* PulsatingSoundComp; UPROPERTY(Export, VisibleAnywhere) UAudioComponent* LaserWarningSound; UPROPERTY(Export, VisibleAnywhere) UDamageComponent* Damage; UPROPERTY(BlueprintAssignable) FConvertedRobotOnStateChanged OnStateChanged; UPROPERTY(BlueprintAssignable) FConvertedRobotOnShieldChanged OnShieldChanged; UPROPERTY(BlueprintAssignable) FConvertedRobotOnIntroductionStart OnIntroductionStart; protected: UPROPERTY(Replicated, Transient) bool ForceSit; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) USoundBase* LaserSound; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) USoundBase* LastPowerDownSound; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) USoundBase* PowerUpSound; UPROPERTY(Export) TWeakObjectPtr<UAudioComponent> LaserSoundComp; UPROPERTY(EditAnywhere) float IntroductionTime; UPROPERTY(Transient, ReplicatedUsing=OnRep_IsIntroducting) bool IsIntroducing; UPROPERTY(Replicated, Transient) bool IntroductionDone; UPROPERTY(Replicated, Transient) bool IsGrowingShield; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float AimDownwardsOffset; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float BigShieldScale; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float SmallShieldScale; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float ShieldGrowthRate; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float LerpExp; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float MinimumShieldSize; UPROPERTY(Replicated, Transient) float TargetShieldSize; UPROPERTY(BlueprintReadOnly, EditAnywhere) float IdleRotationSpeed; UPROPERTY(BlueprintReadOnly, EditAnywhere) float LaserScaleRate; UPROPERTY(BlueprintReadOnly, EditAnywhere) float MaxSearchAngle; UPROPERTY(EditDefaultsOnly) bool DoSpecialWhenEnemy; UPROPERTY(EditDefaultsOnly) bool DoSpecialWhenFriendly; UPROPERTY(EditDefaultsOnly) bool PerfectTrackingWhenEnemy; UPROPERTY(EditDefaultsOnly) bool PerfectTrackingWhenFriendly; UPROPERTY(Transient) bool ReplaceBurstAttack; UPROPERTY(EditDefaultsOnly) USoundBase* GrenadeFireSound; UPROPERTY(EditDefaultsOnly) UParticleSystem* GrenadeFireParticle; UPROPERTY(Transient, ReplicatedUsing=OnRep_IsFiring) bool IsFiring; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float TurretSpinSpeed; UPROPERTY(Replicated, Transient) TArray<AActor*> Parasites; UPROPERTY(EditDefaultsOnly) int32 SpawnParasiteNumer; UPROPERTY(EditDefaultsOnly) int32 MaxParasiteSlots; UPROPERTY(EditDefaultsOnly) float ChanceToSpawnParasite; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) TSubclassOf<AParasiteEnemy> ParasiteClass; UPROPERTY(Transient, ReplicatedUsing=OnRep_SpinTurret) bool SpinTurret; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) TSubclassOf<AProjectile> SpecialAttackProjectile; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) TSubclassOf<AProjectile> FriendlyProjectile; UPROPERTY(Replicated, Transient) bool HasLockedOn; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) USoundBase* TargetingSound; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) UAnimSequenceBase* GrenadeShotAnimation; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float LockOnTime; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) USoundCue* ShootSound; UPROPERTY(EditAnywhere) float ShootSoundFadeout; UPROPERTY(Export, Transient) UAudioComponent* ShootSoundInstance; UPROPERTY(EditAnywhere) USoundCue* ShootSoundTail; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) UParticleSystem* MuzzleEffect; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) UParticleSystem* TracerEffect; UPROPERTY(EditDefaultsOnly) FRuntimeFloatCurve MuzzleLightCurve; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float GunRange; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float FireRate; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float GrenadeFireRate; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float BurstCooldown; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) int32 MinBurst; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) int32 MaxBurst; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float TurretLerpSpeed; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float DamageWhenFriendly; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) float FriendlyFriendlyFireMultiplier; UPROPERTY(Replicated, Transient) bool StartedSpecialAttack; UPROPERTY(EditDefaultsOnly, ReplicatedUsing=OnRep_TeamState) ERobotState TeamState; private: UPROPERTY(Replicated, Transient) bool IsWalking; UPROPERTY(Transient, ReplicatedUsing=OnRep_IsDoingSpecialAttack) bool IsDoingSpecialAttack; UPROPERTY(Export, Transient) UStaticMeshComponent* TurretRotation; UPROPERTY(Transient, ReplicatedUsing=OnRep_Target) AActor* CurrentTarget; protected: UFUNCTION(BlueprintCallable) void UpdateGunsInsideTerrain(); public: UFUNCTION(BlueprintCallable) void StartBossFight(); protected: UFUNCTION(BlueprintCallable) void ParasiteDamaged(float aDamage); UFUNCTION(BlueprintCallable) void OnWeaponsFired(const FVector& aHitResult); UFUNCTION(BlueprintCallable) void OnUsed(APlayerCharacter* aUser, EInputKeys Key); public: UFUNCTION(BlueprintCallable) void OnSeePawn(APawn* APawn); protected: UFUNCTION(BlueprintCallable) void OnRep_TeamState(); UFUNCTION(BlueprintCallable) void OnRep_Target(); UFUNCTION(BlueprintCallable) void OnRep_SpinTurret(); UFUNCTION(BlueprintCallable) void OnRep_IsIntroducting(); UFUNCTION(BlueprintCallable) void OnRep_IsFiring(); UFUNCTION(BlueprintCallable) void OnRep_IsDoingSpecialAttack(); UFUNCTION(BlueprintCallable) void OnParasiteDeath(AActor* AParasiteEnemy); public: UFUNCTION(BlueprintCallable, BlueprintPure) ERobotState GetTeamState() const; UFUNCTION(BlueprintCallable, BlueprintPure) FVector GetPlayerMediumPoint() const; UFUNCTION(BlueprintCallable, BlueprintPure) TArray<AActor*> GetParasites() const; UFUNCTION(BlueprintCallable, BlueprintPure) bool GetHasPoweredDown() const; UFUNCTION(BlueprintCallable, NetMulticast, Reliable) void DestroyAttatchPoint(USceneComponent* aComponent); protected: UFUNCTION(BlueprintCallable, NetMulticast, Reliable) void CannonEffects(); public: UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void BP_OnStateChanged(ERobotState NewTeamState); UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void BP_OnShieldChanged(bool isGrowing); UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void BP_OnInstroduce(); virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override; AConvertedRobot(); // Fix for true pure virtual functions not being implemented };
27.097035
123
0.751616
a81a8e55ec74505b9e5b323a1f165642b536576f
7,433
c
C
freebsd3/sys/alpha/pci/pcibus.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
91
2015-01-05T15:18:31.000Z
2022-03-11T16:43:28.000Z
freebsd3/sys/alpha/pci/pcibus.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
1
2016-02-25T15:57:55.000Z
2016-02-25T16:01:02.000Z
freebsd3/sys/alpha/pci/pcibus.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
21
2015-02-07T08:23:07.000Z
2021-12-14T06:01:49.000Z
/* * Copyright (c) 1997, Stefan Esser <se@freebsd.org> * 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 unmodified, 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 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. * * $Id: pcibus.c,v 1.8 1998/12/27 18:03:29 dfr Exp $ * */ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> #include <sys/interrupt.h> #include <sys/sysctl.h> #include <sys/rman.h> #include <pci/pcivar.h> #include <machine/chipset.h> #include <machine/cpuconf.h> #include <machine/resource.h> char chipset_type[10]; int chipset_bwx = 0; long chipset_ports = 0; long chipset_memory = 0; long chipset_dense = 0; long chipset_hae_mask = 0; SYSCTL_NODE(_hw, OID_AUTO, chipset, CTLFLAG_RW, 0, "PCI chipset information"); SYSCTL_STRING(_hw_chipset, OID_AUTO, type, CTLFLAG_RD, chipset_type, 0, "PCI chipset type"); SYSCTL_INT(_hw_chipset, OID_AUTO, bwx, CTLFLAG_RD, &chipset_bwx, 0, "PCI chipset supports BWX access"); SYSCTL_LONG(_hw_chipset, OID_AUTO, ports, CTLFLAG_RD, &chipset_ports, "PCI chipset port address"); SYSCTL_LONG(_hw_chipset, OID_AUTO, memory, CTLFLAG_RD, &chipset_memory, "PCI chipset memory address"); SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, "PCI chipset dense memory address"); SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, "PCI chipset mask for HAE register"); #ifdef notyet /* return max number of devices on the bus */ int pci_maxdevs(pcicfgregs *cfg) { return chipset.maxdevs(cfg->bus); } #endif /* read configuration space register */ int pci_cfgread(pcicfgregs *cfg, int reg, int bytes) { switch (bytes) { case 1: return chipset.cfgreadb(cfg->bus, cfg->slot, cfg->func, reg); case 2: return chipset.cfgreadw(cfg->bus, cfg->slot, cfg->func, reg); case 4: return chipset.cfgreadl(cfg->bus, cfg->slot, cfg->func, reg); } return ~0; } /* write configuration space register */ void pci_cfgwrite(pcicfgregs *cfg, int reg, int data, int bytes) { switch (bytes) { case 1: return chipset.cfgwriteb(cfg->bus, cfg->slot, cfg->func, reg, data); case 2: return chipset.cfgwritew(cfg->bus, cfg->slot, cfg->func, reg, data); case 4: return chipset.cfgwritel(cfg->bus, cfg->slot, cfg->func, reg, data); } } int pci_cfgopen(void) { return 1; } vm_offset_t pci_cvt_to_dense(vm_offset_t sparse) { if(chipset.cvt_to_dense) return chipset.cvt_to_dense(sparse); else return NULL; } vm_offset_t pci_cvt_to_bwx(vm_offset_t sparse) { if(chipset.cvt_to_bwx) return chipset.cvt_to_bwx(sparse); else return NULL; } /* * These can disappear when I update the pci code to use the new * device framework. */ struct intrec * intr_create(void *dev_instance, int irq, inthand2_t handler, void *arg, intrmask_t *maskptr, int flags) { struct resource *res; device_t pcib = chipset.intrdev; int zero = 0; void *cookie; res = BUS_ALLOC_RESOURCE(pcib, NULL, SYS_RES_IRQ, &zero, irq, irq, 1, RF_SHAREABLE | RF_ACTIVE); if (BUS_SETUP_INTR(pcib, pcib, res, (driver_intr_t *)handler, arg, &cookie)) return 0; return (struct intrec *)cookie; } int intr_connect(struct intrec *idesc) { /* * intr_create has already connected it (doesn't matter for the * only consumer of this interface (pci). */ return 0; } void alpha_platform_assign_pciintr(pcicfgregs *cfg) { if(platform.pci_intr_map) platform.pci_intr_map((void *)cfg); } static struct rman irq_rman, port_rman, mem_rman; void pci_init_resources() { irq_rman.rm_start = 0; irq_rman.rm_end = 32; irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "PCI Interrupt request lines"; if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, 31)) panic("cia_probe irq_rman"); port_rman.rm_start = 0; port_rman.rm_end = 0xffff; port_rman.rm_type = RMAN_ARRAY; port_rman.rm_descr = "I/O ports"; if (rman_init(&port_rman) || rman_manage_region(&port_rman, 0, 0xffff)) panic("cia_probe port_rman"); mem_rman.rm_start = 0; mem_rman.rm_end = ~0u; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0x0, (1L << 32))) panic("cia_probe mem_rman"); } /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of the pci chipset. */ struct resource * pci_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { struct rman *rm; switch (type) { case SYS_RES_IRQ: rm = &irq_rman; break; case SYS_RES_IOPORT: rm = &port_rman; break; case SYS_RES_MEMORY: rm = &mem_rman; break; default: return 0; } return rman_reserve_resource(rm, start, end, count, flags, child); } int pci_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { return (rman_activate_resource(r)); } int pci_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { return (rman_deactivate_resource(r)); } int pci_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { return (rman_release_resource(r)); } void memcpy_fromio(void *d, u_int32_t s, size_t size) { char *cp = d; while (size--) *cp++ = readb(s++); } void memcpy_toio(u_int32_t d, void *s, size_t size) { char *cp = s; while (size--) writeb(d++, *cp++); } void memset_io(u_int32_t d, int val, size_t size) { while (size--) writeb(d++, val); } #include "opt_ddb.h" #ifdef DDB #include <ddb/ddb.h> DB_COMMAND(in, db_in) { int c; int size; u_int32_t val; if (!have_addr) return; size = -1; while (c = *modif++) { switch (c) { case 'b': size = 1; break; case 'w': size = 2; break; case 'l': size = 4; break; } } if (size < 0) { db_printf("bad size\n"); return; } if (count <= 0) count = 1; while (--count >= 0) { db_printf("%08x:\t", addr); switch (size) { case 1: db_printf("%02x\n", inb(addr)); break; case 2: db_printf("%04x\n", inw(addr)); break; case 4: db_printf("%08x\n", inl(addr)); break; } } } #endif
22.800613
78
0.696623
4bf4bb144ab6a5e9430254075a7d2325ef586d11
36,947
h
C
ll/include/pstl/_pstl_list.h
mynlp/enju
d984a630b30b95de16f3b715277e95dc6fbe15b4
[ "Apache-2.0" ]
48
2016-10-11T06:07:02.000Z
2022-03-02T16:26:25.000Z
ll/include/pstl/_pstl_list.h
mynlp/enju
d984a630b30b95de16f3b715277e95dc6fbe15b4
[ "Apache-2.0" ]
7
2017-02-13T09:14:34.000Z
2019-01-18T06:06:29.000Z
ll/include/pstl/_pstl_list.h
mynlp/enju
d984a630b30b95de16f3b715277e95dc6fbe15b4
[ "Apache-2.0" ]
18
2016-11-13T23:14:28.000Z
2022-01-12T15:21:44.000Z
/* * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * Copyright (c) 2005 * Kenta Oouchida, Takashi Tsunakawa and Takashi Ninomiya * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Kenta Oouchida, Takashi Tsunakawa * and Takashi Ninomiya make no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /* NOTE: This is an internal header file, included by other PSTL headers. * You should not attempt to use it directly. */ #ifndef __SGI_PSTL_INTERNAL_LIST_H #define __SGI_PSTL_INTERNAL_LIST_H #include "pstl_pheap.h" #include "pstl_concept_checks.h" __PSTL_BEGIN_NAMESPACE #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) #pragma set woff 1174 #pragma set woff 1375 #endif template <class _Arch> struct _List_node_base { typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; ptr<_List_node_base, arch_type> _M_next; ptr<_List_node_base, arch_type> _M_prev; }; template <class _Arch> struct replace_pheap<_List_node_base<_Arch> > { void operator()(pheap_ptr __ph, _List_node_base<_Arch> &__obj) { __replace_pheap(__ph, __obj._M_next); __replace_pheap(__ph, __obj._M_prev); } }; template <class _Tp, class _Arch> struct _List_node : public _List_node_base<_Arch> { typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; _Tp _M_data; ptr<_Tp, arch_type> get_M_data_pointer(ptr<_Tp, arch_type> _M_this) { ptr_int _M_data_addr = reinterpret_cast<ptr_int>(&_M_data); ptr_int this_addr = reinterpret_cast<ptr_int>(this); return ptr<_Tp, arch_type>(_M_this.getAddress() + (_M_data_addr - this_addr), _M_this.get_pheap()); } const_ptr<_Tp, arch_type> get_M_data_pointer(ptr<_Tp, arch_type> _M_this) const { ptr_int _M_data_addr = reinterpret_cast<ptr_int>(&_M_data); ptr_int this_addr = reinterpret_cast<ptr_int>(this); return const_ptr<_Tp, arch_type>(_M_this.getAddress() + (_M_data_addr - this_addr), _M_this.get_pheap()); } ref<_Tp, arch_type> get_M_data(ptr<_Tp, arch_type> _M_this) { return *get_M_data_pointer(_M_this); } const_ref<_Tp, arch_type> get_M_data(ptr<_Tp, arch_type> _M_this) const { return *get_M_data_pointer(_M_this); } }; template <class _Tp, class _Arch> struct replace_pheap<_List_node<_Tp, _Arch> > { void operator()(pheap_ptr __ph, _List_node<_Tp, _Arch> &__obj) { typedef _List_node_base<_Arch> _Base; _Base &__o = static_cast<_Base &>(__obj); __replace_pheap(__ph, __o); __replace_pheap(__ph, __obj._M_data); } }; template <class _Arch> struct _List_iterator_base { typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef bidirectional_iterator_tag iterator_category; typedef pheap<arch_type> pheap_type; ptr<_List_node_base<arch_type>, arch_type> _M_node; _List_iterator_base(ptr<_List_node_base<arch_type>, arch_type> __x) : _M_node(__x) {} _List_iterator_base() {} void _M_incr() { _M_node = (*_M_node)->_M_next; } void _M_decr() { _M_node = (*_M_node)->_M_prev; } bool operator==(const _List_iterator_base &__x) const { return _M_node == __x._M_node; } bool operator!=(const _List_iterator_base &__x) const { return _M_node != __x._M_node; } }; template <class _Arch> struct replace_pheap<_List_iterator_base<_Arch> > { void operator()(pheap_ptr __ph, _List_iterator_base<_Arch> &__obj) { __replace_pheap(__ph, __obj._M_node); } }; template <class _Tp, class _Ref, class _Ptr, class _Arch> struct _List_iterator : public _List_iterator_base<_Arch>{ typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; typedef _List_iterator<_Tp, ref<_Tp, arch_type>, ptr<_Tp, arch_type>, arch_type> iterator; typedef _List_iterator<_Tp, const_ref<_Tp, arch_type>, const_ptr<_Tp, arch_type>, arch_type> const_iterator; typedef _List_iterator<_Tp, _Ref, _Ptr, _Arch> _Self; typedef _Tp value_type; typedef _Ptr pointer; typedef _Ref reference; typedef _List_node<_Tp, _Arch> _Node; _List_iterator(ptr<_Node, arch_type> __x) : _List_iterator_base<_Arch>(__x) {} _List_iterator() {} _List_iterator(const iterator &__x) : _List_iterator_base<_Arch>(__x._M_node) {} _List_iterator(const_ref<iterator, arch_type> __x) : _List_iterator_base<_Arch>(__x->_M_node) {} reference operator*() const { ref<_List_node<_Tp, arch_type>, arch_type> _M_node_ref = *ptr<_List_node<_Tp, arch_type>, arch_type>(this->_M_node); return _M_node_ref->get_M_data(this->_M_node); } #ifndef __SGI_PSTL_NO_ARROW_OPERATOR pointer operator->() const { ref<_List_node<_Tp, arch_type>, arch_type> _M_node_ref = *ptr<_List_node<_Tp, arch_type>, arch_type>(this->_M_node); return _M_node_ref->get_M_data_pointer(this->_M_node); } #endif /* __SGI_PSTL_NO_ARROW_OPERATOR */ _Self &operator++() { this->_M_incr(); return *this; } _Self operator++(int) { _Self __tmp = *this; this->_M_incr(); return __tmp; } _Self &operator--() { this->_M_decr(); return *this; } _Self operator--(int) { _Self __tmp = *this; this->_M_decr(); return __tmp; } ptr<_Node, arch_type> get_node() { return _List_iterator_base<_Arch>::_M_node; } }; #ifndef __PSTL_CLASS_PARTIAL_SPECIALIZATION inline bidirectional_iterator_tag iterator_category(const _List_iterator_base &) { return bidirectional_iterator_tag(); } template <class _Tp, class _Ref, class _Ptr, class _Arch> inline ptr<_Tp, _Arch> value_type(const _List_iterator<_Tp, _Ref, _Ptr> &) { return ptr<_Tp, _Arch>(0); } template <class _Arch> inline typename _Arch::difference_type * distance_type(const _List_iterator_base<_Arch> &) { return reinterpret_cast<typename _Arch::difference_type *>(0); } #endif /* __PSTL_CLASS_PARTIAL_SPECIALIZATION */ // Base class that encapsulates details of allocators. Three cases: // an ordinary standard-conforming allocator, a standard-conforming // allocator with no non-static data, and an SGI-style allocator. // This complexity is necessary only because we're worrying about backward // compatibility and because we want to avoid wasting storage on an // allocator instance if it isn't necessary. #ifdef __PSTL_USE_STD_ALLOCATORS // Base for general standard-conforming allocators. template <class _Tp, class _Arch, class _Allocator, bool _IsStatic> class _List_alloc_base { public: typedef typename _Alloc_traits<_Tp, _Arch, _Allocator>::allocator_type allocator_type; typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; allocator_type get_allocator() const { return _Node_allocator; } _List_alloc_base(const allocator_type &__a) : _Node_allocator(__a) {} protected: ptr<_List_node<_Tp, arch_type>, arch_type> _M_get_node() { return _Node_allocator.allocate(1); } void _M_put_node(ptr<_List_node<_Tp, arch_type>, arch_type> __p) { _Node_allocator.deallocate(__p, 1); } protected: typename _Alloc_traits<_List_node<_Tp, arch_type>, arch_type, _Allocator>::allocator_type _Node_allocator; ptr<_List_node<_Tp, arch_type>, arch_type> _M_node; template <class _Obj> friend struct replace_pheap; }; template <class _Tp, class _Arch, class _Allocator, bool _IsStatic> struct replace_pheap<_List_alloc_base<_Tp, _Arch, _Allocator, _IsStatic> > { void operator()(pheap_ptr __ph, _List_alloc_base<_Tp, _Arch, _Allocator, _IsStatic> &__obj) { __replace_pheap(__ph, __obj._Node_allocator); __replace_pheap(__ph, __obj._M_node); } }; // Specialization for instanceless allocators. template <class _Tp, class _Arch, class _Allocator> class _List_alloc_base<_Tp, _Arch, _Allocator, true> { public: typedef typename _Alloc_traits<_Tp, _Arch, _Allocator>::allocator_type allocator_type; typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; allocator_type get_allocator() const { return allocator_type(); } _List_alloc_base(const allocator_type &__a) : _M_node(0, __a.get_pheap()) {} protected: typedef typename _Alloc_traits<_List_node<_Tp, arch_type>, arch_type, _Allocator>::_Alloc_type _Alloc_type; ptr<_List_node<_Tp, arch_type>, arch_type> _M_get_node() { return ptr<_List_node<_Tp, arch_type>, arch_type>(pheap_type::pheap_convert(_M_node.get_pheap())->malloc(sizeof(_List_node<_Tp, arch_type>)), _M_node.get_pheap()); } void _M_put_node(ptr<_List_node<_Tp, arch_type>, arch_type> __p) { pheap_type::pheap_convert(_M_node.get_pheap())->free(static_cast<ptr<void, arch_type> >(__p)); //, sizeof(_List_node<_Tp, arch_type>)); } protected: ptr<_List_node<_Tp, arch_type>, arch_type> _M_node; template <class _Obj> friend struct replace_pheap; }; template <class _Tp, class _Arch, class _Allocator> struct replace_pheap<_List_alloc_base<_Tp, _Arch, _Allocator, true> > { void operator()(pheap_ptr __ph, _List_alloc_base<_Tp, _Arch, _Allocator, true> &__obj) { __replace_pheap(__ph, __obj._M_node); } }; template <class _Tp, class _Arch, class _Allocator> class _List_base : public _List_alloc_base<_Tp, _Arch, _Allocator, _Alloc_traits<_Tp, _Arch, _Allocator>::_S_instanceless> { public: typedef _List_alloc_base<_Tp, _Arch, _Allocator, _Alloc_traits<_Tp, _Arch, _Allocator>::_S_instanceless> _Base; typedef typename _Base::allocator_type allocator_type; typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; #ifdef __PSTL_HAS_NAMESPACES using _Base::_M_node; using _Base::_M_get_node; using _Base::_M_put_node; #endif // __PSTL_HAS_NAMESPACES _List_base(const allocator_type &__a) : _Base(__a) { _M_node = _M_get_node(); (*_M_node)->_M_next = _M_node; (*_M_node)->_M_prev = _M_node; } ~_List_base() { clear(); _M_put_node(_M_node); } void clear(); template <class _Obj> friend struct replace_pheap; }; template <class _Tp, class _Arch, class _Alloc> struct replace_pheap<_List_base<_Tp, _Arch, _Alloc> > { void operator()(pheap_ptr __ph, _List_base<_Tp, _Arch, _Alloc> &__obj) { typedef _List_alloc_base<_Tp, _Arch, _Alloc, _Alloc_traits<_Tp, _Arch, _Alloc>::_S_instanceless> _Base; _Base &__o = static_cast<_Base &>(__obj); __replace_pheap(__ph, __o); } }; #else /* __PSTL_USE_STD_ALLOCATORS */ template <class _Tp, class _Arch, class _Alloc> class _List_base { public: typedef _Alloc allocator_type; typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; allocator_type get_allocator() const { return allocator_type(); } _List_base(const allocator_type &) { _M_node = _M_get_node(); (*_M_node)->_M_next = _M_node; (*_M_node)->_M_prev = _M_node; } ~_List_base() { clear(); _M_put_node(_M_node); } void clear(); protected: typedef simple_alloc<_List_node<_Tp, arch_type>, arch_type, _Alloc> _Alloc_type; ptr<_List_node<_Tp, arch_type>, arch_type> _M_get_node() { return _Alloc_type::allocate(1); } void _M_put_node(ptr<_List_node<_Tp, arch_type>, arch_type> __p) { _Alloc_type::deallocate(__p, 1); } protected: ptr<_List_node<_Tp, arch_type>, arch_type> _M_node; template <class _Obj> friend struct replace_pheap; }; template <class _Tp, class _Arch, class _Alloc> struct replace_pheap<_List_base<_Tp, _Arch, _Alloc> > { void operator()(pheap_ptr __ph, _List_base<_Tp, _Arch, _Alloc> &__obj) { __replace_pheap(__ph, __obj._M_node); } }; #endif /* __PSTL_USE_STD_ALLOCATORS */ template <class _Tp, class _Arch, class _Alloc> void _List_base<_Tp, _Arch, _Alloc>::clear() { typedef typename _Alloc_traits<_Tp, arch_type, _Alloc>::allocator_type allocator_type; typedef typename allocator_type::arch_type arch_type; ptr<_List_node<_Tp, arch_type>, arch_type> __cur = ptr<_List_node<_Tp, arch_type>, arch_type>((*_M_node)->_M_next); while (__cur != _M_node) { ptr<_List_node<_Tp, arch_type>, arch_type> __tmp = __cur; __cur = ptr<_List_node<_Tp, arch_type>, arch_type>((*__cur)->_M_next); pstl_Destroy((*_M_node)->get_M_data_pointer(_M_node)); _M_put_node(__tmp); } // (*_M_node)->_M_next = _M_node; (*_M_node)->_M_prev = _M_node; } template <class _Tp, class _Arch, class _Alloc = __PSTL_DEFAULT_ALLOCATOR(_Tp, _Arch) > class list : public _List_base<_Tp, _Arch, _Alloc> { // requirements: __PSTL_CLASS_REQUIRES(_Tp, _Assignable); typedef _Arch arch_type; typedef typename arch_type::dev_type dev_type; typedef typename arch_type::bit_type bit_type; typedef typename arch_type::size_type size_type; typedef typename arch_type::difference_type difference_type; typedef pheap<arch_type> pheap_type; typedef _List_base<_Tp, _Arch, _Alloc> _Base; protected: typedef ptr<void, arch_type> _Void_pointer; public: typedef _Tp value_type; typedef ptr<value_type, arch_type> pointer; typedef const_ptr<value_type, arch_type> const_pointer; typedef ref<value_type, arch_type> value_reference; typedef const_ref<value_type, arch_type> const_value_reference; typedef ref<list, arch_type> reference; typedef const_ref<list, arch_type> const_reference; typedef _List_node<_Tp, arch_type> _Node; typedef _Node node_type; typedef typename _Base::allocator_type allocator_type; allocator_type get_allocator() const { return _Base::get_allocator(); } public: typedef _List_iterator<_Tp, ref<_Tp, arch_type>, ptr<_Tp, arch_type>, arch_type> iterator; typedef _List_iterator<_Tp, const_ref<_Tp, arch_type>, const_ptr<_Tp, arch_type>, arch_type> const_iterator; #ifdef __PSTL_CLASS_PARTIAL_SPECIALIZATION typedef reverse_iterator<const_iterator> const_reverse_iterator; typedef reverse_iterator<iterator> reverse_iterator; #else /* __PSTL_CLASS_PARTIAL_SPECIALIZATION */ typedef reverse_bidirectional_iterator<const_iterator, value_type, arch_type, const_value_reference, difference_type> const_reverse_iterator; typedef reverse_bidirectional_iterator<iterator, value_type, arch_type, value_reference, difference_type> reverse_iterator; #endif /* __PSTL_CLASS_PARTIAL_SPECIALIZATION */ protected: #ifdef __PSTL_HAS_NAMESPACES using _Base::_M_node; using _Base::_M_put_node; using _Base::_M_get_node; #endif /* __PSTL_HAS_NAMESPACES */ protected: ptr<_Node, arch_type> _M_create_node(const _Tp &__x) { ptr<_Node, arch_type> __p = _M_get_node(); __PSTL_TRY { pstl_Construct((*__p)->get_M_data(__p), __x); } __PSTL_UNWIND(_M_put_node(__p)); return __p; } ptr<_Node, arch_type> _M_create_node() { ptr<_Node, arch_type> __p = _M_get_node(); __PSTL_TRY { pstl_Construct((*__p)->get_M_data_pointer(__p)); } __PSTL_UNWIND(_M_put_node(__p)); return __p; } public: list() : _Base(allocator_type()) {} explicit list(pheap_ptr __ph) : _Base(allocator_type(__ph)) {} explicit list(const allocator_type &__a) : _Base(__a) {} public: static ptr<list, arch_type> pnew(pheap_ptr __ph) { ptr<list, arch_type> __p(pheap_type::pheap_convert(__ph)->malloc(sizeof(list)), __ph); ref<list, arch_type> r = *__p; new ((void*) &(r.get_obj())) list(__ph); return __p; } static ptr<list, arch_type> pnew(pheap_ptr __ph, const allocator_type &__a) { ptr<list, arch_type> __p(pheap_type::pheap_convert(__ph)->malloc(sizeof(list)), __ph); ref<list, arch_type> r = *__p; new ((void*) &(r.get_obj())) list(__a); return __p; } iterator begin() { return static_cast<ptr<_Node, arch_type> >((*_M_node)->_M_next); } const_iterator begin() const { return static_cast<ptr<_Node, arch_type> >((*_M_node)->_M_next); } iterator end() { return _M_node; } const_iterator end() const { return _M_node; } reverse_iterator rbegin() { return reverse_iterator(end()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } bool empty() const { return (*_M_node)->_M_next == _M_node; } size_type size() const { size_type __result = 0; distance(begin(), end(), __result); return __result; } size_type max_size() const { return size_type(-1); } value_reference front() { return *begin(); } const_value_reference front() const { return *begin(); } value_reference back() { return *(--end()); } const_value_reference back() const { return *(--end()); } void swap(list<_Tp, _Arch, _Alloc> &__x) { pstl_swap(_M_node, __x._M_node); } iterator insert(iterator __position, const _Tp &__x) { ptr<_Node, arch_type> __tmp = _M_create_node(__x); (*__tmp)->_M_next = __position._M_node; (*__tmp)->_M_prev = (*__position._M_node)->_M_prev; (*(*__position._M_node)->_M_prev)->_M_next = __tmp; (*__position._M_node)->_M_prev = __tmp; return __tmp; } iterator insert(iterator __position) { return insert(__position, _Tp()); } #ifdef __PSTL_MEMBER_TEMPLATES // Check whether it's an integral type. If so, it's not an iterator. template <class _Integer> void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, __true_type) { _M_fill_insert(__pos, (size_type)__n, (_Tp) __x); } template <class _InputIterator> void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type); template <class _InputIterator> void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { typedef typename _Is_integer<_InputIterator>::_Integral _Integral; _M_insert_dispatch(__pos, __first, __last, _Integral()); } #else /* __PSTL_MEMBER_TEMPLATES */ void insert(iterator __position, const_ptr<_Tp, arch_type> __first, const_ptr<_Tp, arch_type> __last); void insert(iterator __position, const_iterator __first, const_iterator __last); #endif /* __PSTL_MEMBER_TEMPLATES */ void insert(iterator __pos, size_type __n, const _Tp &__x) { _M_fill_insert(__pos, __n, __x); } void _M_fill_insert(iterator __pos, size_type __n, const _Tp &__x); void push_front(const _Tp &__x) { insert(begin(), __x); } void push_front() {insert(begin());} void push_back(const _Tp &__x) { insert(end(), __x); } void push_back() {insert(end());} iterator erase(iterator __position) { ptr<_List_node_base<arch_type>, arch_type> __next_node = (*__position._M_node)->_M_next; ptr<_List_node_base<arch_type>, arch_type> __prev_node = (*__position._M_node)->_M_prev; ptr<_Node, arch_type> __n = ptr<_Node, arch_type>(__position._M_node); (*__prev_node)->_M_next = __next_node; (*__next_node)->_M_prev = __prev_node; pstl_Destroy((*__n)->get_M_data_pointer(__n)); _M_put_node(__n); return iterator(ptr<_Node, arch_type>(__next_node)); } iterator erase(iterator __first, iterator __last); void clear() { _Base::clear(); } void resize(size_type __new_size, const _Tp &__x); void resize(size_type __new_size) { this->resize(__new_size, _Tp()); } void pop_front() { erase(begin()); } void pop_back() { iterator __tmp = end(); erase(--__tmp); } list<_Tp, _Arch, _Alloc> &operator=(const list<_Tp, _Arch, _Alloc> &__x); public: // assign(), a generalized assignment member function. Two // versions: one that takes a count, and one that takes a range. // The range version is a member template, so we dispatch on whether // or not the type is an integer. void assign(size_type __n, const _Tp &__val) { _M_fill_assign(__n, __val); } void _M_fill_assign(size_type __n, const _Tp &__val); #ifdef __PSTL_MEMBER_TEMPLATES template <class _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { typedef typename _Is_integer<_InputIterator>::_Integral _Integral; _M_assign_dispatch(__first, __last, _Integral()); } template <class _Integer> void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { _M_fill_assign((size_type) __n, (_Tp) __val); } template <class _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type); #endif /* __PSTL_MEMBER_TEMPLATES */ protected: void transfer(iterator __position, iterator __first, iterator __last) { if (__position != __last) { // Remove [first, last) from its old position. (*(*__last._M_node)->_M_prev)->_M_next = __position._M_node; (*(*__first._M_node)->_M_prev)->_M_next = __last._M_node; (*(*__position._M_node)->_M_prev)->_M_next = __first._M_node; // Splice [first, last) into its new position. ptr<_List_node_base<arch_type>, arch_type> __tmp = (*__position._M_node)->_M_prev; (*__position._M_node)->_M_prev = (*__last._M_node)->_M_prev; (*__last._M_node)->_M_prev = (*__first._M_node)->_M_prev; (*__first._M_node)->_M_prev = __tmp; } } public: void splice(iterator __position, list &__x) { if (!__x.empty()) this->transfer(__position, __x.begin(), __x.end()); } void splice(iterator __position, list &, iterator __i) { iterator __j = __i; ++__j; if (__position == __i || __position == __j) return; this->transfer(__position, __i, __j); } void splice(iterator __position, list &, iterator __first, iterator __last) { if (__first != __last) this->transfer(__position, __first, __last); } void remove(const _Tp &__value); void unique(); void merge(list &__x); void reverse(); void sort(); #ifdef __PSTL_MEMBER_TEMPLATES template <class _Predicate> void remove_if(_Predicate); template <class _BinaryPredicate> void unique(_BinaryPredicate); template <class _StrictWeakOrdering> void merge(list &, _StrictWeakOrdering); template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering); #endif /* __PSTL_MEMBER_TEMPLATES */ template <class _Obj> friend struct replace_pheap; }; template <class _Tp, class _Arch, class _Alloc> struct replace_pheap<list<_Tp, _Arch, _Alloc> > { void operator()(pheap_ptr __ph, list<_Tp, _Arch, _Alloc> &__obj) { typedef _List_base<_Tp, _Arch, _Alloc> _Base; _Base &__o = static_cast<_Base &>(__obj); __replace_pheap(__ph, __o); } }; template <class _Tp, class _Arch, class _Alloc> inline bool operator==(const list<_Tp, _Arch, _Alloc> &__x, const list<_Tp, _Arch, _Alloc> &__y) { typedef typename list<_Tp, _Arch, _Alloc>::const_iterator const_iterator; const_iterator __end1 = __x.end(); const_iterator __end2 = __y.end(); const_iterator __i1 = __x.begin(); const_iterator __i2 = __y.begin(); while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { ++__i1; ++__i2; } return __i1 == __end1 && __i2 == __end2; } template <class _Tp, class _Arch, class _Alloc> inline bool operator<(const list<_Tp, _Arch, _Alloc> &__x, const list<_Tp, _Arch, _Alloc> &__y) { return pstl_lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } #ifdef __PSTL_FUNCTION_TMPL_PARTIAL_ORDER template <class _Tp, class _Arch, class _Alloc> inline bool operator!=(const list<_Tp, _Arch, _Alloc>& __x, const list<_Tp, _Arch, _Alloc>& __y) { return !(__x == __y); } //&&&2 template <class _Tp, class _Arch, class _Alloc> inline bool operator>(const list<_Tp, _Arch, _Alloc>& __x, const list<_Tp, _Arch, _Alloc>& __y) { return __y < __x; } //&&&2 template <class _Tp, class _Arch, class _Alloc> inline bool operator<=(const list<_Tp, _Arch, _Alloc>& __x, const list<_Tp, _Arch, _Alloc>& __y) { return !(__y < __x); } //&&&2 template <class _Tp, class _Arch, class _Alloc> inline bool operator>=(const list<_Tp, _Arch, _Alloc>& __x, const list<_Tp, _Arch, _Alloc>& __y) { return !(__x < __y); } //&&&2 template <class _Tp, class _Arch, class _Alloc> inline void swap(list<_Tp, _Arch, _Alloc>& __x, list<_Tp, _Arch, _Alloc>& __y) { __x.swap(__y); } #endif /* __PSTL_FUNCTION_TMPL_PARTIAL_ORDER */ #ifdef __PSTL_MEMBER_TEMPLATES template <class _Tp, class _Arch, class _Alloc> template <class _InputIter> void list<_Tp, _Arch, _Alloc>::_M_insert_dispatch(iterator __position, _InputIter __first, _InputIter __last, __false_type) { for ( ; __first != __last; ++__first) { insert(__position, *__first); } } #else /* __PSTL_MEMBER_TEMPLATES */ template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::insert(iterator __position, const_ptr<_Tp, _Arch> __first, const_ptr<_Tp, _Arch> __last) { for ( ; __first != __last; ++__first) { insert(__position, *__first); } } template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::insert(iterator __position, const_iterator __first, const_iterator __last) { for ( ; __first != __last; ++__first) { insert(__position, *__first); } } #endif /* __PSTL_MEMBER_TEMPLATES */ template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::_M_fill_insert(iterator __position, size_type __n, const _Tp &__x) { for ( ; __n > 0; --__n) { insert(__position, __x); } } template <class _Tp, class _Arch, class _Alloc> typename list<_Tp, _Arch, _Alloc>::iterator list<_Tp, _Arch, _Alloc>::erase(iterator __first, iterator __last) { while (__first != __last) { erase(__first++); } return __last; } template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::resize(size_type __new_size, const _Tp &__x) { iterator __i = begin(); size_type __len = 0; for ( ; __i != end() && __len < __new_size; ++__i, ++__len); if (__len == __new_size) { erase(__i, end()); } else { // __i == end() insert(end(), __new_size - __len, __x); } } template <class _Tp, class _Arch, class _Alloc> list<_Tp, _Arch, _Alloc> & list<_Tp, _Arch, _Alloc>::operator=(const list<_Tp, _Arch, _Alloc> &__x) { if (this != &__x) { iterator __first1 = begin(); iterator __last1 = end(); const_iterator __first2 = __x.begin(); const_iterator __last2 = __x.end(); while (__first1 != __last1 && __first2 != __last2) { *__first1++ = *__first2++; } if (__first2 == __last2) { erase(__first1, __last1); } else { insert(__last1, __first2, __last2); } } return *this; } template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::_M_fill_assign(size_type __n, const _Tp &__val) { iterator __i = begin(); for ( ; __i != end() && __n > 0; ++__i, --__n) { *__i = __val; } if (__n > 0) { insert(end(), __n, __val); } else { erase(__i, end()); } } #ifdef __PSTL_MEMBER_TEMPLATES template <class _Tp, class _Arch, class _Alloc> template <class _InputIter> void list<_Tp, _Arch, _Alloc>::_M_assign_dispatch(_InputIter __first2, _InputIter __last2, __false_type) { iterator __first1 = begin(); iterator __last1 = end(); for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) *__first1 = *__first2; if (__first2 == __last2) { erase(__first1, __last1); } else { insert(__last1, __first2, __last2); } } #endif /* __PSTL_MEMBER_TEMPLATES */ template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::remove(const _Tp &__value) { iterator __first = begin(); iterator __last = end(); while (__first != __last) { iterator __next = __first; ++__next; if (*__first == __value) { erase(__first); } __first = __next; } } template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::unique() { iterator __first = begin(); iterator __last = end(); if (__first == __last) return; iterator __next = __first; while (++__next != __last) { if (*__first == *__next) { erase(__next); } else { __first = __next; } __next = __first; } } template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::merge(list<_Tp, _Arch, _Alloc> &__x) { iterator __first1 = begin(); iterator __last1 = end(); iterator __first2 = __x.begin(); iterator __last2 = __x.end(); while (__first1 != __last1 && __first2 != __last2) if (*__first2 < *__first1) { iterator __next = __first2; transfer(__first1, __first2, ++__next); __first2 = __next; } else { ++__first1; } if (__first2 != __last2) { transfer(__last1, __first2, __last2); } } template <class _Arch> inline void __List_base_reverse(ptr<_List_node_base<_Arch>, _Arch> __p) { ptr<_List_node_base<_Arch>, _Arch> __tmp = __p; do { pstl_swap((*__tmp)->_M_next, (*__tmp)->_M_prev); __tmp = (*__tmp)->_M_prev; // Old next node is now prev. } while (__tmp != __p); } template <class _Tp, class _Arch, class _Alloc> inline void list<_Tp, _Arch, _Alloc>::reverse() { __List_base_reverse(ptr<_List_node_base<_Arch>, _Arch>(this->_M_node)); } template <class _Tp, class _Arch, class _Alloc> void list<_Tp, _Arch, _Alloc>::sort() { // Do nothing if the list has length 0 or 1. if ((*_M_node)->_M_next != _M_node && (*(*_M_node)->_M_next)->_M_next != _M_node) { list<_Tp, _Arch, _Alloc> __carry(_M_node.get_pheap()); list<_Tp, _Arch, _Alloc> *__counter[64]; for (int i = 0; i < 64; i++) { __counter[i] = new list<_Tp, _Arch, _Alloc>(_M_node.get_pheap()); } int __fill = 0; while (!empty()) { __carry.splice(__carry.begin(), *this, begin()); int __i = 0; while (__i < __fill && !__counter[__i]->empty()) { __counter[__i]->merge(__carry); __carry.swap(*__counter[__i++]); } __carry.swap(*__counter[__i]); if (__i == __fill) { ++__fill; } } for (int __i = 1; __i < __fill; ++__i) { __counter[__i]->merge(*__counter[__i - 1]); } swap(*__counter[__fill - 1]); for (int i = 0; i < 64; i++) { delete __counter[i]; } } } #ifdef __PSTL_MEMBER_TEMPLATES template <class _Tp, class _Arch, class _Alloc> template <class _Predicate> void list<_Tp, _Arch, _Alloc>::remove_if(_Predicate __pred) { iterator __first = begin(); iterator __last = end(); while (__first != __last) { iterator __next = __first; ++__next; if (__pred(*__first)) { erase(__first); } __first = __next; } } template <class _Tp, class _Arch, class _Alloc> template <class _BinaryPredicate> void list<_Tp, _Arch, _Alloc>::unique(_BinaryPredicate __binary_pred) { iterator __first = begin(); iterator __last = end(); if (__first == __last) { return; } iterator __next = __first; while (++__next != __last) { if (__binary_pred(*__first, *__next)) { erase(__next); } else { __first = __next; } __next = __first; } } template <class _Tp, class _Arch, class _Alloc> template <class _StrictWeakOrdering> void list<_Tp, _Arch, _Alloc>::merge(list<_Tp, _Arch, _Alloc> &__x, _StrictWeakOrdering __comp) { iterator __first1 = begin(); iterator __last1 = end(); iterator __first2 = __x.begin(); iterator __last2 = __x.end(); //***1? while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first2, *__first1)) { iterator __next = __first2; transfer(__first1, __first2, ++__next); __first2 = __next; } else { ++__first1; } } if (__first2 != __last2) { transfer(__last1, __first2, __last2); } } template <class _Tp, class _Arch, class _Alloc> template <class _StrictWeakOrdering> void list<_Tp, _Arch, _Alloc>::sort(_StrictWeakOrdering __comp) { // Do nothing if the list has length 0 or 1. if ((*_M_node)->_M_next != _M_node && (*(*_M_node)->_M_next)->_M_next != _M_node) { list<_Tp, _Arch, _Alloc> __carry(_M_node.get_pheap()); list<_Tp, _Arch, _Alloc> *__counter[64]; for (int i = 0; i < 64; i++) { __counter[i] = new list<_Tp, _Arch, _Alloc>(_M_node.get_pheap()); } int __fill = 0; while (!empty()) { __carry.splice(__carry.begin(), *this, begin()); int __i = 0; while(__i < __fill && !__counter[__i]->empty()) { __counter[__i]->merge(__carry, __comp); __carry.swap(*__counter[__i++]); } __carry.swap(*__counter[__i]); if (__i == __fill) { ++__fill; } } for (int __i = 1; __i < __fill; ++__i) { __counter[__i]->merge(*__counter[__i - 1], __comp); } swap(*__counter[__fill - 1]); for (int i = 0; i < 64; i++) { delete __counter[i]; } } } #endif /* __PSTL_MEMBER_TEMPLATES */ #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) #pragma reset woff 1174 #pragma reset woff 1375 #endif __PSTL_END_NAMESPACE #endif /* __SGI_PSTL_INTERNAL_LIST_H */ // Local Variables: // mode:C++ // End:
32.239965
164
0.680705
ef035de341b7e03755f8dc8323764971b22dac80
2,232
c
C
third_party/zip/variable.c
junyanl-code/Luminary-Micro-Library
52dff10f8812558749263b4767de4b0d3c79a9b3
[ "BSD-3-Clause" ]
25
2015-04-20T13:03:05.000Z
2022-01-06T07:25:02.000Z
third_party/zip/variable.c
junyanl-code/Luminary-Micro-Library
52dff10f8812558749263b4767de4b0d3c79a9b3
[ "BSD-3-Clause" ]
null
null
null
third_party/zip/variable.c
junyanl-code/Luminary-Micro-Library
52dff10f8812558749263b4767de4b0d3c79a9b3
[ "BSD-3-Clause" ]
24
2015-09-22T12:08:11.000Z
2021-12-30T10:17:30.000Z
/* * variable.c * * Variable manipulation routines * */ #include "ztypes.h" /* * load * * Load and store a variable value. * */ #ifdef __STDC__ void load (zword_t variable) #else void load (variable) zword_t variable; #endif { store_operand (load_variable (variable)); }/* load */ /* * push_var * * Push a value onto the stack * */ #ifdef __STDC__ void push_var (zword_t value) #else void push_var (value) zword_t value; #endif { stack[--sp] = value; }/* push_var */ /* * pop_var * * Pop a variable from the stack. * */ #ifdef __STDC__ void pop_var (zword_t variable) #else void pop_var (variable) zword_t variable; #endif { store_variable (variable, stack[sp++]); }/* pop_var */ /* * increment * * Increment a variable. * */ #ifdef __STDC__ void increment (zword_t variable) #else void increment (variable) zword_t variable; #endif { store_variable (variable, load_variable (variable) + 1); }/* increment */ /* * decrement * * Decrement a variable. * */ #ifdef __STDC__ void decrement (zword_t variable) #else void decrement (variable) zword_t variable; #endif { store_variable (variable, load_variable (variable) - 1); }/* decrement */ /* * increment_check * * Increment a variable and then check its value against a target. * */ #ifdef __STDC__ void increment_check (zword_t variable, zword_t target) #else void increment_check (variable, target) zword_t variable; zword_t target; #endif { short value; value = (short) load_variable (variable); store_variable (variable, ++value); conditional_jump (value > (short) target); }/* increment_check */ /* * decrement_check * * Decrement a variable and then check its value against a target. * */ #ifdef __STDC__ void decrement_check (zword_t variable, zword_t target) #else void decrement_check (variable, target) zword_t variable; zword_t target; #endif { short value; value = (short) load_variable (variable); store_variable (variable, --value); conditional_jump (value < (short) target); }/* decrement_check */
14.88
67
0.638441
8856a7fd4b6b935d0acefff5ffa60243e2edf6fc
144
h
C
main/console.h
arjenhiemstra/itho-esp
220fe90810d87a8760f84143cbfd9cfe751ff599
[ "Unlicense" ]
5
2020-12-22T21:12:42.000Z
2021-02-13T13:56:28.000Z
main/console.h
arjenhiemstra/itho-esp
220fe90810d87a8760f84143cbfd9cfe751ff599
[ "Unlicense" ]
3
2021-05-05T20:32:37.000Z
2022-01-19T14:35:20.000Z
main/console.h
arjenhiemstra/itho-esp
220fe90810d87a8760f84143cbfd9cfe751ff599
[ "Unlicense" ]
1
2021-03-07T09:25:14.000Z
2021-03-07T09:25:14.000Z
#pragma once #include <string> bool console_read(const char* prompt, std::string& res, const char* defaultValue = "", bool multiline = false);
28.8
111
0.729167
ccfb8ae65dbbb9ceec4d747cb93b399eff305127
15,991
h
C
Haru/4DPlugin.h
miyako/4d-plugin-haru
749599d7ec9f21a2071ebef3859eb3fce8c59754
[ "MIT" ]
null
null
null
Haru/4DPlugin.h
miyako/4d-plugin-haru
749599d7ec9f21a2071ebef3859eb3fce8c59754
[ "MIT" ]
1
2020-02-13T03:34:38.000Z
2020-06-01T21:08:11.000Z
Haru/4DPlugin.h
miyako/4d-plugin-haru
749599d7ec9f21a2071ebef3859eb3fce8c59754
[ "MIT" ]
2
2016-06-07T08:28:17.000Z
2016-08-03T10:53:05.000Z
/* -------------------------------------------------------------------------------- # # 4DPlugin.h # source generated by 4D Plugin Wizard # Project : Haru # author : miyako # 2017/06/24 # # --------------------------------------------------------------------------------*/ // --- Extended Graphics State void PDF_ExtGState_SetAlphaFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_ExtGState_SetAlphaStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_ExtGState_SetBlendMode(sLONG_PTR *pResult, PackagePtr pParams); // --- Document void PDF_UseCNTEncodings(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadU3DFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetPageByIndex(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetCurrentEncoder(sLONG_PTR *pResult, PackagePtr pParams); void PDF_CreateExtGState(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadRaw1BitImageFromMem(sLONG_PTR *pResult, PackagePtr pParams); void PDF_AddPageLabel(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadTTFontFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseCNSEncodings(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetTTFontDefFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadType1FontFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_ResetError(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadRawImageFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadPngImageFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseKREncodings(sLONG_PTR *pResult, PackagePtr pParams); void PDF_CreateOutline(sLONG_PTR *pResult, PackagePtr pParams); void PDF_InsertPage(sLONG_PTR *pResult, PackagePtr pParams); void PDF_AddPage(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetCurrentPage(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetOpenAction(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetPageMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetPageMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetPageLayout(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetPageLayout(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetPagesConfiguration(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SaveToFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_HasDoc(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetFont(sLONG_PTR *pResult, PackagePtr pParams); void PDF_FreeDocAll(sLONG_PTR *pResult, PackagePtr pParams); void PDF_FreeDoc(sLONG_PTR *pResult, PackagePtr pParams); void PDF_NewDoc(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Free(sLONG_PTR *pResult, PackagePtr pParams); void PDF_New(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetEncoder(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetCurrentEncoder(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadRawImageFromMem(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadPngImageFromMem(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadJpegImageFromMem(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LoadJpegImageFromFile(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetInfoAttr(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetInfoAttr(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetInfoDateAttr(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetPassword(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetPermission(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetEncryptionMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetCompressionMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseJPEncodings(sLONG_PTR *pResult, PackagePtr pParams); void PDF_GetViewerPreference(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SetViewerPreference(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseCNTFonts(sLONG_PTR *pResult, PackagePtr pParams); void PDF_SaveToStream(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseCNSFonts(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseKRFonts(sLONG_PTR *pResult, PackagePtr pParams); void PDF_UseJPFonts(sLONG_PTR *pResult, PackagePtr pParams); // --- Annotation void PDF_MarkupAnnot_SetPopup(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetIntent(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetAlpha(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetDate(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetSubject(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetTitle(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Annot_SetNoColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Annot_SetGrayColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Annot_SetCMYKColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Annot_SetRGBColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Annotation_SetBorderStyle(sLONG_PTR *pResult, PackagePtr pParams); void PDF_TextAnnot_SetOpened(sLONG_PTR *pResult, PackagePtr pParams); void PDF_TextAnnot_SetIcon(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LinkAnnot_SetBorderStyle(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LinkAnnot_SetHighlightMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetRectDiff(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetCloudEffect(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetRGBColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetCMYKColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetGrayColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetNoColor(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LineAnnot_SetLeader(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LineAnnot_SetCaption(sLONG_PTR *pResult, PackagePtr pParams); void PDF_LineAnnot_SetPosition(sLONG_PTR *pResult, PackagePtr pParams); void PDF_PopupAnnot_SetOpened(sLONG_PTR *pResult, PackagePtr pParams); void PDF_MarkupAnnot_SetQuadPoints(sLONG_PTR *pResult, PackagePtr pParams); void PDF_FreeAnnot_SetEndingStyle(sLONG_PTR *pResult, PackagePtr pParams); void PDF_FreeAnnot_Set3PointCallout(sLONG_PTR *pResult, PackagePtr pParams); void PDF_FreeAnnot_Set2PointCallout(sLONG_PTR *pResult, PackagePtr pParams); void PDF_FreeAnnot_SetDefaultStyle(sLONG_PTR *pResult, PackagePtr pParams); // --- Outline void PDF_Outline_SetDestination(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Outline_SetOpened(sLONG_PTR *pResult, PackagePtr pParams); // --- Destination void PDF_Destination_SetFitBV(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetFitBH(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetFitB(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetFitR(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetFitV(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetFitH(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetFit(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Destination_SetXYZ(sLONG_PTR *pResult, PackagePtr pParams); // --- Global void PDF_Global_GetEncoding(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Global_SetEncoding(sLONG_PTR *pResult, PackagePtr pParams); // --- Page void PDF_Page_SetGrayFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetFontAndSize(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetExtGState(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetDash(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetCMYKStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetCMYKFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetCharSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Rectangle(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_MoveToNextLine(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_MoveTo(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_MoveTextPos(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_LineTo(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GSave(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GRestore(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_FillStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Fill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_EofillStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Eofill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Eoclip(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_EndText(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_EndPath(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Ellipse(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_DrawImage(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CurveTo3(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CurveTo2(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CurveTo(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Concat(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ClosePathFillStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ClosePathEofillStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ClosePathStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ClosePath(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Clip(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Circle(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_BeginText(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Arc(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateCircleAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateSquareAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateProjectionAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateStampAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreatePopupAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateFreeTextAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateStrikeOutAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateSquigglyAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateUnderlineAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateHighlightAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateLineAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateTextMarkupAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_TextRect(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_TextOut(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_Stroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ShowTextNextLineEx(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ShowTextNextLine(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_ShowText(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetWordSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetTextRise(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetTextRenderingMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetTextMatrix(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetTextLeading(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetRGBStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetRGBFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetMiterLimit(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetLineWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetLineJoin(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetLineCap(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetHorizontalScalling(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetGrayStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetHeight(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetSize(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetRotate(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetHeight(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateDestination(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateTextAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateLinkAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_CreateURILinkAnnot(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_TextWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_MeasureText(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetGMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCurrentPos(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCurrentTextPos(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCurrentFont(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCurrentFontSize(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetTransMatrix(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetLineWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetLineCap(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetLineJoin(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetMiterLimit(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetDash(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetFlat(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCharSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetWordSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetHorizontalScalling(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetTextLeading(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetTextRenderingMode(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetTextRise(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetRGBFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetRGBStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCMYKFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetCMYKStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetGrayFill(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetGrayStroke(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetStrokingColorSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetFillingColorSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetTextMatrix(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_GetGStateDepth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetSlideShow(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Page_SetZoom(sLONG_PTR *pResult, PackagePtr pParams); // --- Font void PDF_Font_GetFontName(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetEncodingName(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetUnicodeWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetBBox(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetAscent(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetDescent(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetXHeight(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_GetCapHeight(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_TextWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Font_MeasureText(sLONG_PTR *pResult, PackagePtr pParams); // --- Image void PDF_Image_GetSize(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_AddSMask(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_GetWidth(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_GetHeight(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_GetBitsPerComponent(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_GetColorSpace(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_SetColorMask(sLONG_PTR *pResult, PackagePtr pParams); void PDF_Image_SetMaskImage(sLONG_PTR *pResult, PackagePtr pParams);
62.709804
86
0.824964
697b6c87f32c285d87813a63d85456d351359ce8
7,031
h
C
VoodooIntel3945.h
pvaibhav/VoodooIntel3945
912ce8c833705689e84e863657998bceeb4bf5b2
[ "BSD-2-Clause" ]
7
2016-03-16T00:23:13.000Z
2021-05-03T13:35:05.000Z
VoodooIntel3945.h
pvaibhav/VoodooIntel3945
912ce8c833705689e84e863657998bceeb4bf5b2
[ "BSD-2-Clause" ]
null
null
null
VoodooIntel3945.h
pvaibhav/VoodooIntel3945
912ce8c833705689e84e863657998bceeb4bf5b2
[ "BSD-2-Clause" ]
2
2019-04-25T13:52:08.000Z
2021-01-19T02:49:58.000Z
/* * VoodooIntel3945.h * VoodooIntel3945 * * Created by Prashant Vaibhav on 31/08/09. * Copyright 2009 Prashant Vaibhav. All rights reserved. * */ #ifndef _VOODOOINTEL3945_H #define _VOODOOINTEL3945_H #pragma mark Includes #include <sys/types.h> #include <sys/kernel_types.h> #include <IOKit/IOLib.h> #include <IOKit/IOBufferMemoryDescriptor.h> #include <IOKit/IOInterruptEventSource.h> #include <IOKit/IOTimerEventSource.h> #include <IOKit/IOWorkLoop.h> #include <IOKit/network/IOMbufMemoryCursor.h> #include <IOKit/pci/IOPCIDevice.h> #include <VoodooWireless/VoodooWirelessDevice.h> #include "if_wpireg.h" #include "ieee80211_amrr.h" #define super VoodooWirelessDevice #define MyClass VoodooIntel3945 /* The following is used for the auth/assoc process. TODO: Move to VoodooWireless */ struct AuthenticationFrame { IEEE::ManagementFrameHeader hdr; uint16_t algorithm; // = 0 for open, 1 for shared uint16_t sequence; // = 1 for request, 2 for response uint16_t status; // refer to table 7-23 in spec } __packed; struct AssocRequestFrame { IEEE::ManagementFrameHeader hdr; IEEE::Capability cap; uint16_t lintval; /* followed by 3 IEs in this order: SSID supported rates extended supported rates */ uint8_t ie[2+32+2+8+2+4+50]; } __packed; struct AssocResponseFrame { IEEE::ManagementFrameHeader hdr; IEEE::Capability cap; uint16_t status; uint16_t aid; // association ID /* followed by IEs : supported rates extended supported rates edca parameter set */ } __packed; class VoodooIntel3945: public VoodooWirelessDevice { /* This is required for I/OKit to properly recognize our class for the RTTI system */ OSDeclareDefaultStructors(VoodooIntel3945) private: #pragma mark Private variables /* Hardware related data */ IOPCIDevice* m_PciDevice; /* The PCI nub we'll use to access the HW */ IOMemoryMap* m_DeviceMap; /* Device memory map */ uint8_t* m_Registers; /* Pointer to memory mapped CSR region */ /* DMA buffers */ IOBufferMemoryDescriptor* m_Firmware; /* Buffer to store firmware images while loading */ IOBufferMemoryDescriptor* m_SharedPage; /* Page of memory shared between NIC and host PC */ wpi_shared* m_SharedPagePtr; IOBufferMemoryDescriptor* m_RxRingMemory; /* DMA safe memory for storing pointers to Rx mbufs */ /* Ring structures */ struct TxRing { IOBufferMemoryDescriptor* descMemory; /* Store the descriptors for each command or tx mbuf */ IOBufferMemoryDescriptor* cmdMemory; /* Slots for holding cmd data */ wpi_tx_desc* descriptors; /* VM pointer to desc array */ wpi_tx_cmd* cmdSlots; /* VM pointer to cmd data array */ uint32_t cmdPhysAdd; /* Physical address of start of cmd data array */ mbuf_t mbufs[WPI_TX_RING_COUNT];/* Array of commands mapped into mbufs (if any) */ int qid; /* Queue ID (0-3 for WME) */ int count; /* How many items this queue holds */ int queued; /* How many are queued */ int current; /* Current queue item */ }; TxRing m_TxRing[4]; TxRing m_CmdRing; struct RxRing { int current; mbuf_t mbufs[WPI_RX_RING_COUNT];/* Incoming packets get stored here */ uint32_t* rx_pkt_ptr; /* Pointer to list of paddr pointers-to-mbuf */ uint32_t physAdd; /* Aligned physical address */ }; RxRing m_RxRing; /* Other assets */ IO80211WorkLoop* m_WorkLoop; /* Workloop for single-threaded HW access */ IOInterruptEventSource* m_InterruptSrc; /* Interrupt generated by the HW */ IOTimerEventSource* m_Timer; /* for various duties */ int m_PowerCountdown; /* count seconds until power recalibration */ IOMbufLittleMemoryCursor* m_MbufCursor; /* For getting scatter gather list */ bool m_SupportsA; /* where 802.11a is supported by this SKU */ bool m_FirmwareLoaded;/* Wait event for firmware load */ bool m_CommandDone; /* Wait event for adapter command */ uint32_t m_Flags; /* Misc. driver flag bits */ int m_Temperature; /* HW temperature */ uint64_t m_Timestamp; /* Received from last beacon */ uint16_t m_BeaconInterval; /* " */ wpi_config m_Config; /* HW configuration */ IEEE::MACAddress m_MacAddress; /* Our hw address */ IEEE::Channel m_CurrentChannel; int m_AssocID; /* Current association ID */ AssociationParameters m_AssocParams; /* For use during auth/assoc */ enum AssocState { staInit, staAuthTry, staAssocTry, staAssociated }; AssocState m_AssocState; /* For keeping track of the current stage in auth/assoc */ int m_TxRateIndex; /* Which rate to transmit at, from m_AssocParams.supportedRates */ struct ieee80211_amrr_node amrrNode; /* For automatic rate adaptation */ struct ieee80211_amrr amrr; /* EEPROM info */ uint8_t m_HWCap; uint16_t m_HWRev; uint8_t m_HWType; wpi_power_group m_PowerGroups[5]; int8_t m_MaxPower[255]; protected: #pragma mark Hardware specific functions IOReturn allocateResources ( IOService* provider ); IOReturn turnPowerOn ( ); IOReturn turnPowerOff ( ); void freeResources ( IOService* provider ); IOReturn startScan ( const ScanParameters* params, const IEEE::ChannelList* channels ); void abortScan ( ); IOReturn associate ( const AssociationParameters* params ); IOReturn disassociate ( ); void getHardwareInfo ( HardwareInfo* info ); IOReturn getConfiguration ( HardwareConfigType type, void* param ); IOReturn setConfiguration ( HardwareConfigType type, void* param ); IOReturn outputFrame ( TxFrameHeader hdr, mbuf_t data ); void interruptOccurred ( OSObject* owner, IOInterruptEventSource* intr, int count ); void timerOccurred ( OSObject* owner, IOTimerEventSource* timer ); private: IOReturn uploadFirmware ( ); IOReturn uploadMicrocode ( const uint8_t* data, size_t len ); IOReturn resetAdapter ( ); IOReturn powerUp ( ); IOReturn stopMaster ( ); IOReturn configure ( ); void configureHardware ( ); IOReturn sendCommand ( int code, const void* buf, int size, bool async = true ); IOReturn setTxPower ( IEEE::Channel chan, bool async = true ); int getPowerIndex ( wpi_power_group* group, IEEE::Channel c, int rate); IOReturn mrrSetup ( ); uint8_t plcpSignal ( int rate ); void resetTxRing ( TxRing* ring ); void resetRxRing ( RxRing* ring ); IOReturn sendManagementFrame ( const uint8_t* data, const size_t len ); void sendAssocRequest ( ); void postAssocProcedure ( int assocID ); void setLED ( uint8_t which, uint8_t off, uint8_t on ); void notificationInterrupt ( ); void rxInterrupt ( wpi_rx_desc* desc ); void txInterrupt ( wpi_rx_desc* desc ); void cmdInterrupt ( wpi_rx_desc* desc ); void memLock ( ); void memUnlock ( ); uint32_t memRead ( uint32_t offset ); void memWrite ( uint32_t offset, uint32_t data ); void memWriteRegion ( uint32_t offset, const uint32_t* data, int ndwords ); IOReturn readPromData ( uint32_t addr, void *data, int len ); IOBufferMemoryDescriptor* allocDmaMemory( size_t size, int alignment, void** vaddr, uint32_t* paddr ); }; #endif//_VOODOOINTEL3945_H
36.430052
103
0.730053
f82daa142460922a85aeb7b03e647115513d386a
138
h
C
lib/ios/ReactNativeNavigationTests/RNNTestRootViewCreator.h
masslight/react-native-navigation
dd51281c7a109abef83ee83995b02417a11fc6db
[ "MIT" ]
7
2018-01-09T23:06:30.000Z
2020-06-14T18:23:52.000Z
lib/ios/ReactNativeNavigationTests/RNNTestRootViewCreator.h
masslight/react-native-navigation
dd51281c7a109abef83ee83995b02417a11fc6db
[ "MIT" ]
18
2020-04-06T02:00:24.000Z
2022-03-25T18:52:20.000Z
lib/ios/ReactNativeNavigationTests/RNNTestRootViewCreator.h
masslight/react-native-navigation
dd51281c7a109abef83ee83995b02417a11fc6db
[ "MIT" ]
5
2020-03-10T16:14:46.000Z
2021-09-25T09:51:59.000Z
#import <Foundation/Foundation.h> #import "RNNRootViewCreator.h" @interface RNNTestRootViewCreator : NSObject <RNNRootViewCreator> @end
19.714286
65
0.811594
f84d18ce64ca4a6a40ea3e046d632bd87581af41
439
c
C
sys_enter_openat/sys_enter_openat.bpf.c
feifeifeimoon/ebpf-study
d56d30febce4a4642c94c9a2da2b542473aa5f46
[ "Apache-2.0" ]
null
null
null
sys_enter_openat/sys_enter_openat.bpf.c
feifeifeimoon/ebpf-study
d56d30febce4a4642c94c9a2da2b542473aa5f46
[ "Apache-2.0" ]
null
null
null
sys_enter_openat/sys_enter_openat.bpf.c
feifeifeimoon/ebpf-study
d56d30febce4a4642c94c9a2da2b542473aa5f46
[ "Apache-2.0" ]
null
null
null
#include "vmlinux.h" #include <bpf/bpf_helpers.h> SEC("tracepoint/syscalls/sys_enter_openat") int tracepoint__syscalls__sys_enter_openat(struct trace_event_raw_sys_enter *ctx) { const char *fname = (const char *) ctx->args[1]; int flags = (int) ctx->args[2]; char fmt[] = "[trace openat] filename='%s' flags='%d"; bpf_trace_printk(fmt, sizeof(fmt), fname, flags); return 0; } char _license[] SEC("license") = "GPL";
29.266667
83
0.687927
52ca8994de180467b6ad0a8f4c5e54c9ca268743
253
h
C
Cores/Play/PVPlayCore/Core/PVPlayCore+Audio.h
ianclawson/Provenance
e9cc8c57f41a4d122a998cf53ffd69b1513d4205
[ "BSD-3-Clause" ]
3,459
2015-01-07T14:07:09.000Z
2022-03-25T03:51:10.000Z
Cores/Play/PVPlayCore/Core/PVPlayCore+Audio.h
ianclawson/Provenance
e9cc8c57f41a4d122a998cf53ffd69b1513d4205
[ "BSD-3-Clause" ]
688
2015-01-05T18:07:57.000Z
2018-03-24T14:29:58.000Z
Cores/Play/PVPlayCore/Core/PVPlayCore+Audio.h
ianclawson/Provenance
e9cc8c57f41a4d122a998cf53ffd69b1513d4205
[ "BSD-3-Clause" ]
549
2015-01-07T14:07:15.000Z
2022-01-07T16:13:05.000Z
// // PVPlayCore+Audio.h // PVPlay // // Created by Joseph Mattiello on 11/1/18. // Copyright © 2021 Provenance. All rights reserved. // #import <PVPlay/PVPlay.h> NS_ASSUME_NONNULL_BEGIN @interface PVPlayCore (Audio) @end NS_ASSUME_NONNULL_END
14.055556
53
0.72332
fb8ed8189044edd79dd0d8fe59bd27630c736186
751
h
C
src/include/DMSUT.h
dotweiba/dbt5
39e23b0a0bfd4dfcb80cb2231270324f6bbf4b42
[ "Artistic-1.0" ]
3
2017-08-30T12:57:33.000Z
2022-02-08T14:25:03.000Z
src/include/DMSUT.h
dotweiba/dbt5
39e23b0a0bfd4dfcb80cb2231270324f6bbf4b42
[ "Artistic-1.0" ]
1
2020-09-28T05:36:28.000Z
2021-03-15T10:38:29.000Z
src/include/DMSUT.h
dotweiba/dbt5
39e23b0a0bfd4dfcb80cb2231270324f6bbf4b42
[ "Artistic-1.0" ]
5
2017-01-18T20:16:06.000Z
2021-03-09T12:23:50.000Z
/* * This file is released under the terms of the Artistic License. Please see * the file LICENSE, included in this package, for details. * * Copyright (C) 2006-2010 Rilson Nascimento * * DM - SUT Interface class * 12 August 2006 */ #ifndef DM_SUT_H #define DM_SUT_H #include "DM.h" #include "locking.h" #include "BaseInterface.h" using namespace TPCE; class CDMSUT : public CDMSUTInterface, public CBaseInterface { public: CDMSUT(char *, const int, ofstream *, ofstream *, CMutex *, CMutex *); ~CDMSUT(void); // return whether it was successful virtual bool DataMaintenance(PDataMaintenanceTxnInput pTxnInput); // return whether it was successful virtual bool TradeCleanup(PTradeCleanupTxnInput pTxnInput); }; #endif // DM_SUT_H
22.757576
77
0.741678
dd3a265859d8f34a6fe226048b4dc44a9e965bb3
1,243
h
C
src/libusockets.h
camill8/uSockets
70e1cc081f728c50347c28690b46fca58054a090
[ "Zlib" ]
1
2018-09-19T07:04:52.000Z
2018-09-19T07:04:52.000Z
src/libusockets.h
xyuan/uSockets
491a8152dff8d8e199742d19e39d057938f4d39c
[ "Zlib" ]
null
null
null
src/libusockets.h
xyuan/uSockets
491a8152dff8d8e199742d19e39d057938f4d39c
[ "Zlib" ]
null
null
null
#ifndef LIBUSOCKETS_H #define LIBUSOCKETS_H /* 512kb shared receive buffer */ #define LIBUS_RECV_BUFFER_LENGTH 524288 /* A timeout granularity of 4 seconds means give or take 4 seconds from set timeout */ #define LIBUS_TIMEOUT_GRANULARITY 4 /* Define what a socket descriptor is based on platform */ #ifdef _WIN32 #include <WinSock2.h> #define LIBUS_SOCKET_DESCRIPTOR SOCKET #define WIN32_EXPORT __declspec(dllexport) #else #define LIBUS_SOCKET_DESCRIPTOR int #define WIN32_EXPORT #endif #ifdef __cplusplus extern "C" { #endif /* I guess these are listening options */ enum { OPTION_REUSE_PORT }; /* Library types publicly available */ struct us_socket; struct us_timer; struct us_socket_context; struct us_loop; struct us_ssl_socket_context; struct us_ssl_socket; /* These are public interfaces sorted by subject */ #include "interfaces/timer.h" #include "interfaces/context.h" #include "interfaces/loop.h" #include "interfaces/poll.h" #include "interfaces/ssl.h" #include "interfaces/socket.h" #ifdef __cplusplus } #endif /* Decide what eventing system to use */ #if !defined(LIBUS_USE_EPOLL) && !defined(LIBUS_USE_LIBUV) #ifdef _WIN32 #define LIBUS_USE_LIBUV #else #define LIBUS_USE_EPOLL #endif #endif #endif // LIBUSOCKETS_H
21.431034
86
0.783588
f7b9334b1424a426c8c6012afa8d4c739fd7b7b6
7,149
h
C
apiwzem/PnlWzemNdeDetail.h
mpsitech/wzem-WhizniumSBE-Engine-Monitor
0d9a204660bfad57f25dbd641fd86713986f32f1
[ "MIT" ]
null
null
null
apiwzem/PnlWzemNdeDetail.h
mpsitech/wzem-WhizniumSBE-Engine-Monitor
0d9a204660bfad57f25dbd641fd86713986f32f1
[ "MIT" ]
null
null
null
apiwzem/PnlWzemNdeDetail.h
mpsitech/wzem-WhizniumSBE-Engine-Monitor
0d9a204660bfad57f25dbd641fd86713986f32f1
[ "MIT" ]
null
null
null
/** * \file PnlWzemNdeDetail.h * API code for job PnlWzemNdeDetail (declarations) * \copyright (C) 2016-2020 MPSI Technologies GmbH * \author Alexander Wirthmueller (auto-generation) * \date created: 6 Dec 2020 */ // IP header --- ABOVE #ifndef PNLWZEMNDEDETAIL_H #define PNLWZEMNDEDETAIL_H #include "ApiWzem_blks.h" #define VecVWzemNdeDetailDo PnlWzemNdeDetail::VecVDo #define ContIacWzemNdeDetail PnlWzemNdeDetail::ContIac #define ContInfWzemNdeDetail PnlWzemNdeDetail::ContInf #define StatAppWzemNdeDetail PnlWzemNdeDetail::StatApp #define StatShrWzemNdeDetail PnlWzemNdeDetail::StatShr #define TagWzemNdeDetail PnlWzemNdeDetail::Tag #define DpchAppWzemNdeDetailData PnlWzemNdeDetail::DpchAppData #define DpchAppWzemNdeDetailDo PnlWzemNdeDetail::DpchAppDo #define DpchEngWzemNdeDetailData PnlWzemNdeDetail::DpchEngData /** * PnlWzemNdeDetail */ namespace PnlWzemNdeDetail { /** * VecVDo (full: VecVWzemNdeDetailDo) */ class VecVDo { public: static const Sbecore::uint BUTSAVECLICK = 1; static const Sbecore::uint BUTPRDVIEWCLICK = 2; static Sbecore::uint getIx(const std::string& sref); static std::string getSref(const Sbecore::uint ix); }; /** * ContIac (full: ContIacWzemNdeDetail) */ class ContIac : public Sbecore::Block { public: static const Sbecore::uint TXFXNR = 1; static const Sbecore::uint TXFIP = 2; static const Sbecore::uint TXFSTA = 3; static const Sbecore::uint TXFSTO = 4; static const Sbecore::uint TXFPRT = 5; static const Sbecore::uint TXFORN = 6; public: ContIac(const std::string& TxfXnr = "", const std::string& TxfIp = "", const std::string& TxfSta = "", const std::string& TxfSto = "", const std::string& TxfPrt = "", const std::string& TxfOrn = ""); public: std::string TxfXnr; std::string TxfIp; std::string TxfSta; std::string TxfSto; std::string TxfPrt; std::string TxfOrn; public: bool readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false); void writeXML(xmlTextWriter* wr, std::string difftag = "", bool shorttags = true); std::set<Sbecore::uint> comm(const ContIac* comp); std::set<Sbecore::uint> diff(const ContIac* comp); }; /** * ContInf (full: ContInfWzemNdeDetail) */ class ContInf : public Sbecore::Block { public: static const Sbecore::uint TXTPRD = 1; public: ContInf(const std::string& TxtPrd = ""); public: std::string TxtPrd; public: bool readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false); std::set<Sbecore::uint> comm(const ContInf* comp); std::set<Sbecore::uint> diff(const ContInf* comp); }; /** * StatApp (full: StatAppWzemNdeDetail) */ class StatApp : public Sbecore::Block { public: static const Sbecore::uint IXWZEMVEXPSTATE = 1; public: StatApp(const Sbecore::uint ixWzemVExpstate = VecWzemVExpstate::MIND); public: Sbecore::uint ixWzemVExpstate; public: bool readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false); std::set<Sbecore::uint> comm(const StatApp* comp); std::set<Sbecore::uint> diff(const StatApp* comp); }; /** * StatShr (full: StatShrWzemNdeDetail) */ class StatShr : public Sbecore::Block { public: static const Sbecore::uint BUTSAVEAVAIL = 1; static const Sbecore::uint BUTSAVEACTIVE = 2; static const Sbecore::uint TXTPRDACTIVE = 3; static const Sbecore::uint BUTPRDVIEWAVAIL = 4; static const Sbecore::uint BUTPRDVIEWACTIVE = 5; static const Sbecore::uint TXFXNRACTIVE = 6; static const Sbecore::uint TXFIPACTIVE = 7; static const Sbecore::uint TXFSTAACTIVE = 8; static const Sbecore::uint TXFSTOACTIVE = 9; static const Sbecore::uint TXFPRTACTIVE = 10; static const Sbecore::uint TXFORNACTIVE = 11; public: StatShr(const bool ButSaveAvail = true, const bool ButSaveActive = true, const bool TxtPrdActive = true, const bool ButPrdViewAvail = true, const bool ButPrdViewActive = true, const bool TxfXnrActive = true, const bool TxfIpActive = true, const bool TxfStaActive = true, const bool TxfStoActive = true, const bool TxfPrtActive = true, const bool TxfOrnActive = true); public: bool ButSaveAvail; bool ButSaveActive; bool TxtPrdActive; bool ButPrdViewAvail; bool ButPrdViewActive; bool TxfXnrActive; bool TxfIpActive; bool TxfStaActive; bool TxfStoActive; bool TxfPrtActive; bool TxfOrnActive; public: bool readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false); std::set<Sbecore::uint> comm(const StatShr* comp); std::set<Sbecore::uint> diff(const StatShr* comp); }; /** * Tag (full: TagWzemNdeDetail) */ class Tag : public Sbecore::Block { public: static const Sbecore::uint CPT = 1; static const Sbecore::uint CPTPRD = 2; static const Sbecore::uint CPTXNR = 3; static const Sbecore::uint CPTIP = 4; static const Sbecore::uint CPTSTA = 5; static const Sbecore::uint CPTSTO = 6; static const Sbecore::uint CPTPRT = 7; static const Sbecore::uint CPTORN = 8; public: Tag(const std::string& Cpt = "", const std::string& CptPrd = "", const std::string& CptXnr = "", const std::string& CptIp = "", const std::string& CptSta = "", const std::string& CptSto = "", const std::string& CptPrt = "", const std::string& CptOrn = ""); public: std::string Cpt; std::string CptPrd; std::string CptXnr; std::string CptIp; std::string CptSta; std::string CptSto; std::string CptPrt; std::string CptOrn; public: bool readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false); }; /** * DpchAppData (full: DpchAppWzemNdeDetailData) */ class DpchAppData : public DpchAppWzem { public: static const Sbecore::uint SCRJREF = 1; static const Sbecore::uint CONTIAC = 2; static const Sbecore::uint ALL = 3; public: DpchAppData(const std::string& scrJref = "", ContIac* contiac = NULL, const std::set<Sbecore::uint>& mask = {NONE}); public: ContIac contiac; public: std::string getSrefsMask(); void writeXML(xmlTextWriter* wr); }; /** * DpchAppDo (full: DpchAppWzemNdeDetailDo) */ class DpchAppDo : public DpchAppWzem { public: static const Sbecore::uint SCRJREF = 1; static const Sbecore::uint IXVDO = 2; static const Sbecore::uint ALL = 3; public: DpchAppDo(const std::string& scrJref = "", const Sbecore::uint ixVDo = 0, const std::set<Sbecore::uint>& mask = {NONE}); public: Sbecore::uint ixVDo; public: std::string getSrefsMask(); void writeXML(xmlTextWriter* wr); }; /** * DpchEngData (full: DpchEngWzemNdeDetailData) */ class DpchEngData : public DpchEngWzem { public: static const Sbecore::uint SCRJREF = 1; static const Sbecore::uint CONTIAC = 2; static const Sbecore::uint CONTINF = 3; static const Sbecore::uint STATAPP = 4; static const Sbecore::uint STATSHR = 5; static const Sbecore::uint TAG = 6; public: DpchEngData(); public: ContIac contiac; ContInf continf; StatApp statapp; StatShr statshr; Tag tag; public: std::string getSrefsMask(); void readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false); }; }; #endif
27.18251
369
0.710589
1c4cf9cc497b476489bb9ec36e6af1b50d270209
24,649
c
C
src/redland/rasqal-0.9.33/src/rasqal_ntriples.c
aram148/libOmexMeta
331a0a48570a212aaa2b6cb3fe72b9f43ac828af
[ "Apache-2.0" ]
6
2020-07-07T11:23:29.000Z
2021-11-19T09:49:02.000Z
src/redland/rasqal-0.9.33/src/rasqal_ntriples.c
aram148/libOmexMeta
331a0a48570a212aaa2b6cb3fe72b9f43ac828af
[ "Apache-2.0" ]
79
2020-06-23T15:32:44.000Z
2022-02-23T06:46:43.000Z
src/redland/rasqal-0.9.33/src/rasqal_ntriples.c
aram148/libOmexMeta
331a0a48570a212aaa2b6cb3fe72b9f43ac828af
[ "Apache-2.0" ]
5
2020-11-29T04:29:54.000Z
2021-08-17T15:55:41.000Z
/* -*- Mode: c; c-basic-offset: 2 -*- * * rasqal_ntriples.c - Rasqal N-Triples parsing utilities * * Copyright (C) 2013, David Beckett http://www.dajobe.org/ * * This package is Free Software and part of Redland http://librdf.org/ * * It is licensed under the following three licenses as alternatives: * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version * 3. Apache License, V2.0 or any newer version * * You may not use this file except in compliance with at least one of * the above three licenses. * * See LICENSE.html or LICENSE.txt at the top of this package for the * complete terms and further detail along with the license texts for * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. * */ #ifdef HAVE_CONFIG_H #include <rasqal_config.h> #endif #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdarg.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif /* Rasqal includes */ #include "rasqal.h" #include "rasqal_internal.h" /* from raptor_uri.c */ #if RAPTOR_VERSION >= 20011 #else static int rasqal_uri_uri_string_is_absolute(const unsigned char* uri_string) { const unsigned char* s = uri_string; /* * scheme = alpha *( alpha | digit | "+" | "-" | "." ) * RFC 2396 section 3.1 Scheme Component */ if(*s && isalpha((int)*s)) { s++; while(*s && (isalnum((int)*s) || (*s == '+') || (*s == '-') || (*s == '.'))) s++; if(*s == ':') return 1; } return 0; } #define raptor_uri_uri_string_is_absolute rasqal_uri_uri_string_is_absolute #endif #if RAPTOR_VERSION >= 20012 #else /**********************************************************************/ /** Internals imported from raptor */ /* turtle_common.c */ static int rasqal_turtle_check_uri_string(unsigned char *string) { unsigned char c; if(!string) return 0; while((c = *string++)) { if(((c <= 0x20) || c == '<' || c == '>' || c == '"' || c == '{' || c == '}' || c == '|' || c == '^' || c == '`' || c == '\\')) return 0; } return 1; } /* raptor_general.c */ static int rasqal_check_ordinal(const unsigned char *name) { int ordinal= -1; unsigned char c; while((c=*name++)) { if(c < '0' || c > '9') return -1; if(ordinal <0) ordinal = 0; ordinal *= 10; ordinal += (c - '0'); } return ordinal; } /**********************************************************************/ /* raptor_ntriples.c converted to use above */ /* These are for 7-bit ASCII and not locale-specific */ #define IS_ASCII_ALPHA(c) (((c) > 0x40 && (c) < 0x5B) || ((c) > 0x60 && (c) < 0x7B)) #define IS_ASCII_UPPER(c) ((c) > 0x40 && (c) < 0x5B) #define IS_ASCII_DIGIT(c) ((c) > 0x2F && (c) < 0x3A) #define IS_ASCII_PRINT(c) ((c) > 0x1F && (c) < 0x7F) #define TO_ASCII_LOWER(c) ((c)+0x20) typedef enum { RASQAL_TERM_CLASS_URI, /* ends on > */ RASQAL_TERM_CLASS_BNODEID, /* ends on first non [A-Za-z][A-Za-z0-9]* */ RASQAL_TERM_CLASS_STRING, /* ends on non-escaped " */ RASQAL_TERM_CLASS_LANGUAGE /* ends on first non [a-z0-9]+ ('-' [a-z0-9]+ )? */ } rasqal_ntriples_term_class; static int rasqal_ntriples_term_valid(unsigned char c, int position, rasqal_ntriples_term_class term_class) { int result = 0; switch(term_class) { case RASQAL_TERM_CLASS_URI: /* ends on > */ result = (c != '>'); break; case RASQAL_TERM_CLASS_BNODEID: /* ends on first non [A-Za-z0-9_:][-.A-Za-z0-9]* */ result = IS_ASCII_ALPHA(c) || IS_ASCII_DIGIT(c) || c == '_' || c == ':'; if(position) /* FIXME * This isn't correct; '.' is allowed in positions 1..N-1 but * this calling convention of character-by-character cannot * check this. */ result = (result || c == '-' || c == '.'); break; case RASQAL_TERM_CLASS_STRING: /* ends on " */ result = (c != '"'); break; case RASQAL_TERM_CLASS_LANGUAGE: /* ends on first non [a-zA-Z]+ ('-' [a-zA-Z0-9]+ )? */ result = IS_ASCII_ALPHA(c); if(position) result = (result || IS_ASCII_DIGIT(c) || c == '-'); break; default: RASQAL_DEBUG2("Unknown N-Triples term class %d", term_class); } return result; } /* * rasqal_ntriples_parse_term_internal: * @world: rasqal world * @locator: locator object (in/out) (or NULL) * @start: pointer to starting character of string (in) * @dest: destination of string (in) * @lenp: pointer to length of string (in/out) * @dest_lenp: pointer to length of destination string (out) * @end_char: string ending character * @class: string class * * INTERNAL - Parse an N-Triples term with escapes. * * Relies that @dest is long enough; it need only be as large as the * input string @start since when UTF-8 encoding, the escapes are * removed and the result is always less than or equal to length of * input. * * N-Triples strings / URIs are written in ASCII at present; * characters outside the printable ASCII range are discarded with a * warning. See the grammar for full details of the allowed ranges. * * UTF-8 and the \u and \U esapes are both allowed. * * Return value: Non 0 on failure **/ static int rasqal_ntriples_parse_term_internal(rasqal_world* world, raptor_locator* locator, const unsigned char **start, unsigned char *dest, size_t *lenp, size_t *dest_lenp, char end_char, rasqal_ntriples_term_class term_class) { const unsigned char *p = *start; unsigned char c = '\0'; size_t ulen = 0; unsigned long unichar = 0; unsigned int position = 0; int end_char_seen = 0; /* find end of string, fixing backslashed characters on the way */ while(*lenp > 0) { int unichar_width; c = *p; p++; (*lenp)--; if(locator) { locator->column++; locator->byte++; } if(c > 0x7f) { /* just copy the UTF-8 bytes through */ int unichar_len; unichar_len = raptor_unicode_utf8_string_get_char(p - 1, 1 + *lenp, NULL); if(unichar_len < 0 || RASQAL_GOOD_CAST(size_t, unichar_len) > *lenp) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "UTF-8 encoding error at character %d (0x%02X) found.", c, c); /* UTF-8 encoding had an error or ended in the middle of a string */ return 1; } memmove(dest, p-1, unichar_len); dest += unichar_len; unichar_len--; /* p, *lenp were moved on by 1 earlier */ p += unichar_len; (*lenp) -= unichar_len; if(locator) { locator->column += unichar_len; locator->byte += unichar_len; } continue; } if(c != '\\') { /* finish at non-backslashed end_char */ if(end_char && c == end_char) { end_char_seen = 1; break; } if(!rasqal_ntriples_term_valid(c, position, term_class)) { if(end_char) { /* end char was expected, so finding an invalid thing is an error */ rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing terminating '%c' (found '%c')", end_char, c); return 0; } else { /* it's the end - so rewind 1 to save next char */ p--; (*lenp)++; if(locator) { locator->column--; locator->byte--; } if(term_class == RASQAL_TERM_CLASS_BNODEID && dest[-1] == '.') { /* If bnode id ended on '.' move back one */ dest--; p--; (*lenp)++; if(locator) { locator->column--; locator->byte--; } } break; } } /* otherwise store and move on */ *dest++ = c; position++; continue; } if(!*lenp) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "\\ at end of input."); return 0; } c = *p; p++; (*lenp)--; if(locator) { locator->column++; locator->byte++; } switch(c) { case '"': case '\\': *dest++ = c; break; case 'b': *dest++ = '\b'; break; case 'f': *dest++ = '\f'; break; case 'n': *dest++ = '\n'; break; case 'r': *dest++ = '\r'; break; case 't': *dest++ = '\t'; break; case '<': case '>': case '{': case '}': case '|': case '^': case '`': /* Turtle 2013 allows these in URIs (as well as \" and \\) */ *dest++ = c; break; case 'u': case 'U': ulen = (c == 'u') ? 4 : 8; if(*lenp < ulen) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "%c over end of input.", c); return 0; } if(1) { unsigned int ii; int n = 0; for(ii = 0; ii < ulen; ii++) { char cc = p[ii]; if(!isxdigit(RASQAL_GOOD_CAST(char, cc))) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "N-Triples string error - illegal hex digit %c in Unicode escape '%c%s...'", cc, c, p); n = 1; break; } } if(n) break; n = sscanf((const char*)p, ((ulen == 4) ? "%04lx" : "%08lx"), &unichar); if(n != 1) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal Uncode escape '%c%s...'", c, p); break; } } p += ulen; (*lenp) -= ulen; if(locator) { locator->column += RASQAL_GOOD_CAST(int, ulen); locator->byte += RASQAL_GOOD_CAST(int, ulen); } if(unichar > rasqal_unicode_max_codepoint) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal Unicode character with code point #x%lX (max #x%lX).", unichar, rasqal_unicode_max_codepoint); break; } unichar_width = raptor_unicode_utf8_string_put_char(unichar, dest, 4); if(unichar_width < 0) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal Unicode character with code point #x%lX.", unichar); break; } /* The destination length is set here to 4 since we know that in * all cases, the UTF-8 encoded output sequence is always shorter * than the input sequence, and the buffer is edited in place. * \uXXXX: 6 bytes input - UTF-8 max 3 bytes output * \uXXXXXXXX: 10 bytes input - UTF-8 max 4 bytes output */ dest += (int)unichar_width; break; default: rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal string escape \\%c in \"%s\"", c, (char*)start); return 0; } position++; } /* end while */ if(end_char && !end_char_seen) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing terminating '%c' before end of input.", end_char); return 1; } /* terminate dest, can be shorter than source */ *dest = '\0'; if(dest_lenp) *dest_lenp = p - *start; *start = p; return 0; } static int rasqal_parse_turtle_term_internal(rasqal_world* world, raptor_locator* locator, const unsigned char **start, unsigned char *dest, size_t *len_p, size_t *dest_lenp, raptor_uri** datatype_uri_p) { const unsigned char *p = *start; unsigned int position = 0; /* 0 = xsd:integer; 1= xsd:decimal; 2= xsd:double */ short dtype = 0; int after_e = 0; while(*len_p > 0) { unsigned char c = *p; if(after_e) { if(!((c >= '0' && c <'9') || c == '+' || c == '-')) break; after_e = 0; } else if((position > 0 && (c == '+' || c == '-')) || !((c >= '0' && c <'9') || c == '.' || c == 'e' || c == 'E')) break; if(c == '.') dtype = 1; else if(c == 'e' || c == 'E') { dtype = 2; after_e = 1; } p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } *dest++ = c; position++; } *dest = '\0'; if(dest_lenp) *dest_lenp = p - *start; *start = p; if(dtype == 0) *datatype_uri_p = raptor_uri_copy(rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_INTEGER)); else if (dtype == 1) *datatype_uri_p = raptor_uri_copy(rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_DECIMAL)); else *datatype_uri_p = raptor_uri_copy(rasqal_xsd_datatype_type_to_uri(world, RASQAL_LITERAL_DOUBLE)); return 0; } /* * rasqal_ntriples_parse_term: * @world: rasqal world * @locator: rasqal locator (in/out) (or NULL) * @string: string input (in) * @len_p: pointer to length of @string (in/out) * @term_p: pointer to store term (out) * @allow_turtle: non-0 to allow Turtle forms such as integers, boolean * * INTERNAL - Parse an N-Triples string into a #raptor_term * * The @len_p destination and @locator fields are modified as parsing * proceeds to be used in error messages. The final value is written * into the #raptor_term pointed at by @term_p * * Return value: number of bytes processed or 0 on failure */ static size_t rasqal_ntriples_parse_term(rasqal_world* world, raptor_locator* locator, unsigned char *string, size_t *len_p, raptor_term** term_p, int allow_turtle) { unsigned char *p = string; unsigned char *dest; size_t term_length = 0; switch(*p) { case '<': dest = p; p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, '>', RASQAL_TERM_CLASS_URI)) { goto fail; } if(!rasqal_turtle_check_uri_string(dest)) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "URI '%s' contains bad character(s)", dest); goto fail; } if(1) { raptor_uri *uri; /* Check for bad ordinal predicate */ if(!strncmp((const char*)dest, "http://www.w3.org/1999/02/22-rdf-syntax-ns#_", 44)) { int ordinal = rasqal_check_ordinal(dest + 44); if(ordinal <= 0) rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal ordinal value %d in property '%s'.", ordinal, dest); } if(raptor_uri_uri_string_is_absolute(dest) <= 0) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "URI '%s' is not absolute.", dest); goto fail; } uri = raptor_new_uri(world->raptor_world_ptr, dest); if(!uri) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Could not create URI for '%s'", (const char *)dest); goto fail; } *term_p = raptor_new_term_from_uri(world->raptor_world_ptr, uri); raptor_free_uri(uri); } break; case '-': case '+': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if(allow_turtle) { raptor_uri* datatype_uri = NULL; dest = p; if(rasqal_parse_turtle_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, &datatype_uri)) { goto fail; } *term_p = raptor_new_term_from_literal(world->raptor_world_ptr, dest, datatype_uri, NULL /* language */); } else goto fail; break; case '"': dest = p; p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, '"', RASQAL_TERM_CLASS_STRING)) { goto fail; } if(1) { unsigned char *object_literal_language = NULL; unsigned char *object_literal_datatype = NULL; raptor_uri* datatype_uri = NULL; if(*len_p && *p == '@') { unsigned char *q; size_t lang_len; object_literal_language = p; /* Skip - */ p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(!*len_p) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing language after \"string\"-"); goto fail; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, object_literal_language, len_p, &lang_len, '\0', RASQAL_TERM_CLASS_LANGUAGE)) { goto fail; } if(!lang_len) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Invalid language tag at @%s", p); goto fail; } /* Normalize language to lowercase * http://www.w3.org/TR/rdf-concepts/#dfn-language-identifier */ for(q = object_literal_language; *q; q++) { if(IS_ASCII_UPPER(*q)) *q = TO_ASCII_LOWER(*q); } } if(*len_p > 1 && *p == '^' && p[1] == '^') { object_literal_datatype = p; /* Skip ^^ */ p += 2; *len_p -= 2; if(locator) { locator->column += 2; locator->byte += 2; } if(!*len_p || (*len_p && *p != '<')) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Missing datatype URI-ref in\"string\"^^<URI-ref> after ^^"); goto fail; } p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, object_literal_datatype, len_p, NULL, '>', RASQAL_TERM_CLASS_URI)) { goto fail; } if(raptor_uri_uri_string_is_absolute(object_literal_datatype) <= 0) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Datatype URI '%s' is not absolute.", object_literal_datatype); goto fail; } } if(object_literal_datatype && object_literal_language) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Typed literal used with a language - ignoring the language"); object_literal_language = NULL; } if(object_literal_datatype) { datatype_uri = raptor_new_uri(world->raptor_world_ptr, object_literal_datatype); if(!datatype_uri) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Could not create literal datatype uri '%s'", object_literal_datatype); goto fail; } object_literal_language = NULL; } *term_p = raptor_new_term_from_literal(world->raptor_world_ptr, dest, datatype_uri, object_literal_language); } break; case '_': /* store where _ was */ dest = p; p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(!*len_p || (*len_p > 0 && *p != ':')) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Illegal bNodeID - _ not followed by :"); goto fail; } /* Found ':' - move on */ p++; (*len_p)--; if(locator) { locator->column++; locator->byte++; } if(rasqal_ntriples_parse_term_internal(world, locator, (const unsigned char**)&p, dest, len_p, &term_length, '\0', RASQAL_TERM_CLASS_BNODEID)) { goto fail; } if(!term_length) { rasqal_log_error_simple(world, RAPTOR_LOG_LEVEL_ERROR, locator, "Bad or missing bNodeID after _:"); goto fail; } *term_p = raptor_new_term_from_blank(world->raptor_world_ptr, dest); break; default: RASQAL_DEBUG2("Unknown term type '%c'", *p); goto fail; } fail: return p - string; } /* * rasqal_new_term_from_counted_string: * @world: rasqal world * @string: N-Triples format string (UTF-8) * @length: length of @string (or 0) * * INTERNAL - create a new term from an N-Triples format string in UTF-8 * * Return value: new term or NULL on failure */ static raptor_term* rasqal_new_term_from_counted_string(rasqal_world* world, unsigned char* string, size_t length) { raptor_term* term = NULL; size_t bytes_read; raptor_locator locator; if(!string) return NULL; if(!length) length = strlen(RASQAL_GOOD_CAST(const char*, string)); memset(&locator, sizeof(locator), '\0'); locator.line = -1; bytes_read = rasqal_ntriples_parse_term(world, &locator, string, &length, &term, 1); if(!bytes_read || length != 0) { if(term) raptor_free_term(term); term = NULL; } return term; } #endif /* * rasqal_new_literal_from_ntriples_counted_string: * @world: rasqal world * @string: N-Triples format string (UTF-8) * @length: length of @string (or 0) * * INTERNAL - create a new literal from an N-Triples format string in UTF-8 * * Return value: new literal or NULL on failure */ rasqal_literal * rasqal_new_literal_from_ntriples_counted_string(rasqal_world *world, unsigned char *string, size_t length) { raptor_term *term; rasqal_literal *l; #if RAPTOR_VERSION >= 20012 term = raptor_new_term_from_counted_string(world->raptor_world_ptr, string, length); #else term = rasqal_new_term_from_counted_string(world, string, length); #endif if (!term) return NULL; l = rasqal_new_literal_from_term(world, term); raptor_free_term(term); return l; }
28.528935
178
0.513043
941d3701584bae242943484f7d7ec92a7298c6dc
252
h
C
Citron/Citron/Adapters/CTStarExpertsCellAdapter.h
lingguang1997/Citrons
630b3d57e0ef1ac988b28d953f4ff84729760a79
[ "Apache-2.0" ]
1
2016-01-27T02:12:28.000Z
2016-01-27T02:12:28.000Z
Citron/Citron/Adapters/CTStarExpertsCellAdapter.h
lingguang1997/Citrons
630b3d57e0ef1ac988b28d953f4ff84729760a79
[ "Apache-2.0" ]
null
null
null
Citron/Citron/Adapters/CTStarExpertsCellAdapter.h
lingguang1997/Citrons
630b3d57e0ef1ac988b28d953f4ff84729760a79
[ "Apache-2.0" ]
1
2016-03-07T14:50:16.000Z
2016-03-07T14:50:16.000Z
// // CTStarExpertsCellAdapter.h // Citron // // Created by Zijiao Liu on 1/11/16. // Copyright © 2016 iAskData. All rights reserved. // #import <AppKit/AKTableViewCellAdapter.h> @interface CTStarExpertsCellAdapter : AKTableViewCellAdapter @end
18
60
0.742063
20a335903da449658f4dda322a39388443353bdf
1,669
h
C
include/c-game/ctools.h
hlibc/cubescript
81e274043444c1d1573f49cb2290c8a0637c28a3
[ "Cube" ]
1
2019-05-25T08:16:55.000Z
2019-05-25T08:16:55.000Z
include/c-game/ctools.h
hlibc/cube-zero
942523b97378829600667cc697598532665a29ba
[ "Cube" ]
null
null
null
include/c-game/ctools.h
hlibc/cube-zero
942523b97378829600667cc697598532665a29ba
[ "Cube" ]
null
null
null
/* things that will sort of work with C .. */ #define true 1 #define false 0 #ifndef _CTOOLS_H #define _CTOOLS_H #ifdef __GNUC__ #define gamma __gamma #endif #include <math.h> #ifdef __GNUC__ #undef gamma #endif /* c headers */ #include <string.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <limits.h> #include <assert.h> /* get rid of these data type */ typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; /* macros */ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #define rnd(max) (rand()%(max)) #define rndreset() (srand(1)) #define rndtime() { loopi(lastmillis&0xF) rnd(i+1); } #define loop(v,m) for(int v = 0; v<(m); v++) #define loopi(m) loop(i,m) #define loopj(m) loop(j,m) #define loopk(m) loop(k,m) #define loopl(m) loop(l,m) #define __cdecl #define _vsnprintf vsnprintf #define loopv(v) for(int i = 0; i<(v).length(); i++) #define loopvrev(v) for(int i = (v).length()-1; i>=0; i--) #define enumerate(ht,t,e,b) loopi(ht->size) for(ht->enumc = ht->table[i]; ht->enumc; ht->enumc = ht->enumc->next) { t e = &ht->enumc->data; b; } // easy safe strings #define _MAXDEFSTR 260 typedef char string[_MAXDEFSTR]; inline void strn0cpy(char *d, const char *s, size_t m) { strncpy(d,s,m); d[(m)-1] = 0; }; inline void strcpy_s(char *d, const char *s) { strn0cpy(d,s,_MAXDEFSTR); }; inline void strcat_s(char *d, const char *s) { size_t n = strlen(d); strn0cpy(d+n,s,_MAXDEFSTR-n); }; inline void formatstring(char *d, const char *fmt, va_list v) { _vsnprintf(d, _MAXDEFSTR, fmt, v); d[_MAXDEFSTR-1] = 0; }; #define fast_f2nat(val) ((int)(val)) #endif
25.676923
144
0.651887
2d96c578e2a5ef61c1b11776dc6aa583329c994a
845
h
C
chrome/browser/error_reporting/constants.h
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
chrome/browser/error_reporting/constants.h
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
113
2015-05-04T09:58:14.000Z
2022-01-31T19:35:03.000Z
chrome/browser/error_reporting/constants.h
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// Copyright 2021 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_ERROR_REPORTING_CONSTANTS_H_ #define CHROME_BROWSER_ERROR_REPORTING_CONSTANTS_H_ #include "build/chromeos_buildflags.h" #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) // The key we pass to crash_reporter to indicate this key/value pair is the // JavaScript stack payload. // The format of the key needs to match Chrome OS's // ChromeCollector::ParseCrashLog and kDefaultJavaScriptStackName. The // 'filename' within the key doesn't actually matter but must be present. extern const char kJavaScriptStackKey[]; #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) #endif // CHROME_BROWSER_ERROR_REPORTING_CONSTANTS_H_
42.25
75
0.807101
31e8056bd280e8a4572de9ba640108d4dd4db287
14,763
c
C
AzureMXChip/MXCHIPAZ3166/core/lib/threadx/ports/c667x/ccs/example_build/sample_threadx_c6678evm/board_setup.c
Logicalis/eugenio-devices
5bba26f1dcfbd84a1e1b38ab5801db8cca87e1d5
[ "MIT" ]
null
null
null
AzureMXChip/MXCHIPAZ3166/core/lib/threadx/ports/c667x/ccs/example_build/sample_threadx_c6678evm/board_setup.c
Logicalis/eugenio-devices
5bba26f1dcfbd84a1e1b38ab5801db8cca87e1d5
[ "MIT" ]
null
null
null
AzureMXChip/MXCHIPAZ3166/core/lib/threadx/ports/c667x/ccs/example_build/sample_threadx_c6678evm/board_setup.c
Logicalis/eugenio-devices
5bba26f1dcfbd84a1e1b38ab5801db8cca87e1d5
[ "MIT" ]
null
null
null
/* * board_setup.c * */ #include "board_setup.h" #include "C66XX.h" #include <string.h> //============================================================================= //============ General definitions ============================================ //============================================================================= // DSP Timer-8 definition #define C66XX_DSP_TIMER C66XX_TIMER_8 // DSP Timer-8 output frequency in Hz #define C66XX_DSP_TIMER_FREQ 100 /* DSP Timer-8 interrupt event ID */ #define C66XX_DSP_TIMER_EVENT_ID 67 //============================================================================= //============================================================================= //============ Global functions =============================================== //============================================================================= void _tx_nmi_vector(void); void _tx_int4_vector(void); void _tx_int5_vector(void); void _tx_int6_vector(void); void _tx_int7_vector(void); void _tx_int8_vector(void); void _tx_int9_vector(void); void _tx_int10_vector(void); void _tx_int11_vector(void); void _tx_int12_vector(void); void _tx_int13_vector(void); void _tx_int14_vector(void); void _tx_int15_vector(void); //============================================================================= //============================================================================= //============ Static functions =============================================== //============================================================================= static int32_t tx_timer_init(C66XX_TIMER timer, uint32_t frequency); static int32_t tx_interrupt_init(void); //============================================================================= /*------------ init_output_timer() function ----------------------------------- * DESCRIPTION: Function initializes Timer64 module * ARGUMENTS: * None * RETURNED VALUE: Error code -----------------------------------------------------------------------------*/ static int32_t tx_timer_init(C66XX_TIMER timer, uint32_t frequency) { int32_t r; C66XX_TIMER_CFG_DD cfg_dd; // Reset 64-bit timer if ((r = C66XX_TIMER_reset(timer, C66XX_TIMER_HW_CFG_64BIT)) != C66XX_OK) goto exit; // Fill configuration data descriptor memset(&cfg_dd, 0, C66XX_TIMER_CFG_DD_LEN); cfg_dd.timer_mode = C66XX_TIMER_MODE_32BIT_UNCHAINED; cfg_dd.timer_high.clk_src_output_mode = C66XX_TIMER_CLK_OUTPUT_MODE_CLK; // Init DSP Timer64 module if ((r = C66XX_TIMER_init(timer, frequency, &cfg_dd)) != C66XX_OK) goto exit; // Enable timer interrupt if ((r = C66XX_TIMER_enable_interrupts(timer, C66XX_TIMER_HW_CFG_32BIT_HIGH)) != C66XX_OK) goto exit; // Start 32-bit timer high to enable continuously if ((r = C66XX_TIMER_start(timer, C66XX_TIMER_HW_CFG_32BIT_HIGH, C66XX_TIMER_COUNT_MODE_CONTINUOUSLY)) != C66XX_OK) goto exit; // TIMER module configuration is completed printf("Timer #%u configuration is completed\n", timer); exit: return (r); } //----------------------------------------------------------------------------- /*------------ tx_interrupt_init() function ----------------------------------- * DESCRIPTION: Function initializes CorePack interrupt module * ARGUMENTS: * None * RETURNED VALUE: Error code -----------------------------------------------------------------------------*/ static int32_t tx_interrupt_init(void) { int32_t r; // Set DSP interrupt handlers to the ones defined in tx_initialize_low_level.asm if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_NMI, _tx_nmi_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_4, _tx_int4_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_5, _tx_int5_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_6, _tx_int6_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_7, _tx_int7_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_8, _tx_int8_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_9, _tx_int9_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_10, _tx_int10_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_11, _tx_int11_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_12, _tx_int12_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_13, _tx_int13_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_14, _tx_int14_vector)) != C66XX_OK) goto exit; if ((r = C66XX_INT_set_core_dsp_interrupt_handler(C66XX_DSP_VECTID_15, _tx_int15_vector)) != C66XX_OK) goto exit; /* CorePack interrupt module configuration is completed */ printf("INTC configuration is completed\n"); // Exit without errors r = C66XX_OK; exit: return (r); } //----------------------------------------------------------------------------- /*------------ hardware_setup() function -------------------------------------- * DESCRIPTION: Function intializes board hardware * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ int hardware_setup() { platform_init_flags init_flags; platform_init_config init_config; platform_info p_info; int32_t r; /* * Initialize all platform peripherals with default values: * PLL, DDR, TCSL, PHY, ECC */ init_flags.pll = 1; init_flags.ddr = 1; init_flags.tcsl = 1; init_flags.phy = 1; init_flags.ecc = 0; memset(&init_config, 0, sizeof(platform_init_config)); if ((r = platform_init(&init_flags, &init_config)) != Platform_EOK) goto exit; /* Initialize platform UART */ if ((r = platform_uart_init()) != Platform_EOK) goto exit; if ((r = platform_uart_set_baudrate(115200)) != Platform_EOK) goto exit; /* Get platform info */ platform_get_info(&p_info); /* Write data to the UART */ platform_write("Platform library version is %s\n", p_info.version); platform_write("Board name is %s\n", p_info.board_name); platform_write("Board serial number is %s\n", p_info.serial_nbr); platform_write("Board revision ID is %u\n", p_info.board_rev); platform_write("CPU name is %s\n", p_info.cpu.name); platform_write("CPU revision ID is %u\n", p_info.cpu.revision_id); platform_write("Number of CPU cores is %u\n", p_info.cpu.core_count); platform_write("CPU frequency is %u MHz\n", p_info.frequency); // Init CorePac INTC if ((r = C66XX_INT_init_core()) != C66XX_OK) goto exit; // Init DSP Timer if ((r = tx_timer_init(C66XX_DSP_TIMER, C66XX_DSP_TIMER_FREQ)) != C66XX_OK) goto exit; // Init DSP interrupt controller if ((r = tx_interrupt_init()) != C66XX_OK) goto exit; printf("Board is initialized\n"); /* Exit with no errors */ exit: return (r); } //----------------------------------------------------------------------------- /*------------ tx_nmi_handler() function -------------------------------------- * DESCRIPTION: Function handles NMI interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_nmi_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int4_handler() function ------------------------------------- * DESCRIPTION: Function handles INT4 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int4_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int5_handler() function ------------------------------------- * DESCRIPTION: Function handles INT5 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int5_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int6_handler() function ------------------------------------- * DESCRIPTION: Function handles INT6 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int6_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int7_handler() function ------------------------------------- * DESCRIPTION: Function handles INT7 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int7_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int8_handler() function ------------------------------------- * DESCRIPTION: Function handles INT8 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int8_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int9_handler() function ------------------------------------- * DESCRIPTION: Function handles INT9 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int9_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int10_handler() function ------------------------------------ * DESCRIPTION: Function handles INT10 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int10_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int11_handler() function ------------------------------------ * DESCRIPTION: Function handles INT11 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int11_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int12_handler() function ------------------------------------ * DESCRIPTION: Function handles INT12 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int12_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int13_handler() function ------------------------------------ * DESCRIPTION: Function handles INT13 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int13_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int14_handler() function ------------------------------------ * DESCRIPTION: Function handles INT14 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int14_handler(void) { } //----------------------------------------------------------------------------- /*------------ tx_int15_handler() function ------------------------------------ * DESCRIPTION: Function handles INT15 interrupt * ARGUMENTS: * None * RETURNED VALUE: None -----------------------------------------------------------------------------*/ void tx_int15_handler(void) { } //----------------------------------------------------------------------------- //============================================================================= //============ Platform OSAL functions ======================================== //============================================================================= /*------------ Osal_platformMalloc() function ----------------------------*//** * @brief Function implements the memory allocate function for the platform * library. * * This function allocates a memory block of a given size specified by input * parameter 'num_bytes'. * * @param[in] num_bytes - number of bytes to be allocated * @param[in] alignment - alignment of allocated memory block in bytes * * @return Allocated block address * -----------------------------------------------------------------------------*/ uint8_t *Osal_platformMalloc(uint32_t num_bytes, uint32_t alignment) { // Allocate memory from default system heap return (NULL); } //----------------------------------------------------------------------------- /*------------ Osal_platformFree() function ------------------------------*//** * @brief Function implements the memory free function for the platform * library. * * This function frees up memory allocated using Osal_platformMalloc() * function call. * * @param[in] mem_ptr - pointer to the memory block to be cleaned up * @param[in] num_bytes - size of the memory block to be cleaned up in bytes * * @return None * -----------------------------------------------------------------------------*/ void Osal_platformFree(uint8_t *mem_ptr, uint32_t num_bytes) { } //----------------------------------------------------------------------------- /*------------ Osal_platformSpiCsEnter() function ------------------------*//** * @brief Function is used to enter a critical section * * Function protects against access from multiple cores and access from * multiple threads on single core * * @param[out] key - pointer to a variable to receive a handle for unlocking * critical section * @return None * -----------------------------------------------------------------------------*/ void Osal_platformSpiCsEnter(void) { } //----------------------------------------------------------------------------- /*------------ Osal_platformSpiCsExit() function -------------------------*//** * @brief Function is used to exit a critical section protected using * Osal_paMtCsEnter() API. * * @param[in] key - handle for unlocking critical section * * @return None * -----------------------------------------------------------------------------*/ void Osal_platformSpiCsExit(void) { } //----------------------------------------------------------------------------- //=============================================================================
33.400452
116
0.477139
f5d44273f83942dc0f856dffdaac476a647f367e
2,157
c
C
Exercise/64/5/ssh_cl.c
sunhuiquan/tlpi-learn
a4674ce2fd21f29f09e6471b12070cdc5eec2f91
[ "MIT" ]
49
2021-07-29T14:26:51.000Z
2022-03-27T10:08:06.000Z
Exercise/64/5/ssh_cl.c
sunhuiquan/TLPI_learn_note
a4674ce2fd21f29f09e6471b12070cdc5eec2f91
[ "MIT" ]
1
2021-09-02T07:56:43.000Z
2021-09-04T09:45:05.000Z
Exercise/64/5/ssh_cl.c
sunhuiquan/TLPI_learn_note
a4674ce2fd21f29f09e6471b12070cdc5eec2f91
[ "MIT" ]
4
2021-10-03T18:08:48.000Z
2022-03-22T14:58:38.000Z
#include <arpa/inet.h> #include <sys/socket.h> #include <sys/select.h> #include <tlpi_hdr.h> #define SSH_SERVICE 22 #define MAXLINE 1024 int main(int argc, char *argv[]) { int cfd; struct sockaddr_in addr; int readn, closed; char buf[MAXLINE]; fd_set rfdset; char user[MAXLINE], host[MAXLINE]; char *pc; if (argc != 2 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) { printf("%s usage: <user@host>\n", argv[0]); exit(EXIT_FAILURE); } if ((pc = strchr(argv[1], '@')) == NULL) { printf("%s usage: <user@host>\n", argv[0]); exit(EXIT_FAILURE); } *pc = '\0'; strncpy(user, argv[1], MAXLINE); strncpy(host, pc + 1, MAXLINE); // for testing // printf("user: %s; host: %s\n", user, host); if ((cfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) errExit("socket"); bzero(&addr, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(SSH_SERVICE); if (inet_pton(AF_INET, host, &addr.sin_addr) == -1) errExit("inet_pton"); if (connect(cfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) errExit("connect"); FD_ZERO(&rfdset); // login的用户 int index = strlen(user); user[index] = '\n'; // 下一行不能用strlen(),因为这一步会删掉\0导致错误 user[index + 1] = '\0'; // \n作为分隔字节流用 if (write(cfd, user, strlen(user)) != strlen(user)) errExit("write"); closed = 0; for (;;) { if (!closed) FD_SET(STDIN_FILENO, &rfdset); FD_SET(cfd, &rfdset); if (select(cfd + 1, &rfdset, NULL, NULL, NULL) == -1) errExit("select"); if (FD_ISSET(STDIN_FILENO, &rfdset)) { readn = read(STDIN_FILENO, buf, MAXLINE); if (readn < 0) errExit("read"); else if (readn == 0) { closed = 1; FD_CLR(STDIN_FILENO, &rfdset); if (shutdown(cfd, SHUT_WR) == -1) // 对端收到FIN,且读connfd会得到EOF errExit("shutdown"); } if (write(cfd, buf, readn) != readn) errExit("write"); } if (FD_ISSET(cfd, &rfdset)) { readn = read(cfd, buf, MAXLINE); if (readn < 0) errExit("read"); else if (readn == 0) // 对端关闭(由于之前shutdown并把剩余数据读完得到EOF,导致的关闭) { printf("lagout\n"); break; // 正常结束客户端 } if (write(STDOUT_FILENO, buf, readn) != readn) errExit("write"); } } return 0; }
21.147059
71
0.601298
8cb3953e8db0afb6013833bf114ba60bbf38011a
431
h
C
my_softphone/subscribe.h
sashkaseltsov1/reposCpp
3ff5ce2a14a368a36b1758099ce4f3e8c4cdf11d
[ "Unlicense" ]
1
2021-01-29T09:49:36.000Z
2021-01-29T09:49:36.000Z
my_softphone/subscribe.h
sashkaseltsov1/MySoftphoneApp
3ff5ce2a14a368a36b1758099ce4f3e8c4cdf11d
[ "Unlicense" ]
1
2020-02-20T06:58:16.000Z
2020-02-20T07:08:07.000Z
my_softphone/subscribe.h
sashkaseltsov1/reposCpp
3ff5ce2a14a368a36b1758099ce4f3e8c4cdf11d
[ "Unlicense" ]
null
null
null
#ifndef SUBSCRIBE_H #define SUBSCRIBE_H #include <QString> #include <mybuddy.h> #include <myaccount.h> #include <config.h> class MyAccount; class Subscribe { public: Subscribe(MyAccount &acc, QString login, Config &settings); ~Subscribe(){delete buddy;} QString getLogin(){return login;} void notifyAboutSubscribe(); private: QString login; MyBuddy *buddy; Config *settings; }; #endif // SUBSCRIBE_H
17.958333
63
0.709977
5d2229ee566e5a2de77e3506c82b76f214cd764f
3,268
c
C
src/path.c
cglindkamp/dfm
2eff482f57858937aaae99423675ab86c46f449e
[ "0BSD" ]
11
2018-01-17T22:13:06.000Z
2022-03-10T08:21:08.000Z
src/path.c
cglindkamp/dfm
2eff482f57858937aaae99423675ab86c46f449e
[ "0BSD" ]
2
2017-08-27T00:25:13.000Z
2020-11-02T06:00:46.000Z
src/path.c
cglindkamp/dfm
2eff482f57858937aaae99423675ab86c46f449e
[ "0BSD" ]
null
null
null
/* See LICENSE file for copyright and license details. */ #include "path.h" #include <errno.h> #include <stdlib.h> #include <string.h> #include <unistd.h> static bool path_make_room(struct path *path, size_t size) { size_t target_size = size ? size : path->allocated_size * 2; if(target_size > path->allocated_size) { char *newpath = realloc(path->path, target_size); if(newpath == NULL) return false; path->allocated_size = target_size; path->path = newpath; } return true; } const char *path_tocstr(struct path *path) { if(path->path[0] == '\0') return "/"; return path->path; } bool path_add_component(struct path *path, const char *component) { while(strlen(path->path) + strlen(component) + 2 > path->allocated_size) if(!path_make_room(path, 0)) return false; strcat(path->path, "/"); strcat(path->path, component); return true; } bool path_remove_component(struct path *path, const char **component) { if(path->path[0] == '\0') return false; char *slash = strrchr(path->path, '/'); *slash = '\0'; if(component) *component = slash + 1; return true; } bool path_set_to_current_working_directory(struct path *path) { while(getcwd(path->path, path->allocated_size) == NULL) { if(errno == ERANGE) { if(!path_make_room(path, 0)) return false; } else return false; } return true; } static bool path_cstr_is_valid(const char *cstr) { if(cstr[0] != '/') return false; return true; } int path_set_from_string(struct path *path, const char *cstr) { if(strcmp(cstr, "~") == 0) { const char *home = getenv("HOME"); if(home == NULL || strcmp(home, "~") == 0) return EINVAL; return path_set_from_string(path, home); } if(!(path_cstr_is_valid(cstr))) return EINVAL; if(!path_make_room(path, strlen(cstr) + 1)) return ENOMEM; strcpy(path->path, cstr); /* reduce multiple consecutive slashes to a single one */ size_t s = 0, d = 0; do { s++; if(path->path[s] == '/' && path->path[d] == '/') continue; d++; path->path[d] = path->path[s]; } while(path->path[s] != '\0'); /* remove trailing slash, this also ensures that the string will be * empty for the root directory */ if(path->path[d - 1] == '/') path->path[d - 1] = '\0'; return 0; } int path_new_from_string(struct path **path, const char *cstr) { /* this check is done again in path_set_from_string, * but the the allocations can be saved, if cstr is invalid */ if(!(path_cstr_is_valid(cstr))) return EINVAL; *path = path_new(); if(*path == NULL) return ENOMEM; int ret = path_set_from_string(*path, cstr); if(ret != 0) { path_delete(*path); *path = NULL; } return ret; } struct path *path_new(void) { struct path *path = malloc(sizeof(*path)); if(path == NULL) return NULL; if(!path_init(path, 0)) { free(path); return NULL; } return path; } bool path_init(struct path *path, size_t size) { path->allocated_size = size; if(path->allocated_size < 1) path->allocated_size = 1; path->path = malloc(path->allocated_size); if(path->path == NULL) return false; path->path[0] = '\0'; return true; } void path_destroy(struct path *path) { free(path->path); } void path_delete(struct path *path) { if(path == NULL) return; path_destroy(path); free(path); }
19.223529
73
0.654529
f63c74cc090ee3ab8505b85d8d35258ba9220303
1,317
h
C
System/Library/PrivateFrameworks/WatchListKit.framework/WLKChannelUtilities.h
lechium/iPhoneOS_12.1.1_Headers
aac688b174273dfcbade13bab104461f463db772
[ "MIT" ]
12
2019-06-02T02:42:41.000Z
2021-04-13T07:22:20.000Z
System/Library/PrivateFrameworks/WatchListKit.framework/WLKChannelUtilities.h
lechium/iPhoneOS_12.1.1_Headers
aac688b174273dfcbade13bab104461f463db772
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/WatchListKit.framework/WLKChannelUtilities.h
lechium/iPhoneOS_12.1.1_Headers
aac688b174273dfcbade13bab104461f463db772
[ "MIT" ]
3
2019-06-11T02:46:10.000Z
2019-12-21T14:58:16.000Z
/* * This header is generated by classdump-dyld 1.0 * on Saturday, June 1, 2019 at 6:48:13 PM Mountain Standard Time * Operating System: Version 12.1.1 (Build 16C5050a) * Image Source: /System/Library/PrivateFrameworks/WatchListKit.framework/WatchListKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ @protocol OS_dispatch_queue; @class WLKServerConfiguration, NSObject, NSDictionary, NSArray; @interface WLKChannelUtilities : NSObject { BOOL _offLineMode; WLKServerConfiguration* _config; NSObject*<OS_dispatch_queue> _accessQueue; NSDictionary* _channelsByBundleID; } @property (nonatomic,copy,readonly) NSDictionary * channelsByID; @property (nonatomic,copy,readonly) NSDictionary * channelsByBundleID; //@synthesize channelsByBundleID=_channelsByBundleID - In the implementation block @property (nonatomic,copy,readonly) NSArray * orderedChannels; +(id)_validiTunesBundles; +(BOOL)isItunesBundleID:(id)arg1 ; +(BOOL)isItunesOrFirstPartyBundleID:(id)arg1 ; +(id)sharedInstance; -(id)initOffline; -(id)_serverConfiguration; -(NSDictionary *)channelsByID; -(NSDictionary *)channelsByBundleID; -(id)channelForBundleID:(id)arg1 ; -(id)channelIDForBundleID:(id)arg1 ; -(NSArray *)orderedChannels; -(id)channelForID:(id)arg1 ; -(id)init; -(id)_init; @end
32.121951
166
0.779803
06ba00ad4a02ce20aaea6beb87f233d5c7635e79
480
h
C
Sources/Controllers/2.0/OACollapsableView.h
Zahnstocher/OsmAnd-ios
d67009024c5ebb0084c83e3a9c305455b5db3397
[ "MIT" ]
null
null
null
Sources/Controllers/2.0/OACollapsableView.h
Zahnstocher/OsmAnd-ios
d67009024c5ebb0084c83e3a9c305455b5db3397
[ "MIT" ]
null
null
null
Sources/Controllers/2.0/OACollapsableView.h
Zahnstocher/OsmAnd-ios
d67009024c5ebb0084c83e3a9c305455b5db3397
[ "MIT" ]
null
null
null
// // OACollapsableView.h // OsmAnd // // Created by Alexey Kulish on 08/12/2016. // Copyright © 2016 OsmAnd. All rights reserved. // #import <UIKit/UIKit.h> #define kMarginLeft 60.0f #define kMarginRight 15.0f #define kCollapsableTitleMarginRight 35.0f @interface OACollapsableView : UIView - (void) adjustHeightForWidth:(CGFloat)width; - (void) setSelected:(BOOL)selected animated:(BOOL)animated; - (void) setHighlighted:(BOOL)highlighted animated:(BOOL)animated; @end
21.818182
66
0.75
bf3889585582fc37e8998e1747d4e7ce0430b63b
7,532
h
C
indra/llmath/m3math.h
SaladDais/LSO2-VM-Performance
d7ec9ad9daa9a2c9e48c5f06cd768606e3e50638
[ "ISC" ]
1
2022-01-29T07:10:03.000Z
2022-01-29T07:10:03.000Z
indra/llmath/m3math.h
SaladDais/LSO2-VM-Performance
d7ec9ad9daa9a2c9e48c5f06cd768606e3e50638
[ "ISC" ]
null
null
null
indra/llmath/m3math.h
SaladDais/LSO2-VM-Performance
d7ec9ad9daa9a2c9e48c5f06cd768606e3e50638
[ "ISC" ]
1
2021-10-01T22:22:27.000Z
2021-10-01T22:22:27.000Z
/** * @file m3math.h * @brief LLMatrix3 class header file. * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. * * This library is distributed in the hope that 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 * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_M3MATH_H #define LL_M3MATH_H #include "llerror.h" #include "stdtypes.h" class LLVector4; class LLVector3; class LLVector3d; class LLQuaternion; // NOTA BENE: Currently assuming a right-handed, z-up universe // ji // LLMatrix3 = | 00 01 02 | // | 10 11 12 | // | 20 21 22 | // LLMatrix3 = | fx fy fz | forward-axis // | lx ly lz | left-axis // | ux uy uz | up-axis // NOTE: The world of computer graphics uses column-vectors and matricies that // "operate to the left". static const U32 NUM_VALUES_IN_MAT3 = 3; class LLMatrix3 { public: F32 mMatrix[NUM_VALUES_IN_MAT3][NUM_VALUES_IN_MAT3]; LLMatrix3(void); // Initializes Matrix to identity matrix explicit LLMatrix3(const F32 *mat); // Initializes Matrix to values in mat explicit LLMatrix3(const LLQuaternion &q); // Initializes Matrix with rotation q LLMatrix3(const F32 angle, const LLVector3 &vec); // Initializes Matrix with axis angle LLMatrix3(const F32 angle, const LLVector3d &vec); // Initializes Matrix with axis angle LLMatrix3(const F32 angle, const LLVector4 &vec); // Initializes Matrix with axis angle LLMatrix3(const F32 roll, const F32 pitch, const F32 yaw); // Initializes Matrix with Euler angles ////////////////////////////// // // Matrix initializers - these replace any existing values in the matrix // // various useful matrix functions const LLMatrix3& setIdentity(); // Load identity matrix const LLMatrix3& clear(); // Clears Matrix to zero const LLMatrix3& setZero(); // Clears Matrix to zero /////////////////////////// // // Matrix setters - set some properties without modifying others // // These functions take Rotation arguments const LLMatrix3& setRot(const F32 angle, const LLVector3 &vec); // Calculate rotation matrix for rotating angle radians about vec const LLMatrix3& setRot(const F32 roll, const F32 pitch, const F32 yaw); // Calculate rotation matrix from Euler angles const LLMatrix3& setRot(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos const LLMatrix3& setRows(const LLVector3 &x_axis, const LLVector3 &y_axis, const LLVector3 &z_axis); const LLMatrix3& setRow( U32 rowIndex, const LLVector3& row ); const LLMatrix3& setCol( U32 colIndex, const LLVector3& col ); /////////////////////////// // // Get properties of a matrix // LLQuaternion quaternion() const; // Returns quaternion from mat void getEulerAngles(F32 *roll, F32 *pitch, F32 *yaw) const; // Returns Euler angles, in radians // Axis extraction routines LLVector3 getFwdRow() const; LLVector3 getLeftRow() const; LLVector3 getUpRow() const; F32 determinant() const; // Return determinant /////////////////////////// // // Operations on an existing matrix // const LLMatrix3& transpose(); // Transpose MAT4 const LLMatrix3& orthogonalize(); // Orthogonalizes X, then Y, then Z void invert(); // Invert MAT4 const LLMatrix3& adjointTranspose();// returns transpose of matrix adjoint, for multiplying normals // Rotate existing matrix // Note: the two lines below are equivalent: // foo.rotate(bar) // foo = foo * bar // That is, foo.rotate(bar) multiplies foo by bar FROM THE RIGHT const LLMatrix3& rotate(const F32 angle, const F32 x, const F32 y, const F32 z); // Rotate matrix by rotating angle radians about (x, y, z) const LLMatrix3& rotate(const F32 angle, const LLVector3 &vec); // Rotate matrix by rotating angle radians about vec const LLMatrix3& rotate(const F32 roll, const F32 pitch, const F32 yaw); // Rotate matrix by roll (about x), pitch (about y), and yaw (about z) const LLMatrix3& rotate(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos void add(const LLMatrix3& other_matrix); // add other_matrix to this one // This operator is misleading as to operation direction // friend LLVector3 operator*(const LLMatrix3 &a, const LLVector3 &b); // Apply rotation a to vector b friend LLVector3 operator*(const LLVector3 &a, const LLMatrix3 &b); // Apply rotation b to vector a friend LLVector3d operator*(const LLVector3d &a, const LLMatrix3 &b); // Apply rotation b to vector a friend LLMatrix3 operator*(const LLMatrix3 &a, const LLMatrix3 &b); // Return a * b friend bool operator==(const LLMatrix3 &a, const LLMatrix3 &b); // Return a == b friend bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b); // Return a != b friend const LLMatrix3& operator*=(LLMatrix3 &a, const LLMatrix3 &b); // Return a * b friend const LLMatrix3& operator*=(LLMatrix3 &a, F32 scalar ); // Return a * scalar friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a }; inline LLMatrix3::LLMatrix3(void) { mMatrix[0][0] = 1.f; mMatrix[0][1] = 0.f; mMatrix[0][2] = 0.f; mMatrix[1][0] = 0.f; mMatrix[1][1] = 1.f; mMatrix[1][2] = 0.f; mMatrix[2][0] = 0.f; mMatrix[2][1] = 0.f; mMatrix[2][2] = 1.f; } inline LLMatrix3::LLMatrix3(const F32 *mat) { mMatrix[0][0] = mat[0]; mMatrix[0][1] = mat[1]; mMatrix[0][2] = mat[2]; mMatrix[1][0] = mat[3]; mMatrix[1][1] = mat[4]; mMatrix[1][2] = mat[5]; mMatrix[2][0] = mat[6]; mMatrix[2][1] = mat[7]; mMatrix[2][2] = mat[8]; } #endif // Rotation matrix hints... // Inverse of Rotation Matrices // ---------------------------- // If R is a rotation matrix that rotate vectors from Frame-A to Frame-B, // then the transpose of R will rotate vectors from Frame-B to Frame-A. // Creating Rotation Matricies From Object Axes // -------------------------------------------- // Suppose you know the three axes of some object in some "absolute-frame". // If you take those three vectors and throw them into the rows of // a rotation matrix what do you get? // // R = | X0 X1 X2 | // | Y0 Y1 Y2 | // | Z0 Z1 Z2 | // // Yeah, but what does it mean? // // Transpose the matrix and have it operate on a vector... // // V * R_transpose = [ V0 V1 V2 ] * | X0 Y0 Z0 | // | X1 Y1 Z1 | // | X2 Y2 Z2 | // // = [ V*X V*Y V*Z ] // // = components of V that are parallel to the three object axes // // = transformation of V into object frame // // Since the transformation of a rotation matrix is its inverse, then // R must rotate vectors from the object-frame into the absolute-frame.
34.87037
148
0.660781
ba2d26ab317fdd779606231b4a1b78107dcda1ef
708
h
C
src/UpnpStack/UpnpTypedef/UpnpDeviceSummary.h
jxfengzi/UpnpLan
9b3357aaf7f04296c5a11c17b100728f2f607dac
[ "MIT" ]
2
2016-03-29T03:02:59.000Z
2016-04-08T10:31:21.000Z
src/UpnpStack/UpnpTypedef/UpnpDeviceSummary.h
jxfengzi/UpnpLan
9b3357aaf7f04296c5a11c17b100728f2f607dac
[ "MIT" ]
null
null
null
src/UpnpStack/UpnpTypedef/UpnpDeviceSummary.h
jxfengzi/UpnpLan
9b3357aaf7f04296c5a11c17b100728f2f607dac
[ "MIT" ]
3
2016-09-18T09:51:08.000Z
2021-12-03T03:41:02.000Z
/* * Copyright (C) 2013-2015 * * @author jxfengzi@gmail.com * @date 2013-7-9 * * @file UpnpDeviceSummary.h * * @remark * set tabstop=4 * set shiftwidth=4 * set expandtab */ #ifndef __UPNP_DEVICE_SUMMARY_H__ #define __UPNP_DEVICE_SUMMARY_H__ #include "tiny_base.h" #include "upnp_define.h" TINY_BEGIN_DECLS typedef struct _UpnpDeviceSummary { char deviceIp[TINY_IP_LEN]; char deviceId[UPNP_URI_LEN]; char deviceUrl[TINY_URL_LEN]; char domainName[UPNP_DOMAIN_NAME_LEN]; char deviceType[UPNP_TYPE_LEN]; char deviceVersion[UPNP_VERSION_LEN]; char upnpStackInfo[UPNP_STACK_INFO_LEN]; } UpnpDeviceSummary; TINY_END_DECLS #endif /* __UPNP_DEVICE_SUMMARY_H__ */
18.631579
44
0.738701
0f8ec70c33703fc5c09c7e17f13bfca5cadb0e00
987
c
C
libft/src/ft_strclr.c
BimManager/filler
20295ce45b05d085434f51cf46e24e7f7fac5707
[ "MIT" ]
null
null
null
libft/src/ft_strclr.c
BimManager/filler
20295ce45b05d085434f51cf46e24e7f7fac5707
[ "MIT" ]
null
null
null
libft/src/ft_strclr.c
BimManager/filler
20295ce45b05d085434f51cf46e24e7f7fac5707
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strclr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: kkozlov <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/12 16:43:19 by kkozlov #+# #+# */ /* Updated: 2019/02/15 14:46:23 by kkozlov ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_strclr(char *s) { if (!s) return ; while (*s) *s++ = 0x00; }
44.863636
80
0.14387
d56e087b6306f2e2d19d3b5b81135e69ad25e583
3,944
c
C
python_ketama/ketamamodule.c
timgates42/ketama
18cf9a7717dad0d8106a5205900a17617043fe2c
[ "BSD-2-Clause" ]
545
2015-01-11T02:10:33.000Z
2022-03-24T06:13:40.000Z
python_ketama/ketamamodule.c
WhatDream/ketama
18cf9a7717dad0d8106a5205900a17617043fe2c
[ "BSD-2-Clause" ]
3
2016-07-26T02:39:05.000Z
2020-01-31T15:38:45.000Z
python_ketama/ketamamodule.c
WhatDream/ketama
18cf9a7717dad0d8106a5205900a17617043fe2c
[ "BSD-2-Clause" ]
107
2015-01-12T06:57:54.000Z
2022-03-24T06:13:44.000Z
/** * $Id: ketamamodule.c 22 2007-07-13 01:31:27Z toxik $ * * ketama Python module. * * Definitions of C-level API calls to libketama * * libketama defines: * ketama_roll: initialize server list and return a continuum * ketama_destroy: free memory used by continuum * ketama_get_server: hash key up and return server to use from continuum * ketama_print_continuum: print out continuum * ketama_error: return current error string */ #include "ketamamodule.h" /* {{{ Continuum type definition */ static void pyketama_Continuum_dealloc(pyketama_Continuum *self) { ketama_smoke(self->cont); free(self->filename); self->ob_type->tp_free((PyObject *)self); } PyObject *pyketama_Continuum_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { /* Investigate: This seems like dull boiler-plate code. Needed? */ pyketama_Continuum *pkc = (pyketama_Continuum *)type->tp_alloc(type, 0); /* Assures that a free() on uninitialized filename will not die. */ pkc->filename = NULL; return (PyObject *)pkc; } static int pyketama_Continuum_init(PyObject *self, PyObject *args, PyObject *kwds) { char *filename; pyketama_Continuum *pkc = (pyketama_Continuum *)self; if (!PyArg_ParseTuple(args, "s", &filename)) { return -1; } /* libketama doesn't really handle long filenames. */ if (strlen(filename) > 255) { PyErr_SetString(PyExc_ValueError, "filename must not be over 255 bytes long"); return -1; } /* I'm not entirely sure if you need this, but I do it. */ if(!(pkc->filename = strdup(filename))) { PyErr_NoMemory(); return -1; } if (!ketama_roll(&(pkc->cont), pkc->filename)) { PyErr_SetString(pyketama_error, ketama_error()); return -1; } return 0; } static PyObject *pyketama_Continuum_repr(PyObject *o) { PyObject *r; r = PyString_FromFormat("<%s from ", o->ob_type->tp_name); PyString_Concat(&r,PyObject_Repr( PyString_FromString(((pyketama_Continuum* )o)->filename))); if (r) { PyString_Concat(&r, PyString_FromString(">")); } /* Example: <ketama.Continuum from '/tmp/slist'> */ return r; } PY_DEF(pyketama_Continuum_get_server, self, args) { char *key; mcs *r; PyObject *ret = NULL; if (PyArg_ParseTuple(args, "s", &key)) { /* ketama_get_server simply can not fail, so there's no point in * error checking. */ r = ketama_get_server(key, ((pyketama_Continuum *)self)->cont); ret = Py_BuildValue("Is", r->point, r->ip); } return ret; } PY_DEF(pyketama_Continuum_get_points, self, args) { PyObject *ret = NULL; pyketama_Continuum *pkc = (pyketama_Continuum *)self; if (pkc->cont->array) { int i; mcs (*mcsarr)[pkc->cont->numpoints] = pkc->cont->array; ret = PyList_New(pkc->cont->numpoints); for (i = 0; i < pkc->cont->numpoints; i++) { PyList_SET_ITEM(ret, i, Py_BuildValue("Is", (*mcsarr)[i].point, (*mcsarr)[i].ip)); } } return ret; } /* }}} Continuum type definition */ PY_DEF(pyketama_hashi, self, args) { char *data; PyObject *r = NULL; if (PyArg_ParseTuple(args, "s", &data)) { r = Py_BuildValue("I", ketama_hashi(data)); } } PyMODINIT_FUNC initketama(void) { PyObject *m; if (PyType_Ready(&pyketama_ContinuumType) < 0) { return; } if (!(m = Py_InitModule3("ketama", ketamaMethods, "Python extension for calling libketama functions."))) { return; } pyketama_error = PyErr_NewException("ketama.KetamaError", NULL, NULL); Py_INCREF(pyketama_error); PyModule_AddObject(m, "KetamaError", pyketama_error); Py_INCREF(&pyketama_ContinuumType); PyModule_AddObject(m, "Continuum", (PyObject *)&pyketama_ContinuumType); } /* vim: ts=4 sts=4 expandtab */
26.469799
76
0.635649
ec11bea29e1a28722045a415217b24d4a6eee430
3,917
h
C
test/src/pottery/benchmark/test_benchmark_sort_common.h
ludocode/pottery
437b071ee8dd496a8a2d47c1db2643eaa82dc34d
[ "MIT" ]
85
2020-12-17T01:21:32.000Z
2022-03-25T10:47:00.000Z
test/src/pottery/benchmark/test_benchmark_sort_common.h
ludocode/pottery
437b071ee8dd496a8a2d47c1db2643eaa82dc34d
[ "MIT" ]
3
2020-12-20T16:09:37.000Z
2022-03-19T18:58:14.000Z
test/src/pottery/benchmark/test_benchmark_sort_common.h
ludocode/pottery
437b071ee8dd496a8a2d47c1db2643eaa82dc34d
[ "MIT" ]
4
2020-12-17T02:13:40.000Z
2022-01-24T03:58:36.000Z
/* * MIT License * * Copyright (c) 2020-2021 11037650 Canada Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef POTTERY_BENCHMARK_TEST_BENCHMARK_SORT_COMMON_H #define POTTERY_BENCHMARK_TEST_BENCHMARK_SORT_COMMON_H // find __GLIBC__ #if __has_include(<features.h>) #include <features.h> #endif #include <stdint.h> // int type to sort typedef intptr_t benchmark_int_t; // The rules for comparator inlining are: // // - qsort() implementations that take a function pointer comparator are not // allowed to inline it. This matches their behaviour in the real world. // // - Template implementations that take a function (such as swenson/sort) are // allowed to inline the comparator function because they take it as a // compile-time template argument, not as a function pointer parameter. An // inline definition is provided below for these templates. // // - Pottery's sort algorithms as well as all C++ templates use the default // comparators. They don't take a comparator function at all. // // We declare here some non-inline comparison functions for use in the various // qsort() wrappers and we don't build the benchmark suite with link-time // optimization. This prevents the compiler from optimizing away the function // pointer indirection. // Three-way value comparator, inline for use in templates static inline int benchmark_int_compare_values(const benchmark_int_t a, const benchmark_int_t b) { // The ternary is faster than the alternative below, sometimes even faster // than the subtraction while being safe, as long as it gets inlined. This // is probably because when inlined the compiler can detect when algorithms // ignore the greater-than branch. return ((a < b) ? -1 : ((a > b) ? 1 : 0)); // This is significantly slower despite optimizations, even when the // comparison function is inlined. //return (a > b) - (a < b); // This is an unsafe three-way comparison of ints. It gives wrong results // on large values. A safe comparison instead uses ordinary comparison // operators as above. // // Ironically, when the comparison function is inlined, the safe comparison is // marginally faster than the unsafe comparison (like swenson/sort quicksort). // However the unsafe comparison is faster on algorithms that cannot inline it // (like qsort() and pottery_qsort().) // // This does not affect algorithms that do not need to use three-way // comparisons and do not use this function (like Pottery templated sorts // and C++ sorts.) //return a - b; } // Non-inline qsort() comparators taking void pointers int benchmark_int_compare(const void* left, const void* right); int benchmark_int_compare_gnu_r(const void* left, const void* right, void* user_context); int benchmark_int_compare_bsd_r(void* user_context, const void* left, const void* right); #endif
43.043956
89
0.747
41af2ef21138b57be580723135121cc4868ffb16
2,005
h
C
QClient/qclient.h
KailinLi/QChat
ea5e762b31cc4769611516d4f6ca1a79ad0f93c1
[ "MIT" ]
4
2017-10-19T15:44:06.000Z
2021-08-24T12:32:29.000Z
QClient/qclient.h
KailinLi/QChat
ea5e762b31cc4769611516d4f6ca1a79ad0f93c1
[ "MIT" ]
null
null
null
QClient/qclient.h
KailinLi/QChat
ea5e762b31cc4769611516d4f6ca1a79ad0f93c1
[ "MIT" ]
1
2020-04-30T08:21:50.000Z
2020-04-30T08:21:50.000Z
#ifndef QCLIENT_H #define QCLIENT_H #include <QWidget> #include <QTextCharFormat> #include "connectthreadpool.h" #include "parallelserver.h" #include "userinfolist.h" #include "sendfile.h" #include "receivefile.h" namespace Ui { class QClient; } class QClient : public QWidget { Q_OBJECT public: explicit QClient(QWidget *parent = 0); ~QClient(); quint32 userID; QHostAddress serverAddress; private: Ui::QClient *ui; ParallelServer *server; ConnectThreadPool threadPool; UserInfoList userList; TcpSocketMsg* tcpToServer; QString userName; quint32 currentID; QColor color; QFile *sendFile; QHostAddress localAddress; ReceiveFile *receiveFileWindow; SendFile *sendFileWindow; public: void start(); void logIn(); void haveNewMsgFromServer(); void initUpdateUI(); void signInUpdateUI(const QString &name); void signOutUpdateUI(const QString &name); void quit(); void makeActive(int row); void changeTableWidget(quint32 id); void sendMsgToUI(); void clickSend(); void setUpCommunication(ConnectThread *thread); bool eventFilter(QObject* obj, QEvent* event); void currentFontChanged(QFont f); void currentFontSizeChanged(const QString &size); void clickBoldBtn(bool checked); void clickItalicBtn(bool checked); void clickUnderlineBtn(bool checked); void clickColorBtn(); void clickSendFile(); void clickSaveFile(); void clickClearBtn(); void currentFormatChanged(const QTextCharFormat &format); void setRedDot(const QString &name); void readMsgUpdateUI(const QString &name, const QString &msg); QHostAddress getIP(); void shakeWindow(); private slots: void haveNewConnect(qintptr socketDescriptor); void haveNewMsg(ConnectThread* thread, Message* msg); void loseConnect(ConnectThread* thread); signals: void sendMsg(Message* msg); void msgToSend(ConnectThread *thread, Message *msg); }; #endif // QCLIENT_H
25.379747
66
0.717207
3bd9085244c081084413ff89548fd36b37ee0875
397
h
C
BTE/Categories/ZTYScreenshot.h
sophiemarceau/bte_iOS
3e44be16be9559709e5dfbe24855f929e68832b1
[ "MIT" ]
1
2022-02-08T06:42:11.000Z
2022-02-08T06:42:11.000Z
BTE/Categories/ZTYScreenshot.h
sophiemarceau/bte_iOS
3e44be16be9559709e5dfbe24855f929e68832b1
[ "MIT" ]
1
2021-11-12T02:04:11.000Z
2021-11-12T02:04:11.000Z
BTE/Categories/ZTYScreenshot.h
sophiemarceau/bte_iOS
3e44be16be9559709e5dfbe24855f929e68832b1
[ "MIT" ]
null
null
null
// // ZTYScreenshot.h // BTE // // Created by wanmeizty on 15/8/18. // Copyright © 2018年 wangli. All rights reserved. // #import <Foundation/Foundation.h> #import "BTECommontModel.h" @interface ZTYScreenshot : NSObject + (UIImage *)screenshotImage; + (UIImage *)screenshotImageBottomImageName:(NSString *)imgName; +(UIImage *)getCapture:(BTECommontModel *)model; +(UIImage*)getCapture; @end
22.055556
64
0.72796
02bdf89714067cdc5b805f789b72d00ca0e30d7d
182
c
C
src/engine/arch/amd64/windows/multithreading.c
tevoran/phoenix-engine
91fb4a20ab698e947f08e75f4481099e6de7bb29
[ "BSL-1.0" ]
4
2021-06-20T01:27:16.000Z
2021-07-18T09:19:01.000Z
src/engine/arch/amd64/windows/multithreading.c
tevoran/phoenix-engine
91fb4a20ab698e947f08e75f4481099e6de7bb29
[ "BSL-1.0" ]
3
2021-07-03T17:15:47.000Z
2021-07-21T22:27:09.000Z
src/engine/arch/amd64/windows/multithreading.c
tevoran/phoenix-engine
91fb4a20ab698e947f08e75f4481099e6de7bb29
[ "BSL-1.0" ]
null
null
null
#include <te.h> #ifdef PTW32_VERSION #include <pthread.h> //Windows POSIX version for the number of CPU threads int te_num_procs() { return pthread_num_processors_np(); } #endif
15.166667
53
0.752747
befd7cc24880b79e716646f534b4857c112573fb
1,123
h
C
Deus/Source/Model.h
mathias-dietrich/flipotronics
6ebdba70448df09ab7a29a4a75ab1fc01138a85f
[ "Apache-2.0" ]
null
null
null
Deus/Source/Model.h
mathias-dietrich/flipotronics
6ebdba70448df09ab7a29a4a75ab1fc01138a85f
[ "Apache-2.0" ]
null
null
null
Deus/Source/Model.h
mathias-dietrich/flipotronics
6ebdba70448df09ab7a29a4a75ab1fc01138a85f
[ "Apache-2.0" ]
null
null
null
// // Model.h // Deus // // Created by Mathias Dietrich on 15.07.20. // Copyright © 2020 Flipotronics. All rights reserved. // #ifndef Model_h #define Model_h #include <JuceHeader.h> #include "Param.h" #include "Defines.h" #include "Global.h" #include "Preset.h" #include "Scale.h" using namespace std; struct ParamSet{ int moduleId; std::map<int, float> params; }; class Model{ protected: static Model *instance; Model() { } public: static Model * of() { if (instance == 0) instance = new Model(); return instance; } void init(){ } Preset preset; E_Master masterSel = mEdit; MatrixSource editSel = s_ADSR0; Global global; Param getParam(E_Module module, int paramId){ return preset.params[module][paramId]; } std::map<int, Param> getParams(E_Module module){ return preset.params[module]; } int64 timeTaken; float sumRMSL; float sumRMSR; float sumPeakL; float sumPeakR; private: }; #endif /* Model_h */
16.042857
55
0.582369
f4087442321a272cc1a5800c6b06c044c88f96d6
229
h
C
RHDemo/LocationViewController.h
nisargvora/BeerInventory-iOS-App
7b2b62df3b88194ef42c04e6b268f78406301a74
[ "MIT" ]
null
null
null
RHDemo/LocationViewController.h
nisargvora/BeerInventory-iOS-App
7b2b62df3b88194ef42c04e6b268f78406301a74
[ "MIT" ]
null
null
null
RHDemo/LocationViewController.h
nisargvora/BeerInventory-iOS-App
7b2b62df3b88194ef42c04e6b268f78406301a74
[ "MIT" ]
null
null
null
// // LocationViewController.h // RHDemo // // Created by Nisarg Vora on 9/6/15. // Copyright (c) 2015 Nisarg Vora. All rights reserved. // #import <UIKit/UIKit.h> @interface LocationViewController : UIViewController @end
16.357143
56
0.707424
3c7b8b769e1642ebf537dbb1ac37496ba9bdff19
6,581
h
C
code-readpad/kernel-schema/include_linux_hugetlb.h.h
r4b3rt/kde
b02669373eeae9b836ba83f004ad2f2b642ffac1
[ "MIT" ]
6
2017-07-23T12:53:38.000Z
2017-11-01T11:29:21.000Z
code-readpad/kernel-schema/include_linux_hugetlb.h.h
r4b3rt/kde
b02669373eeae9b836ba83f004ad2f2b642ffac1
[ "MIT" ]
125
2017-06-16T08:00:28.000Z
2017-11-23T07:08:00.000Z
code-readpad/kernel-schema/include_linux_hugetlb.h.h
lkml-likexu/kde
8d650a838db6660c5fe01139cb5edb8640abd01a
[ "MIT" ]
null
null
null
\n define is_hugepd(hugepd) (0) static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, unsigned pdshift, unsigned long end, int write, struct page **pages, int *nr) static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) static inline unsigned long hugetlb_total_pages(void) static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) static inline void adjust_range_if_pmd_sharing_possible( struct vm_area_struct *vma, unsigned long *start, unsigned long *end) define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) static inline void hugetlb_report_meminfo(struct seq_file *m) define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) static inline void hugetlb_report_meminfo(struct seq_file *m) }define hugetlb_report_node_meminfo(n, buf) 0 static inline void hugetlb_show_meminfo(void) static inline bool isolate_huge_page(struct page *page, struct list_head *list) static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, unsigned long address, unsigned long end, pgprot_t newprot) static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb, struct vm_area_struct *vma, unsigned long start, unsigned long end, struct page *ref_page) static inline void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, unsigned long start, unsigned long end, struct page *ref_page) static inline int pgd_write(pgd_t pgd) static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode) static inline bool is_file_hugepages(struct file *file) define is_file_hugepages(file) false static inline struct file * hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, struct user_struct **user, int creat_flags, int page_size_log) static inline struct hstate *hstate_inode(struct inode *i) static inline struct hstate *hstate_file(struct file *f) static inline struct hstate *hstate_sizelog(int page_size_log) static inline struct hstate *hstate_vma(struct vm_area_struct *vma) static inline unsigned long huge_page_size(struct hstate *h) static inline unsigned long huge_page_mask(struct hstate *h) static inline unsigned int huge_page_order(struct hstate *h) static inline unsigned huge_page_shift(struct hstate *h) static inline bool hstate_is_gigantic(struct hstate *h) static inline unsigned int pages_per_huge_page(struct hstate *h) static inline unsigned int blocks_per_huge_page(struct hstate *h) static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, struct page *page, int writable) static inline struct hstate *page_hstate(struct page *page) static inline unsigned hstate_index_to_shift(unsigned index) static inline int hstate_index(struct hstate *h) static inline pgoff_t basepage_index(struct page *page) extern int dissolve_free_huge_page(struct page *page) ; extern int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) ; static inline bool hugepage_migration_supported(struct hstate *h) static inline spinlock_t *huge_pte_lockptr(struct hstate *h, struct mm_struct *mm, pte_t *pte) static inline void hugetlb_count_add(long l, struct mm_struct *mm) static inline void hugetlb_count_sub(long l, struct mm_struct *mm) static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned long sz) static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned long sz) set_huge_pte_at(mm, addr, ptep, pte) ; }endifdefine alloc_huge_page(v, a, r) NULLdefine alloc_huge_page_node(h, nid) NULLdefine alloc_huge_page_nodemask(h, preferred_nid, nmask) NULLdefine alloc_huge_page_vma(h, vma, address) NULLdefine alloc_bootmem_huge_page(h) NULLdefine hstate_file(f) NULLdefine hstate_sizelog(s) NULLdefine hstate_vma(v) NULLdefine hstate_inode(i) NULLdefine page_hstate(page) NULLdefine huge_page_size(h) PAGE_SIZEdefine huge_page_mask(h) PAGE_MASKdefine vma_kernel_pagesize(v) PAGE_SIZEdefine vma_mmu_pagesize(v) PAGE_SIZEdefine huge_page_order(h) 0define huge_page_shift(h) PAGE_SHIFT static inline bool hstate_is_gigantic(struct hstate *h) static inline unsigned int pages_per_huge_page(struct hstate *h) static inline unsigned hstate_index_to_shift(unsigned index) static inline int hstate_index(struct hstate *h) static inline pgoff_t basepage_index(struct page *page) static inline int dissolve_free_huge_page(struct page *page) static inline int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) static inline bool hugepage_migration_supported(struct hstate *h) static inline spinlock_t *huge_pte_lockptr(struct hstate *h, struct mm_struct *mm, pte_t *pte) static inline void hugetlb_report_usage(struct seq_file *f, struct mm_struct *m) static inline void hugetlb_count_sub(long l, struct mm_struct *mm) static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned long sz) static inline spinlock_t *huge_pte_lock(struct hstate *h, struct mm_struct *mm, pte_t *pte) \n 16 struct hstate *h 10 struct mm_struct *mm 8 h 7 struct vm_area_struct *vma 7 struct page *page 4 v 4 unsigned long end 4 unsigned long addr 4 pte_t *ptep 3 unsigned long sz 3 pte_t *pte 3 pte_t pte 3 mm 3 long l 3 addr 2 write 2 void 2 unsigned long start_pfn 2 unsigned long start 2 unsigned long end_pfn 2 unsigned index 2 struct seq_file *m 2 struct page *ref_page 2 struct mmu_gather *tlb 2 int page_size_log 2 -EINVAL 1 vm_flags_t acctflag 1 vma 1 unsigned pdshift 1 unsigned long *start 1 unsigned long *end 1 unsigned long address 1 unsigned long *addr 1 struct user_struct **user 1 struct super_block *sb 1 struct seq_file *f 1 struct page **pages 1 struct mm_struct *m 1 struct list_head *list 1 struct inode *inode 1 struct inode *i 1 struct file *file 1 struct file *f 1 size_t size 1 s 1 r 1 pte_t entry 1 ptep 1 pte 1 preferred_nid 1 pgprot_t newprot 1 pgd_t pgd 1 page 1 nmask 1 nid 1 n 1 int write 1 int writable 1 int *nr 1 int creat_flags 1 i 1 hugepd_t hugepd 1 hugepd 1 file 1 f 1 const char *name 1 buf 1 address 1 a 1 0
43.013072
167
0.769792
ad981e6fffb9f304215d3d7226c5813a2c86d267
4,380
h
C
src/mame/includes/ladybug.h
Robbbert/messui
49b756e2140d8831bc81335298ee8c5471045e79
[ "BSD-3-Clause" ]
26
2015-03-31T06:25:51.000Z
2021-12-14T09:29:04.000Z
src/mame/includes/ladybug.h
Robbbert/messui
49b756e2140d8831bc81335298ee8c5471045e79
[ "BSD-3-Clause" ]
null
null
null
src/mame/includes/ladybug.h
Robbbert/messui
49b756e2140d8831bc81335298ee8c5471045e79
[ "BSD-3-Clause" ]
10
2015-03-27T05:45:51.000Z
2022-02-04T06:57:36.000Z
// license:BSD-3-Clause // copyright-holders:Nicola Salmoria /************************************************************************* Universal 8106-A2 + 8106-B PCB set *************************************************************************/ #ifndef MAME_INCLUDES_LADYBUG_H #define MAME_INCLUDES_LADYBUG_H #pragma once #include "video/ladybug.h" #include "emupal.h" #include "tilemap.h" class ladybug_base_state : public driver_device { protected: using driver_device::driver_device; void palette_init_common( palette_device &palette, const uint8_t *color_prom, int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1) const; }; // ladybug platform class ladybug_state : public ladybug_base_state { public: ladybug_state(const machine_config &mconfig, device_type type, const char *tag) : ladybug_base_state(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_video(*this, "video") , m_port_dsw0(*this, "DSW0") , m_p1_control(*this, "CONTP1") , m_p2_control(*this, "CONTP2") { } DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p1_control_r); DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p2_control_r); DECLARE_INPUT_CHANGED_MEMBER(coin1_inserted); DECLARE_INPUT_CHANGED_MEMBER(coin2_inserted); void ladybug(machine_config &config); protected: DECLARE_WRITE_LINE_MEMBER(flipscreen_w); void ladybug_palette(palette_device &palette) const; uint32_t screen_update_ladybug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void ladybug_map(address_map &map); required_device<cpu_device> m_maincpu; private: required_device<ladybug_video_device> m_video; required_ioport m_port_dsw0; optional_ioport m_p1_control; optional_ioport m_p2_control; }; // ladybug plus program decryption class dorodon_state : public ladybug_state { public: dorodon_state(const machine_config &mconfig, device_type type, const char *tag) : ladybug_state(mconfig, type, tag) , m_decrypted_opcodes(*this, "decrypted_opcodes") { } void init_dorodon(); void dorodon(machine_config &config); protected: void decrypted_opcodes_map(address_map &map); private: required_shared_ptr<uint8_t> m_decrypted_opcodes; }; // 8203 hardware adds grid tilemap, 2nd audio CPU class mrsdyna_state : public ladybug_base_state { public: mrsdyna_state(const machine_config &mconfig, device_type type, const char *tag) : ladybug_base_state(mconfig, type, tag) , m_palette(*this, "palette") , m_gfxdecode(*this, "gfxdecode") , m_video(*this, "video") { } void mrsdyna(machine_config &config); protected: uint8_t mrsdyna_protection_r(); void mrsdyna_weird_w(offs_t offset, uint8_t data); void mrsdyna_0x30_w(offs_t offset, uint8_t data); void mrsdyna_0x38_w(offs_t offset, uint8_t data); uint8_t mrsdyna_rnd_r(); void mrsdyna_io_w(uint8_t data); void mrsdyna_palette(palette_device &palette) const; DECLARE_WRITE_LINE_MEMBER(screen_vblank_sraider); TILE_GET_INFO_MEMBER(get_grid_tile_info); virtual void machine_start() override; virtual void machine_reset() override; uint32_t screen_update_mrsdyna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void mrsdyna_cpu1_map(address_map &map); void mrsdyna_cpu2_io_map(address_map &map); void mrsdyna_cpu2_map(address_map &map); required_device<palette_device> m_palette; required_device<gfxdecode_device> m_gfxdecode; required_device<ladybug_video_device> m_video; tilemap_t *m_grid_tilemap; uint8_t m_grid_color; uint8_t m_0x30; uint8_t m_0x38; uint8_t m_weird_value[8]; }; // add stars from zerohour, uses grid layer class sraider_state : public mrsdyna_state { public: sraider_state(const machine_config &mconfig, device_type type, const char *tag) : mrsdyna_state(mconfig, type, tag) , m_grid_data(*this, "grid_data") , m_stars(*this, "stars") { } void sraider(machine_config &config); protected: void sraider_io_w(uint8_t data); void sraider_palette(palette_device &palette) const; DECLARE_WRITE_LINE_MEMBER(screen_vblank_sraider); TILE_GET_INFO_MEMBER(get_grid_tile_info); virtual void video_start() override; uint32_t screen_update_sraider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void sraider_cpu2_map(address_map &map); private: required_shared_ptr<uint8_t> m_grid_data; required_device<zerohour_stars_device> m_stars; }; #endif // MAME_INCLUDES_LADYBUG_H
27.375
104
0.762329
5d4168f42fccd27d3ef8575c878fa5bdbf363ed1
244
h
C
A/Targets/Target_A.h
wulei878/A
2b1fc5f4f1473c33e6f00713e6be85933ea99780
[ "MIT" ]
null
null
null
A/Targets/Target_A.h
wulei878/A
2b1fc5f4f1473c33e6f00713e6be85933ea99780
[ "MIT" ]
null
null
null
A/Targets/Target_A.h
wulei878/A
2b1fc5f4f1473c33e6f00713e6be85933ea99780
[ "MIT" ]
null
null
null
// // Target_A.h // A // // Created by Owen on 2017/7/4. // Copyright © 2017年 Owen. All rights reserved. // #import <UIKit/UIKit.h> @interface Target_A : NSObject - (UIViewController *)Action_viewController:(NSDictionary *)params; @end
15.25
67
0.680328
56d4c6781add065ea85796d00ccf2bb1a9286c62
392
h
C
HDMyYuYueViewController.h
sovranliu/tower-ios
c9367cfafd85e6ce9f3057d70560d83de6180fec
[ "Unlicense" ]
null
null
null
HDMyYuYueViewController.h
sovranliu/tower-ios
c9367cfafd85e6ce9f3057d70560d83de6180fec
[ "Unlicense" ]
null
null
null
HDMyYuYueViewController.h
sovranliu/tower-ios
c9367cfafd85e6ce9f3057d70560d83de6180fec
[ "Unlicense" ]
null
null
null
// // HDMyYuYueViewController.h // HDMedical // // Created by DEV_00 on 15-9-24. // Copyright (c) 2015年 HD. All rights reserved. // #import "CMViewController.h" @interface HDMyYuYueViewController : CMViewController<UITableViewDataSource,UITableViewDelegate> @property(nonatomic,strong)UITableView * messageCenterTableView; @property(nonatomic,strong)NSMutableArray * myYuyueArray; @end
26.133333
96
0.785714
951f224c1fc7ae338134b73d878ddb0c2724b872
12,455
c
C
STM8/projects/debugtest/main.c
jaydcarlson/microcontroller-test-code
43ec3a900dcdf5d9a487fa897a7daf4dfbd72fe7
[ "MIT" ]
74
2017-11-06T08:09:41.000Z
2022-03-06T13:32:17.000Z
STM8/projects/debugtest/main.c
jaydcarlson/microcontroller-test-code
43ec3a900dcdf5d9a487fa897a7daf4dfbd72fe7
[ "MIT" ]
1
2018-08-11T13:36:45.000Z
2018-08-29T22:09:43.000Z
STM8/projects/debugtest/main.c
jaydcarlson/microcontroller-test-code
43ec3a900dcdf5d9a487fa897a7daf4dfbd72fe7
[ "MIT" ]
9
2017-12-27T09:55:00.000Z
2020-10-30T05:28:24.000Z
/* MAIN.C file * * Copyright (c) 2002-2005 STMicroelectronics */ static const char data[] = "KZ63862ecLKIsc18DPpZvQJYaaT5So3R8BH4ReCRS8dMe0h5dutTQf0hXzm2Hh8o9JHcRs9dVkfl2AAoJOQt0HeNws0DgQSEP5MqvYhAOwj5C6JjjiXDpGusZ0251sDsX1FI5s8ixy9qgCzsUaaAjNC9Y6c3ZNvEM0JePPcJlcnA7S26z8LREO9Flk9z4Fklct6jnsAuABgeXFd2reGqTCTUHzbrFQG4mm7ZQcEPcIbWxESHqM21dZIuswEO4aNt6Tc05mth2stHSWOohT1P8K24aHHRsOJ5nhHv3BMY5Q2REMKfflc3uDTEH6K9h49c16WSPI3pJ9ef1vUdG5jvWVEdytSEjOKodkxEubV0FavvIeY1hQ6465jqNSrL7pWnn9plUf97CMKNfDyDuacNF8d5Px3RBng0Hy6BNF1halJ9SUgTpmHgRy05Qmld1brOcL6wpRi4DQW7zYfMpZV7ECv6SnrNUkHiGPlgdxiner1Hh00i3QWacXLei6xUcwfOXi603EusJi89D245cQW0sRyKsWhxxeOouoZrcgmS96k7bOUy9mRJLJH8FkXQxN7Mo2um0JEVPVB4SykGV2MZwkewokE2WhVy9C2HD6VKXLQaWJlHemwnZ9rpsOGYYoPdsCjySNjGd2CVZLnpqOPoxxvMopQNwCcbwe1H2AIY53M90r5KcHXNJRZlNAiaBRy7znFdwyeX7Mv1zHLAR9SJnvbxbzCQKC0iNg7Mj57aIDCCJxFmFRSCzkifKnUEuhFiiVy3XJoAAcvnlKOnAHMBl2jZgztcffLCit1cjFpT0bbYelwvbJbtvirXQEv5QZSrHDKXzaDozgY9Ag0t2WDGBMRoKlhxLukVejgF0wQb8f3YXAElcOD7IxlNTGD9me2hX5swtq9xgSr0IPbYZB28Et6sjVJWGkmCQ4YEICSPuaO5wfUPt1CuZ1HWgIOofjTqLHLnzrqSjjVV79h5Ot7IbmiqBESUI5Ty07S9fHccqJgolSUvrJmBKa87jonPLnFMdV4Db1UcoIX0zOdYvqU3nNpvNYDSezXSnwZ9J8qm5WgfSboCJQWP3meWq5rrPEbKm22EWcUewAjYp7RiQ2Do9K8vI25jsAxynNLCCxoCgk0B0FBLmp5BYqf1njSc7V1qyIzJJomearw8XWnajGGvyii4ROkfnQcZ2kdDmDlVMDp0G9Y4lHppCP4cSTl2As0VOgwKCmLgYX859U7DYh68CjJoI1lnCcGSy3sTU3bghXQnNMZ6nvoq7eZptxMrJ4MYFSN4mAmocZWDeXZtp5fYFyZ8sTMZLZVQ5LOtGcOEGYz1IA27mgI9fhzSdkJCWViaowKrNBMvrP1jdGZ5hxW92igmdkvEPGwpER3TbQDmdsvERD7vPxPb1VIV47KRyyvS1lCpM6ztD462lM9W9yr3MFzTSzPtUVKqeXZZkK4oZK24uIJma1xT90F3zMQy301EXO3jZaRAu6CFka7o46RFd3vbyhRjSW71r0MUcbe57jx4C6iGjoWoygPKMwHIVZkRwfqVmZGiH1Un1jhEmaE8j8Sq5zyqQ7eFwY8f1c1OWKSNgcwvDZPI5YF5IofLyFDBB1QvrJ60AvmIwyC2yCPFClLM1N884LhEpl0pYmdekpybfockgSLwJkYQ0JXvqtQiwVRmxxZjYgRjq5DNm9GK8VOFDXKhskfbUBJtBba1ONtI7Ge7L3bCvKFB3tV8zPM6jGHPzZCqe0xYT4ZoiXhZ6UzEfKA5WHRRh5ORGWfdmpxKvd4bIIsT9flR3mXxCWRoHtdlzd9vfNdxgsbgsxc7Eo5Y5GQjfDMYxpGE6u3vjpeeT80S10tF4akNK0m8smWjOeVGWQkeVlOh0TBtGFPH76MdHMSfFhNci9BvHTlqgC1pur7CpasLu1cqC2oB462ZQdEwTDHoI2PBk1zb0iuGVDngYTK6LmEPuq6zhPlT9tNlcjnbLbnIf4PGdERPZM8gZ8klAV4t1CEWHcBt5umWI8HyMGHdAl13kMvzVK1bhcxoUdNxu9zSeg2OZVdvxIugLt79Kd2lB8IZN6X3bziZ5r1b9CerKwGLqmEuQlL1mmtmEtNodc4Gftg4TEvbRhXDSXTQBOmGeBi1gascCKEO3ofFeYfreW4VZh2uTULrs3j75mOmQ4jV1HLI3tt6PWXJlm9chpRqPTIl8luoZJRmG9yvSKaAkYoakKJBWI9fxatqlBBPx9mcDa2wfFKzJvOLF9AkGHMcZUx3yQ0EMEcEFRY9xmH2u9gUxRSzZ5mxU0k8Fq4n59aovBOX7DMNk3pHZsYKpU1B65YKgm6zi9mRoedHEv2bJwVVtJ5uRGCM7EF3eIN1nRFl9LvWnEsKpxGzvNXTszc4Ymn8PFhE7taVxb5N7BhcFbJo9KqsP9JF2Nr1Iz2LQ3yAT0Nlem1H1OS1GlpKMKs0aNlERRgdjgG27jpSo1BatvE0uf9v5bVZIN4j9QGLwRNTE3ykEbw7eD9wj4m4P99YM9WmF29U2agKfilZDG14iVEzz8P5XfnNLT9uIhgcmvKguTKQEbHjAkq9hg3bzjksPEj386FqHo0U8Hhe9MUACgnmSLlM2PIAdEu1Z02qSolNkNLigCI3e07dN8YksOf4yE9UHpqh794HwaMcaz7uDQ6kSqSdknPPGLQbdt950A3kusOpSgNUGjb3ntNgIT9ZAfWR3oFY11N6A5CyCyk3FqOOegIhGFaGZa8XQx2dcbpmFHLiY62bsRiixJeaeTAf9NhFHhyiZsndGjDM6ifGEDnch9226vP02ddDpIv2EZuvYf7IRaPfCpViuj9vZPl3i3UtKysdTmXrlolrertnAY7iRmdOVGOTbi3n56qqWn0Q4puwbb1BnEktWjbZnSZezCBcMUk5lHWjpH2b9trG4j6deZAogZY9X4jAWCbE6bskFMzWRzxhUdyxwfUgMaR3Jly7pG0CtAqBgKeAU1JSnnSYJem7HXWEKGBCNV26jtiFUhtDhK0JlP49pfiX314ouhL6Jx3Q4AfSOYBPwXZIiIsWDnhuwBd4Slz6BHmLbM8LASbyrhCP7TmVvL5YYlcJK66oWNZZAv0ql3E50TPGOp8IIMCRamaW0xSE1pbtowUX1A5jUWVdhXkdUv2H8JOMzQ513dtRuMraOR6enmaX49XFx75A6pYSDTsck71RqIIjDwuOPaHNnGpAKe6yUuDDWOqQJaZDLAVVDEoL0r1KVRDu544tVWmfHADI9FJvM6mYlDP203icdJfq4eoEcgOvEZkEMPF74wQraQuqgr4RD53NDehE6YijNyeKQcf8e2ZML1hiqfhvrYTi8jr84AEkm8hSNaTyE0yaaCsiMyC6R7mzH6BA1QIV3rG2zXHmm9mG1yToCAKTgY33v5lDV7dMR0tk12uB0wToq9CkyuIzZncGVipZf10YDl76sYvrsIoZdBpoUzDn7olPDlkKTd1IfhG7t5yfk4cokxrFU7prrR633j4rJJ0XbaOkKZ2hUip01hL0L6eLE3wgpsqzXUwDQFSkC6zn8YKoUWsTlpWOstGkITalccjnzPRNhmFDD4qbJj5YZwbmWcGaSw8KWaoF2RTzHRzZq0Bw5yKfajPEK4cg55IODlgU6e9iAUtJlFfJJpkbfDTBKzGBXjV6gAh4fEOt0fqC4Iow50AFu7uVFBlBnhJh5xmHHDNkfN9zmEBzC1uEvc83fPuliF5gfTWrO49OUJTBpkaObITIMXC7700cdPXLGkFHmcKOoF7jCoHFql5NVH8REy10ep2wBKAJ2watRYM5lrSmCsStPd64xy95xNGVVBJpkoLcc50i0AjO4ljmOPKDDQ0deByPOnOS9sB8U6J0pBZhDkHyjNs7TloGg8Ci8zRTdyYj2PUcsIkCAFCQ7tMRWfsIZaxREwgb9gML0xdRkCjFtjBp0wBZcCaU2142fuuB50raG5WvDWNLvpoISwvaORb6pJb1fXnCKkHbj0wvzz5hnyTFo85hAf72LwoXGUgtT1b3pejAqZhcadtuq2PD8VigXpkuoIEumtgsDNuxFre3sb6kdjHV1j3rXHFFrnbIVYvk6nzMCuCG5ro66fNCKZ63862ecLKIsc18DPpZvQJYaaT5So3R8BH4ReCRS8dMe0h5dutTQf0hXzm2Hh8o9JHcRs9dVkfl2AAoJOQt0HeNws0DgQSEP5MqvYhAOwj5C6JjjiXDpGusZ0251sDsX1FI5s8ixy9qgCzsUaaAjNC9Y6c3ZNvEM0JePPcJlcnA7S26z8LREO9Flk9z4Fklct6jnsAuABgeXFd2reGqTCTUHzbrFQG4mm7ZQcEPcIbWxESHqM21dZIuswEO4aNt6Tc05mth2stHSWOohT1P8K24aHHRsOJ5nhHv3BMY5Q2REMKfflc3uDTEH6K9h49c16WSPI3pJ9ef1vUdG5jvWVEdytSEjOKodkxEubV0FavvIeY1hQ6465jqNSrL7pWnn9plUf97CMKNfDyDuacNF8d5Px3RBng0Hy6BNF1halJ9SUgTpmHgRy05Qmld1brOcL6wpRi4DQW7zYfMpZV7ECv6SnrNUkHiGPlgdxiner1Hh00i3QWacXLei6xUcwfOXi603EusJi89D245cQW0sRyKsWhxxeOouoZrcgmS96k7bOUy9mRJLJH8FkXQxN7Mo2um0JEVPVB4SykGV2MZwkewokE2WhVy9C2HD6VKXLQaWJlHemwnZ9rpsOGYYoPdsCjySNjGd2CVZLnpqOPoxxvMopQNwCcbwe1H2AIY53M90r5KcHXNJRZlNAiaBRy7znFdwyeX7Mv1zHLAR9SJnvbxbzCQKC0iNg7Mj57aIDCCJxFmFRSCzkifKnUEuhFiiVy3XJoAAcvnlKOnAHMBl2jZgztcffLCit1cjFpT0bbYelwvbJbtvirXQEv5QZSrHDKXzaDozgY9Ag0t2WDGBMRoKlhxLukVejgF0wQb8f3YXAElcOD7IxlNTGD9me2hX5swtq9xgSr0IPbYZB28Et6sjVJWGkmCQ4YEICSPuaO5wfUPt1CuZ1HWgIOofjTqLHLnzrqSjjVV79h5Ot7IbmiqBESUI5Ty07S9fHccqJgolSUvrJmBKa87jonPLnFMdV4Db1UcoIX0zOdYvqU3nNpvNYDSezXSnwZ9J8qm5WgfSboCJQWP3meWq5rrPEbKm22EWcUewAjYp7RiQ2Do9K8vI25jsAxynNLCCxoCgk0B0FBLmp5BYqf1njSc7V1qyIzJJomearw8XWnajGGvyii4ROkfnQcZ2kdDmDlVMDp0G9Y4lHppCP4cSTl2As0VOgwKCmLgYX859U7DYh68CjJoI1lnCcGSy3sTU3bghXQnNMZ6nvoq7eZptxMrJ4MYFSN4mAmocZWDeXZtp5fYFyZ8sTMZLZVQ5LOtGcOEGYz1IA27mgI9fhzSdkJCWViaowKrNBMvrP1jdGZ5hxW92igmdkvEPGwpER3TbQDmdsvERD7vPxPb1VIV47KRyyvS1lCpM6ztD462lM9W9yr3MFzTSzPtUVKqeXZZkK4oZK24uIJma1xT90F3zMQy301EXO3jZaRAu6CFka7o46RFd3vbyhRjSW71r0MUcbe57jx4C6iGjoWoygPKMwHIVZkRwfqVmZGiH1Un1jhEmaE8j8Sq5zyqQ7eFwY8f1c1OWKSNgcwvDZPI5YF5IofLyFDBB1QvrJ60AvmIwyC2yCPFClLM1N884LhEpl0pYmdekpybfockgSLwJkYQ0JXvqtQiwVRmxxZjYgRjq5DNm9GK8VOFDXKhskfbUBJtBba1ONtI7Ge7L3bCvKFB3tV8zPM6jGHPzZCqe0xYT4ZoiXhZ6UzEfKA5WHRRh5ORGWfdmpxKvd4bIIsT9flR3mXxCWRoHtdlzd9vfNdxgsbgsxc7Eo5Y5GQjfDMYxpGE6u3vjpeeT80S10tF4akNK0m8smWjOeVGWQkeVlOh0TBtGFPH76MdHMSfFhNci9BvHTlqgC1pur7CpasLu1cqC2oB462ZQdEwTDHoI2PBk1zb0iuGVDngYTK6LmEPuq6zhPlT9tNlcjnbLbnIf4PGdERPZM8gZ8klAV4t1CEWHcBt5umWI8HyMGHdAl13kMvzVK1bhcxoUdNxu9zSeg2OZVdvxIugLt79Kd2lB8IZN6X3bziZ5r1b9CerKwGLqmEuQlL1mmtmEtNodc4Gftg4TEvbRhXDSXTQBOmGeBi1gascCKEO3ofFeYfreW4VZh2uTULrs3j75mOmQ4jV1HLI3tt6PWXJlm9chpRqPTIl8luoZJRmG9yvSKaAkYoakKJBWI9fxatqlBBPx9mcDa2wfFKzJvOLF9AkGHMcZUx3yQ0EMEcEFRY9xmH2u9gUxRSzZ5mxU0k8Fq4n59aovBOX7DMNk3pHZsYKpU1B65YKgm6zi9mRoedHEv2bJwVVtJ5uRGCM7EF3eIN1nRFl9LvWnEsKpxGzvNXTszc4Ymn8PFhE7taVxb5N7BhcFbJo9KqsP9JF2Nr1Iz2LQ3yAT0Nlem1H1OS1GlpKMKs0aNlERRgdjgG27jpSo1BatvE0uf9v5bVZIN4j9QGLwRNTE3ykEbw7eD9wj4m4P99YM9WmF29U2agKfilZDG14iVEzz8P5XfnNLT9uIhgcmvKguTKQEbHjAkq9hg3bzjksPEj386FqHo0U8Hhe9MUACgnmSLlM2PIAdEu1Z02qSolNkNLigCI3e07dN8YksOf4yE9UHpqh794HwaMcaz7uDQ6kSqSdknPPGLQbdt950A3kusOpSgNUGjb3ntNgIT9ZAfWR3oFY11N6A5CyCyk3FqOOegIhGFaGZa8XQx2dcbpmFHLiY62bsRiixJeaeTAf9NhFHhyiZsndGjDM6ifGEDnch9226vP02ddDpIv2EZuvYf7IRaPfCpViuj9vZPl3i3UtKysdTmXrlolrertnAY7iRmdOVGOTbi3n56qqWn0Q4puwbb1BnEktWjbZnSZezCBcMUk5lHWjpH2b9trG4j6deZAogZY9X4jAWCbE6bskFMzWRzxhUdyxwfUgMaR3Jly7pG0CtAqBgKeAU1JSnnSYJem7HXWEKGBCNV26jtiFUhtDhK0JlP49pfiX314ouhL6Jx3Q4AfSOYBPwXZIiIsWDnhuwBd4Slz6BHmLbM8LASbyrhCP7TmVvL5YYlcJK66oWNZZAv0ql3E50TPGOp8IIMCRamaW0xSE1pbtowUX1A5jUWVdhXkdUv2H8JOMzQ513dtRuMraOR6enmaX49XFx75A6pYSDTsck71RqIIjDwuOPaHNnGpAKe6yUuDDWOqQJaZDLAVVDEoL0r1KVRDu544tVWmfHADI9FJvM6mYlDP203icdJfq4eoEcgOvEZkEMPF74wQraQuqgr4RD53NDehE6YijNyeKQcf8e2ZML1hiqfhvrYTi8jr84AEkm8hSNaTyE0yaaCsiMyC6R7mzH6BA1QIV3rG2zXHmm9mG1yToCAKTgY33v5lDV7dMR0tk12uB0wToq9CkyuIzZncGVipZf10YDl76sYvrsIoZdBpoUzDn7olPDlkKTd1IfhG7t5yfk4cokxrFU7prrR633j4rJJ0XbaOkKZ2hUip01hL0L6eLE3wgpsqzXUwDQFSkC6zn8YKoUWsTlpWOstGkITalccjnzPRNhmFDD4qbJj5YZwbmWcGaSw8KWaoF2RTzHRzZq0Bw5yKfajPEK4cg55IODlgU6e9iAUtJlFfJJpkbfDTBKzGBXjV6gAh4fEOt0fqC4Iow50AFu7uVFBlBnhJh5xmHHDNkfN9zmEBzC1uEvc83fPuliF5gfTWrO49OUJTBpkaObITIMXC7700cdPXLGkFHmcKOoF7jCoHFql5NVH8REy10ep2wBKAJ2watRYM5lrSmCsStPd64xy95xNGVVBJpkoLcc50i0AjO4ljmOPKDDQ0deByPOnOS9sB8U6J0pBZhDkHyjNs7TloGg8Ci8zRTdyYj2PUcsIkCAFCQ7tMRWfsIZaxREwgb9gML0xdRkCjFtjBp0wBZcCaU2142fuuB50raG5WvDWNLvpoISwvaORb6pJb1fXnCKkHbj0wvzz5hnyTFo85hAf72LwoXGUgtT1b3pejAqZhcadtuq2PD8VigXpkuoIEumtgsDNuxFre3sb6kdjHV1j3rXHFFrnbIVYvk6nzMCuCG5ro66fNCKZ63862ecLKIsc18DPpZvQJYaaT5So3R8BH4ReCRS8dMe0h5dutTQf0hXzm2Hh8o9JHcRs9dVkfl2AAoJOQt0HeNws0DgQSEP5MqvYhAOwj5C6JjjiXDpGusZ0251sDsX1FI5s8ixy9qgCzsUaaAjNC9Y6c3ZNvEM0JePPcJlcnA7S26z8LREO9Flk9z4Fklct6jnsAuABgeXFd2reGqTCTUHzbrFQG4mm7ZQcEPcIbWxESHqM21dZIuswEO4aNt6Tc05mth2stHSWOohT1P8K24aHHRsOJ5nhHv3BMY5Q2REMKfflc3uDTEH6K9h49c16WSPI3pJ9ef1vUdG5jvWVEdytSEjOKodkxEubV0FavvIeY1hQ6465jqNSrL7pWnn9plUf97CMKNfDyDuacNF8d5Px3RBng0Hy6BNF1halJ9SUgTpmHgRy05Qmld1brOcL6wpRi4DQW7zYfMpZV7ECv6SnrNUkHiGPlgdxiner1Hh00i3QWacXLei6xUcwfOXi603EusJi89D245cQW0sRyKsWhxxeOouoZrcgmS96k7bOUy9mRJLJH8FkXQxN7Mo2um0JEVPVB4SykGV2MZwkewokE2WhVy9C2HD6VKXLQaWJlHemwnZ9rpsOGYYoPdsCjySNjGd2CVZLnpqOPoxxvMopQNwCcbwe1H2AIY53M90r5KcHXNJRZlNAiaBRy7znFdwyeX7Mv1zHLAR9SJnvbxbzCQKC0iNg7Mj57aIDCCJxFmFRSCzkifKnUEuhFiiVy3XJoAAcvnlKOnAHMBl2jZgztcffLCit1cjFpT0bbYelwvbJbtvirXQEv5QZSrHDKXzaDozgY9Ag0t2WDGBMRoKlhxLukVejgF0wQb8f3YXAElcOD7IxlNTGD9me2hX5swtq9xgSr0IPbYZB28Et6sjVJWGkmCQ4YEICSPuaO5wfUPt1CuZ1HWgIOofjTqLHLnzrqSjjVV79h5Ot7IbmiqBESUI5Ty07S9fHccqJgolSUvrJmBKa87jonPLnFMdV4Db1UcoIX0zOdYvqU3nNpvNYDSezXSnwZ9J8qm5WgfSboCJQWP3meWq5rrPEbKm22EWcUewAjYp7RiQ2Do9K8vI25jsAxynNLCCxoCgk0B0FBLmp5BYqf1njSc7V1qyIzJJomearw8XWnajGGvyii4ROkfnQcZ2kdDmDlVMDp0G9Y4lHppCP4cSTl2As0VOgwKCmLgYX859U7DYh68CjJoI1lnCcGSy3sTU3bghXQnNMZ6nvoq7eZptxMrJ4MYFSN4mAmocZWDeXZtp5fYFyZ8sTMZLZVQ5LOtGcOEGYz1IA27mgI9fhzSdkJCWViaowKrNBMvrP1jdGZ5hxW92igmdkvEPGwpER3TbQDmdsvERD7vPxPb1VIV47KRyyvS1lCpM6ztD462lM9W9yr3MFzTSzPtUVKqeXZZkK4oZK24uIJma1xT90F3zMQy301EXO3jZaRAu6CFka7o46RFd3vbyhRjSW71r0MUcbe57jx4C6iGjoWoygPKMwHIVZkRwfqVmZGiH1Un1jhEmaE8j8Sq5zyqQ7eFwY8f1c1OWKSNgcwvDZPI5YF5IofLyFDBB1QvrJ60AvmIwyC2yCPFClLM1N884LhEpl0pYmdekpybfockgSLwJkYQ0JXvqtQiwVRmxxZjYgRjq5DNm9GK8VOFDXKhskfbUBJtBba1ONtI7Ge7L3bCvKFB3tV8zPM6jGHPzZCqe0xYT4ZoiXhZ6UzEfKA5WHRRh5ORGWfdmpxKvd4bIIsT9flR3mXxCWRoHtdlzd9vfNdxgsbgsxc7Eo5Y5GQjfDMYxpGE6u3vjpeeT80S10tF4akNK0m8smWjOeVGWQkeVlOh0TBtGFPH76MdHMSfFhNci9BvHTlqgC1pur7CpasLu1cqC2oB462ZQdEwTDHoI2PBk1zb0iuGVDngYTK6LmEPuq6zhPlT9tNlcjnbLbnIf4PGdERPZM8gZ8klAV4t1CEWHcBt5umWI8HyMGHdAl13kMvzVK1bhcxoUdNxu9zSeg2OZVdvxIugLt79Kd2lB8IZN6X3bziZ5r1b9CerKwGLqmEuQlL1mmtmEtNodc4Gftg4TEvbRhXDSXTQBOmGeBi1gascCKEO3ofFeYfreW4VZh2uTULrs3j75mOmQ4jV1HLI3tt6PWXJlm9chpRqPTIl8luoZJRmG9yvSKaAkYoakKJBWI9fxatqlBBPx9mcDa2wfFKzJvOLF9AkGHMcZUx3yQ0EMEcEFRY9xmH2u9gUxRSzZ5mxU0k8Fq4n59aovBOX7DMNk3pHZsYKpU1B65YKgm6zi9mRoedHEv2bJwVVtJ5uRGCM7EF3eIN1nRFl9LvWnEsKpxGzvNXTszc4Ymn8PFhE7taVxb5N7BhcFbJo9KqsP9JF2Nr1Iz2LQ3yAT0Nlem1H1OS1GlpKMKs0aNlERRgdjgG27jpSo1BatvE0uf9v5bVZIN4j9QGLwRNTE3ykEbw7eD9wj4m4P99YM9WmF29U2agKfilZDG14iVEzz8P5XfnNLT9uIhgcmvKguTKQEbHjAkq9hg3bzjksPEj386FqHo0U8Hhe9MUACgnmSLlM2PIAdEu1Z02qSolNkNLigCI3e07dN8YksOf4yE9UHpqh794HwaMcaz7uDQ6kSqSdknPPGLQbdt950A3kusOpSgNUGjb3ntNgIT9ZAfWR3oFY11N6A5CyCyk3FqOOegIhGFaGZa8XQx2dcbpmFHLiY62bsRiixJeaeTAf9NhFHhyiZsndGjDM6ifGEDnch9226vP02ddDpIv2EZuvYf7IRaPfCpViuj9vZPl3i3UtKysdTmXrlolrertnAY7iRmdOVGOTbi3n56qqWn0Q4puwbb1BnEktWjbZnSZezCBcMUk5lHWjpH2b9trG4j6deZAogZY9X4jAWCbE6bskFMzWRzxhUdyxwfUgMaR3Jly7pG0CtAqBgKeAU1JSnnSYJem7HXWEKGBCNV26jtiFUhtDhK0JlP49pfiX314ouhL6Jx3Q4AfSOYBPwXZIiIsWDnhuwBd4Slz6BHmLbM8LASbyrhCP7TmVvL5YYlcJK66oWNZZAv0ql3E50TPGOp8IIMCRamaW0xSE1pbtowUX1A5jUWVdhXkdUv2H8JOMzQ513dtRuMraOR6enmaX49XFx75A6pYSDTsck71RqIIjDwuOPaHNnGpAKe6yUuDDWOqQJaZDLAVVDEoL0r1KVRDu544tVWmfHADI9FJvM6mYlDP203icdJfq4eoEcgOvEZkEMPF74wQraQuqgr4RD53NDehE6YijNyeKQcf8e2ZML1hiqfhvrYTi8jr84AEkm8hSNaTyE0yaaCsiMyC6R7mzH6BA1QIV3rG2zXHmm9mG1yToCAKTgY33v5lDV7dMR0tk12uB0wToq9CkyuIzZncGVipZf10YDl76sYvrsIoZdBpoUzDn7olPDlkKTd1IfhG7t5yfk4cokxrFU7prrR633j4rJJ0XbaOkKZ2hUip01hL0L6eLE3wgpsqzXUwDQFSkC6zn8YKoUWsTlpWOstGkITalccjnzPRNhmFDD4qbJj5YZwbmWcGaSw8KWaoF2RTzHRzZq0Bw5yKfajPEK4cg55IODlgU6e9iAUtJlFfJJpkbfDTBKzGBXjV6gAh4fEOt0fqC4Iow50AFu7uVFBlBnhJh5xmHHDNkfN9zmEBzC1uEvc83fPuliF5gfTWrO49OUJTBpkaObITIMXC7700cdPXLGkFHmcKOoF7jCoHFql5NVH8REy10ep2wBKAJ2watRYM5lrSmCsStPd64xy95xNGVVBJpkoLcc50i0AjO4ljmOPKDDQ0deByPOnOS9sB8U6J0pBZhDkHyjNs7TloGg8Ci8zRTdyYj2PUcsIkCAFCQ7tMRWfsIZaxREwgb9gML0xdRkCjFtjBp0wBZcCaU2142fuuB50raG5WvDWNLvpoISwvaORb6pJb1fXnCKkHbj0wvzz5hnyTFo85hAf72LwoXGUgtT1b3pejAqZhcadtuq2PD8VigXpkuoIEumtgsDNuxFre3sb6kdjHV1j3rXHFFrnbIVYvk6nzMCuCG5ro66fNC"; main() { int i = 0; while (1) { if(data[i++] == 'a') return; } }
778.4375
12,306
0.993095
4e82512343193a3dd0704427a9887e2a6220ed49
539
h
C
headword.h
mosxuqian/libutils-c
cbed2db901e687417fa3e98a1e7a951eba5dfd4d
[ "MIT" ]
14
2017-03-25T18:22:26.000Z
2022-03-30T08:08:49.000Z
headword.h
xinzsky/libutils-c
cbed2db901e687417fa3e98a1e7a951eba5dfd4d
[ "MIT" ]
null
null
null
headword.h
xinzsky/libutils-c
cbed2db901e687417fa3e98a1e7a951eba5dfd4d
[ "MIT" ]
10
2017-11-12T08:06:08.000Z
2021-07-14T01:45:34.000Z
/* +----------------------------------------------------------------------+ | Author: Xingzhi Liu <dudubird2006@163.com> | +----------------------------------------------------------------------+ */ #ifndef HEADWORD_H #define HEADWORD_H #ifdef __cplusplus extern "C" { #endif void *headword_init(const char *dicdir, int codetype); int headword_extract(void *Dic, const char *content, char *wordbuf, int bufsize, int codetype); void headword_free(void *Dic); #ifdef __cplusplus } #endif #endif
19.962963
97
0.48423
821f10294b820a9d56b7ec3ad8f04b8448ab91b3
4,233
h
C
RecoPixelVertexing/PixelLowPtUtilities/interface/StripSubClusterShapeTrajectoryFilter.h
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-24T19:10:26.000Z
2019-02-19T11:45:32.000Z
RecoPixelVertexing/PixelLowPtUtilities/interface/StripSubClusterShapeTrajectoryFilter.h
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-23T13:40:24.000Z
2019-12-05T21:16:03.000Z
RecoPixelVertexing/PixelLowPtUtilities/interface/StripSubClusterShapeTrajectoryFilter.h
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
5
2018-08-21T16:37:52.000Z
2020-01-09T13:33:17.000Z
#ifndef _StripSubClusterShapeTrajectoryFilter_h_ #define _StripSubClusterShapeTrajectoryFilter_h_ #include <vector> #include <unordered_map> #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "RecoTracker/TkSeedingLayers/interface/SeedComparitor.h" class ClusterShapeHitFilter; class TrackerTopology; class TrackerGeometry; class TrajectoryMeasurement; class TrajectoryStateOnSurface; class MeasurementTrackerEvent; class SiStripNoises; class TTree; namespace edm { class Event; class EventSetup; class ConsumesCollector; } //#define StripSubClusterShapeFilterBase_COUNTERS class StripSubClusterShapeFilterBase { public: StripSubClusterShapeFilterBase(const edm::ParameterSet &iConfig, edm::ConsumesCollector& iC); virtual ~StripSubClusterShapeFilterBase(); protected: void setEventBase(const edm::Event &, const edm::EventSetup &) ; bool testLastHit(const TrackingRecHit *hit, const TrajectoryStateOnSurface &tsos, bool mustProject=false) const ; bool testLastHit(const TrackingRecHit *hit, const GlobalPoint &gpos, const GlobalVector &gdir, bool mustProject=false) const ; // who am i std::string label_; // pass-through of clusters with too many consecutive saturated strips uint32_t maxNSat_; // trimming parameters uint8_t trimMaxADC_; float trimMaxFracTotal_, trimMaxFracNeigh_; // maximum difference after peak finding float maxTrimmedSizeDiffPos_, maxTrimmedSizeDiffNeg_; // peak finding parameters float subclusterWindow_; float seedCutMIPs_, seedCutSN_; float subclusterCutMIPs_, subclusterCutSN_; // layers in which to apply the filter std::array<std::array<uint8_t,10>, 7> layerMask_; #ifdef StripSubClusterShapeFilterBase_COUNTERS mutable uint64_t called_, saturated_, test_, passTrim_, failTooLarge_, passSC_, failTooNarrow_; #endif edm::ESHandle<TrackerGeometry> theTracker; edm::ESHandle<ClusterShapeHitFilter> theFilter; edm::ESHandle<SiStripNoises> theNoise; edm::ESHandle<TrackerTopology> theTopology; }; class StripSubClusterShapeTrajectoryFilter: public StripSubClusterShapeFilterBase, public TrajectoryFilter { public: StripSubClusterShapeTrajectoryFilter(const edm::ParameterSet &iConfig, edm::ConsumesCollector& iC): StripSubClusterShapeFilterBase(iConfig,iC) {} ~StripSubClusterShapeTrajectoryFilter() override {} bool qualityFilter(const TempTrajectory&) const override; bool qualityFilter(const Trajectory&) const override; bool toBeContinued(TempTrajectory&) const override; bool toBeContinued(Trajectory&) const override; std::string name() const override { return "StripSubClusterShapeTrajectoryFilter"; } void setEvent(const edm::Event & e, const edm::EventSetup & es) override { setEventBase(e,es); } protected: using StripSubClusterShapeFilterBase::testLastHit; bool testLastHit(const TrajectoryMeasurement &last) const ; }; class StripSubClusterShapeSeedFilter: public StripSubClusterShapeFilterBase, public SeedComparitor { public: StripSubClusterShapeSeedFilter(const edm::ParameterSet &iConfig, edm::ConsumesCollector& iC) ; ~StripSubClusterShapeSeedFilter() override {} void init(const edm::Event& ev, const edm::EventSetup& es) override { setEventBase(ev,es); } // implemented bool compatible(const TrajectoryStateOnSurface &tsos, SeedingHitSet::ConstRecHitPointer hit) const override ; // not implemented bool compatible(const SeedingHitSet &hits) const override { return true; } bool compatible(const SeedingHitSet &hits, const GlobalTrajectoryParameters &helixStateAtVertex, const FastHelix &helix) const override ; protected: bool filterAtHelixStage_; }; #endif
36.808696
145
0.741791
250dab89ef5c3ecfe783a22e1fbee5c19413df3e
917
h
C
ESMF/src/Infrastructure/Mesh/include/ESMCI_MBMesh_Types.h
joeylamcy/gchp
0e1676300fc91000ecb43539cabf1f342d718fb3
[ "NCSA", "Apache-2.0", "MIT" ]
1
2018-07-05T16:48:58.000Z
2018-07-05T16:48:58.000Z
ESMF/src/Infrastructure/Mesh/include/ESMCI_MBMesh_Types.h
joeylamcy/gchp
0e1676300fc91000ecb43539cabf1f342d718fb3
[ "NCSA", "Apache-2.0", "MIT" ]
1
2022-03-04T16:12:02.000Z
2022-03-04T16:12:02.000Z
ESMF/src/Infrastructure/Mesh/include/ESMCI_MBMesh_Types.h
joeylamcy/gchp
0e1676300fc91000ecb43539cabf1f342d718fb3
[ "NCSA", "Apache-2.0", "MIT" ]
null
null
null
// $Id$ // Earth System Modeling Framework // Copyright 2002-2019, University Corporation for Atmospheric Research, // Massachusetts Institute of Technology, Geophysical Fluid Dynamics // Laboratory, University of Michigan, National Centers for Environmental // Prediction, Los Alamos National Laboratory, Argonne National Laboratory, // NASA Goddard Space Flight Center. // Licensed under the University of Illinois-NCSA License. // //----------------------------------------------------------------------------- #ifndef ESMCI_MBMesh_Types_h #define ESMCI_MBMesh_Types_h // Take out if MOAB isn't being used #if defined ESMF_MOAB namespace ESMCI { typedef unsigned int UInt; typedef unsigned char UChar; typedef unsigned short UShort; typedef unsigned long ULong; // Some promotion traits template<typename T1, typename T2> struct mbmesh_richest_type { typedef T1 value; }; } // namespace #endif #endif
26.2
79
0.716467
f9788665cf71c13613c800bdff36f94330150b85
1,230
h
C
define_mouse.h
shingyo12/multi2
daa9d6ec620af36d4f86da4426e5f4559ca66200
[ "MIT" ]
null
null
null
define_mouse.h
shingyo12/multi2
daa9d6ec620af36d4f86da4426e5f4559ca66200
[ "MIT" ]
null
null
null
define_mouse.h
shingyo12/multi2
daa9d6ec620af36d4f86da4426e5f4559ca66200
[ "MIT" ]
null
null
null
#ifndef __DEFINEHEADER_HEADER__ #define __DEFINEHEADER_HEADER__ #include "iodefine.h" #define LED_1 PORT5.PODR.BIT.B4 #define LED_2 PORT5.PODR.BIT.B5 #define LED_7SEG_1 PORT3.PODR.BIT.B2 #define LED_7SEG_2 PORT3.PODR.BIT.B1 #define LED_7SEG_3 PORT1.PODR.BIT.B4 #define LED_7SEG_4 PORT1.PODR.BIT.B5 #define LED_7SEG_5 PORT1.PODR.BIT.B6 #define LED_7SEG_6 PORT1.PODR.BIT.B7 #define LED_7SEG_7 PORT2.PODR.BIT.B7 #define MOT_R_IN1 PORTB.PODR.BIT.B0 #define MOT_R_IN2 PORTB.PODR.BIT.B1 #define MOT_L_IN1 PORTB.PODR.BIT.B5 #define MOT_L_IN2 PORTB.PODR.BIT.B6 #define MOT_STBY PORTB.PODR.BIT.B7 #define BUZZ_OUT PORTB.PODR.BIT.B3 #define CHIP_LED_ON 0 #define CHIP_LED_OFF 1 #define SW_MODE PORT4.PIDR.BIT.B6 #define SW_RESET PORT4.PIDR.BIT.B1 #define SW_START PORT4.PIDR.BIT.B4 #define CAM_CLK PORTH.PODR.BIT.B0 #define CAM_SI PORTH.PODR.BIT.B1 #define CAM_AOO S12AD.ADDR0 #define SW_ON 0 #define SW_OFF 1 #define RL 24 //L wheel #define RR 24 //R wheel #define WB 98 //wheel base #define GEAR 18/42; #define KP 1 #define KD 1 #define R_ENC -1*MTU1.TCNT #define L_ENC MTU2.TCNT #define PI 3.1415926535 #define DEG2RAD PI/180 //extern short int move=0; #endif
23.207547
37
0.739837
b5c484cbebb6eb6eb534f1aa866cdd992356c686
586
h
C
IANPaintedEggshellDemo/IANPaintedEggshellDemo/IANPaintedEggshell/Manager/IANAppMacros.h
ianisme/PaintedEggshell
09c6515d52d0650d6b7876f9192a0756bcba4635
[ "MIT" ]
null
null
null
IANPaintedEggshellDemo/IANPaintedEggshellDemo/IANPaintedEggshell/Manager/IANAppMacros.h
ianisme/PaintedEggshell
09c6515d52d0650d6b7876f9192a0756bcba4635
[ "MIT" ]
null
null
null
IANPaintedEggshellDemo/IANPaintedEggshellDemo/IANPaintedEggshell/Manager/IANAppMacros.h
ianisme/PaintedEggshell
09c6515d52d0650d6b7876f9192a0756bcba4635
[ "MIT" ]
null
null
null
// // IANAppMacros.h // IANPaintedEggshellDemo // // Created by ian on 16/11/28. // Copyright © 2016年 ian. All rights reserved. // #ifndef IANAppMacros_h #define IANAppMacros_h // 测试正式环境切换 #define PAINTED_EGGSHELL_INDEX @"painted_eggshell_index" #define PAINTED_EGGSHELL_LOG_ISOPEN @"painted_eggshell_log_isopen" #define PAINTED_EGGSHELL_CRASH_LOG_ISOPEN @"painted_eggshell_crash_log_isopen" // 是否集成彩蛋功能 (1为集成,0为不集成)APPStore版本禁止集成,设置为0 #define PAINTED_EGGSHELL_CODE_IS_OPEN 1 #endif /* IANAppMacros_h */
26.636364
91
0.697952
68627d3917a0c732ea3e3e4298fb025c640707ad
2,491
c
C
gempak/source/diaglib/grc/grcacol.c
oxelson/gempak
e7c477814d7084c87d3313c94e192d13d8341fa1
[ "BSD-3-Clause" ]
42
2015-06-03T15:26:21.000Z
2022-02-28T22:36:03.000Z
gempak/source/diaglib/grc/grcacol.c
oxelson/gempak
e7c477814d7084c87d3313c94e192d13d8341fa1
[ "BSD-3-Clause" ]
60
2015-05-11T21:36:08.000Z
2022-03-29T16:22:42.000Z
gempak/source/diaglib/grc/grcacol.c
oxelson/gempak
e7c477814d7084c87d3313c94e192d13d8341fa1
[ "BSD-3-Clause" ]
27
2016-06-06T21:55:14.000Z
2022-03-18T18:23:28.000Z
#include "geminc.h" #include "gemprm.h" void grc_acol ( int *kxin, int *kyin, float *grid, int *kxout, int *kyout, int *iret ) /************************************************************************ * grc_acol * * * * This subroutine adds a column of data to a grid. * * * * This is mainly used for adding a column to grids on cylindrical * * projections. The data should be a global grid which does not * * completely wrap around the earth, but is only one grid point short. * * This routine will then repeat the first column of data as the last * * column in order to achieve a complete wrap. * * * * grc_acol ( *kxin, *kyin, grid, kxout, kyout, iret ) * * * * Input parameters: * * *kxin const int Number of input points in x dir * * *kyin const int Number of input points in y dir * * * * Input and output parameters: * * *grid float Grid of data * * * * Output parameters: * * *kxout int Number of output points in x dir* * *kyout int Number of output points in y dir* * *iret int Return code * ** * * Log: * * K. Brill/NMC 03/93 * * S. Jacobs/EAI 11/93 Adapted from GR_RARG * * D.W.Plummer/NCEP 12/05 Translated from FORTRAN * ************************************************************************/ { /*----------------------------------------------------------------------*/ gr_acol ( kxin, kyin, grid, kxout, kyout, iret ); return; }
57.930233
74
0.30831
be5e6992235ba45db89151c738011b97927822f5
285
h
C
LongPressTableCell/UIButton+category.h
410900345/LongPressTableDemo
ca1dfbcb2d64f78b8bb10c1bce123b334e551604
[ "MIT" ]
1
2016-03-19T14:06:45.000Z
2016-03-19T14:06:45.000Z
LongPressTableCell/UIButton+category.h
410900345/LongPressTableDemo
ca1dfbcb2d64f78b8bb10c1bce123b334e551604
[ "MIT" ]
null
null
null
LongPressTableCell/UIButton+category.h
410900345/LongPressTableDemo
ca1dfbcb2d64f78b8bb10c1bce123b334e551604
[ "MIT" ]
null
null
null
// // UIButton+category.h // LongPressTable // // Created by jiuhao-yangshuo on 16/3/18. // Copyright © 2016年 jiuhao. All rights reserved. // #import <UIKit/UIKit.h> @interface UIButton (category) - (void)setIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)indexPath; @end
16.764706
50
0.698246
3b0c932b05066628039d8153aea8c97f9b2f87f9
242
h
C
libnavi/include/RequestManageListener.h
rm-medina/agl-service-navigation
b9fa50ad33af4c3425d7198beaa63b783da2f62c
[ "Apache-2.0" ]
null
null
null
libnavi/include/RequestManageListener.h
rm-medina/agl-service-navigation
b9fa50ad33af4c3425d7198beaa63b783da2f62c
[ "Apache-2.0" ]
null
null
null
libnavi/include/RequestManageListener.h
rm-medina/agl-service-navigation
b9fa50ad33af4c3425d7198beaa63b783da2f62c
[ "Apache-2.0" ]
4
2017-12-12T03:59:55.000Z
2019-03-12T19:47:26.000Z
// Copyright 2017 AISIN AW CO.,LTD #pragma once #include <json-c/json.h> class RequestManageListener { public: RequestManageListener() { } virtual ~RequestManageListener() { } virtual void OnReply(struct json_object *reply) = 0; };
13.444444
53
0.719008
3b244733fafc99d99742ce71f71c4066bccef91a
1,529
h
C
unittests/mock_mailstore.h
JonathanGuthrie/wodin
bef3d5f0fa65f2148e7d8fb52606191689023bb0
[ "Apache-2.0" ]
3
2015-05-06T16:56:14.000Z
2017-03-22T05:25:21.000Z
unittests/mock_mailstore.h
JonathanGuthrie/wodin
bef3d5f0fa65f2148e7d8fb52606191689023bb0
[ "Apache-2.0" ]
null
null
null
unittests/mock_mailstore.h
JonathanGuthrie/wodin
bef3d5f0fa65f2148e7d8fb52606191689023bb0
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2013 Jonathan R. Guthrie * * 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. */ #if !defined(MOCK_MAILSTORE_INCLUDED) #define MOCK_MAILSTORE_INCLUDED class MockMailstore : public Namespace { public: MockMailstore(void) : Namespace(NULL) {} MOCK_METHOD1(lock, MailStore::MAIL_STORE_RESULT(const std::string &)); MOCK_METHOD1(unlock, MailStore::MAIL_STORE_RESULT(const std::string &)); MOCK_METHOD6(addMessageToMailbox, MailStore::MAIL_STORE_RESULT(const std::string &MailboxName, const uint8_t *data, size_t length, DateTime &createTime, uint32_t messageFlags, size_t *newUid)); MOCK_METHOD4(appendDataToMessage, MailStore::MAIL_STORE_RESULT(const std::string &MailboxName, size_t uid, const uint8_t *data, size_t length)); MOCK_METHOD2(doneAppendingDataToMessage, MailStore::MAIL_STORE_RESULT(const std::string &MailboxName, size_t uid)); }; #endif // !defined(MOCK_MAILSTORE_INCLUDED)
36.404762
77
0.720078
b3c65ff2ffc6d3d92ad57894b36486c92232eea7
5,948
c
C
src/string.c
sallecta/sparrow
74da31d6ff166ef3f7bb1035ea381316261f8460
[ "PSF-2.0" ]
null
null
null
src/string.c
sallecta/sparrow
74da31d6ff166ef3f7bb1035ea381316261f8460
[ "PSF-2.0" ]
2
2019-10-05T12:48:52.000Z
2019-10-05T13:04:00.000Z
src/string.c
sallecta/sparrow
74da31d6ff166ef3f7bb1035ea381316261f8460
[ "PSF-2.0" ]
null
null
null
/* File: String * String handling functions. */ /* * Create a new empty string of a certain size. * Does not put it in for GC tracking, since contents should be * filled after returning. */ type_vmObj vm_string_new(type_vm *tp, int n) { type_vmObj r = vm_string_n(0,n); r.string.info = (type_vmString*)calloc(sizeof(type_vmString)+n,1);/*calloc((x),1)*/ r.string.info->len = n; r.string.val = r.string.info->s; return r; } /* * Create a new string which is a copy of some memory. * This is put into GC tracking for you. */ type_vmObj vm_string_copy(type_vm *tp, const char *s, int n) { type_vmObj r = vm_string_new(tp,n); memcpy(r.string.info->s,s,n); return vm_gc_track(tp,r); } /* * Create a new string which is a substring slice of another STRING. * Does not need to be put into GC tracking, as its parent is * already being tracked (supposedly). */ type_vmObj vm_string_substring(type_vm *tp, type_vmObj s, int a, int b) { int l = s.string.len; a = vm_max(0,(a<0?l+a:a)); b = vm_min(l,(b<0?l+b:b)); type_vmObj r = s; r.string.val += a; r.string.len = b-a; return r; } type_vmObj vm_string_printf(type_vm *tp, char const *fmt,...) { int l; type_vmObj r; char *s; va_list arg; va_start(arg, fmt); l = vsnprintf(NULL, 0, fmt,arg); r = vm_string_new(tp,l); s = r.string.info->s; va_end(arg); va_start(arg, fmt); vsprintf(s,fmt,arg); va_end(arg); return vm_gc_track(tp,r); } int vm_string_index(type_vmObj s, type_vmObj k) { int i=0; while ((s.string.len - i) >= k.string.len) { if (memcmp(s.string.val+i,k.string.val,k.string.len) == 0) { return i; } i += 1; } return -1; } type_vmObj vm_string_join(type_vm *tp) { type_vmObj delim = vm_operations_get(tp,tp->params,vm_none); type_vmObj val = vm_operations_get(tp,tp->params,vm_none); int l=0,i; type_vmObj r; char *s; for (i=0; i<val.list.val->len; i++) { if (i!=0) { l += delim.string.len; } l += vm_operations_str(tp,val.list.val->items[i]).string.len; } r = vm_string_new(tp,l); s = r.string.info->s; l = 0; for (i=0; i<val.list.val->len; i++) { type_vmObj e; if (i!=0) { memcpy(s+l,delim.string.val,delim.string.len); l += delim.string.len; } e = vm_operations_str(tp,val.list.val->items[i]); memcpy(s+l,e.string.val,e.string.len); l += e.string.len; } return vm_gc_track(tp,r); } type_vmObj vm_string_split(type_vm *tp) { type_vmObj v = vm_operations_get(tp,tp->params,vm_none); type_vmObj d = vm_operations_get(tp,tp->params,vm_none); type_vmObj r = vm_list(tp); int i; while ((i=vm_string_index(v,d))!=-1) { vm_list_append(tp,r.list.val,vm_string_substring(tp,v,0,i)); v.string.val += i + d.string.len; v.string.len -= i + d.string.len; } vm_list_append(tp,r.list.val,vm_string_substring(tp,v,0,v.string.len)); return r; } type_vmObj vm_string_find(type_vm *tp) { type_vmObj s = vm_operations_get(tp,tp->params,vm_none); type_vmObj v = vm_operations_get(tp,tp->params,vm_none); return vm_create_numericObj(vm_string_index(s,v)); } type_vmObj vm_string_obj_index(type_vm *tp) { type_vmObj s = vm_operations_get(tp,tp->params,vm_none); type_vmObj v = vm_operations_get(tp,tp->params,vm_none); int n = vm_string_index(s,v); if (n >= 0) { return vm_create_numericObj(n); } vm_raise(0,vm_string("(vm_string_obj_index) ValueError: substring not found")); return vm_none; } type_vmObj vm_string_str2(type_vm *tp) { type_vmObj v = vm_operations_get(tp,tp->params,vm_none); return vm_operations_str(tp,v); } type_vmObj vm_string_chr(type_vm *tp) { int v = vm_typecheck(tp,vm_enum1_number,vm_operations_get(tp,tp->params,vm_none)).number.val; return vm_string_n(tp->chars[(unsigned char)v],1); } type_vmObj vm_string_ord(type_vm *tp) { type_vmObj s = vm_typecheck(tp,vm_enum1_string,vm_operations_get(tp,tp->params,vm_none)); if (s.string.len != 1) { vm_raise(0,vm_string("(vm_string_ord) TypeError: ord() expected a character")); } return vm_create_numericObj((unsigned char)s.string.val[0]); } type_vmObj vm_string_strip(type_vm *tp) { type_vmObj o = vm_typecheck(tp,vm_enum1_string,vm_operations_get(tp,tp->params,vm_none)); char const *v = o.string.val; int l = o.string.len; int i; int a = l, b = 0; type_vmObj r; char *s; for (i=0; i<l; i++) { if (v[i] != ' ' && v[i] != '\n' && v[i] != '\t' && v[i] != '\r') { a = vm_min(a,i); b = vm_max(b,i+1); } } if ((b-a) < 0) { return vm_string(""); } r = vm_string_new(tp,b-a); s = r.string.info->s; memcpy(s,v+a,b-a); return vm_gc_track(tp,r); } type_vmObj vm_string_replace(type_vm *tp) { type_vmObj s = vm_operations_get(tp,tp->params,vm_none); type_vmObj k = vm_operations_get(tp,tp->params,vm_none); type_vmObj v = vm_operations_get(tp,tp->params,vm_none); type_vmObj p = s; int i,n = 0; int c; int l; type_vmObj rr; char *r; char *d; type_vmObj z; while ((i = vm_string_index(p,k)) != -1) { n += 1; p.string.val += i + k.string.len; p.string.len -= i + k.string.len; } /* fprintf(stderr,"ns: %d\n",n); */ l = s.string.len + n * (v.string.len-k.string.len); rr = vm_string_new(tp,l); r = rr.string.info->s; d = r; z = p = s; while ((i = vm_string_index(p,k)) != -1) { p.string.val += i; p.string.len -= i; memcpy(d,z.string.val,c=(p.string.val-z.string.val)); d += c; p.string.val += k.string.len; p.string.len -= k.string.len; memcpy(d,v.string.val,v.string.len); d += v.string.len; z = p; } memcpy(d,z.string.val,(s.string.val + s.string.len) - z.string.val); return vm_gc_track(tp,rr); }
30.979167
97
0.617014
8302b1931cb053d533ad4583ddd7414b4fb4a3a5
5,212
c
C
redismq.c
ancurabiez/redismq
fdd96cf9ec5462d0b61e41620ad2008f876db85f
[ "BSD-3-Clause" ]
1
2016-08-14T08:06:33.000Z
2016-08-14T08:06:33.000Z
redismq.c
ancurabiez/redismq
fdd96cf9ec5462d0b61e41620ad2008f876db85f
[ "BSD-3-Clause" ]
null
null
null
redismq.c
ancurabiez/redismq
fdd96cf9ec5462d0b61e41620ad2008f876db85f
[ "BSD-3-Clause" ]
1
2019-05-17T01:32:31.000Z
2019-05-17T01:32:31.000Z
/*********************************************/ /*** Copyright (c) 2014, Lulus Wijayakto ***/ /*** ***/ /*** Email : l.wijayakto@yahoo.com ***/ /*** l.wijayakto@gmail.com ***/ /*** ***/ /*** License: BSD 3-Clause /*********************************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <assert.h> #include "redismq.h" rmqContext* rmq_connect(const char *path_host, int port, int timeout, char **err, int flag) { struct timeval tv; rmqContext *rContext; int i; tv.tv_sec = timeout; tv.tv_usec = 0; rContext = je_malloc(sizeof(struct rmqContext)); assert (rContext); memset (rContext, 0, sizeof(struct rmqContext)); rContext->host = je_malloc(16); assert (rContext->host); memset(rContext->host, 0, 16); memcpy(rContext->host, path_host, 15); rContext->port = port; rContext->flag = flag; if (flag == UNIX_SOCKET) rContext->rctx = redisConnectUnixWithTimeout(path_host, tv); else rContext->rctx = redisConnectWithTimeout(path_host, port, tv); if (!rContext->rctx || rContext->rctx->err) { char b1[128]; if (rContext->rctx) { snprintf(b1, 128, "Queue connection error: %s\n", rContext->rctx->errstr); redisFree(rContext->rctx); i = strlen(b1); *err = je_malloc(i + 1); assert(*err); memset(*err, 0, i); memcpy(*err, b1, i); return NULL; } else { snprintf(b1, 128, "Queue connection error: can't " "allocate redis context\n"); i = strlen(b1); *err = je_malloc(i + 1); assert(*err); memset(*err, 0, i); memcpy(*err, b1, i); return NULL; } } return rContext; } void rmq_free(rmqContext *rctx) { redisFree(rctx->rctx); je_free(rctx->host); je_free(rctx); } /* reconnect */ static void rmq_reconnect(rmqContext **rctx) { rmqContext *rctx__ = NULL; char *err; char host__[16]; int i = 0; int port__; int flag__; memset (host__, 0, 16); memcpy(host__, (*rctx)->host, strlen((*rctx)->host)); port__ = (*rctx)->port; flag__ = (*rctx)->flag; rmq_free(*rctx); // trying reconnect till 60 times while (1) { rctx__ = rmq_connect(host__, port__, 1, &err, flag__); if (!rctx__) { i++; if (i >= 60) //give up exit(1); je_free(err); sleep(1); } else break; } *rctx = rctx__; } /* return : NULL if error */ char* rmq_get(rmqContext **rctx, const char *key, int timeout) { redisReply *rep = NULL; char *res = NULL; if (timeout > 0) rep = redisCommand((*rctx)->rctx, "BLPOP redismq:%s %d", key, timeout); else rep = redisCommand((*rctx)->rctx, "LPOP redismq:%s", key); if (!rep) { rmq_reconnect(rctx); // re-execute if (timeout > 0) rep = redisCommand((*rctx)->rctx, "BLPOP redismq:%s %d", key, timeout); else rep = redisCommand((*rctx)->rctx, "LPOP redismq:%s", key); } if ((rep->type == REDIS_REPLY_STRING) && (rep->elements == 0)) { if (rep->str) { res = je_malloc(rep->len); assert(res); memcpy(res, rep->str, rep->len); } } else if ((rep->type == REDIS_REPLY_ARRAY) && (rep->elements == 2)) { if (rep->element[1]->str) { res = je_malloc(rep->element[1]->len); assert (res); memcpy(res, rep->element[1]->str, rep->element[1]->len); } } freeReplyObject(rep); return res; } /* return : 1 on success */ /* 0 on error */ int rmq_put(rmqContext **rctx, const char *key, char *val, int val_len) { redisReply *rep = NULL; int ret = 0; rep = redisCommand((*rctx)->rctx, "RPUSH redismq:%s %b", key, val, val_len); if (!rep) { rmq_reconnect(rctx); //re-execute rep = redisCommand((*rctx)->rctx, "RPUSH redismq:%s %b", key, val, val_len); } if (rep->type == REDIS_REPLY_INTEGER) ret = 1; freeReplyObject(rep); return ret; } int rmq_setter(rmqContext **rctx, const char *key, int expired, char *val, int val_len) { redisReply *rep = NULL; int ret = 0; rep = redisCommand((*rctx)->rctx, "SETEX %s %d %b", key, expired, val, val_len); if (!strcmp(rep->str, "OK")) ret = 1; freeReplyObject(rep); return ret; } int rmq_del(rmqContext **rctx, const char *key) { redisReply *rep = NULL; int ret = 0; rep = redisCommand((*rctx)->rctx, "DEL %s", key); if (rep->integer > 0) ret = 1; freeReplyObject(rep); return ret; } char* rmq_getter(rmqContext **rctx, const char *key) { redisReply *rep = NULL; char *res = NULL; rep = redisCommand((*rctx)->rctx, "GET %s", key); if (rep->len > 0) { if (rep->str) { res = je_malloc(rep->len); assert(res); memcpy(res, rep->str, rep->len); } } freeReplyObject(rep); return res; }
21.807531
83
0.528204
7e6f809be050d7e6864d3d5c46a7eb84758592f8
2,362
c
C
cprog/Ref/ArrayTest/arraytest.c
floppydisk525/RaspPiTempFan
22aa90f2f02ac4dd92e8aa00b2ab60ab158c9839
[ "MIT" ]
2
2019-04-27T17:11:16.000Z
2019-05-28T20:35:33.000Z
cprog/Ref/ArrayTest/arraytest.c
floppydisk525/RaspPiTempFan
22aa90f2f02ac4dd92e8aa00b2ab60ab158c9839
[ "MIT" ]
4
2019-05-05T18:21:50.000Z
2019-06-10T14:38:52.000Z
cprog/Ref/ArrayTest/arraytest.c
floppydisk525/RaspPiTempFan
22aa90f2f02ac4dd92e8aa00b2ab60ab158c9839
[ "MIT" ]
null
null
null
//Build and run this program with something like: //gcc -Wall arraytest.c -o arraytest //sudo ./arraytest //good book: https://www.dipmat.univpm.it/~demeio/public/the_c_programming_language_2.pdf #include <stdio.h> #include <string.h> char *path = "/sys/bus/w1/devices"; //char pointer to path (that doesn't change) char *dev[][16]; char *devPath[][128]; //void printarray( char **array, int SIZE ) void printarray( char array[][50], int SIZE ){ int i; int j; for( j = 0; j < SIZE; j++ ){ for( i = 0; i < SIZE; i ++){ printf( "%c ", array[j][i] ); } printf( "\n" ); } } void fillarray (){ dev[0][16]="dev 0, 16"; dev[1][16]="dev 1, 16"; dev[2][16]="dev 2, 16"; int i; printf("\n"); printf("Printed from fillarry\n"); for (i = 0; i<3; i++){ printf("dev variable is: %s\n", dev[i][16]); } printf("\n"); } int getTempSensCnt () { int cnt = 3; printf ("The string is: %s\n", path); return cnt; } int main( void ){ // char array[][50]; // int SIZE; dev[0][16] = "0"; devPath[0][128] = "0"; int i; printf("Dev variable before tempSensCnt is: %s\n", dev[0][16]); int tempSensCnt = getTempSensCnt(); printf ("The count is: %d\n", tempSensCnt); // ...call function to fill array... this part works. fillarray(); //printarray( array, SIZE ); printf("Printed from main\n"); for (i = 0; i<3; i++){ printf("Dev variable is: %s\n", dev[i][16]); } } //char *dev[0][16]; //char *devPath[0][128]; /* NOTES to Mark!! I found that I could pass the pointer or not pass it through the function call. The following exmaples are the SAME! #include <stdio.h> #include <string.h> char *path = "/sys/bus/w1/devices"; //char pointer to path (that doesn't change) int getTempSensCnt () { int cnt = 3; printf ("The string is: %s\n", path); return cnt; } int main( void ){ int tempSensCnt = getTempSensCnt(); printf ("The count is: %d\n", tempSensCnt); } ------------- The ABOVE WORKED THE SAME As BELOW ------------------ #include <stdio.h> #include <string.h> char *path = "/sys/bus/w1/devices"; //char pointer to path (that doesn't change) int getTempSensCnt (char *p) { int cnt = 3; printf ("The string is: %s\n", p); return cnt; } int main( void ){ int tempSensCnt = getTempSensCnt(path); printf ("The count is: %d\n", tempSensCnt); } */
21.669725
90
0.595258
cc3546f7c9a6584c5ad36730b7cc7414ad5d8153
301
h
C
BBLayout/DemoVC/Cell/SongCell.h
shaozg/BBLayout
0fa3fa49b92971ee4b6294d7fe198764cabf57f5
[ "MIT" ]
3
2020-03-17T02:26:19.000Z
2020-03-17T03:07:05.000Z
BBLayout/DemoVC/Cell/SongCell.h
shaozg/BBLayout
0fa3fa49b92971ee4b6294d7fe198764cabf57f5
[ "MIT" ]
null
null
null
BBLayout/DemoVC/Cell/SongCell.h
shaozg/BBLayout
0fa3fa49b92971ee4b6294d7fe198764cabf57f5
[ "MIT" ]
null
null
null
// // SongCell.h // BBLayout // // Created by shaozengguang on 2020/3/14. // Copyright © 2020 shaozengguang. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface SongCell : UITableViewCell - (void)updateWithDict:(NSDictionary *)dict; @end NS_ASSUME_NONNULL_END
15.05
56
0.734219
f2d9cf0df203f45c9864a6cba49a9d0be17e5ae0
2,466
c
C
rtl.c
jimstudt/ook-decoder
cc108f9826de65094b6678174cc41a06b7043121
[ "MIT" ]
127
2015-01-04T19:14:54.000Z
2022-03-25T16:28:39.000Z
rtl.c
EvilDonkey420/ook-decoder
e814354f9c84a95292bbef5d05e49bb862d656b2
[ "MIT" ]
4
2015-06-03T20:19:06.000Z
2016-11-05T16:35:09.000Z
rtl.c
EvilDonkey420/ook-decoder
e814354f9c84a95292bbef5d05e49bb862d656b2
[ "MIT" ]
18
2015-05-04T23:34:06.000Z
2021-07-10T23:29:24.000Z
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "rtl.h" const int magic = 0x471005D4; static int rtlOk( const struct rtldev *r) { if ( !r || r->magic != magic) return 0; return 1; } struct rtldev *rtlOpen( const char *serial, int32_t ind) { if ( ind < 0) { if ( serial) { ind = rtlsdr_get_index_by_serial( serial); if ( ind < 0) return 0; } else { ind = 0; } } rtlsdr_dev_t *dev = 0; int e = rtlsdr_open( &dev, (uint32_t)ind); if ( e == 0 && dev != 0) { struct rtldev *r = calloc( sizeof(*r), 1); r->magic = magic; r->dev = dev; return r; } else { return 0; } } void rtlClose( struct rtldev *r) { if (!r) return; if (!rtlOk(r)) { fprintf(stderr,"RTL SDR passed to rtlClose is corrupted\n"); return; } rtlsdr_cancel_async( r->dev); // don't check error, looks like it gives -2 if you weren't streaming. int e = rtlsdr_close( r->dev); if ( e) { fprintf(stderr,"Failed to close RTL SDR device\n"); } memset(r, 0, sizeof(*r)); // make invalid free(r); } int rtlSetup( struct rtldev *r, uint32_t frequency, uint32_t sampleRate) { if ( !rtlOk(r)) { return -1; } int e = rtlsdr_set_center_freq( r->dev, frequency); if (e) { fprintf(stderr,"Failed to set center frequency to %uHz\n", frequency); return -1; } int s = rtlsdr_set_sample_rate( r->dev, sampleRate); if (s) { fprintf(stderr,"Failed to set sample rate to %usamples/sec\n", sampleRate); return -1; } int a = rtlsdr_set_tuner_gain_mode( r->dev, 0); if ( a) { fprintf(stderr,"Failed to set tuner automatic gain mode\n"); return -1; } return 0; } struct rtlHandlerState { struct rtldev *rtl; sdr_handler handler; void *ctx; }; static void rtlHandler(unsigned char *buf, uint32_t len, void *ctx) { struct rtlHandlerState *state = (struct rtlHandlerState *)ctx; state->handler( buf, len, state->ctx, state->rtl); } int rtlRun( struct rtldev *r, sdr_handler handler, void *ctx) { if ( !rtlOk(r)) { return -1; } int re = rtlsdr_reset_buffer( r->dev); // this is important if ( re) return 0; struct rtlHandlerState state = { r, handler, ctx }; int e = rtlsdr_read_async( r->dev, rtlHandler, (void *)&state, 0,0); if ( e != 0) return 0; return 0; } int rtlStop( struct rtldev *r) { if ( !rtlOk(r)) { return -1; } return rtlsdr_cancel_async(r->dev); }
19.728
76
0.605434
a4fcf5ebdcbc9fd160d75ed63ac4f399dad27eb0
3,455
h
C
sparseklearn/fastLA/distances.h
EricKightley/sparseklearn
d5d1f42c0572972ea3f4702734f82066ae7270e3
[ "MIT" ]
3
2018-02-08T08:35:54.000Z
2020-02-19T21:50:28.000Z
sparseklearn/fastLA/distances.h
EricKightley/sparseklearn
d5d1f42c0572972ea3f4702734f82066ae7270e3
[ "MIT" ]
1
2020-07-07T05:23:52.000Z
2020-07-08T13:57:48.000Z
sparseklearn/fastLA/distances.h
EricKightley/sparseklearn
d5d1f42c0572972ea3f4702734f82066ae7270e3
[ "MIT" ]
1
2019-10-07T03:56:41.000Z
2019-10-07T03:56:41.000Z
#include <stdio.h> #include <stdint.h> #include <math.h> double dist_both_comp(double *comp_sample_1, double *comp_sample_2, int64_t *mask_1, int64_t *mask_2, int64_t num_feat_comp, int64_t num_feat_full); double dist_one_comp_one_full(double *comp_sample, double *full_sample, int64_t *mask, int64_t num_feat_comp, int64_t num_feat_full); void pairwise_l2_distances_with_self(double *result, double *comp_array, int64_t *mask_array, int64_t num_samples, int64_t num_feat_comp, int64_t num_feat_full); void pairwise_full_distances_with_full(double *result, double *comp_array, double *full_array, int64_t *mask_array, int64_t num_samples_comp, int64_t num_samples_full, int64_t num_feat_comp, int64_t num_feat_full); double mahalanobis_distance_spherical(double *comp_sample, double *full_mean, int64_t *mask, double spherical_covariance, int64_t num_feat_comp, int64_t num_feat_full); double mahalanobis_distance_diagonal(double *comp_sample, double *full_mean, int64_t *mask, double *diagonal_covariance, int64_t num_feat_comp, int64_t num_feat_full); void pairwise_mahalanobis_distances_spherical(double *result, double *comp_array, double *full_means, int64_t *mask_array, double *spherical_covariance_array, int64_t num_samples_comp, int64_t num_samples_full, int64_t num_feat_comp, int64_t num_feat_full); void pairwise_mahalanobis_distances_diagonal(double *result, double *comp_array, double *full_means, int64_t *mask_array, double *diagonal_covariance_array, int64_t num_samples_comp, int64_t num_samples_full, int64_t num_feat_comp, int64_t num_feat_full);
51.567164
80
0.384949
cd18fdab41b43732766319f0ee88e4f6b14f6a22
843
c
C
app/src/intern.c
Heisenberk/SHA1
812922db9537c3e06bda50b9884b9d777768053b
[ "MIT" ]
null
null
null
app/src/intern.c
Heisenberk/SHA1
812922db9537c3e06bda50b9884b9d777768053b
[ "MIT" ]
null
null
null
app/src/intern.c
Heisenberk/SHA1
812922db9537c3e06bda50b9884b9d777768053b
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include "../inc/intern.h" #include "../inc/types.h" /** * @brief Fonction f du processus de SHA-1. */ uint32_t f(uint32_t B,uint32_t C,uint32_t D,int t){ uint32_t f; if((0<=t)&&(t<=19)) f=((B & C) | ((~B) & D)); //F1 else if((20<=t)&&(t<=39)) f=B ^ C ^ D; //F2 else if((40<=t)&&(t<=59)) f=((B & C) | (B & D) | (C & D)); //F3 else if((60<=t)&&(t<=79)) f=B ^ C ^ D; //F4 else f=-1; return f; } /** * @brief Fonction k du processus de SHA-1. */ uint32_t k(int t){ uint32_t out; if((0<=t)&&(t<=19)) out=K1; else if((20<=t)&&(t<=39)) out=K2; else if((40<=t)&&(t<=59)) out=K3; else if((60<=t)&&(t<=79)) out=K4; else out=-1; return out; } /** * @brief Fonction shift du processus de SHA-1. */ uint32_t shift(int n,uint32_t X){ uint32_t out=((X<<n) | (X>>(32-n))); return out; }
21.075
64
0.529063
f3cb905aa8ddd11560644b8a7340338268b8ed7e
271
h
C
socket/socket_server.h
name1e5s/Trace-It
bb42ed21dc16b3fb5bfed3cb5592c9232c43ace2
[ "WTFPL" ]
null
null
null
socket/socket_server.h
name1e5s/Trace-It
bb42ed21dc16b3fb5bfed3cb5592c9232c43ace2
[ "WTFPL" ]
null
null
null
socket/socket_server.h
name1e5s/Trace-It
bb42ed21dc16b3fb5bfed3cb5592c9232c43ace2
[ "WTFPL" ]
null
null
null
#ifndef SOCKET_H #define SOCKET_H #include <arpa/inet.h> #include <sys/socket.h> class SocketServer { public: SocketServer(int port = 8888); bool start(); int accept(); private: int m_port; int m_socket; struct sockaddr_in m_server; }; #endif // SOCKET_H
13.55
32
0.701107
a38bf8137291e863a40a7ec2ef9455ad064dc474
2,530
h
C
gen/blink/modules/EventTargetModulesNames.h
gergul/MiniBlink
7a11c52f141d54d5f8e1a9af31867cd120a2c3c4
[ "Apache-2.0" ]
8
2019-05-05T16:38:05.000Z
2021-11-09T11:45:38.000Z
gen/blink/modules/EventTargetModulesNames.h
gergul/MiniBlink
7a11c52f141d54d5f8e1a9af31867cd120a2c3c4
[ "Apache-2.0" ]
null
null
null
gen/blink/modules/EventTargetModulesNames.h
gergul/MiniBlink
7a11c52f141d54d5f8e1a9af31867cd120a2c3c4
[ "Apache-2.0" ]
4
2018-12-14T07:52:46.000Z
2021-06-11T18:06:09.000Z
// Copyright (c) 2014 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 EventTargetModulesNames_h #define EventTargetModulesNames_h #include "core/EventTargetNames.h" #include "platform/PlatformExport.h" // Generated from: // - ../../modules/EventTargetModulesFactory.in namespace blink { namespace EventTargetNames { extern const WTF::AtomicString& BatteryManager; extern const WTF::AtomicString& CompositorWorker; extern const WTF::AtomicString& CompositorWorkerGlobalScope; extern const WTF::AtomicString& MediaKeySession; extern const WTF::AtomicString& FileWriter; extern const WTF::AtomicString& IDBDatabase; extern const WTF::AtomicString& IDBOpenDBRequest; extern const WTF::AtomicString& IDBRequest; extern const WTF::AtomicString& IDBTransaction; extern const WTF::AtomicString& MediaSource; extern const WTF::AtomicString& SourceBuffer; extern const WTF::AtomicString& SourceBufferList; extern const WTF::AtomicString& MediaStream; extern const WTF::AtomicString& MediaStreamTrack; extern const WTF::AtomicString& RTCDTMFSender; extern const WTF::AtomicString& RTCDataChannel; extern const WTF::AtomicString& RTCPeerConnection; extern const WTF::AtomicString& ServicePortCollection; extern const WTF::AtomicString& NetworkInformation; extern const WTF::AtomicString& Notification; extern const WTF::AtomicString& PermissionStatus; extern const WTF::AtomicString& Presentation; extern const WTF::AtomicString& PresentationAvailability; extern const WTF::AtomicString& PresentationSession; extern const WTF::AtomicString& ScreenOrientation; extern const WTF::AtomicString& ServiceWorker; extern const WTF::AtomicString& ServiceWorkerContainer; extern const WTF::AtomicString& ServiceWorkerGlobalScope; extern const WTF::AtomicString& ServiceWorkerRegistration; extern const WTF::AtomicString& StashedPortCollection; extern const WTF::AtomicString& SpeechRecognition; extern const WTF::AtomicString& SpeechSynthesis; extern const WTF::AtomicString& SpeechSynthesisUtterance; extern const WTF::AtomicString& MIDIAccess; extern const WTF::AtomicString& MIDIInput; extern const WTF::AtomicString& MIDIPort; extern const WTF::AtomicString& DOMWebSocket; #if ENABLE(WEB_AUDIO) extern const WTF::AtomicString& AudioContext; #endif // ENABLE(WEB_AUDIO) #if ENABLE(WEB_AUDIO) extern const WTF::AtomicString& AudioNode; #endif // ENABLE(WEB_AUDIO) void initModules(); } // EventTargetNames } // namespace blink #endif
37.761194
73
0.819368
1abce812872df866cdb43cfd365f516ac7ee25a8
24,349
h
C
resources/home/dnanexus/root/include/TBufferFile.h
edawson/parliament2
2632aa3484ef64c9539c4885026b705b737f6d1e
[ "Apache-2.0" ]
null
null
null
resources/home/dnanexus/root/include/TBufferFile.h
edawson/parliament2
2632aa3484ef64c9539c4885026b705b737f6d1e
[ "Apache-2.0" ]
null
null
null
resources/home/dnanexus/root/include/TBufferFile.h
edawson/parliament2
2632aa3484ef64c9539c4885026b705b737f6d1e
[ "Apache-2.0" ]
1
2020-05-28T23:01:44.000Z
2020-05-28T23:01:44.000Z
// @(#)root/io:$Id: 697641b2b52ed3d97bb5bde0fb5d2ff4a2f6c24f $ // Author: Rene Brun 17/01/2007 /************************************************************************* * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TBufferFile #define ROOT_TBufferFile ////////////////////////////////////////////////////////////////////////// // // // TBufferFile // // // // The concrete implementation of TBuffer for writing/reading to/from a // // ROOT file or socket. // // // ////////////////////////////////////////////////////////////////////////// #include "TBufferIO.h" #include "Bytes.h" #include <vector> #ifdef R__OLDHPACC namespace std { using ::string; using ::vector; } #endif class TVirtualStreamerInfo; class TStreamerInfo; class TStreamerElement; class TClass; class TVirtualArray; namespace TStreamerInfoActions { class TActionSequence; } class TBufferFile : public TBufferIO { protected: typedef std::vector<TStreamerInfo*> InfoList_t; TStreamerInfo *fInfo{nullptr}; ///< Pointer to TStreamerInfo object writing/reading the buffer InfoList_t fInfoStack; ///< Stack of pointers to the TStreamerInfos // Default ctor TBufferFile() = default; // TBuffer objects cannot be copied or assigned TBufferFile(const TBufferFile &); ///< not implemented void operator=(const TBufferFile &); ///< not implemented Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss, const char* classname); virtual void CheckCount(UInt_t offset); UInt_t CheckObject(UInt_t offset, const TClass *cl, Bool_t readClass = kFALSE); virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse); public: enum { kStreamedMemberWise = BIT(14) }; //added to version number to know if a collection has been stored member-wise TBufferFile(TBuffer::EMode mode); TBufferFile(TBuffer::EMode mode, Int_t bufsiz); TBufferFile(TBuffer::EMode mode, Int_t bufsiz, void *buf, Bool_t adopt = kTRUE, ReAllocCharFun_t reallocfunc = 0); virtual ~TBufferFile(); virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss); virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const char *classname); virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE); virtual void SkipVersion(const TClass *cl = 0); virtual Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, const TClass *cl = 0); virtual Version_t ReadVersionNoCheckSum(UInt_t *start = 0, UInt_t *bcnt = 0); virtual Version_t ReadVersionForMemberWise(const TClass *cl = 0); virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE); virtual UInt_t WriteVersionMemberWise(const TClass *cl, Bool_t useBcnt = kFALSE); virtual void *ReadObjectAny(const TClass* cast); virtual void SkipObjectAny(); virtual void IncrementLevel(TVirtualStreamerInfo* info); virtual void SetStreamerElementNumber(TStreamerElement*,Int_t) {} virtual void DecrementLevel(TVirtualStreamerInfo*); TVirtualStreamerInfo *GetInfo() {return (TVirtualStreamerInfo*)fInfo;} virtual void ClassBegin(const TClass*, Version_t = -1) {} virtual void ClassEnd(const TClass*) {} virtual void ClassMember(const char*, const char* = 0, Int_t = -1, Int_t = -1) {} virtual Int_t ReadBuf(void *buf, Int_t max); virtual void WriteBuf(const void *buf, Int_t max); virtual char *ReadString(char *s, Int_t max); virtual void WriteString(const char *s); virtual TClass *ReadClass(const TClass *cl = 0, UInt_t *objTag = 0); virtual void WriteClass(const TClass *cl); virtual TObject *ReadObject(const TClass *cl); using TBufferIO::CheckObject; // basic types and arrays of basic types virtual void ReadFloat16 (Float_t *f, TStreamerElement *ele=0); virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0); virtual void ReadDouble32 (Double_t *d, TStreamerElement *ele=0); virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0); virtual void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue); virtual void ReadWithNbits(Float_t *ptr, Int_t nbits); virtual void ReadWithFactor(Double_t *ptr, Double_t factor, Double_t minvalue); virtual void ReadWithNbits(Double_t *ptr, Int_t nbits); virtual Int_t ReadArray(Bool_t *&b); virtual Int_t ReadArray(Char_t *&c); virtual Int_t ReadArray(UChar_t *&c); virtual Int_t ReadArray(Short_t *&h); virtual Int_t ReadArray(UShort_t *&h); virtual Int_t ReadArray(Int_t *&i); virtual Int_t ReadArray(UInt_t *&i); virtual Int_t ReadArray(Long_t *&l); virtual Int_t ReadArray(ULong_t *&l); virtual Int_t ReadArray(Long64_t *&l); virtual Int_t ReadArray(ULong64_t *&l); virtual Int_t ReadArray(Float_t *&f); virtual Int_t ReadArray(Double_t *&d); virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0); virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0); virtual Int_t ReadStaticArray(Bool_t *b); virtual Int_t ReadStaticArray(Char_t *c); virtual Int_t ReadStaticArray(UChar_t *c); virtual Int_t ReadStaticArray(Short_t *h); virtual Int_t ReadStaticArray(UShort_t *h); virtual Int_t ReadStaticArray(Int_t *i); virtual Int_t ReadStaticArray(UInt_t *i); virtual Int_t ReadStaticArray(Long_t *l); virtual Int_t ReadStaticArray(ULong_t *l); virtual Int_t ReadStaticArray(Long64_t *l); virtual Int_t ReadStaticArray(ULong64_t *l); virtual Int_t ReadStaticArray(Float_t *f); virtual Int_t ReadStaticArray(Double_t *d); virtual Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele=0); virtual Int_t ReadStaticArrayDouble32(Double_t *d, TStreamerElement *ele=0); virtual void ReadFastArray(Bool_t *b, Int_t n); virtual void ReadFastArray(Char_t *c, Int_t n); virtual void ReadFastArrayString(Char_t *c, Int_t n); virtual void ReadFastArray(UChar_t *c, Int_t n); virtual void ReadFastArray(Short_t *h, Int_t n); virtual void ReadFastArray(UShort_t *h, Int_t n); virtual void ReadFastArray(Int_t *i, Int_t n); virtual void ReadFastArray(UInt_t *i, Int_t n); virtual void ReadFastArray(Long_t *l, Int_t n); virtual void ReadFastArray(ULong_t *l, Int_t n); virtual void ReadFastArray(Long64_t *l, Int_t n); virtual void ReadFastArray(ULong64_t *l, Int_t n); virtual void ReadFastArray(Float_t *f, Int_t n); virtual void ReadFastArray(Double_t *d, Int_t n); virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0); virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0); virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) ; virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits); virtual void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue); virtual void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) ; virtual void ReadFastArray(void *start , const TClass *cl, Int_t n=1, TMemberStreamer *s=0, const TClass* onFileClass=0 ); virtual void ReadFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0, const TClass* onFileClass=0); virtual void WriteArray(const Bool_t *b, Int_t n); virtual void WriteArray(const Char_t *c, Int_t n); virtual void WriteArray(const UChar_t *c, Int_t n); virtual void WriteArray(const Short_t *h, Int_t n); virtual void WriteArray(const UShort_t *h, Int_t n); virtual void WriteArray(const Int_t *i, Int_t n); virtual void WriteArray(const UInt_t *i, Int_t n); virtual void WriteArray(const Long_t *l, Int_t n); virtual void WriteArray(const ULong_t *l, Int_t n); virtual void WriteArray(const Long64_t *l, Int_t n); virtual void WriteArray(const ULong64_t *l, Int_t n); virtual void WriteArray(const Float_t *f, Int_t n); virtual void WriteArray(const Double_t *d, Int_t n); virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0); virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0); virtual void WriteFastArray(const Bool_t *b, Int_t n); virtual void WriteFastArray(const Char_t *c, Int_t n); virtual void WriteFastArrayString(const Char_t *c, Int_t n); virtual void WriteFastArray(const UChar_t *c, Int_t n); virtual void WriteFastArray(const Short_t *h, Int_t n); virtual void WriteFastArray(const UShort_t *h, Int_t n); virtual void WriteFastArray(const Int_t *i, Int_t n); virtual void WriteFastArray(const UInt_t *i, Int_t n); virtual void WriteFastArray(const Long_t *l, Int_t n); virtual void WriteFastArray(const ULong_t *l, Int_t n); virtual void WriteFastArray(const Long64_t *l, Int_t n); virtual void WriteFastArray(const ULong64_t *l, Int_t n); virtual void WriteFastArray(const Float_t *f, Int_t n); virtual void WriteFastArray(const Double_t *d, Int_t n); virtual void WriteFastArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0); virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0); virtual void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=0); virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0); virtual void StreamObject(void *obj, const std::type_info &typeinfo, const TClass* onFileClass = 0 ); virtual void StreamObject(void *obj, const char *className, const TClass* onFileClass = 0 ); virtual void StreamObject(void *obj, const TClass *cl, const TClass* onFileClass = 0 ); virtual void StreamObject(TObject *obj); virtual void ReadBool(Bool_t &b); virtual void ReadChar(Char_t &c); virtual void ReadUChar(UChar_t &c); virtual void ReadShort(Short_t &s); virtual void ReadUShort(UShort_t &s); virtual void ReadInt(Int_t &i); virtual void ReadUInt(UInt_t &i); virtual void ReadLong(Long_t &l); virtual void ReadULong(ULong_t &l); virtual void ReadLong64(Long64_t &l); virtual void ReadULong64(ULong64_t &l); virtual void ReadFloat(Float_t &f); virtual void ReadDouble(Double_t &d); virtual void ReadCharP(Char_t *c); virtual void ReadTString(TString &s); virtual void ReadStdString(std::string *s); using TBuffer::ReadStdString; virtual void ReadCharStar(char* &s); virtual void WriteBool(Bool_t b); virtual void WriteChar(Char_t c); virtual void WriteUChar(UChar_t c); virtual void WriteShort(Short_t s); virtual void WriteUShort(UShort_t s); virtual void WriteInt(Int_t i); virtual void WriteUInt(UInt_t i); virtual void WriteLong(Long_t l); virtual void WriteULong(ULong_t l); virtual void WriteLong64(Long64_t l); virtual void WriteULong64(ULong64_t l); virtual void WriteFloat(Float_t f); virtual void WriteDouble(Double_t d); virtual void WriteCharP(const Char_t *c); virtual void WriteTString(const TString &s); using TBuffer::WriteStdString; virtual void WriteStdString(const std::string *s); virtual void WriteCharStar(char *s); // Utilities for TClass virtual Int_t ReadClassEmulated(const TClass *cl, void *object, const TClass *onfile_class); virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class); virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, Int_t version, UInt_t start, UInt_t count, const TClass *onfile_class); virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer); // Utilites to streamer using sequences. Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object); Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection); Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection); ClassDef(TBufferFile,0) //concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket. }; //---------------------- TBufferFile inlines --------------------------------------- //______________________________________________________________________________ inline void TBufferFile::WriteBool(Bool_t b) { if (fBufCur + sizeof(UChar_t) > fBufMax) AutoExpand(fBufSize+sizeof(UChar_t)); tobuf(fBufCur, b); } //______________________________________________________________________________ inline void TBufferFile::WriteChar(Char_t c) { if (fBufCur + sizeof(Char_t) > fBufMax) AutoExpand(fBufSize+sizeof(Char_t)); tobuf(fBufCur, c); } //______________________________________________________________________________ inline void TBufferFile::WriteUChar(UChar_t c) { if (fBufCur + sizeof(UChar_t) > fBufMax) AutoExpand(fBufSize+sizeof(UChar_t)); tobuf(fBufCur, (Char_t)c); } //______________________________________________________________________________ inline void TBufferFile::WriteShort(Short_t h) { if (fBufCur + sizeof(Short_t) > fBufMax) AutoExpand(fBufSize+sizeof(Short_t)); tobuf(fBufCur, h); } //______________________________________________________________________________ inline void TBufferFile::WriteUShort(UShort_t h) { if (fBufCur + sizeof(UShort_t) > fBufMax) AutoExpand(fBufSize+sizeof(UShort_t)); tobuf(fBufCur, (Short_t)h); } //______________________________________________________________________________ inline void TBufferFile::WriteInt(Int_t i) { if (fBufCur + sizeof(Int_t) > fBufMax) AutoExpand(fBufSize+sizeof(Int_t)); tobuf(fBufCur, i); } //______________________________________________________________________________ inline void TBufferFile::WriteUInt(UInt_t i) { if (fBufCur + sizeof(UInt_t) > fBufMax) AutoExpand(fBufSize+sizeof(UInt_t)); tobuf(fBufCur, (Int_t)i); } //______________________________________________________________________________ inline void TBufferFile::WriteLong(Long_t l) { if (fBufCur + sizeof(Long_t) > fBufMax) AutoExpand(fBufSize+sizeof(Long_t)); tobuf(fBufCur, l); } //______________________________________________________________________________ inline void TBufferFile::WriteULong(ULong_t l) { if (fBufCur + sizeof(ULong_t) > fBufMax) AutoExpand(fBufSize+sizeof(ULong_t)); tobuf(fBufCur, (Long_t)l); } //______________________________________________________________________________ inline void TBufferFile::WriteLong64(Long64_t ll) { if (fBufCur + sizeof(Long64_t) > fBufMax) AutoExpand(fBufSize+sizeof(Long64_t)); tobuf(fBufCur, ll); } //______________________________________________________________________________ inline void TBufferFile::WriteULong64(ULong64_t ll) { if (fBufCur + sizeof(ULong64_t) > fBufMax) AutoExpand(fBufSize+sizeof(ULong64_t)); tobuf(fBufCur, (Long64_t)ll); } //______________________________________________________________________________ inline void TBufferFile::WriteFloat(Float_t f) { if (fBufCur + sizeof(Float_t) > fBufMax) AutoExpand(fBufSize+sizeof(Float_t)); tobuf(fBufCur, f); } //______________________________________________________________________________ inline void TBufferFile::WriteDouble(Double_t d) { if (fBufCur + sizeof(Double_t) > fBufMax) AutoExpand(fBufSize+sizeof(Double_t)); tobuf(fBufCur, d); } //______________________________________________________________________________ inline void TBufferFile::WriteCharP(const Char_t *c) { WriteString(c); } //______________________________________________________________________________ inline void TBufferFile::ReadBool(Bool_t &b) { frombuf(fBufCur, &b); } //______________________________________________________________________________ inline void TBufferFile::ReadChar(Char_t &c) { frombuf(fBufCur, &c); } //______________________________________________________________________________ inline void TBufferFile::ReadUChar(UChar_t &c) { TBufferFile::ReadChar((Char_t &)c); } //______________________________________________________________________________ inline void TBufferFile::ReadShort(Short_t &h) { frombuf(fBufCur, &h); } //______________________________________________________________________________ inline void TBufferFile::ReadUShort(UShort_t &h) { TBufferFile::ReadShort((Short_t &)h); } //______________________________________________________________________________ inline void TBufferFile::ReadInt(Int_t &i) { frombuf(fBufCur, &i); } //______________________________________________________________________________ inline void TBufferFile::ReadUInt(UInt_t &i) { TBufferFile::ReadInt((Int_t &)i); } // in implementation file because special case with old version //______________________________________________________________________________ //inline void TBufferFile::ReadLong(Long_t &ll) //{ // frombuf(fBufCur, &ll); //} //______________________________________________________________________________ inline void TBufferFile::ReadULong(ULong_t &ll) { TBufferFile::ReadLong((Long_t&)ll); } //______________________________________________________________________________ inline void TBufferFile::ReadLong64(Long64_t &ll) { frombuf(fBufCur, &ll); } //______________________________________________________________________________ inline void TBufferFile::ReadULong64(ULong64_t &ll) { TBufferFile::ReadLong64((Long64_t &)ll); } //______________________________________________________________________________ inline void TBufferFile::ReadFloat(Float_t &f) { frombuf(fBufCur, &f); } //______________________________________________________________________________ inline void TBufferFile::ReadDouble(Double_t &d) { frombuf(fBufCur, &d); } //______________________________________________________________________________ inline void TBufferFile::ReadCharP(Char_t *c) { ReadString(c, -1); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadArray(UChar_t *&c) { return TBufferFile::ReadArray((Char_t *&)c); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadArray(UShort_t *&h) { return TBufferFile::ReadArray((Short_t *&)h); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadArray(UInt_t *&i) { return TBufferFile::ReadArray((Int_t *&)i); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadArray(ULong_t *&l) { return TBufferFile::ReadArray((Long_t *&)l); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadArray(ULong64_t *&ll) { return TBufferFile::ReadArray((Long64_t *&)ll); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadStaticArray(UChar_t *c) { return TBufferFile::ReadStaticArray((Char_t *)c); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadStaticArray(UShort_t *h) { return TBufferFile::ReadStaticArray((Short_t *)h); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadStaticArray(UInt_t *i) { return TBufferFile::ReadStaticArray((Int_t *)i); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadStaticArray(ULong_t *l) { return TBufferFile::ReadStaticArray((Long_t *)l); } //______________________________________________________________________________ inline Int_t TBufferFile::ReadStaticArray(ULong64_t *ll) { return TBufferFile::ReadStaticArray((Long64_t *)ll); } //______________________________________________________________________________ inline void TBufferFile::ReadFastArray(UChar_t *c, Int_t n) { TBufferFile::ReadFastArray((Char_t *)c, n); } //______________________________________________________________________________ inline void TBufferFile::ReadFastArray(UShort_t *h, Int_t n) { TBufferFile::ReadFastArray((Short_t *)h, n); } //______________________________________________________________________________ inline void TBufferFile::ReadFastArray(UInt_t *i, Int_t n) { TBufferFile::ReadFastArray((Int_t *)i, n); } //______________________________________________________________________________ inline void TBufferFile::ReadFastArray(ULong_t *l, Int_t n) { TBufferFile::ReadFastArray((Long_t *)l, n); } //______________________________________________________________________________ inline void TBufferFile::ReadFastArray(ULong64_t *ll, Int_t n) { TBufferFile::ReadFastArray((Long64_t *)ll, n); } //______________________________________________________________________________ inline void TBufferFile::WriteArray(const UChar_t *c, Int_t n) { TBufferFile::WriteArray((const Char_t *)c, n); } //______________________________________________________________________________ inline void TBufferFile::WriteArray(const UShort_t *h, Int_t n) { TBufferFile::WriteArray((const Short_t *)h, n); } //______________________________________________________________________________ inline void TBufferFile::WriteArray(const UInt_t *i, Int_t n) { TBufferFile::WriteArray((const Int_t *)i, n); } //______________________________________________________________________________ inline void TBufferFile::WriteArray(const ULong64_t *ll, Int_t n) { TBufferFile::WriteArray((const Long64_t *)ll, n); } //______________________________________________________________________________ inline void TBufferFile::WriteFastArray(const UChar_t *c, Int_t n) { TBufferFile::WriteFastArray((const Char_t *)c, n); } //______________________________________________________________________________ inline void TBufferFile::WriteFastArray(const UShort_t *h, Int_t n) { TBufferFile::WriteFastArray((const Short_t *)h, n); } //______________________________________________________________________________ inline void TBufferFile::WriteFastArray(const UInt_t *i, Int_t n) { TBufferFile::WriteFastArray((const Int_t *)i, n); } //______________________________________________________________________________ inline void TBufferFile::WriteFastArray(const ULong64_t *ll, Int_t n) { TBufferFile::WriteFastArray((const Long64_t *)ll, n); } #endif
46.028355
157
0.710419
d8a47329df373fa77fa84e4adef080b2bb55e74d
779
h
C
include/hdlConvertor/vhdlConvertor/blockDeclarationParser.h
curiousTauseef/hdlConvertor
5041c2cca2d14f47237dc4e91fd3228a88bd01df
[ "MIT" ]
1
2022-02-17T23:32:46.000Z
2022-02-17T23:32:46.000Z
include/hdlConvertor/vhdlConvertor/blockDeclarationParser.h
curiousTauseef/hdlConvertor
5041c2cca2d14f47237dc4e91fd3228a88bd01df
[ "MIT" ]
null
null
null
include/hdlConvertor/vhdlConvertor/blockDeclarationParser.h
curiousTauseef/hdlConvertor
5041c2cca2d14f47237dc4e91fd3228a88bd01df
[ "MIT" ]
null
null
null
#pragma once #include <vector> #include <hdlConvertor/vhdlConvertor/vhdlParser/vhdlParser.h> #include <hdlConvertor/hdlAst/iHdlObj.h> #include <hdlConvertor/hdlAst/hdlModuleDec.h> #include <hdlConvertor/vhdlConvertor/commentParser.h> namespace hdlConvertor { namespace vhdl { class VhdlBlockDeclarationParser { VhdlCommentParser &commentParser; public: using vhdlParser = vhdl_antlr::vhdlParser; bool hierarchyOnly; VhdlBlockDeclarationParser(VhdlCommentParser &_commentParser, bool hierarchyOnly); void visitBlock_declarative_item( vhdlParser::Block_declarative_itemContext *ctx, std::vector<std::unique_ptr<hdlAst::iHdlObj>> &objs); std::unique_ptr<hdlAst::HdlModuleDec> visitComponent_declaration( vhdlParser::Component_declarationContext *ctx); }; } }
25.129032
83
0.808729
4f1e55fcfa0a97a015d1c6f0a00a05f9fb9671af
1,976
h
C
include/il2cpp/UnityEngine/JsonUtility.h
martmists-gh/BDSP
d6326c5d3ad9697ea65269ed47aa0b63abac2a0a
[ "MIT" ]
1
2022-01-15T20:20:27.000Z
2022-01-15T20:20:27.000Z
include/il2cpp/UnityEngine/JsonUtility.h
martmists-gh/BDSP
d6326c5d3ad9697ea65269ed47aa0b63abac2a0a
[ "MIT" ]
null
null
null
include/il2cpp/UnityEngine/JsonUtility.h
martmists-gh/BDSP
d6326c5d3ad9697ea65269ed47aa0b63abac2a0a
[ "MIT" ]
null
null
null
#pragma once #include "il2cpp.h" System_String_o* UnityEngine_JsonUtility__ToJsonInternal (Il2CppObject* obj, bool prettyPrint, const MethodInfo* method_info); Il2CppObject* UnityEngine_JsonUtility__FromJsonInternal (System_String_o* json, Il2CppObject* objectToOverwrite, System_Type_o* type, const MethodInfo* method_info); System_String_o* UnityEngine_JsonUtility__ToJson (Il2CppObject* obj, const MethodInfo* method_info); System_String_o* UnityEngine_JsonUtility__ToJson (Il2CppObject* obj, bool prettyPrint, const MethodInfo* method_info); Dpr_UI_UIAnimationEvent_AnimationEventBase_o* UnityEngine_JsonUtility__FromJson_UIAnimationEvent_AnimationEventBase_ (System_String_o* json, const MethodInfo* method_info); Dpr_UI_UIAnimationEvent_AnimationEventHoge_o* UnityEngine_JsonUtility__FromJson_UIAnimationEvent_AnimationEventHoge_ (System_String_o* json, const MethodInfo* method_info); INL1_IlcaNetServerSerial_SerialResponseAuth_o* UnityEngine_JsonUtility__FromJson_IlcaNetServerSerial_SerialResponseAuth_ (System_String_o* json, const MethodInfo* method_info); INL1_IlcaNetServerSerial_SerialResponseUpdate_o* UnityEngine_JsonUtility__FromJson_IlcaNetServerSerial_SerialResponseUpdate_ (System_String_o* json, const MethodInfo* method_info); INL1_IlcaNetServerValidate_CheckResponse_o* UnityEngine_JsonUtility__FromJson_IlcaNetServerValidate_CheckResponse_ (System_String_o* json, const MethodInfo* method_info); INL1_IlcaNetServerValidate_PublicKeyResponse_o* UnityEngine_JsonUtility__FromJson_IlcaNetServerValidate_PublicKeyResponse_ (System_String_o* json, const MethodInfo* method_info); Il2CppObject* UnityEngine_JsonUtility__FromJson_object_ (System_String_o* json, const MethodInfo* method_info); Il2CppObject* UnityEngine_JsonUtility__FromJson (System_String_o* json, System_Type_o* type, const MethodInfo* method_info); void UnityEngine_JsonUtility__FromJsonOverwrite (System_String_o* json, Il2CppObject* objectToOverwrite, const MethodInfo* method_info);
109.777778
180
0.8917
fa2ce1c456e015d2986939478dcf635223bf2da9
38
h
C
external/webkit/Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h
ghsecuritylab/android_platform_sony_nicki
526381be7808e5202d7865aa10303cb5d249388a
[ "Apache-2.0" ]
6
2017-05-31T01:46:45.000Z
2018-06-12T10:53:30.000Z
WebKit/Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h
JavaScriptTesting/LJS
9818dbdb421036569fff93124ac2385d45d01c3a
[ "Apache-2.0" ]
2
2017-07-25T09:37:22.000Z
2017-08-04T07:18:56.000Z
WebKit/Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h
JavaScriptTesting/LJS
9818dbdb421036569fff93124ac2385d45d01c3a
[ "Apache-2.0" ]
2
2017-08-09T09:03:23.000Z
2020-05-26T09:14:49.000Z
#import <JavaScriptCore/HashTraits.h>
19
37
0.815789
366b7f518f41ec74d4b6dfbc17f40fb42c053586
2,454
c
C
tests/lib/cmsis_dsp/bayes/src/f16.c
ldalek/zephyr
fa2054f93e4e80b079a4a6a9e84d642e51912042
[ "Apache-2.0" ]
1
2022-02-23T09:03:56.000Z
2022-02-23T09:03:56.000Z
tests/lib/cmsis_dsp/bayes/src/f16.c
ldalek/zephyr
fa2054f93e4e80b079a4a6a9e84d642e51912042
[ "Apache-2.0" ]
3
2021-10-14T04:32:03.000Z
2021-11-12T09:02:16.000Z
tests/lib/cmsis_dsp/bayes/src/f16.c
ldalek/zephyr
fa2054f93e4e80b079a4a6a9e84d642e51912042
[ "Apache-2.0" ]
1
2018-07-07T11:14:38.000Z
2018-07-07T11:14:38.000Z
/* * Copyright (c) 2021 Stephanos Ioannidis <root@stephanos.io> * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 */ #include <ztest.h> #include <zephyr/zephyr.h> #include <stdlib.h> #include <arm_math_f16.h> #include "../../common/test_common.h" #include "f16.pat" #define REL_ERROR_THRESH (3.0e-3) /* Note: this source file is only built when CONFIG_CMSIS_DSP_FLOAT16 is enabled */ ZTEST_SUITE(bayes_f16, NULL, NULL, NULL, NULL, NULL); ZTEST(bayes_f16, test_gaussian_naive_bayes_predict_f16) { arm_gaussian_naive_bayes_instance_f16 inst; size_t index; const uint16_t pattern_count = in_dims[0]; const uint16_t class_count = in_dims[1]; const uint16_t vec_dims = in_dims[2]; const float16_t *params = (const float16_t *)in_param; const float16_t *input = (const float16_t *)in_val; float16_t *output_probs_buf, *output_probs; uint16_t *output_preds_buf, *output_preds; float16_t *temp; /* Initialise instance */ inst.vectorDimension = vec_dims; inst.numberOfClasses = class_count; inst.theta = params; inst.sigma = params + (class_count * vec_dims); inst.classPriors = params + (2 * class_count * vec_dims); inst.epsilon = params[class_count + (2 * class_count * vec_dims)]; /* Allocate output buffers */ output_probs_buf = malloc(pattern_count * class_count * sizeof(float16_t)); zassert_not_null(output_probs_buf, ASSERT_MSG_BUFFER_ALLOC_FAILED); output_preds_buf = malloc(pattern_count * sizeof(uint16_t)); zassert_not_null(output_preds_buf, ASSERT_MSG_BUFFER_ALLOC_FAILED); output_probs = output_probs_buf; output_preds = output_preds_buf; temp = malloc(pattern_count * class_count * sizeof(float16_t)); zassert_not_null(temp, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Enumerate patterns */ for (index = 0; index < pattern_count; index++) { /* Run test function */ *output_preds = arm_gaussian_naive_bayes_predict_f16( &inst, input, output_probs, temp); /* Increment pointers */ input += vec_dims; output_probs += class_count; output_preds++; } /* Validate output */ zassert_true( test_rel_error_f16(pattern_count, output_probs_buf, (float16_t *)ref_prob, REL_ERROR_THRESH), ASSERT_MSG_REL_ERROR_LIMIT_EXCEED); zassert_true( test_equal_q15(pattern_count, output_preds_buf, ref_pred), ASSERT_MSG_INCORRECT_COMP_RESULT); /* Free output buffers */ free(output_probs_buf); free(output_preds_buf); }
28.206897
83
0.755501
36e339f4e0fc2fcfaad060d635ce318be56f9ed6
272
h
C
LZIOSPro_Moran/LZIOSPro_Moran/Controllers/LZMMainTabBarController.h
comst007/LZMoran
d29e9601d626c15e443607655f2942c942ab19fe
[ "Apache-2.0" ]
null
null
null
LZIOSPro_Moran/LZIOSPro_Moran/Controllers/LZMMainTabBarController.h
comst007/LZMoran
d29e9601d626c15e443607655f2942c942ab19fe
[ "Apache-2.0" ]
null
null
null
LZIOSPro_Moran/LZIOSPro_Moran/Controllers/LZMMainTabBarController.h
comst007/LZMoran
d29e9601d626c15e443607655f2942c942ab19fe
[ "Apache-2.0" ]
null
null
null
// // LZMMainTabBarController.h // LZIOSPro_Moran // // Created by comst on 15/11/6. // Copyright (c) 2015年 com.comst1314. All rights reserved. // #import <UIKit/UIKit.h> #import "CYLTabBarController.h" @interface LZMMainTabBarController : CYLTabBarController @end
18.133333
59
0.735294
9a70d553672440c46cb9cfb166899235554ac92e
415
h
C
T8ChatUIKitDemo/Pods/Headers/Public/T8TableViewForm/T8MenuSection.h
zhangqippp/T8ChatUIKit
ad4f7b45c988436fdec1d594445357f2ea8e0e8f
[ "MIT" ]
1
2015-12-23T03:55:53.000Z
2015-12-23T03:55:53.000Z
T8ChatUIKitDemo/Pods/Headers/Public/T8TableViewForm/T8MenuSection.h
zhangqippp/T8ChatUIKit
ad4f7b45c988436fdec1d594445357f2ea8e0e8f
[ "MIT" ]
null
null
null
T8ChatUIKitDemo/Pods/Headers/Public/T8TableViewForm/T8MenuSection.h
zhangqippp/T8ChatUIKit
ad4f7b45c988436fdec1d594445357f2ea8e0e8f
[ "MIT" ]
null
null
null
// // T8MenuSection.h // T8DevelopKitDemo // // Created by 琦张 on 15/6/24. // Copyright (c) 2015年 琦张. All rights reserved. // #import <Foundation/Foundation.h> #import "T8MenuItem.h" @interface T8MenuSection : NSObject @property (nonatomic) NSMutableArray *items; @property (nonatomic) UIEdgeInsets sectionEdgeInsets; - (void)addMenuItem:(T8MenuItem *)item; - (void)removeMenuItem:(T8MenuItem *)item; @end
18.863636
53
0.727711
82ae9c26934910f5695ea8b4c21502c00c297156
29,210
c
C
contrib/gnu/gdb/dist/gas/config/tc-iq2000.c
TheSledgeHammer/2.11BSD
fe61f0b9aaa273783cd027c7b5ec77e95ead2153
[ "BSD-3-Clause" ]
3
2021-05-04T17:09:06.000Z
2021-10-04T07:19:26.000Z
contrib/gnu/gdb/dist/gas/config/tc-iq2000.c
TheSledgeHammer/2.11BSD
fe61f0b9aaa273783cd027c7b5ec77e95ead2153
[ "BSD-3-Clause" ]
null
null
null
contrib/gnu/gdb/dist/gas/config/tc-iq2000.c
TheSledgeHammer/2.11BSD
fe61f0b9aaa273783cd027c7b5ec77e95ead2153
[ "BSD-3-Clause" ]
null
null
null
/* tc-iq2000.c -- Assembler for the Sitera IQ2000. Copyright (C) 2003-2020 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GAS is distributed in the hope that it will be useful, but WITHOUT 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 GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "as.h" #include "safe-ctype.h" #include "subsegs.h" #include "symcat.h" #include "opcodes/iq2000-desc.h" #include "opcodes/iq2000-opc.h" #include "cgen.h" #include "elf/common.h" #include "elf/iq2000.h" #include "sb.h" #include "macro.h" /* Structure to hold all of the different components describing an individual instruction. */ typedef struct { const CGEN_INSN * insn; const CGEN_INSN * orig_insn; CGEN_FIELDS fields; #if CGEN_INT_INSN_P CGEN_INSN_INT buffer [1]; #define INSN_VALUE(buf) (*(buf)) #else unsigned char buffer [CGEN_MAX_INSN_SIZE]; #define INSN_VALUE(buf) (buf) #endif char * addr; fragS * frag; int num_fixups; fixS * fixups [GAS_CGEN_MAX_FIXUPS]; int indices [MAX_OPERAND_INSTANCES]; } iq2000_insn; const char comment_chars[] = "#"; const char line_comment_chars[] = "#"; const char line_separator_chars[] = ";"; const char EXP_CHARS[] = "eE"; const char FLT_CHARS[] = "dD"; /* Default machine. */ #define DEFAULT_MACHINE bfd_mach_iq2000 #define DEFAULT_FLAGS EF_IQ2000_CPU_IQ2000 static unsigned long iq2000_mach = bfd_mach_iq2000; static int cpu_mach = (1 << MACH_IQ2000); /* Flags to set in the elf header. */ static flagword iq2000_flags = DEFAULT_FLAGS; typedef struct proc { symbolS *isym; unsigned long reg_mask; unsigned long reg_offset; unsigned long fpreg_mask; unsigned long fpreg_offset; unsigned long frame_offset; unsigned long frame_reg; unsigned long pc_reg; } procS; static procS cur_proc; static procS *cur_proc_ptr; static int numprocs; /* Relocations against symbols are done in two parts, with a HI relocation and a LO relocation. Each relocation has only 16 bits of space to store an addend. This means that in order for the linker to handle carries correctly, it must be able to locate both the HI and the LO relocation. This means that the relocations must appear in order in the relocation table. In order to implement this, we keep track of each unmatched HI relocation. We then sort them so that they immediately precede the corresponding LO relocation. */ struct iq2000_hi_fixup { struct iq2000_hi_fixup * next; /* Next HI fixup. */ fixS * fixp; /* This fixup. */ segT seg; /* The section this fixup is in. */ }; /* The list of unmatched HI relocs. */ static struct iq2000_hi_fixup * iq2000_hi_fixup_list; /* Macro hash table, which we will add to. */ extern struct htab *macro_hash; const char *md_shortopts = ""; struct option md_longopts[] = { {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof (md_longopts); int md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED) { return 0; } void md_show_usage (FILE * stream ATTRIBUTE_UNUSED) { } /* Automatically enter conditional branch macros. */ typedef struct { const char * mnemonic; const char ** expansion; const char ** args; } iq2000_macro_defs_s; static const char * abs_args[] = { "rd", "rs", "scratch=%1", NULL }; static const char * abs_expn = "\n sra \\rd,\\rs,31\n xor \\scratch,\\rd,\\rs\n sub \\rd,\\scratch,\\rd\n"; static const char * la_expn = "\n lui \\reg,%hi(\\label)\n ori \\reg,\\reg,%lo(\\label)\n"; static const char * la_args[] = { "reg", "label", NULL }; static const char * bxx_args[] = { "rs", "rt", "label", "scratch=%1", NULL }; static const char * bge_expn = "\n slt \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n"; static const char * bgeu_expn = "\n sltu \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n"; static const char * bgt_expn = "\n slt \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n"; static const char * bgtu_expn = "\n sltu \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n"; static const char * ble_expn = "\n slt \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n"; static const char * bleu_expn = "\n sltu \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n"; static const char * blt_expn = "\n slt \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n"; static const char * bltu_expn = "\n sltu \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n"; static const char * sxx_args[] = { "rd", "rs", "rt", NULL }; static const char * sge_expn = "\n slt \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n"; static const char * sgeu_expn = "\n sltu \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n"; static const char * sle_expn = "\n slt \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n"; static const char * sleu_expn = "\n sltu \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n"; static const char * sgt_expn = "\n slt \\rd,\\rt,\\rs\n"; static const char * sgtu_expn = "\n sltu \\rd,\\rt,\\rs\n"; static const char * sne_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n"; static const char * seq_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n xori \\rd,\\rd,1\n"; static const char * ai32_args[] = { "rt", "rs", "imm", NULL }; static const char * andi32_expn = "\n\ .if (\\imm & 0xffff0000 == 0xffff0000)\n\ andoi \\rt,\\rs,%lo(\\imm)\n\ .elseif (\\imm & 0x0000ffff == 0x0000ffff)\n\ andoui \\rt,\\rs,%uhi(\\imm)\n\ .elseif (\\imm & 0xffff0000 == 0x00000000)\n\ andi \\rt,\\rs,%lo(\\imm)\n\ .else\n\ andoui \\rt,\\rs,%uhi(\\imm)\n\ andoi \\rt,\\rt,%lo(\\imm)\n\ .endif\n"; static const char * ori32_expn = "\n\ .if (\\imm & 0xffff == 0)\n\ orui \\rt,\\rs,%uhi(\\imm)\n\ .elseif (\\imm & 0xffff0000 == 0)\n\ ori \\rt,\\rs,%lo(\\imm)\n\ .else\n\ orui \\rt,\\rs,%uhi(\\imm)\n\ ori \\rt,\\rt,%lo(\\imm)\n\ .endif\n"; static const char * neg_args[] = { "rd", "rs", NULL }; static const char * neg_expn = "\n sub \\rd,%0,\\rs\n"; static const char * negu_expn = "\n subu \\rd,%0,\\rs\n"; static const char * li_args[] = { "rt", "imm", NULL }; static const char * li_expn = "\n\ .if (\\imm & 0xffff0000 == 0x0)\n\ ori \\rt,%0,\\imm\n\ .elseif (\\imm & 0xffff0000 == 0xffff0000)\n\ addi \\rt,%0,\\imm\n\ .elseif (\\imm & 0x0000ffff == 0)\n\ lui \\rt,%uhi(\\imm)\n\ .else\n\ lui \\rt,%uhi(\\imm)\n\ ori \\rt,\\rt,%lo(\\imm)\n\ .endif\n"; static iq2000_macro_defs_s iq2000_macro_defs[] = { {"abs", (const char **) & abs_expn, (const char **) & abs_args}, {"la", (const char **) & la_expn, (const char **) & la_args}, {"bge", (const char **) & bge_expn, (const char **) & bxx_args}, {"bgeu", (const char **) & bgeu_expn, (const char **) & bxx_args}, {"bgt", (const char **) & bgt_expn, (const char **) & bxx_args}, {"bgtu", (const char **) & bgtu_expn, (const char **) & bxx_args}, {"ble", (const char **) & ble_expn, (const char **) & bxx_args}, {"bleu", (const char **) & bleu_expn, (const char **) & bxx_args}, {"blt", (const char **) & blt_expn, (const char **) & bxx_args}, {"bltu", (const char **) & bltu_expn, (const char **) & bxx_args}, {"sge", (const char **) & sge_expn, (const char **) & sxx_args}, {"sgeu", (const char **) & sgeu_expn, (const char **) & sxx_args}, {"sle", (const char **) & sle_expn, (const char **) & sxx_args}, {"sleu", (const char **) & sleu_expn, (const char **) & sxx_args}, {"sgt", (const char **) & sgt_expn, (const char **) & sxx_args}, {"sgtu", (const char **) & sgtu_expn, (const char **) & sxx_args}, {"seq", (const char **) & seq_expn, (const char **) & sxx_args}, {"sne", (const char **) & sne_expn, (const char **) & sxx_args}, {"neg", (const char **) & neg_expn, (const char **) & neg_args}, {"negu", (const char **) & negu_expn, (const char **) & neg_args}, {"li", (const char **) & li_expn, (const char **) & li_args}, {"ori32", (const char **) & ori32_expn, (const char **) & ai32_args}, {"andi32",(const char **) & andi32_expn,(const char **) & ai32_args}, }; static void iq2000_add_macro (const char * name, const char * semantics, const char ** arguments) { macro_entry *macro; sb macro_name; const char *namestr; macro = XNEW (macro_entry); sb_new (& macro->sub); sb_new (& macro_name); macro->formal_count = 0; macro->formals = 0; sb_add_string (& macro->sub, semantics); if (arguments != NULL) { formal_entry ** p = &macro->formals; macro->formal_count = 0; macro->formal_hash = htab_create_alloc (7, hash_formal_entry, eq_formal_entry, NULL, xcalloc, free); while (*arguments != NULL) { formal_entry *formal; formal = XNEW (formal_entry); sb_new (& formal->name); sb_new (& formal->def); sb_new (& formal->actual); /* chlm: Added the following to allow defaulted args. */ if (strchr (*arguments,'=')) { char * tt_args = strdup (*arguments); char * tt_dflt = strchr (tt_args,'='); *tt_dflt = 0; sb_add_string (& formal->name, tt_args); sb_add_string (& formal->def, tt_dflt + 1); } else sb_add_string (& formal->name, *arguments); /* Add to macro's hash table. */ htab_insert (macro->formal_hash, formal_entry_alloc (sb_terminate (& formal->name), formal), 1); formal->index = macro->formal_count; macro->formal_count++; *p = formal; p = & formal->next; *p = NULL; ++arguments; } } sb_add_string (&macro_name, name); namestr = sb_terminate (&macro_name); htab_insert (macro_hash, macro_entry_alloc (namestr, macro), 1); macro_defined = 1; } static void iq2000_load_macros (void) { int i; int mcnt = ARRAY_SIZE (iq2000_macro_defs); for (i = 0; i < mcnt; i++) iq2000_add_macro (iq2000_macro_defs[i].mnemonic, *iq2000_macro_defs[i].expansion, iq2000_macro_defs[i].args); } void md_begin (void) { /* Initialize the `cgen' interface. */ /* Set the machine number and endian. */ gas_cgen_cpu_desc = iq2000_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, cpu_mach, CGEN_CPU_OPEN_ENDIAN, CGEN_ENDIAN_BIG, CGEN_CPU_OPEN_END); iq2000_cgen_init_asm (gas_cgen_cpu_desc); /* This is a callback from cgen to gas to parse operands. */ cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand); /* Set the ELF flags if desired. */ if (iq2000_flags) bfd_set_private_flags (stdoutput, iq2000_flags); /* Set the machine type */ bfd_default_set_arch_mach (stdoutput, bfd_arch_iq2000, iq2000_mach); iq2000_load_macros (); } void md_assemble (char * str) { static long delayed_load_register = 0; static int last_insn_had_delay_slot = 0; static int last_insn_has_load_delay = 0; static int last_insn_unconditional_jump = 0; static int last_insn_was_ldw = 0; iq2000_insn insn; char * errmsg; /* Initialize GAS's cgen interface for a new instruction. */ gas_cgen_init_parse (); insn.insn = iq2000_cgen_assemble_insn (gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, & errmsg); if (!insn.insn) { as_bad ("%s", errmsg); return; } /* Doesn't really matter what we pass for RELAX_P here. */ gas_cgen_finish_insn (insn.insn, insn.buffer, CGEN_FIELDS_BITSIZE (& insn.fields), 1, NULL); /* We need to generate an error if there's a yielding instruction in the delay slot of a control flow modifying instruction (jump (yes), load (no)) */ if ((last_insn_had_delay_slot && !last_insn_has_load_delay) && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_YIELD_INSN)) as_bad (_("the yielding instruction %s may not be in a delay slot."), CGEN_INSN_NAME (insn.insn)); /* Warn about odd numbered base registers for paired-register instructions like LDW. On iq2000, result is always rt. */ if (iq2000_mach == bfd_mach_iq2000 && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_EVEN_REG_NUM) && (insn.fields.f_rt % 2)) as_bad (_("Register number (R%ld) for double word access must be even."), insn.fields.f_rt); /* Warn about insns that reference the target of a previous load. */ /* NOTE: R0 is a special case and is not subject to load delays (except for ldw). */ if (delayed_load_register && (last_insn_has_load_delay || last_insn_was_ldw)) { if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RD) && insn.fields.f_rd == delayed_load_register) as_warn (_("operand references R%ld of previous load."), insn.fields.f_rd); if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RS) && insn.fields.f_rs == delayed_load_register) as_warn (_("operand references R%ld of previous load."), insn.fields.f_rs); if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RT) && insn.fields.f_rt == delayed_load_register) as_warn (_("operand references R%ld of previous load."), insn.fields.f_rt); if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_R31) && delayed_load_register == 31) as_warn (_("instruction implicitly accesses R31 of previous load.")); } /* Warn about insns that reference the (target + 1) of a previous ldw. */ if (last_insn_was_ldw) { if ((CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RD) && insn.fields.f_rd == delayed_load_register + 1) || (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RS) && insn.fields.f_rs == delayed_load_register + 1) || (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RT) && insn.fields.f_rt == delayed_load_register + 1)) as_warn (_("operand references R%ld of previous load."), delayed_load_register + 1); } last_insn_had_delay_slot = CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_DELAY_SLOT); last_insn_has_load_delay = CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_LOAD_DELAY); if (last_insn_unconditional_jump) last_insn_has_load_delay = last_insn_unconditional_jump = 0; else if (! strcmp (CGEN_INSN_MNEMONIC (insn.insn), "j") || ! strcmp (CGEN_INSN_MNEMONIC (insn.insn), "jal")) last_insn_unconditional_jump = 1; /* The meaning of EVEN_REG_NUM was overloaded to also imply LDW. Since that's not true for IQ10, let's make the above logic specific to LDW. */ last_insn_was_ldw = ! strcmp ("ldw", CGEN_INSN_NAME (insn.insn)); /* The assumption here is that the target of a load is always rt. */ delayed_load_register = insn.fields.f_rt; } valueT md_section_align (segT segment, valueT size) { int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * md_undefined_symbol (char * name ATTRIBUTE_UNUSED) { return 0; } /* Interface to relax_segment. */ /* Return an initial guess of the length by which a fragment must grow to hold a branch to reach its destination. Also updates fr_type/fr_subtype as necessary. Called just before doing relaxation. Any symbol that is now undefined will not become defined. The guess for fr_var is ACTUALLY the growth beyond fr_fix. Whatever we do to grow fr_fix or fr_var contributes to our returned value. Although it may not be explicit in the frag, pretend fr_var starts with a 0 value. */ int md_estimate_size_before_relax (fragS * fragP, segT segment ATTRIBUTE_UNUSED) { int old_fr_fix = fragP->fr_fix; /* The only thing we have to handle here are symbols outside of the current segment. They may be undefined or in a different segment in which case linker scripts may place them anywhere. However, we can't finish the fragment here and emit the reloc as insn alignment requirements may move the insn about. */ return (fragP->fr_var + fragP->fr_fix - old_fr_fix); } /* *fragP has been relaxed to its final size, and now needs to have the bytes inside it modified to conform to the new size. Called after relaxation is finished. fragP->fr_type == rs_machine_dependent. fragP->fr_subtype is the subtype of what the address relaxed to. */ void md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS * fragP ATTRIBUTE_UNUSED) { } /* Functions concerning relocs. */ long md_pcrel_from_section (fixS * fixP, segT sec) { if (fixP->fx_addsy != (symbolS *) NULL && (! S_IS_DEFINED (fixP->fx_addsy) || S_GET_SEGMENT (fixP->fx_addsy) != sec)) { /* The symbol is undefined (or is defined but not in this section). Let the linker figure it out. */ return 0; } /* Return the address of the delay slot. */ return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address; } /* Return the bfd reloc type for OPERAND of INSN at fixup FIXP. Returns BFD_RELOC_NONE if no reloc type can be found. *FIXP may be modified if desired. */ bfd_reloc_code_real_type md_cgen_lookup_reloc (const CGEN_INSN * insn ATTRIBUTE_UNUSED, const CGEN_OPERAND * operand, fixS * fixP ATTRIBUTE_UNUSED) { switch (operand->type) { case IQ2000_OPERAND_OFFSET: return BFD_RELOC_16_PCREL_S2; case IQ2000_OPERAND_JMPTARG: return BFD_RELOC_IQ2000_OFFSET_16; case IQ2000_OPERAND_JMPTARGQ10: return BFD_RELOC_NONE; case IQ2000_OPERAND_HI16: return BFD_RELOC_HI16; case IQ2000_OPERAND_LO16: return BFD_RELOC_LO16; default: break; } return BFD_RELOC_NONE; } /* Record a HI16 reloc for later matching with its LO16 cousin. */ static void iq2000_record_hi16 (int reloc_type, fixS * fixP, segT seg ATTRIBUTE_UNUSED) { struct iq2000_hi_fixup * hi_fixup; gas_assert (reloc_type == BFD_RELOC_HI16); hi_fixup = XNEW (struct iq2000_hi_fixup); hi_fixup->fixp = fixP; hi_fixup->seg = now_seg; hi_fixup->next = iq2000_hi_fixup_list; iq2000_hi_fixup_list = hi_fixup; } /* Called while parsing an instruction to create a fixup. We need to check for HI16 relocs and queue them up for later sorting. */ fixS * iq2000_cgen_record_fixup_exp (fragS * frag, int where, const CGEN_INSN * insn, int length, const CGEN_OPERAND * operand, int opinfo, expressionS * exp) { fixS * fixP = gas_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp); if (operand->type == IQ2000_OPERAND_HI16 /* If low/high was used, it is recorded in `opinfo'. */ && (fixP->fx_cgen.opinfo == BFD_RELOC_HI16 || fixP->fx_cgen.opinfo == BFD_RELOC_LO16)) iq2000_record_hi16 (fixP->fx_cgen.opinfo, fixP, now_seg); return fixP; } /* Return BFD reloc type from opinfo field in a fixS. It's tricky using fx_r_type in iq2000_frob_file because the values are BFD_RELOC_UNUSED + operand number. */ #define FX_OPINFO_R_TYPE(f) ((f)->fx_cgen.opinfo) /* Sort any unmatched HI16 relocs so that they immediately precede the corresponding LO16 reloc. This is called before md_apply_fix and tc_gen_reloc. */ void iq2000_frob_file (void) { struct iq2000_hi_fixup * l; for (l = iq2000_hi_fixup_list; l != NULL; l = l->next) { segment_info_type * seginfo; int pass; gas_assert (FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_HI16 || FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_LO16); /* Check quickly whether the next fixup happens to be a matching low. */ if (l->fixp->fx_next != NULL && FX_OPINFO_R_TYPE (l->fixp->fx_next) == BFD_RELOC_LO16 && l->fixp->fx_addsy == l->fixp->fx_next->fx_addsy && l->fixp->fx_offset == l->fixp->fx_next->fx_offset) continue; /* Look through the fixups for this segment for a matching `low'. When we find one, move the high just in front of it. We do this in two passes. In the first pass, we try to find a unique `low'. In the second pass, we permit multiple high's relocs for a single `low'. */ seginfo = seg_info (l->seg); for (pass = 0; pass < 2; pass++) { fixS * f; fixS * prev; prev = NULL; for (f = seginfo->fix_root; f != NULL; f = f->fx_next) { /* Check whether this is a `low' fixup which matches l->fixp. */ if (FX_OPINFO_R_TYPE (f) == BFD_RELOC_LO16 && f->fx_addsy == l->fixp->fx_addsy && f->fx_offset == l->fixp->fx_offset && (pass == 1 || prev == NULL || (FX_OPINFO_R_TYPE (prev) != BFD_RELOC_HI16) || prev->fx_addsy != f->fx_addsy || prev->fx_offset != f->fx_offset)) { fixS ** pf; /* Move l->fixp before f. */ for (pf = &seginfo->fix_root; * pf != l->fixp; pf = & (* pf)->fx_next) gas_assert (* pf != NULL); * pf = l->fixp->fx_next; l->fixp->fx_next = f; if (prev == NULL) seginfo->fix_root = l->fixp; else prev->fx_next = l->fixp; break; } prev = f; } if (f != NULL) break; if (pass == 1) as_warn_where (l->fixp->fx_file, l->fixp->fx_line, _("Unmatched high relocation")); } } } /* See whether we need to force a relocation into the output file. */ int iq2000_force_relocation (fixS * fix) { if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return 1; return 0; } /* Handle the .set pseudo-op. */ static void s_iq2000_set (int x ATTRIBUTE_UNUSED) { static const char * ignored_arguments [] = { "reorder", "noreorder", "at", "noat", "macro", "nomacro", "move", "novolatile", "nomove", "volatile", "bopt", "nobopt", NULL }; const char ** ignored; char *name = input_line_pointer, ch; char *save_ILP = input_line_pointer; while (!is_end_of_line[(unsigned char) *input_line_pointer]) input_line_pointer++; ch = *input_line_pointer; *input_line_pointer = '\0'; for (ignored = ignored_arguments; * ignored; ignored ++) if (strcmp (* ignored, name) == 0) break; if (* ignored == NULL) { /* We'd like to be able to use .set symbol, expn */ input_line_pointer = save_ILP; s_set (0); return; } *input_line_pointer = ch; demand_empty_rest_of_line (); } /* Write a value out to the object file, using the appropriate endianness. */ void md_number_to_chars (char * buf, valueT val, int n) { number_to_chars_bigendian (buf, val, n); } void md_operand (expressionS * exp) { /* In case of a syntax error, escape back to try next syntax combo. */ if (exp->X_op == O_absent) gas_cgen_md_operand (exp); } const char * md_atof (int type, char * litP, int * sizeP) { return ieee_md_atof (type, litP, sizeP, TRUE); } bfd_boolean iq2000_fix_adjustable (fixS * fixP) { bfd_reloc_code_real_type reloc_type; if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) { const CGEN_INSN *insn = NULL; int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); reloc_type = md_cgen_lookup_reloc (insn, operand, fixP); } else reloc_type = fixP->fx_r_type; if (fixP->fx_addsy == NULL) return TRUE; /* Prevent all adjustments to global symbols. */ if (S_IS_EXTERNAL (fixP->fx_addsy)) return FALSE; if (S_IS_WEAK (fixP->fx_addsy)) return FALSE; /* We need the symbol name for the VTABLE entries. */ if ( reloc_type == BFD_RELOC_VTABLE_INHERIT || reloc_type == BFD_RELOC_VTABLE_ENTRY) return FALSE; return TRUE; } static void s_change_sec (int sec) { #ifdef OBJ_ELF /* The ELF backend needs to know that we are changing sections, so that .previous works correctly. We could do something like check for a obj_section_change_hook macro, but that might be confusing as it would not be appropriate to use it in the section changing functions in read.c, since obj-elf.c intercepts those. FIXME: This should be cleaner, somehow. */ obj_elf_section_change_hook (); #endif switch (sec) { case 't': s_text (0); break; case 'd': case 'r': s_data (0); break; } } static symbolS * get_symbol (void) { int c; char *name; symbolS *p; c = get_symbol_name (&name); p = (symbolS *) symbol_find_or_make (name); (void) restore_line_pointer (c); return p; } /* The .end directive. */ static void s_iq2000_end (int x ATTRIBUTE_UNUSED) { symbolS *p; int maybe_text; if (!is_end_of_line[(unsigned char) *input_line_pointer]) { p = get_symbol (); demand_empty_rest_of_line (); } else p = NULL; if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; if (!maybe_text) as_warn (_(".end not in text section")); if (!cur_proc_ptr) { as_warn (_(".end directive without a preceding .ent directive.")); demand_empty_rest_of_line (); return; } if (p != NULL) { gas_assert (S_GET_NAME (p)); if (strcmp (S_GET_NAME (p), S_GET_NAME (cur_proc_ptr->isym))) as_warn (_(".end symbol does not match .ent symbol.")); } else as_warn (_(".end directive missing or unknown symbol")); cur_proc_ptr = NULL; } static int get_number (void) { int negative = 0; long val = 0; if (*input_line_pointer == '-') { ++input_line_pointer; negative = 1; } if (! ISDIGIT (*input_line_pointer)) as_bad (_("Expected simple number.")); if (input_line_pointer[0] == '0') { if (input_line_pointer[1] == 'x') { input_line_pointer += 2; while (ISXDIGIT (*input_line_pointer)) { val <<= 4; val |= hex_value (*input_line_pointer++); } return negative ? -val : val; } else { ++input_line_pointer; while (ISDIGIT (*input_line_pointer)) { val <<= 3; val |= *input_line_pointer++ - '0'; } return negative ? -val : val; } } if (! ISDIGIT (*input_line_pointer)) { printf (_(" *input_line_pointer == '%c' 0x%02x\n"), *input_line_pointer, *input_line_pointer); as_warn (_("Invalid number")); return -1; } while (ISDIGIT (*input_line_pointer)) { val *= 10; val += *input_line_pointer++ - '0'; } return negative ? -val : val; } /* The .aent and .ent directives. */ static void s_iq2000_ent (int aent) { symbolS *symbolP; int maybe_text; symbolP = get_symbol (); if (*input_line_pointer == ',') input_line_pointer++; SKIP_WHITESPACE (); if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-') get_number (); if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; if (!maybe_text) as_warn (_(".ent or .aent not in text section.")); if (!aent && cur_proc_ptr) as_warn (_("missing `.end'")); if (!aent) { cur_proc_ptr = &cur_proc; memset (cur_proc_ptr, '\0', sizeof (procS)); cur_proc_ptr->isym = symbolP; symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION; numprocs++; } demand_empty_rest_of_line (); } /* The .frame directive. If the mdebug section is present (IRIX 5 native) then ecoff.c (ecoff_directive_frame) is used. For embedded targets, s_iq2000_frame is used so that we can set the PDR information correctly. We can't use the ecoff routines because they make reference to the ecoff symbol table (in the mdebug section). */ static void s_iq2000_frame (int ignore) { s_ignore (ignore); } /* The .fmask and .mask directives. If the mdebug section is present (IRIX 5 native) then ecoff.c (ecoff_directive_mask) is used. For embedded targets, s_iq2000_mask is used so that we can set the PDR information correctly. We can't use the ecoff routines because they make reference to the ecoff symbol table (in the mdebug section). */ static void s_iq2000_mask (int reg_type) { s_ignore (reg_type); } /* The target specific pseudo-ops which we support. */ const pseudo_typeS md_pseudo_table[] = { { "align", s_align_bytes, 0 }, { "word", cons, 4 }, { "rdata", s_change_sec, 'r'}, { "sdata", s_change_sec, 's'}, { "set", s_iq2000_set, 0 }, { "ent", s_iq2000_ent, 0 }, { "end", s_iq2000_end, 0 }, { "frame", s_iq2000_frame, 0 }, { "fmask", s_iq2000_mask, 'F'}, { "mask", s_iq2000_mask, 'R'}, { "dword", cons, 8 }, { "half", cons, 2 }, { NULL, NULL, 0 } };
29.475277
109
0.640603
89c949ce1e0b80d94dae15c887a74b089bb1e615
6,825
h
C
ui/ui_aboutdialog.h
ansleliu/GWMS-GermanWordMemorySoftware
4d102257a10e4c8a4cb6ad93adba2b157d773708
[ "MIT" ]
7
2017-03-15T16:50:44.000Z
2022-02-24T12:05:26.000Z
ui/ui_aboutdialog.h
ansleliu/GWMS-GermanWordMemorySoftware
4d102257a10e4c8a4cb6ad93adba2b157d773708
[ "MIT" ]
null
null
null
ui/ui_aboutdialog.h
ansleliu/GWMS-GermanWordMemorySoftware
4d102257a10e4c8a4cb6ad93adba2b157d773708
[ "MIT" ]
1
2021-12-22T06:15:41.000Z
2021-12-22T06:15:41.000Z
/******************************************************************************** ** Form generated from reading UI file 'aboutdialog.ui' ** ** Created: Tue Nov 24 04:05:56 2015 ** by: Qt User Interface Compiler version 4.8.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_ABOUTDIALOG_H #define UI_ABOUTDIALOG_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QDialog> #include <QtGui/QHeaderView> #include <QtGui/QLabel> #include <QtGui/QTextBrowser> QT_BEGIN_NAMESPACE class Ui_aboutDialog { public: QLabel *icoLabel; QTextBrowser *AboutTextBrowser; QLabel *label; void setupUi(QDialog *aboutDialog) { if (aboutDialog->objectName().isEmpty()) aboutDialog->setObjectName(QString::fromUtf8("aboutDialog")); aboutDialog->resize(462, 213); QIcon icon; icon.addFile(QString::fromUtf8(":/new/prefix2/rc/ansle.png"), QSize(), QIcon::Normal, QIcon::Off); aboutDialog->setWindowIcon(icon); icoLabel = new QLabel(aboutDialog); icoLabel->setObjectName(QString::fromUtf8("icoLabel")); icoLabel->setGeometry(QRect(10, 10, 201, 161)); icoLabel->setPixmap(QPixmap(QString::fromUtf8(":/new/prefix2/rc/pic.png"))); icoLabel->setScaledContents(true); icoLabel->setAlignment(Qt::AlignCenter); icoLabel->setWordWrap(false); AboutTextBrowser = new QTextBrowser(aboutDialog); AboutTextBrowser->setObjectName(QString::fromUtf8("AboutTextBrowser")); AboutTextBrowser->setGeometry(QRect(220, 10, 231, 171)); AboutTextBrowser->setOpenExternalLinks(true); AboutTextBrowser->setOpenLinks(true); label = new QLabel(aboutDialog); label->setObjectName(QString::fromUtf8("label")); label->setGeometry(QRect(10, 180, 451, 31)); retranslateUi(aboutDialog); QMetaObject::connectSlotsByName(aboutDialog); } // setupUi void retranslateUi(QDialog *aboutDialog) { aboutDialog->setWindowTitle(QApplication::translate("aboutDialog", " \345\205\263\344\272\216\350\275\257\344\273\266", 0, QApplication::UnicodeUTF8)); icoLabel->setText(QString()); AboutTextBrowser->setHtml(QApplication::translate("aboutDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> </span><span style=\" font-weight:600; color:#000000;\">\345\205\263\344\272\216\350\275\257\344\273\266</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">------------------------------</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#000000;\"> \350\275\257\344\273\266\345\220\215" "\347\247\260</span><span style=\" font-weight:600;\">\357\274\232 \345\276\267\350\257\255\350\203\214\345\215\225\350\257\215</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#aa0000;\"> </span><span style=\" font-weight:600; color:#ff0000;\"> \350\275\257\344\273\266\344\275\234\350\200\205\357\274\232 \345\210\230\346\205\247\345\206\233(ansleliu)</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ff0000;\"> \346\257\225\344\270\232\351\231\242\346\240\241\357\274\232 \350\245\277\345\256\211\347\224\265\345\255\220\347\247\221\346\212\200\345\244\247\345\255\246</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ff0000;\"> \346\234\254" "\347\247\221\344\270\223\344\270\232\357\274\232 \351\200\232\344\277\241\345\267\245\347\250\213</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ffaa00;\"> \345\217\221\345\270\203\346\227\245\346\234\237\357\274\232 28/08/2014</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ffaa00;\"> \345\275\223\345\211\215\347\211\210\346\234\254\357\274\232 Beta 4.2.0</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600; color:#ffaa00;\"></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ffaa00;\"> \344\272\206\350\247\243\346\233\264" "\345\244\232\346\226\260\347\211\271\346\200\247\344\270\216\344\275\277\347\224\250\346\226\271\346\263\225\350\257\267\350\256\277\351\227\256\357\274\232</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> <a href=\"http://hi.baidu.com/ansleliu\"><span style=\" font-weight:600; text-decoration: underline; color:#0000ff;\">\346\210\221\347\232\204\347\231\276\345\272\246\347\251\272\351\227\264\344\270\273\351\241\265</span></a></p></body></html>", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("aboutDialog", "\346\234\254\350\275\257\344\273\266\347\224\261(\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215-\345\271\277\345\221\212\344\275\215)\350\265\236\345\212\251\345\274\200\345\217\221", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; namespace Ui { class aboutDialog: public Ui_aboutDialog {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_ABOUTDIALOG_H
72.606383
490
0.663297
3288911693cb354d251d5a2bd92606ef7301c4f7
3,109
h
C
System/Library/PrivateFrameworks/CMCapture.framework/BWIrisSequenceAdjuster.h
lechium/tvOS144Headers
e22dcf52662ae03002e3a6d57273f54e74013cb0
[ "MIT" ]
2
2021-04-15T10:50:21.000Z
2021-08-19T19:00:09.000Z
System/Library/PrivateFrameworks/CMCapture.framework/BWIrisSequenceAdjuster.h
lechium/tvOS144Headers
e22dcf52662ae03002e3a6d57273f54e74013cb0
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/CMCapture.framework/BWIrisSequenceAdjuster.h
lechium/tvOS144Headers
e22dcf52662ae03002e3a6d57273f54e74013cb0
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.5 * on Wednesday, April 14, 2021 at 2:33:51 PM Mountain Standard Time * Operating System: Version 14.4 (Build 18K802) * Image Source: /System/Library/PrivateFrameworks/CMCapture.framework/CMCapture * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ #import <CMCapture/CMCapture-Structs.h> @class NSMutableArray, BWMotionDataPreserver; @interface BWIrisSequenceAdjuster : NSObject { NSMutableArray* _discontinuities; SCD_Struct_BW7 _firstIrisAudioOffset; NSMutableArray* _interleavingQueues; SCD_Struct_BW7 _nextAdjustedVideoTime; unsigned* _mediaTypes; NSMutableArray* _timeSkews; SCD_Struct_BW7 _masterMovieOriginalStartTime; SCD_Struct_BW7 _previewFrameDuration; SCD_Struct_BW7 _lastVideoAdjustedTime; BWMotionDataPreserver* _motionDataPreserver; int _audioOffsetForOriginalStillImageTimeMaximumFrameLatency; } @property (assign,nonatomic) int audioOffsetForOriginalStillImageTimeMaximumFrameLatency; //@synthesize audioOffsetForOriginalStillImageTimeMaximumFrameLatency=_audioOffsetForOriginalStillImageTimeMaximumFrameLatency - In the implementation block @property (assign,nonatomic) SCD_Struct_BW7 masterMovieOriginalStartTime; @property (readonly) BOOL readyToReleaseAudio; +(void)initialize; -(void)dealloc; -(void)reset; -(id)initWithMediaTypes:(id)arg1 visMotionMetadataPreloadingEnabled:(BOOL)arg2 ; -(void)enqueueVideoBufferTime:(SCD_Struct_BW7)arg1 nativeTime:(SCD_Struct_BW7)arg2 isBracketFrame:(BOOL)arg3 isSISFrame:(BOOL)arg4 ; -(void)adjustMovieInfoTimes:(id)arg1 ; -(BOOL)readyToReleaseAudio; -(void)enqueueSampleBuffer:(opaqueCMSampleBufferRef)arg1 forMediaTypeWithIndex:(long long)arg2 ; -(SCD_Struct_BW7)audioOffsetForOriginalStillImageTime:(SCD_Struct_BW7)arg1 ; -(opaqueCMSampleBufferRef)dequeueAndRetainAdjustedSampleBufferForMediaTypeWithIndex:(long long)arg1 ; -(SCD_Struct_BW7)adjustedTimeForStillImageTime:(SCD_Struct_BW7)arg1 ; -(int)audioOffsetForOriginalStillImageTimeMaximumFrameLatency; -(void)setMasterMovieOriginalStartTime:(SCD_Struct_BW7)arg1 ; -(SCD_Struct_BW7)_adjustedTimeForAudioBufferWithTime:(SCD_Struct_BW7)arg1 ; -(SCD_Struct_BW7)_adjustedTimeForVideoBufferWithTime:(SCD_Struct_BW7)arg1 ; -(SCD_Struct_BW7)_audioOffsetForOriginalStillImageTime:(SCD_Struct_BW7)arg1 adjustedStillImageTime:(SCD_Struct_BW7)arg2 ; -(SCD_Struct_BW7)_adjustedTimeForMetadataBufferWithTime:(SCD_Struct_BW7)arg1 ; -(SCD_Struct_BW7)adjustedTimeForTime:(SCD_Struct_BW7)arg1 ; -(BOOL)_getPreviousTimeSkewOut:(id*)arg1 andNextTimeSkewOut:(id*)arg2 forTime:(SCD_Struct_BW7)arg3 ; -(long long)_indexOfTime:(SCD_Struct_BW7)arg1 ; -(SCD_Struct_BW7)_originalDurationForVideoBufferWithTime:(SCD_Struct_BW7)arg1 ; -(void)_adjustTimesInAudioInterleavingQueues; -(SCD_Struct_BW7)masterMovieOriginalStartTime; -(id)_timeSkewsDescription; -(void)setAudioOffsetForOriginalStillImageTimeMaximumFrameLatency:(int)arg1 ; @end
52.694915
259
0.812158
c5c3270c3a86e705e8285f25dcedeace7dbc460a
6,637
c
C
ial_2014_du2/c016/c016.c
argorain/balg
29ec6e57cf4ba27ae215c9a9fe59e58c53b090ea
[ "MIT" ]
null
null
null
ial_2014_du2/c016/c016.c
argorain/balg
29ec6e57cf4ba27ae215c9a9fe59e58c53b090ea
[ "MIT" ]
null
null
null
ial_2014_du2/c016/c016.c
argorain/balg
29ec6e57cf4ba27ae215c9a9fe59e58c53b090ea
[ "MIT" ]
null
null
null
/* c016.c: **********************************************************} {* Téma: Tabulka s Rozptýlenými Položkami ** První implementace: Petr Přikryl, prosinec 1994 ** Do jazyka C prepsal a upravil: Vaclav Topinka, 2005 ** Úpravy: Karel Masařík, říjen 2014 ** Úpravy: Radek Hranický, říjen 2014 ** ** Vytvořete abstraktní datový typ ** TRP (Tabulka s Rozptýlenými Položkami = Hash table) ** s explicitně řetězenými synonymy. Tabulka je implementována polem ** lineárních seznamů synonym. ** ** Implementujte následující procedury a funkce. ** ** HTInit ....... inicializuje tabulku před prvním použitím ** HTInsert ..... vložení prvku ** HTSearch ..... zjištění přítomnosti prvku v tabulce ** HTDelete ..... zrušení prvku ** HTRead ....... přečtení hodnoty prvku ** HTClearAll ... zrušení obsahu celé tabulky (inicializace tabulky ** poté, co již byla použita) ** ** Definici typů naleznete v souboru c016.h. ** ** Tabulka je reprezentována datovou strukturou typu tHTable, ** která se skládá z ukazatelů na položky, jež obsahují složky ** klíče 'key', obsahu 'data' (pro jednoduchost typu float), a ** ukazatele na další synonymum 'ptrnext'. Při implementaci funkcí ** uvažujte maximální rozměr pole HTSIZE. ** ** U všech procedur využívejte rozptylovou funkci hashCode. Povšimněte si ** způsobu předávání parametrů a zamyslete se nad tím, zda je možné parametry ** předávat jiným způsobem (hodnotou/odkazem) a v případě, že jsou obě ** možnosti funkčně přípustné, jaké jsou výhody či nevýhody toho či onoho ** způsobu. ** ** V příkladech jsou použity položky, kde klíčem je řetězec, ke kterému ** je přidán obsah - reálné číslo. */ #include "c016.h" int HTSIZE = MAX_HTSIZE; int solved; /* ------- ** Rozptylovací funkce - jejím úkolem je zpracovat zadaný klíč a přidělit ** mu index v rozmezí 0..HTSize-1. V ideálním případě by mělo dojít ** k rovnoměrnému rozptýlení těchto klíčů po celé tabulce. V rámci ** pokusů se můžete zamyslet nad kvalitou této funkce. (Funkce nebyla ** volena s ohledem na maximální kvalitu výsledku). } */ int hashCode ( tKey key ) { int retval = 1; int keylen = strlen(key); for ( int i=0; i<keylen; i++ ) retval += key[i]; return ( retval % HTSIZE ); } /* ** Inicializace tabulky s explicitně zřetězenými synonymy. Tato procedura ** se volá pouze před prvním použitím tabulky. */ void htInit ( tHTable* ptrht ) { for(int i=0; i< MAX_HTSIZE; i++){ //všechny řádky tabulky nastaví na NULL (*ptrht)[i]=NULL; } } /* TRP s explicitně zřetězenými synonymy. ** Vyhledání prvku v TRP ptrht podle zadaného klíče key. Pokud je ** daný prvek nalezen, vrací se ukazatel na daný prvek. Pokud prvek nalezen není, ** vrací se hodnota NULL. ** */ tHTItem* htSearch ( tHTable* ptrht, tKey key ) { tHTItem *tmp; int hash = hashCode(key); //spočítáme hash kde by měl být int line = hash % (MAX_HTSIZE + 1); //a z hashe řádku tmp=(*ptrht)[line]; //vlezeme na řádku while (tmp!=NULL){ //a dokud není null, hledáme v řádce if (tmp->key==key) //sedí klíče? když ano, vracíme pointer return tmp; tmp=tmp->ptrnext; //jinak hledáme dál } return NULL; //a když nic, tak null } /* ** TRP s explicitně zřetězenými synonymy. ** Tato procedura vkládá do tabulky ptrht položku s klíčem key a s daty ** data. Protože jde o vyhledávací tabulku, nemůže být prvek se stejným ** klíčem uložen v tabulce více než jedenkrát. Pokud se vkládá prvek, ** jehož klíč se již v tabulce nachází, aktualizujte jeho datovou část. ** ** Využijte dříve vytvořenou funkci htSearch. Při vkládání nového ** prvku do seznamu synonym použijte co nejefektivnější způsob, ** tedy proveďte.vložení prvku na začátek seznamu. **/ void htInsert ( tHTable* ptrht, tKey key, tData data ) { tHTItem *tmp; if((tmp=htSearch(ptrht, key))==NULL) { //vyhledá prvek který chceme vložit int hash = hashCode(key); //když neexistuje, spočítáme jeho hash int line = hash % (MAX_HTSIZE + 1); //z hashe řádku tmp = malloc(sizeof(tHTItem)); //zaalokujeme prostor tmp->ptrnext = (*ptrht)[line]; //zavěsíme následující položky (nebo NULL) tmp->key = key; //vložíme klíč tmp->data = data; //a data (*ptrht)[line] = tmp; //a vložíme do tabulky }else{ tmp->data=data; //pokud existuje, přepíšeme data } //solved = 0; /*v pripade reseni, smazte tento radek!*/ } /* ** TRP s explicitně zřetězenými synonymy. ** Tato funkce zjišťuje hodnotu datové části položky zadané klíčem. ** Pokud je položka nalezena, vrací funkce ukazatel na položku ** Pokud položka nalezena nebyla, vrací se funkční hodnota NULL ** ** Využijte dříve vytvořenou funkci HTSearch. */ tData* htRead ( tHTable* ptrht, tKey key ) { return &(htSearch(ptrht, key)->data); //najde pomocí search a vrací data //solved = 0; /*v pripade reseni, smazte tento radek!*/ } /* ** TRP s explicitně zřetězenými synonymy. ** Tato procedura vyjme položku s klíčem key z tabulky ** ptrht. Uvolněnou položku korektně zrušte. Pokud položka s uvedeným ** klíčem neexistuje, dělejte, jako kdyby se nic nestalo (tj. nedělejte ** nic). ** ** V tomto případě NEVYUŽÍVEJTE dříve vytvořenou funkci HTSearch. */ void htDelete ( tHTable* ptrht, tKey key ) { int hash = hashCode(key); //spočítá hash int line = hash % (MAX_HTSIZE + 1); //z hashe řádek tHTItem *tmp = (*ptrht)[line]; //uloží si nalezený prvek (*ptrht)[line]=tmp->ptrnext; //přepojí zbytek tabulky free(tmp); //uvolní paměť //solved = 0; /*v pripade reseni, smazte tento radek!*/ } /* TRP s explicitně zřetězenými synonymy. ** Tato procedura zruší všechny položky tabulky, korektně uvolní prostor, ** který tyto položky zabíraly, a uvede tabulku do počátečního stavu. */ void htClearAll ( tHTable* ptrht ) { tHTItem *tmp; for(int i=0; i< MAX_HTSIZE; i++){ //projde celou tabulku řádek po řádku while((*ptrht)[i]!=NULL) { //projde každý řádek (tj dokud je ptrnext různý od NULL) tmp = (*ptrht)[i]; (*ptrht)[i] = tmp->ptrnext; //posunutí dále free(tmp); //uvolnění } } //solved = 0; /*v pripade reseni, smazte tento radek!*/ }
38.587209
100
0.634925
65d81077b657f08b85db453d75dfc790f1a4dc84
3,401
c
C
lib/libfsid/msdosfs.c
lambdaxymox/DragonFlyBSD
6379cf2998a4a073c65b12d99e62988a375b4598
[ "BSD-3-Clause" ]
432
2015-01-03T20:05:29.000Z
2022-03-24T16:39:09.000Z
lib/libfsid/msdosfs.c
lambdaxymox/DragonFlyBSD
6379cf2998a4a073c65b12d99e62988a375b4598
[ "BSD-3-Clause" ]
8
2015-12-03T15:45:38.000Z
2020-12-25T15:42:08.000Z
lib/libfsid/msdosfs.c
lambdaxymox/DragonFlyBSD
6379cf2998a4a073c65b12d99e62988a375b4598
[ "BSD-3-Clause" ]
114
2015-01-07T16:23:00.000Z
2022-03-23T18:26:01.000Z
/* * Copyright (c) 2010 The DragonFly Project. All rights reserved. * * This code is derived from software contributed to The DragonFly Project * by Alex Hornung <ahornung@gmail.com * and Ákos Kovács <akoskovacs@gmx.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name of The DragonFly Project 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 HOLDERS 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 "libfsid.h" #include <vfs/msdosfs/bootsect.h> #define MSDOS_BOOT_BLOCK_SIZE 512 static char *get_volname(char *buf); static char buffer[MSDOS_BOOT_BLOCK_SIZE * 4]; fsid_t msdosfs_probe(const char *dev) { if (fsid_dev_read(dev, 0L, sizeof(buffer), buffer) != 0) return FSID_UNKNOWN; if (get_volname(buffer) != NULL) return FSID_MSDOSFS; return FSID_MSDOSFS; } char * msdosfs_volname(const char *dev) { char *volname; if (fsid_dev_read(dev, 0L, sizeof(buffer), buffer) != 0) return NULL; volname = get_volname(buffer); if (volname == NULL || volname[0] == '\0') return NULL; volname[sizeof(volname) - 1] = '\0'; return volname; } /* * This function used to get the offset address of * the volume name, of the FAT partition. * It also checks, that is a real FAT partition. */ static char * get_volname(char *buff) { struct bootsector710 *bpb7; struct bootsector50 *bpb4; struct extboot *extb; bpb7 = (struct bootsector710 *)buff; bpb4 = (struct bootsector50 *)buff; /* * First, assume BPB v7 */ extb = (struct extboot *)bpb7->bsExt; if ((extb->exBootSignature == 0x28 || extb->exBootSignature == 0x29) && strncmp(extb->exFileSysType, "FAT", 3) == 0) return extb->exVolumeLabel; /* * If this is not a BPB v7, try it as a bpb v4. */ extb = (struct extboot *)bpb4->bsExt; if ((extb->exBootSignature == EXBOOTSIG || extb->exBootSignature == EXBOOTSIG2) && strncmp(extb->exFileSysType, "FAT", 3) == 0) return extb->exVolumeLabel; /* * If previous checks failed, it may not a FAT filesystem, or * it may an older one without a volume name. */ return NULL; }
30.366071
74
0.721258
d6a1c4fb0aead2aaa89c8720e7cc623a5ff47fd9
10,345
c
C
core/dev/slip.c
s3lsensor/CEE155_SensorDeployLab_b
ad2d9ccf13ecfacb0a73115548fccfee3120f2a1
[ "Apache-2.0" ]
5
2016-05-20T10:40:23.000Z
2019-11-04T20:46:58.000Z
core/dev/slip.c
s3lsensor/CEE155_SensorDeployLab_b
ad2d9ccf13ecfacb0a73115548fccfee3120f2a1
[ "Apache-2.0" ]
6
2016-02-18T22:29:26.000Z
2016-02-18T22:31:54.000Z
core/dev/slip.c
s3lsensor/CEE155_SensorDeployLab_b
ad2d9ccf13ecfacb0a73115548fccfee3120f2a1
[ "Apache-2.0" ]
7
2015-11-24T23:09:12.000Z
2022-02-18T07:56:02.000Z
/* -*- C -*- */ /* * Copyright (c) 2005, Swedish Institute of Computer Science * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This file is part of the Contiki operating system. * * @(#)$Id: slip.c,v 1.12 2010/12/23 22:38:47 dak664 Exp $ */ #include <stdio.h> #include <string.h> #include "contiki.h" #include "net/uip.h" #include "net/uip-fw.h" #define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) #include "dev/slip.h" #define SLIP_END 0300 #define SLIP_ESC 0333 #define SLIP_ESC_END 0334 #define SLIP_ESC_ESC 0335 PROCESS(slip_process, "SLIP driver"); uint8_t slip_active; #if 1 #define SLIP_STATISTICS(statement) #else uint16_t slip_rubbish, slip_twopackets, slip_overflow, slip_ip_drop; #define SLIP_STATISTICS(statement) statement #endif /* Must be at least one byte larger than UIP_BUFSIZE! */ #define RX_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN + 16) enum { STATE_TWOPACKETS = 0, /* We have 2 packets and drop incoming data. */ STATE_OK = 1, STATE_ESC = 2, STATE_RUBBISH = 3, }; /* * Variables begin and end manage the buffer space in a cyclic * fashion. The first used byte is at begin and end is one byte past * the last. I.e. [begin, end) is the actively used space. * * If begin != pkt_end we have a packet at [begin, pkt_end), * furthermore, if state == STATE_TWOPACKETS we have one more packet at * [pkt_end, end). If more bytes arrive in state STATE_TWOPACKETS * they are discarded. */ static uint8_t state = STATE_TWOPACKETS; static uint16_t begin, end; static uint8_t rxbuf[RX_BUFSIZE]; static uint16_t pkt_end; /* SLIP_END tracker. */ static void (* input_callback)(void) = NULL; /*---------------------------------------------------------------------------*/ void slip_set_input_callback(void (*c)(void)) { input_callback = c; } /*---------------------------------------------------------------------------*/ /* slip_send: forward (IPv4) packets with {UIP_FW_NETIF(..., slip_send)} * was used in slip-bridge.c */ //#if WITH_UIP uint8_t slip_send(void) { uint16_t i; uint8_t *ptr; uint8_t c; slip_arch_writeb(SLIP_END); ptr = &uip_buf[UIP_LLH_LEN]; for(i = 0; i < uip_len; ++i) { if(i == UIP_TCPIP_HLEN) { ptr = (uint8_t *)uip_appdata; } c = *ptr++; if(c == SLIP_END) { slip_arch_writeb(SLIP_ESC); c = SLIP_ESC_END; } else if(c == SLIP_ESC) { slip_arch_writeb(SLIP_ESC); c = SLIP_ESC_ESC; } slip_arch_writeb(c); } slip_arch_writeb(SLIP_END); return UIP_FW_OK; } //#endif /* WITH_UIP */ /*---------------------------------------------------------------------------*/ uint8_t slip_write(const void *_ptr, int len) { const uint8_t *ptr = _ptr; uint16_t i; uint8_t c; slip_arch_writeb(SLIP_END); for(i = 0; i < len; ++i) { c = *ptr++; if(c == SLIP_END) { slip_arch_writeb(SLIP_ESC); c = SLIP_ESC_END; } else if(c == SLIP_ESC) { slip_arch_writeb(SLIP_ESC); c = SLIP_ESC_ESC; } slip_arch_writeb(c); } slip_arch_writeb(SLIP_END); return len; } /*---------------------------------------------------------------------------*/ static void rxbuf_init(void) { begin = end = pkt_end = 0; state = STATE_OK; } /*---------------------------------------------------------------------------*/ /* Upper half does the polling. */ static uint16_t slip_poll_handler(uint8_t *outbuf, uint16_t blen) { /* This is a hack and won't work across buffer edge! */ if(rxbuf[begin] == 'C') { int i; if(begin < end && (end - begin) >= 6 && memcmp(&rxbuf[begin], "CLIENT", 6) == 0) { state = STATE_TWOPACKETS; /* Interrupts do nothing. */ memset(&rxbuf[begin], 0x0, 6); rxbuf_init(); for(i = 0; i < 13; i++) { slip_arch_writeb("CLIENTSERVER\300"[i]); } return 0; } } #ifdef SLIP_CONF_ANSWER_MAC_REQUEST else if(rxbuf[begin] == '?') { /* Used by tapslip6 to request mac for auto configure */ int i, j; char* hexchar = "0123456789abcdef"; if(begin < end && (end - begin) >= 2 && rxbuf[begin + 1] == 'M') { state = STATE_TWOPACKETS; /* Interrupts do nothing. */ rxbuf[begin] = 0; rxbuf[begin + 1] = 0; rxbuf_init(); rimeaddr_t addr = get_mac_addr(); /* this is just a test so far... just to see if it works */ slip_arch_writeb('!'); slip_arch_writeb('M'); for(j = 0; j < 8; j++) { slip_arch_writeb(hexchar[addr.u8[j] >> 4]); slip_arch_writeb(hexchar[addr.u8[j] & 15]); } slip_arch_writeb(SLIP_END); return 0; } } #endif /* SLIP_CONF_ANSWER_MAC_REQUEST */ /* * Interrupt can not change begin but may change pkt_end. * If pkt_end != begin it will not change again. */ if(begin != pkt_end) { uint16_t len; if(begin < pkt_end) { len = pkt_end - begin; if(len > blen) { len = 0; } else { memcpy(outbuf, &rxbuf[begin], len); } } else { len = (RX_BUFSIZE - begin) + (pkt_end - 0); if(len > blen) { len = 0; } else { unsigned i; for(i = begin; i < RX_BUFSIZE; i++) { *outbuf++ = rxbuf[i]; } for(i = 0; i < pkt_end; i++) { *outbuf++ = rxbuf[i]; } } } /* Remove data from buffer together with the copied packet. */ begin = pkt_end; if(state == STATE_TWOPACKETS) { pkt_end = end; state = STATE_OK; /* Assume no bytes where lost! */ /* One more packet is buffered, need to be polled again! */ process_poll(&slip_process); } return len; } return 0; } /*---------------------------------------------------------------------------*/ PROCESS_THREAD(slip_process, ev, data) { PROCESS_BEGIN(); rxbuf_init(); while(1) { PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); slip_active = 1; /* Move packet from rxbuf to buffer provided by uIP. */ uip_len = slip_poll_handler(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN); #if !UIP_CONF_IPV6 if(uip_len == 4 && strncmp((char*)&uip_buf[UIP_LLH_LEN], "?IPA", 4) == 0) { char buf[8]; memcpy(&buf[0], "=IPA", 4); memcpy(&buf[4], &uip_hostaddr, 4); if(input_callback) { input_callback(); } slip_write(buf, 8); } else if(uip_len > 0 && uip_len == (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) && uip_ipchksum() == 0xffff) { #define IP_DF 0x40 if(BUF->ipid[0] == 0 && BUF->ipid[1] == 0 && BUF->ipoffset[0] & IP_DF) { static uint16_t ip_id; uint16_t nid = ip_id++; BUF->ipid[0] = nid >> 8; BUF->ipid[1] = nid; nid = uip_htons(nid); nid = ~nid; /* negate */ BUF->ipchksum += nid; /* add */ if(BUF->ipchksum < nid) { /* 1-complement overflow? */ BUF->ipchksum++; } } #ifdef SLIP_CONF_TCPIP_INPUT SLIP_CONF_TCPIP_INPUT(); #else tcpip_input(); #endif } else { uip_len = 0; SLIP_STATISTICS(slip_ip_drop++); } #else /* UIP_CONF_IPV6 */ if(uip_len > 0) { if(input_callback) { input_callback(); } #ifdef SLIP_CONF_TCPIP_INPUT SLIP_CONF_TCPIP_INPUT(); #else tcpip_input(); #endif } #endif /* UIP_CONF_IPV6 */ } PROCESS_END(); } /*---------------------------------------------------------------------------*/ int slip_input_byte(unsigned char c) { switch(state) { case STATE_RUBBISH: if(c == SLIP_END) { state = STATE_OK; } return 0; case STATE_TWOPACKETS: /* Two packets are already buffered! */ return 0; case STATE_ESC: if(c == SLIP_ESC_END) { c = SLIP_END; } else if(c == SLIP_ESC_ESC) { c = SLIP_ESC; } else { state = STATE_RUBBISH; SLIP_STATISTICS(slip_rubbish++); end = pkt_end; /* remove rubbish */ return 0; } state = STATE_OK; break; case STATE_OK: if(c == SLIP_ESC) { state = STATE_ESC; return 0; } else if(c == SLIP_END) { /* * We have a new packet, possibly of zero length. * * There may already be one packet buffered. */ if(end != pkt_end) { /* Non zero length. */ if(begin == pkt_end) { /* None buffered. */ pkt_end = end; } else { state = STATE_TWOPACKETS; SLIP_STATISTICS(slip_twopackets++); } process_poll(&slip_process); return 1; } return 0; } break; } /* add_char: */ { unsigned next; next = end + 1; if(next == RX_BUFSIZE) { next = 0; } if(next == begin) { /* rxbuf is full */ state = STATE_RUBBISH; SLIP_STATISTICS(slip_overflow++); end = pkt_end; /* remove rubbish */ return 0; } rxbuf[end] = c; end = next; } /* There could be a separate poll routine for this. */ if(c == 'T' && rxbuf[begin] == 'C') { process_poll(&slip_process); return 1; } return 0; } /*---------------------------------------------------------------------------*/
26.057935
79
0.586177
aaa5b9d453d646ae50ddd4ff16d66dc734b0bf11
1,553
h
C
include/inoreader_api.h
adiel-mittmann/newsboat
8011952624387f0b2fcb18ba5d96382c257764c2
[ "MIT" ]
null
null
null
include/inoreader_api.h
adiel-mittmann/newsboat
8011952624387f0b2fcb18ba5d96382c257764c2
[ "MIT" ]
null
null
null
include/inoreader_api.h
adiel-mittmann/newsboat
8011952624387f0b2fcb18ba5d96382c257764c2
[ "MIT" ]
null
null
null
#ifndef NEWSBOAT_INOREADER_API_H_ #define NEWSBOAT_INOREADER_API_H_ #include <remote_api.h> #include <urlreader.h> #include <cache.h> namespace newsboat { class inoreader_api : public remote_api { public: explicit inoreader_api(configcontainer * c); virtual ~inoreader_api(); virtual bool authenticate(); virtual std::vector<tagged_feedurl> get_subscribed_urls(); virtual void add_custom_headers(curl_slist** custom_headers); virtual bool mark_all_read(const std::string& feedurl); virtual bool mark_article_read(const std::string& guid, bool read); virtual bool update_article_flags(const std::string& inoflags, const std::string& newflags, const std::string& guid); private: std::vector<std::string> get_tags(xmlNode * node); std::string get_new_token(); std::string retrieve_auth(); std::string post_content(const std::string& url, const std::string& postdata); bool star_article(const std::string& guid, bool star); bool share_article(const std::string& guid, bool share); bool mark_article_read_with_token(const std::string& guid, bool read, const std::string& token); std::string auth; std::string auth_header; }; class inoreader_urlreader : public urlreader { public: inoreader_urlreader(configcontainer * c, const std::string& url_file, remote_api * a); virtual ~inoreader_urlreader(); virtual void write_config(); virtual void reload(); virtual std::string get_source(); private: configcontainer * cfg; std::string file; remote_api * api; }; } #endif /* NEWSBOAT_INOREADER_API_H_ */
31.693878
119
0.754024
45f62ef10c3b5f083e7a85a48a74aadb1fd79a57
5,353
h
C
SimVascular-master/Code/Source/vtkSV/Modules/Boolean/vtkSVLoopBooleanPolyDataFilter.h
mccsssk2/SimVascularPM3_March2020
3cce6cc7be66545bea5dc3915a2db50a3892bf04
[ "BSD-3-Clause" ]
null
null
null
SimVascular-master/Code/Source/vtkSV/Modules/Boolean/vtkSVLoopBooleanPolyDataFilter.h
mccsssk2/SimVascularPM3_March2020
3cce6cc7be66545bea5dc3915a2db50a3892bf04
[ "BSD-3-Clause" ]
null
null
null
SimVascular-master/Code/Source/vtkSV/Modules/Boolean/vtkSVLoopBooleanPolyDataFilter.h
mccsssk2/SimVascularPM3_March2020
3cce6cc7be66545bea5dc3915a2db50a3892bf04
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) Stanford University, The Regents of the University of * California, and others. * * All Rights Reserved. * * See Copyright-SimVascular.txt for additional details. * * 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. * * 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. */ /** * \class vtkSVLoopBooleanPolyDataFilter * * \brief Computes the boundary of the union, intersection, or difference * volume computed from the volumes defined by two input surfaces. * * \details The two surfaces do not need to be manifold, but if they are not, * unexpected results may be obtained. The resulting surface is * available in the first output of the filter. The second output * contains a set of polylines that represent the intersection between * the two input surfaces. * The filter uses vtkSVLoopIntersectionPolyDataFilter. Must have information * about the cells on mesh that the intersection lines touch. Filter assumes * this information is given. * The ouput result will have data about the Original Surface, * BoundaryPoints, Boundary Cells, * Free Edges, and Bad Triangles * * \author Adam Updegrove * \author updega2@gmail.com * \author UC Berkeley * \author shaddenlab.berkeley.edu */ #ifndef vtkSVLoopBooleanPolyDataFilter_h #define vtkSVLoopBooleanPolyDataFilter_h #include "vtkSVBooleanModule.h" // For export macro #include "vtkPolyDataAlgorithm.h" class VTKSVBOOLEAN_EXPORT vtkSVLoopBooleanPolyDataFilter : public vtkPolyDataAlgorithm { public: /// \brief Construct object that computes the boolean surface. static vtkSVLoopBooleanPolyDataFilter *New(); vtkTypeMacro(vtkSVLoopBooleanPolyDataFilter, vtkPolyDataAlgorithm); // PrintSelf void PrintSelf(ostream& os, vtkIndent indent) override; //@{ /// \brief Integer describing the number of intersection points and lines vtkGetMacro(NumberOfIntersectionPoints, int); vtkGetMacro(NumberOfIntersectionLines, int); //@} //@{ /// \brief Variable to determine what is output if no intersection occurs. /// \details ONLY USED IF NO INTERSECTION BETWEEN SURFACES. /// 0 = neither (default), 1 = first, 2 = second, 3 = both vtkGetMacro(NoIntersectionOutput, int); vtkSetMacro(NoIntersectionOutput, int); vtkBooleanMacro(NoIntersectionOutput, int); //@} /// \brief Union intersection, or difference enum OperationType { VTK_UNION=0, VTK_INTERSECTION, VTK_DIFFERENCE }; /// \brief Output if no intersection enum NoIntersectionOutputType { VTK_NEITHER=0, VTK_FIRST, VTK_SECOND, VTK_BOTH, }; //@{ /// \brief Set the boolean operation to perform. Defaults to union. vtkSetClampMacro( Operation, int, VTK_UNION, VTK_DIFFERENCE ); vtkGetMacro( Operation, int ); void SetOperationToUnion() { this->SetOperation( VTK_UNION ); } void SetOperationToIntersection() { this->SetOperation( VTK_INTERSECTION ); } void SetOperationToDifference() { this->SetOperation( VTK_DIFFERENCE ); } //@} /// \brief Check the status of the filter after update. /// \details If the status is zero, there was an error in the operation. /// If status is one, everything went smoothly. vtkGetMacro(Status, int); /// \brief Set the tolerance for geometric tests. vtkGetMacro(Tolerance, double); vtkSetMacro(Tolerance, double); protected: vtkSVLoopBooleanPolyDataFilter(); ~vtkSVLoopBooleanPolyDataFilter(); int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; int FillInputPortInformation(int, vtkInformation*) override; vtkPolyData *OutputSurface; int Operation; int NoIntersectionOutput; int NumberOfIntersectionPoints; int NumberOfIntersectionLines; int Status; double Tolerance; /// brief A class containing the actual implementation. Called during Update class Impl; private: vtkSVLoopBooleanPolyDataFilter(const vtkSVLoopBooleanPolyDataFilter&); // Not implemented void operator=(const vtkSVLoopBooleanPolyDataFilter&); // Not implemented }; #endif
34.095541
92
0.749113
43d0786b2fe1ec5221c904ef3af674de454dbefb
379
c
C
07_11_pr05.c
CodeMacrocosm/C-BOOK
5d48bb33549371f9eede2221e8082ca462127cf1
[ "MIT" ]
9
2021-05-18T06:25:21.000Z
2021-12-31T23:24:10.000Z
07_11_pr05.c
shreyamalogi/C-BOOK
5d48bb33549371f9eede2221e8082ca462127cf1
[ "MIT" ]
null
null
null
07_11_pr05.c
shreyamalogi/C-BOOK
5d48bb33549371f9eede2221e8082ca462127cf1
[ "MIT" ]
7
2021-05-18T06:58:20.000Z
2022-01-25T07:31:08.000Z
#include<stdio.h> void reverse(int *arr, int n){ int temp; for(int i=0; i<(n/2); i++){ temp = arr[i]; arr[i] = arr[n-i-1]; arr[n-i-1] = temp; } } int main(){ int arr[] = {1,2,3,4,5,6,7}; reverse(arr, 7); for(int i=0; i<7; i++){ printf("The value of %d element is: %d\n", i, arr[i]); } return 0; }
21.055556
64
0.430079
a2dcbf3727ec0c77eb0bada2b622b84e28f9787d
854
h
C
usr/libexec/tursd/TUDialRequest-NanoPhone.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
usr/libexec/tursd/TUDialRequest-NanoPhone.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
usr/libexec/tursd/TUDialRequest-NanoPhone.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 Steve Nygard. // #import <TelephonyUtilities/TUDialRequest.h> @class NPHDialRequestDisplayDetails, NSArray, NSString; @interface TUDialRequest (NanoPhone) + (void)_logProvider:(id)arg1; // IMP=0x000000010000b904 @property(nonatomic) _Bool nph_injectFallDetectAudioMessage; @property(copy, nonatomic) NSString *nph_errorAlertMessage; @property(copy, nonatomic) NSArray *nph_disambiguationDestinations; - (void)nph_logWithReason:(id)arg1 indented:(_Bool)arg2; // IMP=0x000000010000b7f4 @property(readonly, nonatomic) _Bool nph_needsRTTDisambiguationPrompt; @property(readonly, nonatomic) _Bool nph_needsPrompt; @property(readonly, nonatomic) NPHDialRequestDisplayDetails *nph_displayDetails; @end
38.818182
120
0.800937
2e9c7b815ceb23472b4077a21b2c4343198f9dcc
3,105
h
C
firmware/coreboot/src/include/console/uart.h
fabiojna02/OpenCellular
45b6a202d6b2e2485c89955b9a6da920c4d56ddb
[ "CC-BY-4.0", "BSD-3-Clause" ]
1
2019-11-04T07:11:25.000Z
2019-11-04T07:11:25.000Z
firmware/coreboot/src/include/console/uart.h
fabiojna02/OpenCellular
45b6a202d6b2e2485c89955b9a6da920c4d56ddb
[ "CC-BY-4.0", "BSD-3-Clause" ]
13
2018-10-12T21:29:09.000Z
2018-10-25T20:06:51.000Z
firmware/coreboot/src/include/console/uart.h
fabiojna02/OpenCellular
45b6a202d6b2e2485c89955b9a6da920c4d56ddb
[ "CC-BY-4.0", "BSD-3-Clause" ]
null
null
null
/* * This file is part of the coreboot project. * * Copyright (C) 2012 The ChromiumOS Authors. All rights reserved. * * 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; version 2 of the 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. */ #ifndef CONSOLE_UART_H #define CONSOLE_UART_H #include <rules.h> #include <stdint.h> /* Return the clock frequency UART uses as reference clock for * baudrate generator. */ unsigned int uart_platform_refclk(void); #if IS_ENABLED(CONFIG_UART_OVERRIDE_BAUDRATE) /* Return the baudrate, define this in your platform when using the above configuration. */ unsigned int get_uart_baudrate(void); #else static inline unsigned int get_uart_baudrate(void) { return CONFIG_TTYS0_BAUD; } #endif /* Returns the divisor value for a given baudrate. * The formula to satisfy is: * refclk / divisor = baudrate * oversample */ unsigned int uart_baudrate_divisor(unsigned int baudrate, unsigned int refclk, unsigned int oversample); /* Returns the oversample divisor multiplied by any other divisors that act * on the input clock */ unsigned int uart_input_clock_divider(void); /* Bitbang out one byte on an 8n1 UART through the output function set_tx(). */ void uart_bitbang_tx_byte(unsigned char data, void (*set_tx)(int line_state)); void uart_init(int idx); void uart_tx_byte(int idx, unsigned char data); void uart_tx_flush(int idx); unsigned char uart_rx_byte(int idx); uintptr_t uart_platform_base(int idx); #if !defined(__ROMCC__) static inline void *uart_platform_baseptr(int idx) { return (void *)uart_platform_base(idx); } void oxford_remap(unsigned int new_base); #define __CONSOLE_SERIAL_ENABLE__ (IS_ENABLED(CONFIG_CONSOLE_SERIAL) && \ (ENV_BOOTBLOCK || ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_VERSTAGE || \ ENV_POSTCAR || (ENV_SMM && IS_ENABLED(CONFIG_DEBUG_SMI)))) #if __CONSOLE_SERIAL_ENABLE__ static inline void __uart_init(void) { uart_init(CONFIG_UART_FOR_CONSOLE); } static inline void __uart_tx_byte(u8 data) { uart_tx_byte(CONFIG_UART_FOR_CONSOLE, data); } static inline void __uart_tx_flush(void) { uart_tx_flush(CONFIG_UART_FOR_CONSOLE); } #else static inline void __uart_init(void) {} static inline void __uart_tx_byte(u8 data) {} static inline void __uart_tx_flush(void) {} #endif #if IS_ENABLED(CONFIG_GDB_STUB) && (ENV_ROMSTAGE || ENV_RAMSTAGE) #define CONFIG_UART_FOR_GDB CONFIG_UART_FOR_CONSOLE static inline void __gdb_hw_init(void) { uart_init(CONFIG_UART_FOR_GDB); } static inline void __gdb_tx_byte(u8 data) { uart_tx_byte(CONFIG_UART_FOR_GDB, data); } static inline void __gdb_tx_flush(void) { uart_tx_flush(CONFIG_UART_FOR_GDB); } static inline u8 __gdb_rx_byte(void) { return uart_rx_byte(CONFIG_UART_FOR_GDB); } #endif #endif /* __ROMCC__ */ #endif /* CONSOLE_UART_H */
29.018692
79
0.777134
c8c38a6f4df5ddbad2ed4032b0146e6b44d5161c
489
c
C
src/cuda_setup.c
rohanraja/cgt_distributed
3d8ee39460eadc96739d55eb46eed92f12ea1e22
[ "MIT" ]
698
2015-08-25T08:17:42.000Z
2022-02-08T10:08:01.000Z
src/cuda_setup.c
xiaohu2015/cgt
90b15ab041fc2137e62b96e8612ccee605f71ceb
[ "MIT" ]
59
2015-08-25T17:45:24.000Z
2021-11-14T16:58:52.000Z
src/cuda_setup.c
xiaohu2015/cgt
90b15ab041fc2137e62b96e8612ccee605f71ceb
[ "MIT" ]
111
2015-08-25T20:35:17.000Z
2021-09-18T03:35:28.000Z
#include "cgt_cuda.h" #include "cublas.h" CudaContext g_context; #ifdef CGT_ENABLE_CUDA void cuda_initialize() { CUDA_CHECK(cudaStreamCreate(&g_context.stream)); CUBLAS_CHECK(cublasCreate_v2(&g_context.cublas_handle)); CUBLAS_CHECK(cublasSetStream(g_context.cublas_handle, g_context.stream)); // CUDNN_CHECK(cudnnCreate(&g_context.cudnn_handle)); // CUDNN_CHECK(cudnnSetStream(g_context.cudnn_handle, g_context.stream)); } #else void cuda_initialize() { } #endif
23.285714
77
0.766871
4e13ca0c08b1e15da0d1ac4a1ab990be5394a924
6,826
c
C
src/hg/makeDb/genbank/src/lib/gbEntry.c
bowhan/kent
714d060bfe004719bb2465a2fecde52f746ab4fb
[ "IJG" ]
3
2017-10-11T21:10:01.000Z
2018-03-14T22:19:20.000Z
src/hg/makeDb/genbank/src/lib/gbEntry.c
bowhan/kent
714d060bfe004719bb2465a2fecde52f746ab4fb
[ "IJG" ]
null
null
null
src/hg/makeDb/genbank/src/lib/gbEntry.c
bowhan/kent
714d060bfe004719bb2465a2fecde52f746ab4fb
[ "IJG" ]
3
2016-10-25T18:19:35.000Z
2021-03-07T01:46:18.000Z
#include "gbEntry.h" #include "gbRelease.h" #include "gbUpdate.h" #include "gbGenome.h" #include "gbProcessed.h" #include "gbAligned.h" #include "gbFileOps.h" #include "localmem.h" #include "hash.h" struct gbEntry* gbEntryNew(struct gbRelease* release, char* acc, unsigned type) /* allocate a new gbEntry object and add it to the release*/ { struct gbEntry* entry; struct hashEl* hashEl; gbReleaseAllocEntryVar(release, entry); /* add to hash table, which copy key into it's own local memory, * then save that key */ hashEl = hashAdd(release->entryTbl, acc, entry); entry->acc = hashEl->name; /* don't let others flags slip in */ entry->type = type & GB_TYPE_MASK; entry->selectVer = NULL_VERSION; if (type == GB_MRNA) release->numMRnas++; else if (type == GB_EST) release->numEsts++; else errAbort("invalid entry type"); return entry; } struct gbProcessed* gbEntryFindProcessed(struct gbEntry* entry, int version) /* Find the newest processed object for a specific version, or NULL not * found */ { struct gbProcessed* processed = entry->processed; while ((processed != NULL) && (processed->version != version)) processed = processed->next; return processed; } struct gbProcessed* gbEntryFindUpdateProcessed(struct gbEntry* entry, struct gbUpdate* update) /* Find the processed object for a specific update, or NULL if not in this * update. */ { struct gbProcessed* processed = entry->processed; while ((processed != NULL) && (processed->update != update)) processed = processed->next; return processed; } static int cmpProcessedVers(int version, time_t modDate, struct gbUpdate* update, struct gbProcessed* processed2) /* compare a version and modDate with a processed entry */ { int cmp = (version - processed2->version); if (cmp == 0) cmp = (modDate - processed2->modDate); if (cmp == 0) { /* Same entry. If one of the updates is the full it is returned. This * handles the case of a daily that is older than the full, which happens * with RefSeq. */ if (update == processed2->update) cmp = 0; else if (update->isFull) cmp = 1; else if (processed2->update->isFull) cmp = -1; else cmp = gbUpdateCmp(update, processed2->update); } return cmp; } struct gbProcessed* gbEntryAddProcessed(struct gbEntry* entry, struct gbUpdate* update, int version, time_t modDate, char* organism, enum molType molType) /* Create a new processed object in the entry and link with it's update */ { struct gbProcessed* cur = entry->processed; struct gbProcessed* prev = NULL; int cmp = 1; /* Search the place to insert */ while ((cur != NULL) && ((cmp = cmpProcessedVers(version, modDate, update, cur)) < 0)) { prev = cur; cur = cur->next; } if (cmp == 0) { /* ignore duplicates (it happens in dailies) */ return cur; } else { struct gbProcessed* processed = gbProcessedNew(entry, update, version, modDate, organism, molType); if (prev == NULL) { /* add to head */ processed->next = entry->processed; entry->processed = processed; } else { /* add after previous */ processed->next = prev->next; prev->next = processed; } /* link in with it's update */ processed->updateLink = processed->update->processed; processed->update->processed = processed; /* set organism category from organism if we have a genome */ if (update->release->genome != NULL) { entry->orgCat = gbGenomeOrgCat(update->release->genome, organism); } return processed; } } struct gbAligned* gbEntryFindAligned(struct gbEntry* entry, struct gbUpdate* update) /* Find an aligned entry for a specific update, or NULL not found */ { struct gbAligned* aligned = entry->aligned; while ((aligned != NULL) && (aligned->update != update)) aligned = aligned->next; return aligned; } struct gbAligned* gbEntryFindAlignedVer(struct gbEntry* entry, int version) /* Find an aligned entry for a specific version, or NULL not found */ { struct gbAligned* aligned = entry->aligned; while ((aligned != NULL) && (aligned->version != version)) aligned = aligned->next; return aligned; } struct gbAligned* gbEntryGetAligned(struct gbEntry* entry, struct gbUpdate* update, int version, boolean *created) /* Get an aligned entry for a specific version, creating a new one if not * found */ { struct gbAligned* aligned = entry->aligned; struct gbAligned* prev = NULL; if (created != NULL) *created = FALSE; while ((aligned != NULL) && (version < aligned->version)) { prev = aligned; aligned = aligned->next; } if ((aligned == NULL) || (aligned->update != update) || (aligned->version != version)) { /* create new and add to list */ aligned = gbAlignedNew(entry, update, version); if (prev == NULL) { /* add to head */ aligned->next = entry->aligned; entry->aligned = aligned; } else { /* add after previous */ aligned->next = prev->next; prev->next = aligned; } if (created != NULL) *created = TRUE; } return aligned; } boolean gbEntryMatch(struct gbEntry* entry, unsigned flags) /* Determine if an entry matches the entry type flag (GB_MRNA or GB_EST) in * flags, and if organism category is in flags (GB_NATIVE or GB_XENO), * check this as well. */ { if ((flags & GB_TYPE_MASK) != entry->type) return FALSE; if ((flags & GB_ORG_CAT_MASK) != 0) return ((flags & GB_ORG_CAT_MASK) == entry->orgCat); else return TRUE; } void gbEntryDump(struct gbEntry* entry, FILE* out, int indent) /* print a gbEntry object */ { struct gbProcessed* prNext; struct gbAligned* alNext; fprintf(out, "%*s%s: %s\n", indent, "", entry->acc, ((entry->type == GB_MRNA) ? "mRNA" : "EST")); for (prNext = entry->processed; prNext != NULL; prNext = prNext->next) fprintf(out, "%*spr: %s: %d %s \"%s\"\n", indent+2, "", prNext->update->name, prNext->version, gbFormatDate(prNext->modDate), prNext->organism); for (alNext = entry->aligned; alNext != NULL; alNext = alNext->next) fprintf(out, "%*sal: %s: %d\n", indent+2, "", alNext->update->name, alNext->version); } /* * Local Variables: * c-file-style: "jkent-c" * End: */
29.678261
79
0.606065
83ae96c51a2762cf7386f096e348eace58525e37
4,845
c
C
kernel_dvfs/linux-linaro-tracking-gem5/block/blk-mq-tag.c
lokeshjindal15/pd-gem5_transformer
f8eb40dc65a5d7e15c8aa0756b1b48dd104bd54f
[ "BSD-3-Clause" ]
null
null
null
kernel_dvfs/linux-linaro-tracking-gem5/block/blk-mq-tag.c
lokeshjindal15/pd-gem5_transformer
f8eb40dc65a5d7e15c8aa0756b1b48dd104bd54f
[ "BSD-3-Clause" ]
null
null
null
kernel_dvfs/linux-linaro-tracking-gem5/block/blk-mq-tag.c
lokeshjindal15/pd-gem5_transformer
f8eb40dc65a5d7e15c8aa0756b1b48dd104bd54f
[ "BSD-3-Clause" ]
null
null
null
#include <linux/kernel.h> #include <linux/module.h> #include <linux/percpu_ida.h> #include <linux/blk-mq.h> #include "blk.h" #include "blk-mq.h" #include "blk-mq-tag.h" /* * Per tagged queue (tag address space) map */ struct blk_mq_tags { unsigned int nr_tags; unsigned int nr_reserved_tags; unsigned int nr_batch_move; unsigned int nr_max_cache; struct percpu_ida free_tags; struct percpu_ida reserved_tags; }; void blk_mq_wait_for_tags(struct blk_mq_tags *tags) { int tag = blk_mq_get_tag(tags, __GFP_WAIT, false); blk_mq_put_tag(tags, tag); } bool blk_mq_has_free_tags(struct blk_mq_tags *tags) { return !tags || percpu_ida_free_tags(&tags->free_tags, nr_cpu_ids) != 0; } static unsigned int __blk_mq_get_tag(struct blk_mq_tags *tags, gfp_t gfp) { int tag; tag = percpu_ida_alloc(&tags->free_tags, (gfp & __GFP_WAIT) ? TASK_UNINTERRUPTIBLE : TASK_RUNNING); if (tag < 0) return BLK_MQ_TAG_FAIL; return tag + tags->nr_reserved_tags; } static unsigned int __blk_mq_get_reserved_tag(struct blk_mq_tags *tags, gfp_t gfp) { int tag; if (unlikely(!tags->nr_reserved_tags)) { WARN_ON_ONCE(1); return BLK_MQ_TAG_FAIL; } tag = percpu_ida_alloc(&tags->reserved_tags, (gfp & __GFP_WAIT) ? TASK_UNINTERRUPTIBLE : TASK_RUNNING); if (tag < 0) return BLK_MQ_TAG_FAIL; return tag; } unsigned int blk_mq_get_tag(struct blk_mq_tags *tags, gfp_t gfp, bool reserved) { if (!reserved) return __blk_mq_get_tag(tags, gfp); return __blk_mq_get_reserved_tag(tags, gfp); } static void __blk_mq_put_tag(struct blk_mq_tags *tags, unsigned int tag) { BUG_ON(tag >= tags->nr_tags); percpu_ida_free(&tags->free_tags, tag - tags->nr_reserved_tags); } static void __blk_mq_put_reserved_tag(struct blk_mq_tags *tags, unsigned int tag) { BUG_ON(tag >= tags->nr_reserved_tags); percpu_ida_free(&tags->reserved_tags, tag); } void blk_mq_put_tag(struct blk_mq_tags *tags, unsigned int tag) { if (tag >= tags->nr_reserved_tags) __blk_mq_put_tag(tags, tag); else __blk_mq_put_reserved_tag(tags, tag); } static int __blk_mq_tag_iter(unsigned id, void *data) { unsigned long *tag_map = data; __set_bit(id, tag_map); return 0; } void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *, unsigned long *), void *data) { unsigned long *tag_map; size_t map_size; map_size = ALIGN(tags->nr_tags, BITS_PER_LONG) / BITS_PER_LONG; tag_map = kzalloc(map_size * sizeof(unsigned long), GFP_ATOMIC); if (!tag_map) return; percpu_ida_for_each_free(&tags->free_tags, __blk_mq_tag_iter, tag_map); if (tags->nr_reserved_tags) percpu_ida_for_each_free(&tags->reserved_tags, __blk_mq_tag_iter, tag_map); fn(data, tag_map); kfree(tag_map); } struct blk_mq_tags *blk_mq_init_tags(unsigned int total_tags, unsigned int reserved_tags, int node) { unsigned int nr_tags, nr_cache; struct blk_mq_tags *tags; int ret; if (total_tags > BLK_MQ_TAG_MAX) { pr_err("blk-mq: tag depth too large\n"); return NULL; } tags = kzalloc_node(sizeof(*tags), GFP_KERNEL, node); if (!tags) return NULL; nr_tags = total_tags - reserved_tags; nr_cache = nr_tags / num_possible_cpus(); if (nr_cache < BLK_MQ_TAG_CACHE_MIN) nr_cache = BLK_MQ_TAG_CACHE_MIN; else if (nr_cache > BLK_MQ_TAG_CACHE_MAX) nr_cache = BLK_MQ_TAG_CACHE_MAX; tags->nr_tags = total_tags; tags->nr_reserved_tags = reserved_tags; tags->nr_max_cache = nr_cache; tags->nr_batch_move = max(1u, nr_cache / 2); ret = __percpu_ida_init(&tags->free_tags, tags->nr_tags - tags->nr_reserved_tags, tags->nr_max_cache, tags->nr_batch_move); if (ret) goto err_free_tags; if (reserved_tags) { /* * With max_cahe and batch set to 1, the allocator fallbacks to * no cached. It's fine reserved tags allocation is slow. */ ret = __percpu_ida_init(&tags->reserved_tags, reserved_tags, 1, 1); if (ret) goto err_reserved_tags; } return tags; err_reserved_tags: percpu_ida_destroy(&tags->free_tags); err_free_tags: kfree(tags); return NULL; } void blk_mq_free_tags(struct blk_mq_tags *tags) { percpu_ida_destroy(&tags->free_tags); percpu_ida_destroy(&tags->reserved_tags); kfree(tags); } ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page) { char *orig_page = page; unsigned int cpu; if (!tags) return 0; page += sprintf(page, "nr_tags=%u, reserved_tags=%u, batch_move=%u," " max_cache=%u\n", tags->nr_tags, tags->nr_reserved_tags, tags->nr_batch_move, tags->nr_max_cache); page += sprintf(page, "nr_free=%u, nr_reserved=%u\n", percpu_ida_free_tags(&tags->free_tags, nr_cpu_ids), percpu_ida_free_tags(&tags->reserved_tags, nr_cpu_ids)); for_each_possible_cpu(cpu) { page += sprintf(page, " cpu%02u: nr_free=%u\n", cpu, percpu_ida_free_tags(&tags->free_tags, cpu)); } return page - orig_page; }
23.405797
79
0.728999
2677096f2ea3ffc1b7b0e58bab62f4f9f14afed5
185
h
C
include/clap/private/std.h
robbert-vdh/clap
128217b9f4e4dcf22f535142f672ce90ee0034eb
[ "MIT" ]
null
null
null
include/clap/private/std.h
robbert-vdh/clap
128217b9f4e4dcf22f535142f672ce90ee0034eb
[ "MIT" ]
null
null
null
include/clap/private/std.h
robbert-vdh/clap
128217b9f4e4dcf22f535142f672ce90ee0034eb
[ "MIT" ]
null
null
null
#pragma once #ifdef __cplusplus # include <cstdint> # include <cstddef> #else # include <stddef.h> # include <stdbool.h> # include <stdint.h> # include <stdalign.h> #endif
15.416667
24
0.659459
31384a1a92b3d8c98d8684bc08a0df19247bbe4e
5,385
c
C
src/Dolphin/mem_funcs.c
projectPiki/pikmin2
a431d992acde856d092889a515ecca0e07a3ea7c
[ "Unlicense" ]
33
2021-12-08T11:10:59.000Z
2022-03-26T19:59:37.000Z
src/Dolphin/mem_funcs.c
projectPiki/pikmin2
a431d992acde856d092889a515ecca0e07a3ea7c
[ "Unlicense" ]
6
2021-12-22T17:54:31.000Z
2022-01-07T21:43:18.000Z
src/Dolphin/mem_funcs.c
projectPiki/pikmin2
a431d992acde856d092889a515ecca0e07a3ea7c
[ "Unlicense" ]
2
2022-01-04T06:00:49.000Z
2022-01-26T07:27:28.000Z
/* * --INFO-- * Address: 800C7158 * Size: 0000AC */ void __copy_longs_rev_unaligned(void) { /* .loc_0x0: add r11, r3, r5 add r10, r4, r5 rlwinm. r3,r11,0,30,31 beq- .loc_0x24 sub r5, r5, r3 .loc_0x14: lbzu r0, -0x1(r10) subic. r3, r3, 0x1 stbu r0, -0x1(r11) bne+ .loc_0x14 .loc_0x24: rlwinm r8,r10,3,27,28 rlwinm r7,r10,0,30,31 subfic r9, r8, 0x20 rlwinm r6,r5,29,3,31 subfic r0, r7, 0x4 add r10, r10, r0 lwzu r4, -0x4(r10) .loc_0x40: lwz r0, -0x4(r10) srw r3, r4, r9 subic. r6, r6, 0x1 slw r4, r0, r8 srw r0, r0, r9 or r3, r4, r3 stw r3, -0x4(r11) lwzu r4, -0x8(r10) slw r3, r4, r8 or r0, r3, r0 stwu r0, -0x8(r11) bne+ .loc_0x40 rlwinm. r0,r5,0,29,29 beq- .loc_0x8C lwzu r3, -0x4(r10) srw r0, r4, r9 slw r3, r3, r8 or r0, r3, r0 stwu r0, -0x4(r11) .loc_0x8C: rlwinm. r5,r5,0,30,31 beqlr- add r10, r10, r7 .loc_0x98: lbzu r0, -0x1(r10) subic. r5, r5, 0x1 stbu r0, -0x1(r11) bne+ .loc_0x98 blr */ } /* * --INFO-- * Address: 800C7204 * Size: 0000C0 */ void __copy_longs_unaligned(void) { /* .loc_0x0: neg r0, r3 subi r8, r4, 0x1 rlwinm. r6,r0,0,30,31 subi r3, r3, 0x1 beq- .loc_0x28 sub r5, r5, r6 .loc_0x18: lbzu r0, 0x1(r8) subic. r6, r6, 0x1 stbu r0, 0x1(r3) bne+ .loc_0x18 .loc_0x28: addi r0, r8, 0x1 subi r6, r3, 0x3 rlwinm r9,r0,0,30,31 rlwinm r7,r5,29,3,31 sub r8, r8, r9 rlwinm r10,r0,3,27,28 lwzu r4, 0x1(r8) subfic r11, r10, 0x20 .loc_0x48: lwz r3, 0x4(r8) slw r4, r4, r10 subic. r7, r7, 0x1 srw r0, r3, r11 slw r3, r3, r10 or r0, r4, r0 stw r0, 0x4(r6) lwzu r4, 0x8(r8) srw r0, r4, r11 or r0, r3, r0 stwu r0, 0x8(r6) bne+ .loc_0x48 rlwinm. r0,r5,0,29,29 beq- .loc_0x94 lwzu r0, 0x4(r8) slw r3, r4, r10 srw r0, r0, r11 or r0, r3, r0 stwu r0, 0x4(r6) .loc_0x94: rlwinm. r5,r5,0,30,31 addi r4, r8, 0x3 addi r3, r6, 0x3 beqlr- subfic r0, r9, 0x4 sub r4, r4, r0 .loc_0xAC: lbzu r0, 0x1(r4) subic. r5, r5, 0x1 stbu r0, 0x1(r3) bne+ .loc_0xAC blr */ } /* * --INFO-- * Address: 800C72C4 * Size: 0000A8 */ void __copy_longs_rev_aligned(void) { /* .loc_0x0: add r7, r3, r5 add r6, r4, r5 rlwinm. r3,r7,0,30,31 beq- .loc_0x24 sub r5, r5, r3 .loc_0x14: lbzu r0, -0x1(r6) subic. r3, r3, 0x1 stbu r0, -0x1(r7) bne+ .loc_0x14 .loc_0x24: rlwinm. r4,r5,27,5,31 beq- .loc_0x74 .loc_0x2C: lwz r3, -0x4(r6) subic. r4, r4, 0x1 lwz r0, -0x8(r6) stw r3, -0x4(r7) lwz r3, -0xC(r6) stw r0, -0x8(r7) lwz r0, -0x10(r6) stw r3, -0xC(r7) lwz r3, -0x14(r6) stw r0, -0x10(r7) lwz r0, -0x18(r6) stw r3, -0x14(r7) lwz r3, -0x1C(r6) stw r0, -0x18(r7) lwzu r0, -0x20(r6) stw r3, -0x1C(r7) stwu r0, -0x20(r7) bne+ .loc_0x2C .loc_0x74: rlwinm. r3,r5,30,29,31 beq- .loc_0x8C .loc_0x7C: lwzu r0, -0x4(r6) subic. r3, r3, 0x1 stwu r0, -0x4(r7) bne+ .loc_0x7C .loc_0x8C: rlwinm. r5,r5,0,30,31 beqlr- .loc_0x94: lbzu r0, -0x1(r6) subic. r5, r5, 0x1 stbu r0, -0x1(r7) bne+ .loc_0x94 blr */ } /* * --INFO-- * Address: 800C736C * Size: 0000BC */ void __copy_longs_aligned(void) { /* .loc_0x0: neg r0, r3 subi r4, r4, 0x1 rlwinm. r6,r0,0,30,31 subi r3, r3, 0x1 beq- .loc_0x28 sub r5, r5, r6 .loc_0x18: lbzu r0, 0x1(r4) subic. r6, r6, 0x1 stbu r0, 0x1(r3) bne+ .loc_0x18 .loc_0x28: rlwinm. r6,r5,27,5,31 subi r7, r4, 0x3 subi r4, r3, 0x3 beq- .loc_0x80 .loc_0x38: lwz r3, 0x4(r7) subic. r6, r6, 0x1 lwz r0, 0x8(r7) stw r3, 0x4(r4) lwz r3, 0xC(r7) stw r0, 0x8(r4) lwz r0, 0x10(r7) stw r3, 0xC(r4) lwz r3, 0x14(r7) stw r0, 0x10(r4) lwz r0, 0x18(r7) stw r3, 0x14(r4) lwz r3, 0x1C(r7) stw r0, 0x18(r4) lwzu r0, 0x20(r7) stw r3, 0x1C(r4) stwu r0, 0x20(r4) bne+ .loc_0x38 .loc_0x80: rlwinm. r3,r5,30,29,31 beq- .loc_0x98 .loc_0x88: lwzu r0, 0x4(r7) subic. r3, r3, 0x1 stwu r0, 0x4(r4) bne+ .loc_0x88 .loc_0x98: rlwinm. r5,r5,0,30,31 addi r6, r7, 0x3 addi r3, r4, 0x3 beqlr- .loc_0xA8: lbzu r0, 0x1(r6) subic. r5, r5, 0x1 stbu r0, 0x1(r3) bne+ .loc_0xA8 blr */ } /* * --INFO-- * Address: ........ * Size: 0001FC */ void __move_mem(void) { // UNUSED FUNCTION } /* * --INFO-- * Address: ........ * Size: 000060 */ void __copy_mem(void) { // UNUSED FUNCTION }
18.07047
37
0.471495
2330694d7bab9f05be88a8b3f7a75016124c42c1
488
h
C
AuxiliaryMethods.h
tomasz-nyckowiak/OgarniamyFinanse
b7e56b24d2c62a7eca5fa453be7d210ecb55c609
[ "Unlicense" ]
null
null
null
AuxiliaryMethods.h
tomasz-nyckowiak/OgarniamyFinanse
b7e56b24d2c62a7eca5fa453be7d210ecb55c609
[ "Unlicense" ]
null
null
null
AuxiliaryMethods.h
tomasz-nyckowiak/OgarniamyFinanse
b7e56b24d2c62a7eca5fa453be7d210ecb55c609
[ "Unlicense" ]
null
null
null
#ifndef AUXILIARYMETHODS_H #define AUXILIARYMETHODS_H #include <iostream> #include <sstream> #include <algorithm> #include <string> #include <cstdlib> using namespace std; class AuxiliaryMethods { public: static string conversionIntToString(int number); static string loadLine(); static int conversionStringToInt(string number); static int loadInteger(); static char loadSign(); static bool isSignANumber(string dateAsString); }; #endif
20.333333
53
0.721311
641be9da13ae0b1edec2f52e9b16ab135c0e8036
1,533
h
C
System/Library/PrivateFrameworks/ContentKit.framework/WFRunShortcutErrorEvent.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
System/Library/PrivateFrameworks/ContentKit.framework/WFRunShortcutErrorEvent.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/ContentKit.framework/WFRunShortcutErrorEvent.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
/* * This header is generated by classdump-dyld 1.5 * on Wednesday, October 27, 2021 at 3:18:14 PM Mountain Standard Time * Operating System: Version 13.5.1 (Build 17F80) * Image Source: /System/Library/PrivateFrameworks/ContentKit.framework/ContentKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ #import <ContentKit/WFEvent.h> @class NSString; @interface WFRunShortcutErrorEvent : WFEvent { NSString* _key; NSString* _actionIdentifier; NSString* _errorDomain; NSString* _errorCode; } @property (nonatomic,copy) NSString * key; //@synthesize key=_key - In the implementation block @property (nonatomic,copy) NSString * actionIdentifier; //@synthesize actionIdentifier=_actionIdentifier - In the implementation block @property (nonatomic,copy) NSString * errorDomain; //@synthesize errorDomain=_errorDomain - In the implementation block @property (nonatomic,copy) NSString * errorCode; //@synthesize errorCode=_errorCode - In the implementation block +(Class)codableEventClass; -(NSString *)key; -(void)setKey:(NSString *)arg1 ; -(NSString *)actionIdentifier; -(NSString *)errorCode; -(NSString *)errorDomain; -(void)setErrorDomain:(NSString *)arg1 ; -(void)setErrorCode:(NSString *)arg1 ; -(void)setActionIdentifier:(NSString *)arg1 ; @end
41.432432
147
0.663405
fccdb913c950408a81888a5d2519fd2d7fc2be2f
6,786
h
C
jni/sources/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
guo19941204/c-jni
866a2bc3f1148824e1a5c270fdf452888cb06d2b
[ "MIT" ]
null
null
null
jni/sources/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
guo19941204/c-jni
866a2bc3f1148824e1a5c270fdf452888cb06d2b
[ "MIT" ]
null
null
null
jni/sources/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
guo19941204/c-jni
866a2bc3f1148824e1a5c270fdf452888cb06d2b
[ "MIT" ]
null
null
null
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /* * bandwidth_estimator.h * * This header file contains the API for the Bandwidth Estimator * designed for iSAC. * */ #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ #include "structs.h" #include "settings.h" #define MIN_ISAC_BW 10000 #define MIN_ISAC_BW_LB 10000 #define MIN_ISAC_BW_UB 25000 #define MAX_ISAC_BW 56000 #define MAX_ISAC_BW_UB 32000 #define MAX_ISAC_BW_LB 32000 #define MIN_ISAC_MD 5 #define MAX_ISAC_MD 25 // assumed header size, in bytes; we don't know the exact number // (header compression may be used) #define HEADER_SIZE 35 // Initial Frame-Size, in ms, for Wideband & Super-Wideband Mode #define INIT_FRAME_LEN_WB 60 #define INIT_FRAME_LEN_SWB 30 // Initial Bottleneck Estimate, in bits/sec, for // Wideband & Super-wideband mode #define INIT_BN_EST_WB 20e3f #define INIT_BN_EST_SWB 56e3f // Initial Header rate (header rate depends on frame-size), // in bits/sec, for Wideband & Super-Wideband mode. #define INIT_HDR_RATE_WB \ ((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_WB) #define INIT_HDR_RATE_SWB \ ((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_SWB) // number of packets in a row for a high rate burst #define BURST_LEN 3 // ms, max time between two full bursts #define BURST_INTERVAL 500 // number of packets in a row for initial high rate burst #define INIT_BURST_LEN 5 // bits/s, rate for the first BURST_LEN packets #define INIT_RATE_WB INIT_BN_EST_WB #define INIT_RATE_SWB INIT_BN_EST_SWB #if defined(__cplusplus) extern "C" { #endif /* This function initializes the struct */ /* to be called before using the struct for anything else */ /* returns 0 if everything went fine, -1 otherwise */ WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator( BwEstimatorstr* bwest_str, enum IsacSamplingRate encoderSampRate, enum IsacSamplingRate decoderSampRate); /* This function updates the receiving estimate */ /* Parameters: */ /* rtp_number - value from RTP packet, from NetEq */ /* frame length - length of signal frame in ms, from iSAC decoder */ /* send_ts - value in RTP header giving send time in samples */ /* arr_ts - value given by timeGetTime() time of arrival in samples of packet from NetEq */ /* pksize - size of packet in bytes, from NetEq */ /* Index - integer (range 0...23) indicating bottle neck & jitter as estimated by other side */ /* returns 0 if everything went fine, -1 otherwise */ WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator( BwEstimatorstr* bwest_str, const WebRtc_UWord16 rtp_number, const WebRtc_Word32 frame_length, const WebRtc_UWord32 send_ts, const WebRtc_UWord32 arr_ts, const WebRtc_Word32 pksize); /* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */ WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl( BwEstimatorstr* bwest_str, WebRtc_Word16 Index, enum IsacSamplingRate encoderSamplingFreq); /* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the sending iSAC payload */ WebRtc_UWord16 WebRtcIsac_GetDownlinkBwJitIndexImpl( BwEstimatorstr* bwest_str, WebRtc_Word16* bottleneckIndex, WebRtc_Word16* jitterInfo, enum IsacSamplingRate decoderSamplingFreq); /* Returns the bandwidth estimation (in bps) */ WebRtc_Word32 WebRtcIsac_GetDownlinkBandwidth( const BwEstimatorstr *bwest_str); /* Returns the max delay (in ms) */ WebRtc_Word32 WebRtcIsac_GetDownlinkMaxDelay( const BwEstimatorstr *bwest_str); /* Returns the bandwidth that iSAC should send with in bps */ void WebRtcIsac_GetUplinkBandwidth( const BwEstimatorstr* bwest_str, WebRtc_Word32* bitRate); /* Returns the max delay value from the other side in ms */ WebRtc_Word32 WebRtcIsac_GetUplinkMaxDelay( const BwEstimatorstr *bwest_str); /* * update amount of data in bottle neck buffer and burst handling * returns minimum payload size (bytes) */ int WebRtcIsac_GetMinBytes( RateModel* State, int StreamSize, /* bytes in bitstream */ const int FrameLen, /* ms per frame */ const double BottleNeck, /* bottle neck rate; excl headers (bps) */ const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */ enum ISACBandwidth bandwidth /*,WebRtc_Word16 frequentLargePackets*/); /* * update long-term average bitrate and amount of data in buffer */ void WebRtcIsac_UpdateRateModel( RateModel* State, int StreamSize, /* bytes in bitstream */ const int FrameSamples, /* samples per frame */ const double BottleNeck); /* bottle neck rate; excl headers (bps) */ void WebRtcIsac_InitRateModel( RateModel *State); /* Returns the new framelength value (input argument: bottle_neck) */ int WebRtcIsac_GetNewFrameLength( double bottle_neck, int current_framelength); /* Returns the new SNR value (input argument: bottle_neck) */ double WebRtcIsac_GetSnr( double bottle_neck, int new_framelength); WebRtc_Word16 WebRtcIsac_UpdateUplinkJitter( BwEstimatorstr* bwest_str, WebRtc_Word32 index); #if defined(__cplusplus) } #endif #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ */
38.123596
106
0.635721
6c7f2c9f2ab49500883d544821204c8233df4af7
6,721
h
C
AirTraffic.framework/ATAsset.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
4
2021-10-06T12:15:26.000Z
2022-02-21T02:26:00.000Z
AirTraffic.framework/ATAsset.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
null
null
null
AirTraffic.framework/ATAsset.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
1
2021-10-08T07:40:53.000Z
2021-10-08T07:40:53.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/AirTraffic.framework/AirTraffic */ @interface ATAsset : NSObject <NSCopying, NSSecureCoding> { long long _assetState; NSString * _assetType; bool _bypassStore; unsigned long long _bytesRemaining; bool _canUseCellularData; NSDictionary * _clientParams; unsigned long long _completedAssetParts; id /* block */ _completionBlock; NSString * _dataclass; bool _downloadOnly; float _downloadProgress; NSError * _error; NSURL * _icon; NSString * _identifier; NSString * _infoPlist; bool _installOnly; float _installProgress; bool _installStarted; bool _installed; bool _isDownload; bool _isForeground; bool _isPrioritized; bool _isRestore; bool _legacy; NSString * _localPath; bool _lyricsEmbeddedInAsset; bool _powerRequired; NSString * _prettyName; unsigned int _priority; id /* block */ _progressBlock; int _protectionType; double _queueDuration; double _queueStartTime; bool _readyForStore; NSData * _resumeData; ATStoreInfo * _storeInfo; long long _storePID; NSString * _storePlist; unsigned long long _totalBytes; double _transferDuration; double _transferStartTime; NSDictionary * _variantOptions; } @property (nonatomic) long long assetState; @property (nonatomic, retain) NSString *assetType; @property (nonatomic) bool bypassStore; @property (nonatomic) unsigned long long bytesRemaining; @property (nonatomic) bool canUseCellularData; @property (nonatomic, retain) NSDictionary *clientParams; @property (nonatomic) unsigned long long completedAssetParts; @property (nonatomic, copy) id /* block */ completionBlock; @property (nonatomic, retain) NSString *dataclass; @property (nonatomic) bool downloadOnly; @property (nonatomic) float downloadProgress; @property (nonatomic, retain) NSError *error; @property (nonatomic, retain) NSURL *icon; @property (nonatomic, retain) NSString *identifier; @property (nonatomic, retain) NSString *infoPlist; @property (nonatomic) bool installOnly; @property (nonatomic) float installProgress; @property (nonatomic) bool installStarted; @property (getter=isInstalled, nonatomic) bool installed; @property (nonatomic) bool isDownload; @property (nonatomic) bool isForeground; @property (nonatomic) bool isPrioritized; @property (nonatomic) bool isRestore; @property (getter=isLegacy, nonatomic) bool legacy; @property (nonatomic) bool lyricsEmbeddedInAsset; @property (nonatomic, retain) NSString *path; @property (nonatomic) bool powerRequired; @property (nonatomic, retain) NSString *prettyName; @property (nonatomic) unsigned int priority; @property (nonatomic, copy) id /* block */ progressBlock; @property (nonatomic) int protectionType; @property (nonatomic) double queueDuration; @property (nonatomic) double queueStartTime; @property (nonatomic) bool readyForStore; @property (nonatomic, retain) NSData *resumeData; @property (nonatomic, retain) ATStoreInfo *storeInfo; @property (nonatomic) long long storePID; @property (nonatomic, retain) NSString *storePlist; @property (nonatomic) unsigned long long totalBytes; @property (nonatomic) double transferDuration; @property (nonatomic) double transferStartTime; @property (nonatomic, retain) NSDictionary *variantOptions; + (id)assetWithSerializedAsset:(id)arg1; + (id)downloadAssetWithIdentifier:(id)arg1 dataclass:(id)arg2 prettyName:(id)arg3; + (id)iCloudRestoreAssetWithIdentifier:(id)arg1 dataclass:(id)arg2 assetType:(id)arg3 restorePath:(id)arg4 displayName:(id)arg5; + (bool)supportsSecureCoding; + (id)uploadAssetWithIdentifier:(id)arg1 dataclass:(id)arg2 sourcePath:(id)arg3 prettyName:(id)arg4; - (void).cxx_destruct; - (id)_variantDescription; - (unsigned long long)assetParts; - (long long)assetState; - (id)assetType; - (bool)bypassStore; - (unsigned long long)bytesRemaining; - (bool)canUseCellularData; - (id)clientParams; - (unsigned long long)completedAssetParts; - (id /* block */)completionBlock; - (id)copyWithZone:(struct _NSZone { }*)arg1; - (id)dataclass; - (id)description; - (bool)downloadOnly; - (float)downloadProgress; - (void)encodeWithCoder:(id)arg1; - (id)error; - (unsigned long long)hash; - (id)icon; - (id)identifier; - (id)infoPlist; - (id)init; - (id)initWithCoder:(id)arg1; - (id)initWithIdentifier:(id)arg1 dataclass:(id)arg2 prettyName:(id)arg3; - (bool)installOnly; - (float)installProgress; - (bool)installStarted; - (bool)isDownload; - (bool)isEqual:(id)arg1; - (bool)isForeground; - (bool)isInstalled; - (bool)isLegacy; - (bool)isPrioritized; - (bool)isRestore; - (bool)lyricsEmbeddedInAsset; - (id)path; - (bool)powerRequired; - (id)prettyName; - (unsigned int)priority; - (id /* block */)progressBlock; - (int)protectionType; - (double)queueDuration; - (double)queueStartTime; - (bool)readyForStore; - (id)resumeData; - (id)serializedAsset; - (void)setAssetState:(long long)arg1; - (void)setAssetType:(id)arg1; - (void)setBypassStore:(bool)arg1; - (void)setBytesRemaining:(unsigned long long)arg1; - (void)setCanUseCellularData:(bool)arg1; - (void)setClientParams:(id)arg1; - (void)setCompletedAssetParts:(unsigned long long)arg1; - (void)setCompletionBlock:(id /* block */)arg1; - (void)setDataclass:(id)arg1; - (void)setDownloadOnly:(bool)arg1; - (void)setDownloadProgress:(float)arg1; - (void)setError:(id)arg1; - (void)setIcon:(id)arg1; - (void)setIdentifier:(id)arg1; - (void)setInfoPlist:(id)arg1; - (void)setInstallOnly:(bool)arg1; - (void)setInstallProgress:(float)arg1; - (void)setInstallStarted:(bool)arg1; - (void)setInstalled:(bool)arg1; - (void)setIsDownload:(bool)arg1; - (void)setIsForeground:(bool)arg1; - (void)setIsPrioritized:(bool)arg1; - (void)setIsRestore:(bool)arg1; - (void)setLegacy:(bool)arg1; - (void)setLyricsEmbeddedInAsset:(bool)arg1; - (void)setPath:(id)arg1; - (void)setPowerRequired:(bool)arg1; - (void)setPrettyName:(id)arg1; - (void)setPriority:(unsigned int)arg1; - (void)setProgressBlock:(id /* block */)arg1; - (void)setProtectionType:(int)arg1; - (void)setQueueDuration:(double)arg1; - (void)setQueueStartTime:(double)arg1; - (void)setReadyForStore:(bool)arg1; - (void)setResumeData:(id)arg1; - (void)setStoreInfo:(id)arg1; - (void)setStorePID:(long long)arg1; - (void)setStorePlist:(id)arg1; - (void)setTotalBytes:(unsigned long long)arg1; - (void)setTransferDuration:(double)arg1; - (void)setTransferStartTime:(double)arg1; - (void)setVariantOptions:(id)arg1; - (id)shortDescription; - (id)storeInfo; - (long long)storePID; - (id)storePlist; - (unsigned long long)totalBytes; - (double)transferDuration; - (double)transferStartTime; - (id)variantOptions; @end
33.944444
128
0.748549
6c9ba91047361be3c27e450848344d2af6396ab6
2,015
h
C
deps/xxHash/tests/bench/benchHash.h
Masha/hashcat
178003d692ab72abfd9588fdce9e4f569d2b1aa7
[ "MIT" ]
13,663
2015-12-04T16:08:29.000Z
2022-03-31T23:43:17.000Z
deps/xxHash/tests/bench/benchHash.h
Masha/hashcat
178003d692ab72abfd9588fdce9e4f569d2b1aa7
[ "MIT" ]
2,014
2015-12-04T16:45:36.000Z
2022-03-31T21:02:58.000Z
deps/xxHash/tests/bench/benchHash.h
Masha/hashcat
178003d692ab72abfd9588fdce9e4f569d2b1aa7
[ "MIT" ]
2,555
2015-12-04T16:09:31.000Z
2022-03-31T11:34:38.000Z
/* * Hash benchmark module * Part of the xxHash project * Copyright (C) 2019-2020 Yann Collet * * GPL v2 License * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * You can contact the author at: * - xxHash homepage: https://www.xxhash.com * - xxHash source repository: https://github.com/Cyan4973/xxHash */ #ifndef BENCH_HASH_H_983426678 #define BENCH_HASH_H_983426678 #if defined (__cplusplus) extern "C" { #endif /* === Dependencies === */ #include "benchfn.h" /* BMK_benchFn_t */ /* === Declarations === */ typedef enum { BMK_throughput, BMK_latency } BMK_benchMode; typedef enum { BMK_fixedSize, /* hash always `size` bytes */ BMK_randomSize, /* hash a random nb of bytes, between 1 and `size` (inclusive) */ } BMK_sizeMode; /* * bench_hash(): * Returns speed expressed as nb hashes per second. * total_time_ms: time spent benchmarking the hash function with given parameters * iter_time_ms: time spent for one round. If multiple rounds are run, * bench_hash() will report the speed of best round. */ double bench_hash(BMK_benchFn_t hashfn, BMK_benchMode benchMode, size_t size, BMK_sizeMode sizeMode, unsigned total_time_ms, unsigned iter_time_ms); #if defined (__cplusplus) } #endif #endif /* BENCH_HASH_H_983426678 */
29.632353
97
0.705707
530057c15dfd2c43d8a82742f7d34b732911dca5
4,685
c
C
TR_SRC/METADATA/fgetln_kms.c
busstoptaktik/trlib
8bac3ce58599c4ba51da7c10312741fc3ac13c2b
[ "0BSD" ]
null
null
null
TR_SRC/METADATA/fgetln_kms.c
busstoptaktik/trlib
8bac3ce58599c4ba51da7c10312741fc3ac13c2b
[ "0BSD" ]
null
null
null
TR_SRC/METADATA/fgetln_kms.c
busstoptaktik/trlib
8bac3ce58599c4ba51da7c10312741fc3ac13c2b
[ "0BSD" ]
null
null
null
/* * Copyright (c) 2011, National Survey and Cadastre, Denmark * (Kort- og Matrikelstyrelsen), kms@kms.dk * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include <stdio.h> #include "lord.h" int fgetln_kms( /*_______________________*/ char *outstr, int *n_item, FILE *fp ) { int c, e, act, klasse, res; int nst = 0, item = 0, mode_ap = 0; struct act_nst { short action; short nstate; }; static struct act_nst tab[] = { /* STATE init more letter 2+sp tab init* more* more" */ /* input 0 1 2 3 4 5 6 7 */ /* CLASS */ /* 0 sp */ {0,0},{0,1},{0,3},{2,1},{0,1},{0,5},{0,6},{1,7}, /* 1 letter */ {1,2},{1,2},{1,2},{1,2},{1,2},{0,5},{0,6},{1,7}, /* 2 tab */ {0,4},{2,4},{2,4},{2,4},{0,4},{0,5},{0,6},{2,7}, /* 3 cr */ {0,0},{7,9},{6,9},{6,9},{6,9},{0,5},{0,6},{7,9}, /* 4 * */ {0,5},{0,6},{2,6},{2,6},{0,6},{0,5},{0,6},{0,6}, /* 5 ; */ {0,0},{1,4},{1,4},{1,4},{1,4},{0,0},{0,1},{0,7}, /* 6 " */ {1,7},{1,7},{1,7},{1,7},{1,7},{0,5},{0,6},{1,7}, /* 7 EOF */ {8,9},{8,9},{8,9},{8,9},{8,9},{8,9},{8,9},{8,9}, /* nil */ {0,0} }, *ptab; /* action = 0 no action */ /* = 1 include letter */ /* = 2 set double sp */ /* = 6 terminate string */ /* = 7 set \n and termin. */ /* = 8 set EOF */ /* state = 0 start */ /* = 1 more */ /* = 2 after letter */ /* = 3 after letter + sp */ /* = 4 after tab */ /* = 5 after init * */ /* = 6 after more * */ /* = 7 after more " */ /* = 9 return dummy */ *outstr = '\0'; res = 0; *n_item = 0; do { c = getc(fp); switch(c) { case '/' : klasse = 1; e = getc(fp); if ( e == '*') { c = e; klasse = 4; break; } else (void) ungetc(e, fp); break; case ' ': klasse = 0; break; case '\t': klasse = 2; break; case '\n': case '\r': case '\f': klasse = 3; break; case '*' : klasse = 4; c = getc(fp); if (c == '/') { klasse = 5; break; } else c = ungetc(c, fp); break; case ';' : klasse = 5; break; case '"' : klasse = 6; mode_ap = 1 -mode_ap; break; case EOF: case 0: klasse = (res > 0) ? 3 : 7; break; default: klasse = c > 32 ? 1 : 0; break; } if (klasse == 5 && mode_ap) nst = 7; ptab = tab + 8*klasse + nst; act = ptab->action; nst = ptab->nstate; switch(act) { case 0: /* no action */ break; case 1: /* include acc char */ *(outstr++) = (char) c; res++; item = 1; break; case 2: /* set double sp */ *(outstr++) = ' '; *(outstr++) = ' '; if (item) { (*n_item)++; item = 0; } res += 2; break; case 6: /* terminate string */ *(outstr++) = (char) c; *(outstr++) = '\0'; if (item) { (*n_item)++; item = 0; } res++; break; case 7: /* set \n and terminate */ *(outstr++) = '\n'; *(outstr++) = '\0'; if (item) { (*n_item)++; item = 0; } res++; break; case 8: /* set EOF */ *(outstr++) = EOF; *(outstr++) = '\0'; if (item) { (*n_item)++; item = 0; } (void) ungetc(c, fp); res = EOF; break; default: (void) lord_error(0, LORD("\n*** fgetln_kms programfejl")); return(-1); } } while (nst < 9); return res; }
23.193069
75
0.419424