blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
333
content_id
stringlengths
40
40
detected_licenses
listlengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
5
113
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
604 values
visit_date
timestamp[us]date
2016-08-02 21:20:34
2023-09-06 10:17:08
revision_date
timestamp[us]date
1970-01-01 00:00:00
2023-09-05 20:12:54
committer_date
timestamp[us]date
1970-01-01 00:00:00
2023-09-05 20:12:54
github_id
int64
966
664M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]date
2012-06-18 16:43:44
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-02-03 21:17:16
2023-07-07 15:57:14
gha_language
stringclasses
121 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
128
17.8k
extension
stringclasses
134 values
content
stringlengths
128
8.19k
authors
listlengths
1
1
author_id
stringlengths
1
143
1f072701568fcdd362d05e14d222f23bdcfee163
fe5b4e7af9a4504437d33734de0ea62baf454b69
/Learning/OtherLanguages/C/C练习题/Use C/22.c
0e9206dbacee9661cee3f6bc109dac54a7eeea25
[]
no_license
FelicxFoster/Sources
937f2936b0fa3eef9dd2bbbde09e7f44755b8a8a
3750c393088c281c000228d84fe619ba321bd5bc
refs/heads/master
2020-04-22T09:37:05.191325
2016-08-06T07:02:50
2016-08-06T07:02:50
null
0
0
null
null
null
null
UTF-8
C
false
false
467
c
#include <stdio.h> void main() { char i, j, k; for(i='x';i<='z';i++) { for(j='x';j<='z';j++) { for(k='x';k<='z';k++) { if(i!=j && i!=k && j!=k) { if(i!='x' && k!='x' && k!='z') { printf("a<->%c\nb<->%c\nc<->%c\n", i, j, k); } } } } } }
874c18716352d10f69b743b73be5c641f0372846
cdfd3a4a8134aa8f97ed3c5751eefdfd9fbba747
/src/benchmark64bitreductions.c
accbfc7ea46e82c5e0171dfdb6fef57e0a696c9e
[ "MIT", "LicenseRef-scancode-public-domain", "Apache-2.0" ]
permissive
pombreda/StronglyUniversalStringHashing
50b9c8fb833544839610c24b68b457c0c89e4581
20d1fe8769bb03e1520999aef1439e1429b27b10
refs/heads/master
2021-01-16T21:02:56.932260
2015-03-20T21:52:41
2015-03-20T21:52:41
null
0
0
null
null
null
null
UTF-8
C
false
false
4,346
c
#include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <sys/time.h> #include <assert.h> #include <unistd.h> #ifdef __AVX__ #define __PCLMUL__ 1 #endif typedef unsigned long long ticks; // Taken from stackoverflow (see http://stackoverflow.com/questions/3830883/cpu-cycle-count-based-profiling-in-c-c-linux-x86-64) // Can give nonsensical results on multi-core AMD processors. ticks rdtsc() { unsigned int lo, hi; asm volatile ( "cpuid \n" /* serializing */ "rdtsc" : "=a"(lo), "=d"(hi) /* outputs */ : "a"(0) /* inputs */ : "%ebx", "%ecx"); /* clobbers*/ return ((unsigned long long) lo) | (((unsigned long long) hi) << 32); } ticks startRDTSC(void) { return rdtsc(); } ticks stopRDTSCP(void) { return rdtsc(); } #include "clmul.h" void force_computation(uint32_t forcedValue) { // make sure forcedValue has to be computed, but avoid output (unless unlucky) if (forcedValue % 277387 == 17) printf("wow, what a coincidence! (in benchmark.c)"); } void printusage(char * command) { printf(" Usage: %s ", command); } // WARNING: HIGH 64 BITS CONTAIN GARBAGE, must call _mm_cvtsi128_si64 to get // meaningful bits. __m128i barrettWithoutPrecomputation64_si128(__m128i A) { ///http://www.jjj.de/mathdata/minweight-primpoly.txt // it is important, for the algo. we have chosen that 4 is smaller // equal than 32=64/2 //const int n = 64; // degree of the polynomial //const __m128i C = _mm_set_epi64x(1U, // (1U << 4) + (1U << 3) + (1U << 1) + (1U << 0)); // C is the irreducible poly. (64,4,3,1,0) const __m128i C = _mm_cvtsi64_si128((1U << 4) + (1U << 3) + (1U << 1) + (1U << 0)); ///////////////// /// This algo. requires two multiplications (_mm_clmulepi64_si128) /// They are probably the bottleneck. /// Note: Barrett's original algorithm also required two multiplications. //////////////// //assert(n / 8 == 8); __m128i Q2 = _mm_clmulepi64_si128(A, C, 0x01); Q2 = _mm_xor_si128(Q2, A); const __m128i Q4 = _mm_clmulepi64_si128(Q2, C, 0x01); const __m128i final = _mm_xor_si128(A, Q4); return final; /// WARNING: HIGH 64 BITS CONTAIN GARBAGE } uint64_t barrettWithoutPrecomputation64(__m128i A) { const __m128i final = barrettWithoutPrecomputation64_si128(A); return _mm_cvtsi128_si64(final); } int main(int argc, char ** arg) { int N = 1024; int SHORTTRIALS = 100000; int HowManyRepeats = 3; int elapsed1, elapsed2; int i,j,k; int sumToFoolCompiler1, sumToFoolCompiler2; ticks bef, aft; struct timeval start, finish; uint32_t intstring[N] __attribute__ ((aligned (16))); // // could force 16-byte alignment with __attribute__ ((aligned (16))); int c; while ((c = getopt(argc, arg, "h")) != -1) switch (c) { case 'h': printusage(arg[0]); return 0; default: abort(); } for (i = 0; i < N; ++i) { intstring[i] = rand(); } printf( "Reporting the number of cycles per byte and the billions of bytes processed per second.\n"); for (k = 0; k < HowManyRepeats; ++k) { printf("test #%d (reduction) ", k + 1); printf("(%d bytes) \n", N * 4); sumToFoolCompiler1 = 0; sumToFoolCompiler2 = 0; __m128i * data = (__m128i *) &intstring[0]; gettimeofday(&start, 0); bef = startRDTSC(); for (j = 0; j < SHORTTRIALS; ++j) for (i = 0; i < N / 4; ++i) sumToFoolCompiler1 += precompReduction64(data[i]); aft = stopRDTSCP(); gettimeofday(&finish, 0); elapsed1 = (1000000 * (finish.tv_sec - start.tv_sec) + (finish.tv_usec - start.tv_usec)); printf( "[fast technique] CPU cycle/byte = %f \t billions of bytes per second = %f \n", (aft - bef) * 1.0 / (4.0 * SHORTTRIALS * N), (4.0 * SHORTTRIALS * N) / (1000. * elapsed1)); force_computation (sumToFoolCompiler1); gettimeofday(&start, 0); bef = startRDTSC(); for (j = 0; j < SHORTTRIALS; ++j) for (i = 0; i < N / 4; ++i) sumToFoolCompiler2 += barrettWithoutPrecomputation64(data[i]); aft = stopRDTSCP(); gettimeofday(&finish, 0); elapsed2 = (1000000 * (finish.tv_sec - start.tv_sec) + (finish.tv_usec - start.tv_usec)); printf( "[noprecomp ] CPU cycle/byte = %f \t billions of bytes per second = %f \n", (aft - bef) * 1.0 / (4.0 * SHORTTRIALS * N), (4.0 * SHORTTRIALS * N) / (1000. * elapsed2)); printf("speed ratio = %f \n",1.*elapsed2/elapsed1); force_computation (sumToFoolCompiler2); } printf("\n"); }
33b9fae59db98cce76417326d2b5693a43164dca
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/net/ethernet/broadcom/bnx2x/extr_bnx2x_ethtool.c_bnx2x_set_rss_flags.c
ef244058b3e937fdfd552bca1435bd940ac52c2e
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
3,829
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct ethtool_rxnfc {int flow_type; int data; } ; struct TYPE_2__ {int udp_rss_v4; int udp_rss_v6; } ; struct bnx2x {TYPE_1__ rss_conf_obj; int /*<<< orphan*/ state; } ; /* Variables and functions */ #define AH_ESP_V4_FLOW 143 #define AH_ESP_V6_FLOW 142 #define AH_V4_FLOW 141 #define AH_V6_FLOW 140 int /*<<< orphan*/ BNX2X_MSG_ETHTOOL ; int /*<<< orphan*/ BNX2X_STATE_OPEN ; int /*<<< orphan*/ CHIP_IS_E1x (struct bnx2x*) ; int /*<<< orphan*/ DP (int /*<<< orphan*/ ,char*,...) ; int EINVAL ; #define ESP_V4_FLOW 139 #define ESP_V6_FLOW 138 #define ETHER_FLOW 137 #define IPV4_FLOW 136 #define IPV6_FLOW 135 #define IP_USER_FLOW 134 int RXH_IP_DST ; int RXH_IP_SRC ; int RXH_L4_B_0_1 ; int RXH_L4_B_2_3 ; #define SCTP_V4_FLOW 133 #define SCTP_V6_FLOW 132 #define TCP_V4_FLOW 131 #define TCP_V6_FLOW 130 #define UDP_V4_FLOW 129 #define UDP_V6_FLOW 128 int bnx2x_rss (struct bnx2x*,TYPE_1__*,int,int) ; __attribute__((used)) static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info) { int udp_rss_requested; DP(BNX2X_MSG_ETHTOOL, "Set rss flags command parameters: flow type = %d, data = %llu\n", info->flow_type, info->data); switch (info->flow_type) { case TCP_V4_FLOW: case TCP_V6_FLOW: /* For TCP only 4-tupple hash is supported */ if (info->data ^ (RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)) { DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n"); return -EINVAL; } return 0; case UDP_V4_FLOW: case UDP_V6_FLOW: /* For UDP either 2-tupple hash or 4-tupple hash is supported */ if (info->data == (RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)) udp_rss_requested = 1; else if (info->data == (RXH_IP_SRC | RXH_IP_DST)) udp_rss_requested = 0; else return -EINVAL; if (CHIP_IS_E1x(bp) && udp_rss_requested) { DP(BNX2X_MSG_ETHTOOL, "57710, 57711 boards don't support RSS according to UDP 4-tuple\n"); return -EINVAL; } if ((info->flow_type == UDP_V4_FLOW) && (bp->rss_conf_obj.udp_rss_v4 != udp_rss_requested)) { bp->rss_conf_obj.udp_rss_v4 = udp_rss_requested; DP(BNX2X_MSG_ETHTOOL, "rss re-configured, UDP 4-tupple %s\n", udp_rss_requested ? "enabled" : "disabled"); if (bp->state == BNX2X_STATE_OPEN) return bnx2x_rss(bp, &bp->rss_conf_obj, false, true); } else if ((info->flow_type == UDP_V6_FLOW) && (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) { bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested; DP(BNX2X_MSG_ETHTOOL, "rss re-configured, UDP 4-tupple %s\n", udp_rss_requested ? "enabled" : "disabled"); if (bp->state == BNX2X_STATE_OPEN) return bnx2x_rss(bp, &bp->rss_conf_obj, false, true); } return 0; case IPV4_FLOW: case IPV6_FLOW: /* For IP only 2-tupple hash is supported */ if (info->data ^ (RXH_IP_SRC | RXH_IP_DST)) { DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n"); return -EINVAL; } return 0; case SCTP_V4_FLOW: case AH_ESP_V4_FLOW: case AH_V4_FLOW: case ESP_V4_FLOW: case SCTP_V6_FLOW: case AH_ESP_V6_FLOW: case AH_V6_FLOW: case ESP_V6_FLOW: case IP_USER_FLOW: case ETHER_FLOW: /* RSS is not supported for these protocols */ if (info->data) { DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n"); return -EINVAL; } return 0; default: return -EINVAL; } }
ae711732e8bc08374e9fa0f6629517d8b8e30f65
79499869a3ff3f098fd9c2cb1daddaa456ce7717
/libft/ft_strlcat.c
eba8db1ef8c6f78bee9c9e5a6795217361804b85
[]
no_license
nikGrape/GNL
29e7440924aef13938441924660e3091c60ad0c0
21a880046864d7acb9c783f4f8800a51c9bf80eb
refs/heads/master
2020-05-22T22:30:18.181661
2019-06-01T19:30:37
2019-06-01T19:30:37
186,547,023
11
2
null
null
null
null
UTF-8
C
false
false
1,235
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strlcat.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vinograd <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/05/03 14:59:22 by vinograd #+# #+# */ /* Updated: 2019/05/03 16:31:24 by vinograd ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" size_t ft_strlcat(char *restrict dst, const char \ *restrict src, size_t dstsize) { size_t len_dst; size_t len_src; len_dst = ft_strlen(dst); len_src = ft_strlen(src); if (dstsize <= len_dst) return (len_src + dstsize); else ft_strncat(dst, (char*)src, dstsize - len_dst - 1); return (len_dst + len_src); }
ce85df87ce90c7546e33870699ac1498a79cceb7
3587e1e87f426382d301fa36f92492c67b0a5359
/leetcode/building-h2o/solve.c
bacc24ffb442b31b1b9c8f12aa67fec51a3b1df0
[]
no_license
tt67wq/euler_project
b3e714373e36436d1d504a560ee32b5556a4964b
843cd66a81032a5cdf140b59eaa95b3600a249b7
refs/heads/master
2023-05-25T11:57:13.726509
2023-05-22T02:42:20
2023-05-22T02:42:20
109,090,240
30
1
null
null
null
null
UTF-8
C
false
false
2,233
c
/* * ===================================================================================== * * Filename: solve.c * * Description: 氢氧同步 * * Version: 1.0 * Created: 2020-01-18 * Revision: none * Compiler: clang * * Author: * * ===================================================================================== */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> typedef struct { // User defined data may be declared here. pthread_mutex_t *mutex; pthread_cond_t *cond; int hc; int oc; } H2O; H2O *h2oCreate() { H2O *obj = (H2O *)malloc(sizeof(H2O)); obj->mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); obj->cond = (pthread_cond_t *)calloc(1, sizeof(pthread_cond_t)); // Initialize user defined data here. pthread_mutex_init(obj->mutex, NULL); pthread_cond_init(obj->cond, NULL); obj->hc = 0; obj->oc = 0; return obj; } void hydrogen(H2O *obj) { // releaseHydrogen() outputs "H". Do not change or remove this line. pthread_mutex_lock(obj->mutex); while (obj->hc == 2 && obj->oc == 0) { pthread_cond_wait(obj->cond, obj->mutex); } if (obj->hc == 2 && obj->oc == 1) { obj->hc = 0; obj->oc = 0; } releaseHydrogen(); obj->hc++; pthread_mutex_unlock(obj->mutex); pthread_cond_signal(obj->cond); } void oxygen(H2O *obj) { // releaseOxygen() outputs "O". Do not change or remove this line. pthread_mutex_lock(obj->mutex); while (obj->oc >= obj->hc) { pthread_cond_wait(obj->cond, obj->mutex); } if (obj->hc == 2 && obj->oc == 1) { obj->hc = 0; obj->oc = 0; } releaseOxygen(); obj->oc++; pthread_mutex_unlock(obj->mutex); pthread_cond_signal(obj->cond); } void h2oFree(H2O *obj) { // User defined data may be cleaned up here. pthread_mutex_destroy(obj->mutex); pthread_cond_destroy(obj->cond); free(obj); } int main() { return 0; }
8b54e75df5fbca2e7ccca01370c02b3e4c35d139
43124e9a583ffd4cf654b1d17c04d4b2bb5f36df
/Pretty/data/coreutils/methods-only/08-install.c
3b565f81bdec25e876d6604baaf43700f8590129
[]
no_license
roncoleman125/Pretty
a86d87904281e76031db47264ffb65ff6c536740
227c3174d9bf15016d57b3a50d3df71fa6798306
refs/heads/master
2020-04-15T16:53:44.581854
2017-10-13T11:24:59
2017-10-13T11:24:59
32,341,194
0
0
null
null
null
null
UTF-8
C
false
false
665
c
/* Copy file FROM onto file TO and give TO the appropriate attributes. Return true if successful. */ static bool install_file_in_file (const char *from, const char *to, const struct cp_options *x) { struct stat from_sb; if (x->preserve_timestamps && stat (from, &from_sb) != 0) { error (0, errno, _("cannot stat %s"), quote (from)); return false; } if (! copy_file (from, to, x)) return false; if (strip_files) strip (to); if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode)) && ! change_timestamps (&from_sb, to)) return false; return change_attributes (to); }
1ae46955af183ea311104f68faee951864c1635a
0c83640cf0c7c24f7125a68d82b25f485f836601
/abc143/d/main.c
536fe4cf772ccc37d4affe4442e91340c487a2f7
[]
no_license
tiqwab/atcoder
f7f3fdc0c72ea7dea276bd2228b0b9fee9ba9aea
c338b12954e8cbe983077c428d0a36eb7ba2876f
refs/heads/master
2023-07-26T11:51:14.608775
2023-07-16T08:48:45
2023-07-16T08:48:45
216,480,686
0
0
null
null
null
null
UTF-8
C
false
false
1,616
c
#include <stdio.h> #define MAX_N 2000 #define MAX_L 1000 int n; int ls[MAX_N]; int ms[MAX_L+1]; void sort(int n) { for (int i = 0; i < n; i++) { ms[ls[i]]++; } int i = 1; int j = 0; while (i < MAX_L+1) { while (ms[i] > 0) { ls[j++] = i; ms[i]--; } i++; } } /* * Return the minimum index whose value is same or larger than the target value if exists, otherwise -1. * * l: lowest index * h: highest index * x: target value */ int search(int l, int h, int x) { if (ls[l] >= x) { return l; } while (h - l > 0) { // printf("h: %d, l: %d, mid: %d, v: %d\n", h, l, (l + h) / 2, ls[(l + h / 2)]); int mid = (l + h) / 2; if (ls[mid] < x) { l = mid + 1; } else if (ls[mid] > x) { h = mid; } else { h = mid; } } if (ls[l] < x) { return -1; } return l; } int solve(int n) { int count = 0; for (int i = n-1; i > 0; i--) { for (int j = i-1; j > 0; j--) { int a = ls[i]; int b = ls[j]; int min_c = a - b + 1; int lim_ind = search(0, j-1, min_c); // printf("%d %d %d\n", 0, j-1, lim_ind); if (lim_ind < 0) { break; } count += j - lim_ind; } } return count; } int main(void) { scanf("%d\n", &n); for (int i = 0; i < n; i++) { int x; scanf("%d", &x); ls[i] = x; } sort(n); printf("%d\n", solve(n)); return 0; }
1764fe7ccdbbc4cf890dedc997460e6771c6709c
a0986ce87fbed37e88c86a60108adc5d34dfeb17
/aosp/external/libnfc-nci/halimpl/pn547/utils/phNxpNciHal_utils.h
60495605a3fbd30d3b1326204b49ce0587977040
[]
no_license
xsbh0310/android_nxp-nci
ba93c413f1f8e8be92b99cc9a0280d64e9a7b3bb
9cfe6842d1ba9bb3d0c19f00f7b7c74a7835b001
refs/heads/master
2021-01-23T20:11:55.614943
2015-06-05T06:33:18
2015-06-05T06:33:18
40,778,550
1
0
null
2015-08-15T18:51:59
2015-08-15T18:51:59
null
UTF-8
C
false
false
4,068
h
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * * The original Work has been changed by NXP Semiconductors. * * Copyright (C) 2013-2014 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _PHNXPNCIHAL_UTILS_H_ #define _PHNXPNCIHAL_UTILS_H_ #include <pthread.h> #include <semaphore.h> #include <phNfcStatus.h> #include <assert.h> /********************* Definitions and structures *****************************/ /* List structures */ struct listNode { void* pData; struct listNode* pNext; }; struct listHead { struct listNode* pFirst; pthread_mutex_t mutex; }; /* Semaphore handling structure */ typedef struct phNxpNciHal_Sem { /* Semaphore used to wait for callback */ sem_t sem; /* Used to store the status sent by the callback */ NFCSTATUS status; /* Used to provide a local context to the callback */ void* pContext; } phNxpNciHal_Sem_t; /* Semaphore helper macros */ #define SEM_WAIT(cb_data) sem_wait(&((cb_data).sem)) #define SEM_POST(p_cb_data) sem_post(&((p_cb_data)->sem)) /* Semaphore and mutex monitor */ typedef struct phNxpNciHal_Monitor { /* Mutex protecting native library against reentrance */ pthread_mutex_t reentrance_mutex; /* Mutex protecting native library against concurrency */ pthread_mutex_t concurrency_mutex; /* List used to track pending semaphores waiting for callback */ struct listHead sem_list; } phNxpNciHal_Monitor_t; /************************ Exposed functions ***********************************/ /* List functions */ int listInit(struct listHead* pList); int listDestroy(struct listHead* pList); int listAdd(struct listHead* pList, void* pData); int listRemove(struct listHead* pList, void* pData); int listGetAndRemoveNext(struct listHead* pList, void** ppData); void listDump(struct listHead* pList); /* NXP NCI HAL utility functions */ phNxpNciHal_Monitor_t* phNxpNciHal_init_monitor(void); void phNxpNciHal_cleanup_monitor(void); phNxpNciHal_Monitor_t* phNxpNciHal_get_monitor(void); NFCSTATUS phNxpNciHal_init_cb_data(phNxpNciHal_Sem_t *pCallbackData, void *pContext); void phNxpNciHal_cleanup_cb_data(phNxpNciHal_Sem_t* pCallbackData); void phNxpNciHal_releaseall_cb_data(void); void phNxpNciHal_print_packet(const char *pString, const uint8_t *p_data, uint16_t len); void phNxpNciHal_emergency_recovery(void); /* Lock unlock helper macros */ #define REENTRANCE_LOCK() pthread_mutex_lock(&phNxpNciHal_get_monitor()->reentrance_mutex) #define REENTRANCE_UNLOCK() pthread_mutex_unlock(&phNxpNciHal_get_monitor()->reentrance_mutex) #define CONCURRENCY_LOCK() pthread_mutex_lock(&phNxpNciHal_get_monitor()->concurrency_mutex) #define CONCURRENCY_UNLOCK() pthread_mutex_unlock(&phNxpNciHal_get_monitor()->concurrency_mutex) #endif /* _PHNXPNCIHAL_UTILS_H_ */
41b221f18eabd3df31e21a5ef98699db4acc73c8
3567309d3f25020ec7a0d59e0ef55da7be113085
/d/affils/rooms/grm.c
0fd4e98fcfd3bc89448dc56a3de187531ebe3c3b
[]
no_license
flyingstupid/gbapoclib
64ec8b3828201d7eb158b5371164765d1b65ce93
dea2a4be3399509c7df44d33b2a307db3821017d
refs/heads/master
2021-04-27T08:02:48.717277
2018-02-23T17:04:11
2018-02-23T17:04:11
122,640,255
0
0
null
null
null
null
UTF-8
C
false
false
7,973
c
#include <mudlib.h> inherit AFFILIATION; inherit GUILD; object robe; void reset(status arg) { guild::reset(arg); affils::reset(arg); reset_doors(arg); remove_door("west door"); if(!guild_master) { guild_master = clone_object(MONSTER); guild_master -> set_name("ramsus"); guild_master -> set_short("Lt. Ramsus, of the Nine"); guild_master -> set_long( "Ramsus is a man of war, a lieutenant in the great wars of the \n"+ "IronHand at Ebony a few years ago. He is a mighty battle-mage \n"+ "and a skilled military tactician. Though a mage, he does not \n"+ "waste time in study, but prefers to be out in the field, training\n"+ "both mind and body.\n"+ "Ramsus is a Grey Robe Mage.\n"); guild_master -> load_chat(5, ({ "Ramsus studies an ancient tome.\n", "Ramsus asks: Have you come to study here, apprentice?\n", "Ramsus peruses a few scrolls of magic.\n", "Ramsus ponders the complexities of a magical formula.\n", "Ramsus practices a complex magical spell.\n", })); guild_master -> load_a_chat(5, ({ "Ramsus says: How dare you!\n", "Ramsus exclaims: You insolent fool!\n", "Ramsus says: You shall be punihed for this action.\n", "Ramsus says: Begone, or my magic will slay you.\n", "Ramsus exlaims: Leave the library now!\n", })); guild_master -> set_gender(1); guild_master -> set_level(30); guild_master -> set_hp(3000); guild_master -> set_ac(30); guild_master -> add_class("mage"); guild_master -> add_class("cleric"); guild_master -> load_spells(15, ({ "cure serious wounds", "energy drain", "meteor swarm", "comet", "burning hands", "chill touch", "vampiric touch", "disintegrate", "fire shield", "stone skin", "bless", "curse", "lightning bolt", "fireball", "death spell", })); guild_master -> add_spell_immunity("cold"); guild_master -> add_spell_immunity("fire"); guild_master -> add_spell_immunity("lightning"); guild_master -> set_magic_resist(50); guild_master -> set_race("human"); guild_master -> add_money(100 + random(1000)); guild_master -> set_dead_ob(this_object()); move_object(guild_master,this_object()); } if(!present("robe", guild_master)) { robe = clone_object("d/coronos/w/angel/city/obj/grobe"); move_object(robe, guild_master); guild_master->init_command("wear robe"); } if(arg) return; load_door(({ "file", "d/sorcery/w/angel/hall3", "direction", "east door", "long", "A fine door of sturdy oak.\n", })); set_short("the chambers of the grey robed mages"); set_long( "Battle plans from many wars, both past and present hang on the \n"+ "walls of this fine office. There is definitely the cry of war \n"+ "in this room. Suits of armour, glistening in the candle light \n"+ "from the single black ornate candle that sits on the wide desk,\n"+ "filled with papers and plans. This is where hopeful students \n"+ "from all over Magia come to learn from the master of the Grey \n"+ "Robes, and join the robes of alignment.\n"); set_items(({ "papers#paper#plan#plans", "They outline new spells and new tactics in which to employ them", "desk", "A large desk of some dark black metal", "armour#suits of armour#suits", "Nine carefully cared for suits of full plate armour stand at \n"+ "attention at regular intervals around the room. You almost \n"+ "expect them to come to life at any moment now!", "candle", "A black incense candle. The scent from it is quite delicate, \n"+ "and in quite contrast to the rest of the room. It bears the \n"+ "initials SW in a circle of magic at its base", "plans#battle plans", "You catch a glimpse of one of the plans for the Ebony War.\n"+ "It makes some mention of drow bases around the tips of \n"+ "what is now known as Ille Coronos", })); set_weather(5, 1, 0); set_affiliation_name("Grey Robe Mage"); set_affiliation_file("grm"); set_skills_file("obj/skills/affils/grm"); set_exits(({ })); set_guild_name("No"); /* normal guild */ set_classes(({ "primary", ({ "intelligence", "wisdom", }), "mage", ({ "illusion", "charm", "conjuration", "abjuration", "necromancy", "evocation", "divination", "alteration", }), })); set_exp(({ 0, 1014, 1522, 2283, 3425, 5138, 7707, 11561, 17341, 26012, 39018, 58527, 87791, 131687, 197530, 296296, 444444, 666666, 1000000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000, 4500000, 5000000, 5500000, 6000000, 6500000, })); set_skill_exp(({ 30, 50, 75, 100, 175, 250, 400, 600, 900, 1200, 2000, 3000, 4500, 6500, 10000, 15000, 20000, 30000, 50000, 75000, 100000, 125000, 150000, 175000, 200000, 225000, 250000, 275000, 300000, 325000, })); set_titles(({ ({}), /* no neuter characters now but possible */ /* male titles */ ({ "the Utter Newbie", "the Apprentice", "the Initiate", "the Student of Magic", "the Apprentice of Magic", "the Apprentice Magician", "the Magician", "the Apprentice Sorcerer", "the Sorcerer", "the Wizard", "the Wizard of the 1st Circle", "the Wizard of the 2nd Circle", "the Wizard of the 3rd Circle", "the Wizard of the 4th Circle", "the Wizard of the 4th Circle", "the Wizard of the 5th Circle", "the Wizard of the 6th Circle", "the Wizard of the 7th Circle", "the Wizard of the 8th Circle", "the Wizard of the 9th Circle", "the Mage", "the High Mage", "the High Mage of the 1st Circle", "the High Mage of the 2nd Circle", "the High Mage of the 3rd Circle", "the High Mage of the 4th Circle", "the High Mage of the 5th Circle", "the High Mage of the 6th Circle", "the High Mage of the 7th Circle", "the High Mage of the 8th Circle", "the High Mage of the 9th Circle", }), /* female titles */ ({ "the Utter Newbie", "the Apprentice", "the Initiate", "the Student of Magic", "the Apprentice of Magic", "the Apprentice Magician", "the Magician", "the Apprentice Sorcerer", "the Sorcerer", "the Wizard", "the Wizard of the 1st Circle", "the Wizard of the 2nd Circle", "the Wizard of the 3rd Circle", "the Wizard of the 4th Circle", "the Wizard of the 5th Circle", "the Wizard of the 6th Circle", "the Wizard of the 7th Circle", "the Wizard of the 8th Circle", "the Wizard of the 9th Circle", "the Mage", "the High Mage", "the High Mage of the 1st Circle", "the High Mage of the 1st Circle", "the High Mage of the 2nd Circle", "the High Mage of the 3rd Circle", "the High Mage of the 4th Circle", "the High Mage of the 5th Circle", "the High Mage of the 6th Circle", "the High Mage of the 7th Circle", "the High Mage of the 8th Circle", "the High Mage of the 9th Circle", }), })); /*** get a new pretitle one in four levels after 30 ***/ set_pretitles(({ ({}), /* no neuter pretitles */ /* male pretitles */ ({ "Magus", "Magus", "Magus", "High Magus", "High Magus", "High Magus", "Archmage", "Archmage", "Archmage", }), /* female pretitles */ ({ "Magus", "Magus", "Magus", "High Magus", "High Magus", "High Magus", "Archmage", "Archmage", "Archmage", }), })) ; } void init() { affils::init(); guild::init(); }
fa105093d55566b79f3cdffb19a9160ecd5bb997
6e73069807b8e7ad48dc729e8068334d5b44bd60
/src/daemon/zbdriver/silicon_labs/Simplicity-Studio-v4/developer/sdks/gecko_sdk_suite/v2.7/protocol/zigbee/app/framework/plugin/drlc-server/drlc-server-cli.c
2951d72cb4d03e5a6b6f481a5dc52db8aaa777eb
[ "Apache-2.0" ]
permissive
AndrewGoing/gl-zigbee-sdk
8da086cb5affd43a038b8a0d407f1b9cc470d7f8
94f5b41e7d2d46ce096fdd245ee9d171831c73de
refs/heads/master
2023-08-20T23:06:33.306442
2021-10-08T03:31:34
2021-10-08T03:31:34
null
0
0
null
null
null
null
UTF-8
C
false
false
6,665
c
/***************************************************************************//** * @file * @brief CLI for the DRLC plugin. ******************************************************************************* * # License * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b> ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this * software is governed by the terms of Silicon Labs Master Software License * Agreement (MSLA) available at * www.silabs.com/about-us/legal/master-software-license-agreement. This * software is distributed to you in Source Code format and is governed by the * sections of the MSLA applicable to Source Code. * ******************************************************************************/ #include "app/framework/include/af.h" #include "app/util/serial/command-interpreter2.h" #include "app/framework/plugin/drlc-server/drlc-server.h" void emberAfPluginDrlcServerPrintCommand(void); void emberAfPluginDrlcServerSlceCommand(void); void emberAfPluginDrlcServerSslceCommand(void); void emberAfPluginDrlcServerCslceCommand(void); #if !defined(EMBER_AF_GENERATE_CLI) EmberCommandEntry emberAfPluginDrlcServerCommands[] = { emberCommandEntryAction("print", emberAfPluginDrlcServerPrintCommand, "u", ""), emberCommandEntryAction("slce", emberAfPluginDrlcServerSlceCommand, "uuub", ""), emberCommandEntryAction("sslce", emberAfPluginDrlcServerSslceCommand, "vuuu", ""), emberCommandEntryAction("cslce", emberAfPluginDrlcServerCslceCommand, "u", ""), emberCommandEntryTerminator(), }; #endif // EMBER_AF_GENERATE_CLI // plugin drlc-server slce <endpoint:1> <index:1> <length:1> <load control event bytes> // load control event bytes are expected as 23 raw bytes in the form // {<eventId:4> <deviceClass:2> <ueg:1> <startTime:4> <duration:2> <criticalityLevel:1> // <coolingTempOffset:1> <heatingTempOffset:1> <coolingTempSetPoint:2> <heatingTempSetPoint:2> // <afgLoadPercentage:1> <dutyCycle:1> <eventControl:1> } all multibyte values should be // little endian as though they were coming over the air. // Example: plug drlc-server slce 0 23 { ab 00 00 00 ff 0f 00 00 00 00 00 01 00 01 00 00 09 1a 09 1a 0a 00 } void emberAfPluginDrlcServerSlceCommand(void) { EmberAfLoadControlEvent event; EmberStatus status; uint8_t endpoint = (uint8_t)emberUnsignedCommandArgument(0); uint8_t index = (uint8_t)emberUnsignedCommandArgument(1); uint8_t length = (uint8_t)emberUnsignedCommandArgument(2); uint8_t slceBuffer[sizeof(EmberAfLoadControlEvent)]; status = emAfGetScheduledLoadControlEvent(endpoint, index, &event); if (status != EMBER_SUCCESS) { emberAfDemandResponseLoadControlClusterPrintln("slce fail: 0x%x", status); return; } if (length > sizeof(EmberAfLoadControlEvent)) { emberAfDemandResponseLoadControlClusterPrintln("slce fail, length: %x, max: %x", length, sizeof(EmberAfLoadControlEvent)); return; } emberCopyStringArgument(3, slceBuffer, length, false); event.eventId = emberAfGetInt32u(slceBuffer, 0, length); event.deviceClass = emberAfGetInt16u(slceBuffer, 4, length); event.utilityEnrollmentGroup = emberAfGetInt8u(slceBuffer, 6, length); event.startTime = emberAfGetInt32u(slceBuffer, 7, length); event.duration = emberAfGetInt16u(slceBuffer, 11, length); event.criticalityLevel = emberAfGetInt8u(slceBuffer, 13, length); event.coolingTempOffset = emberAfGetInt8u(slceBuffer, 14, length); event.heatingTempOffset = emberAfGetInt8u(slceBuffer, 15, length); event.coolingTempSetPoint = emberAfGetInt16u(slceBuffer, 16, length); event.heatingTempSetPoint = emberAfGetInt16u(slceBuffer, 18, length); event.avgLoadPercentage = emberAfGetInt8u(slceBuffer, 20, length); event.dutyCycle = emberAfGetInt8u(slceBuffer, 21, length); event.eventControl = emberAfGetInt8u(slceBuffer, 22, length); event.source[0] = 0x00; //activate the event in the table status = emAfSetScheduledLoadControlEvent(endpoint, index, &event); emberAfDemandResponseLoadControlClusterPrintln("DRLC event scheduled on server: 0x%x", status); } // plugin drlc-server lce-schedule-mand <endpoint:1> <index:1> <eventId:4> <class:2> <ueg:1> <startTime:4> // <durationMins:2> <criticalLevel:1> <eventCtrl:1> void emberAfPluginDrlcServerScheduleMandatoryLce(void) { EmberAfLoadControlEvent event; EmberStatus status; uint8_t endpoint = (uint8_t)emberUnsignedCommandArgument(0); uint8_t index = (uint8_t)emberUnsignedCommandArgument(1); status = emAfGetScheduledLoadControlEvent(endpoint, index, &event); if ( status != EMBER_SUCCESS ) { emberAfDemandResponseLoadControlClusterPrintln("Error: Get LCE status=0x%x", status); } event.eventId = (uint32_t)emberUnsignedCommandArgument(2); event.deviceClass = (uint16_t)emberUnsignedCommandArgument(3); event.utilityEnrollmentGroup = (uint8_t) emberUnsignedCommandArgument(4); event.startTime = (uint32_t)emberUnsignedCommandArgument(5); event.duration = (uint16_t)emberUnsignedCommandArgument(6); event.criticalityLevel = (uint8_t) emberUnsignedCommandArgument(7); event.eventControl = (uint8_t) emberUnsignedCommandArgument(8); // Optionals event.coolingTempOffset = 0xFF; event.heatingTempOffset = 0xFF; event.coolingTempSetPoint = 0x8000; event.heatingTempSetPoint = 0x8000; event.avgLoadPercentage = 0x80; event.dutyCycle = 0xFF; event.source[0] = 0x00; //activate the event in the table status = emAfSetScheduledLoadControlEvent(endpoint, index, &event); if ( status == EMBER_SUCCESS ) { emberAfDemandResponseLoadControlClusterPrintln("DRLC event scheduled"); } else { emberAfDemandResponseLoadControlClusterPrintln("Error: Schedule DRLC event: 0x%x", status); } } // plugin drlc-server sslce <nodeId:2> <srcEndpoint:1> <dstEndpoint:1> <index:1> void emberAfPluginDrlcServerSslceCommand(void) { emAfPluginDrlcServerSlceMessage((EmberNodeId)emberUnsignedCommandArgument(0), (uint8_t)emberUnsignedCommandArgument(1), (uint8_t)emberUnsignedCommandArgument(2), (uint8_t)emberUnsignedCommandArgument(3)); } // plugin drlc-server print <endpoint:1> void emberAfPluginDrlcServerPrintCommand(void) { emAfPluginDrlcServerPrintInfo((uint8_t)emberUnsignedCommandArgument(0)); } // plugin drlc-server cslce <endpoint:1> void emberAfPluginDrlcServerCslceCommand(void) { emAfClearScheduledLoadControlEvents((uint8_t)emberUnsignedCommandArgument(0)); }
8b731cb1e64cff236c34f0946052eb3bd571b45e
309e1045a872514f82e7b3987f97b38c28b03e41
/rouziclib/fileio/image_tiff.h
ab0ec5abc1821533c8a59bec6969fb9372485f5b
[ "MIT" ]
permissive
Photosounder/rouziclib
ca51421f59389ed153cbd9598b7045772fdeed9b
fdc965964b13edf8c110fb1258d422856b5180dc
refs/heads/master
2023-08-24T23:51:23.023879
2023-08-20T06:13:11
2023-08-20T06:13:11
19,373,094
43
9
null
null
null
null
UTF-8
C
false
false
942
h
typedef struct { xyi_t dim; int be, chan, bpc; // big endian, channel count, bits per channel int compression; // 1 for uncompressed int photometric; // 2 for RGB(A) int sample_format; // 1 for uint, 2 for int, 3 for float int lzw_diff; // 1 for no difference, 2 for horizontal difference uint32_t *data_offset; // points to the strip offsets int offset_count; // number of strip offsets int rowsperstrip, planarconfig; int bytesperstrip; // number of decoded bytes per strip } tiff_info_t; extern int is_file_tiff_mem(uint8_t *data); extern raster_t load_tiff_mem_raster(uint8_t *data); extern float *load_tiff_file(const char *path, xyi_t *dim, int *out_chan); extern void *load_tiff_file_raw(const char *path, tiff_info_t *info); extern raster_t load_tiff_file_raster(const char *path); extern int save_image_tiff(const char *path, float *im, xyi_t dim, int in_chan, int out_chan, int bpc); extern int tiff_store_pixels_last;
d6d01ad9a8e31aebeb6e9b828c68e2e9efbc6c50
2f8598fd68531c9942e12ee0f404aea04a8a3481
/STM32F429Discovery/Driver/System/getThreadInfo.h
5919d8c7d3efbc06ed5ae50d693aa62cbe0ce108
[]
no_license
houjunzyt/GraduationProject
851c33d24d9355b7eb27982767aa32f6c092d505
eb4b506c1451d68c1eba15bb6bc85d03bd9d6ce7
refs/heads/master
2020-04-25T07:57:11.368504
2019-06-01T11:44:42
2019-06-01T11:44:42
172,630,000
2
1
null
null
null
null
GB18030
C
false
false
647
h
#ifndef _GETTHREADINFO_H_ #define _GETTHREADINFO_H_ #include "board.h" #include "rtthread.h" #include "stm32f4xx.h" #include <rthw.h> #include <string.h> #include <stdio.h> #define LIST_FIND_OBJ_NR 8 typedef struct { rt_list_t *list; rt_list_t **array; rt_uint8_t type; int nr; int nr_out; } list_get_next_t; typedef struct { char name[RT_NAME_MAX]; //线程名字 rt_uint8_t stat; //线程状态 rt_uint8_t current_priority; //线程优先级 rt_uint8_t num; //线程个数 } RT_Thread_Info; void list_thread(RT_Thread_Info *user_thread ); #endif
d81a312d3b5e8ed74dd17034cb0801327ccc5fde
c425afb8bb6b182168fd4c3a46c9b334f4740e60
/data/warcraft/rrrooo.c
d627d64bd3e5fe607eeaac74cfbc3364930cc32c
[]
no_license
fluffos/nt7
ceef82b2465cf322549c7ece6ce757eaa8ec31ff
52727f5a4266b14f1796c2aa297ca645ca07282a
refs/heads/main
2023-06-17T10:07:33.000534
2021-07-15T11:15:05
2021-07-15T11:15:05
308,148,401
9
9
null
2021-06-28T14:11:57
2020-10-28T21:45:40
C
UTF-8
C
false
false
493
c
// warcraft.c #include "/clone/npc/warcraft.h" void setup() { set_name("小马", ({"rrroooma"})); set("gender", "男性"); set("long", "小马 它是江一的魔幻兽。 "); set("race_type", "麒麟"); set("magic/type", "earth"); set("owner", "rrrooo"); set("owner_name", "江一"); set_temp("owner", "rrrooo"); set_temp("owner_name", "江一"); ::setup(); }
227375173115abac566c17badc6311bf9928a545
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/dbdd6f6a-9495-41c6-9e11-e0814d536ca3.c
c1caf1a2438c953dea3f2d9b9f71529b8826b031
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
551
c
#include <string.h> #include <stdio.h> int main() { int i=4; int j=12; int k; int l; k = 53; l = 64; k = i-j; l = i%j; l = k%j; l = k-j*i; //variables //random /* START VULNERABILITY */ int a; long b[40]; long c[57]; a = 0; do { /* START BUFFER SET */ *((long *)c + a) = *((long *)b + a); /* END BUFFER SET */ //random a++; } while(a < strlen(b)); /* END VULNERABILITY */ printf("%d%d\n",k,l); return 0; }
d928811aa73e2fdaa6b2420218c9b5f20477528f
b010b0acdeacb2164ec2a8753469544465a45d23
/mess/src/lib/miniupnpc-1.4.20100609/miniupnpcstrings.h
64032f8b62aa9c98deef6660797167a16c2f5316
[ "BSD-3-Clause" ]
permissive
lidibupa/ClientServerMAME
1457e13caf171ca5c19be73654eb7b4c20097ade
d0997a9b8ebc26e7518135526cb7583552675d95
refs/heads/master
2021-01-18T08:47:16.107337
2011-08-13T18:35:23
2011-08-13T18:35:23
null
0
0
null
null
null
null
UTF-8
C
false
false
502
h
/* $Id: miniupnpcstrings.h.in,v 1.2 2009/10/30 09:18:18 nanard Exp $ */ /* Project: miniupnp * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author: Thomas Bernard * Copyright (c) 2005-2009 Thomas Bernard * This software is subjects to the conditions detailed * in the LICENCE file provided within this distribution */ #ifndef __MINIUPNPCSTRINGS_H__ #define __MINIUPNPCSTRINGS_H__ #define OS_STRING "MINGW32_NT-6.1/1.0.11(0.46/3/2)" #define MINIUPNPC_VERSION_STRING "1.4" #endif
273c2d25ee68f08687c6e38539738169efb999ae
150d50b0d1cea5b6bc7488a9703914e1d99b2fe2
/src/bf.c
4d811617372e1167dfb32b706778165851843919
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
bartlomiejbloniarz/cherkassky_goldberg_radzik
67b0fb1ecc9c1f4f5ab67016df51a6a3373fb2ed
cf72bb0111e1ff3576aabf2cc3c5aa7b3ceb6c2d
refs/heads/master
2022-05-10T16:59:49.631099
2017-06-10T10:52:40
2017-06-10T10:52:40
null
0
0
null
null
null
null
UTF-8
C
false
false
2,102
c
void bf ( n, nodes, source ) long n; /* number of nodes */ node *nodes, /* pointer to the first node */ *source; /* pointer to the source */ { #define NNULL (node*)NULL #define VERY_FAR 1073741823 /* ----- queues definitions ----- */ node *begin, *end; /* status of node regarding to queue */ #define IN_QUEUE 0 #define OUT_OF_QUEUE 1 #define INIT_QUEUE(source)\ {\ begin = end = source;\ source -> next = NNULL;\ source -> status = IN_QUEUE;\ } #define NONEMPTY_QUEUE ( begin != NNULL ) #define NODE_IN_QUEUE(node) ( node -> status == IN_QUEUE ) #define EXTRACT_FIRST(node)\ {\ node = begin;\ node -> status = OUT_OF_QUEUE;\ begin = begin -> next;\ } #define INSERT_TO_QUEUE(node)\ {\ if ( begin == NNULL )\ begin = node;\ else\ end -> next = node;\ \ end = node;\ end -> next = NNULL;\ node -> status = IN_QUEUE;\ }\ /* -------------------------------------- */ long dist_new, dist_from; node *node_from, *node_to, *node_last, *i; arc *arc_ij, *arc_last; long num_scans = 0; /* initialization */ node_last = nodes + n ; for ( i = nodes; i != node_last; i ++ ) { i -> parent = NNULL; i -> dist = VERY_FAR; i -> status = OUT_OF_QUEUE; } source -> parent = source; source -> dist = 0; INIT_QUEUE (source) /* main loop */ while ( NONEMPTY_QUEUE ) { num_scans ++; EXTRACT_FIRST ( node_from ) arc_last = ( node_from + 1 ) -> first; dist_from = node_from -> dist; for ( arc_ij = node_from -> first; arc_ij != arc_last; arc_ij ++ ) { /* scanning arcs outgoing from node_from */ node_to = arc_ij -> head; dist_new = dist_from + ( arc_ij -> len ); if ( dist_new < node_to -> dist ) { node_to -> dist = dist_new; node_to -> parent = node_from; if ( ! NODE_IN_QUEUE ( node_to ) ) INSERT_TO_QUEUE ( node_to ) } } /* end of scanning node_from */ } /* end of the main loop */ n_scans = num_scans; }
cbbb378d667a9daf3931a1880eb23ba5107f7479
ffca8ba2fe1392fd5012b4b08245c969a00161bb
/Thread-1.0.1/hal/micro/cortexm3/em35x/em3596/mpu-config.h
f9be3c2161361d5d8458481bc8804639909d0074
[]
no_license
umangparekh/thread_apps
c7e5f2fadb091107f6135de433812e6d78588adc
989f324d44437e5a71a69551a4f8148b38cf55cd
refs/heads/master
2021-01-10T02:02:34.394997
2015-09-29T17:58:17
2015-09-29T17:58:17
43,340,391
0
0
null
null
null
null
UTF-8
C
false
false
4,202
h
/** @file hal/micro/cortexm3/em35x/em3596/mpu-config.h * * @brief MPU configuration for the em3596 * * THIS IS A GENERATED FILE. DO NOT EDIT. * * <!-- Copyright 2015 Silicon Laboratories, Inc. *80*--> */ #ifndef __MPU_H__ #error This header should not be included directly, use hal/micro/cortexm3/mpu.h #endif #ifndef __EM3596_MPU_CFG_H__ #define __EM3596_MPU_CFG_H__ #include "hal/micro/micro.h" // Define the address offsets for all of our MPU regions #define FLASH_REGION (0x08000000 + 0x10) #define PERIPH_REGION (0x40000000 + 0x11) #define USERPER_REGION (0x40008000 + 0x12) #define SRAM_REGION (0x20000000 + 0x13) #define GUARD_REGION (0x20000000 + 0x14) #define SPARE0_REGION (0x20000000 + 0x15) #define SPARE1_REGION (0x20000000 + 0x16) #define SPARE2_REGION (0x20000000 + 0x17) //============================================================================= // Define the data used to initialize the MPU. Each of the 8 MPU regions // has a programmable size and various attributes. A region must be a power of // two in size, and its base address must be a multiple of that size. Regions // are divided into 8 equal-sized sub-regions that can be individually disabled. // A region is defined by what is written to MPU_BASE and MPU_ATTR. // MPU_BASE holds the region base address, with some low order bits ignored // depending on the region size. If B4 is set, then B3:0 set the region number. // The MPU_ATTR fields are: // XN (1 bit) - set to disable instruction execution // AP (2 bits) - selects Privilege & User access- None, Read-only or Read-Write // TEX,S,C,B (6 bits) - configures memory type, write ordering, shareable, ... // SRD (8 bits) - a set bit disables the corresponding sub-region // SIZE (5 bits) - specifies the region size as a power of two // ENABLE (1 bit) - set to enable the region, except any disabled sub-regions //============================================================================= // Region 0 - Flash, including main, fixed and customer info blocks: // execute, normal, not shareable // Enabled sub-regions: 08000000 - 0809FFFF #define FLASH_REGION_ATTR MATTR(0, PRO_URO, MEM_NORMAL, 0xE0, SIZE_1M, 1) // Region 1 - System peripherals: no execute, non-shared device // Enabled sub-regions: 40000000 - 4001FFFF #define PERIPH_REGION_ATTR MATTR(1, PRW_URO, MEM_DEVICE, 0x00, SIZE_128K, 1) // Region 2 - User peripherals: no execute, non-shared device // Enabled sub-regions: 4000A000 - 4000FFFF #define USERPER_REGION_ATTR MATTR(1, PRW_URW, MEM_DEVICE, 0x03, SIZE_32K, 1) // Region 3 - SRAM: no execute, normal, not shareable // Enabled sub-regions: 20000000 - 2000FFFF #define SRAM_REGION_ATTR MATTR(1, PRW_URW, MEM_NORMAL, 0x00, SIZE_32K, 1) // Region 4 - Guard region between the heap and stack #define GUARD_REGION_ATTR_EN MATTR(1, PNA_UNA, MEM_NORMAL, 0x00, \ HEAP_GUARD_REGION_SIZE, 1) #define GUARD_REGION_ATTR_DIS MATTR(1, PNA_UNA, MEM_NORMAL, 0x00, \ HEAP_GUARD_REGION_SIZE, 0) // Regions 5-7 - unused: disabled (otherwise set up for SRAM) #define SPARE0_REGION_ATTR MATTR(1, PRW_URW, MEM_NORMAL, 0x00, SIZE_1K, 0) #define SPARE1_REGION_ATTR MATTR(1, PRW_URW, MEM_NORMAL, 0x00, SIZE_1K, 0) #define SPARE2_REGION_ATTR MATTR(1, PRW_URW, MEM_NORMAL, 0x00, SIZE_1K, 0) // Map the regions defined above into more generic versions that are // appropriate for mpu.c #define MPU_REGION0_BASE FLASH_REGION #define MPU_REGION1_BASE PERIPH_REGION #define MPU_REGION2_BASE USERPER_REGION #define MPU_REGION3_BASE SRAM_REGION #define MPU_REGION4_BASE GUARD_REGION #define MPU_REGION5_BASE SPARE0_REGION #define MPU_REGION6_BASE SPARE1_REGION #define MPU_REGION7_BASE SPARE2_REGION #define MPU_REGION0_ATTR FLASH_REGION_ATTR #define MPU_REGION1_ATTR PERIPH_REGION_ATTR #define MPU_REGION2_ATTR USERPER_REGION_ATTR #define MPU_REGION3_ATTR SRAM_REGION_ATTR #define MPU_REGION4_ATTR GUARD_REGION_ATTR_DIS #define MPU_REGION5_ATTR SPARE0_REGION_ATTR #define MPU_REGION6_ATTR SPARE1_REGION_ATTR #define MPU_REGION7_ATTR SPARE2_REGION_ATTR #endif //__EM3596_MPU_CFG_H__
9c2a6b0b0d846994a07f18645bf4a8e44da4eede
ef23e388061a637f82b815d32f7af8cb60c5bb1f
/src/emu/imagedev/chd_cd.h
5c28ac508974f9fefda2b37fdd4b3cbc742838a4
[]
no_license
marcellodash/psmame
76fd877a210d50d34f23e50d338e65a17deff066
09f52313bd3b06311b910ed67a0e7c70c2dd2535
refs/heads/master
2021-05-29T23:57:23.333706
2011-06-23T20:11:22
2011-06-23T20:11:22
null
0
0
null
null
null
null
UTF-8
C
false
false
1,236
h
/********************************************************************* chd_cd.h Interface to the CHD CDROM code *********************************************************************/ #ifndef CHD_CD_H #define CHD_CD_H #include "cdrom.h" /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ typedef struct cdrom_config_t cdrom_config; struct cdrom_config_t { const char * interface; }; /*************************************************************************** FUNCTION PROTOTYPES ***************************************************************************/ DECLARE_LEGACY_IMAGE_DEVICE(CDROM, cdrom); cdrom_file *cd_get_cdrom_file(device_t *device); /*************************************************************************** DEVICE CONFIGURATION MACROS ***************************************************************************/ #define MCFG_CDROM_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, CDROM, 0) \ #define MCFG_CDROM_INTERFACE(_interface) \ MCFG_DEVICE_CONFIG_DATAPTR(cdrom_config, interface, _interface ) #endif /* CHD_CD_H */
[ "Mike@localhost" ]
Mike@localhost
c97b3328343856417f101259ccb47b9d5a639da2
dadb03095d2ec2c1d70382bf280db0bccbd497d1
/mega328_GPS_CAN/Src/Main.c
67ad70386e7231b63e8b7e11e0b4db7a1ab8eb8e
[]
no_license
nalale/BoatFirmware
493ff9cf8bbacb3fccb7e927036acfaff2b88db5
6476312e96541f55f916849912780912c7767a4d
refs/heads/master
2021-06-15T01:32:03.516836
2021-05-25T06:30:09
2021-05-25T06:30:09
197,399,164
0
1
null
null
null
null
WINDOWS-1251
C
false
false
1,710
c
/* * Main.c * * Created on: 17 мая 2020 г. * Author: a.lazko */ #include "Main.h" #include <avr/io.h> #include <avr/interrupt.h> #include <avr/pgmspace.h> #include <stdio.h> #include <string.h> #include "../ATmega328P-master/inc/SPI.h" #include "../ATmega328P-master/inc/UART2.h" #include "../ExternalDrivers/mcp2515.h" #include "../ExternalDrivers/gpsNeo6n.h" #include "TIMER.h" #define PORT_DIR_OUT 1 #define PORT_DIR_IN !PORT_DIR_OUT int main(void) { uint32_t ts = 0; char s = 0, led = 0; CanMsg msg; msg.ID = 363; msg.DLC = 8; msg.Ext = 0; DDRD = (PORT_DIR_OUT << DDD3) | (PORT_DIR_OUT << DDD4) | (PORT_DIR_OUT << DDD5); UART2_init(); SPI_init(); TIMER_init(); //MCP2515_SELECT(MCP_CS1_U6); mcp2515_setSpiCallBack(SPI_writeRead); mcp2515_init(MCP_CS1_U6, MCP_CAN1_NUM, kBAUD250); sei(); while(1) { if(UART2_ngets(&s, sizeof(s))) neo6m_ProcessCharacter(s); neo6m_Thread(); if(GetTime_msFrom(ts) >= 250) { ts = GetTime_msStamp(); led = !led; PORTD = (led << PORTD3) | (led << PORTD4) | (led << PORTD5); uint16_t vel = GetVelocityKmph(); msg.data[0] = vel; msg.data[1] = vel >> 8; msg.data[2] = (uint8_t)GetTime(); msg.data[3] = (uint8_t)((uint32_t)GetTime() >> 8); msg.data[4] = (uint8_t)((uint32_t)GetTime() >> 16); msg.data[5] = (uint8_t)((uint32_t)GetTime() >> 24); mcp2515_write_canMsg(MCP_CS1_U6, &msg); } } }
fa6e394b4ac2dac9dfa0807db16dbfd6e40309a8
ca93ccf1b7168680b9c6e336e33a33be2726ca54
/Excercise/chapter9/C(d).c
7fd2fd0f63adf26f7981b0a40cf69e580f297e90
[]
no_license
shubh-dubey/Let-Us-C-Solutions
bf202126228133a816a9924e53ef7e1e0ad2b51c
de1f57455d8840313bf27715ed04efade5c20c18
refs/heads/main
2023-08-22T09:50:55.815620
2021-06-10T10:08:04
2021-06-10T10:08:04
412,448,514
0
0
null
2021-10-01T11:57:42
2021-10-01T11:57:42
null
UTF-8
C
false
false
364
c
#include<stdio.h> #include<conio.h> void GCD(int *, int *); int main(){ int J, K; printf("Enter value of J and K : "); scanf("%d %d", &J, &K); while(K!=0){ GCD(&J, &K); } getch(); return 0; } void GCD(int *J, int *K){ int j, k; int remainder = *J / *K; j=*J; k=*K; *J=k; *K= j-remainder*k; if(*K==0) printf("\nGreatest common divisor is %d", k); }
73e426fbe28b3a735c0696956ad45467384a006a
d792300a60bf72fc85f85d7297c7b878ede92fc6
/bsp/inc/bsp.h
3ef95f1dcb85f9dec94a9fa34b1cf227ec7598cc
[]
no_license
nahueespinosa/salt
f2882b6a8220dda16559c65281318e443bce5ff6
0fa33e4ad54c1ef9464be9194368bee91ce67c32
refs/heads/master
2023-01-22T05:43:55.373000
2020-11-29T16:13:26
2020-11-29T16:13:26
292,737,728
0
0
null
2020-10-01T23:39:33
2020-09-04T03:18:07
C
UTF-8
C
false
false
2,787
h
/* * -------------------------------------------------------------------------- * * Framework RKH * ------------- * * State-machine framework for reactive embedded systems * * Copyright (C) 2010 Leandro Francucci. * All rights reserved. Protected by international copyright laws. * * * RKH is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * RKH 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 RKH, see copying.txt file. * * Contact information: * RKH web site: http://sourceforge.net/projects/rkh-reactivesys/ * e-mail: [email protected] * --------------------------------------------------------------------------- */ /** * \file bsp.h * \brief BSP for Cortex-M3 EDU-CIAA LPC4337 ARM-GCC * * \ingroup bsp */ /* -------------------------- Development history -------------------------- */ /* * 2017.06.23 DaBa v1.0.00 Initial version */ /* -------------------------------- Authors -------------------------------- */ /* * DaBa Dario Bali\F1a [email protected] */ /* --------------------------------- Module -------------------------------- */ #ifndef __BSP_H__ #define __BSP_H__ /* ----------------------------- Include files ----------------------------- */ /* ---------------------- External C language linkage ---------------------- */ #ifdef __cplusplus extern "C" { #endif /* --------------------------------- Macros -------------------------------- */ /* -------------------------------- Constants ------------------------------ */ #define BSP_TICK_RATE_HZ (1000) #define BSP_TICK_RATE_MS (BSP_TICK_RATE_HZ/RKH_CFG_FWK_TICK_RATE_HZ) /* ------------------------------- Data types ------------------------------ */ /* -------------------------- External variables --------------------------- */ /* -------------------------- Function prototypes -------------------------- */ void bsp_init( int argc, char *argv[] ); void bsp_timeTick( void ); /* -------------------- External C language linkage end -------------------- */ #ifdef __cplusplus } #endif /* ------------------------------ Module end ------------------------------- */ #endif /* ------------------------------ File footer ------------------------------ */
9b61c6b11509f78e7248b0e1265c8a49121277d9
a280aa9ac69d3834dc00219e9a4ba07996dfb4dd
/regularexpress/home/weilaidb/software/Python-2.7.13/Modules/zlib/gzwrite.c
2c9ac2b2f60a283032eae46b7e79ca53e6ff65fa
[]
no_license
weilaidb/PythonExample
b2cc6c514816a0e1bfb7c0cbd5045cf87bd28466
798bf1bdfdf7594f528788c4df02f79f0f7827ce
refs/heads/master
2021-01-12T13:56:19.346041
2017-07-22T16:30:33
2017-07-22T16:30:33
68,925,741
4
2
null
null
null
null
UTF-8
C
false
false
1,084
c
local int gz_init OF((gz_statep)); local int gz_comp OF((gz_statep, int)); local int gz_zero OF((gz_statep, z_off64_t)); local int gz_init(state) gz_statep state; local int gz_comp(state, flush) gz_statep state; int flush; local int gz_zero(state, len) gz_statep state; z_off64_t len; int ZEXPORT gzwrite(file, buf, len) gzFile file; voidpc buf; unsigned len; int ZEXPORT gzputc(file, c) gzFile file; int c; int ZEXPORT gzputs(file, str) gzFile file; const char *str; #if defined(STDC) || defined(Z_HAVE_STDARG_H) int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; int ZEXPORT gzflush(file, flush) gzFile file; int flush; int ZEXPORT gzsetparams(file, level, strategy) gzFile file; int level; int strategy; int ZEXPORT gzclose_w(file) gzFile file;
e09cf7fcd5e60270c792254f89d9d830e468fc56
ecfb152af870aea90355fe29fa46989030c6d4c6
/xorg-server-X11R7.1-1.1.0/hw/xfree86/os-support/shared/bios_devmem.c
b63704cde96a2a11f8c7371e715908474e5fec9e
[]
no_license
Magister/x11rdp_xorg71
b1e6a4acf08812dc92b3e507bd22281697989ef0
097603f5f9cf6e8ea56d6e3f8bea6100cc835ada
refs/heads/master
2021-01-19T07:41:02.050682
2012-02-11T21:49:32
2012-02-11T21:49:32
3,473,986
1
2
null
null
null
null
UTF-8
C
false
false
2,328
c
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c,v 3.5 1998/09/13 00:51:32 dawes Exp $ */ /* * Copyright 1993 by David Wexelblat <[email protected]> * * 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, and that the name of David Wexelblat not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. David Wexelblat makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, 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. * */ /* $XConsortium: bios_devmem.c /main/5 1996/10/19 18:07:41 kaleb $ */ #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif #include <X11/X.h> #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include <string.h> /* * Read BIOS via /dev/mem. */ #ifndef DEV_MEM # define DEV_MEM "/dev/mem" #endif _X_EXPORT int xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) { int fd; #ifdef __ia64__ if ((fd = open(DEV_MEM, O_RDONLY | O_SYNC)) < 0) #else if ((fd = open(DEV_MEM, O_RDONLY)) < 0) #endif { xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", DEV_MEM, strerror(errno)); return(-1); } if (lseek(fd, (Base+Offset), SEEK_SET) < 0) { xf86Msg(X_WARNING, "xf86ReadBIOS: %s seek failed (%s)\n", DEV_MEM, strerror(errno)); close(fd); return(-1); } if (read(fd, Buf, Len) != Len) { xf86Msg(X_WARNING, "xf86ReadBIOS: %s read failed (%s)\n", DEV_MEM, strerror(errno)); close(fd); return(-1); } close(fd); return(Len); }
[ "jay@1bcb0b09-b424-0410-92a4-e5ef3db1a8a0" ]
jay@1bcb0b09-b424-0410-92a4-e5ef3db1a8a0
838c0cdff1f1e0f6f58b8063f308aec7c91ec593
03a7c5275dfeb4369930679c561e73e9eeeeb215
/CodeScanner/USER/stm32f10x_it.c
76e0959e619ff1390536dc653ee5bac1ed89ed3e
[ "Apache-2.0" ]
permissive
lingjiawang511/myprogram_2016year
620edf99783a0857e7dc93476a931a3a76909ff3
758bc0a2d9bdfda8e8664d539180cb14c96ace9c
refs/heads/master
2021-01-23T07:21:29.008533
2020-04-26T07:15:46
2020-04-26T07:15:46
86,420,757
0
1
null
null
null
null
GB18030
C
false
false
7,047
c
/** ****************************************************************************** * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c * @author MCD Application Team * @version V3.5.0 * @date 08-April-2011 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2> ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_it.h" #include"HeadType.h" #include "usart.h" /** @addtogroup STM32F10x_StdPeriph_Template * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M3 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { } //============================================================================= //函数名称:TIM2_IRQHandler //功能概要:TIM2 中断函数 //参数说明:无 //函数返回:无 //============================================================================= void TIM2_IRQHandler(void) { if ( TIM_GetITStatus(TIM2 , TIM_IT_Update) != RESET ) { scanner_scan(); Beep_LoudNum(); Led_Flash(); TIM_ClearITPendingBit(TIM2 , TIM_FLAG_Update); } } //============================================================================= //函数名称:TIM3_IRQHandler //功能概要:TIM3 中断函数 //参数说明:无 //函数返回:无 //============================================================================= void TIM3_IRQHandler(void) { if ( TIM_GetITStatus(TIM3 , TIM_IT_Update) != RESET ) { if (1 == Usart1_Control_Data.rx_start){ if(Auto_Frame_Time1 >0){ Auto_Frame_Time1--; }else{ Auto_Frame_Time1 = 0; Usart1_Control_Data.rx_aframe = 1; Usart1_Control_Data.rx_count = Usart1_Control_Data.rx_index; Usart1_Control_Data.rx_start = 0; Usart1_Control_Data.rx_index = 0; } } if (1 == Usart2_Control_Data.rx_start){ if(Auto_Frame_Time2 >0){ Auto_Frame_Time2--; }else{ Auto_Frame_Time2 = 0; Usart2_Control_Data.rx_aframe = 1; Usart2_Control_Data.rx_count = Usart2_Control_Data.rx_index; Usart2_Control_Data.rx_start = 0; Usart2_Control_Data.rx_index = 0; } } TIM_ClearITPendingBit(TIM3 , TIM_FLAG_Update); } } //============================================================================= //函数名称:TIM4_IRQHandler //功能概要:TIM4 中断函数 //参数说明:无 //函数返回:无 //============================================================================= void TIM4_IRQHandler(void) { if ( TIM_GetITStatus(TIM4 , TIM_IT_Update) != RESET ) { Beep_Response(); TIM_ClearITPendingBit(TIM4 , TIM_FLAG_Update); } } //============================================================================= //函数名称:USART1_IRQHandler //功能概要:USART1 中断函数 //参数说明:无 //函数返回:无 //============================================================================= void USART1_IRQHandler(void) { if(USART_GetFlagStatus(USART1, USART_FLAG_RXNE)||USART_GetFlagStatus(USART1, USART_FLAG_ORE) != RESET){ //解决数据没接收完一直进中断的问题 USART1_Do_Rx(USART_ReceiveData(USART1)); USART_ClearFlag(USART1,USART_FLAG_RXNE); } if(USART_GetFlagStatus(USART1, USART_FLAG_TC)){ USART1_Do_Tx(); USART_ClearFlag(USART1,USART_FLAG_TC); } } //============================================================================= //函数名称:USART2_IRQHandler //功能概要:USART2 中断函数 //参数说明:无 //函数返回:无 //============================================================================= void USART2_IRQHandler(void) { if(USART_GetFlagStatus(USART2, USART_FLAG_RXNE)||USART_GetFlagStatus(USART2, USART_FLAG_ORE) != RESET){ USART2_Do_Rx(USART_ReceiveData(USART2)); USART_ClearFlag(USART2,USART_FLAG_RXNE); } if(USART_GetFlagStatus(USART2, USART_FLAG_TC)){ USART2_Do_Tx(); USART_ClearFlag(USART2,USART_FLAG_TC); } }
3afd41daf1a9ef727174609417f5aacca43a12be
1e55349d14d65e5be67e2e92d9978beb0ed7a0c0
/examples/c/rkh/blinky_bm/bsp/src/assert.c
66d02b8eaf625713096846593687653433b05c66
[ "BSD-3-Clause" ]
permissive
martinribelotta/cese-edu-ciaa-template
39b325389aff0a19dd1e14ed87088d63f3e222a8
8ff0977b104f4fe43f155d90bbc2ebbd3430fb2d
refs/heads/master
2021-04-15T12:46:16.263408
2020-09-17T13:55:05
2020-09-17T13:55:05
126,267,255
1
0
BSD-3-Clause
2018-09-26T02:32:18
2018-03-22T02:20:04
C
UTF-8
C
false
false
2,887
c
/* * -------------------------------------------------------------------------- * * Framework RKH * ------------- * * State-machine framework for reactive embedded systems * * Copyright (C) 2010 Leandro Francucci. * All rights reserved. Protected by international copyright laws. * * * RKH is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any * later version. * * RKH 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 RKH, see copying.txt file. * * Contact information: * RKH web site: http://sourceforge.net/projects/rkh-reactivesys/ * e-mail: [email protected] * --------------------------------------------------------------------------- */ /** * \file assert.c * \brief RKH assert function for EDU-CIAA * * \ingroup bsp */ /* -------------------------- Development history -------------------------- */ /* * 2017.04.14 DaBa v2.4.05 Initial version */ /* -------------------------------- Authors -------------------------------- */ /* * DaBa Dario Bali�a [email protected] */ /* --------------------------------- Notes --------------------------------- */ /* ----------------------------- Include files ----------------------------- */ #include "rkh.h" #include "rkhfwk_sched.h" #include "sapi.h" RKH_THIS_MODULE /* ----------------------------- Local macros ------------------------------ */ #ifdef DEBUG #define reset_now() __asm volatile (" bkpt 0x00FF\n" ) #else #define reset_now() NVIC_SystemReset() #endif /* ------------------------------- Constants ------------------------------- */ /* ---------------------------- Local data types --------------------------- */ /* ---------------------------- Global variables --------------------------- */ /* ---------------------------- Local variables ---------------------------- */ /* ----------------------- Local function prototypes ----------------------- */ /* ---------------------------- Local functions ---------------------------- */ /* ---------------------------- Global functions --------------------------- */ void rkh_assert( RKHROM char * const file, int line ) { ( void )line; RKH_DIS_INTERRUPT(); RKH_TR_FWK_ASSERT( ( RKHROM char * )file, __LINE__ ); rkh_fwk_exit(); reset_now(); } /* ------------------------------ File footer ------------------------------ */
a9dc7f189b7bd847f70f29b02750875ced440a38
e41c5d10d50013752a9b4fa0823b30a55ab4c958
/src/kernel/management/mm.c
6bf0be8370cf09d5b95569d1620f305df6d1216a
[]
no_license
autumn-wind/os-lab1
de4dffcbe923275e72639480211862582def72c6
4c7e3e2c5185f75100b7dff084771e41c9d267ae
refs/heads/master
2021-05-04T11:00:18.959405
2017-05-11T06:15:08
2017-05-11T06:15:08
48,466,517
1
0
null
null
null
null
UTF-8
C
false
false
6,262
c
#include "kernel.h" static void mm(void); extern uint8_t mem_maps[PAGE_NR]; pid_t MM; uint32_t get_free_page(){ int i; for(i = 0; i < PAGE_NR; ++ i){ if(mem_maps[i] == 0){ mem_maps[i] = 1; return KMEM + i * PAGE_SIZE; } } panic("No free page is found!\n"); return 0; } void copy_mem(char *dest, char *src, size_t len){ size_t i; for(i = 0; i < len; ++i){ *(dest + i) = *(src + i); } } void init_mm(){ PCB *p = create_kthread(mm); MM = p->pid; wakeup(p); } static void mm(void){ PDE *pdir, *fdir, *kpdir = get_kpdir(); PTE *ptable, *ftable; uint32_t pdir_idx, ptable_idx, addr, stack_page, new_page; uint32_t va, memsz, filesz, phoff, i, j, k, index; int file; uint8_t *c; Msg m; while(1){ receive(ANY, &m); if(m.src == MSG_HARD_INTR){ assert(0); }else if(m.src == PM){ /*user_addr_start = m.req_pid * PD_SIZE;*/ /*pdir = pa_to_va(user_addr_start);*/ /*ptable = pa_to_va(user_addr_start + PAGE_SIZE);*/ switch(m.type){ case GET_PAGE_DIR: pdir = pa_to_va( get_free_page() ); /*printk("page dir: %x\n", va_to_pa(pdir));*/ for(pdir_idx = 0; pdir_idx < NR_PDE; ++ pdir_idx){ make_invalid_pde(&pdir[pdir_idx]); } m.ret = (uint32_t)va_to_pa(pdir); break; case CLEAN_ADDR: pdir = pa_to_va(m.buf); for(pdir_idx = 0; pdir_idx < KOFFSET / PD_SIZE; pdir_idx++){ if(pdir[pdir_idx].present == 1){ ptable = pa_to_va(pdir[pdir_idx].page_frame << 12); for(ptable_idx = 0; ptable_idx < NR_PTE; ++ ptable_idx){ if(ptable[ptable_idx].present == 1){ mem_maps[( ( ptable[ptable_idx].page_frame << 12 ) - KMEM ) / PAGE_SIZE] = 0; } } mem_maps[((pdir[pdir_idx].page_frame << 12) - KMEM) / PAGE_SIZE] = 0; } } mem_maps[( (uint32_t)va_to_pa(pdir) - KMEM ) / PAGE_SIZE] = 0; /*pframe_idx = (user_addr_start >> 12) + 1;*/ break; case GET_STACK_PAGE: pdir = pa_to_va(m.buf); index = (USER_STACK >> 22) & 0x3FF; if(pdir[index].present){ ptable = pa_to_va( pdir[index].page_frame << 12 ); }else{ ptable = pa_to_va(get_free_page()); /*printk("new page table for stack: %x\n", va_to_pa(ptable));*/ for(ptable_idx = 0; ptable_idx < NR_PTE; ptable_idx ++){ make_invalid_pte(&ptable[ptable_idx]); } make_pde(&pdir[( USER_STACK >> 22 ) & 0x3FF], va_to_pa(ptable)); } stack_page = get_free_page(); /*printk("stack_page: %x\n", stack_page);*/ make_pte(&ptable[ ( USER_STACK >> 12 ) & 0x3FF], (void *)stack_page); m.ret = stack_page; break; case NEW_PAGE: pdir = pa_to_va(m.buf); /*printk("pframe_idx: %x\n", pframe_idx);*/ /*printk("pa sent in mm: %x\n", pa);*/ va = m.offset; file = m.req_pid; /*pa = (pframe_idx << 12);*/ memsz = m.len; filesz = m.filesz; /*printk("filesz: %x\n", filesz);*/ phoff = m.phoff; for(j = 0; j < memsz; ){ index = (va >> 22) & 0x3FF; if(pdir[index].present == 0){ ptable = pa_to_va(get_free_page()); /*printk("new page table: %x\n", va_to_pa(ptable));*/ for(ptable_idx = 0; ptable_idx < NR_PTE; ptable_idx ++){ make_invalid_pte(&ptable[ptable_idx]); } make_pde(&pdir[index], va_to_pa(ptable)); }else{ ptable = pa_to_va(pdir[index].page_frame << 12); } off_t page_offset; for(i = 0; j + i < memsz && i <= PD_SIZE - PAGE_SIZE; ){ page_offset = va % PAGE_SIZE; size_t can_fill = PAGE_SIZE - page_offset; new_page = get_free_page(); /*printk("new page: %x\n", new_page);*/ make_pte(&ptable[(va >> 12) & 0x3FF], (void *)new_page); c = pa_to_va(new_page); if(j + i >= filesz){ for(k = page_offset; k < PAGE_SIZE; ++ k){ c[k] = 0; } /*printk("fill zero page\n");*/ }else{ if(j + i + can_fill < filesz){ do_read(file, c, phoff, can_fill); phoff += can_fill; /*printk("fill full page\n");*/ }else{ size_t len = filesz - (j + i); do_read(file, c + page_offset, phoff, len); for(k = page_offset + len; k < PAGE_SIZE; ++ k){ c[k] = 0; } /*printk("fill half-full page\n");*/ } } va += can_fill; i += can_fill; } j += i; } break; case SHARE_KERNEL_PAGE: pdir = pa_to_va(m.buf); va = KOFFSET; memsz = KMEM; for(i = 0; i < memsz; i += PD_SIZE, va += PD_SIZE){ index = (va >> 22) & 0x3FF; make_pde(&pdir[index], (void *)(kpdir[index].page_frame << 12)); } break; case COPY_FATHER_PAGE: pdir = pa_to_va(m.buf); fdir = pa_to_va(m.offset); for(i = 0; i < KOFFSET / PD_SIZE; ++i){ if(fdir[i].present){ if(pdir[i].present){ ptable = pa_to_va(pdir[i].page_frame << 12); }else{ ptable = pa_to_va(get_free_page()); for(ptable_idx = 0; ptable_idx < NR_PTE; ptable_idx ++){ make_invalid_pte(&ptable[ptable_idx]); } /*printk("new child page table: %x\n", va_to_pa(ptable));*/ make_pde(&pdir[i], va_to_pa(ptable)); } ftable = pa_to_va(fdir[i].page_frame << 12); for(j = 0; j < NR_PTE; ++j){ if(ftable[j].present){ uint32_t phy_page; if(ptable[j].present){ phy_page = ptable[j].page_frame << 12; }else{ phy_page = get_free_page(); /*printk("new child page: %x\n", phy_page);*/ make_pte(&ptable[j], (void *)phy_page); } copy_mem((char *)pa_to_va(phy_page), (char *)pa_to_va(ftable[j].page_frame << 12), PAGE_SIZE); } } } } break; case GET_ARGS_PHY_ADDR: pdir = pa_to_va(m.buf); addr = m.offset; /*printk("old process args virtual addr: %x\n", addr);*/ ptable = pa_to_va(pdir[(addr >> 22) & 0x3FF].page_frame << 12); m.ret = (ptable[(addr >> 12) & 0x3FF].page_frame << 12) + (addr % PAGE_SIZE); /*printk("old process args physical addr: %x\n", m.ret);*/ break; default: assert(0); } pid_t dest = m.src; m.src = current->pid; send(dest, &m); }else{ assert(0); } } }
f39483a20b77f95659c49efc89f27aae18d3def5
c99d6f8fab0e587bcfa5d21bd5a126851b7bdf24
/kalimba/lib_sets/sdk/include/multirate_operators/cbops_peak_monitor_op.h
916f379ccd9bbd00a7969a9fbc0c919c8668f1cd
[]
no_license
DIIIIII/koovox_adk4.0
cd75854533a1b88667bdc21f8ef6e9476e289cc3
ed6522025aca351885b47593620926889b914d37
refs/heads/master
2020-04-28T17:00:38.985571
2015-08-21T07:02:09
2015-08-21T07:02:09
null
0
0
null
null
null
null
UTF-8
C
false
false
600
h
// ***************************************************************************** // %%fullcopyright(2007) http://www.csr.com // %%version // // $Change: 2317643 $ $DateTime: 2015/07/10 11:14:28 $ // ***************************************************************************** #ifndef CBOPS_PEAK_MONITOR_HEADER_INCLUDED #define CBOPS_PEAK_MONITOR_HEADER_INCLUDED .CONST $cbops.peak_monitor_op.PTR_INPUT_BUFFER_FIELD 0; .CONST $cbops.peak_monitor_op.PEAK_LEVEL_PTR 1; .CONST $cbops.peak_monitor_op.STRUC_SIZE 2; #endif //PEAK_MONITOR_HEADER_INCLUDED
74fc6835d34cec1e2dae5784bb573dfa0198a474
fee9e7a10356c611229a426bba147c9b489df089
/Chapter12/example/prog12.4.c
8a2eb0b7e6600b5f2e46e7a9795047a9ace3f34c
[]
no_license
ankitrgadiya/learn-c
e6be58f8ff588168ecf69b0ec92517118e07156b
88445a9ccf99023e6753eb4fbe87ad5b6ee50086
refs/heads/master
2021-03-22T02:15:59.054313
2017-10-05T15:08:44
2017-10-05T15:08:44
88,732,254
0
0
null
null
null
null
UTF-8
C
false
false
849
c
// Program to illustrate rotation of integers #include <stdio.h> int main (void) { unsigned int w1 = 0xabcdef00u, w2 = 0xffff1122u; unsigned int rotate (unsigned int value, int n); printf("%x\n", rotate (w1, 8)); printf("%x\n", rotate (w1, -16)); printf("%x\n", rotate (w2, 4)); printf("%x\n", rotate (w2, -2)); printf("%x\n", rotate (w1, 0)); printf("%x\n", rotate (w1, 44)); return 0; } // Function to rotate an unsigned int left or right unsigned int rotate (unsigned int value, int n) { unsigned int result, bits; // scale down the shift count to a defined range if (n > 0) n = n % 32; else n = -(-n % 32); if (n == 0) { result = value; } else if ( n > 0) { bits = value >> (32 - n); result = value << n | bits; } else { n = -n; bits = value << (32 - n); result = value >> n | bits; } return result; }
17c3554a0e5f96c50a0bc58e036e717366402412
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/mpv/video/out/opengl/extr_context_angle.c_angle_swap_buffers.c
7bd2ae27dc9b5bcdf7e449fce6264ee92f23ec6f
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
799
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ra_ctx {struct priv* priv; } ; struct priv {scalar_t__ dxgi_swapchain; } ; /* Variables and functions */ int /*<<< orphan*/ d3d11_swap_buffers (struct ra_ctx*) ; int /*<<< orphan*/ egl_swap_buffers (struct ra_ctx*) ; __attribute__((used)) static void angle_swap_buffers(struct ra_ctx *ctx) { struct priv *p = ctx->priv; if (p->dxgi_swapchain) d3d11_swap_buffers(ctx); else egl_swap_buffers(ctx); }
b6b7adc3ce32b5a8062cc2ae7dbdeab344d0b1b3
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/video/fbdev/extr_leo.c_leo_unmap_regs.c
1818cd781a46434dc349ff569f5ff0f51f6e133a
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,322
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct platform_device {int /*<<< orphan*/ * resource; } ; struct leo_par {scalar_t__ cursor; scalar_t__ lx_krn; scalar_t__ ld_ss1; scalar_t__ ld_ss0; scalar_t__ lc_ss0_usr; } ; struct leo_cursor {int dummy; } ; struct fb_info {scalar_t__ screen_base; } ; /* Variables and functions */ int /*<<< orphan*/ of_iounmap (int /*<<< orphan*/ *,scalar_t__,int) ; __attribute__((used)) static void leo_unmap_regs(struct platform_device *op, struct fb_info *info, struct leo_par *par) { if (par->lc_ss0_usr) of_iounmap(&op->resource[0], par->lc_ss0_usr, 0x1000); if (par->ld_ss0) of_iounmap(&op->resource[0], par->ld_ss0, 0x1000); if (par->ld_ss1) of_iounmap(&op->resource[0], par->ld_ss1, 0x1000); if (par->lx_krn) of_iounmap(&op->resource[0], par->lx_krn, 0x1000); if (par->cursor) of_iounmap(&op->resource[0], par->cursor, sizeof(struct leo_cursor)); if (info->screen_base) of_iounmap(&op->resource[0], info->screen_base, 0x800000); }
dbf16474a120ed17d54c179cf4c524424f6f637e
03b60dde2f22afe5bb7752558c0cfa20c4f251c2
/third-party/LUFA100513/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h
2e5f1caeef665e9f69400adb13107c52d2a4ee44
[ "CC0-1.0" ]
permissive
CrashSerious/dump-ninja
241e8f20c74eed7401e028bdc20eceb0bcc7110f
36e8e4a7625bdc956582a3bf30972dabe229e606
refs/heads/master
2020-05-16T21:11:13.447711
2012-01-14T16:19:41
2012-01-14T16:19:41
3,175,915
2
0
null
null
null
null
UTF-8
C
false
false
2,801
h
/* LUFA Library Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) 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 the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim 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, 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. */ /** \file * * Header file for KeyboardHost.c. */ #ifndef _KEYBOARD_HOST_H_ #define _KEYBOARD_HOST_H_ /* Includes: */ #include <avr/io.h> #include <avr/wdt.h> #include <avr/pgmspace.h> #include <avr/power.h> #include <avr/interrupt.h> #include <stdio.h> #include <LUFA/Version.h> #include <LUFA/Drivers/Misc/TerminalCodes.h> #include <LUFA/Drivers/Peripheral/SerialStream.h> #include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/Class/HID.h> /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ #define LEDMASK_USB_NOTREADY LEDS_LED1 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) /* Function Prototypes: */ void SetupHardware(void); void EVENT_USB_Host_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_DeviceAttached(void); void EVENT_USB_Host_DeviceUnattached(void); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationComplete(void); #endif
[ "root@AVRDev.(none)" ]
root@AVRDev.(none)
3fc434589591683f4ec7e04e48fd991cbc79228f
01a4e429aeed06d87a74960818115ce2f534a462
/apps/i2c_fail_safe_bootloader/host_app_nvm/firmware/src/config/sam_e54_xpro/peripheral/nvic/plib_nvic.c
29b31940be2c2230bf6ce551f98c4aebc6883f2f
[ "ISC", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jmaya371/Boot-i2c
de7457db5946f3688c160bdd737be9c87a5360a6
1aa53edf577ac6b0d1096c753bd11997c79a6c89
refs/heads/master
2023-03-07T13:31:04.998810
2020-11-30T23:19:56
2020-11-30T23:19:56
340,567,769
0
0
null
null
null
null
UTF-8
C
false
false
2,795
c
/******************************************************************************* NVIC PLIB Implementation Company: Microchip Technology Inc. File Name: plib_nvic.c Summary: NVIC PLIB Source File Description: None *******************************************************************************/ /******************************************************************************* * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to comply with third party license terms applicable to your * use of third party software (including open source software) that may * accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A * PARTICULAR PURPOSE. * * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. *******************************************************************************/ #include "device.h" #include "plib_nvic.h" // ***************************************************************************** // ***************************************************************************** // Section: NVIC Implementation // ***************************************************************************** // ***************************************************************************** void NVIC_Initialize( void ) { /* Priority 0 to 7 and no sub-priority. 0 is the highest priority */ NVIC_SetPriorityGrouping( 0x04 ); /* Enable NVIC Controller */ __DMB(); __enable_irq(); /* Enable the interrupt sources and configure the priorities as configured * from within the "Interrupt Manager" of MHC. */ NVIC_SetPriority(PAC_IRQn, 7); NVIC_EnableIRQ(PAC_IRQn); NVIC_SetPriority(SERCOM7_0_IRQn, 7); NVIC_EnableIRQ(SERCOM7_0_IRQn); NVIC_SetPriority(SERCOM7_1_IRQn, 7); NVIC_EnableIRQ(SERCOM7_1_IRQn); NVIC_SetPriority(SERCOM7_2_IRQn, 7); NVIC_EnableIRQ(SERCOM7_2_IRQn); NVIC_SetPriority(SERCOM7_OTHER_IRQn, 7); NVIC_EnableIRQ(SERCOM7_OTHER_IRQn); return; }
6695fd12e433549f310e0567b53702efce2f6a98
c7be5b45ee13d3f2bad32902f8602ee00dff13c0
/numeric/AKWF_0487.h
5ff63a51334301bf54aa304b855dc53892d430c9
[]
no_license
DatanoiseTV/AKWF_WaveForms_1024
d38ed856416b093d3b0c0b7ef8203cd3fdf20f20
54c9d55511f007feacfac3d437e0eb1d1f214d5e
refs/heads/master
2021-01-19T22:01:48.646095
2014-07-08T12:34:35
2014-07-08T12:34:35
21,574,675
3
1
null
null
null
null
UTF-8
C
false
false
7,406
h
// Converted by AKWF2Teensy from AKWF_0487.wav. // AKWF2Teensy - Beerware by Datanoise.net. const int16_t AKWF_0487[1025] = { 217, 639, 1062, 1485, 1908, 2328, 2748, 3164, 3579, 3985, 4389, 4788, 5181, 5566, 5945, 6316, 6679, 7031, 7376, 7711, 8036, 8350, 8653, 8945, 9223, 9491, 9746, 9988, 10217, 10432, 10633, 10824, 10999, 11160, 11306, 11440, 11560, 11665, 11757, 11834, 11898, 11947, 11984, 12007, 12017, 12014, 11997, 11969, 11928, 11876, 11812, 11736, 11650, 11554, 11448, 11331, 11207, 11073, 10932, 10782, 10625, 10462, 10292, 10119, 9938, 9752, 9563, 9373, 9178, 8981, 8783, 8584, 8385, 8183, 7984, 7785, 7588, 7394, 7204, 7016, 6830, 6650, 6476, 6307, 6140, 5984, 5833, 5689, 5552, 5425, 5305, 5194, 5091, 4998, 4916, 4841, 4779, 4726, 4683, 4651, 4633, 4623, 4626, 4638, 4662, 4696, 4745, 4805, 4875, 4955, 5049, 5155, 5268, 5396, 5535, 5682, 5839, 6009, 6189, 6376, 6575, 6784, 7001, 7224, 7459, 7700, 7948, 8204, 8470, 8740, 9012, 9294, 9582, 9871, 10165, 10468, 10770, 11071, 11380, 11694, 12000, 12312, 12630, 12943, 13248, 13564, 13881, 14181, 14483, 14803, 15100, 15376, 15690, 16006, 16228, 16494, 16970, 17094, 15644, 12023, 7066, 2125, -2226, -6130, -9626,-12487,-14631,-16165,-17125, -17522,-17482,-17169,-16679,-16121,-15642,-15348,-15281,-15490,-16012, -16822,-17870,-19113,-20490,-21909,-23293,-24583,-25716,-26636,-27319, -27762,-27960,-27932,-27719,-27362,-26894,-26370,-25837,-25327,-24866, -24479,-24175,-23945,-23783,-23674,-23591,-23504,-23391,-23226,-22985, -22650,-22217,-21676,-21027,-20280,-19453,-18554,-17603,-16620,-15623, -14626,-13640,-12680,-11749,-10846, -9972, -9126, -8293, -7469, -6647, -5818, -4973, -4108, -3220, -2310, -1375, -423, 544, 1517, 2491, 3455, 4404, 5330, 6228, 7092, 7921, 8710, 9460, 10176, 10853, 11497, 12112, 12699, 13260, 13796, 14310, 14801, 15271, 15716, 16137, 16531, 16892, 17222, 17518, 17774, 17991, 18169, 18304, 18398, 18451, 18464, 18438, 18372, 18273, 18141, 17975, 17778, 17555, 17302, 17024, 16720, 16389, 16033, 15653, 15248, 14819, 14365, 13888, 13388, 12866, 12323, 11761, 11181, 10584, 9973, 9348, 8713, 8071, 7421, 6765, 6104, 5442, 4781, 4118, 3456, 2798, 2144, 1495, 852, 217, -410, -1030, -1638, -2233, -2815, -3384, -3940, -4476, -4994, -5493, -5972, -6431, -6868, -7281, -7669, -8034, -8372, -8686, -8973, -9234, -9469, -9677, -9857,-10010,-10134,-10233,-10301,-10341,-10355,-10340, -10297,-10226,-10128,-10003, -9848, -9670, -9464, -9231, -8974, -8692, -8388, -8059, -7708, -7334, -6940, -6526, -6094, -5641, -5174, -4690, -4190, -3676, -3148, -2608, -2058, -1497, -927, -349, 237, 825, 1421, 2018, 2620, 3223, 3825, 4425, 5023, 5618, 6207, 6792, 7369, 7940, 8499, 9051, 9593, 10122, 10639, 11141, 11630, 12104, 12561, 13003, 13426, 13833, 14220, 14586, 14935, 15262, 15569, 15855, 16119, 16361, 16581, 16778, 16952, 17104, 17233, 17339, 17421, 17480, 17517, 17531, 17522, 17491, 17438, 17363, 17267, 17148, 17010, 16851, 16672, 16473, 16256, 16021, 15769, 15500, 15215, 14912, 14597, 14269, 13926, 13569, 13203, 12826, 12438, 12042, 11637, 11227, 10809, 10386, 9958, 9528, 9094, 8658, 8223, 7787, 7351, 6918, 6488, 6063, 5641, 5224, 4815, 4412, 4017, 3630, 3254, 2888, 2532, 2188, 1855, 1535, 1230, 938, 661, 397, 151, -79, -293, -490, -672, -835, -981, -1110, -1220, -1312, -1385, -1441, -1477, -1496, -1497, -1479, -1444, -1389, -1317, -1228, -1122, -998, -857, -701, -527, -338, -135, 82, 316, 562, 822, 1095, 1378, 1674, 1981, 2298, 2624, 2960, 3304, 3656, 4013, 4378, 4745, 5119, 5498, 5879, 6263, 6647, 7033, 7419, 7804, 8188, 8569, 8948, 9325, 9697, 10063, 10425, 10781, 11128, 11471, 11804, 12128, 12444, 12749, 13045, 13329, 13603, 13865, 14116, 14353, 14577, 14790, 14987, 15172, 15344, 15500, 15642, 15768, 15881, 15979, 16062, 16130, 16184, 16221, 16243, 16253, 16247, 16226, 16190, 16141, 16077, 15999, 15908, 15804, 15686, 15556, 15414, 15260, 15093, 14916, 14729, 14531, 14325, 14108, 13883, 13648, 13407, 13160, 12905, 12646, 12378, 12107, 11833, 11554, 11272, 10988, 10702, 10416, 10127, 9839, 9551, 9266, 8982, 8698, 8418, 8143, 7872, 7605, 7343, 7085, 6834, 6589, 6352, 6121, 5900, 5687, 5481, 5284, 5097, 4921, 4754, 4597, 4452, 4316, 4191, 4078, 3978, 3886, 3807, 3742, 3687, 3644, 3614, 3596, 3589, 3593, 3610, 3639, 3679, 3731, 3796, 3870, 3955, 4051, 4158, 4274, 4402, 4542, 4687, 4840, 5006, 5179, 5359, 5547, 5744, 5944, 6151, 6367, 6589, 6811, 7039, 7277, 7514, 7750, 7995, 8245, 8488, 8733, 8989, 9239, 9480, 9732, 9987, 10224, 10463, 10720, 10954, 11166, 11419, 11672, 11832, 12036, 12441, 12508, 11059, 7514, 2679, -2141, -6390,-10211,-13634,-16444,-18568, -20100,-21080,-21516,-21528,-21280,-20863,-20379,-19971,-19742,-19733, -19990,-20548,-21385,-22451,-23707,-25091,-26516,-27906,-29209,-30358, -31299,-32016,-32501,-32750,-32767,-32630,-32342,-31948,-31500,-31041, -30607,-30219,-29901,-29664,-29502,-29400,-29352,-29326,-29298,-29245, -29142,-28965,-28697,-28333,-27864,-27293,-26628,-25881,-25065,-24200, -23304,-22393,-21480,-20582,-19707,-18857,-18035,-17241,-16470,-15715, -14966,-14218,-13464,-12693,-11902,-11091,-10252, -9392, -8515, -7623, -6721, -5820, -4928, -4052, -3193, -2363, -1565, -801, -74, 617, 1274, 1897, 2489, 3050, 3587, 4099, 4589, 5056, 5504, 5932, 6337, 6717, 7073, 7398, 7694, 7956, 8183, 8371, 8521, 8633, 8705, 8736, 8730, 8686, 8607, 8494, 8348, 8173, 7968, 7735, 7476, 7193, 6884, 6551, 6193, 5812, 5407, 4980, 4530, 4057, 3561, 3045, 2510, 1955, 1383, 794, 193, -420, -1046, -1679, -2320, -2963, -3611, -4263, -4915, -5566, -6215, -6861, -7504, -8143, -8775, -9401,-10019,-10628,-11227,-11817,-12391,-12953,-13500,-14031, -14544,-15037,-15513,-15970,-16404,-16815,-17204,-17568,-17909,-18225, -18515,-18782,-19022,-19234,-19423,-19581,-19716,-19824,-19904,-19956, -19982,-19980,-19952,-19897,-19815,-19705,-19569,-19408,-19221,-19009, -18771,-18511,-18226,-17920,-17591,-17240,-16871,-16480,-16071,-15644, -15201,-14741,-14265,-13774,-13273,-12758,-12232,-11693,-11148,-10594, -10032, -9466, -8895, -8317, -7739, -7159, -6578, -5998, -5419, -4843, -4272, -3704, -3142, -2587, -2041, -1504, -975, -457, 49, 541, 1021, 1489, 1940, 2377, 2797, 3201, 3587, 3956, 4307, 4638, 4949, 5240, 5510, 5761, 5991, 6201, 6388, 6553, 6696, 6818, 6919, 6999, 7055, 7091, 7106, 7099, 7073, 7025, 6956, 6867, 6760, 6632, 6485, 6321, 6140, 5940, 5724, 5493, 5247, 4985, 4709, 4421, 4120, 3807, 3483, 3149, 2807, 2455, 2097, 1731, 1360, 984, 604, 218, -168, -554, -941, -1329, -1716, -2102, -2483, -2862, -3235, -3603, -3965, -4320, -4668, -5005, -5335, -5656, -5964, -6262, -6548, -6822, -7081, -7328, -7560, -7779, -7983, -8169, -8341, -8497, -8636, -8757, -8861, -8949, -9019, -9071, -9104, -9121, -9121, -9102, -9063, -9007, -8936, -8846, -8737, -8613, -8471, -8312, -8137, -7945, -7738, -7515, -7277, -7026, -6759, -6479, -6186, -5881, -5562, -5233, -4895, -4545, -4185, -3816, -3439, -3053, -2662, -2265, -1862, -1452, -1039, -623, -204, 217 };
8f7d3e44857ac33ebee1e2fa253a778f81c03a05
3c883e1084f0a61e558c2d210bb1b4ae8a5e6a06
/third_party/nvxs-1.0.2/CLAPACK/SRC/cgeqlf.c
a489c9139f70bc8d25734fd728ecf6586899fe87
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "Python-2.0", "BSD-3-Clause" ]
permissive
nya3jp/python-animeface
7e48aa333c9f365a80acdf43e5d516edc8d0b189
15caf8b1ca29847f0dceb54e4b91c77726c4111c
refs/heads/main
2022-04-29T20:17:01.198810
2022-04-04T10:17:59
2022-04-04T10:17:59
10,998,381
150
14
Apache-2.0
2022-04-03T07:18:40
2013-06-27T14:06:08
C
UTF-8
C
false
false
7,291
c
#include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static integer c__1 = 1; static integer c_n1 = -1; static integer c__3 = 3; static integer c__2 = 2; /* Subroutine */ int cgeqlf_(integer *m, integer *n, complex *a, integer *lda, complex *tau, complex *work, integer *lwork, integer *info) { /* System generated locals */ integer a_dim1, a_offset, i__1, i__2, i__3, i__4; /* Local variables */ integer i__, k, ib, nb, ki, kk, mu, nu, nx, iws, nbmin, iinfo; extern /* Subroutine */ int cgeql2_(integer *, integer *, complex *, integer *, complex *, complex *, integer *), clarfb_(char *, char *, char *, char *, integer *, integer *, integer *, complex *, integer *, complex *, integer *, complex *, integer *, complex *, integer *), clarft_(char *, char * , integer *, integer *, complex *, integer *, complex *, complex * , integer *), xerbla_(char *, integer *); extern integer ilaenv_(integer *, char *, char *, integer *, integer *, integer *, integer *); integer ldwork, lwkopt; logical lquery; /* -- LAPACK routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* CGEQLF computes a QL factorization of a complex M-by-N matrix A: */ /* A = Q * L. */ /* Arguments */ /* ========= */ /* M (input) INTEGER */ /* The number of rows of the matrix A. M >= 0. */ /* N (input) INTEGER */ /* The number of columns of the matrix A. N >= 0. */ /* A (input/output) COMPLEX array, dimension (LDA,N) */ /* On entry, the M-by-N matrix A. */ /* On exit, */ /* if m >= n, the lower triangle of the subarray */ /* A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L; */ /* if m <= n, the elements on and below the (n-m)-th */ /* superdiagonal contain the M-by-N lower trapezoidal matrix L; */ /* the remaining elements, with the array TAU, represent the */ /* unitary matrix Q as a product of elementary reflectors */ /* (see Further Details). */ /* LDA (input) INTEGER */ /* The leading dimension of the array A. LDA >= max(1,M). */ /* TAU (output) COMPLEX array, dimension (min(M,N)) */ /* The scalar factors of the elementary reflectors (see Further */ /* Details). */ /* WORK (workspace/output) COMPLEX array, dimension (MAX(1,LWORK)) */ /* On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */ /* LWORK (input) INTEGER */ /* The dimension of the array WORK. LWORK >= max(1,N). */ /* For optimum performance LWORK >= N*NB, where NB is */ /* the optimal blocksize. */ /* If LWORK = -1, then a workspace query is assumed; the routine */ /* only calculates the optimal size of the WORK array, returns */ /* this value as the first entry of the WORK array, and no error */ /* message related to LWORK is issued by XERBLA. */ /* INFO (output) INTEGER */ /* = 0: successful exit */ /* < 0: if INFO = -i, the i-th argument had an illegal value */ /* Further Details */ /* =============== */ /* The matrix Q is represented as a product of elementary reflectors */ /* Q = H(k) . . . H(2) H(1), where k = min(m,n). */ /* Each H(i) has the form */ /* H(i) = I - tau * v * v' */ /* where tau is a complex scalar, and v is a complex vector with */ /* v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in */ /* A(1:m-k+i-1,n-k+i), and tau in TAU(i). */ /* ===================================================================== */ /* .. Local Scalars .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. Executable Statements .. */ /* Test the input arguments */ /* Parameter adjustments */ a_dim1 = *lda; a_offset = 1 + a_dim1; a -= a_offset; --tau; --work; /* Function Body */ *info = 0; lquery = *lwork == -1; if (*m < 0) { *info = -1; } else if (*n < 0) { *info = -2; } else if (*lda < max(1,*m)) { *info = -4; } if (*info == 0) { k = min(*m,*n); if (k == 0) { lwkopt = 1; } else { nb = ilaenv_(&c__1, "CGEQLF", " ", m, n, &c_n1, &c_n1); lwkopt = *n * nb; } work[1].r = (real) lwkopt, work[1].i = 0.f; if (*lwork < max(1,*n) && ! lquery) { *info = -7; } } if (*info != 0) { i__1 = -(*info); xerbla_("CGEQLF", &i__1); return 0; } else if (lquery) { return 0; } /* Quick return if possible */ if (k == 0) { return 0; } nbmin = 2; nx = 1; iws = *n; if (nb > 1 && nb < k) { /* Determine when to cross over from blocked to unblocked code. */ /* Computing MAX */ i__1 = 0, i__2 = ilaenv_(&c__3, "CGEQLF", " ", m, n, &c_n1, &c_n1); nx = max(i__1,i__2); if (nx < k) { /* Determine if workspace is large enough for blocked code. */ ldwork = *n; iws = ldwork * nb; if (*lwork < iws) { /* Not enough workspace to use optimal NB: reduce NB and */ /* determine the minimum value of NB. */ nb = *lwork / ldwork; /* Computing MAX */ i__1 = 2, i__2 = ilaenv_(&c__2, "CGEQLF", " ", m, n, &c_n1, & c_n1); nbmin = max(i__1,i__2); } } } if (nb >= nbmin && nb < k && nx < k) { /* Use blocked code initially. */ /* The last kk columns are handled by the block method. */ ki = (k - nx - 1) / nb * nb; /* Computing MIN */ i__1 = k, i__2 = ki + nb; kk = min(i__1,i__2); i__1 = k - kk + 1; i__2 = -nb; for (i__ = k - kk + ki + 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { /* Computing MIN */ i__3 = k - i__ + 1; ib = min(i__3,nb); /* Compute the QL factorization of the current block */ /* A(1:m-k+i+ib-1,n-k+i:n-k+i+ib-1) */ i__3 = *m - k + i__ + ib - 1; cgeql2_(&i__3, &ib, &a[(*n - k + i__) * a_dim1 + 1], lda, &tau[ i__], &work[1], &iinfo); if (*n - k + i__ > 1) { /* Form the triangular factor of the block reflector */ /* H = H(i+ib-1) . . . H(i+1) H(i) */ i__3 = *m - k + i__ + ib - 1; clarft_("Backward", "Columnwise", &i__3, &ib, &a[(*n - k + i__) * a_dim1 + 1], lda, &tau[i__], &work[1], &ldwork); /* Apply H' to A(1:m-k+i+ib-1,1:n-k+i-1) from the left */ i__3 = *m - k + i__ + ib - 1; i__4 = *n - k + i__ - 1; clarfb_("Left", "Conjugate transpose", "Backward", "Columnwi" "se", &i__3, &i__4, &ib, &a[(*n - k + i__) * a_dim1 + 1], lda, &work[1], &ldwork, &a[a_offset], lda, &work[ ib + 1], &ldwork); } /* L10: */ } mu = *m - k + i__ + nb - 1; nu = *n - k + i__ + nb - 1; } else { mu = *m; nu = *n; } /* Use unblocked code to factor the last or only block */ if (mu > 0 && nu > 0) { cgeql2_(&mu, &nu, &a[a_offset], lda, &tau[1], &work[1], &iinfo); } work[1].r = (real) iws, work[1].i = 0.f; return 0; /* End of CGEQLF */ } /* cgeqlf_ */
b51b6941e732d4ac14e96952356b51db5c84da76
11ee3810ad0e2334e7f5af76867a7e8de98715d8
/C_06/ex03/ft_sort_params.c
057e442bab37cf955eb20db882479f9e75ae3fed
[]
no_license
ncliff-git/school21_pool_by_ncliff
38f1ee9c5fb2c1206224aaeabed2d647007c6513
a24601f66c0b74ca0d18fd2723c3767c3941ba29
refs/heads/master
2023-08-01T00:13:30.659337
2021-09-12T11:07:16
2021-09-12T11:07:16
286,780,068
0
0
null
null
null
null
UTF-8
C
false
false
1,630
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_sort_params.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncliff <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/07/30 15:50:20 by ncliff #+# #+# */ /* Updated: 2020/07/30 17:00:24 by ncliff ### ########.fr */ /* */ /* ************************************************************************** */ #include <unistd.h> int my_strcmp(char *s1, char *s2) { int i; int n; i = 0; n = 0; while (s1[i] != '\0' || s2[i] != '\0') { if (s1[i] - s2[i] != 0) { n = s1[i] - s2[i]; break ; } i++; } return (n); } void write_argv(int argc, char **argv) { int i; int n; n = 1; while (n < argc) { i = 0; while (argv[n][i]) { write(1, &argv[n][i], 1); i++; } n++; write(1, "\n", 1); } } int main(int argc, char *argv[]) { int i; int n; char *swap; i = 1; n = 1; while (i < argc) { while (n < argc - 1) { if (my_strcmp(argv[n], argv[n + 1]) > 0) { swap = argv[n]; argv[n] = argv[n + 1]; argv[n + 1] = swap; } n++; } n = 1; i++; } write_argv(argc, argv); }
2878bda288888805864cb36db64e70866f0a7919
05bd89f61623c130cfa36d3c5b0d1e8617005cc4
/0x13-more_singly_linked_lists/4-free_listint.c
088c22e608b1fa503a6faad2dc543d367959f63e
[]
no_license
stevenbrand99/holbertonschool-low_level_programming
bf832e2188f8fa832d08532a0dff161fd29554c3
c72c1e8716190251271f19ca9e42dcbf34f1dd89
refs/heads/master
2022-12-14T19:45:48.322233
2020-08-27T05:11:33
2020-08-27T05:11:33
null
0
0
null
null
null
null
UTF-8
C
false
false
212
c
#include "lists.h" /** * free_listint - free_listint * @head: head */ void free_listint(listint_t *head) { listint_t *store; while (head != NULL) { store = head->next; free(head); head = store; } }
e52ddabf597623c9e98ce120b844a50689b1fe89
2875e427d9931ab8cfe2e066e1568c3130fcc3f2
/Solaris_2.6/os_net/src_ws/usr/src/lib/libcurses/screen/compiler.h
4338dee919e150e1fb30fa90fd384608f5a12856
[]
no_license
legacy-codedigger/Solaris-2.6-Source-Code
3afaff70487fb96c864d55bd5845dd11c6c5c871
60a0b3093caa7d84e63dd891a23df0e8e720bf3d
refs/heads/master
2022-05-23T16:05:32.631954
2020-04-25T01:07:08
2020-04-25T01:07:08
258,658,903
1
1
null
null
null
null
UTF-8
C
false
false
5,179
h
/* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ #ident "@(#)compiler.h 1.5 92/07/14 SMI" /* SVr4.0 1.5 */ /********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** * This software is copyright (C) 1982 by Pavel Curtis * * * * Permission is granted to reproduce and distribute * * this file by any means so long as no fee is charged * * above a nominal handling fee and so long as this * * notice is always included in the copies. * * * * Other rights are reserved except as explicitly granted * * by written permission of the author. * * Pavel Curtis * * Computer Science Dept. * * 405 Upson Hall * * Cornell University * * Ithaca, NY 14853 * * * * Ph- (607) 256-4934 * * * * Pavel.Cornell@Udel-Relay (ARPAnet) * * decvax!cornell!pavel (UUCPnet) * *********************************************************************/ /* * compiler.h - Global variables and structures for the terminfo * compiler. * * $Header: RCS/compiler.v Revision 2.1 82/10/25 14:46:04 pavel Exp$ * * $Log: RCS/compiler.v $ Revision 2.1 82/10/25 14:46:04 pavel Added Copyright Notice Revision 2.0 82/10/24 15:17:20 pavel Beta-one Test Release Revision 1.3 82/08/23 22:30:09 pavel The REAL Alpha-one Release Version Revision 1.2 82/08/19 19:10:10 pavel Alpha Test Release One Revision 1.1 82/08/12 18:38:11 pavel Initial revision * */ #include <stdio.h> #include <signal.h> /* use this file to determine if this is SVR4.0 system */ #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef EXTERN /* for machines w/o multiple externs */ # define EXTERN extern #endif /* EXTERN */ #define SINGLE /* only one terminal (actually none) */ extern char *destination; /* destination directory for object files */ EXTERN long start_time; /* time at start of compilation */ extern long time(); EXTERN int curr_line; /* current line # in input */ EXTERN long curr_file_pos; /* file offset of current line */ EXTERN int debug_level; /* level of debugging output */ #define DEBUG(level, fmt, a1) \ if (debug_level >= level)\ fprintf(stderr, fmt, a1); /* * These are the types of tokens returned by the scanner. * The first three are also used in the hash table of capability * names. The scanner returns one of these values after loading * the specifics into the global structure curr_token. * */ #define BOOLEAN 0 /* Boolean capability */ #define NUMBER 1 /* Numeric capability */ #define STRING 2 /* String-valued capability */ #define CANCEL 3 /* Capability to be cancelled in following tc's */ #define NAMES 4 /* The names for a terminal type */ #define MAXBOOLS 64 /* Maximum # of boolean caps we can handle */ #define MAXNUMS 64 /* Maximum # of numeric caps we can handle */ #define MAXSTRINGS 512 /* Maximum # of string caps we can handle */ /* * The global structure in which the specific parts of a * scanned token are returned. * */ struct token { char *tk_name; /* name of capability */ int tk_valnumber; /* value of capability (if a number) */ char *tk_valstring; /* value of capability (if a string) */ }; EXTERN struct token curr_token; /* * The file comp_captab.c contains an array of these structures, * one per possible capability. These are then made into a hash * table array of the same structures for use by the parser. * */ struct name_table_entry { struct name_table_entry *nte_link; char *nte_name; /* name to hash on */ int nte_type; /* BOOLEAN, NUMBER or STRING */ short nte_index; /* index of associated variable in its array */ }; extern struct name_table_entry cap_table[]; extern struct name_table_entry *cap_hash_table[]; extern int Captabsize; extern int Hashtabsize; extern int BoolCount; extern int NumCount; extern int StrCount; #define NOTFOUND ((struct name_table_entry *) 0) /* * Function types * */ struct name_table_entry *find_entry(); /* look up entry in hash table */ int next_char(); int trans_string(); #ifdef SIGSTOP /* SVR4.0 and beyond */ #define SRCDIR "/usr/share/lib/terminfo" #else #define SRCDIR "/usr/lib/terminfo" #endif
a04001b2b15aae24f19eb13721a0624dd761f563
5838cf8f133a62df151ed12a5f928a43c11772ed
/NT/com/netfx/src/clr/toolbox/tlbimp/tlbimpcode/__file__.h
0b2942c6ac8250263661b975b63378a8cd971847
[]
no_license
proaholic/Win2K3
e5e17b2262f8a2e9590d3fd7a201da19771eb132
572f0250d5825e7b80920b6610c22c5b9baaa3aa
refs/heads/master
2023-07-09T06:15:54.474432
2021-08-11T09:09:14
2021-08-11T09:09:14
null
0
0
null
null
null
null
UTF-8
C
false
false
444
h
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== #ifdef _DEBUG #define VER_FILEFLAGS VS_FF_DEBUG #else #define VER_FILEFLAGS VS_FF_SPECIALBUILD #endif #define VER_FILETYPE VFT_DLL #define VER_INTERNALNAME_STR "TLBIMPCODE.DLL" #define VER_FILEDESCRIPTION_STR "Microsoft Type Library to .NET Assembly Converter Implementation\0" #define VER_ORIGFILENAME_STR "TlbImpCode.dll\0"
ee7c28d552e74a466873e4e53c9d7331f337dd1b
ad0f70df9a874f388515ca5263a3e35c250c82c6
/lab2-2_1/lab2-2_1.c
97819943fe27e785c5c1c628bb1293be8e076ec3
[]
no_license
JJuOn/2019-01-iotsw
fdf131392fe84db0355db1c96e9bd1425de241aa
885c5fca43f4fc40efedf03fd9936cc855f3807d
refs/heads/master
2020-05-17T22:43:26.121868
2019-06-21T04:30:55
2019-06-21T04:30:55
184,009,223
1
0
null
null
null
null
UTF-8
C
false
false
410
c
#include <stdio.h> #include <wiringPi.h> #define LED_ON 1 #define LED_OFF 0 const int Led[16]={4,17,18,27,22,23,24,25,6,12,13,16,19,20,26,21}; int main() { int i; if(wiringPiSetupGpio()==-1) return 1; for(i=0;i<16;i++) { pinMode(Led[i],OUTPUT); digitalWrite(Led[i],LED_OFF); } while(1) { digitalWrite(Led[0],LED_ON); delay(500); digitalWrite(Led[0],LED_OFF); delay(500); } return 0; }
22eb5565d4e4bd60d5774f3ede7dddda4fc0e0de
21b34921c86f311eb99e6d6af5d72744b2d9ba73
/buffer.h
969c5d8678c5bcf8aaa73f2b0511f86330ebec04
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain" ]
permissive
io7m/coreland-corelib
39d1aef2a16b858101df1b743e9a67681fa42f8b
f0c27f147c9757980de95189ff4435dae7d13dd3
refs/heads/master
2020-04-09T08:10:15.939615
2009-10-23T04:24:55
2009-10-23T04:24:55
null
0
0
null
null
null
null
UTF-8
C
false
false
1,390
h
#ifndef CORELIB_BUFFER_H #define CORELIB_BUFFER_H #define BUFFER_OUTSIZE 8192 #define BUFFER_INSIZE 8192 #define BUFFER_ZERO {0,0,0,0,0} struct buffer { char *buf; unsigned long pos; unsigned long size; int fd; long (*op)(int, char *, unsigned long); }; typedef long (*buffer_op)(int, char *, unsigned long); #define buffer_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (buffer_op)(op) } void buffer_init(struct buffer *, long (*)(int, char *, unsigned long), int, char *, unsigned long); long buffer_get(struct buffer *, char *, unsigned long); long buffer_feed(struct buffer *); char *buffer_peek(struct buffer *); void buffer_seek(struct buffer *, unsigned long); long buffer_flush(struct buffer *); int buffer_put(struct buffer *, const char *, unsigned long); int buffer_puts(struct buffer *, const char *); int buffer_putflush(struct buffer *, const char *, unsigned long); int buffer_putsflush(struct buffer *, const char *); int buffer_copy(struct buffer *, struct buffer *); #define buffer_PEEK(s) ( (s)->buf + (s)->size ) #define buffer_SEEK(s,len) ( ( (s)->pos -= (len) ) , ( (s)->size += (len) ) ) #define buffer_GETC(s,c) \ ( ((s)->pos > 0) \ ? ( *(c) = (s)->buf[(s)->size], buffer_SEEK((s),1), 1 ) \ : buffer_get((s),(c),1) \ ) extern struct buffer *buffer0; extern struct buffer *buffer1; extern struct buffer *buffer2; #endif
[ "markzero@6e7d7e42-f3d6-da11-80d8-00d0b73f4485" ]
markzero@6e7d7e42-f3d6-da11-80d8-00d0b73f4485
3e541acf3fcb22613f9a07de10e7d837ae8fa561
c2cedcf36667730f558ab354bea4505b616c90d2
/players/astaroth/nk1.c
b82d466121b5983c9ef1dd3f22cee39b5e60f3e1
[]
no_license
wugouzi/Nirvlp312mudlib
965ed876c7080ab00e28c5d8cd5ea9fc9e46258f
616cad7472279cc97c9693f893940f5336916ff8
refs/heads/master
2023-03-16T03:45:05.510851
2017-09-21T17:05:00
2017-09-21T17:05:00
null
0
0
null
null
null
null
UTF-8
C
false
false
361
c
inherit "obj/monster"; reset(arg) { if(!arg) ::reset(arg); set_name("johnathan"); set_level(1); set_alias("newkid"); set_race("man"); set_hp(15); set_aggressive(1); set_al(-1000); set_short("Johnathan"); set_long("This is an evil new kid.\n" + "He belongs on the chopping block.\n" + ""); set_wc(5); set_ac(3); }
b2625c08e5d4c9ec306611b16c9f398e5aab39c2
b945b2fac11f237a49de33af1b8fa02ba3ed1814
/vds/vdaim/test2/main.c
c921ffdcd1071a280d8453dbbee5267b94659dc6
[]
no_license
ahundiak/isdp
b94f56f7a7b02b806209ff06da8e22497f6e1386
07572eb18f07cbf762505ef34e471fa47c102df4
refs/heads/master
2021-03-12T20:02:34.067237
2011-12-16T20:03:20
2011-12-16T20:03:20
37,136,442
0
0
null
null
null
null
UTF-8
C
false
false
4,345
c
#include <stdio.h> #include <string.h> #include <glib.h> #include <gio/gio.h> extern test_ftp(); #define POSTMAN_MAGICNO 1234567876 /* good buffer identifier prefix */ #define FULL_BUFFER 1 /* needs packing buffer on CLIX */ #define LEAN_BUFFER 2 /* no mfail etc; saves packing space */ #define INIT_REQUEST 100 /* first dummy initialize request from clix */ #define SYNC_REQUEST 101 /* syncing packet while reading/writing */ #define CHUNKSIZE_INFO 102 /* chunksize information, back from server */ /* ------ Header Packet Structure -------- */ typedef struct header { int magicno; /* POSTMAN MAGIC NUM - check for valid packets */ int packettype; /* packet type - see #define constants */ int bytecount; /* bytecount of data buffer to follow separately */ } THeader; /* header packet is sent by itself, then data */ /* ------ Data Packet Structures -------- */ typedef union pmdatabuf { union fullbufTag /* postman buffer format */ { struct pmebufTag /* dm2 communication */ { int dstat; /* method function return code */ int mfail; /* method return code via argument */ char buf[1]; /* errmsg string (null-term), rest .. */ /* nonascii or null-terminated ascii data */ } pmebuf; struct postmanTag /* only postman<->clix communication */ { int request; /* see #defines */ int info; /* depends on request */ char buf[1]; /* not used */ } postman; } fullbuf; union leanbufTag /* lean buffer - no packing buffer needed */ { struct pmebufTag2 /* DM2 request from CLIX */ { char data[1]; /* nonascii or null-terminated ascii data */ } pmebuf; } leanbuf; } TPayload; int main(int argc, char *argv) { GSocketClient *client; GIOStream *conn; // GSocketConnection GOutputStream *connOut; GInputStream *connInn; const gchar *clientHostName; TPayload *payload; THeader header; gchar *buf; gssize bufLen; gssize count; // For gobject g_type_init(); test_ftp(); if (1) return 0; // Connect client = g_socket_client_new(); conn = (GIOStream *)g_socket_client_connect_to_host(client,"avd_aim_test",9083,NULL,NULL); g_assert(conn); g_tcp_connection_set_graceful_disconnect((GTcpConnection*)conn,TRUE); // Ask server for chunk info clientHostName = g_get_host_name(); bufLen = sizeof(TPayload) + strlen(clientHostName); header.magicno = POSTMAN_MAGICNO; header.packettype = FULL_BUFFER; header.bytecount = bufLen; buf = g_malloc0(bufLen + 1000); payload = (TPayload *)buf; payload->fullbuf.postman.request = INIT_REQUEST; memcpy(buf+sizeof(TPayload),clientHostName,strlen(clientHostName)); connOut = g_io_stream_get_output_stream(conn); connInn = g_io_stream_get_input_stream (conn); count = g_output_stream_write(connOut,&header,sizeof(THeader),NULL,NULL); g_assert_cmpint(sizeof(THeader),==,count); count = g_output_stream_write(connOut,buf,bufLen,NULL,NULL); g_assert_cmpint(bufLen,==,count); count = g_input_stream_read(connInn,&header,sizeof(THeader),NULL,NULL); g_assert_cmpint(sizeof(THeader),==,count); g_assert_cmpint(header.magicno, ==, POSTMAN_MAGICNO); g_assert_cmpint(header.packettype,==, FULL_BUFFER); g_assert_cmpint(header.bytecount, ==, 9); bufLen = header.bytecount; count = g_input_stream_read(connInn,buf,bufLen,NULL,NULL); g_assert_cmpint(bufLen,==,count); g_assert_cmpint(payload->fullbuf.postman.request,==,CHUNKSIZE_INFO); g_assert_cmpint(payload->fullbuf.postman.info, ==,99995); // Not just sure if this is just a hack or not but the serve sends a second message with status code count = g_input_stream_read(connInn,&header,sizeof(THeader),NULL,NULL); g_assert_cmpint(sizeof(THeader),==,count); count = g_input_stream_read(connInn,buf,bufLen,NULL,NULL); g_assert_cmpint(bufLen,==,count); g_assert_cmpint(payload->fullbuf.pmebuf.dstat,==,0); g_assert_cmpint(payload->fullbuf.pmebuf.mfail,==,0); // Try to read again, it will block, need to figure out how to break out // count = g_input_stream_read(connInn,&header,sizeof(THeader),NULL,NULL); // Close down g_io_stream_close(conn,NULL,NULL); // Free it g_object_unref(conn); g_object_unref(client); }
[ "ahundiak@e9faf64c-7e38-11de-a453-d5a50d962d30" ]
ahundiak@e9faf64c-7e38-11de-a453-d5a50d962d30
7a6936325243ed3e3fb6d0b331e4c6fb4797c8f8
4f1d319133a467466a99c5197b519f73fd73e1f1
/src/osd/sdl/dview.h
488aaa1c61833c18b0c7b6f847698d635ad75fc3
[]
no_license
AltimorTASDK/shmupmametgm
5da401800c7c435b1c3a5a927ba5bc15a6e056cd
2911e3cf43d04a3d1587a48a63352c42647cc9e6
refs/heads/master
2021-01-13T00:50:22.251435
2015-12-13T18:16:27
2015-12-13T18:16:27
47,025,375
3
3
null
2017-02-05T01:09:53
2015-11-28T13:55:58
C
UTF-8
C
false
false
1,332
h
#ifndef DVIEW_H #define DVIEW_H #include <gtk/gtk.h> #include "emu.h" #include "video.h" #include "osdepend.h" #include "debug/debugvw.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" GType dview_get_type(void); #define DVIEW_TYPE (dview_get_type()) #define DVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), DVIEW_TYPE, DView)) #define DVIEW_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST((obj), DVIEW, DViewClass)) #define IS_DVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), DVIEW_TYPE)) #define IS_DVIEW_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((obj), DVIEW_TYPE)) #define DVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), DVIEW_TYPE, DViewClass)) typedef struct _DViewClass DViewClass; typedef struct _DView DView; struct _DViewClass { GtkContainerClass parent_class; PangoFontDescription *fixedfont; int fixedfont_width, fixedfont_height; }; struct _DView { GtkContainer parent; GtkAdjustment *hadj, *vadj; GtkWidget *hscrollbar, *vscrollbar; int hsz, vsz; int hs, vs; int tr, tc; gchar *name; PangoLayout *playout; GdkGC *gc; debug_view *view; int dv_type; }; GtkWidget *dview_new(const gchar *widget_name, const gchar *string1, const gchar *string2, gint int1, gint int2); void dview_set_debug_view(DView *dv, running_machine *machine, int type); #endif
7e81e080c10c76f97aef06c0a42dbcf598b3d785
4045ca0933bbccd556c8cd251ecba512c8e1383d
/src/include/dare/dare_kvs_sm.h
575f5145386481c76cf628011021617bddc39a6e
[ "BSD-3-Clause-Open-MPI" ]
permissive
wnagchenghku/RDMA-PAXOS
64372cff3c1e658a7c33137f728e0ce8c301a6cd
9fd851b959800aadd8b74ccee61e9d4fc8b34b63
refs/heads/master
2020-05-29T14:04:52.502763
2019-06-07T04:52:49
2019-06-07T04:52:49
189,182,791
0
0
NOASSERTION
2019-05-29T08:24:44
2019-05-29T08:24:44
null
UTF-8
C
false
false
999
h
/** * DARE (Direct Access REplication) * * State machine implementation (KVS) * * Copyright (c) 2014-2015 ETH-Zurich. All rights reserved. * * Author(s): Marius Poke <[email protected]> * */ #ifndef DARE_KVS_SM_H #define DARE_KVS_SM_H #define __STDC_FORMAT_MACROS #include <inttypes.h> #include "./dare_sm.h" #define DEFAULT_KVS_SIZE 1024 #define KEY_SIZE 64 /* KVS commands */ #define KVS_PUT 1 #define KVS_GET 2 #define KVS_RM 3 /* KVS command */ struct kvs_cmd_t { uint8_t type; // read, write, delete char key[KEY_SIZE]; uint16_t len; uint8_t data[0]; }; typedef struct kvs_cmd_t kvs_cmd_t; struct kvs_blob_t { uint16_t len; void *data; }; typedef struct kvs_blob_t kvs_blob_t; struct kvs_entry_t { char key[KEY_SIZE]; kvs_blob_t blob; }; typedef struct kvs_entry_t kvs_entry_t; #endif /* DARE_KVS_SM_H */
0825592e53ba7046f2026b08e439232d380ebc0a
c14b295f793b0ea3cdfdfc185c3a4b5a382fb14e
/0x05-pointers_arrays_strings/0-main.c
9938daea095eba90e41bdd3e63f3e79db4cbb93f
[]
no_license
macoyulloa/holbertonschool-low_level_programming
2b87acc374e8d71a8f07eec15e20b4bff2bbe943
291a7290e2144eed0f0c877a8107b0e31d2a69a5
refs/heads/master
2020-04-21T09:02:19.247265
2019-08-29T23:48:08
2019-08-29T23:48:08
169,436,484
0
0
null
null
null
null
UTF-8
C
false
false
356
c
#include "holberton.h" #include <stdio.h> /** * main - check the code for Holberton School students. * * Return: Always 0. */ int main(void) { char s1[98] = "Hello "; char s2[] = "World!\n"; char *p; printf("%s\n", s1); printf("%s", s2); p = _strcat(s1, s2); printf("%s", s1); printf("%s", s2); printf("%s", p); return (0); }
834f348a38c3f412467849641d2d2a7d144d205c
02a087e8de0a7d0cfed9dba60e8cff5be4ae3be1
/Research_Bucket/Completed_Archived/ConcolicProcess/oracles/Bellon/bellon_benchmark/sourcecode/cook/src/cook/graph/run.h
b8e5449e85054e967c0f0e78f7289b476ca05e53
[]
no_license
dan7800/Research
7baf8d5afda9824dc5a53f55c3e73f9734e61d46
f68ea72c599f74e88dd44d85503cc672474ec12a
refs/heads/master
2021-01-23T09:50:47.744309
2018-09-01T14:56:01
2018-09-01T14:56:01
32,521,867
1
1
null
null
null
null
UTF-8
C
false
false
1,197
h
/* * cook - file construction tool * Copyright (C) 1997 Peter Miller; * 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; 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., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * * MANIFEST: interface definition for cook/graph/run.c */ #ifndef COOK_GRAPH_RUN_H #define COOK_GRAPH_RUN_H #include <graph/walk.h> struct graph_ty; /* existence */ struct graph_recipe_ty; /* existence */ graph_walk_status_ty graph_recipe_run _((struct graph_recipe_ty *, struct graph_ty *)); #endif /* COOK_GRAPH_RUN_H */
c4fc7f178872d84fa16efb7f9920ad174a396aa9
3ac819ce9d1ac47712238d91e77a47446841821b
/driver/retimer/nb7v904m.c
81fd5abc93be4e3fcde120563625204132869c39
[ "BSD-3-Clause" ]
permissive
platinasystems/chrome-ec
cd638b8f86076cb01e5048ca51a63e4adbfbac85
ce143d577fa85acae86ae372a7521d7def6c2391
refs/heads/master
2021-01-12T13:00:38.698345
2020-02-19T16:48:06
2020-02-27T14:35:48
69,767,954
1
0
null
null
null
null
UTF-8
C
false
false
3,492
c
/* Copyright 2020 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * * ON Semiconductor NB7V904M USB Type-C DisplayPort Alt Mode Redriver */ #include <stdbool.h> #include "common.h" #include "console.h" #include "ec_commands.h" #include "i2c.h" #include "nb7v904m.h" #include "usb_mux.h" #define CPRINTS(format, args...) cprints(CC_USB, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USB, format, ## args) static int nb7v904m_write(int port, int offset, int data) { return i2c_write8(usb_retimers[port].i2c_port, usb_retimers[port].i2c_addr_flags, offset, data); } static int nb7v904m_read(int port, int offset, int *regval) { return i2c_read8(usb_retimers[port].i2c_port, usb_retimers[port].i2c_addr_flags, offset, regval); } static int set_low_power_mode(int port, bool enable) { int regval; int rv; rv = nb7v904m_read(port, NB7V904M_REG_GEN_DEV_SETTINGS, &regval); if (rv) return rv; if (enable) regval |= NB7V904M_CHIP_EN; else regval &= ~NB7V904M_CHIP_EN; return nb7v904m_write(port, NB7V904M_REG_GEN_DEV_SETTINGS, regval); } static int nb7v904m_enter_low_power_mode(int port) { int rv = set_low_power_mode(port, 1); if (rv) CPRINTS("C%d: NB7V904M: Failed to enter low power mode!", port); return rv; } static int nb7v904m_init(int port) { int rv = set_low_power_mode(port, 0); if (rv) CPRINTS("C%d: NB7V904M: init failed!", port); return rv; } static int nb7v904m_set_mux(int port, mux_state_t mux_state) { int rv = EC_SUCCESS; int regval; int flipped = !!(mux_state & USB_PD_MUX_POLARITY_INVERTED); /* Turn off redriver if it's not needed at all. */ if (mux_state == USB_PD_MUX_NONE) return nb7v904m_enter_low_power_mode(port); rv = nb7v904m_init(port); if (rv) return rv; /* Clear operation mode field */ rv = nb7v904m_read(port, NB7V904M_REG_GEN_DEV_SETTINGS, &regval); if (rv) { CPRINTS("C%d %s: Failed to obtain dev settings!", port, __func__); return rv; } regval &= ~NB7V904M_OP_MODE_MASK; if (mux_state & USB_PD_MUX_USB_ENABLED) { /* USB with DP */ if (mux_state & USB_PD_MUX_DP_ENABLED) { if (flipped) regval |= NB7V904M_USB_DP_FLIPPED; else regval |= NB7V904M_USB_DP_NORMAL; } else { /* USB only */ regval |= NB7V904M_USB_ONLY; } } else if (mux_state & USB_PD_MUX_DP_ENABLED) { /* 4 lanes DP */ regval |= NB7V904M_DP_ONLY; } if (mux_state & USB_PD_MUX_DP_ENABLED) { /* Connect AUX */ rv = nb7v904m_write(port, NB7V904M_REG_AUX_CH_CTRL, flipped ? NB7V904M_AUX_CH_FLIPPED : NB7V904M_AUX_CH_NORMAL); /* Enable all channels for DP */ regval |= NB7V904M_CH_EN_MASK; } else { /* Disconnect AUX since it's not being used. */ rv = nb7v904m_write(port, NB7V904M_REG_AUX_CH_CTRL, NB7V904M_AUX_CH_HI_Z); /* Disable the unused channels to save power */ regval &= ~NB7V904M_CH_EN_MASK; if (flipped) { /* Only enable channels A & B */ regval |= NB7V904M_CH_A_EN | NB7V904M_CH_B_EN; } else { /* Only enable channels C & D */ regval |= NB7V904M_CH_C_EN | NB7V904M_CH_D_EN; } } rv |= nb7v904m_write(port, NB7V904M_REG_GEN_DEV_SETTINGS, regval); if (rv) CPRINTS("C%d: %s failed!", port, __func__); return rv; } const struct usb_retimer_driver nb7v904m_usb_redriver_drv = { .enter_low_power_mode = &nb7v904m_enter_low_power_mode, .init = &nb7v904m_init, .set = &nb7v904m_set_mux, };
f5c51e2a4bac01595de5cebdb3f46d6a3f423a98
2c78de0b151238b1c0c26e6a4d1a36c7fa09268c
/common/components/rtl/external/Embarcadero/DelphiBerlin/cpprtl/Source/startup/rawdll.c
987f7ed5397312653a3a174a65879a6d6b3b7f00
[]
no_license
bravesoftdz/realwork
05a3b308cef59bed8a9efda4212849c391b4b267
19b446ce8ad2adf82ab8ce7988bc003221accad2
refs/heads/master
2021-06-07T23:57:22.429896
2016-11-01T18:30:21
2016-11-01T18:30:21
null
0
0
null
null
null
null
UTF-8
C
false
false
443
c
/*-----------------------------------------------------------------------* * filename - rawdll.c * *-----------------------------------------------------------------------*/ /* * C/C++ Run Time Library - Version 24.0 * * Copyright (c) 1995, 2016 by Embarcadero Technologies, Inc. * All Rights Reserved. * */ /* $Revision: 23293 $ */ #include <ntbc.h> BOOL (WINAPI *_pRawDllMain)(HINSTANCE, DWORD, LPVOID);
db376c16e0d821c3c61a42b83b5a7ef7130b6e71
41d0aee2205d1d1d244faf6b72bae5b48d3839af
/kernel/base/include/los_base_pri.h
a43f073a33585280e12c3232407a7083781ec7e4
[ "BSD-3-Clause" ]
permissive
SunnyLy/kernel_liteos_a_note
75d2df014abce78e85722406331343832f74cec4
9c54aa38d2330b365e55e5feff1f808c3b6dba25
refs/heads/master
2023-08-19T13:15:21.905929
2021-10-22T09:26:15
2021-10-22T09:26:15
null
0
0
null
null
null
null
UTF-8
C
false
false
2,093
h
/* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 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. */ #ifndef _LOS_BASE_PRI_H #define _LOS_BASE_PRI_H #include "los_base.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ #define OS_GOTO_ERREND() do { \ goto LOS_ERREND; \ } while (0) #ifdef __cplusplus #if __cplusplus } #endif /* __cplusplus */ #endif /* __cplusplus */ #endif /* _LOS_BASE_PRI_H */
0184788893cc48dfd6c8f117c1b22420fafd3dbc
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/input/keyboard/extr_imx_keypad.c_imx_keypad_irq_handler.c
79547298deed6e0de85cf2822cd92de35ae7cf24
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,642
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct imx_keypad {int /*<<< orphan*/ check_matrix_timer; scalar_t__ stable_count; scalar_t__ enabled; scalar_t__ mmio_base; } ; typedef int /*<<< orphan*/ irqreturn_t ; /* Variables and functions */ int /*<<< orphan*/ IRQ_HANDLED ; unsigned short KBD_STAT_KDIE ; unsigned short KBD_STAT_KPKD ; unsigned short KBD_STAT_KPKR ; unsigned short KBD_STAT_KRIE ; scalar_t__ KPSR ; scalar_t__ jiffies ; int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ msecs_to_jiffies (int) ; unsigned short readw (scalar_t__) ; int /*<<< orphan*/ writew (unsigned short,scalar_t__) ; __attribute__((used)) static irqreturn_t imx_keypad_irq_handler(int irq, void *dev_id) { struct imx_keypad *keypad = dev_id; unsigned short reg_val; reg_val = readw(keypad->mmio_base + KPSR); /* Disable both interrupt types */ reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE); /* Clear interrupts status bits */ reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD; writew(reg_val, keypad->mmio_base + KPSR); if (keypad->enabled) { /* The matrix is supposed to be changed */ keypad->stable_count = 0; /* Schedule the scanning procedure near in the future */ mod_timer(&keypad->check_matrix_timer, jiffies + msecs_to_jiffies(2)); } return IRQ_HANDLED; }
8a2eeaaf22f040f7ff7ef70633a970bd89b12dfc
173eb435fef61582ea8b255fe5d1df9dc58f2abc
/slave_srio/se_main.c
8a27127ac123df82391597b161bdc0f2fb27b7c2
[]
no_license
Cai900205/test
6d9e8fe5c7193cdf1e75885d85bc92c67cdb8812
1f9db0fcaa4bdd4f8966e016649a99bb37614808
refs/heads/master
2020-12-25T17:27:05.718094
2016-08-22T13:15:20
2016-08-22T13:15:20
40,888,283
1
0
null
null
null
null
UTF-8
C
false
false
1,694
c
/************************************************************************* > File Name: main.c > Author: > Mail: > Created Time: Wed 12 Aug 2015 05:16:49 PM CST ************************************************************************/ #include "fvl_common.h" #include "fvl_srio.h" #define Buf_num 16 #define Buf_size 0x100000 #define Chan_num 4 #define Port_Num 2 #define Total_Buf_Size (Buf_num*Buf_size*Chan_num) static char channame[]="srio0-chan3"; int main(int argc, char **argv) { fvl_srio_init_param_t srio_init[Port_Num]; fvl_dma_pool_t *port_dma_wr[Port_Num]; fvl_read_rvl_t rlen; char data[Buf_size]; int rvl=0; uint8_t i=0; for(i=0;i<2;i++) { // srio_init[i].buf_num=Buf_num; // srio_init[i].buf_size=Buf_size; srio_init[i].chan_num=Chan_num; // srio_init[i].chan_size=Buf_num*Buf_size; srio_init[i].port_num=i; rvl = dma_pool_init(&port_dma_wr[i],Total_Buf_Size,Total_Buf_Size/2); if(rvl!=0) { FVL_LOG("port %d dma_pool_init failed!\n",i+1); return -errno; } srio_init[i].port_rd_buf=port_dma_wr[i]; rvl=fvl_srio_init(&srio_init[i]); if(rvl!=0) { FVL_LOG("srio init error!\n"); return -errno; } } int fd=0; // open one channel fd=fvl_srio_channel_open(channame); printf("###################fd:%d*****************\n",fd); sleep(3); // while(1) for(i=0;i<32;i++) { // i++; memset(data,i,Buf_size); rvl=fvl_srio_write(fd,data,Buf_size); if(rvl!=0) { printf("error!\n"); } } return 0; }
8f0694449339d464aa9309f5a872f652c51c147c
2bbbe579a904fdc6ec06ad6c94237c9d06c58018
/testsuites/kernel/sample/posix/pthread/full/It_posix_pthread_068.c
6ced64b9c5d1545f23b4b14a3eb814b41bb3d151
[ "BSD-3-Clause" ]
permissive
zuiaichi/kernel_liteos_a_note
98e622f2ee65ecb0ec987f234767bc5bfdf34262
547a4b3582581da3321c82b7e19114c165db0c94
refs/heads/master
2023-06-08T17:05:22.794654
2021-06-30T02:06:44
2021-06-30T02:06:44
null
0
0
null
null
null
null
UTF-8
C
false
false
3,896
c
/* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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 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. */ #include "It_posix_pthread.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ static VOID *PthreadF02(VOID *argument) { UINT32 ret; ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); ret = pthread_cancel(g_newTh); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); g_testCount++; ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result. EXIT: return NULL; } static VOID *PthreadF01(VOID *argument) { int oldstate; UINT32 ret; pthread_attr_t attr; g_testCount++; ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); ICUNIT_GOTO_EQUAL(oldstate, PTHREAD_CANCEL_DEFERRED, oldstate, EXIT); ret = pthread_attr_init(&attr); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); attr.inheritsched = PTHREAD_EXPLICIT_SCHED; attr.schedparam.sched_priority = 8; // 8, set priority. ret = pthread_create(&g_newTh2, &attr, PthreadF02, NULL); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); #if (LOSCFG_KERNEL_SMP == YES) while (g_testCount < 2) { // 2, delay until g_testCount is equal to 2. TestBusyTaskDelay(1); } TestBusyTaskDelay(1); #else g_testCount++; ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result. #endif EXIT: return NULL; } static UINT32 Testcase(VOID) { UINT32 ret; UINTPTR temp = 1; g_testCount = 0; ret = pthread_create(&g_newTh, NULL, PthreadF01, NULL); ICUNIT_ASSERT_EQUAL(ret, 0, ret); TestExtraTaskDelay(10); // 10, delay for Timing control. ret = pthread_join(g_newTh, (void *)&temp); ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp); ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, here assert the result. ret = pthread_join(g_newTh2, NULL); ICUNIT_ASSERT_EQUAL(ret, 0, ret); return PTHREAD_NO_ERROR; } VOID ItPosixPthread068(VOID) // IT_Layer_ModuleORFeature_No { TEST_ADD_CASE("ItPosixPthread068", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); } #ifdef __cplusplus #if __cplusplus } #endif /* __cpluscplus */ #endif /* __cpluscplus */
93c84d2a4a391b6280a8138e7f0e154e9379678c
ecf37088c1618092ee847cb3bc656fdcf851fc48
/Project/DemoKit/SrcCode/UIApp/UsbCommand/UsbCmdID.c
b1bb5f3a415ef086967e63bffca5950270856a69
[]
no_license
calvinqiu/mygithub
b2ce14f0f6f1d3057517c16f109347d88b4a096d
b16780a2b34ba8e00af39b0fd9ccb4dacf1a0eee
refs/heads/master
2021-05-13T21:55:39.951529
2018-01-08T02:39:35
2018-01-08T02:39:35
116,472,710
0
0
null
null
null
null
UTF-8
C
false
false
883
c
#include "UsbCmdID.h" #include "SysKer.h" #include "UsbCmdInt.h" #include "UsbCmdAPI.h" #include "PrjCfg.h" //#NT#2016/05/31#Ben Wang -begin //#NT#Add UVC multimedia function. #if(UVC_MULTIMEDIA_FUNC == ENABLE) #define PRI_USBCMD 10 #define STKSIZE_USBCMD 4096 #define STKSIZE_USBCMD_DOWNLOAD 2048 UINT32 USBCMDTSK_ID = 0; UINT32 USBCMDTSK2_ID = 0; UINT32 USBCMDDOWNLOADTSK_ID = 0; UINT32 FLG_ID_USBCMD = 0; UINT32 SEMID_USBCMD_1ST_COM = 0; void UsbCmd_InstallID(void) { OS_CONFIG_TASK(USBCMDTSK_ID, PRI_USBCMD, STKSIZE_USBCMD, UsbCmdTsk); OS_CONFIG_TASK(USBCMDTSK2_ID, PRI_USBCMD, STKSIZE_USBCMD, UsbCmdTsk2); OS_CONFIG_TASK(USBCMDDOWNLOADTSK_ID, PRI_USBCMD, STKSIZE_USBCMD_DOWNLOAD, UsbCmdDownloadTsk); OS_CONFIG_FLAG(FLG_ID_USBCMD); OS_CONFIG_SEMPHORE(SEMID_USBCMD_1ST_COM, 0, 1, 1); } #endif //#NT#2016/05/31#Ben Wang -end
d09caf25421535e604ce5e6da03014532a38b0bd
ac0936da6729df900b1a3eafe10dd53dcfa3104f
/extlibs/MCU/Examples/C8051F97x/Oscillators/Oscillator_CMOS/src/F970_Oscillator_CMOS.c
9fe0eb4327b7742a6fdb328c53e59c92afee88b0
[]
no_license
dania99/si1000-rf-beacon
272195996c0e491e4177ddac31114edb700fb1c1
ba772d789cde2935fd12e66f7765c6edf1408ce2
refs/heads/master
2022-01-05T04:39:43.174744
2019-05-13T16:59:48
2019-05-13T16:59:48
null
0
0
null
null
null
null
UTF-8
C
false
false
5,170
c
//----------------------------------------------------------------------------- // F97x_Oscillator_CMOS.c //----------------------------------------------------------------------------- // Copyright 2014 Silicon Laboratories, Inc. // http://developer.silabs.com/legal/version/v11/Silicon_Labs_Software_License_Agreement.txt // // Program Description: // // This program demonstrates how to configure the oscillator to use an // external CMOS clock. // // // How To Test: // ------------ // 1) Ensure shorting blocks are place on the following: // - J1: 3.3v <> VREG (Power) // - JP3: VDD <> VMCU // 2) Connect the USB Debug Adapter to H8. // 3) Place the VDD SELECT switch (SW1) in the VREG position and power the board. // 4) Compile and download code to the C8051F970-TB by selecting // Run -> Debug from the menus, // or clicking the Debug button in the quick menu, // or pressing F11. // 5) Run the code by selecting // Run -> Resume from the menus, // or clicking the Resume button in the quick menu, // or pressing F8. // 6) Measure the frequency output on P0.1 to be approximately 20 MHz. // // // Target: C8051F97x // Tool chain: Simplicity Studio / Keil C51 9.51 // Command Line: None // // // Release 1.0 // - Initial Revision (CM2/JL) // - 28 MAY 2014 //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #include <SI_C8051F970_Register_Enums.h> //----------------------------------------------------------------------------- // Global VARIABLES //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Function Prototypes //----------------------------------------------------------------------------- void OSCILLATOR_Init (void); void PORT_Init (void); //----------------------------------------------------------------------------- // main() Routine //----------------------------------------------------------------------------- void main (void) { SFRPAGE = PCA0_PAGE; PCA0MD &= ~PCA0MD_WDTE__ENABLED; // WDTE = 0 (clear watchdog timer // enable) PORT_Init(); // Initialize Port I/O OSCILLATOR_Init (); // Initialize Oscillator while (1); } //----------------------------------------------------------------------------- // Initialization Subroutines //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // OSCILLATOR_Init //----------------------------------------------------------------------------- // // Return Value : None // Parameters : None // // This function initializes the system clock to use the internal low power // oscillator. // //----------------------------------------------------------------------------- void OSCILLATOR_Init (void) { U8 SFRPAGE_save = SFRPAGE; SFRPAGE = LEGACY_PAGE; // If system clock is > 14 MHz, bypass (disable) the one-shot timer FLSCL |= FLSCL_BYPASS__SYSCLK; // Set the BYPASS bit OSCXCN = OSCXCN_XOSCMD__CMOS; // External CMOS mode // In CMOS mode, the XCLKVLD flag will never be set //while ((OSCXCN & OSCXCN_XCLKVLD__BMASK) == OSCXCN_XCLKVLD__NOT_SET); // Switch to EXTOSC CLKSEL = CLKSEL_CLKSL__EXTOSC | CLKSEL_CLKDIV__SYSCLK_DIV_1; // Wait for divider to be applied while ((CLKSEL & CLKSEL_CLKRDY__BMASK) == CLKSEL_CLKRDY__NOT_SET); SFRPAGE = SFRPAGE_save; } //----------------------------------------------------------------------------- // PORT_Init //----------------------------------------------------------------------------- // // Return Value : None // Parameters : None // // This function configures the crossbar and ports pins. // // The oscillator pins should be configured as analog inputs when using the // external oscillator in crystal mode. // // P0.1 digital push-pull /SYSCLK // // P1.1 digital push-pull XTAL2 (CMOS) // //----------------------------------------------------------------------------- void PORT_Init (void) { U8 SFRPAGE_save = SFRPAGE; // Save the current SFRPAGE SFRPAGE = CONFIG_PAGE; P0SKIP = 0x01; // P0.0 has a capacitor on it P0MDOUT |= 0x02; // P0.1 is push-pull // Oscillator Pin P1MDIN |= 0x02; // P1.1 is digital CMOS input P1MDOUT &= ~0x02; // Change mode to open drain P1 |= 0x02; // Disable output drivers XBR0 = XBR0_SYSCKE__ENABLED; XBR1 = XBR1_XBARE__ENABLED | // Enable crossbar XBR1_WEAKPUD__PULL_UPS_ENABLED; // with weak pullups SFRPAGE = SFRPAGE_save; // Restore saved SFRPAGE } //----------------------------------------------------------------------------- // End Of File //-----------------------------------------------------------------------------
4ef191dbf255612e56b0e976a6b910aa11644202
f15eb31f51ee26de9a161c2950312721ae4acd37
/asm/src/parser.c
8d8453bd61983224b737abdc90ccf1755da7b574
[]
no_license
theocerutti/Corewar
a667f8e4f0e4580bd9d76b6e33fe2d9ca9544b24
541dce938100b7ec24ce48ad38ea6cce37c44d07
refs/heads/master
2020-05-27T20:22:33.832275
2020-04-06T16:00:10
2020-04-06T16:00:10
188,778,697
4
0
null
null
null
null
UTF-8
C
false
false
798
c
/* ** EPITECH PROJECT, 2019 ** parser ** File description: ** parser */ #include "asm.h" void write_instru_token(data_t *data, token_t *token, char *instru, int begin_code_line) { for (int i = 0; instru != NULL && op_tab[i].mnemonique != NULL; i++) { if (!my_strncmp(instru, op_tab[i].mnemonique, my_strlen(instru))) { write_instruction(data, token, &op_tab[i], begin_code_line); break; } } } int parse_token(data_t *data, token_t *token) { int ret = 0; char *instru = token->t_token[0]; int begin_code_line = 0; if (is_flag(instru)) { instru = token->t_token[1]; begin_code_line = 1; } else { begin_code_line = 0; } write_instru_token(data, token, instru, begin_code_line); return (ret); }
516c2c91d7cc37c838f7d590864f99176a4e2e04
2a4ef692496bd4904a7d44fa55d966f6ff5b80bf
/src/display_size.c
fd1202d13e2a606aa49b1af223b6745fec243f14
[]
no_license
Geoffrey42/ft_ls
437068af955f326fc5300f0292050225eacbbd52
a89088e2e6151d65d9ca42c186a33f2223ad299f
refs/heads/master
2021-01-13T07:49:48.554266
2017-01-09T09:43:35
2017-01-09T09:43:35
60,631,687
2
0
null
null
null
null
UTF-8
C
false
false
2,338
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* display_size.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ggane <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/09/27 17:25:08 by ggane #+# #+# */ /* Updated: 2016/09/30 11:39:45 by ggane ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_ls.h" int empty_dir(t_data *dir) { struct dirent *file; DIR *dirp; int hidden; int turns; hidden = 0; turns = 0; if (dir->flags & LOW_A_FLAG) return (0); if (!(dirp = opendir(dir->name))) return (1); while ((file = readdir(dirp))) { if (ft_strcmp(file->d_name, ".") == 0 || ft_strcmp(file->d_name, "..") == 0) hidden++; turns++; } closedir(dirp); if (hidden == 2 && turns == 2) return (1); return (0); } void display_size(struct stat file_stat) { ft_putnbr(file_stat.st_size); ft_putchar(' '); } void print_total_size(size_t size) { ft_putstr("total "); ft_putnbr(size); ft_putchar('\n'); } size_t sum_file_sizes(t_data *directory, struct dirent *file) { size_t size; struct stat file_stat; char *file_pathname; size = 0; file_pathname = create_pathname(directory->pathname, file->d_name); lstat(file_pathname, &file_stat); size = file_stat.st_blocks; return (size); } void display_total_size(t_data *directory) { size_t size; struct dirent *file; DIR *dirp; size = 0; if (empty_dir(directory)) return ; if (!(dirp = opendir(directory->name))) return ; while ((file = readdir(dirp))) { if (directory->flags & LOW_A_FLAG) size = size + sum_file_sizes(directory, file); else if ((directory->flags & LOW_A_FLAG) == 0 && file->d_name[0] != '.') size = size + sum_file_sizes(directory, file); } closedir(dirp); print_total_size(size); }
15e74a14557572e4c7888b21f619db97c93de545
893ea7cffd4e6fe3fbf38ee488249358e0dc8bd1
/0728/1vital_code/整合的十段代码/3标准IO_文件IO/标准IO/3putc_getc.c
6ec5ed5bec56f8202fa6f1a05a4d15d8dda4d037
[]
no_license
lansplansplansp/0707
b198a2107371c81a12e38a417beb8ea709725d81
6f4b4e31305104a19bcf920e4aceaac8fb83c591
refs/heads/master
2020-06-16T18:27:49.387589
2019-07-28T15:59:05
2019-07-28T15:59:05
195,664,192
0
0
null
null
null
null
UTF-8
C
false
false
202
c
#include<stdio.h> #include<string.h> int main() { char ch; printf("Input a character:"); ch=getc(stdin); //ch=fgetc(stdin); putc(ch,stdout); //fputc(ch,stdout); return 0; }
0570f6a3a9e16251d586fe37d28cf20995a96004
c0a1d0c3273c0ef64c812e29f3766ebb46f9416e
/src/test/readv.c
57e1b8d06ce63b85bcbe6b35ef66160d824d0bd7
[ "MIT", "BSD-2-Clause" ]
permissive
xs3c/rr
bfcdc7c52b9712e2e8eb7b5c58466e399832d384
832c7f0fea3a56f35a462e70aaff09a15086b949
refs/heads/master
2020-12-25T00:28:49.189848
2016-01-27T00:08:27
2016-01-27T00:08:27
null
0
0
null
null
null
null
UTF-8
C
false
false
1,305
c
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ #include "rrutil.h" static char data[10] = "0123456789"; static void test(int use_preadv) { char name[] = "/tmp/rr-readv-XXXXXX"; int fd = mkstemp(name); struct { char ch[7]; } * part1; struct { char ch[10]; } * part2; struct iovec iovs[2]; ssize_t nread; test_assert(fd >= 0); test_assert(0 == unlink(name)); test_assert(sizeof(data) == write(fd, data, sizeof(data))); ALLOCATE_GUARD(part1, 'x'); ALLOCATE_GUARD(part2, 'y'); iovs[0].iov_base = part1; iovs[0].iov_len = sizeof(*part1); iovs[1].iov_base = part2; iovs[1].iov_len = sizeof(*part2); if (use_preadv) { /* Work around busted preadv prototype in older libcs */ nread = syscall(SYS_preadv, fd, iovs, 2, 0, 0); } else { test_assert(0 == lseek(fd, 0, SEEK_SET)); nread = readv(fd, iovs, 2); } test_assert(sizeof(data) == nread); test_assert(0 == memcmp(part1, data, sizeof(*part1))); test_assert( 0 == memcmp(part2, data + sizeof(*part1), sizeof(data) - sizeof(*part1))); test_assert(part2->ch[sizeof(data) - sizeof(*part1)] == 'y'); VERIFY_GUARD(part1); VERIFY_GUARD(part2); } int main(int argc, char* argv[]) { test(0); test(1); atomic_puts("EXIT-SUCCESS"); return 0; }
e923d0118caed8f77739c72b671ebad997688e37
f4dc3450a1cfedf352774cba95dc68b32cbfbf11
/Sources/Emulator/src/mess/machine/ecbbus.c
6fcdc78ff1f530cba0db4df372754544d30e752d
[]
no_license
Jaku2k/MAMEHub
ae85696aedf3f1709b98090c843c752d417874a9
faa98abc278cd52dd599584f7de5e2dd39cf6f87
refs/heads/master
2021-01-18T07:48:32.570205
2013-10-10T01:42:06
2013-10-10T01:42:06
null
0
0
null
null
null
null
UTF-8
C
false
false
6,693
c
/********************************************************************** Conitec Datensysteme ECB Bus emulation Copyright MESS Team. Visit http://mamedev.org for licensing and usage restrictions. **********************************************************************/ #include "ecbbus.h" //************************************************************************** // GLOBAL VARIABLES //************************************************************************** const device_type ECBBUS_SLOT = &device_creator<ecbbus_slot_device>; //************************************************************************** // LIVE DEVICE //************************************************************************** //------------------------------------------------- // ecbbus_slot_device - constructor //------------------------------------------------- ecbbus_slot_device::ecbbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ECBBUS_SLOT, "ECB bus slot", tag, owner, clock), device_slot_interface(mconfig, *this) { } //------------------------------------------------- // static_set_ecbbus_slot - //------------------------------------------------- void ecbbus_slot_device::static_set_ecbbus_slot(device_t &device, const char *tag, int num) { ecbbus_slot_device &ecbbus_card = dynamic_cast<ecbbus_slot_device &>(device); ecbbus_card.m_bus_tag = tag; ecbbus_card.m_bus_num = num; } //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void ecbbus_slot_device::device_start() { m_bus = machine().device<ecbbus_device>(m_bus_tag); device_ecbbus_card_interface *dev = dynamic_cast<device_ecbbus_card_interface *>(get_card_device()); if (dev) m_bus->add_ecbbus_card(dev, m_bus_num); } //************************************************************************** // GLOBAL VARIABLES //************************************************************************** const device_type ECBBUS = &device_creator<ecbbus_device>; void ecbbus_device::static_set_cputag(device_t &device, const char *tag) { ecbbus_device &ecbbus = downcast<ecbbus_device &>(device); ecbbus.m_cputag = tag; } //------------------------------------------------- // device_config_complete - perform any // operations now that the configuration is // complete //------------------------------------------------- void ecbbus_device::device_config_complete() { // inherit a copy of the static data const ecbbus_interface *intf = reinterpret_cast<const ecbbus_interface *>(static_config()); if (intf != NULL) { *static_cast<ecbbus_interface *>(this) = *intf; } // or initialize to defaults if none provided else { memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb)); } } //************************************************************************** // DEVICE ECBBUS CARD INTERFACE //************************************************************************** //------------------------------------------------- // device_ecbbus_card_interface - constructor //------------------------------------------------- device_ecbbus_card_interface::device_ecbbus_card_interface(const machine_config &mconfig, device_t &device) : device_slot_card_interface(mconfig, device) { m_slot = dynamic_cast<ecbbus_slot_device *>(device.owner()); } //------------------------------------------------- // ~device_ecbbus_card_interface - destructor //------------------------------------------------- device_ecbbus_card_interface::~device_ecbbus_card_interface() { } //************************************************************************** // LIVE DEVICE //************************************************************************** //------------------------------------------------- // ecbbus_device - constructor //------------------------------------------------- ecbbus_device::ecbbus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ECBBUS, "ECB bus", tag, owner, clock) { for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) m_ecbbus_device[i] = NULL; } //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void ecbbus_device::device_start() { m_maincpu = machine().device<cpu_device>(m_cputag); // resolve callbacks m_out_int_func.resolve(m_out_int_cb, *this); m_out_nmi_func.resolve(m_out_nmi_cb, *this); } //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- void ecbbus_device::device_reset() { } //------------------------------------------------- // add_ecbbus_card - add ECB bus card //------------------------------------------------- void ecbbus_device::add_ecbbus_card(device_ecbbus_card_interface *card, int pos) { m_ecbbus_device[pos] = card; } //------------------------------------------------- // mem_r - //------------------------------------------------- READ8_MEMBER( ecbbus_device::mem_r ) { UINT8 data = 0; for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) { if (m_ecbbus_device[i] != NULL) { data |= m_ecbbus_device[i]->ecbbus_mem_r(offset); } } return data; } //------------------------------------------------- // mem_w - //------------------------------------------------- WRITE8_MEMBER( ecbbus_device::mem_w ) { for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) { if (m_ecbbus_device[i] != NULL) { m_ecbbus_device[i]->ecbbus_mem_w(offset, data); } } } //------------------------------------------------- // io_r - //------------------------------------------------- READ8_MEMBER( ecbbus_device::io_r ) { UINT8 data = 0; for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) { if (m_ecbbus_device[i] != NULL) { data |= m_ecbbus_device[i]->ecbbus_io_r(offset); } } return data; } //------------------------------------------------- // io_w - //------------------------------------------------- WRITE8_MEMBER( ecbbus_device::io_w ) { for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) { if (m_ecbbus_device[i] != NULL) { m_ecbbus_device[i]->ecbbus_io_w(offset, data); } } } //------------------------------------------------- // int_w - //------------------------------------------------- WRITE_LINE_MEMBER( ecbbus_device::int_w ) { m_out_int_func(state); } //------------------------------------------------- // nmi_w - //------------------------------------------------- WRITE_LINE_MEMBER( ecbbus_device::nmi_w ) { m_out_nmi_func(state); }
a197fb3c45780a9b2a04a06af7971a2f9faad6ba
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/d222fc17-0529-4c3b-846c-e732cdf2d379.c
cde9260751ce014ae8e6aeacc2c844eefd9c85da
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
574
c
#include <string.h> #include <stdio.h> int main() { int i=4; int j=14; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = l/j; l = i-j; l = k%j; l = i+j; k = k-i*i; //variables //random /* START VULNERABILITY */ int a; int b[87]; int c[82]; a = 0; while (b[a] != 0) { //random /* START BUFFER SET */ *((int *)c + a) = *((int *)b + a); /* END BUFFER SET */ a++; } /* END VULNERABILITY */ printf("%d%d\n",k,l); return 0; }
30a5e34715b4d1f54886f02a1fe40cffc4e494b6
d42fa606a26402258bc804332c0bab5d154ba99c
/srslte/lib/phch/cqi.c
ec47fcbd1afde1f9b3cbee0e4e6b6f651541e8d5
[]
no_license
zz4fap/Wireless-Spectrum-Hypervisor
44c2635d7092c65fa932b6b2e9cd1337ebbc4836
24158b45660dd304e6a39a1b318d534c3607bd7c
refs/heads/master
2020-06-18T04:11:00.451308
2019-11-14T17:00:37
2019-11-14T17:00:37
196,159,695
4
2
null
null
null
null
UTF-8
C
false
false
5,540
c
/** * * \section COPYRIGHT * * Copyright 2013-2015 Software Radio Systems Limited * * \section LICENSE * * This file is part of the srsLTE library. * * srsLTE is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * srsLTE 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 Affero General Public License for more details. * * A copy of the GNU Affero General Public License can be found in * the LICENSE file in the top-level directory of this distribution * and at http://www.gnu.org/licenses/. * */ #include <stdint.h> #include <stdio.h> #include <string.h> #include <strings.h> #include <stdlib.h> #include <stdbool.h> #include <assert.h> #include <math.h> #include "srslte/phch/cqi.h" #include "srslte/common/phy_common.h" #include "srslte/utils/bit.h" #include "srslte/utils/vector.h" #include "srslte/utils/debug.h" int srslte_cqi_hl_subband_pack(srslte_cqi_hl_subband_t *msg, uint8_t buff[SRSLTE_CQI_MAX_BITS]) { uint8_t *body_ptr = buff; srslte_bit_unpack(msg->wideband_cqi, &body_ptr, 4); srslte_bit_unpack(msg->subband_diff_cqi, &body_ptr, 2*msg->N); return 4+2*msg->N; } int srslte_cqi_ue_subband_pack(srslte_cqi_ue_subband_t *msg, uint8_t buff[SRSLTE_CQI_MAX_BITS]) { uint8_t *body_ptr = buff; srslte_bit_unpack(msg->wideband_cqi, &body_ptr, 4); srslte_bit_unpack(msg->subband_diff_cqi, &body_ptr, 2); srslte_bit_unpack(msg->subband_diff_cqi, &body_ptr, msg->L); return 4+2+msg->L; } int srslte_cqi_format2_wideband_pack(srslte_cqi_format2_wideband_t *msg, uint8_t buff[SRSLTE_CQI_MAX_BITS]) { uint8_t *body_ptr = buff; srslte_bit_unpack(msg->wideband_cqi, &body_ptr, 4); return 4; } int srslte_cqi_format2_subband_pack(srslte_cqi_format2_subband_t *msg, uint8_t buff[SRSLTE_CQI_MAX_BITS]) { uint8_t *body_ptr = buff; srslte_bit_unpack(msg->subband_cqi, &body_ptr, 4); srslte_bit_unpack(msg->subband_label, &body_ptr, msg->subband_label_2_bits?2:1); return 4+(msg->subband_label_2_bits)?2:1; } int srslte_cqi_value_pack(srslte_cqi_value_t *value, uint8_t buff[SRSLTE_CQI_MAX_BITS]) { switch(value->type) { case SRSLTE_CQI_TYPE_WIDEBAND: return srslte_cqi_format2_wideband_pack(&value->wideband, buff); case SRSLTE_CQI_TYPE_SUBBAND: return srslte_cqi_format2_subband_pack(&value->subband, buff); case SRSLTE_CQI_TYPE_SUBBAND_UE: return srslte_cqi_ue_subband_pack(&value->subband_ue, buff); case SRSLTE_CQI_TYPE_SUBBAND_HL: return srslte_cqi_hl_subband_pack(&value->subband_hl, buff); } return -1; } bool srslte_cqi_send(uint32_t I_cqi_pmi, uint32_t tti) { uint32_t N_p = 0; uint32_t N_offset = 0; if (I_cqi_pmi <= 1) { N_p = 2; N_offset = I_cqi_pmi; } else if (I_cqi_pmi <= 6) { N_p = 5; N_offset = I_cqi_pmi - 2; } else if (I_cqi_pmi <= 16) { N_p = 10; N_offset = I_cqi_pmi - 7; } else if (I_cqi_pmi <= 36) { N_p = 20; N_offset = I_cqi_pmi - 17; } else if (I_cqi_pmi <= 76) { N_p = 40; N_offset = I_cqi_pmi - 37; } else if (I_cqi_pmi <= 156) { N_p = 80; N_offset = I_cqi_pmi - 77; } else if (I_cqi_pmi <= 316) { N_p = 160; N_offset = I_cqi_pmi - 157; } else if (I_cqi_pmi == 317) { return false; } else if (I_cqi_pmi <= 349) { N_p = 32; N_offset = I_cqi_pmi - 318; } else if (I_cqi_pmi <= 413) { N_p = 64; N_offset = I_cqi_pmi - 350; } else if (I_cqi_pmi <= 541) { N_p = 128; N_offset = I_cqi_pmi - 414; } else if (I_cqi_pmi <= 1023) { return false; } if (N_p) { if ((tti-N_offset)%N_p == 0) { return true; } } return false; } /* SNR-to-CQI conversion, got from "Downlink SNR to CQI Mapping for Different Multiple Antenna Techniques in LTE" * Table III. */ // From paper static float cqi_to_snr_table[15] = { 1.95, 4, 6, 8, 10, 11.95, 14.05, 16, 17.9, 19.9, 21.5, 23.45, 25.0, 27.30, 29}; // New srsLTE values. Should be tested before using. //static float cqi_to_snr_table[15] = { 1.95, 4, 6, 8, 10, 11.95, 14.05, 16, 17.9, 20.9, 22.5, 24.75, 25.5, 27.30, 29}; // From experimental measurements @ 5 MHz //static float cqi_to_snr_table[15] = { 1, 1.75, 3, 4, 5, 6, 7.5, 9, 11.5, 13.0, 15.0, 18, 20, 22.5, 26.5}; uint8_t srslte_cqi_from_snr(float snr) { for (int cqi=14;cqi>=0;cqi--) { if (snr >= cqi_to_snr_table[cqi]) { return (uint8_t) cqi+1; } } return 0; } /* Returns the subband size for higher layer-configured subband feedback, * i.e., the number of RBs per subband as a function of the cell bandwidth * (Table 7.2.1-3 in TS 36.213) */ int srslte_cqi_hl_get_subband_size(int nof_prb) { if (nof_prb < 7) { return 0; } else if (nof_prb <= 26) { return 4; } else if (nof_prb <= 63) { return 6; } else if (nof_prb <= 110) { return 8; } else { return -1; } } /* Returns the number of subbands to be reported in CQI measurements as * defined in clause 7.2 in TS 36.213, i.e., the N parameter */ int srslte_cqi_hl_get_no_subbands(int nof_prb) { int hl_size = srslte_cqi_hl_get_subband_size(nof_prb); if (hl_size > 0) { return (int)ceil((float)nof_prb/hl_size); } else { return 0; } }
c91db683c771e907e23e9403b8f7e540ddb2b2d0
0854453c6d24044420e3cf85f55205f60e062067
/src/test/collection/lfcByteBuffer/spec_lfcByteBuffer_read_uint64.c
c78f143a73b735b0a1062f1b8a7b3f2cd2dfd0d8
[]
no_license
pfke/libForC
f82c00949fce4e57237f82df77d968151577b941
7c5965958e2ad5a843bc14c1f082e95ff44ca20f
refs/heads/master
2023-01-15T20:23:27.410897
2020-11-20T17:44:18
2020-11-20T17:44:18
276,684,658
0
0
null
null
null
null
UTF-8
C
false
false
1,258
c
#include "collection/lfcByteBuffer.h" #include "testing/lfcCriterionHelper.h" #define TEST_SUITE_NAME spec_lfcByteBuffer_read_uint64 Test( TEST_SUITE_NAME, return_0_after_start ) { lfcByteBuffer_t *tto = lfcByteBuffer_ctor(); should_be_same_int(lfcByteBuffer_read_uint64(tto, NULL), 0); delete(tto); } Test( TEST_SUITE_NAME, return_0_if_capacity_is_0 ) { lfcByteBuffer_t *tto = lfcByteBuffer_ctor(); lfcByteBuffer_write_int8(tto, 1); lfcByteBuffer_write_int8(tto, 1); lfcByteBuffer_write_int8(tto, 1); lfcByteBuffer_read_int16(tto, NULL); lfcByteBuffer_read_int8(tto, NULL); should_be_same_int(lfcByteBuffer_read_uint64(tto, NULL), 0); delete(tto); } Test( TEST_SUITE_NAME, return_not_0_if_capacity_is_not0__passNULL ) { lfcByteBuffer_t *tto = lfcByteBuffer_ctor(); lfcByteBuffer_write_uint64(tto, 125); should_be_same_int(lfcByteBuffer_read_uint64(tto, NULL), 8); delete(tto); } Test( TEST_SUITE_NAME, read_correct ) { uint64_t result = 0; lfcByteBuffer_t *tto = lfcByteBuffer_ctor(); lfcByteBuffer_write_uint64(tto, 1145); lfcByteBuffer_read_uint64(tto, &result); should_be_same_int(result, 1145); delete(tto); }
727a289a92137609f9d4d1184a311e2d9926a4d3
21c09799d006ed6bede4123d57d6d54d977c0b63
/fits_2018_10/PFNo10Dijet2016bgCSVv21b221Scan/corrHist.C
b65377cd85dbace30661b9460da333322794fbe8
[]
no_license
corvettettt/DijetRootTreeAnalyzer
68cb12e6b280957e1eb22c9842b0b9b30ae2c779
e65624ffc105798209436fc80fb82e2c252c6344
refs/heads/master
2021-05-06T09:57:12.816787
2019-04-18T15:32:38
2019-04-18T15:32:38
114,043,763
1
0
null
2017-12-12T22:02:46
2017-12-12T22:02:46
null
UTF-8
C
false
false
4,898
c
void corrHist() { //=========Macro generated from canvas: c/c //========= (Thu Dec 13 10:29:53 2018) by ROOT version6.02/05 TCanvas *c = new TCanvas("c", "c",0,0,500,500); gStyle->SetOptStat(0); c->SetHighLightColor(2); c->Range(-0.5333333,-0.5,4.8,4.5); c->SetFillColor(0); c->SetBorderMode(0); c->SetBorderSize(2); c->SetRightMargin(0.15); c->SetFrameBorderMode(0); c->SetFrameBorderMode(0); TH2D *correlation_matrix = new TH2D("correlation_matrix","correlation_matrix",4,0,4,4,0,4); correlation_matrix->SetBinContent(8,-0.991517); correlation_matrix->SetBinContent(9,0.9995474); correlation_matrix->SetBinContent(10,1); correlation_matrix->SetBinContent(14,-0.9948967); correlation_matrix->SetBinContent(15,1); correlation_matrix->SetBinContent(16,0.9995474); correlation_matrix->SetBinContent(20,1); correlation_matrix->SetBinContent(21,-0.9948967); correlation_matrix->SetBinContent(22,-0.991517); correlation_matrix->SetBinContent(25,1); correlation_matrix->SetBinError(8,0.991517); correlation_matrix->SetBinError(9,0.9995474); correlation_matrix->SetBinError(10,1); correlation_matrix->SetBinError(14,0.9948967); correlation_matrix->SetBinError(15,1); correlation_matrix->SetBinError(16,0.9995474); correlation_matrix->SetBinError(20,1); correlation_matrix->SetBinError(21,0.9948967); correlation_matrix->SetBinError(22,0.991517); correlation_matrix->SetBinError(25,1); correlation_matrix->SetMinimum(-1); correlation_matrix->SetMaximum(1); correlation_matrix->SetEntries(16); correlation_matrix->SetStats(0); correlation_matrix->SetContour(20); correlation_matrix->SetContourLevel(0,-1); correlation_matrix->SetContourLevel(1,-0.9); correlation_matrix->SetContourLevel(2,-0.8); correlation_matrix->SetContourLevel(3,-0.7); correlation_matrix->SetContourLevel(4,-0.6); correlation_matrix->SetContourLevel(5,-0.5); correlation_matrix->SetContourLevel(6,-0.4); correlation_matrix->SetContourLevel(7,-0.3); correlation_matrix->SetContourLevel(8,-0.2); correlation_matrix->SetContourLevel(9,-0.1); correlation_matrix->SetContourLevel(10,0); correlation_matrix->SetContourLevel(11,0.1); correlation_matrix->SetContourLevel(12,0.2); correlation_matrix->SetContourLevel(13,0.3); correlation_matrix->SetContourLevel(14,0.4); correlation_matrix->SetContourLevel(15,0.5); correlation_matrix->SetContourLevel(16,0.6); correlation_matrix->SetContourLevel(17,0.7); correlation_matrix->SetContourLevel(18,0.8); correlation_matrix->SetContourLevel(19,0.9); TPaletteAxis *palette = new TPaletteAxis(4.026667,0,4.266667,4,correlation_matrix); palette->SetLabelColor(1); palette->SetLabelFont(42); palette->SetLabelOffset(0.005); palette->SetLabelSize(0.035); palette->SetTitleOffset(1); palette->SetTitleSize(0.035); palette->SetFillColor(100); palette->SetFillStyle(1001); correlation_matrix->GetListOfFunctions()->Add(palette,"br"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); correlation_matrix->SetLineColor(ci); correlation_matrix->GetXaxis()->SetBinLabel(1,"Ntot_bkg_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetXaxis()->SetBinLabel(2,"p1_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetXaxis()->SetBinLabel(3,"p2_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetXaxis()->SetBinLabel(4,"p3_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetXaxis()->SetLabelFont(42); correlation_matrix->GetXaxis()->SetLabelSize(0.035); correlation_matrix->GetXaxis()->SetTitleSize(0.035); correlation_matrix->GetXaxis()->SetTitleFont(42); correlation_matrix->GetYaxis()->SetBinLabel(4,"Ntot_bkg_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetYaxis()->SetBinLabel(3,"p1_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetYaxis()->SetBinLabel(2,"p2_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetYaxis()->SetBinLabel(1,"p3_PFNo10Dijet2016bgCSVv21b221"); correlation_matrix->GetYaxis()->SetLabelFont(42); correlation_matrix->GetYaxis()->SetLabelSize(0.035); correlation_matrix->GetYaxis()->SetTitleSize(0.035); correlation_matrix->GetYaxis()->SetTitleFont(42); correlation_matrix->GetZaxis()->SetLabelFont(42); correlation_matrix->GetZaxis()->SetLabelSize(0.035); correlation_matrix->GetZaxis()->SetTitleSize(0.035); correlation_matrix->GetZaxis()->SetTitleFont(42); correlation_matrix->Draw("colztext"); TPaveText *pt = new TPaveText(0.2793145,0.9365254,0.7206855,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("correlation_matrix"); pt->Draw(); c->Modified(); c->cd(); c->SetSelected(c); }
1a41a0ea712cd87a29c948e45995a8fe08966ead
ab7d5ec2e40b26c33da957210b5d2da77f9b696d
/repos/sproxel/contents/pyBindings.h
87b7ec998070f5053c589697259e108782507875
[]
no_license
mcclure/bitbucket-backup
e49d280363ff7ef687f03473e463865a7ad8a817
b6a02ca8decf843fa0a765c842c24e7eccf59307
refs/heads/archive
2023-01-24T21:15:14.875131
2020-02-02T20:56:23
2020-02-02T20:56:23
237,833,969
115
6
null
2023-01-07T14:24:14
2020-02-02T20:43:56
C
UTF-8
C
false
false
581
h
#ifndef __SPROXEL_PY_BINDINGS_H__ #define __SPROXEL_PY_BINDINGS_H__ #include "script.h" #include "SproxelProject.h" #include "UndoManager.h" PyObject* sprite_to_py(VoxelGridGroupPtr sprite); PyObject* project_to_py(SproxelProjectPtr proj); PyObject* undo_manager_to_py(UndoManager *); PyObject* PySproxel_registerImporter(PyObject*, PyObject *arg); PyObject* PySproxel_unregisterImporter(PyObject*, PyObject *arg); PyObject* PySproxel_registerExporter(PyObject*, PyObject *arg); PyObject* PySproxel_unregisterExporter(PyObject*, PyObject *arg); #endif
914fbaecd46d1eabd6af5d7103933b06f6f577e1
4483b10028c73fc49a518be4a2bcb56848d8786b
/ios/Google Cardboard Demo/Mecha-Mecha/Classes/Native/mscorlib_System_Array_InternalEnumerator_1_gen_18MethodDeclarations.h
500c69e7ec283d00f4a471094cd86cbea3b996fe
[]
no_license
nchavez324/es50_final_project
aa8202470b59be1ddc25e78a3e1712708f5b00c4
be1b8f9849d1ff4a845a137eefecb49df27f2e1c
refs/heads/master
2021-01-10T07:03:26.885783
2020-12-03T16:02:23
2020-12-03T16:02:23
47,363,409
0
0
null
null
null
null
UTF-8
C
false
false
3,127
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include <assert.h> #include <exception> // System.Array struct Array_t; // System.Object struct Object_t; #include "codegen/il2cpp-codegen.h" #include "mscorlib_System_Array_InternalEnumerator_1_gen_18.h" #include "UnityEngine_UnityEngine_RaycastHit2D.h" // System.Void System.Array/InternalEnumerator`1<UnityEngine.RaycastHit2D>::.ctor(System.Array) extern "C" void InternalEnumerator_1__ctor_m12699_gshared (InternalEnumerator_1_t1944 * __this, Array_t * ___array, const MethodInfo* method); #define InternalEnumerator_1__ctor_m12699(__this, ___array, method) (( void (*) (InternalEnumerator_1_t1944 *, Array_t *, const MethodInfo*))InternalEnumerator_1__ctor_m12699_gshared)(__this, ___array, method) // System.Void System.Array/InternalEnumerator`1<UnityEngine.RaycastHit2D>::System.Collections.IEnumerator.Reset() extern "C" void InternalEnumerator_1_System_Collections_IEnumerator_Reset_m12700_gshared (InternalEnumerator_1_t1944 * __this, const MethodInfo* method); #define InternalEnumerator_1_System_Collections_IEnumerator_Reset_m12700(__this, method) (( void (*) (InternalEnumerator_1_t1944 *, const MethodInfo*))InternalEnumerator_1_System_Collections_IEnumerator_Reset_m12700_gshared)(__this, method) // System.Object System.Array/InternalEnumerator`1<UnityEngine.RaycastHit2D>::System.Collections.IEnumerator.get_Current() extern "C" Object_t * InternalEnumerator_1_System_Collections_IEnumerator_get_Current_m12701_gshared (InternalEnumerator_1_t1944 * __this, const MethodInfo* method); #define InternalEnumerator_1_System_Collections_IEnumerator_get_Current_m12701(__this, method) (( Object_t * (*) (InternalEnumerator_1_t1944 *, const MethodInfo*))InternalEnumerator_1_System_Collections_IEnumerator_get_Current_m12701_gshared)(__this, method) // System.Void System.Array/InternalEnumerator`1<UnityEngine.RaycastHit2D>::Dispose() extern "C" void InternalEnumerator_1_Dispose_m12702_gshared (InternalEnumerator_1_t1944 * __this, const MethodInfo* method); #define InternalEnumerator_1_Dispose_m12702(__this, method) (( void (*) (InternalEnumerator_1_t1944 *, const MethodInfo*))InternalEnumerator_1_Dispose_m12702_gshared)(__this, method) // System.Boolean System.Array/InternalEnumerator`1<UnityEngine.RaycastHit2D>::MoveNext() extern "C" bool InternalEnumerator_1_MoveNext_m12703_gshared (InternalEnumerator_1_t1944 * __this, const MethodInfo* method); #define InternalEnumerator_1_MoveNext_m12703(__this, method) (( bool (*) (InternalEnumerator_1_t1944 *, const MethodInfo*))InternalEnumerator_1_MoveNext_m12703_gshared)(__this, method) // T System.Array/InternalEnumerator`1<UnityEngine.RaycastHit2D>::get_Current() extern "C" RaycastHit2D_t383 InternalEnumerator_1_get_Current_m12704_gshared (InternalEnumerator_1_t1944 * __this, const MethodInfo* method); #define InternalEnumerator_1_get_Current_m12704(__this, method) (( RaycastHit2D_t383 (*) (InternalEnumerator_1_t1944 *, const MethodInfo*))InternalEnumerator_1_get_Current_m12704_gshared)(__this, method)
44207efa1f272b306b9f0a210295e2b556389d9b
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/reactos/base/services/dhcpcsvc/dhcp/extr_options.c_pretty_print_option.c
4f18a8356d7e200f69e9f7b4fbf6e83a4835b0d0
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
6,453
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct in_addr {int /*<<< orphan*/ s_addr; } ; typedef int /*<<< orphan*/ optbuf ; struct TYPE_2__ {char* format; int /*<<< orphan*/ name; } ; /* Variables and functions */ char ANSI_NULL ; int _snprintf (char*,int,char*,char) ; TYPE_1__* dhcp_options ; int /*<<< orphan*/ error (char*,unsigned int) ; scalar_t__ getLong (unsigned char*) ; char getShort (unsigned char*) ; scalar_t__ getULong (unsigned char*) ; char getUShort (unsigned char*) ; int /*<<< orphan*/ htonl (scalar_t__) ; char* inet_ntoa (struct in_addr) ; int /*<<< orphan*/ isascii (unsigned char) ; int /*<<< orphan*/ isprint (unsigned char) ; int strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; int /*<<< orphan*/ warning (char*,...) ; char * pretty_print_option(unsigned int code, unsigned char *data, int len, int emit_commas, int emit_quotes) { static char optbuf[32768]; /* XXX */ int hunksize = 0, numhunk = -1, numelem = 0; char fmtbuf[32], *op = optbuf; int i, j, k, opleft = sizeof(optbuf); unsigned char *dp = data; struct in_addr foo; char comma; /* Code should be between 0 and 255. */ if (code > 255) error("pretty_print_option: bad code %d", code); if (emit_commas) comma = ','; else comma = ' '; /* Figure out the size of the data. */ for (i = 0; dhcp_options[code].format[i]; i++) { if (!numhunk) { warning("%s: Excess information in format string: %s", dhcp_options[code].name, &(dhcp_options[code].format[i])); break; } numelem++; fmtbuf[i] = dhcp_options[code].format[i]; switch (dhcp_options[code].format[i]) { case 'A': --numelem; fmtbuf[i] = 0; numhunk = 0; break; case 'X': for (k = 0; k < len; k++) if (!isascii(data[k]) || !isprint(data[k])) break; if (k == len) { fmtbuf[i] = 't'; numhunk = -2; } else { fmtbuf[i] = 'x'; hunksize++; comma = ':'; numhunk = 0; } fmtbuf[i + 1] = 0; break; case 't': fmtbuf[i] = 't'; fmtbuf[i + 1] = 0; numhunk = -2; break; case 'I': case 'l': case 'L': hunksize += 4; break; case 's': case 'S': hunksize += 2; break; case 'b': case 'B': case 'f': hunksize++; break; case 'e': break; default: warning("%s: garbage in format string: %s", dhcp_options[code].name, &(dhcp_options[code].format[i])); break; } } /* Check for too few bytes... */ if (hunksize > len) { warning("%s: expecting at least %d bytes; got %d", dhcp_options[code].name, hunksize, len); return ("<error>"); } /* Check for too many bytes... */ if (numhunk == -1 && hunksize < len) warning("%s: %d extra bytes", dhcp_options[code].name, len - hunksize); /* If this is an array, compute its size. */ if (!numhunk) numhunk = len / hunksize; /* See if we got an exact number of hunks. */ if (numhunk > 0 && numhunk * hunksize < len) warning("%s: %d extra bytes at end of array", dhcp_options[code].name, len - numhunk * hunksize); /* A one-hunk array prints the same as a single hunk. */ if (numhunk < 0) numhunk = 1; /* Cycle through the array (or hunk) printing the data. */ for (i = 0; i < numhunk; i++) { for (j = 0; j < numelem; j++) { int opcount; switch (fmtbuf[j]) { case 't': if (emit_quotes) { *op++ = '"'; opleft--; } for (; dp < data + len; dp++) { if (!isascii(*dp) || !isprint(*dp)) { if (dp + 1 != data + len || *dp != 0) { _snprintf(op, opleft, "\\%03o", *dp); op += 4; opleft -= 4; } } else if (*dp == '"' || *dp == '\'' || *dp == '$' || *dp == '`' || *dp == '\\') { *op++ = '\\'; *op++ = *dp; opleft -= 2; } else { *op++ = *dp; opleft--; } } if (emit_quotes) { *op++ = '"'; opleft--; } *op = 0; break; case 'I': foo.s_addr = htonl(getULong(dp)); strncpy(op, inet_ntoa(foo), opleft - 1); op[opleft - 1] = ANSI_NULL; opcount = strlen(op); if (opcount >= opleft) goto toobig; opleft -= opcount; dp += 4; break; case 'l': opcount = _snprintf(op, opleft, "%ld", (long)getLong(dp)); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; dp += 4; break; case 'L': opcount = _snprintf(op, opleft, "%ld", (unsigned long)getULong(dp)); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; dp += 4; break; case 's': opcount = _snprintf(op, opleft, "%d", getShort(dp)); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; dp += 2; break; case 'S': opcount = _snprintf(op, opleft, "%d", getUShort(dp)); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; dp += 2; break; case 'b': opcount = _snprintf(op, opleft, "%d", *(char *)dp++); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; break; case 'B': opcount = _snprintf(op, opleft, "%d", *dp++); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; break; case 'x': opcount = _snprintf(op, opleft, "%x", *dp++); if (opcount >= opleft || opcount == -1) goto toobig; opleft -= opcount; break; case 'f': opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1); op[opleft - 1] = ANSI_NULL; if (opcount >= opleft) goto toobig; opleft -= opcount; break; default: warning("Unexpected format code %c", fmtbuf[j]); } op += strlen(op); opleft -= strlen(op); if (opleft < 1) goto toobig; if (j + 1 < numelem && comma != ':') { *op++ = ' '; opleft--; } } if (i + 1 < numhunk) { *op++ = comma; opleft--; } if (opleft < 1) goto toobig; } return (optbuf); toobig: warning("dhcp option too large"); return ("<error>"); }
30dd3f844560a1ed2b4abe2d3936ca9592a22ddd
e2e8d3c97155003038ea55fcb7f0247438b8aff9
/C语言学习17/2/queue.h
edb8097835f44dcde7f9109bc05e225c710e3ee8
[]
no_license
Hyuga-Hinata/C-learning
a5f62bdfa585ee815e71ab0c0ce7f34f26faa44d
e91311e3dd5870e7a5ca93f1c27cef2c3af33141
refs/heads/master
2021-05-06T06:01:27.276058
2018-03-31T16:49:49
2018-03-31T16:49:49
115,264,606
0
0
null
null
null
null
GB18030
C
false
false
2,300
h
//队列接口 #pragma c9x on #ifndef _QUEUE_H_ #define _QUEUE_H_ #include<stdbool.h> //在此处插入Item的类型定义 //例如 typedef int Item; //或: typedef struct item{int gumption;int charisma; } Item; #define MAXQUEUE 10 typedef struct node { Item item; struct node * next; }Node; typedef struct queue { Node * front; //指向队列首的指针 Node * rear; //指向队列尾的指针 int items; //队列中项目的个数 }Queue; //操作: 初始化队列 //操作前:pq指向一个队列 //操作后:该队列被初始化为空队列 void InitializeQueue(Queue * pq); //操作: 初始化队列 //操作前: pq指向一个队列 //操作后:该队列被初始化为空队列 void InitializeQueue(Queue * pq); //操作: 检查队列是否已满 //操作前:pq指向一个先前已初始化过的队列 //操作后:如果该队列已满,则返回True;否则返回False bool QueueIsFull(const Queue * pq); //操作:检查队列是否为空 //操作前:pq指向一个先前已初始化过的队列 //操作后:如果该队列为空,则返回True;否则返回False bool QueueIsEmpty(const Queue *pq); //操作:确定队列中项目的个数 //操作前:pq指向一个先前已初始化过的队列 //操作后:返回队列中项目的个数 int QueueItemCount(const Queue * pq); //操作:向队列尾端添加项目 //操作前:pq指向一个先前已初始化过的队列 // item是要添加到队列尾端的项目 //操作后:如果队列未满,item被添加到 // 队列尾部,函数返回True;否则, // 不改变队列,函数返回False bool EnQueue(Item item,Queue * pq); //操作: 从队列首端删除项目 //操作前: pq指向一个先前已初始化过的队列 //操作后:如果队列非空,队列首端的项目 // 被复制到*pitem,并被从队列中删除, // 函数返回值True;如果这个操作 // 使队列为空,把队列重置为空队列 // 如果队列开始时为空, // 不改变队列,函数返回False bool DeQueue(Item *pitem,Queue * pq); //操作: 清空队列 //操作前:pq指向一个先前已初始化过的队列 //操作后:队列被清空 void EmptyTheQueue(Queue * pq); #endif
11cde50b90107f0e2b5995bb4e34acbe2bf2358e
65f9576021285bc1f9e52cc21e2d49547ba77376
/adsp_proc/core/storage/tftp/common/inc/tftp_config_i.h
79c69c2bdf23cb1a605852d91055f4b13d9c2357
[]
no_license
AVCHD/qcs605_root_qcom
183d7a16e2f9fddc9df94df9532cbce661fbf6eb
44af08aa9a60c6ca724c8d7abf04af54d4136ccb
refs/heads/main
2023-03-18T21:54:11.234776
2021-02-26T11:03:59
2021-02-26T11:03:59
null
0
0
null
null
null
null
UTF-8
C
false
false
2,368
h
/*********************************************************************** * tftp_config_i.h * * Short description * Copyright (c) 2013-2014 Qualcomm Technologies, Inc. All Rights Reserved. * Qualcomm Technologies Proprietary and Confidential. * * Verbose description. * ***********************************************************************/ /*=========================================================================== EDIT HISTORY FOR MODULE This section contains comments describing changes made to the module. Notice that changes are listed in reverse chronological order. $Header: //components/rel/core.qdsp6/2.1/storage/tftp/common/inc/tftp_config_i.h#1 $ $DateTime: 2017/07/21 22:10:47 $ $Author: pwbldsvc $ when who what, where, why ---------- --- --------------------------------------------------------- 2014-01-05 rp In logs do not print full-paths just file-name portion. 2014-12-30 dks Fixes to config and log modules. 2014-07-28 rp Move log-buffer from global to stack. 2014-06-04 rp Switch to IPCRouter sockets. 2014-01-20 dks Configure message printing. 2013-12-05 nr Separate the socket type from the build flavour. 2013-11-14 rp Create ===========================================================================*/ #ifndef __TFTP_CONFIG_I_H__ #define __TFTP_CONFIG_I_H__ #include "tftp_config.h" #if defined (FEATURE_TFTP_SERVER_BUILD) #if defined (TFTP_LA_BUILD) #define TFTP_USE_IPCR_LA_SOCKETS #define TFTP_USE_POSIX_THREADS #define TFTP_SERVER_NO_FOLDER_ABSTRACTION #elif defined (TFTP_WINDOWS_BUILD) #define TFTP_USE_IPCR_WINDOWS_SOCKETS #define TFTP_USE_WINDOWS_THREADS #define TFTP_SERVER_NO_FOLDER_ABSTRACTION #elif defined (TFTP_NHLOS_BUILD) #define TFTP_USE_IPCR_MODEM_SOCKETS #define TFTP_USE_REX_THREADS #else #error "Server-build : unknown config" #endif #elif defined (FEATURE_TFTP_CLIENT_BUILD) #if defined (TFTP_NHLOS_BUILD) #define TFTP_USE_IPCR_MODEM_SOCKETS #define TFTP_USE_REX_THREADS #else #error "Client-build : unknown config" #endif #else #error "Configure build for either Client or Server" #endif #if defined (__FILENAME__) #define TFTP_SOURCE_FILE_NAME __FILENAME__ #else #define TFTP_SOURCE_FILE_NAME __FILE__ #endif #endif /* not __TFTP_CONFIG_I_H__ */
467900f8852a36a8bc70010d68d08fa2ed44a474
6f35b2705109d1b6105a5dfe7877dff621f9936b
/libftprintfgnl/ft_printf/src/utils/min.c
47dbcbf1bf588c964760b799122f039a8843942b
[ "MIT" ]
permissive
almayor/ft_select
f79b2af972358fa3478a0ecade402907035954cd
56756281464bf3b49cbb8f9cc51f112843f308ed
refs/heads/master
2023-07-16T21:45:58.254387
2021-08-28T10:51:59
2021-08-28T10:51:59
299,352,168
0
0
null
null
null
null
UTF-8
C
false
false
991
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* min_size.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: unite <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/03/31 17:47:18 by unite #+# #+# */ /* Updated: 2020/03/31 17:52:31 by unite ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_printf_private.h" inline size_t min(size_t a, size_t b) { return (a < b ? a : b); }
fd97ff5f63671d97fcb124723bdf077f0581bb90
c4afbfe1885e8d0c7a1c8b928563f7bb8ab6a683
/GreenDemonstrator/MEN_demonstrator_stubs/KCG-MEN-train/CAST_M_ERROR_to_int_TM_conversions.c
8d5f47ee7ee9ec1b312f71f327ac4ec0f4e2dc07
[]
no_license
VladislavLasmann/srcAndBinary
cd48ebaa2f1f7f697ba5df9f38abb9ed50658e10
13aa76e545b9596f6dac84fb20480dffae7584d8
refs/heads/master
2021-05-08T15:04:05.709079
2016-01-22T12:40:10
2016-01-22T12:40:10
null
0
0
null
null
null
null
UTF-8
C
false
false
4,581
c
/* $*************** KCG Version 6.1.3 (build i6) **************** ** Command: s2c613 -config C:/GITHUB/modeling/model/Scade/System/MEN_demonstrator/KCG-MEN\kcg_s2c_config.txt ** Generation date: 2015-10-19T14:37:59 *************************************************************$ */ #include "kcg_consts.h" #include "kcg_sensors.h" #include "CAST_M_ERROR_to_int_TM_conversions.h" /* TM_conversions::CAST_M_ERROR_to_int */ kcg_int CAST_M_ERROR_to_int_TM_conversions( /* TM_conversions::CAST_M_ERROR_to_int::m_error */M_ERROR m_error) { /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else */ kcg_bool _7_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else::else */ kcg_bool _5_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else::else::else::else */ kcg_bool _3_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else::else::else::else::else::else */ kcg_bool _1_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else::else::else::else::else::else::else */ kcg_bool else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else::else::else::else::else */ kcg_bool _2_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else::else::else */ kcg_bool _4_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1::else::else */ kcg_bool _6_else_clock_IfBlock1; /* TM_conversions::CAST_M_ERROR_to_int::IfBlock1 */ kcg_bool IfBlock1_clock; /* TM_conversions::CAST_M_ERROR_to_int::m_error_int */ kcg_int m_error_int; IfBlock1_clock = m_error == ENUM_M_ERROR_balise_group_linking_conistency_TM_conversions; if (IfBlock1_clock) { m_error_int = INT_M_ERROR_balise_group_linking_conistency_TM_conversions; } else { _7_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Double_linking_error_TM_conversions; if (_7_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Double_linking_error_TM_conversions; } else { _6_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Double_repositioning_error_TM_conversions; if (_6_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Double_repositioning_error_TM_conversions; } else { _5_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Linked_balise_group_message_consistency_erro_TM_conversions; if (_5_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Linked_balise_group_message_consistency_error_TM_conversions; } else { _4_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Radio_message_consistency_error_TM_conversions; if (_4_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Radio_message_consistency_error_TM_conversions; } else { _3_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Radio_safe_radio_connection_error_TM_conversions; if (_3_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Radio_safe_radio_connection_error_TM_conversions; } else { _2_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Radio_sequence_error_TM_conversions; if (_2_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Radio_sequence_error_TM_conversions; } else { _1_else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Safety_critical_failure_TM_conversions; if (_1_else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Safety_critical_failure_TM_conversions; } else { else_clock_IfBlock1 = m_error == ENUM_M_ERROR_Unlinked_balise_group_message_consistency_error_TM_conversions; if (else_clock_IfBlock1) { m_error_int = INT_M_ERROR_Unlinked_balise_group_message_consistency_error_TM_conversions; } else { m_error_int = INT_M_ERROR_Safety_critical_failure_TM_conversions; } } } } } } } } } return m_error_int; } /* $*************** KCG Version 6.1.3 (build i6) **************** ** CAST_M_ERROR_to_int_TM_conversions.c ** Generation date: 2015-10-19T14:37:59 *************************************************************$ */
8744f02bff723a701d4b7d7e669dbd3e836b848a
524591f2c4f760bc01c12fea3061833847a4ff9a
/arm/usr/include/Poco/Net/SocketDefs.h
bf35fe2a51a3315420fdf5ee047e05c8d36ef532
[ "BSD-3-Clause" ]
permissive
Roboy/roboy_plexus
6f78d45c52055d97159fd4d0ca8e0f32f1fbd07e
1f3039edd24c059459563cb81d194326fe824905
refs/heads/roboy3
2023-03-10T15:01:34.703853
2021-08-16T13:42:54
2021-08-16T13:42:54
101,666,005
2
4
BSD-3-Clause
2022-10-22T13:43:45
2017-08-28T16:53:52
C++
UTF-8
C
false
false
7,005
h
// // SocketDefs.h // // $Id: //poco/1.3/Net/include/Poco/Net/SocketDefs.h#3 $ // // Library: Net // Package: NetCore // Module: SocketDefs // // Include platform-specific header files for sockets. // // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef Net_SocketDefs_INCLUDED #define Net_SocketDefs_INCLUDED #if defined(POCO_OS_FAMILY_WINDOWS) #include "Poco/UnWindows.h" #include <winsock2.h> #include <ws2tcpip.h> #define POCO_INVALID_SOCKET INVALID_SOCKET #define poco_socket_t SOCKET #define poco_socklen_t int #define poco_closesocket(s) closesocket(s) #define POCO_EINTR WSAEINTR #define POCO_EACCES WSAEACCES #define POCO_EFAULT WSAEFAULT #define POCO_EINVAL WSAEINVAL #define POCO_EMFILE WSAEMFILE #define POCO_EAGAIN WSAEWOULDBLOCK #define POCO_EWOULDBLOCK WSAEWOULDBLOCK #define POCO_EINPROGRESS WSAEINPROGRESS #define POCO_EALREADY WSAEALREADY #define POCO_ENOTSOCK WSAENOTSOCK #define POCO_EDESTADDRREQ WSAEDESTADDRREQ #define POCO_EMSGSIZE WSAEMSGSIZE #define POCO_EPROTOTYPE WSAEPROTOTYPE #define POCO_ENOPROTOOPT WSAENOPROTOOPT #define POCO_EPROTONOSUPPORT WSAEPROTONOSUPPORT #define POCO_ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT #define POCO_ENOTSUP WSAEOPNOTSUPP #define POCO_EPFNOSUPPORT WSAEPFNOSUPPORT #define POCO_EAFNOSUPPORT WSAEAFNOSUPPORT #define POCO_EADDRINUSE WSAEADDRINUSE #define POCO_EADDRNOTAVAIL WSAEADDRNOTAVAIL #define POCO_ENETDOWN WSAENETDOWN #define POCO_ENETUNREACH WSAENETUNREACH #define POCO_ENETRESET WSAENETRESET #define POCO_ECONNABORTED WSAECONNABORTED #define POCO_ECONNRESET WSAECONNRESET #define POCO_ENOBUFS WSAENOBUFS #define POCO_EISCONN WSAEISCONN #define POCO_ENOTCONN WSAENOTCONN #define POCO_ESHUTDOWN WSAESHUTDOWN #define POCO_ETIMEDOUT WSAETIMEDOUT #define POCO_ECONNREFUSED WSAECONNREFUSED #define POCO_EHOSTDOWN WSAEHOSTDOWN #define POCO_EHOSTUNREACH WSAEHOSTUNREACH #define POCO_ESYSNOTREADY WSASYSNOTREADY #define POCO_ENOTINIT WSANOTINITIALISED #define POCO_HOST_NOT_FOUND WSAHOST_NOT_FOUND #define POCO_TRY_AGAIN WSATRY_AGAIN #define POCO_NO_RECOVERY WSANO_RECOVERY #define POCO_NO_DATA WSANO_DATA #elif defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_VMS) #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #if POCO_OS != POCO_OS_HPUX #include <sys/select.h> #endif #include <sys/ioctl.h> #if defined(POCO_OS_FAMILY_VMS) #include <inet.h> #else #include <arpa/inet.h> #endif #include <netinet/in.h> #include <netinet/tcp.h> #include <netdb.h> #if defined(POCO_OS_FAMILY_UNIX) #include <net/if.h> #endif #if defined(sun) || defined(__APPLE__) #include <sys/sockio.h> #include <sys/filio.h> #endif #define POCO_INVALID_SOCKET -1 #define poco_socket_t int #define poco_socklen_t socklen_t #define poco_closesocket(s) ::close(s) #define POCO_EINTR EINTR #define POCO_EACCES EACCES #define POCO_EFAULT EFAULT #define POCO_EINVAL EINVAL #define POCO_EMFILE EMFILE #define POCO_EAGAIN EAGAIN #define POCO_EWOULDBLOCK EWOULDBLOCK #define POCO_EINPROGRESS EINPROGRESS #define POCO_EALREADY EALREADY #define POCO_ENOTSOCK ENOTSOCK #define POCO_EDESTADDRREQ EDESTADDRREQ #define POCO_EMSGSIZE EMSGSIZE #define POCO_EPROTOTYPE EPROTOTYPE #define POCO_ENOPROTOOPT ENOPROTOOPT #define POCO_EPROTONOSUPPORT EPROTONOSUPPORT #if defined(ESOCKTNOSUPPORT) #define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT #else #define POCO_ESOCKTNOSUPPORT -1 #endif #define POCO_ENOTSUP ENOTSUP #define POCO_EPFNOSUPPORT EPFNOSUPPORT #define POCO_EAFNOSUPPORT EAFNOSUPPORT #define POCO_EADDRINUSE EADDRINUSE #define POCO_EADDRNOTAVAIL EADDRNOTAVAIL #define POCO_ENETDOWN ENETDOWN #define POCO_ENETUNREACH ENETUNREACH #define POCO_ENETRESET ENETRESET #define POCO_ECONNABORTED ECONNABORTED #define POCO_ECONNRESET ECONNRESET #define POCO_ENOBUFS ENOBUFS #define POCO_EISCONN EISCONN #define POCO_ENOTCONN ENOTCONN #if defined(ESHUTDOWN) #define POCO_ESHUTDOWN ESHUTDOWN #else #define POCO_ESHUTDOWN -2 #endif #define POCO_ETIMEDOUT ETIMEDOUT #define POCO_ECONNREFUSED ECONNREFUSED #if defined(EHOSTDOWN) #define POCO_EHOSTDOWN EHOSTDOWN #else #define POCO_EHOSTDOWN -3 #endif #define POCO_EHOSTUNREACH EHOSTUNREACH #define POCO_ESYSNOTREADY -4 #define POCO_ENOTINIT -5 #define POCO_HOST_NOT_FOUND HOST_NOT_FOUND #define POCO_TRY_AGAIN TRY_AGAIN #define POCO_NO_RECOVERY NO_RECOVERY #define POCO_NO_DATA NO_DATA #endif #if defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_TRU64) || (POCO_OS == POCO_OS_AIX) || (POCO_OS == POCO_OS_IRIX) || (POCO_OS == POCO_OS_QNX) || (POCO_OS == POCO_OS_VXWORKS) #define POCO_HAVE_SALEN 1 #endif #if (POCO_OS == POCO_OS_HPUX) || (POCO_OS == POCO_OS_SOLARIS) #define POCO_BROKEN_TIMEOUTS 1 #endif #if defined(POCO_HAVE_SALEN) #define poco_set_sa_len(pSA, len) (pSA)->sa_len = (len) #define poco_set_sin_len(pSA) (pSA)->sin_len = sizeof(struct sockaddr_in) #if defined(POCO_HAVE_IPv6) #define poco_set_sin6_len(pSA) (pSA)->sin6_len = sizeof(struct sockaddr_in6) #endif #else #define poco_set_sa_len(pSA, len) (void) 0 #define poco_set_sin_len(pSA) (void) 0 #define poco_set_sin6_len(pSA) (void) 0 #endif #ifndef INADDR_NONE #define INADDR_NONE 0xFFFFFFFF #endif #endif // Net_SocketDefs_INCLUDED
17d4edb1bf8656342f6e9d76531082ba45bfb22f
0e4519d3a94157a419e56576875aec1da906f578
/DSA_DOIT/08/0812/Q12.c
85b28077df3357681ba3ed38925613b61bd11a68
[]
no_license
ivorymood/TIL
0de3b92861e345375e87d01654d1fddf940621cd
1f09e8b1f4df7c205c68eefd9ab02d17a85d140a
refs/heads/master
2021-02-23T17:30:50.406370
2020-10-02T06:43:25
2020-10-02T06:43:25
245,388,390
0
0
null
null
null
null
UHC
C
false
false
1,727
c
// 답안 소스 거의 그대로 가져옴 #include <stdio.h> #include <string.h> #include <limits.h> int _print(const char txt[], const char pat[], int txt_len, int pat_len, int pt, int pp) { int i = 0, k = 0; if (pp != pat_len - 1) printf(" "); else { printf("%2d ", pt - pp); k = pt - pp; } for (i = 0; i < txt_len; i++) printf("%c ", txt[i]); putchar('\n'); printf("%*s%c\n", pt * 2 + 4, "", (txt[pt] == pat[pp]) ? '+' : '|'); printf("%*s", (pt - pp) * 2 + 4, ""); for (i = 0; i < pat_len; i++) printf("%c ", pat[i]); printf("\n\n"); } int bm_match(const char txt[], const char pat[]) { int pt; // txt 커서 int pp; // pat 커서 int txt_len = strlen(txt); int pat_len = strlen(pat); int skip[UCHAR_MAX + 1]; // 건너뛰기 표 만들기 for (pt = 0; pt <= UCHAR_MAX; ++pt) { skip[pt] = pat_len; } for (pt = 0; pt <= pat_len - 1; pt++) { skip[pat[pt]] = pat_len - pt - 1; } // Boyer-Moore법으로 검사하기 while (pt < txt_len) { pp = pat_len - 1; while (_print(txt, pat, txt_len, pat_len, pt, pp), txt[pt] == pat[pp]) { if (pp == 0) { return pt; } pp--; pt--; } pt += (skip[txt[pt]] > pat_len - pp) ? skip[txt[pt]] : pat_len - pp; } return -1; } int main(void) { int idx; char s1[256]; /* 텍스트 */ char s2[256]; /* 패턴 */ puts("Boyer-Moore법"); printf("텍스트 : "); scanf_s("%s", s1, 256); printf("패턴 : "); scanf_s("%s", s2, 256); idx = bm_match(s1, s2); /* 문자열 s1에서 문자열 s2를 Boyer-Moore법을 사용해 검색합니다. */ if (idx == -1) { puts("텍스트에 패턴이 없습니다."); } else { printf("%d번째 문자부터 match합니다.\n", idx + 1); } return 0; }
454b39b7d60dbb86f5aedab2321e9c600ebb2071
e60547640edc55a41013b2fc0692a83b574e1c88
/conf/conf_ja2104.h
efad6db6bcca389e2bce08f444cd562224baf55b
[]
no_license
shiv50084/hidvr-git
62eb4eb123866edc7bf7375a8470b13470802996
964b61408f8c0a3751eeaa168c600ef9735073aa
refs/heads/master
2021-03-23T19:55:00.073788
2015-09-02T08:39:16
2015-09-02T08:39:16
null
0
0
null
null
null
null
UTF-8
C
false
false
1,408
h
#ifndef __MODEL_CONF_H__ #define __MODEL_CONF_H__ #include "version.h" #include "ui_sel.h" #define _JA2104 #define SN_HEAD "I6" #define _EXT_EFFIO #define SDK_PLATFORM_HI3521 #define _HI3520A_EXT #define GPIO_PLAT_TYPE6 #define GPIO_KEYPAD_MATRIX #define HD_DISPLAY_SIZE_OPTIMISED #define HWVER_MAJ (1) #define HWVER_MIN (0) #define HWVER_REV (0) #define HWVER_EXT "" #define MAX_REF_CH (32) #define MAX_CAM_CH (4) #define ALL_CAM_BITMASK (0xf) #define MAX_AUD_CH (2) #define ALL_AUD_BITMASK (0x3) #define MAX_SENSOR_CH (4) #define ALL_SENSOR_BITMASK (0xf) #define MAX_ALARM_CH (1) #define ALL_ALARM_BITMASK (0x1) #define MAX_HDD_CNT (4) #define MAX_TELECTRL_CH (4) #define MAX_CIF_CNT (4) #define MAX_D1_CNT (4) #define MAX_D1_LIVE_FPS (30) #define MAX_CIF_LIVE_FPS (30) #define MAX_D1_ENC_FPS (30) #define MAX_CIF_ENC_FPS (30) #define MAX_NET_ENC_FPS (16) #define MAX_D1_ENC_BPS (2048) #define MAX_CIF_ENC_BPS (512) #define MAX_ENC_CH (4) #define MAX_DEC_CH (4) #define MAX_PLAYBACK_CH (4) #if defined(_EXT_JUANOEM) #define FIRMWARE_MAGIC "JUAN HI3521 JA-R2104 FIRMWARE COPYRIGHT BY JUAN" #define FIRMWARE_FILE_NAME_PREFIX "FWHJ2104_" #else #define FIRMWARE_MAGIC "JUAN HI3521 JA2104 FIRMWARE DESIGNED BY LAW" #define FIRMWARE_FILE_NAME_PREFIX "FWHI2104_" #endif #define DEVICE_FEATURE_NO "112226" #endif //__MODEL_CONF_H__
e66f3f10d37640da8b352570f96509088f0589ba
a3c604effcb34c7a9594a7a37e2ec618aab4c74f
/reference/cvs/jul285/news/c_news.h
32ef78312083a2509e258818a0f1c2f22a861694
[]
no_license
jvonwimm/aleph64bit
09d9d48db51ed8c5f868b5409c6b7a78bfff8e6f
a779f00fd147a2fd3b1f81e0d65ca09509045c88
refs/heads/main
2023-02-04T06:10:49.338430
2020-12-16T00:59:48
2020-12-16T00:59:48
301,156,974
0
2
null
null
null
null
UTF-8
C
false
false
686
h
C! 1st entry in C_SET ! JULIA 280 CFPNMP, CRCJOB, CTHCLU : replace WRITE(6, by WRITE(IW(6), (H. Drevermann, Feb 96) CTKCHG : opening "'" should have a closing "'" within the same line for cvs (F. Ranjard, Feb 96) * corr file 279.1 CASHET : remove comments after *CA for LIGHT (P. Comas, Nov 95) ! JULIA 279 ! JULIA 275 CDANG : restrict COMN1 to [-1.,1.] to avoid precision problems (P. Comas, 18-OCT-1994) CTRPAR : avoid division by zero: no need to step in the helix if STEP = 0 (A. Bonissant,P. Comas, 29-SEP-1994) ! JULIA 272 CINIJO : define POT name-indices even when no output file is required
639b274c34757b192706be28a8398628a174fb8a
21c09799d006ed6bede4123d57d6d54d977c0b63
/fits_2018_10/PFNo11Dijet2017bbCSVv22b152Scan/corrHist.C
2b4fb8905a3381ca61fe0b178cc84874c1c365bb
[]
no_license
corvettettt/DijetRootTreeAnalyzer
68cb12e6b280957e1eb22c9842b0b9b30ae2c779
e65624ffc105798209436fc80fb82e2c252c6344
refs/heads/master
2021-05-06T09:57:12.816787
2019-04-18T15:32:38
2019-04-18T15:32:38
114,043,763
1
0
null
2017-12-12T22:02:46
2017-12-12T22:02:46
null
UTF-8
C
false
false
4,902
c
void corrHist() { //=========Macro generated from canvas: c/c //========= (Fri Dec 14 08:46:12 2018) by ROOT version6.02/05 TCanvas *c = new TCanvas("c", "c",0,0,500,500); gStyle->SetOptStat(0); c->SetHighLightColor(2); c->Range(-0.5333333,-0.5,4.8,4.5); c->SetFillColor(0); c->SetBorderMode(0); c->SetBorderSize(2); c->SetRightMargin(0.15); c->SetFrameBorderMode(0); c->SetFrameBorderMode(0); TH2D *correlation_matrix = new TH2D("correlation_matrix","correlation_matrix",4,0,4,4,0,4); correlation_matrix->SetBinContent(8,-0.9808662); correlation_matrix->SetBinContent(9,0.9985653); correlation_matrix->SetBinContent(10,1); correlation_matrix->SetBinContent(14,-0.9896813); correlation_matrix->SetBinContent(15,1); correlation_matrix->SetBinContent(16,0.9985653); correlation_matrix->SetBinContent(20,1); correlation_matrix->SetBinContent(21,-0.9896813); correlation_matrix->SetBinContent(22,-0.9808662); correlation_matrix->SetBinContent(25,1); correlation_matrix->SetBinError(8,0.9808662); correlation_matrix->SetBinError(9,0.9985653); correlation_matrix->SetBinError(10,1); correlation_matrix->SetBinError(14,0.9896813); correlation_matrix->SetBinError(15,1); correlation_matrix->SetBinError(16,0.9985653); correlation_matrix->SetBinError(20,1); correlation_matrix->SetBinError(21,0.9896813); correlation_matrix->SetBinError(22,0.9808662); correlation_matrix->SetBinError(25,1); correlation_matrix->SetMinimum(-1); correlation_matrix->SetMaximum(1); correlation_matrix->SetEntries(16); correlation_matrix->SetStats(0); correlation_matrix->SetContour(20); correlation_matrix->SetContourLevel(0,-1); correlation_matrix->SetContourLevel(1,-0.9); correlation_matrix->SetContourLevel(2,-0.8); correlation_matrix->SetContourLevel(3,-0.7); correlation_matrix->SetContourLevel(4,-0.6); correlation_matrix->SetContourLevel(5,-0.5); correlation_matrix->SetContourLevel(6,-0.4); correlation_matrix->SetContourLevel(7,-0.3); correlation_matrix->SetContourLevel(8,-0.2); correlation_matrix->SetContourLevel(9,-0.1); correlation_matrix->SetContourLevel(10,0); correlation_matrix->SetContourLevel(11,0.1); correlation_matrix->SetContourLevel(12,0.2); correlation_matrix->SetContourLevel(13,0.3); correlation_matrix->SetContourLevel(14,0.4); correlation_matrix->SetContourLevel(15,0.5); correlation_matrix->SetContourLevel(16,0.6); correlation_matrix->SetContourLevel(17,0.7); correlation_matrix->SetContourLevel(18,0.8); correlation_matrix->SetContourLevel(19,0.9); TPaletteAxis *palette = new TPaletteAxis(4.026667,0,4.266667,4,correlation_matrix); palette->SetLabelColor(1); palette->SetLabelFont(42); palette->SetLabelOffset(0.005); palette->SetLabelSize(0.035); palette->SetTitleOffset(1); palette->SetTitleSize(0.035); palette->SetFillColor(100); palette->SetFillStyle(1001); correlation_matrix->GetListOfFunctions()->Add(palette,"br"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); correlation_matrix->SetLineColor(ci); correlation_matrix->GetXaxis()->SetBinLabel(1,"Ntot_bkg_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetXaxis()->SetBinLabel(2,"p1_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetXaxis()->SetBinLabel(3,"p2_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetXaxis()->SetBinLabel(4,"p3_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetXaxis()->SetLabelFont(42); correlation_matrix->GetXaxis()->SetLabelSize(0.035); correlation_matrix->GetXaxis()->SetTitleSize(0.035); correlation_matrix->GetXaxis()->SetTitleFont(42); correlation_matrix->GetYaxis()->SetBinLabel(4,"Ntot_bkg_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetYaxis()->SetBinLabel(3,"p1_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetYaxis()->SetBinLabel(2,"p2_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetYaxis()->SetBinLabel(1,"p3_PFNo11Dijet2017bbCSVv22b152"); correlation_matrix->GetYaxis()->SetLabelFont(42); correlation_matrix->GetYaxis()->SetLabelSize(0.035); correlation_matrix->GetYaxis()->SetTitleSize(0.035); correlation_matrix->GetYaxis()->SetTitleFont(42); correlation_matrix->GetZaxis()->SetLabelFont(42); correlation_matrix->GetZaxis()->SetLabelSize(0.035); correlation_matrix->GetZaxis()->SetTitleSize(0.035); correlation_matrix->GetZaxis()->SetTitleFont(42); correlation_matrix->Draw("colztext"); TPaveText *pt = new TPaveText(0.2793145,0.9365254,0.7206855,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("correlation_matrix"); pt->Draw(); c->Modified(); c->cd(); c->SetSelected(c); }
bd8bced730e1d7692fe970567316d5ec050ce194
a86995a16ba2e574376c882c3a9eead8143dd4f8
/STM32Cube_FW_F4_V1.9.0/Drivers/BSP/STM324xG_EVAL/stm324xg_eval_ts.c
98c4f8d24ba44baf62f9dc28686b024198b2ce01
[]
no_license
umapathiuit/Stm32-Tools-Evaluation
ded5f569677c8e9cbe708a57b5db19780a86fd6c
e9fd061f48f50501606bc237c6773c2b6c28d345
refs/heads/master
2020-12-02T17:11:19.014644
2015-11-23T07:45:38
2015-11-23T07:45:38
null
0
0
null
null
null
null
UTF-8
C
false
false
7,529
c
/** ****************************************************************************** * @file stm324xg_eval_ts.c * @author MCD Application Team * @version V2.1.0 * @date 14-August-2015 * @brief This file provides a set of functions needed to manage the touch * screen on STM324xG-EVAL evaluation board. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * 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 STMicroelectronics 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 Info : ----------------------------------------------------------------- User NOTES 1. How To use this driver: -------------------------- - This driver is used to drive the touch screen module of the STM324xG-EVAL evaluation board on the ILI9325 LCD mounted on MB785 daughter board . - The STMPE811 IO expander device component driver must be included with this driver in order to run the TS module commanded by the IO expander device mounted on the evaluation board. 2. Driver description: --------------------- + Initialization steps: o Initialize the TS module using the BSP_TS_Init() function. This function includes the MSP layer hardware resources initialization and the communication layer configuration to start the TS use. The LCD size properties (x and y) are passed as parameters. o If TS interrupt mode is desired, you must configure the TS interrupt mode by calling the function BSP_TS_ITConfig(). The TS interrupt mode is generated as an external interrupt whenever a touch is detected. + Touch screen use o The touch screen state is captured whenever the function BSP_TS_GetState() is used. This function returns information about the last LCD touch occurred in the TS_StateTypeDef structure. o If TS interrupt mode is used, the function BSP_TS_ITGetStatus() is needed to get the interrupt status. To clear the IT pending bits, you should call the function BSP_TS_ITClear(). o The IT is handled using the corresponding external interrupt IRQ handler, the user IT callback treatment is implemented on the same external interrupt callback. ------------------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/ #include "stm324xg_eval_ts.h" /** @addtogroup BSP * @{ */ /** @addtogroup STM324xG_EVAL * @{ */ /** @defgroup STM324xG_EVAL_TS * @{ */ /** @defgroup STM324xG_EVAL_TS_Private_Types_Definitions * @{ */ /** * @} */ /** @defgroup STM324xG_EVAL_TS_Private_Defines * @{ */ /** * @} */ /** @defgroup STM324xG_EVAL_TS_Private_Macros * @{ */ /** * @} */ /** @defgroup STM324xG_EVAL_TS_Private_Variables * @{ */ static TS_DrvTypeDef *ts_driver; static uint16_t ts_x_boundary, ts_y_boundary; static uint8_t ts_orientation; /** * @} */ /** @defgroup STM324xG_EVAL_TS_Private_Function_Prototypes * @{ */ /** * @} */ /** @defgroup STM324xG_EVAL_TS_Private_Functions * @{ */ /** * @brief Initializes and configures the touch screen functionalities and * configures all necessary hardware resources (GPIOs, clocks..). * @param xSize: Maximum X size of the TS area on LCD * ySize: Maximum Y size of the TS area on LCD * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_Init(uint16_t xSize, uint16_t ySize) { uint8_t ret = TS_ERROR; if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID) { /* Initialize the TS driver structure */ ts_driver = &stmpe811_ts_drv; /* Initialize x and y positions boundaries */ ts_x_boundary = xSize; ts_y_boundary = ySize; ts_orientation = TS_SWAP_XY; ret = TS_OK; } if(ret == TS_OK) { /* Initialize the LL TS Driver */ ts_driver->Init(TS_I2C_ADDRESS); ts_driver->Start(TS_I2C_ADDRESS); } return ret; } /** * @brief Configures and enables the touch screen interrupts. * @param None * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_ITConfig(void) { /* Call component driver to enable TS ITs */ ts_driver->EnableIT(TS_I2C_ADDRESS); return TS_OK; } /** * @brief Gets the touch screen interrupt status. * @param None * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_ITGetStatus(void) { /* Call component driver to enable TS ITs */ return (ts_driver->GetITStatus(TS_I2C_ADDRESS)); } /** * @brief Returns status and positions of the touch screen. * @param TS_State: Pointer to touch screen current state structure * @retval TS_OK if all initializations are OK. Other value if error. */ uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State) { static uint32_t _x = 0, _y = 0; uint16_t xDiff, yDiff , x , y; uint16_t swap; TS_State->TouchDetected = ts_driver->DetectTouch(TS_I2C_ADDRESS); if(TS_State->TouchDetected) { ts_driver->GetXY(TS_I2C_ADDRESS, &x, &y); if(ts_orientation & TS_SWAP_X) { x = 4096 - x; } if(ts_orientation & TS_SWAP_Y) { y = 4096 - y; } if(ts_orientation & TS_SWAP_XY) { swap = y; y = x; x = swap; } xDiff = x > _x? (x - _x): (_x - x); yDiff = y > _y? (y - _y): (_y - y); if (xDiff + yDiff > 5) { _x = x; _y = y; } TS_State->x = (ts_x_boundary * _x) >> 12; TS_State->y = (ts_y_boundary * _y) >> 12; } return TS_OK; } /** * @brief Clears all touch screen interrupts. * @param None * @retval None */ void BSP_TS_ITClear(void) { ts_driver->ClearIT(TS_I2C_ADDRESS); } /** * @} */ /** * @} */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
455c609576cffc589fdf41b6f52cece5dd8ab1aa
0b12d6110fe8a54ccb3829f69707a229bfb35282
/naruto/daemon/condition/iceball_cd.c
94ffbc51b4bb02f5338ef7263597759ac56ca5d4
[]
no_license
MudRen/mudos-game-naruto
b8f913deba70f7629c0bab117521508d1393e3b6
000f286645e810e1cd786130c52d7b9c1747cae8
refs/heads/master
2023-09-04T05:49:01.137753
2023-08-28T12:19:10
2023-08-28T12:19:10
245,764,270
1
0
null
2020-03-08T06:29:36
2020-03-08T06:29:36
null
BIG5
C
false
false
467
c
// 冰封球的短CD #include <ansi.h> inherit CONDITION; private void create() { seteuid(getuid()); DAEMON_D->register_condition_daemon("iceball_cd"); } // 每 update 一次 消秏時效一點.. void condition_update(object me, string cnd, mixed cnd_data) { if( !mapp(cnd_data) || (cnd_data["duration"]--) < 1 ) { tell_object(me, NOR"[冰念匯集完畢。]\n"NOR); me->delete_condition(cnd); return; } }
56f6003141a09be1c1df35dc380b5e3586a8ec3c
3ff6aa2fce1d0c0d98d2c0cc521204f5e22d5402
/include/linux/minix_fs.h
fcdb105857f04005f2f4bd36097856ba83e81cb5
[ "MIT" ]
permissive
davitkalantaryan/wlac2
1c59c513db49d5c1594bf5246ec2f018ea0cd7e4
6ec0f88b04407a801c2bf4456044d6a86d589a3a
refs/heads/master
2023-04-13T07:25:58.068081
2023-03-15T14:33:14
2023-03-15T14:33:14
199,640,620
0
0
null
2023-03-15T14:33:16
2019-07-30T11:42:58
C
UTF-8
C
false
false
524
h
// // (c) 2015-2018 WLAC. For details refers to LICENSE.md // /* * File: <linux/minix_f.h> For WINDOWS MFC * * Created on: Sep 23, 2016 * Author : Davit Kalantaryan (Email: [email protected]) * * */ #ifndef __linux_minix_fs_h__ #define __linux_minix_fs_h__ #include <first_includes/common_include_for_headers.h> #include <sdef_gem_windows.h> __BEGIN_C_DECLS //GEM_API_FAR int semget(key_t key, int nsems, int semflg); __END_C_DECLS #endif // #ifndef __linux_minix_fs_h__
896db9f54aa801d054e5baf70bb6231f4f78cddc
5c255f911786e984286b1f7a4e6091a68419d049
/code/0896109a-1953-41b9-941a-83b145890a08.c
23b80ac70c54ecfe00a39a5adc1a7bbf21ec0950
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
253
c
#include <stdio.h> int main() { int i=4; int j=14; int k; int l; k = 53; l = 54; k = i/j; l = i/j; l = i/j; l = l/j; l = i%j; l = l%j; k = k-k*i; printf("vulnerability"); printf("%d%d\n",k,l); return 0; }
86ac8a7a1318cf6f4309af01e9531c4c414c7dd6
aa0411560b7c406c77bafb5ce0857c309916fa0d
/KernighanAndRitchie_2019/chapterFour/queue.c
901c1c8ede15dc442ce55957df29868c992cd28b
[]
no_license
sumedh105/CPrograms
9f0c317ff7723e450aeac7cff34ab79e4c7e3755
5ead5a7565ded6582a0e972b03f5b9d774d16b49
refs/heads/master
2021-07-16T01:04:38.961129
2020-05-22T19:01:08
2020-05-22T19:01:08
141,177,327
0
0
null
null
null
null
UTF-8
C
false
false
1,335
c
#include <stdio.h> #include <stdlib.h> #define MAXVAL 50 void enqueue(int); int dequeue(); void display(); int queue[MAXVAL] = {0}; int queueBottom = 0; int queueTop = 0; int main() { int choice = 0; int num = 0; int result = 0; while (1) { printf("\nEnter the choice\n"); printf("\n1. Enqueue\n"); printf("\n2. Dequeue\n"); printf("\n3. Display\n"); printf("\n4. Exit\n"); scanf("%d", &choice); switch (choice) { case 1: printf("\nEnter the number to be enqueued\n"); scanf("%d", &num); enqueue(num); break; case 2: result = dequeue(); printf("\nThe dequeued element is: %d\n", result); break; case 3: display(); break; case 4: exit(0); break; default: break; } } return 0; } void enqueue(int num) { if (queueTop <= MAXVAL) { queue[queueTop++] = num; } else { printf("\nerror: the queue is full, cannot push the element in a queue\n"); } } int dequeue() { int num; if (queueBottom <= queueTop) { num = queue[queueBottom++]; return num; } else { printf("\nerror: cannot dequeue an element, the queue is empty\n"); } } void display() { int index = 0; printf("\nThe queue contents are:\n"); for (index = queueBottom; index < queueTop; ++index) { printf("\nqueue[%d]: %d\n", index, queue[index]); } }
db920e5fa228e664d93d38b90576ef9932a9de65
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/tools/testing/selftests/x86/extr_ioperm.c_clearhandler.c
a9c5eadd3386092167bb12ba0db67722d501f2b3
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
998
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sigaction {int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ; typedef int /*<<< orphan*/ sa ; /* Variables and functions */ int /*<<< orphan*/ SIG_DFL ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ memset (struct sigaction*,int /*<<< orphan*/ ,int) ; scalar_t__ sigaction (int,struct sigaction*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ; __attribute__((used)) static void clearhandler(int sig) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_DFL; sigemptyset(&sa.sa_mask); if (sigaction(sig, &sa, 0)) err(1, "sigaction"); }
63b35b971721603543839786e8640c38251131ef
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14055/function14055_schedule_6/function14055_schedule_6_wrapper.h
ac78535d26e3466ce7daaaee360bcd5392692c66
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C
false
false
447
h
#ifndef HALIDE__generated_function14055_schedule_6_h #define HALIDE__generated_function14055_schedule_6_h #include <tiramisu/utils.h> #ifdef __cplusplus extern "C" { #endif int function14055_schedule_6(halide_buffer_t *buf00, halide_buffer_t *buf01, halide_buffer_t *buf02, halide_buffer_t *buf03, halide_buffer_t *buf04, halide_buffer_t *buf05, halide_buffer_t *buf06, halide_buffer_t *buf0); #ifdef __cplusplus } // extern "C" #endif #endif
e8c2ea61b0cd005af031bdb5b6a2a0c1c0a628b3
68dfc747d9fdfe7b9c083f74bd084e86d5b16802
/old_DISCOVERY_STemWIN_MH_Z19/string.c
0a0c14ff3203760226a33f5db623f19f7019c0c2
[]
no_license
EvgenyDD/DISCOVERY_STemWIN_Prj
82a526fd2aba5e75bfd07b255abc2cfe585d8376
515b391baa34fc9bbf540e8b9ba3ad8b94e2d003
refs/heads/master
2021-01-26T07:14:54.756820
2020-05-30T12:17:12
2020-05-30T12:17:12
243,360,378
0
0
null
null
null
null
UTF-8
C
false
false
6,301
c
/* Includes ------------------------------------------------------------------*/ #include "string.h" #include "stm32f4xx.h" //#include "math_.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Extern variables ----------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : strlen * Description : calculating length of the string * Input : pointer to text string * Return : string length *******************************************************************************/ int strlen(char *pText) { int len = 0; for(; *pText != '\0'; pText++, len++) ; return len; } /******************************************************************************* * Function Name : strlenNum * Description : calculating length of the string * Input : pointer to text string * Return : string length *******************************************************************************/ int strlenNum(char *pText, int begin) { int len = 0; pText += begin; for(; *pText != '\0'; pText++, len++) ; return len; } /******************************************************************************* * Function Name : itoa * Description : Convert int to char * Input : int number (signed/unsigned) * Return : pointer to text string *******************************************************************************/ void itoa_(int n, char s[]) { int sign; if((sign = n) < 0) n = -n; int i = 0; do { s[i++] = n % 10 + '0'; } while((n /= 10) > 0); if(sign < 0) s[i++] = '-'; s[i] = '\0'; reverse(s); } /******************************************************************************* * Function Name : itoa * Description : Convert int to char * Input : int number (signed/unsigned) * Return : pointer to text string *******************************************************************************/ void dtoa_(uint32_t n, char s[]) { int sign; if((sign = n) < 0) n = -n; int i = 0; do { s[i++] = n % 10 + '0'; } while((n /= 10) > 0); if(sign < 0) s[i++] = '-'; s[i] = '\0'; reverse(s); } /******************************************************************************* * Function Name : ftoa_ * Description : Convert float to char * Input : float number, char, output precision * Return : pointer to text string *******************************************************************************/ void ftoa_(float num, char str[], char precision) { unsigned char zeroFlag = 0; int digit = 0, reminder = 0; long wt = 0; if(num < 0) { num = -num; zeroFlag = 1; } int whole_part = num; int log_value = log10_(num), index = log_value; if(zeroFlag) str[0] = '-'; //Extract the whole part from float num for(int i = 1; i < log_value + 2; i++) { wt = pow_(10.0, i); reminder = whole_part % wt; digit = (reminder - digit) / (wt / 10); //Store digit in string str[index-- + zeroFlag] = digit + 48; // ASCII value of digit = digit + 48 if(index == -1) break; } index = log_value + 1; str[index + zeroFlag] = '.'; float fraction_part = num - whole_part; float tmp1 = fraction_part, tmp = 0; //Extract the fraction part from number for(int i = 1; i <= precision; i++) { wt = 10; tmp = tmp1 * wt; digit = tmp; //Store digit in string str[++index + zeroFlag] = digit + 48; // ASCII value of digit = digit + 48 tmp1 = tmp - digit; } str[++index + zeroFlag] = '\0'; } /******************************************************************************* * Function Name : reverse * Description : Reverses string * Input : pointer to string *******************************************************************************/ void reverse(char s[]) { int c, i, j; for(i = 0, j = strlen(s) - 1; i < j; i++, j--) { c = s[i]; s[i] = s[j]; s[j] = c; } } /******************************************************************************* * Function Name : strcat * Description : add * Input : pointer to string *******************************************************************************/ void strcat_(char first[], char second[]) { int i = 0, j = 0; while(first[i] != '\0') i++; while((first[i++] = second[j++]) != '\0') ; } /******************************************************************************* * Function Name : strcat * Description : add * Input : pointer to string *******************************************************************************/ void strcatNum(char first[], char second[], int begin, int end) { if(begin >= end) return; int i = 0, j = begin; while(j != end) { first[i++] = second[j++]; } first[i] = '\0'; } /******************************************************************************* * Function Name : pow_ * Description : Power x in y *******************************************************************************/ float pow_(float x, float y) { double result = 1; for(int i = 0; i < y; i++) result *= x; return result; } /******************************************************************************* * Function Name : log10_ *******************************************************************************/ float log10_(int v) { return (v >= 1000000000u) ? 9 : (v >= 100000000u) ? 8 : (v >= 10000000u) ? 7 : (v >= 1000000u) ? 6 : (v >= 100000u) ? 5 : (v >= 10000u) ? 4 : (v >= 1000u) ? 3 : (v >= 100u) ? 2 : (v >= 10u) ? 1u : 0u; }
e35e13cb240006a64c96e8aaa637c9cb79733f59
e4215c48c60ddb959fd045dbd5f51644b527355c
/mongoose/challenge/src/controller/lib/mymath.h
1fe14af553f8683dddc28a82eaacc5f40a5d1166
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
brytemorio/hackasat-qualifier-2021
698215582a77b144b1af34feb19fc929014eb404
12458737767263a7d605e47e445c745e4d758dfd
refs/heads/main
2023-06-14T20:43:07.591213
2021-07-08T17:07:14
2021-07-08T17:11:19
null
0
0
null
null
null
null
UTF-8
C
false
false
1,283
h
/* Author: Jason Williams <[email protected]> Copyright (c) 2014 Cromulence LLC 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 __MYMATH_H__ #define __MYMATH_H__ double floor( double ); double round( double, double n ); int is_nan(double value); int is_inf(double value); #endif // __MYMATH_H__
a3974e79ea1dabccf62d347497066eb45294c367
73fe36e0b939f134b79cb1d45a0b359781f303e0
/srcs/libft/ft_putnbr.c
ae7863f7b7f98918ec2135e87a41e878033b7853
[]
no_license
l-geoffroy/42-ft-printf
8ba947aae830b989d20b1b0f250d30f0d57b95d8
693b76a2c5307f54738c3dfa415ed5529e94a001
refs/heads/main
2023-07-01T00:06:19.547849
2021-08-05T14:24:25
2021-08-05T14:24:25
387,072,963
0
0
null
null
null
null
UTF-8
C
false
false
1,155
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putnbr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lgeoffro <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/06/29 10:12:17 by lgeoffro #+# #+# */ /* Updated: 2021/08/04 11:18:52 by lgeoffro ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_putnbr(int n) { long long int nb; if (n == -2147483648) { ft_putstr("-2147483648"); return ; } nb = n; if (nb < 0) { nb = nb * -1; ft_putchar('-'); } if (nb >= 10) ft_putnbr(nb / 10); ft_putchar((nb % 10) + 48); }
ff9e592b1481329cd390475b43777d1bcfdcb7ec
dee52474971db4fcbc8696feab48ce63d141b2d3
/Orso8TeV/macro/Plotting/2J0T/corrected/myRead.C
a8bf26338ab3928ec02481f7d262f278b737aa71
[]
no_license
nadjieh/work
7de0282f3ed107e25f596fd7d0a95f21793c8d29
3c9cc0319e1ab5cd240063f6dd940872b212ddce
refs/heads/master
2016-09-01T17:34:31.112603
2014-02-07T22:43:32
2014-02-07T22:43:32
null
0
0
null
null
null
null
UTF-8
C
false
false
7,872
c
#include <iostream> #include <fstream> #include <string> using namespace std; string settitles(string s){ string ret=""; if(s == string("allW_BJet_Pt")) ret = string("p_{T}^{b-jets} (GeV)"); if(s == string("Default_allWcosTheta")) ret = string("cos(#theta_{l}*)"); if(s == string("allW_Muon_Pt")) ret = string("p_{T}^{l}"); if(s == string("EtaFwD_allWcosTheta")) ret = string("cos(#theta_{l}*)"); if(s == string("allW_FwD_Eta")) ret = string("#eta_{jet}^{FwD}"); if(s == string("allW_Jet_Pt")) ret = string("p_{T}^{jets} (GeV)"); if(s == string("allW_finalMT")) ret = string("m_{T}^{W} (GeV)"); if(s == string("allW_Met_Pt")) ret = string("E_{T}^{miss} (GeV)"); if(s == string("Default_allW_topMass")) ret = string("m_{lb#nu} (GeV)"); return ret; } string setYtitles(string s){ string ret=string("Events @ 19.4 fb^{-1}"); if(s == string("allW_Jet_Pt")) ret = string("Jets @ 19.4 fb^{-1}"); return ret; } string getlegend(){ string leg = " TLegend *leg = new TLegend(0.1516667,0.63,0.4983333,0.9516667,NULL,\"brNDC\");\n"; leg+=" leg->SetBorderSize(0);\n"; leg+=" leg->SetTextFont(62);\n"; leg+=" leg->SetTextSize(0.03);\n"; leg+=" leg->SetLineColor(1);\n"; leg+=" leg->SetLineStyle(1);\n"; leg+=" leg->SetLineWidth(1);\n"; leg+=" leg->SetFillColor(0);\n"; leg+=" leg->SetFillStyle(1001);\n"; leg+=" TLegendEntry *entry=leg->AddEntry(\"\",\"data\",\"lpf\");\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" entry->SetLineColor(1);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(1);\n"; leg+=" entry->SetMarkerStyle(20);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"t-channel\",\"lpf\");\n"; leg+=" entry->SetFillColor(2);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" entry->SetLineColor(2);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(2);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"tW-channel\",\"lpf\");\n"; leg+=" ci = TColor::GetColor(\"#ffcc00\");\n"; leg+=" entry->SetFillColor(ci);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" ci = TColor::GetColor(\"#ffcc00\");\n"; leg+=" entry->SetLineColor(ci);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(ci);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"s-channel\",\"lpf\");\n"; leg+=" entry->SetFillColor(5);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" entry->SetLineColor(5);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(5);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"t#bar{t}\",\"lpf\");\n"; leg+=" ci = TColor::GetColor(\"#cc33cc\");\n"; leg+=" entry->SetFillColor(ci);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" ci = TColor::GetColor(\"#cc33cc\");\n"; leg+=" entry->SetLineColor(ci);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(ci);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"W+Jets\",\"lpf\");\n"; leg+=" ci = TColor::GetColor(\"#0033ff\");\n"; leg+=" entry->SetFillColor(ci);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" ci = TColor::GetColor(\"#0033ff\");\n"; leg+=" entry->SetLineColor(ci);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(ci);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"#gamma^{*}/Z+Jets\",\"lpf\");\n"; leg+=" ci = TColor::GetColor(\"#00cc00\");\n"; leg+=" entry->SetFillColor(ci);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" ci = TColor::GetColor(\"#00cc00\");\n"; leg+=" entry->SetLineColor(ci);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(ci);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"\",\"QCD\",\"lpf\");\n"; leg+=" ci = TColor::GetColor(\"#663300\");\n"; leg+=" entry->SetFillColor(kGray);\n"; leg+=" entry->SetFillStyle(1001);\n"; leg+=" ci = TColor::GetColor(\"#663300\");\n"; leg+=" entry->SetLineColor(kGray);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(kGray);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(1);\n"; leg+=" entry=leg->AddEntry(\"NULL\",\"Stat. Unc.\",\"f\");\n"; leg+=" entry->SetFillColor(1);\n"; leg+=" entry->SetFillStyle(3004);\n"; leg+=" ci = TColor::GetColor(\"#000099\");\n"; leg+=" entry->SetLineColor(1);\n"; leg+=" entry->SetLineStyle(1);\n"; leg+=" entry->SetLineWidth(1);\n"; leg+=" entry->SetMarkerColor(1);\n"; leg+=" entry->SetMarkerStyle(1);\n"; leg+=" entry->SetMarkerSize(0);\n"; leg+=" entry->SetMarkerSize(0);\n"; leg+=" leg->Draw();\n"; leg+=" TLatex * tex = new TLatex(0.27,0.9684385,\"CMS preliminary, 19.4 fb^{-1} at #sqrt{s} = 8 TeV\");\n"; leg+=" tex->SetNDC();\n"; leg+=" tex->SetTextSize(0.03156146);\n"; leg+=" tex->SetLineWidth(2);\n"; leg+=" tex->Draw();\n"; leg+=" c->Modified();\n"; leg+=" c->cd();\n"; leg+=" c->SetSelected(c);\n}\n"; return leg; } void myRead(string s,string name, double scale =1) {//"bpt_Ele.C" string line; string preline; ifstream myfile (name.c_str()); ofstream myfileOUT ((string("tmp/")+name).c_str()); int iLine = 0; //string s = "allW_BJet_Pt"; string q = "\"\""; string myLine = string(" ")+s+string("->Add(")+s+string(",")+q+string(");"); cout<<"---- "<<myLine<<endl; string errName = "Draw(\"PE1sames\");"; if (myfile.is_open()) { while ( myfile.good() ) { preline = line; getline (myfile,line); if(string(line) == (" TLatex * tex = new TLatex(0.27,0.9684385,\"CMS preliminary, 19.4 fb^{-1} at #sqrt{s} = 8 TeV\");")){ myfileOUT<<" TLatex * tex = new TLatex(0.27,0.9684385,\"CMS preliminary, 19.8 fb^{-1} at #sqrt{s} = 8 TeV\");\n"; iLine++; continue; } else if (string(line).find("->GetYaxis()->SetTitle(\"Events @ 19.4 fb^{-1}\");") > 0 && string(line).find("->GetYaxis()->SetTitle(\"Events @ 19.4 fb^{-1}\");") < string(line).size()){ int pos = string(line).find("->GetYaxis()->SetTitle(\"Events @ 19.4 fb^{-1}\");"); myfileOUT<<string(line).substr(0,pos)<<"->GetYaxis()->SetTitle(\"Events @ 19.8 fb^{-1}\");\n"; iLine++; continue; } else { myfileOUT<<line<<endl; } iLine++; } myfile.close(); myfileOUT<<"\n"<<getlegend()<<endl; myfileOUT.close(); } else cout << "Unable to open file"; } void doJob(){ double scale = 1.; myRead("Default_allWcosTheta","Ele_cosTheta_2j0tag.C",scale); myRead("Default_allWcosTheta","Mu_cosTheta_2j0tag.C",1); myRead("allW_Muon_Pt","Ele_ept_2j0t.C",scale); myRead("allW_Muon_Pt","Mu_mupt_2j0t.C",1); myRead("allW_FwD_Eta","Ele_etafwd_2j0t.C",scale); myRead("allW_FwD_Eta","Mu_etafwd_2j0t.C",1); myRead("allW_Jet_Pt","Ele_jetpt_2j0t.C",scale); myRead("allW_Jet_Pt","Mu_jetpt_2j0t.C",1); myRead("allW_finalMT","Ele_mt_2j0t.C",scale); myRead("allW_Met_Pt","Mu_met_2j0t.C",1); myRead("Default_allW_topMass","Ele_mtop_2j0t.C",scale); myRead("Default_allW_topMass","Mu_mtop_2j0t.C",1); }
1ff5470fc743a57a927a92cfe6ea22931493dd9d
de8c0ea84980b6d9bb6e3e23b87e6066a65f4995
/3pp/linux/arch/sh/include/cpu-common/cpu/timer.h
af51438755e003aacb3d9309cb4d6db46ef13eef
[ "MIT", "Linux-syscall-note", "GPL-2.0-only" ]
permissive
eerimoq/monolinux-example-project
7cc19c6fc179a6d1fd3ec60f383f906b727e6715
57c4c2928b11cc04db59fb5ced962762099a9895
refs/heads/master
2021-02-08T10:57:58.215466
2020-07-02T08:04:25
2020-07-02T08:04:25
244,144,570
6
0
MIT
2020-07-02T08:15:50
2020-03-01T12:24:47
C
UTF-8
C
false
false
161
h
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_CPU_SH2_TIMER_H #define __ASM_CPU_SH2_TIMER_H /* Nothing needed yet */ #endif /* __ASM_CPU_SH2_TIMER_H */
5d1c9abf4caf3854ef0f27ed8d487d504f434b28
3973a5708e3330302d1fb0d54baaa5391872f20e
/include/slices.h
c7f9a1f3f18f378fed0435a360c1c04f52c80285
[]
no_license
smealum/ludum34
0fc2bc8060e1045588f091fc40a29806bcd0e76b
fdd11699e9bef4fa981908d2ce305a92ee594fc8
refs/heads/master
2021-01-15T08:57:41.927636
2015-12-15T20:41:06
2015-12-15T20:41:06
47,804,124
24
2
null
2015-12-14T03:35:21
2015-12-11T04:01:53
C++
UTF-8
C
false
false
290
h
#ifndef SLICES_H #define SLICES_H #define LEVEL_WIDTH (9) #define LEVEL_NUMLAYERS (3) typedef unsigned int cubeProperties_t; typedef struct { unsigned char data[LEVEL_WIDTH][LEVEL_WIDTH]; }slice_s; void rotateSlice(slice_s* dst, slice_s* src, int orientation); #endif
9d100039dc921a4ad20e15e201fa9c414ac6cc88
4d9190c2926ebbd6e0751336787f90bd82441918
/Code/signals/signal.c
48601b7ffe52b9a8ef5af228397bedc2f16e58dd
[]
no_license
mohit-ingale/Operating_Systems
5aac9c0b7517e27ec13560d11bfd67a9527702a9
5fd5dc995606767d19ea3e23224c78869c56e071
refs/heads/master
2020-12-05T08:43:23.300029
2020-01-06T08:50:27
2020-01-06T08:50:27
232,060,055
0
0
null
null
null
null
UTF-8
C
false
false
442
c
#include<stdio.h> #include <signal.h> #include<string.h> #include<unistd.h> void sighandler(int signum,siginfo_t info) { printf("you think i am interrupt no!!!\n i am signal from linux\n"); } int main(int argc, char const *argv[]) { struct sigaction sa; memset(&sa,0,sizeof(sa)); sa.sa_sigaction=sighandler; sigaction(SIGUSR1,&sa,NULL); while(1) { printf("i am waiting for your signal\n"); sleep(1); } return 0; }
f8923a99b6cd3821791e437a9814b1a3070a610c
6ba22205362feb363c9103008b502d730be4d9fb
/System/Library/NanoPreferenceBundles/General/PairedUnlockSettings.bundle/PairedUnlockSettings-Structs.h
dcd353f0dc4081228490f86268cc5f99fefa13eb
[]
no_license
kasumar/iOS-9.3.3-iphoneheaders
9a4b47dd27aabf37cf237b5b6e8437fde8b3ca89
4799de2d13be2c77c5f3d0b1ef750655c0daebd9
refs/heads/master
2020-04-06T04:49:07.178532
2016-07-29T20:17:36
2016-07-29T20:17:36
null
0
0
null
null
null
null
UTF-8
C
false
false
410
h
/* * This header is generated by classdump-dyld 1.0 * on Saturday, July 30, 2016 at 2:11:10 AM Japan Standard Time * Operating System: Version 9.3.3 (Build 13G34) * Image Source: /System/Library/NanoPreferenceBundles/General/PairedUnlockSettings.bundle/PairedUnlockSettings * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ typedef struct __MKBAssertion* MKBAssertionRef;
4d0d1ac3947c91939a21fdfc8e7ac19d63189e13
a037e1cc32976d4d2cd772d9b866b5c75e9cea9f
/Temp/StagingArea/Data/il2cppOutput/t2082.h
61a9235ec6d5b280724e1c9f1361d319ecaf073b
[]
no_license
Sojex/BumbleBrigadeWithClickToKill
4e11642e5e4d23d6456ac9add86570e15e28145f
fb7c30ae13a6e10bc388315bc2dc2b6e3cf1c581
refs/heads/master
2021-01-10T15:45:59.727221
2016-03-28T17:15:18
2016-03-28T17:15:18
54,907,861
0
0
null
null
null
null
UTF-8
C
false
false
214
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> struct t442; #include "t8.h" struct t2082 : public t8 { t442 * f0; };
62e5819835b9363e3d45e03de660fbda682b4d31
5792b184e71a9de7779e0bd21b6833f8ddfdb4b5
/SysVr2.0_32000/SysVr2.0_32000/src/lib/libF77/d_log.c
3cd9cdf1a4d18fdf970108e1ee3ded00ddda793c
[]
no_license
ryanwoodsmall/oldsysv
1637a3e62bb1b9426a224e832f44a46f1e1a31d4
e68293af91e2dc39f5f29c20d7e429f9e0cabc75
refs/heads/master
2020-03-30T06:06:30.495611
2018-09-29T09:04:59
2018-09-29T09:04:59
150,839,670
7
0
null
null
null
null
UTF-8
C
false
false
821
c
/* ******************************************************************************** * Copyright (c) 1985 AT&T * * All Rights Reserved * * * * * * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T * * The copyright notice above does not evidence any actual * * or intended publication of such source code. * ******************************************************************************** */ /* @(#)d_log.c 1.2 */ double d_log(x) double *x; { double log(); return( log(*x) ); }
41153a7fa7654c7974eaaa57e153917662defbcd
446a8236fcbf15c8bc5f3387dec9a2f3e0b2eb38
/文件系统类/ATMEL FAT File System/target nand fs - 2004.5/CODE/fs 20045/POSIXFS/PERM.C
85b34b2ee2a45650e644a248effa7d7525f40913
[]
no_license
venkatarajasekhar/protocols
5e12d7e5d9b636bf7fa1a61b4232e84da664c2de
b0c5010c05029750d9e11b02f6883a083fceec3a
refs/heads/master
2020-06-21T04:59:04.461670
2013-08-08T03:22:44
2013-08-08T03:22:44
null
0
0
null
null
null
null
UTF-8
C
false
false
7,639
c
/***********************************************************************/ /* */ /* Module: perm.c */ /* Release: 2004.5 */ /* Version: 2002.0 */ /* Purpose: Implements the check and set permission functions */ /* */ /*---------------------------------------------------------------------*/ /* */ /* Copyright 2004, Blunk Microsystems */ /* ALL RIGHTS RESERVED */ /* */ /* Licensees have the non-exclusive right to use, modify, or extract */ /* this computer program for software development at a single site. */ /* This program may be resold or disseminated in executable format */ /* only. The source code may not be redistributed or resold. */ /* */ /***********************************************************************/ #include "../posix.h" #include "../include/libc/errno.h" #include "../include/fsprivate.h" /***********************************************************************/ /* Global Function Definitions */ /***********************************************************************/ /***********************************************************************/ /* SetPerm: Set permissions on a file/dir about to be created */ /* */ /* Inputs: comm_ptr = pointer to common control block */ /* mode = mode for file/directory */ /* */ /***********************************************************************/ void SetPerm(FCOM_T *comm_ptr, mode_t mode) { uid_t uid; gid_t gid; /*-------------------------------------------------------------------*/ /* Get group and user ID for current process. */ /*-------------------------------------------------------------------*/ FsGetId(&uid, &gid); /*-------------------------------------------------------------------*/ /* Set the permission mode. */ /*-------------------------------------------------------------------*/ comm_ptr->mode = mode; /*-------------------------------------------------------------------*/ /* Set user and group ID. */ /*-------------------------------------------------------------------*/ comm_ptr->user_id = uid; comm_ptr->group_id = gid; } /***********************************************************************/ /* CheckPerm: Check permissions on existing file or directory */ /* */ /* Inputs: comm_ptr = pointer to common control block */ /* permissions = permissions to check for file/dir */ /* */ /* Returns: 0 if permissions match, -1 otherwise */ /* */ /***********************************************************************/ int CheckPerm(FCOM_T *comm_ptr, int permissions) { uid_t uid; gid_t gid; /*-------------------------------------------------------------------*/ /* Get group and user ID for current process. */ /*-------------------------------------------------------------------*/ FsGetId(&uid, &gid); /*-------------------------------------------------------------------*/ /* Check if we need to look at read permissions. */ /*-------------------------------------------------------------------*/ if (permissions & F_READ) { /*-----------------------------------------------------------------*/ /* If other has no read permission, check group. */ /*-----------------------------------------------------------------*/ if ((comm_ptr->mode & S_IROTH) == FALSE) { /*---------------------------------------------------------------*/ /* If not in group or group has no read permission, check owner. */ /*---------------------------------------------------------------*/ if ((gid != comm_ptr->group_id) || !(comm_ptr->mode & S_IRGRP)) { /*-------------------------------------------------------------*/ /* If not user or user has no read permissions, return error. */ /*-------------------------------------------------------------*/ if ((uid != comm_ptr->user_id) || !(comm_ptr->mode & S_IRUSR)) { set_errno(EACCES); return -1; } } } } /*-------------------------------------------------------------------*/ /* Check if we need to look at write permissions. */ /*-------------------------------------------------------------------*/ if (permissions & F_WRITE) { /*-----------------------------------------------------------------*/ /* If other has no write permission, check group. */ /*-----------------------------------------------------------------*/ if ((comm_ptr->mode & S_IWOTH) == 0) { /*---------------------------------------------------------------*/ /* If not in group or group has no write permission, check owner.*/ /*---------------------------------------------------------------*/ if ((gid != comm_ptr->group_id) || !(comm_ptr->mode & S_IWGRP)) { /*-------------------------------------------------------------*/ /* If not user or user has no write permissions, return error. */ /*-------------------------------------------------------------*/ if ((uid != comm_ptr->user_id) || !(comm_ptr->mode & S_IWUSR)) { set_errno(EACCES); return -1; } } } } /*-------------------------------------------------------------------*/ /* Check if we need to look at execute permissions. */ /*-------------------------------------------------------------------*/ if (permissions & F_EXECUTE) { /*-----------------------------------------------------------------*/ /* If other has no execute permission, check group. */ /*-----------------------------------------------------------------*/ if ((comm_ptr->mode & S_IXOTH) == 0) { /*---------------------------------------------------------------*/ /* If not in group or group can't execute, check owner. */ /*---------------------------------------------------------------*/ if ((gid != comm_ptr->group_id) || !(comm_ptr->mode & S_IXGRP)) { /*-------------------------------------------------------------*/ /* If not user or user can't execute, return error. */ /*-------------------------------------------------------------*/ if ((uid != comm_ptr->user_id) || !(comm_ptr->mode & S_IXUSR)) { set_errno(EACCES); return -1; } } } } return 0; }
60a33d8227af14b859835a0b0546df2e8a3287c4
d321f4a07566c87ed3aa0d8ade58e8ea6b2399e5
/9-binary_tree_height.c
a0008af1ef250581b8b839b64a9f670eea56adf2
[]
no_license
JHS1790/binary_trees
2650d12225e2e835f8046c1ee7e6b555b4856b3e
89a1de18cc4c88a2d99daa957bedd2c71c57334b
refs/heads/main
2023-01-15T05:36:46.931683
2020-11-24T17:37:32
2020-11-24T17:37:32
314,295,097
0
0
null
null
null
null
UTF-8
C
false
false
866
c
#include "binary_trees.h" /** * binary_tree_height - measures the height of a binary tree * @tree: a pointer to the root node of the tree to measure the height * Return: height but we're doing that weird 0 thing */ size_t binary_tree_height(const binary_tree_t *tree) { if (tree == NULL) return (0); return (recursiveSearch(tree) - 1); } /** * recursiveSearch - recursive function to find height * @tree: current working node * Return: actual height */ size_t recursiveSearch(const binary_tree_t *tree) { if (tree == NULL) return (0); return ( findMax( recursiveSearch(tree->left), recursiveSearch(tree->right) ) + 1 ); } /** * findMax - find the bigger of two numbers * @a: first number * @b: second number * Return: the larger of the two */ size_t findMax(size_t a, size_t b) { if (a >= b) return (a); else return (b); }
4c12c12835833a7cb324ce9ae811011b8400aa1e
943d51a06836e615d58a8888cef706d63d270a75
/DUMP/HG_Damage_Mod_classes.h
feb7e7975910205aac63347cd45a64b803c51a87
[]
no_license
hengtek/Back4BloodSDK
f1254133d004d7a5237013059d49c80f536879db
25ab4c4ce2e140b7e6b7afaac443e836802c3b2d
refs/heads/main
2023-07-05T03:23:01.152076
2021-08-15T15:03:38
2021-08-15T15:03:38
null
0
0
null
null
null
null
UTF-8
C
false
false
145
h
// BlueprintGeneratedClass HG_Damage_Mod.HG_Damage_Mod_C // Size: 0xe0 (Inherited: 0xe0) struct UHG_Damage_Mod_C : UApplyGameplayEffectMod { };
563013fb77e55a3c6e5061b8a7997006ffa8fd06
c5cb98ad5c3fa37ce761cb9b430b69e29a33141f
/clone/cloth/pink_cloth.c
e847a17b1305627f77319c1d4e672ee536980d4c
[]
no_license
cao777/mudylfy
92669b53216a520a48cf2cca49ea08d4df4999c5
266685aa486ecf0e3616db87b5bf7ad5ea4e57e4
refs/heads/master
2023-03-16T20:58:21.877729
2019-12-13T07:39:24
2019-12-13T07:39:24
null
0
0
null
null
null
null
GB18030
C
false
false
483
c
// pink_cloth.c #include <armor.h> #include <ansi.h> inherit CLOTH; void create() { set_name(MAG"粉红绸衫"NOR, ({ "pink cloth", "cloth" }) ); set_weight(1000); if( clonep() ) set_default_object(__FILE__); else { set("long", "这件粉红色的绸衫上面绣着几只黄鹊,闻起来还有一股淡香。\n"); set("unit", "件"); set("material", "cloth"); set("armor_prop/armor", 1); set("armor_prop/personality", 3); set("female_only", 1); } setup(); }
de27422bd4669c7ab7b6d7a73497f1ed5570edcc
0fbd393e538372cd77ce2de2ba7e08401127aa94
/BinaryHeap/BinaryHeap.h
30526d6f9382fc1ae09e7b4347dcee8deeedee07
[]
no_license
NoSoul/ToolsLib
3e9e90a689cb989384d94c249876ee68c58f5f21
9c6caec142c6053ce2f55734c70566ca58050d0a
refs/heads/master
2021-12-12T01:53:17.172152
2021-11-29T06:41:42
2021-11-29T06:41:42
18,164,191
0
0
null
null
null
null
UTF-8
C
false
false
1,038
h
#ifndef _BinaryHeap_H_ #define _BinaryHeap_H_ typedef int DataType_t; int DataCMP(DataType_t a, DataType_t b) { return a > b ? 1 : 0; } void BinaryHeapPush(DataType_t *array, int *len, DataType_t val) { ++(*len); int now = *len; while(now > 1 && DataCMP(val, array[now >> 1])) { array[now] = array[now >> 1]; now >>= 1; } array[now] = val; } DataType_t BinaryHeapPop(DataType_t *array, int *len) { DataType_t ret = array[1]; int now = 1, temp; while((now << 1) <= *len) { temp = now << 1; if((temp + 1) <= *len && DataCMP(array[temp + 1], array[temp])) { ++temp; } if(DataCMP(array[temp], array[*len])) { array[now] = array[temp]; } else { break; } now = temp; } array[now] = array[*len]; --(*len); return ret; } void BinaryHeapSort(DataType_t *array, int len) { while(len) { int curIdx = len; array[curIdx] = BinaryHeapPop(array, &len); } } #endif
c68c97267afce6522ad653cd7afeec7b66305d9c
882e579d0b9abea069fb9573f1c376ff3f5f7055
/v3_TMTDyn_hll_MORSE2019/Samples/Fabric/1. Passive/eom/codegen/mex/sprdmpF41/sprdmpF41_types.h
08d3efaee6aa58d8e377e010b32d498e9b7e8bde
[ "BSD-2-Clause" ]
permissive
LenhartYang/TMTDyn
f92d12d9d913a25eadac309670953ab302ffcfa2
134d89b156bdc078f6426561d1de76271f07259e
refs/heads/master
2023-03-27T12:34:16.250684
2021-03-25T13:40:01
2021-03-25T13:40:01
374,253,641
1
0
NOASSERTION
2021-06-06T02:47:07
2021-06-06T02:47:06
null
UTF-8
C
false
false
434
h
/* * Academic License - for use in teaching, academic research, and meeting * course requirements at degree granting institutions only. Not for * government, commercial, or other organizational use. * * sprdmpF41_types.h * * Code generation for function 'sprdmpF41' * */ #ifndef SPRDMPF41_TYPES_H #define SPRDMPF41_TYPES_H /* Include files */ #include "rtwtypes.h" #endif /* End of code generation (sprdmpF41_types.h) */
0c94f4e819f0116261b58db9adef2950d12d9965
a0c4ed3070ddff4503acf0593e4722140ea68026
/source/XPOS/GDI/OPENGL/TEST/CONFORM/COVGLU/D.C
4f98362a0cba8bffd1d416e347e5b3bb517c2152
[]
no_license
cjacker/windows.xp.whistler
a88e464c820fbfafa64fbc66c7f359bbc43038d7
9f43e5fef59b44e47ba1da8c2b4197f8be4d4bc8
refs/heads/master
2022-12-10T06:47:33.086704
2020-09-19T15:06:48
2020-09-19T15:06:48
299,932,617
0
1
null
2020-09-30T13:43:42
2020-09-30T13:43:41
null
UTF-8
C
false
false
1,295
c
/* ** Copyright 2000, Silicon Graphics, Inc. ** All Rights Reserved. ** ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; ** the contents of this file may not be disclosed to third parties, copied or ** duplicated in any form, in whole or in part, without the prior written ** permission of Silicon Graphics, Inc. ** ** RESTRICTED RIGHTS LEGEND: ** Use, duplication or disclosure by the Government is subject to restrictions ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - ** rights reserved under the Copyright Laws of the United States. */ #include <windows.h> #include <GL/gl.h> #include <GL/glu.h> #include "shell.h" void CallDeleteNurbsRenderer(void) { Output("gluDeleteNurbsRenderer\n"); gluDeleteNurbsRenderer(nurbObj); Output("\n"); } void CallDeleteQuadric(void) { Output("gluDeleteQuadric\n"); gluDeleteQuadric(quadObj); Output("\n"); } void CallDeleteTess(void) { Output("gluDeleteTess\n"); gluDeleteTess(tessObj); Output("\n"); } void CallDisk(void) { Output("gluDisk\n"); gluDisk(quadObj, 5.0, 10.0, 4, 5); Output("\n"); }
565f1f35c5dad564570503a0adc7eb0af606dba9
52c8ed39b32ccc7c0673278c1adea3638797c9ff
/src/arch/arm32/mach-rv1106/driver/clk-rv1106-mux.c
ba69990f1b5c4cc7a7a20b199b310ed070333491
[ "MIT" ]
permissive
xboot/xboot
0cab7b440b612aa0a4c366025598a53a7ec3adf1
6d6b93947b7fcb8c3924fedb0715c23877eedd5e
refs/heads/master
2023-08-20T05:56:25.149388
2023-07-12T07:38:29
2023-07-12T07:38:29
471,539
765
296
MIT
2023-05-25T09:39:01
2010-01-14T08:25:12
C
UTF-8
C
false
false
5,752
c
/* * driver/clk-rv1106-mux.c * * Copyright(c) 2007-2023 Jianjun Jiang <[email protected]> * Official site: http://xboot.org * Mobile phone: +86-18665388956 * QQ: 8192542 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #include <xboot.h> #include <clk/clk.h> struct clk_rv1106_mux_parent_t { char * name; int value; }; struct clk_rv1106_mux_pdata_t { virtual_addr_t virt; struct clk_rv1106_mux_parent_t * parent; int nparent; int shift; int width; }; static void clk_rv1106_mux_set_parent(struct clk_t * clk, const char * pname) { struct clk_rv1106_mux_pdata_t * pdat = (struct clk_rv1106_mux_pdata_t *)clk->priv; u32_t val; int i; for(i = 0; i < pdat->nparent; i++) { if(strcmp(pdat->parent[i].name, pname) == 0) { val = pdat->parent[i].value << pdat->shift; val |= ((1 << pdat->width) - 1) << (pdat->shift + 16); write32(pdat->virt, val); break; } } } static const char * clk_rv1106_mux_get_parent(struct clk_t * clk) { struct clk_rv1106_mux_pdata_t * pdat = (struct clk_rv1106_mux_pdata_t *)clk->priv; int val = (read32(pdat->virt) >> pdat->shift) & ((1 << pdat->width) - 1); int i; for(i = 0; i < pdat->nparent; i++) { if(pdat->parent[i].value == val) return pdat->parent[i].name; } return NULL; } static void clk_rv1106_mux_set_enable(struct clk_t * clk, bool_t enable) { } static bool_t clk_rv1106_mux_get_enable(struct clk_t * clk) { return TRUE; } static void clk_rv1106_mux_set_rate(struct clk_t * clk, u64_t prate, u64_t rate) { } static u64_t clk_rv1106_mux_get_rate(struct clk_t * clk, u64_t prate) { return prate; } static struct device_t * clk_rv1106_mux_probe(struct driver_t * drv, struct dtnode_t * n) { struct clk_rv1106_mux_pdata_t * pdat; struct clk_rv1106_mux_parent_t * parent; struct clk_t * clk; struct device_t * dev; struct dtnode_t o; virtual_addr_t virt = phys_to_virt(dt_read_address(n)); char * name = dt_read_string(n, "name", NULL); int nparent = dt_read_array_length(n, "parent"); int shift = dt_read_int(n, "shift", -1); int width = dt_read_int(n, "width", -1); int i; if(!name || (nparent <= 0) || (shift < 0) || (width <= 0)) return NULL; if(search_clk(name)) return NULL; pdat = malloc(sizeof(struct clk_rv1106_mux_pdata_t)); if(!pdat) return NULL; parent = malloc(sizeof(struct clk_rv1106_mux_parent_t) * nparent); if(!parent) { free(pdat); return NULL; } clk = malloc(sizeof(struct clk_t)); if(!clk) { free(pdat); free(parent); return NULL; } for(i = 0; i < nparent; i++) { dt_read_array_object(n, "parent", i, &o); parent[i].name = strdup(dt_read_string(&o, "name", NULL)); parent[i].value = dt_read_int(&o, "value", 0); } pdat->virt = virt; pdat->parent = parent; pdat->nparent = nparent; pdat->shift = shift; pdat->width = width; clk->name = strdup(name); clk->count = 0; clk->set_parent = clk_rv1106_mux_set_parent; clk->get_parent = clk_rv1106_mux_get_parent; clk->set_enable = clk_rv1106_mux_set_enable; clk->get_enable = clk_rv1106_mux_get_enable; clk->set_rate = clk_rv1106_mux_set_rate; clk->get_rate = clk_rv1106_mux_get_rate; clk->priv = pdat; if(!(dev = register_clk(clk, drv))) { for(i = 0; i < pdat->nparent; i++) free(pdat->parent[i].name); free(pdat->parent); free(clk->name); free(clk->priv); free(clk); return NULL; } if(dt_read_object(n, "default", &o)) { char * c = clk->name; char * p; u64_t r; int e; if((p = dt_read_string(&o, "parent", NULL)) && search_clk(p)) clk_set_parent(c, p); if((r = (u64_t)dt_read_long(&o, "rate", 0)) > 0) clk_set_rate(c, r); if((e = dt_read_bool(&o, "enable", -1)) != -1) { if(e > 0) clk_enable(c); else clk_disable(c); } } return dev; } static void clk_rv1106_mux_remove(struct device_t * dev) { struct clk_t * clk = (struct clk_t *)dev->priv; struct clk_rv1106_mux_pdata_t * pdat = (struct clk_rv1106_mux_pdata_t *)clk->priv; int i; if(clk) { unregister_clk(clk); for(i = 0; i < pdat->nparent; i++) free(pdat->parent[i].name); free(pdat->parent); free(clk->name); free(clk->priv); free(clk); } } static void clk_rv1106_mux_suspend(struct device_t * dev) { } static void clk_rv1106_mux_resume(struct device_t * dev) { } static struct driver_t clk_rv1106_mux = { .name = "clk-rv1106-mux", .probe = clk_rv1106_mux_probe, .remove = clk_rv1106_mux_remove, .suspend = clk_rv1106_mux_suspend, .resume = clk_rv1106_mux_resume, }; static __init void clk_rv1106_mux_driver_init(void) { register_driver(&clk_rv1106_mux); } static __exit void clk_rv1106_mux_driver_exit(void) { unregister_driver(&clk_rv1106_mux); } driver_initcall(clk_rv1106_mux_driver_init); driver_exitcall(clk_rv1106_mux_driver_exit);