Dataset Viewer
Auto-converted to Parquet
blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
333
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
1
143
32004cd6aee41c08905cd5b705ab6f8ff0bb6507
cdf75036c20eed12b54f9110c95588652899fa4c
/Others/atoi_2.c
1845ab7cbe713cde67484b57a0fe4dd8bbf74bd5
[]
no_license
M1c17/C_Programming_Language
6ca585297ab6014a8a5a86ec1e4be8fb58f01e39
15c3074a7876dea9615a3d4a5dd0bb8120abf180
refs/heads/main
2023-03-06T05:41:51.665000
2021-02-07T04:41:49
2021-02-07T04:41:49
323,505,241
0
0
null
null
null
null
UTF-8
C
false
false
862
c
#include <stdio.h> #include <ctype.h> #include <string.h> /* atoi: convert s to integer; version 2 */ int atoi(char line[]); int main(){ int val; char str[10]; strcpy(str, "-93284927"); val = atoi(str); printf("String value = %s, Int value = %d\n", str, val); strcpy(str, "hello"); val = atoi(str); printf("String value = %s, Int value = %d\n", str, val); return 0; } int atoi(char line[]){ //Initialize variables int i, n, sign; //skip white space, if any for (i = 0; isspace(line[i]); ++i){ ; } //get sign, if any sign = (line[i] == '-') ? -1 : 1; //skip sign, if any if (line[i] == '+' || line[i] == '-'){ ++i; } //get integer part and convert it for (n = 0; isdigit(line[i]); ++i){ n = 10 * n + (line[i] - '0'); } return sign * n; }
0ddad1251dcd4016b4c526efeafe716af3f5026e
ef9a2839953f3586e66c1cf824c9de199f52d088
/mcc_generated_files/X2CCode/Library/Math/Controller/inc/Sqrt_FiP16.h
b83fa9c934f92a6452ef0773f0ae3be8fd299024
[]
no_license
MCHP-X2Cdemos/mc_foc_sl_fip_dsPIC33ck_mclv2.x
72f1e06eb18738796d59938474c6d533bd07bb1e
d77e18983439d895b83b6d63fdaad4c8fdb028e7
refs/heads/master
2023-03-20T10:54:54.157000
2021-03-11T22:01:12
2021-03-11T22:01:12
288,478,027
2
0
null
null
null
null
UTF-8
C
false
false
3,510
h
/* * Copyright (c) 2013, Linz Center of Mechatronics GmbH (LCM) http://www.lcm.at/ * All rights reserved. */ /* * This file is licensed according to the BSD 3-clause license as follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the "Linz Center of Mechatronics GmbH" and "LCM" 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 "Linz Center of Mechatronics GmbH" BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * This file is part of X2C. http://x2c.lcm.at/ * $LastChangedRevision: 1603 $ */ /* USERCODE-BEGIN:Description */ /** Description: Square Root Computation **/ /** Calculation: **/ /** y = sqrt((abs(u)) **/ /** **/ /* USERCODE-END:Description */ #ifndef SQRT_FIP16_H #define SQRT_FIP16_H #ifdef __cplusplus extern "C" { #endif #include "CommonFcts.h" #if !defined(SQRT_FIP16_ISLINKED) #define SQRT_FIP16_ID ((uint16)4817) typedef struct { uint16 ID; int16 *In; int16 Out; } SQRT_FIP16; #define SQRT_FIP16_FUNCTIONS { \ SQRT_FIP16_ID, \ (void (*)(void*))Sqrt_FiP16_Update, \ (void (*)(void*))Sqrt_FiP16_Init, \ (tLoadImplementationParameter)Common_Load, \ (tSaveImplementationParameter)Common_Save, \ (void* (*)(const void*, uint16))Sqrt_FiP16_GetAddress } /**********************************************************************************************************************/ /** Public prototypes **/ /**********************************************************************************************************************/ void Sqrt_FiP16_Update(SQRT_FIP16 *pTSqrt_FiP16); void Sqrt_FiP16_Init(SQRT_FIP16 *pTSqrt_FiP16); void* Sqrt_FiP16_GetAddress(const SQRT_FIP16 *block, uint16 elementId); #endif #ifdef __cplusplus } #endif #endif
[ "christoph.baumgartner@microchipcom" ]
christoph.baumgartner@microchipcom
ae6588ae9020907de235f7dc4c83350dbf925003
60cddbbb30ef7614070f6e1691ab9a3f0ce407e4
/robo2-xsdk/libs/phymod/chip/falcon16/falcon16_diagnostics_dispatch.c
12ba0238027635ff729ee0e14f43ab82c3db76e5
[]
no_license
David-Croose/Broadcom-Compute-Connectivity-Software-robo2-xsdk
f2a1fe9a704e1a1873eac2fba02125ba7cb1570f
25b15c851d6e8a5a70715603e4f8d8a9af8f66fe
refs/heads/master
2022-11-27T00:00:23.553000
2020-08-03T07:36:34
2020-08-03T07:36:34
null
0
0
null
null
null
null
UTF-8
C
false
false
1,555
c
/* * * $Id: phymod.xml,v 1.1.2.5 Broadcom SDK $ * * * This license is set out in https://github.com/Broadcom/Broadcom-Compute-Connectivity-Software-robo2-xsdk/master/Legal/LICENSE file. * * $Copyright: (c) 2020 Broadcom Inc. * Broadcom Proprietary and Confidential. All rights reserved.$ * * * DO NOT EDIT THIS FILE! * */ #include <phymod/phymod.h> #include <phymod/phymod_diagnostics.h> #include <phymod/phymod_diagnostics_dispatch.h> #ifdef PHYMOD_FALCON16_SUPPORT #include <phymod/chip/falcon16_diagnostics.h> __phymod_diagnostics__dispatch__t__ phymod_diagnostics_falcon16_diagnostics_driver = { falcon16_phy_rx_slicer_position_set, falcon16_phy_rx_slicer_position_get, falcon16_phy_rx_slicer_position_max_get, falcon16_phy_prbs_config_set, falcon16_phy_prbs_config_get, falcon16_phy_prbs_enable_set, falcon16_phy_prbs_enable_get, falcon16_phy_prbs_status_get, falcon16_phy_pattern_config_set, falcon16_phy_pattern_config_get, falcon16_phy_pattern_enable_set, falcon16_phy_pattern_enable_get, falcon16_core_diagnostics_get, falcon16_phy_diagnostics_get, falcon16_phy_pmd_info_dump, NULL, /* phymod_phy_pcs_info_dump */ falcon16_phy_eyescan_run, NULL, /* phymod_phy_link_mon_enable_set */ NULL, /* phymod_phy_link_mon_enable_get */ NULL, /* phymod_phy_link_mon_status_get */ NULL, /* phymod_phy_fec_correctable_counter_get */ NULL, /* phymod_phy_fec_uncorrectable_counter_get */ }; #endif /* PHYMOD_FALCON16_SUPPORT */
26393171c0093670884c0ea4829ff4beaea2848e
fda015cc078e877754e4cd5a48e970f0a1159ada
/src/sources/shared/system_support/os_specifics.h
aee560f47e775860f7a101ac20eaaa04456aeddf
[]
no_license
cran/liquidSVM
886e0487104a434d3854120a774ebe120e1ddeae
35b8af219f5d52df5513789793c1e5cf07d310b8
refs/heads/master
2020-04-06T04:12:26.063000
2019-09-14T17:20:02
2019-09-14T17:20:02
83,014,436
2
0
null
null
null
null
UTF-8
C
false
false
4,395
h
// Copyright 2015, 2016, 2017 Ingo Steinwart // // This file is part of liquidSVM. // // liquidSVM 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. // // liquidSVM 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. // You should have received a copy of the GNU Affero General Public License // along with liquidSVM. If not, see <http://www.gnu.org/licenses/>. #if !defined (OS_SPECIFICS_H) #define OS_SPECIFICS_H #include "sources/shared/system_support/compiler_specifics.h" //********************************************************************************************************************************** // Linux and Mac //********************************************************************************************************************************** #if defined __linux__ || defined __MACH__ #define POSIX_OS__ #define THREADING_IMPLEMENTED #ifdef __SSE2__ #define SSE2__ #endif #ifdef __AVX__ #define AVX__ #endif #ifdef __AVX2__ #define AVX2__ #endif #define sync_add_and_fetch __sync_add_and_fetch #define Tmutex pthread_mutex_t #define Tthread_handle pthread_t #define atomic_unsigned unsigned #define thread__ __thread #define restrict__ __restrict__ #endif //********************************************************************************************************************************** // Windows //********************************************************************************************************************************** #if defined _WIN32 #if !defined (NOMINMAX) #define NOMINMAX #endif #include <malloc.h> // Has to come before windows.h #include <windows.h> // Has to come before emmintrin.h/immintrin.h in simd_basics.h ! #include <iso646.h> #define THREADING_IMPLEMENTED #undef COMPILE_WITH_CUDA__ // The next line repeats the default of MS Visual Studio 2012++ // Basically, it assumes that Windows is not running on a CPU built before 2004 or so. #define SSE2__ #ifdef __AVX__ #define AVX__ #endif #ifdef __AVX2__ #define AVX2__ #endif #define Tmutex HANDLE #define Tthread_handle HANDLE #ifdef __MINGW32__ #define sync_add_and_fetch __sync_add_and_fetch #define atomic_unsigned unsigned #define thread__ __thread #else #define sync_add_and_fetch atomic_fetch_add #if defined(MSVISUAL_LEGACY) #define atomic_unsigned unsigned #else #define atomic_unsigned atomic_uint #endif #define thread__ __declspec(thread) #endif #define restrict__ __restrict #endif //********************************************************************************************************************************** // Other Operating Systems //********************************************************************************************************************************** #if !defined(POSIX_OS__) && !defined(_WIN32) #define UNKNOWN_OS__ #undef THREADING_IMPLEMENTED // The following definitions are meant as safeguards. Depending on the // situtation they may or may not be necessary. #undef SSE2__ #undef AVX__ #undef AVX2__ #undef COMPILE_WITH_CUDA__ #define Tmutex unsigned #define Tthread_handle void* #define atomic_unsigned unsigned #define thread__ #define restrict__ #endif //********************************************************************************************************************************** // More safeguards //********************************************************************************************************************************** // Make sure that simd instructions are only used on systems on which we can // safely alloc aligned memory. Currently, this is true for MS Windows and // systems supporting POSIX with optional posix_memalign commands. #if defined _WIN32 #define SIMD_ACTIVATED #else #include <unistd.h> #if defined(_POSIX_ADVISORY_INFO) && _POSIX_ADVISORY_INFO > 0 #define SIMD_ACTIVATED #else #undef SIMD_ACTIVATED #undef AVX2__ #undef AVX__ #undef SSE2__ #endif #endif #endif
e68b09ef487cfbc95b0472becf08661d8f918a67
93f2b5dc75142b5d6f5cb31e1e02f1c5aac130a0
/srcs_lem/get_next_line1.c
9a771719bb18a1137c4edc964beaab2d64290170
[]
no_license
Enshertid/lem-in_school21
d869541fb45c6c6f9d8f96bb047d489aed895b26
3b326ec0c41cefe4af28eb46d76817ad89612a33
refs/heads/master
2022-05-07T23:49:00.736000
2020-03-15T16:34:49
2020-03-15T16:34:49
null
0
0
null
null
null
null
UTF-8
C
false
false
3,150
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line1.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ymanilow <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/02 14:42:04 by dbendu #+# #+# */ /* Updated: 2020/02/13 21:25:11 by ymanilow ### ########.fr */ /* */ /* ************************************************************************** */ #include "lem_in.h" #define GNL_BUFF 1024 void ft_lstappend(t_list **list, t_list *new) { if (!list || !new) return ; if (!*list) { *list = new; new->end = new; } else { (*list)->end->next = new; (*list)->end = new; } } static void add_in_bufs(t_list **bufs, const char *src, size_t strlen, int fd) { char *str; str = ft_strnew(strlen); ft_memcpy(str, src, strlen); ft_lstappend(bufs, ft_lstnew(str, strlen + 1)); (*bufs)->end->content_size = fd; free(str); } static int check_bufs(t_list **bufs, t_list **buf, int fd) { t_list *iter; char *npos; char *temp; iter = *bufs; while (iter && (int)iter->content_size != fd) iter = iter->next; if (!iter) return (0); npos = (char*)ft_memchr(iter->content, '\n', ft_strlen(iter->content)); ft_lstappend(buf, ft_lstnew(iter->content, npos ? (size_t)(npos - (char*)iter->content) : (size_t)ft_strlen(iter->content))); if (!npos || (npos && !npos[1])) ft_lstdelete(bufs, &iter); else if (npos[1]) { temp = ft_strdup(npos + 1); free(iter->content); iter->content = temp; } return (npos ? 1 : 0); } static char *lst_to_str(const t_list *list) { char *str; char *striter; const t_list *lstiter; size_t len; len = 0; lstiter = list; while (lstiter) { len += lstiter->content_size; lstiter = lstiter->next; } str = ft_strnew(len); if (!str) return (NULL); striter = str; while (list) { ft_memcpy(striter, list->content, list->content_size); striter += list->content_size; list = list->next; } return (str); } int get_next_line(const int fd, char **line) { static t_list *bufs = NULL; t_list *buf; ssize_t ret; char *npos; char str[GNL_BUFF]; if (fd < 0 || !GNL_BUFF || read(fd, str, 0) < 0 || (buf = NULL)) return (-1); if (!check_bufs(&bufs, &buf, fd)) { while ((ret = read(fd, str, GNL_BUFF))) { npos = (char*)ft_memchr(str, '\n', ret); ft_lstappend(&buf, ft_lstnew(str, npos ? npos - str : ret)); if (npos) break ; } if (!ret && !buf) return (0); if (ret && npos && npos - str != ret - 1) add_in_bufs(&bufs, npos + 1, ret - 1 - (npos - str), fd); } *line = lst_to_str(buf); ft_lstpurge(&buf); return (*line ? 1 : -1); }
435d938de995c245d164b32e935ec8b55a8bc340
bb762a49e4f5324de253d6287438899a4c645632
/Lista9/Questao1/tadArvoreBB3.c
9f8071a9ac77eb7d89a79a9acd91267be9385138
[]
no_license
RaquelBelmiro/estruturas-de-dados-c
7de2defe4ffaf1849eb5408c533658c0637a1366
f38f6e6758a897a24e8091e773b6651f02e09a45
refs/heads/master
2023-08-01T07:46:45.736000
2021-09-21T21:42:25
2021-09-21T21:42:25
408,981,056
0
0
null
null
null
null
UTF-8
C
false
false
3,945
c
#include<stdio.h> #include<stdlib.h> struct reg_no_arvore { struct reg_no_arvore *ptrEsquerda; int chave; struct reg_no_arvore *ptrDireita; }; typedef struct reg_no_arvore **tipo_no_arvore; tipo_no_arvore inicializar_arvore(tipo_no_arvore sub_raiz) { sub_raiz = (struct reg_no_arvore**)malloc(sizeof(struct reg_no_arvore*)); *sub_raiz = NULL; } void incluir_no_arvore(tipo_no_arvore sub_raiz, int chave) { if (*sub_raiz == NULL) { *sub_raiz = malloc(sizeof(struct reg_no_arvore)); (*sub_raiz)->chave = chave; (*sub_raiz)->ptrEsquerda = NULL; (*sub_raiz)->ptrDireita = NULL; } else { if (chave < (*sub_raiz)->chave) { incluir_no_arvore(&((*sub_raiz)->ptrEsquerda), chave); } else { if (chave > (*sub_raiz)->chave) { incluir_no_arvore(&((*sub_raiz)->ptrDireita), chave); } } } } void percurso_em_ordem(tipo_no_arvore sub_raiz) { if (*sub_raiz != NULL) { percurso_em_ordem(&((*sub_raiz)->ptrEsquerda)); printf("%d ", (*sub_raiz)->chave); percurso_em_ordem(&((*sub_raiz)->ptrDireita)); } } void percurso_em_pre_ordem(tipo_no_arvore sub_raiz) { if (*sub_raiz != NULL) { printf("%d ", (*sub_raiz)->chave); percurso_em_pre_ordem(&((*sub_raiz)->ptrEsquerda)); percurso_em_pre_ordem(&((*sub_raiz)->ptrDireita)); } } void percurso_em_pos_ordem(tipo_no_arvore sub_raiz) { if (*sub_raiz != NULL) { percurso_em_pos_ordem(&((*sub_raiz)->ptrEsquerda)); percurso_em_pos_ordem(&((*sub_raiz)->ptrDireita)); printf("%d ", (*sub_raiz)->chave); } } int encontrar_elemento(tipo_no_arvore sub_raiz, int chave) { if ((*sub_raiz) == NULL) { return 0; } else { if (chave == (*sub_raiz)->chave) { return 1; } else { if (chave < (*sub_raiz)->chave) { return encontrar_elemento(&((*sub_raiz)->ptrEsquerda), chave); } else { if (chave > (*sub_raiz)->chave) { return encontrar_elemento(&((*sub_raiz)->ptrDireita), chave); } } } } } int numero_nos(tipo_no_arvore sub_raiz){ if (*sub_raiz != NULL) { return 1+numero_nos(&((*sub_raiz)->ptrEsquerda))+numero_nos(&((*sub_raiz)->ptrDireita)); } return 0; } int qtdFolha(tipo_no_arvore sub_raiz){ if (*sub_raiz !=NULL) { if(((*sub_raiz)->ptrEsquerda==NULL) && ((*sub_raiz)->ptrDireita==NULL)) return 1+qtdFolha(&(*sub_raiz)->ptrEsquerda) + qtdFolha(&(*sub_raiz)->ptrDireita); else return qtdFolha(&(*sub_raiz)->ptrDireita) + qtdFolha(&(*sub_raiz)->ptrEsquerda); } else return 0; } int qtdNull(tipo_no_arvore sub_raiz){ if (*sub_raiz !=NULL) { return qtdNull(&(*sub_raiz)->ptrEsquerda)+qtdNull(&(*sub_raiz)->ptrDireita); } else return 1; } int altura(tipo_no_arvore sub_raiz){ if (*sub_raiz !=NULL) { if( altura(&((*sub_raiz)->ptrEsquerda)) > altura(&((*sub_raiz)->ptrDireita))) return 1+altura(&(*sub_raiz)->ptrEsquerda); else return 1+altura(&(*sub_raiz)->ptrDireita); } return 0; } void copiarArvore(tipo_no_arvore sub_raiz_original, tipo_no_arvore sub_raiz_copia){ if(*sub_raiz_original!=NULL){ incluir_no_arvore(sub_raiz_copia,(*sub_raiz_original)->chave); copiarArvore(&((*sub_raiz_original)->ptrDireita),sub_raiz_copia); copiarArvore(&((*sub_raiz_original)->ptrEsquerda),sub_raiz_copia); } }
85535a4d92f8f2666b9a5170975b7e8728e2f10d
bd1fea86d862456a2ec9f56d57f8948456d55ee6
/000/246/087/CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13.c
820a233fd4b7e26bdeed91be32983bf04da283ab
[]
no_license
CU-0xff/juliet-cpp
d62b8485104d8a9160f29213368324c946f38274
d8586a217bc94cbcfeeec5d39b12d02e9c6045a2
refs/heads/master
2021-03-07T15:44:19.446000
2020-03-10T12:45:40
2020-03-10T12:45:40
246,275,244
0
1
null
null
null
null
UTF-8
C
false
false
6,999
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-13.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Fixed string * Sink: w32_execv * BadSink : execute command with execv * Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=5) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "-c" #define COMMAND_ARG2 "ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 #include <process.h> #define EXECV _execv #ifndef OMITBAD void CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_bad() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(GLOBAL_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; char *replace; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; size_t dataLen = strlen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(char) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(char)] = '\0'; /* Eliminate CRLF */ replace = strchr(data, '\r'); if (replace) { *replace = '\0'; } replace = strchr(data, '\n'); if (replace) { *replace = '\0'; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_FIVE==5 to GLOBAL_CONST_FIVE!=5 */ static void goodG2B1() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(GLOBAL_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(GLOBAL_CONST_FIVE==5) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } void CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
140d8434c9645707bed4716235e4ff9dc4315eca
c9eccf85f19371a3843911c1480e761de4773722
/src/lvgl/src/lv_misc/lv_bidi.h
f3f758b43ab14b9f6180db943b44a41d1f39df7d
[ "MIT" ]
permissive
mibus/TTGO_TWatch_Library
7d3c04ca2358b181264ea744a1bcd8338f508d91
bd77e6edba3baf9c5c68de4683a01b81f6b3a8b3
refs/heads/master
2022-11-25T03:04:40.292000
2020-07-25T03:15:55
2020-07-25T03:15:55
275,497,118
0
0
MIT
2020-06-28T03:13:55
2020-06-28T03:13:54
null
UTF-8
C
false
false
4,064
h
/** * @file lv_bifi.h * */ #ifndef LV_BIDI_H #define LV_BIDI_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include <stdbool.h> #include <stdint.h> /********************* * DEFINES *********************/ /* Special non printable strong characters. * They can be inserted to texts to affect the run's direction*/ #define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/ #define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/ /********************** * TYPEDEFS **********************/ enum { /*The first 4 values are stored in `lv_obj_t` on 2 bits*/ LV_BIDI_DIR_LTR = 0x00, LV_BIDI_DIR_RTL = 0x01, LV_BIDI_DIR_AUTO = 0x02, LV_BIDI_DIR_INHERIT = 0x03, LV_BIDI_DIR_NEUTRAL = 0x20, LV_BIDI_DIR_WEAK = 0x21, }; typedef uint8_t lv_bidi_dir_t; /********************** * GLOBAL PROTOTYPES **********************/ #if LV_USE_BIDI /** * Convert a text to get the characters in the correct visual order according to * Unicode Bidirectional Algorithm * @param str_in the text to process * @param str_out store the result here. Has the be `strlen(str_in)` length * @param base_dir `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` */ void _lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir); /** * Auto-detect the direction of a text based on the first strong character * @param txt the text to process * @return `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` */ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt); /** * Get the logical position of a character in a line * @param str_in the input string. Can be only one line. * @param bidi_txt internally the text is bidi processed which buffer can be get here. * If not required anymore has to freed with `lv_mem_free()` * Can be `NULL` is unused * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param vicual_pos the visual character position which logical position should be get * @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context * @return the logical character position */ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, uint32_t visual_pos, bool * is_rtl); /** * Get the visual position of a character in a line * @param str_in the input string. Can be only one line. * @param bidi_txt internally the text is bidi processed which buffer can be get here. * If not required anymore has to freed with `lv_mem_free()` * Can be `NULL` is unused * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param logical_pos the logical character position which visual position should be get * @param is_rtl tell the the char at `logical_pos` is RTL or LTR context * @return the visual character position */ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, uint32_t logical_pos, bool * is_rtl); /** * Bidi process a paragraph of text * @param str_in the string to process * @param str_out store the result here * @param len length of teh text * @param base_dir base dir of the text * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. * Can be `NULL` is unused * @param pos_conv_len length of `pos_conv_out` in element count */ void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir, uint16_t * pos_conv_out, uint16_t pos_conv_len); /********************** * MACROS **********************/ #endif /*LV_USE_BIDI*/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /*LV_BIDI_H*/
4e6ed1901fc0f9319647713b68b5b6b327930a06
3f309b1dd9774ca1eef2c7bb7626447e6c3dbe70
/apps/evsys/evsys_trigger/firmware/src/config/sam_l10_xpro/peripheral/clock/plib_clock.c
e3a6e5298e13415f391dd1c25b0e3d7d7fe6eb46
[ "LicenseRef-scancode-unknown-license-reference", "ISC", "LicenseRef-scancode-public-domain" ]
permissive
Unitek-KL/csp
30892ddf1375f5191173cafdfba5f098245a0ff7
2ac7ba59465f23959e51d2f16a5712b57b79ef5f
refs/heads/master
2020-12-10T13:42:26.878000
2019-10-14T17:55:22
2019-10-14T17:56:20
233,609,402
0
0
NOASSERTION
2020-01-13T14:04:51
2020-01-13T14:04:51
null
UTF-8
C
false
false
4,781
c
/******************************************************************************* CLOCK PLIB Company: Microchip Technology Inc. File Name: plib_clock.c Summary: CLOCK PLIB Implementation 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 "plib_clock.h" #include "device.h" static void OSCCTRL_Initialize(void) { /**************** OSC16M IniTialization *************/ OSCCTRL_REGS->OSCCTRL_OSC16MCTRL = OSCCTRL_OSC16MCTRL_FSEL(0x0) | OSCCTRL_OSC16MCTRL_ENABLE_Msk; } static void OSC32KCTRL_Initialize(void) { OSC32KCTRL_REGS->OSC32KCTRL_RTCCTRL = OSC32KCTRL_RTCCTRL_RTCSEL(0); } static void FDPLL_Initialize(void) { GCLK_REGS->GCLK_PCHCTRL[0] = GCLK_PCHCTRL_GEN(0x1) | GCLK_PCHCTRL_CHEN_Msk; while ((GCLK_REGS->GCLK_PCHCTRL[0] & GCLK_PCHCTRL_CHEN_Msk) != GCLK_PCHCTRL_CHEN_Msk) { /* Wait for synchronization */ } /****************** DPLL Initialization *********************************/ /* Configure DPLL */ OSCCTRL_REGS->OSCCTRL_DPLLCTRLB = OSCCTRL_DPLLCTRLB_FILTER(0) | OSCCTRL_DPLLCTRLB_LTIME(0)| OSCCTRL_DPLLCTRLB_REFCLK(2) ; OSCCTRL_REGS->OSCCTRL_DPLLRATIO = OSCCTRL_DPLLRATIO_LDRFRAC(0) | OSCCTRL_DPLLRATIO_LDR(63); while((OSCCTRL_REGS->OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_DPLLRATIO_Msk) == OSCCTRL_DPLLSYNCBUSY_DPLLRATIO_Msk) { /* Waiting for the synchronization */ } /* Selection of the DPLL Enable */ OSCCTRL_REGS->OSCCTRL_DPLLCTRLA = OSCCTRL_DPLLCTRLA_ENABLE_Msk ; while((OSCCTRL_REGS->OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk) == OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk ) { /* Waiting for the DPLL enable synchronization */ } while((OSCCTRL_REGS->OSCCTRL_DPLLSTATUS & (OSCCTRL_DPLLSTATUS_LOCK_Msk | OSCCTRL_DPLLSTATUS_CLKRDY_Msk)) != (OSCCTRL_DPLLSTATUS_LOCK_Msk | OSCCTRL_DPLLSTATUS_CLKRDY_Msk)) { /* Waiting for the Ready state */ } } static void GCLK0_Initialize(void) { GCLK_REGS->GCLK_GENCTRL[0] = GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC(7) | GCLK_GENCTRL_GENEN_Msk; while((GCLK_REGS->GCLK_SYNCBUSY & GCLK_SYNCBUSY_GENCTRL0_Msk) == GCLK_SYNCBUSY_GENCTRL0_Msk) { /* wait for the Generator 0 synchronization */ } } static void GCLK1_Initialize(void) { GCLK_REGS->GCLK_GENCTRL[1] = GCLK_GENCTRL_DIV(4) | GCLK_GENCTRL_SRC(5) | GCLK_GENCTRL_GENEN_Msk; while((GCLK_REGS->GCLK_SYNCBUSY & GCLK_SYNCBUSY_GENCTRL1_Msk) == GCLK_SYNCBUSY_GENCTRL1_Msk) { /* wait for the Generator 1 synchronization */ } } void CLOCK_Initialize (void) { /* Function to Initialize the Oscillators */ OSCCTRL_Initialize(); /* Function to Initialize the 32KHz Oscillators */ OSC32KCTRL_Initialize(); GCLK1_Initialize(); FDPLL_Initialize(); GCLK0_Initialize(); /* Selection of the Generator and write Lock for EIC */ GCLK_REGS->GCLK_PCHCTRL[3] = GCLK_PCHCTRL_GEN(0x0) | GCLK_PCHCTRL_CHEN_Msk; while ((GCLK_REGS->GCLK_PCHCTRL[3] & GCLK_PCHCTRL_CHEN_Msk) != GCLK_PCHCTRL_CHEN_Msk) { /* Wait for synchronization */ } /* Selection of the Generator and write Lock for EVSYS_0 */ GCLK_REGS->GCLK_PCHCTRL[6] = GCLK_PCHCTRL_GEN(0x0) | GCLK_PCHCTRL_CHEN_Msk; while ((GCLK_REGS->GCLK_PCHCTRL[6] & GCLK_PCHCTRL_CHEN_Msk) != GCLK_PCHCTRL_CHEN_Msk) { /* Wait for synchronization */ } }
[ "http://support.microchip.com" ]
http://support.microchip.com
f8a07ef6a3923daba641e7ac3c0fd7ad2ecbfc87
1fabbdfd1ca9ea1b6808893e12bd907eb74de414
/xcode/Classes/Native/AssemblyU2DCSharp_SPacket_SocketInstance_GC_SYNC_REACHEDSCENMethodDeclarations.h
cc71e70250fd75fada95620a65e6af4003c60645
[]
no_license
Klanly/TutorialPackageClient
6f889e96c40ab13c97d107708ae8f3c71a484301
b9d61ba2f287c491c9565b432f852980ec3fee28
refs/heads/master
2020-12-03T01:42:35.256000
2016-11-01T02:40:21
2016-11-01T02:40:21
null
0
0
null
null
null
null
UTF-8
C
false
false
743
h
#pragma once #include <stdint.h> #include <assert.h> #include <exception> #include "codegen/il2cpp-codegen.h" // SPacket.SocketInstance.GC_SYNC_REACHEDSCENEHandler struct GC_SYNC_REACHEDSCENEHandler_t2847; // PacketDistributed struct PacketDistributed_t2209; // System.Void SPacket.SocketInstance.GC_SYNC_REACHEDSCENEHandler::.ctor() void GC_SYNC_REACHEDSCENEHandler__ctor_m16033 (GC_SYNC_REACHEDSCENEHandler_t2847 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.UInt32 SPacket.SocketInstance.GC_SYNC_REACHEDSCENEHandler::Execute(PacketDistributed) uint32_t GC_SYNC_REACHEDSCENEHandler_Execute_m16034 (GC_SYNC_REACHEDSCENEHandler_t2847 * __this, PacketDistributed_t2209 * ___ipacket, MethodInfo* method) IL2CPP_METHOD_ATTR;
8b39fe097d9a0ad75f4e8e176acbcd3e9e6ce47c
5c255f911786e984286b1f7a4e6091a68419d049
/code/24fbc88b-b066-449c-ae5b-a5acd378d8ab.c
6c6cfa7dc48bd7868bbeecf6b19c39cd6bf27ae4
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944000
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
217
c
#include <stdio.h> int main() { int i=0; int j=14; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = l/j; l = k-j*i; printf("vulnerability"); printf("%d%d\n",l,l); return 0; }
6e142e946a8eea810bceb15f7ada544ab9931cb0
6ef6213d2fa39d1d0ab7e2373d882b9d263e8c6d
/ti_components/algorithms/vlib_c66x_3_3_2_0/packages/ti/vlib/src/VLIB_ORB_computeOrientation/VLIB_ORB_computeOrientation_cn.h
b894dbc58a0b2a4caf5af6d8c2a4c550a38628ff
[]
no_license
Zhangh2018/PROCESSOR_SDK_VISION_03_06_00_00
9c380d3167b156a11a8f21814e94ac5550cddc87
05c72de5d031006c7565d4234abd53670a926acd
refs/heads/master
2021-10-16T13:43:05.313000
2019-02-11T09:10:44
2019-02-11T09:10:44
null
0
0
null
null
null
null
UTF-8
C
false
false
3,069
h
/******************************************************************************* **+--------------------------------------------------------------------------+** **| **** |** **| **** |** **| ******o*** |** **| ********_///_**** |** **| ***** /_//_/ **** |** **| ** ** (__/ **** |** **| ********* |** **| **** |** **| *** |** **| |** **| Copyright (c) 2007-2012 Texas Instruments Incorporated |** **| ALL RIGHTS RESERVED |** **| |** **| Permission to use, copy, modify, or distribute this software, |** **| whether in part or in whole, for any purpose is forbidden without |** **| a signed licensing agreement and NDA from Texas Instruments |** **| Incorporated (TI). |** **| |** **| TI makes no representation or warranties with respect to the |** **| performance of this computer program, and specifically disclaims |** **| any responsibility for any damages, special or consequential, |** **| connected with the use of this program. |** **| |** **+--------------------------------------------------------------------------+** *******************************************************************************/ #ifndef VLIB_ORB_COMPUTEORIENTATION_CN_H_ #define VLIB_ORB_COMPUTEORIENTATION_CN_H_ 1 #include "../common/VLIB_types.h" #include "../common/VLIB_orb.h" CORBResult VLIB_ORB_computeOrientation_cn(uint8_t *inImg, uint16_t imgWidth, uint16_t imgHeight, uint16_t imgPitch, uint32_t *featuresLoc, uint16_t numFeatures, int16_t *outAngle, uint8_t *momentPattern, uint8_t *scratch); #endif /* ======================================================================== */ /* End of file: VLIB_ORB_computeOrientation_cn.h */ /* ======================================================================== */
d982dd43d5b4af36c08a4f37e4b1553183be2623
65969eb320c536e360abed38cfb15c34d4b2e586
/lee.c
80cd25a6825242bcf6ff21022062ad706cc3e1f3
[ "MIT" ]
permissive
essele/roLua
39a593d19a4f520bac72dfbde18821ef095e2c5b
b492912789cac58f4a25e053773e7fc24cb26c21
refs/heads/main
2023-03-20T09:44:06.246000
2021-03-10T17:47:55
2021-03-10T17:47:55
343,067,872
1
0
null
null
null
null
UTF-8
C
false
false
2,999
c
#include <lua.h> #include <lualib.h> #include <lauxlib.h> #include <lapi.h> #include <lstate.h> #include <lobject.h> #include <lgc.h> #include <stdlib.h> #include <string.h> #include <malloc/malloc.h> #include <lstring.h> static void *lee_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { static size_t running_total = 0; (void)ud; (void)osize; /* not used */ if (nsize == 0) { size_t sz = malloc_size(ptr); running_total -= sz; fprintf(stderr, "freel called on %p (size=%zu) tot=%zu\n", ptr, sz, running_total); free(ptr); return NULL; } else { size_t sz = 0; if (ptr != 0) { sz = malloc_size(ptr); running_total -= sz; } running_total += nsize; fprintf(stderr, "realloc called on %p (%zu -> %zu) tot=%zu\n", ptr, sz, nsize, running_total); return realloc(ptr, nsize); } } int main(int argc, char ** argv) { lua_State *L = lua_newstate(lee_alloc, NULL); fprintf(stderr, " ---- AFTER NEWSTATE ------\n"); TString *s = luaS_new(L, "goto"); uint8_t *p = (uint8_t *)s; fprintf(stderr, "DUMP(%p) ", p); for (int i=0; i < sizeof(TString)+4; i++) { fprintf(stderr, "%02x ", *(p+i)); } fprintf(stderr, "\n"); fprintf(stderr, "%08x\n", s->hash); // exit(0); luaL_openlibs(L); fprintf(stderr, " ---- AFTER OPENLIBS ------\n"); // Push the pointer to function // lua_pushcfunction(L, multiplication); // Get the value on top of the stack // and set as a global, in this case is the function // lua_setglobal(L, "mul"); // Our Lua code, it simply prints a Hello, World message char * code = // "print(collectgarbage('count'));" // "collectgarbage('collect');" // "print(collectgarbage('count'));" // "x=mul(7,8);print(x);f={};f.a=1;f.b=2;print(f.a); print(x.joe);" // "f={};f.a=1;f.b=2;" // "print(f.a);" "for i=1,10 do print('hello') end;" "print(math.pi);" "print(math.floor(4.567));" // "x=nil; f=nil;" // "collectgarbage('collect');" // "print(collectgarbage('count'));" "collectgarbage('collect');" "print(collectgarbage('count'));" "print(math.huge);" "print(math.maxinteger);" "print(string);" "print(string.upper);" "print(string.upper('Lee Essen'));" "print(_VERSION);" "print(_G);" ; // Here we load the string and use lua_pcall for run the code fprintf(stderr, " ---- BEFORE LOADSTRING ------\n"); if (luaL_loadstring(L, code) == LUA_OK) { fprintf(stderr, " ---- AFTER LOADSTRING ------\n"); if (lua_pcall(L, 0, 1, 0) == LUA_OK) { // If it was executed successfuly we // remove the code from the stack lua_pop(L, lua_gettop(L)); } } lua_close(L); return 0; }
37c89afb473fb1f0e71c3f743b0cc646712c4985
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/0f76e37c-5ba9-431e-acb0-97747e28c6bb.c
d70ff0058833ce6c0df966372d79fbd154c48354
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944000
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
558
c
#include <string.h> #include <stdio.h> int main() { int i=4; int j=13; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = j/j; l = l/j; l = l%j; l = l-j; k = k-k*i; //variables /* START VULNERABILITY */ int a; int b[28]; int c[67]; a = 0; while (a > -1) { //random /* START BUFFER SET */ *((int *)c + a) = *((int *)b + a); /* END BUFFER SET */ a--; } /* END VULNERABILITY */ printf("%d%d\n",k,l); return 0; }
c6c3bdfecdb996c5a631181b252045ec0128fe41
d317c415b8eda9b2f3d2723e52a669daabc4bb7c
/test/bi_test1.c
9b80d601d8f5a5fadb4187d23c6c5b366869c4d4
[]
no_license
liuguangxi/pe
73fcf8c3ed0d0af2bc6a2555ed7a7561d91565d6
0a1ff3535dbef5856fda3f916011eb3c720c9b2a
refs/heads/master
2022-12-17T07:49:49.424000
2020-09-23T18:23:22
2020-09-23T18:23:22
298,725,253
1
0
null
2020-09-26T02:55:36
2020-09-26T02:55:35
null
UTF-8
C
false
false
4,305
c
#include "pe_test.h" namespace bi_test { SL void bi_test_small() { for (int i = -100; i <= 100; ++i) for (int j = -100; j <= 100; ++j) { bi a(i), b(j); assert(i + j == a + b); assert(i - j == a - b); assert(i * j == a * b); if (j != 0) { assert(i / j == a / b); assert(i % j == a % b); } if (i >= 0 && j >= 0) { assert((i & j) == (a & b)); assert((i ^ j) == (a ^ b)); assert((i | j) == (a | b)); } assert((i > j) == (bool)(a > b)); assert((i < j) == (bool)(a < b)); assert((i == j) == (bool)(a == b)); assert((i >= j) == (bool)(a >= b)); assert((i <= j) == (bool)(a <= b)); } } PE_REGISTER_TEST(&bi_test_small, "bi_test_small", SMALL); #if ENABLE_GMP SL void bi_mul_test_impl(int x, int y) { for (int s1 = -1; s1 <= 1; ++s1) for (int s2 = -1; s2 <= 1; ++s2) for (int id = 0; id < x; ++id) { std::vector<int> A, B; for (int i = 0; i < y; ++i) { A.push_back(rand()); B.push_back(rand()); } string expectedResult; { mpz_class a = s1; mpz_class b = s2; for (auto& iter : A) a *= iter; for (auto& iter : B) b *= iter; mpz_class c = a * b; stringstream ss; ss << c; ss >> expectedResult; } string myResult; { bi a = s1; bi b = s2; for (auto& iter : A) a *= iter; for (auto& iter : B) b *= iter; bi c = a * b; stringstream ss; ss << c; ss >> myResult; } assert(expectedResult == myResult); } } SL void bi_mul_test_medium() { bi_mul_test_impl(1000, 500); } PE_REGISTER_TEST(&bi_mul_test_medium, "bi_mul_test_medium", MEDIUM); SL void bi_mul_test_big() { bi_mul_test_impl(10, 10000); } #if !defined(CONTINUOUS_INTEGRATION_TEST) PE_REGISTER_TEST(&bi_mul_test_big, "bi_mul_test_big", BIG); #endif SL void bi_div_test_medium_impl(int x, int y) { for (int strategy = 0; strategy < 2; ++strategy) for (int s1 = -1; s1 <= 1; ++s1) for (int s2 = -1; s2 <= 1; ++s2) if (s2 != 0) for (int id = 0; id < x; ++id) { std::vector<int> A, B; if (strategy == 0) { for (int i = 0; i < y; ++i) { int t = rand() + 1; A.push_back(t); if (i & 1) { B.push_back(t); } } } else { for (int i = 0; i < y; ++i) { A.push_back(rand() + 1); if (i & 1) { B.push_back(rand() + 1); } } } string expectedResult1; string expectedResult2; { mpz_class a = s1; mpz_class b = s2; for (auto& iter : A) a *= iter; for (auto& iter : B) b *= iter; mpz_class c = a / b; mpz_class d = a % b; stringstream ss; ss << c; ss >> expectedResult1; ss << d; ss >> expectedResult2; } string myResult1; string myResult2; { bi a = s1; bi b = s2; for (auto& iter : A) a *= iter; for (auto& iter : B) b *= iter; bi c, d; tie(c, d) = div(a, b); stringstream ss; ss << c; ss >> myResult1; ss << d; ss >> myResult2; } assert(expectedResult1 == myResult1); assert(expectedResult2 == myResult2); } } SL void bi_div_test_medium() { bi_div_test_medium_impl(100, 500); } #if !defined(CONTINUOUS_INTEGRATION_TEST) PE_REGISTER_TEST(&bi_div_test_medium, "bi_div_test_medium", MEDIUM); #endif SL void bi_div_test_big() { bi_div_test_medium_impl(10, 2000); } #if !defined(CONTINUOUS_INTEGRATION_TEST) PE_REGISTER_TEST(&bi_div_test_big, "bi_div_test_big", BIG); #endif #endif } // namespace bi_test
d72ff3d4ec3ada9988c95d4136098e7c4acf8f6a
3d18a6d10c097db154f96107079e025170442541
/FinalProject/Sources/led_thread.c
a7b4ec20bc74f7eea8f9dc84a9734599a6c33641
[]
no_license
Snazzythat/ecse69_final_project
cc0a7cb9e23fb28c7c837048382b3a597e931815
807a0c53c570a916ca75215b5f166f9009b7c596
refs/heads/master
2020-06-19T17:17:46.620000
2016-12-01T04:47:32
2016-12-01T04:47:32
74,845,506
0
1
null
null
null
null
UTF-8
C
false
false
1,113
c
//////////////////////////////////////////////////////////////////////////////// // File Name : led_thread.c // Description : program entry // Author : Team 12 // Date : Nov 1st, 2016 //////////////////////////////////////////////////////////////////////////////// // Includes #include "main.h" // Globals osThreadId led_thread_ID; osThreadDef(led_thread, osPriorityNormal, 1,0); /* ** Brief: Starts the LED thread in the OS (from Inactive into the Lifecycle) ** Params: A void pointer to initial arguments, NULL if unused ** Return: None */ void led_thread_init(void *args) { led_thread_ID = osThreadCreate(osThread(led_thread), args); } /* ** Brief: The LED thread function in the OS ** Waits for a signal from the TIM interrupt handler and then ** toggles the on board LEDs ** Params: A void pointer to initial arguments, NULL if unused ** Return: None */ void led_thread(void const *args) { while(1) { osSignalWait(0x00000001, osWaitForever); HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15); } }
5615d1cc69744580b5bcb0019a2a5f34931c71ba
17c87e23e01e074c684619ff0e56706b407f0b23
/omi-1.0.8/pal/sem.h
37bac3318770a130e9e15e9e1786f23beaf6769d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
HuaweiSwitch/OMI
8856be28d0dbe22650dc70635e2749a908802c7d
bca42b3388f0e97d21fd1e872a949fa4032adbff
refs/heads/master
2021-01-10T17:51:50.818000
2016-03-31T09:15:47
2016-03-31T09:16:07
55,116,218
2
1
null
null
null
null
UTF-8
C
false
false
4,975
h
/* **============================================================================== ** ** Open Management Infrastructure (OMI) ** ** Copyright (c) Microsoft Corporation ** ** Licensed under the Apache License, Version 2.0 (the "License"); you may not ** use this file except in compliance with the License. You may obtain a copy ** of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, ** MERCHANTABLITY OR NON-INFRINGEMENT. ** ** See the Apache 2 License for the specific language governing permissions ** and limitations under the License. ** **============================================================================== */ #ifndef _pal_sem_h #define _pal_sem_h #include <nits/base/nits.h> #if defined(PAL_HAVE_POSIX) # include <fcntl.h> # include <sys/stat.h> # include <semaphore.h> # include <time.h> #endif PAL_BEGIN_EXTERNC /* **============================================================================== ** ** Sem - semaphore ** **============================================================================== */ typedef struct _Sem { #if defined(_MSC_VER) HANDLE handle; #else sem_t* sem; #endif } Sem; typedef enum _SemUserAccess { SEM_USER_ACCESS_DEFAULT = 1, SEM_USER_ACCESS_ALLOW_ALL = 2 } SemUserAccess; _Success_(return == 0) int Sem_Init_Injected( _Out_ Sem* self, SemUserAccess userAccess, unsigned int count, NitsCallSite cs); #define Sem_Init(self, userAccess, count) Sem_Init_Injected(self, userAccess, count, NitsHere()) PAL_INLINE void Sem_Destroy( _Inout_ Sem* self) { #if defined(_MSC_VER) CloseHandle(self->handle); #else if (self->sem) { sem_close(self->sem); PAL_Free(self->sem); self->sem = NULL; } #endif } PAL_INLINE int Sem_Wait( _Inout_ Sem* self) { #if defined(_MSC_VER) return WaitForSingleObject(self->handle, INFINITE) == WAIT_OBJECT_0 ? 0 : -1; #else return sem_wait(self->sem) == 0 ? 0 : -1; #endif } #if !defined(CONFIG_HAVE_SEM_TIMEDWAIT) #include <errno.h> #include <pal/sleep.h> int __TimedWaitHelper(sem_t* sem, int milliseconds); #endif PAL_INLINE int Sem_TimedWait( _Inout_ Sem* self, int milliseconds) { #if defined(_MSC_VER) return WaitForSingleObject(self->handle, milliseconds) == WAIT_OBJECT_0 ? 0 : -1; #elif defined(CONFIG_HAVE_SEM_TIMEDWAIT) struct timespec temp = { time(0) + milliseconds / 1000, milliseconds % 1000 * 1000000 }; return sem_timedwait(self->sem, &temp) == 0 ? 0 : -1; #else return __TimedWaitHelper(self->sem, milliseconds); #endif } int Sem_Post( _Inout_ Sem* self, unsigned int count); /* **============================================================================== ** ** NamedSem - named semaphore ** **============================================================================== */ #define NAMEDSEM_FLAG_CREATE 1 #define NAMEDSEM_FLAG_EXCLUSIVE 2 typedef struct _NamedSem { #if defined(_MSC_VER) HANDLE handle; #else sem_t* sem; char semname[PAL_MAX_PATH_SIZE]; #endif } NamedSem; _Return_type_success_(return == 0) int NamedSem_Open_Injected( _Out_ NamedSem* self, SemUserAccess userAccess, unsigned int count, _In_z_ const PAL_Char *name, unsigned long flags, NitsCallSite cs); #define NamedSem_Open(self, userAccess, count, name, flags) NamedSem_Open_Injected(self, userAccess, count, name, flags, NitsHere()) void NamedSem_Close( _Inout_ NamedSem* self); PAL_INLINE int NamedSem_Wait( _Inout_ NamedSem* self) { #if defined(_MSC_VER) return WaitForSingleObject(self->handle, INFINITE) == WAIT_OBJECT_0 ? 0 : -1; #else return sem_wait(self->sem) == 0 ? 0 : -1; #endif } /* * To be called when the semaphore is no longer needed by any user of the semaphore */ PAL_INLINE void NamedSem_Destroy( _Inout_ NamedSem* self) { #if defined(_MSC_VER) #else sem_unlink(self->semname); #endif } PAL_INLINE int NamedSem_TimedWait( _Inout_ NamedSem* self, int milliseconds) { #if defined(_MSC_VER) return WaitForSingleObject(self->handle, milliseconds) == WAIT_OBJECT_0 ? 0 : -1; #elif defined(CONFIG_HAVE_SEM_TIMEDWAIT) struct timespec temp = { time(0) + milliseconds / 1000, milliseconds % 1000 * 1000000 }; return sem_timedwait(self->sem, &temp) == 0 ? 0 : -1; #else return __TimedWaitHelper(self->sem, milliseconds); #endif } int NamedSem_Post( _Inout_ NamedSem* self, unsigned int count); PAL_INLINE int NamedSem_GetValue( _Inout_ NamedSem* self, _Out_ int *value) { #if defined(_MSC_VER) *value = 0; return 0; #else return sem_getvalue(self->sem, value) == 0 ? 0 : -1; #endif } PAL_END_EXTERNC #endif /* _pal_sem_h */
[ "mao58398297" ]
mao58398297
9f2645903d93c6b9e39fbc1e9b4094496f66a432
acd52f69773265a8e46f1c07f5868cdb29b49fdd
/C/15-04/10.h
ab55daa8624b6038666f300686e00f2f0bbab40d
[ "Unlicense" ]
permissive
Numb4r/LPCI
0ebac7d2586c6e55f267aafc9da1b8499285a862
2959863bba81ae67b90c1067f73d039f5fc89e68
refs/heads/master
2020-04-27T18:00:45.747000
2019-08-24T02:53:50
2019-08-24T02:53:50
null
0
0
null
null
null
null
UTF-8
C
false
false
140
h
int perimetro_retangulo(int lado1,int lado2){ return(2*lado1+2*lado2); } int area_retangulo(int lado1,int lado2){ return lado1*lado2; }
db61a73a94750946a32fa8812887d06c1a30a7e4
75859787b3eb1fc054b5df82c26bc261421d47e0
/3rdparty/genFiles/RSRP-RangeSL-r12.c
1037dd467dcedec3ad2ad30aa7e7b0c275e4af33
[]
no_license
aa7133/RRC
e118b3d769abff4b0b42d7511530f7b1cc29d09e
955c1ceadebf97d21306f3c083b5f38a24838da4
refs/heads/master
2020-12-10T10:45:56.892000
2020-01-26T13:02:20
2020-01-26T13:02:20
233,563,734
0
1
null
null
null
null
UTF-8
C
false
false
1,767
c
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "EUTRA-RRC-Definitions" * found in "../asnFiles/36331-f60-ASNfunctions.asn" * `asn1c -fcompound-names -findirect-choice -fincludes-quoted -fno-include-deps -gen-PER -no-gen-OER -D.` */ #include "RSRP-RangeSL-r12.h" int RSRP_RangeSL_r12_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 13)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ asn_per_constraints_t asn_PER_type_RSRP_RangeSL_r12_constr_1 CC_NOTUSED = { { APC_CONSTRAINED, 4, 4, 0, 13 } /* (0..13) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static const ber_tlv_tag_t asn_DEF_RSRP_RangeSL_r12_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_RSRP_RangeSL_r12 = { "RSRP-RangeSL-r12", "RSRP-RangeSL-r12", &asn_OP_NativeInteger, asn_DEF_RSRP_RangeSL_r12_tags_1, sizeof(asn_DEF_RSRP_RangeSL_r12_tags_1) /sizeof(asn_DEF_RSRP_RangeSL_r12_tags_1[0]), /* 1 */ asn_DEF_RSRP_RangeSL_r12_tags_1, /* Same as above */ sizeof(asn_DEF_RSRP_RangeSL_r12_tags_1) /sizeof(asn_DEF_RSRP_RangeSL_r12_tags_1[0]), /* 1 */ { 0, &asn_PER_type_RSRP_RangeSL_r12_constr_1, RSRP_RangeSL_r12_constraint }, 0, 0, /* No members */ 0 /* No specifics */ };
3794c2c92e553b27a530f0276dbe213eb9ec7733
0fedaa9e1fd650888f12dd49ef34ead7785ea643
/SRC/applications/BSP_Init.c
8bf3b4e126ea2b81761313a7f54d184b409fa5af
[]
no_license
leomoons/FC_ANO
e6f0ce30289981f7af30ed101d79159bbba7d1de
5207dd2d8eaabe96b9a4cb1be7944ed2a5fdf8cc
refs/heads/main
2023-04-01T04:13:02.185000
2021-04-07T06:02:50
2021-04-07T06:02:50
324,680,992
0
0
null
null
null
null
UTF-8
C
false
false
3,252
c
/******************** (C) COPYRIGHT 2017 ANO Tech ******************************** * 作者 :匿名科创 * 官网 :www.anotc.com * 淘宝 :anotc.taobao.com * 技术Q群 :190169595 * 描述 :飞控初始化 **********************************************************************************/ #include "include.h" #include "Drv_pwm_out.h" #include "Drv_led.h" #include "Drv_spi.h" #include "Drv_icm20602.h" #include "drv_ak8975.h" #include "drv_spl06.h" #include "Drv_w25qxx.h" #include "Drv_i2c_soft.h" #include "Drv_laser.h" #include "Ano_FlightCtrl.h" #include "Drv_adc.h" #include "Drv_heating.h" #include "Ano_RC.h" #include "Ano_Sensor_Basic.h" #include "Drv_UP_Flow.h" #include "param.h" #include "controller.h" #include "motor.h" #include "Ano_DTv7.h" u8 of_init_type; u8 All_Init() { NVIC_PriorityGroupConfig(NVIC_GROUP); //中断优先级组别设置 SysTick_Configuration(); //滴答时钟 Delay_ms(100); //延时 Drv_LED_Init(); //LED功能初始化 Flash_Init(); //板载FLASH芯片驱动初始化 Para_Data_Init(); //参数数据初始化 ParamInit(); // 控制器和扰估计参数初始化 Remote_Control_Init(); PWM_Out_Init(); //初始化电调输出功能 Delay_ms(100); //延时 Drv_SPI2_init(); //spi_2初始化,用于读取飞控板上所有传感器,都用SPI读取 Drv_Icm20602CSPin_Init(); //spi片选初始化 Drv_AK8975CSPin_Init(); //spi片选初始化 Drv_SPL06CSPin_Init(); //spi片选初始化 sens_hd_check.gyro_ok = sens_hd_check.acc_ok = Drv_Icm20602Reg_Init(); //icm陀螺仪加速度计初始化,若初始化成功,则将陀螺仪和加速度的初始化成功标志位赋值 sens_hd_check.mag_ok = 1; //标记罗盘OK sens_hd_check.baro_ok = Drv_Spl0601_Init(); //气压计初始化 Usb_Hid_Init(); //飞控usb接口的hid初始化 Delay_ms(100); //延时 ANO_DT_Init(); Usart2_Init(115200); //串口2初始化,函数参数为波特率 Delay_ms(10); //延时 // Uart4_Init(115200); //首先判断是否连接的是激光模块 // if(!Drv_Laser_Init()) //激光没有有效连接,则配置为光流模式 // Uart4_Init(500000); // Delay_ms(10); //延时 Usart3_Init(115200); //用于和ros端通信 // Delay_ms(10); //延时 // Uart4_Init(19200); //接优像光流 Uart5_Init(115200);//接大功率激光 // MyDelayMs(200); //优像光流初始化 of_init_type = (Drv_OFInit()==0)?0:2; if(of_init_type==2)//优像光流初始化成功 { //大功率激光初始化 Drv_Laser_Init(); } else if(of_init_type==0)//优像光流初始化失败 { Uart4_Init(500000); //接匿名光流 } // Drv_AdcInit(); Delay_ms(100); //延时 All_PID_Init(); //PID初始化 //////////// Drv_GpsPin_Init(); //GPS初始化 串口1 Delay_ms(50); //延时 Drv_HeatingInit(); // Drv_HeatingSet(5); // Sensor_Basic_Init(); // 主控制器初始化 ControllerInit(); // 电调PWM输出初始化 MotorInit(); // ANO_DT_SendString("SYS init OK!"); return (1); } /******************* (C) COPYRIGHT 2014 ANO TECH *****END OF FILE************/
d305f8e3495d17acdb8e910a22552b1d76159128
948f4e13af6b3014582909cc6d762606f2a43365
/testcases/juliet_test_suite/testcases/CWE590_Free_Memory_Not_on_Heap/s04/CWE590_Free_Memory_Not_on_Heap__free_char_static_68b.c
f9b7cb5453042e0b67db1519f0341e5cae74e82a
[]
no_license
junxzm1990/ASAN--
0056a341b8537142e10373c8417f27d7825ad89b
ca96e46422407a55bed4aa551a6ad28ec1eeef4e
refs/heads/master
2022-08-02T15:38:56.286000
2022-06-16T22:19:54
2022-06-16T22:19:54
408,238,453
74
13
null
2022-06-16T22:19:55
2021-09-19T21:14:59
null
UTF-8
C
false
false
1,575
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE590_Free_Memory_Not_on_Heap__free_char_static_68b.c Label Definition File: CWE590_Free_Memory_Not_on_Heap__free.label.xml Template File: sources-sink-68b.tmpl.c */ /* * @description * CWE: 590 Free Memory Not on Heap * BadSource: static Data buffer is declared static on the stack * GoodSource: Allocate memory on the heap * Sink: * BadSink : Print then free data * Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> extern char * CWE590_Free_Memory_Not_on_Heap__free_char_static_68_badData; extern char * CWE590_Free_Memory_Not_on_Heap__free_char_static_68_goodG2BData; /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE590_Free_Memory_Not_on_Heap__free_char_static_68b_badSink() { char * data = CWE590_Free_Memory_Not_on_Heap__free_char_static_68_badData; printLine(data); /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */ free(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE590_Free_Memory_Not_on_Heap__free_char_static_68b_goodG2BSink() { char * data = CWE590_Free_Memory_Not_on_Heap__free_char_static_68_goodG2BData; printLine(data); /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */ free(data); } #endif /* OMITGOOD */
cb5d342c2720de427b01970d97981f1231b257a8
f27e3cb90a6bb97c48b92b626fcc2825871d91a7
/0000_base_learn/linux-sys.zh.pdf_learn/process/013_init_daemon/test.c
fe90b4dacf113cdd3e4f2b17e291a59585db4280
[]
no_license
flxshujie799056897/jiuyinzhenjing
0ecf161f9a7f6df86c78a69a60f5c9b8f5134798
caedf00ba6c80cb38996da2bae72d60597e0c202
refs/heads/master
2022-01-12T06:50:27.759000
2019-05-27T13:55:10
2019-05-27T13:55:10
null
0
0
null
null
null
null
UTF-8
C
false
false
1,209
c
#include<stdio.h> #include<stdlib.h> #include<pthread.h> int init_daemon(void){ pid_t pid; umask(0);//4 /* clear file mode creation mask */ /* parent exits , child continues */ if((pid = fork()) < 0){//1 printf("error fork()"); return -1; } else if(pid != 0){ printf("error != 0");//正确的分支 exit(0); } setsid();//2 /* become session leader */ /* if(chdir("/")<0){ //3 exit(1); } */ close(1);//5 //close(0); return 0; } int main(){ printf("begin\n"); if(init_daemon() == -1){ exit(0); } while(1){ sleep(1); } printf("end\n"); return 0; } /* 1. 创建子进程,父进程退出 所有工作在子进程中进行 形式上脱离了控制终端 2. 在子进程中创建新会话 setsid()函数 使子进程完全独立出来,脱离控制 3. 改变当前目录为根目录 chdir()函数 防止占用可卸载的文件系统 也可以换成其它路径 4. 重设文件权限掩码 umask()函数 防止继承的文件创建屏蔽字拒绝某些权限 增加守护进程灵活性 5. 关闭文件描述符 继承的打开文件不会用到,浪费系统资源,无法卸载 6. 开始执行守护进程核心工作 7. 守护进程退出处理 */
326c8aca73d729ed1466243b8b049e01d6d375c6
5bc04daeef5284871264a7446aadf7552ec0d195
/lib/percy/cryptominisat/src/sql_tablestructure.h
43bee8b2e5e0a707451d4e35dae57ac2c593563b
[ "MIT", "GPL-1.0-or-later", "GPL-2.0-only" ]
permissive
Ace-Ma/LSOracle
a8fd7efe8927f8154ea37407bac727e409098ed5
6e940906303ef6c2c6b96352f44206567fdd50d3
refs/heads/master
2020-07-23T15:36:18.224000
2019-08-16T15:58:33
2019-08-16T15:58:33
207,612,130
0
0
MIT
2019-09-10T16:42:43
2019-09-10T16:42:43
null
UTF-8
C
false
false
1,436
h
/************************************************************* MiniSat --- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson CryptoMiniSat --- Copyright (c) 2014, Mate Soos 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 __SQL_TABLESTRUCTURE_H__ #define __SQL_TABLESTRUCTURE_H__ extern char cmsat_tablestructure_sql[]; extern unsigned int cmsat_tablestructure_sql_len; #endif
de4c9d43cf9459e3ef357bb267e96e8ab8c74b44
b945b2fac11f237a49de33af1b8fa02ba3ed1814
/bspmath/include/prototypes/bsfilendpar.h
af9ba4c157d97d4973faadd972018bf62ae46187
[]
no_license
ahundiak/isdp
b94f56f7a7b02b806209ff06da8e22497f6e1386
07572eb18f07cbf762505ef34e471fa47c102df4
refs/heads/master
2021-03-12T20:02:34.067000
2011-12-16T20:03:20
2011-12-16T20:03:20
37,136,442
0
0
null
null
null
null
UTF-8
C
false
false
148
h
/* /usr3/bs/src.em/bsfilendpar.c */ extern void BSfilendpar(IGRint, IGRdouble, IGRdouble, IGRdouble, IGRint, IGRint, BSpair *, IGRint [2], BSrc *);
[ "ahundiak@e9faf64c-7e38-11de-a453-d5a50d962d30" ]
ahundiak@e9faf64c-7e38-11de-a453-d5a50d962d30
65f77212d5e067076dfaccd169a3fafdd1fc7751
b2a07c363daa20974a7822cf04ed8aa2499cf5f7
/I2S—录音与回放/User/i2c/i2c.c
36e64b6a5b861c26efb27782fae85890bb45e754
[]
no_license
capsper1/ebf_stm32h743_tiaozhanzhe_code
5e77be0bb726936a3b71a740177cd91735d5bfa8
a1d644ff1be4601571fb60f4fb33480c59013ff4
refs/heads/master
2022-09-27T01:35:49.281000
2020-06-06T03:53:51
2020-06-06T03:53:51
null
0
0
null
null
null
null
GB18030
C
false
false
5,144
c
/** ****************************************************************************** * @file i2c.c * @author fire * @version V1.0 * @date 2015-xx-xx * @brief i2c 总线驱动,方便与各种I2C传感器通讯。 ****************************************************************************** * @attention * * 实验平台:秉火 STM32 F767 开发板 * 论坛 :http://www.firebbs.cn * 淘宝 :http://firestm32.taobao.com * ****************************************************************************** */ #include "./i2c/i2c.h" #include "./delay/core_delay.h" I2C_HandleTypeDef I2C_Handle; /******************************* Function ************************************/ /** * @brief 初始化I2C总线,使用I2C前需要调用 * @param 无 * @retval 无 */ void I2cMaster_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; /* 使能I2Cx时钟 */ SENSORS_I2C_RCC_CLK_ENABLE(); /* 使能I2C GPIO 时钟 */ SENSORS_I2C_SCL_GPIO_CLK_ENABLE(); SENSORS_I2C_SDA_GPIO_CLK_ENABLE(); /* 配置I2Cx引脚: SCL ----------------------------------------*/ GPIO_InitStructure.Pin = SENSORS_I2C_SCL_GPIO_PIN; GPIO_InitStructure.Mode = GPIO_MODE_AF_OD; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStructure.Pull= GPIO_NOPULL; GPIO_InitStructure.Alternate=SENSORS_I2C_AF; HAL_GPIO_Init(SENSORS_I2C_SCL_GPIO_PORT, &GPIO_InitStructure); /* 配置I2Cx引脚: SDA ----------------------------------------*/ GPIO_InitStructure.Pin = SENSORS_I2C_SDA_GPIO_PIN; HAL_GPIO_Init(SENSORS_I2C_SDA_GPIO_PORT, &GPIO_InitStructure); if(HAL_I2C_GetState(&I2C_Handle) == HAL_I2C_STATE_RESET) { /* 强制复位I2C外设时钟 */ SENSORS_I2C_FORCE_RESET(); /* 释放I2C外设时钟复位 */ SENSORS_I2C_RELEASE_RESET(); /* I2C 配置 */ I2C_Handle.Instance = SENSORS_I2C; I2C_Handle.Init.Timing = 0x40604E73;//100KHz I2C_Handle.Init.OwnAddress1 = 0; I2C_Handle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; I2C_Handle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; I2C_Handle.Init.OwnAddress2 = 0; I2C_Handle.Init.OwnAddress2Masks = I2C_OA2_NOMASK; I2C_Handle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; I2C_Handle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; /* 初始化I2C */ HAL_I2C_Init(&I2C_Handle); /* 使能模拟滤波器 */ HAL_I2CEx_AnalogFilter_Config(&I2C_Handle, I2C_ANALOGFILTER_ENABLE); } } /** * @brief Manages error callback by re-initializing I2C. * @param Addr: I2C Address * @retval None */ static void I2Cx_Error(uint8_t Addr) { /* 恢复I2C寄存器为默认值 */ HAL_I2C_DeInit(&I2C_Handle); /* 重新初始化I2C外设 */ I2cMaster_Init(); } /** * @brief 写寄存器,这是提供给上层的接口 * @param slave_addr: 从机地址 * @param reg_addr:寄存器地址 * @param len:写入的长度 * @param data_ptr:指向要写入的数据 * @retval 正常为0,不正常为非0 */ int Sensors_I2C_WriteRegister(unsigned char slave_addr, unsigned char reg_addr, unsigned short len, unsigned char *data_ptr) { HAL_StatusTypeDef status = HAL_OK; status = HAL_I2C_Mem_Write(&I2C_Handle, slave_addr, reg_addr, I2C_MEMADD_SIZE_8BIT,data_ptr, len,I2Cx_FLAG_TIMEOUT); /* 检查通讯状态 */ if(status != HAL_OK) { /* 总线出错处理 */ I2Cx_Error(slave_addr); } while (HAL_I2C_GetState(&I2C_Handle) != HAL_I2C_STATE_READY) { } /* 检查SENSOR是否就绪进行下一次读写操作 */ while (HAL_I2C_IsDeviceReady(&I2C_Handle, slave_addr, I2Cx_FLAG_TIMEOUT, I2Cx_FLAG_TIMEOUT) == HAL_TIMEOUT); /* 等待传输结束 */ while (HAL_I2C_GetState(&I2C_Handle) != HAL_I2C_STATE_READY) { } return status; } /** * @brief 读寄存器,这是提供给上层的接口 * @param slave_addr: 从机地址 * @param reg_addr:寄存器地址 * @param len:要读取的长度 * @param data_ptr:指向要存储数据的指针 * @retval 正常为0,不正常为非0 */ int Sensors_I2C_ReadRegister(unsigned char slave_addr, unsigned char reg_addr, unsigned short len, unsigned char *data_ptr) { HAL_StatusTypeDef status = HAL_OK; status =HAL_I2C_Mem_Read(&I2C_Handle,slave_addr,reg_addr,I2C_MEMADD_SIZE_8BIT,data_ptr,len,I2Cx_FLAG_TIMEOUT); /* 检查通讯状态 */ if(status != HAL_OK) { /* 总线出错处理 */ I2Cx_Error(slave_addr); } while (HAL_I2C_GetState(&I2C_Handle) != HAL_I2C_STATE_READY) { } /* 检查SENSOR是否就绪进行下一次读写操作 */ while (HAL_I2C_IsDeviceReady(&I2C_Handle, slave_addr, I2Cx_FLAG_TIMEOUT, I2Cx_FLAG_TIMEOUT) == HAL_TIMEOUT); /* 等待传输结束 */ while (HAL_I2C_GetState(&I2C_Handle) != HAL_I2C_STATE_READY) { } return status; }
422ad3573de9a5cfe1d70016e2b6da72fc0382d3
e37c46a141827d831c6868b9677bba95de1e34bb
/bareMetal/dijk15x15/dijkstra_155.c
75d1d99d3e7a2de37b4f68662e23f490d1957f70
[]
no_license
guimadalozzo/OVP-MPSoC-NoC
0eb24342c18b6513ac920c8c44deb15d6be11443
8842cf92068ef64165efe1061e263a6c2e846f52
refs/heads/master
2020-04-01T18:48:49.032000
2018-10-31T19:41:03
2018-10-31T19:41:03
153,516,330
0
2
null
2018-12-05T19:04:22
2018-10-17T20:02:29
C
UTF-8
C
false
false
3,979
c
#include <stdlib.h> #include <stdio.h> #include "MPIe.h" #include "tasks_comm.h" #define NONE 9999 //Maximum #define MAXPROCESSORS 64 //The amount of processor #define NUM_NODES 16 //16 for small input; 160 for large input; 30 for medium input; int rank = 155; struct _NODE{ int iDist; int iPrev; int iCatched; }; typedef struct _NODE NODE; struct _UVERTEX{ int iPID; int iNID; int iDist; }; typedef struct _UVERTEX UVERTEX; UVERTEX uVertex[MAXPROCESSORS]; NODE rgnNodes[MAXPROCESSORS][NUM_NODES]; int g_qCount[MAXPROCESSORS]; int paths; int resultSend[33]; int tasks[MAXPROCESSORS][2]; int nodes_tasks[NUM_NODES*(NUM_NODES-1)/2][2]; int AdjMatrix[NUM_NODES][NUM_NODES]; int globalMiniCost[MAXPROCESSORS]; int qtdEnvios = 0; int qcount (int myID){ return(g_qCount[myID]); } void sendPath(NODE *rgnNodes, int chNode){ if ((rgnNodes+chNode)->iPrev != NONE){ sendPath(rgnNodes, (rgnNodes+chNode)->iPrev); } resultSend[paths] = chNode+1; paths++; } void sendResult(int myID,int chStart, int chEnd){ paths = 3; int k; for(k=0; k<33; k++) resultSend[k] = 0; resultSend[0] = chStart; resultSend[1] = chEnd; resultSend[2] = rgnNodes[myID][chEnd].iDist; sendPath(rgnNodes[myID], chEnd); Message msg; msg.length = 33; msg.msg[0] = -1; for(k=0; k<33; k++) msg.msg[k] = resultSend[k]; Send(msg, divider); } void dijkstra(int myID) { int x,i,v; int chStart, chEnd; int u =-1; for(x=tasks[myID][0]; x<tasks[myID][1]; x++){ chStart = nodes_tasks[x][0]; //Start node chEnd = nodes_tasks[x][1]; //End node u=-1; //Initialize and clear uVertex[myID].iDist=NONE; uVertex[myID].iPID=myID; uVertex[myID].iNID=NONE; g_qCount[myID] = 0; u=-1; for (v=0; v<NUM_NODES; v++) { rgnNodes[myID][v].iDist = AdjMatrix[chStart][v]; rgnNodes[myID][v].iPrev = NONE; rgnNodes[myID][v].iCatched = 0; } //Start working while (qcount(myID) < NUM_NODES-1){ for (i=0; i<NUM_NODES; i++) { if(rgnNodes[myID][i].iCatched==0 && rgnNodes[myID][i].iDist<uVertex[myID].iDist && rgnNodes[myID][i].iDist!=0){ uVertex[myID].iDist=rgnNodes[myID][i].iDist; uVertex[myID].iNID=i; } } globalMiniCost[myID]=NONE; if(globalMiniCost[myID]>uVertex[myID].iDist){ globalMiniCost[myID] = uVertex[myID].iDist; u=uVertex[myID].iNID; g_qCount[myID]++; } for (v=0; v<NUM_NODES; v++) { if(v==u){ rgnNodes[myID][v].iCatched = 1; continue; } if((rgnNodes[myID][v].iCatched==0 && rgnNodes[myID][v].iDist>(rgnNodes[myID][u].iDist+AdjMatrix[u][v]))){ rgnNodes[myID][v].iDist=rgnNodes[myID][u].iDist+AdjMatrix[u][v]; rgnNodes[myID][v].iPrev = u; } } uVertex[myID].iDist = NONE; //Reset } sendResult(myID,chStart,chEnd); qtdEnvios++; } Message msg; msg.length = 33; msg.msg[0] = -1; Send(msg, divider); //MADA ECHO("finaliza\n"); } int main(int argc, char *argv[]) { MemoryWrite(INITIALIZE_ROUTER, 156); int i, j; Message msg; msg.length = NUM_NODES*(NUM_NODES-1)/2; msg = Receive(); //MADAmsg, divider); for (i=0; i<(NUM_NODES*(NUM_NODES-1)/2); i++) nodes_tasks[i][0] = msg.msg[i]; msg = Receive(); //MADAmsg, divider); for (i=0; i<(NUM_NODES*(NUM_NODES-1)/2); i++) nodes_tasks[i][1] = msg.msg[i]; msg.length = MAXPROCESSORS; msg = Receive(); //MADAmsg, divider); for (i=0; i<MAXPROCESSORS; i++) { tasks[i][0] = msg.msg[i]; } msg = Receive(); //MADAmsg, divider); for (i=0; i<MAXPROCESSORS; i++) { tasks[i][1] = msg.msg[i]; } msg.length = NUM_NODES; for (i=0; i<NUM_NODES; i++) { msg = Receive(); //MADAmsg, divider); for (j=0; j<NUM_NODES; j++) AdjMatrix[j][i] = msg.msg[j]; } for(i=0; i<NUM_NODES; i++) { //MADA ECHO(" D1: "); for(j=0; j<NUM_NODES; j++) { //MADA ECHO(itoa(AdjMatrix[i][j])); //MADA ECHO(" "); } //MADA ECHO("\n"); } dijkstra(rank); //MADA ECHO(itoa(GetTick())); printf("Dijkstra_155 finished."); MemoryWrite(END_SIM, 156); return 0; }
1edfe833fd0bfe1b868357e8047416fde0d34d03
02e2f32edb8df4013061776c12c50292e85e8a6e
/src/nucleus/ft_cut_copy.c
386fcdde3a453c2771f7d552f6553dba1468a029
[]
no_license
pankratdodo/21sh
1de930ab2257999b214784ec3832c1c87d7df8bd
a61d1910b36f8589d06f73390b1abf844a6e4a79
refs/heads/master
2022-11-09T13:41:58.292000
2020-06-23T13:11:28
2020-06-23T13:11:28
224,352,247
2
0
null
null
null
null
UTF-8
C
false
false
1,510
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_cut_copy.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: qmartina <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/27 17:49:33 by qmartina #+# #+# */ /* Updated: 2020/01/27 17:49:34 by qmartina ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../inc/fshell.h" void ft_cut_copy(t_readline *p) { char *tmp; if (p->sum_read == 25) ft_putcut(p); else if (p->sum_read == 23) { free(g_cp); g_cp = ft_strndup(p->buff, p->index); tmp = p->buff; p->buff = ft_strndup(&tmp[p->index], (p->len - p->index)); free(tmp); ft_cleanstr(p->index + p->len_hint, p); p->index = 0; p->len = ft_strlen(p->buff); p->buff_size = p->len; p->len_hint = ft_printf_helper(p->mod); write(2, p->buff, p->len); ft_setcursor(0, p->len); } else if (p->sum_read == 21) ft_cut(p); else if (p->sum_read == 127 && p->index > 0) ft_do_delch(p); }
db78316e94c58b7370f94241359ef1b2feb55a55
63b4a698bc22fd54857c8fa097b1331f79c39e5a
/src/uclibc/uClibc-0.9.33.2/test/stat/stat.c
4980cdd78b33640d2c2c7de15afd9cea13884d15
[ "LGPL-2.1-only", "LGPL-2.1-or-later", "LicenseRef-scancode-other-permissive", "Apache-2.0" ]
permissive
MinimSecure/unum-sdk
67e04e2b230f9afb3ae328501a16afa4b94cdac6
30c63f0eccddba39a760671a831be3602842f3f4
refs/heads/master
2023-07-13T07:33:43.078000
2023-07-07T13:52:05
2023-07-07T13:52:05
143,209,329
33
22
Apache-2.0
2021-03-05T22:56:59
2018-08-01T21:13:43
C
UTF-8
C
false
false
1,786
c
#include <stdio.h> #include <string.h> #include <fcntl.h> #include <sys/stat.h> #include <unistd.h> #include <stdlib.h> static void print_struct_stat(char *msg, struct stat *s) { printf("%s\n", msg); /* The casts are because glibc thinks it's cool */ printf("device : 0x%llx\n",(long long)s->st_dev); printf("inode : %lld\n", (long long)s->st_ino); printf("mode : 0x%llx\n",(long long)s->st_mode); printf("nlink : %lld\n", (long long)s->st_nlink); printf("uid : %lld\n", (long long)s->st_uid); printf("gid : %lld\n", (long long)s->st_gid); printf("rdev : 0x%llx\n",(long long)s->st_rdev); printf("size : %lld\n", (long long)s->st_size); printf("blksize : %lld\n", (long long)s->st_blksize); printf("blocks : %lld\n", (long long)s->st_blocks); printf("atime : %lld\n", (long long)s->st_atime); printf("mtime : %lld\n", (long long)s->st_mtime); printf("ctime : %lld\n", (long long)s->st_ctime); } int main(int argc,char **argv) { int fd, ret; char *file; struct stat s; if (argc < 2) { fprintf(stderr, "Usage: stat FILE\n"); exit(1); } file = argv[1]; memset(&s, 0, sizeof(struct stat)); ret = stat(file, &s); if(ret<0){ perror("stat"); exit(1); } print_struct_stat("\nTesting stat:", &s); memset(&s, 0, sizeof(struct stat)); ret = lstat(file, &s); if(ret<0){ perror("lstat"); exit(1); } print_struct_stat("\nTesting lstat:", &s); fd = open(file, O_RDONLY); if(fd<0){ perror("open"); exit(1); } memset(&s, 0, sizeof(struct stat)); ret = fstat(fd,&s); if(ret<0){ perror("fstat"); exit(1); } print_struct_stat("\nTesting fstat:", &s); exit(0); }
20166b6e322f465b3473471ceaf9d9ad165b3f66
e25c8b65c0115053b14f8ecffaea94a964eefa1f
/ds/u/k/kakasi/eq/mask.c
b31cbc94b270aa530a16608def683a412d7fb2fb
[]
no_license
zwshen/mudos-game-ds
c985b4b64c586bdc7347bd95d97ab12e78a2f20f
07ea84ebdff5ee49cb482a520bdf1aaeda886cd0
refs/heads/master
2022-03-01T14:55:10.537000
2022-02-15T15:41:26
2022-02-15T15:41:26
244,925,365
4
1
null
2022-02-15T15:41:27
2020-03-04T14:44:49
C
BIG5
C
false
false
635
c
#include <ansi.h> #include <armor.h> inherit MASK; void create() { set_name(RED"寫輪"HIW"ソ"HIY"眼"NOR,({"sha-lon mask","mask",}) ); set("long",@LONG 旗木卡卡西的貼身護具之一。 LONG ); set_weight(291); if( clonep() ) set_default_object(__FILE__); else { set("limit_int",15); set("unit", "個"); set("value",3100); set("volume", 2); set("material", "gold"); } set("armor_prop/armor",5); set("armor_prop/int",2); set("armor_prop/dex",2); setup(); }
0dfd3320294559b4017e9812d1845e4c07f01377
53cec7c4ca4bef433c649c46d7cf208db4fb55e4
/u/stey/u/ziye/weapon_new/standard/body.c
32ebf9f953c578d5039879cae367cf868853fe38
[]
no_license
androids7/sjsh
c57b2f0f94932e228641a166efda8b7e19eefcc1
1c0391f6b8236f2c6e0c62a2bf904f47e3d5ca26
refs/heads/master
2021-01-09T15:35:19.076000
2016-02-21T11:27:48
2016-02-21T11:27:48
null
0
0
null
null
null
null
WINDOWS-1252
C
false
false
554
c
// tiejia.c #include <armor.h> inherit ARMOR; void create() { set_name("Ìú¼×", ({"tie jia","tiejia","jia","armor","body",})); set_weight(40000); if( clonep() ) set_default_object(__FILE__); else { set("unit", "¼þ"); set("long", "Ò»¼þ³ÁµéµéµÄÌú¼×¡£\n"); set("value", 5000); set("material", "steel"); set("armor_prop/armor", 40); set("armor_prop/dodge", -10); } setup(); }
0773347eee3c6872054e2a22a3d09b2a0bc0d8f9
0be7bb63022754d44b5d272309109f63d7862727
/m/rls/rlb/ricas.c
1b37ad47b88478ce898094ad1cfbc6a5408bccfd
[]
no_license
rust11/rust
dbb3f68d2b8eea6a5de064f644e203fa2cacd8b2
8d347f1415da38b679cbafe2eb0ae0332c0ff0ee
refs/heads/master
2023-03-10T06:35:41.453000
2023-03-08T18:26:00
2023-03-08T18:26:00
32,439,492
13
2
null
2022-08-12T04:10:56
2015-03-18T05:18:25
R
UTF-8
C
false
false
1,777
c
/* file - ricas - case statements */ #include "m:\rid\ridef.h" #include "m:\rid\ridat.h" #include "m:\rid\chdef.h" #include "m:\rid\imdef.h" #include "m:\rid\eddef.h" #include "m:\rid\stdef.h" #define riKcas 32 int riVcas = 0; int riAcas [riKcas]= {0}; /* code - ri_orf - or/of preprocessor */ void ri_orf( int brk ) { char Alab [128]; register char *lab = &Alab[0]; char *dot = edPdot; *lab = 0; if ( ! riAcas[riVcas]) { if ( riVfil != 0) { im_rep ("W-of/or not in case in (%s)", riAseg); } riAcas[++riVcas] = 2; } if (( brk) &&(riAcas[riVcas] != 1)) { st_app (" break; ", lab); } ++riAcas[riVcas]; ed_del (" "); if ( ed_del ("other")) { st_app ("default: ", lab); ri_idn (-1); ri_prt (lab); return; } dot = ut_tok (dot, (st_app ("case ", lab))); st_app (":", lab); ri_idn (-1); ri_prt (lab); st_mov (dot, edPdot); ed_del (" "); } /* code - kw_cas - case statement */ void kw_cas() { ed_pre ("switch ("); ed_app (")"); ri_beg (); riAcas[++riVcas] = 1; } /* code - kw_eca - end-case statement */ void kw_eca() { ri_end (); if ( ! riVcas) { im_rep ("W-end_case not in case in (%s)", riAseg); } else { --riVcas; } } /* code - kw_or - handle of ... to ... */ void kw_or() { char Alab [128]; register char *lab = &Alab[0]; register char *dot = edPdot; register char cha ; char ter ; int cnt ; cha = dot[1]; ter = dot[8]; dot[1] = 'a'; dot[8] = 'a'; if ( (st_cmp (dot, "'a' to 'a'"))) { dot[1] = cha; dot[8] = ter; } st_mov ("case 'a': ", lab); cnt = 8; while ( cha != ter) { if ( --cnt == 0) { cnt = 8; ri_new (); } lab[6] = cha; ri_dis (lab); if ( ter > cha) { ++cha; } else { --cha; } } ri_new (); ++riVsup; }
6f7ce927611fe4a889cb5a5e5b58eaef88188035
40de3da30239862f11a946166b50438174c2fd4e
/lib/wizards/nalle/_lasttells.c
f79127590c13f9bc08ee0ed3311e9f3dae2b6505
[ "MIT" ]
permissive
vlehtola/questmud
f53b7205351f30e846110300d60b639d52d113f8
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
refs/heads/master
2020-12-23T19:59:44.886000
2020-01-30T15:52:16
2020-01-30T15:52:16
237,240,459
0
0
null
null
null
null
UTF-8
C
false
false
529
c
cmd_lasttells(str) { object ob; if (!str) { write("Need argument.\n"); return 1; } ob = find_player(lower_case(str)); if (!ob) { write("No such a player.\n"); return 1; } last_tell(ob->query_last_tells()); if (ob->query_level()>this_player()->query_level() && this_player()->query_name()!="Nalle") { tell_object(ob,"[Last tells checked by "+this_player()->query_name()+"]\n"); } return 1; } status last_tell(string *arr) { int x; for(x=0;x<sizeof(arr);x++) { write(arr[x]); } return 1; }
e418c13f6ed8184256e55213d63af207f2a4a6d6
fe692881320e10c55962cebd165d478c1434c359
/skill/64/64039.c
9f4e4f409feaabfc8dee4302dc8eeda31eeb2275
[]
no_license
anho9339/chienquoc
130602c90c43053bbc99dfbfbc877de0b2d81dd7
cb5157d5eabcb4bb2ff71c292cfbdd5dc5fbb221
refs/heads/master
2021-07-04T07:51:49.408000
2021-02-01T15:15:58
2021-02-01T15:15:58
222,929,950
1
0
null
null
null
null
UTF-8
C
false
false
567
c
#include <ansi.h> #include <skill.h> #include <effect.h> #include <equip.h> #include <item.h> inherit "/inh/std/vitaskill"; void create() { set_skill(640); set_skill_type(2); set_number(39); set_name("Bích Long Đầu Cân Chế Tác"); set_skill_level(34); set_tool(510); set_tili(1); set_final("/item/final/65/2030"); set_skill_temp(0); set_master("0"); set_skill_color(0); set_base_rate(75); set_product( ([ "48" : 2, "236" : 1, "35" : 1, // 无 : 0, // 无 : 0, // 无 : 0, ])); set_count(1); }
f7f8e7dfd789e8ae223042325a40175a1b5920f2
48138de07966053e6aae6eeda42acf37037e23da
/All_Sprints/sprint08/t03/mx_hex_to_nbr.c
82e5a2236b118a22c57f34735a27def5a4cac935
[]
no_license
JustXAH/Ucode_MarathonC
23f425320c3671753292d5089b8ce54205dfa3c1
22ebf06f2cf2c5c62746bbb53e5397511ad5cae8
refs/heads/master
2022-12-07T16:23:47.164000
2020-09-01T12:57:24
2020-09-01T12:57:24
291,010,240
0
2
null
null
null
null
UTF-8
C
false
false
619
c
#include "hex_to_nbr.h" unsigned long mx_hex_to_nbr(const char *hex) { unsigned long nbr = 0; int n = 0; unsigned long dec = 1; if (!hex) return 0; for ( ;hex[n + 1]; n++) dec *= 16; for (int i = 0; hex[i]; i++) { if (mx_isdigit(hex[i])) nbr += (hex[i] - 48) * dec; else if (mx_isalpha(hex[i])) { if (mx_isupper(hex[i]) && hex[i] <= 'F') nbr += (hex[i] - 55) * dec; else if (mx_islower(hex[i]) && hex[i] <= 'f') nbr += (hex[i] - 87) * dec; } dec /= 16; } return nbr; }
069c70124b3efca58105d360bb0eabacbb1e8b96
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/extr_hw.c__rtl88ee_set_media_status.c
38289adb71752c25e0bb4df3df115326339b5b58
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024000
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
4,071
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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct TYPE_4__ {scalar_t__ link_state; } ; struct rtl_priv {TYPE_3__* cfg; TYPE_1__ mac80211; } ; struct ieee80211_hw {int dummy; } ; typedef enum nl80211_iftype { ____Placeholder_nl80211_iftype } nl80211_iftype ; typedef enum led_ctl_mode { ____Placeholder_led_ctl_mode } led_ctl_mode ; struct TYPE_6__ {TYPE_2__* ops; } ; struct TYPE_5__ {int /*<<< orphan*/ (* led_control ) (struct ieee80211_hw*,int) ;} ; /* Variables and functions */ int /*<<< orphan*/ COMP_ERR ; int /*<<< orphan*/ COMP_INIT ; int /*<<< orphan*/ DBG_TRACE ; int /*<<< orphan*/ DBG_WARNING ; int LED_CTL_LINK ; int LED_CTL_NO_LINK ; scalar_t__ MAC80211_LINKED ; scalar_t__ MSR ; int MSR_ADHOC ; int MSR_AP ; int MSR_INFRA ; int MSR_NOLINK ; #define NL80211_IFTYPE_ADHOC 132 #define NL80211_IFTYPE_AP 131 #define NL80211_IFTYPE_MESH_POINT 130 #define NL80211_IFTYPE_STATION 129 #define NL80211_IFTYPE_UNSPECIFIED 128 scalar_t__ REG_BCNTCFG ; int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ _rtl88ee_disable_bcn_sub_func (struct ieee80211_hw*) ; int /*<<< orphan*/ _rtl88ee_enable_bcn_sub_func (struct ieee80211_hw*) ; int /*<<< orphan*/ _rtl88ee_resume_tx_beacon (struct ieee80211_hw*) ; int /*<<< orphan*/ _rtl88ee_stop_tx_beacon (struct ieee80211_hw*) ; int /*<<< orphan*/ pr_err (char*,int) ; struct rtl_priv* rtl_priv (struct ieee80211_hw*) ; int rtl_read_byte (struct rtl_priv*,scalar_t__) ; int /*<<< orphan*/ rtl_write_byte (struct rtl_priv*,scalar_t__,int) ; int /*<<< orphan*/ stub1 (struct ieee80211_hw*,int) ; __attribute__((used)) static int _rtl88ee_set_media_status(struct ieee80211_hw *hw, enum nl80211_iftype type) { struct rtl_priv *rtlpriv = rtl_priv(hw); u8 bt_msr = rtl_read_byte(rtlpriv, MSR) & 0xfc; enum led_ctl_mode ledaction = LED_CTL_NO_LINK; u8 mode = MSR_NOLINK; switch (type) { case NL80211_IFTYPE_UNSPECIFIED: mode = MSR_NOLINK; RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to NO LINK!\n"); break; case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_MESH_POINT: mode = MSR_ADHOC; RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to Ad Hoc!\n"); break; case NL80211_IFTYPE_STATION: mode = MSR_INFRA; ledaction = LED_CTL_LINK; RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to STA!\n"); break; case NL80211_IFTYPE_AP: mode = MSR_AP; ledaction = LED_CTL_LINK; RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Set Network type to AP!\n"); break; default: pr_err("Network type %d not support!\n", type); return 1; break; } /* MSR_INFRA == Link in infrastructure network; * MSR_ADHOC == Link in ad hoc network; * Therefore, check link state is necessary. * * MSR_AP == AP mode; link state is not cared here. */ if (mode != MSR_AP && rtlpriv->mac80211.link_state < MAC80211_LINKED) { mode = MSR_NOLINK; ledaction = LED_CTL_NO_LINK; } if (mode == MSR_NOLINK || mode == MSR_INFRA) { _rtl88ee_stop_tx_beacon(hw); _rtl88ee_enable_bcn_sub_func(hw); } else if (mode == MSR_ADHOC || mode == MSR_AP) { _rtl88ee_resume_tx_beacon(hw); _rtl88ee_disable_bcn_sub_func(hw); } else { RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, "Set HW_VAR_MEDIA_STATUS: No such media status(%x).\n", mode); } rtl_write_byte(rtlpriv, MSR, bt_msr | mode); rtlpriv->cfg->ops->led_control(hw, ledaction); if (mode == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); return 0; }
fdb1ab0c6698d9fe649d7dbb68845fef034eb4ea
f08bbe3a9406fe3e39aa3c03eb979fdd88ea819a
/Oscillographer/EMWIN/STemWin/inc/GUIDRV_Dist.h
a6e47c4317c3dcb52a234fbdcea32f116e50cc22
[]
no_license
lazode/MCU_Code
e41def826d7b812fe00db76bd288106d7acd37e3
1105eb8f289f9107d97b3dc9de0e50a456570964
refs/heads/master
2020-12-30T15:07:39.352000
2017-08-11T06:11:00
2017-08-11T06:11:00
91,100,444
7
0
null
null
null
null
UTF-8
C
false
false
3,321
h
/********************************************************************* * SEGGER Microcontroller GmbH & Co. KG * * Solutions for real time microcontroller applications * ********************************************************************** * * * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG * * * * Internet: www.segger.com Support: [email protected] * * * ********************************************************************** ** emWin V5.30 - Graphical user interface for embedded applications ** All Intellectual Property rights in the Software belongs to SEGGER. emWin is protected by international copyright laws. Knowledge of the source code may not be used to write a similar product. This file may only be used in accordance with the following terms: The software has been licensed to ARM LIMITED whose registered office is situated at 110 Fulbourn Road, Cambridge CB1 9NJ, England solely for the purposes of creating libraries for ARM7, ARM9, Cortex-M series, and Cortex-R4 processor-based devices, sublicensed and distributed as part of the MDK-ARM Professional under the terms and conditions of the End User License supplied with the MDK-ARM Professional. Full source code is available at: www.segger.com We appreciate your understanding and fairness. ---------------------------------------------------------------------- Licensing information Licensor: SEGGER Software GmbH Licensed to: ARM Ltd Licensed SEGGER software: emWin License number: GUI-00181 License model: LES-SLA-20007, Agreement, effective since October 1st 2011 Licensed product: MDK-ARM Professional Licensed platform: ARM7/9, Cortex-M/R4 Licensed number of seats: - ---------------------------------------------------------------------- File : GUIDRV_Dist.h Purpose : Interface definition for GUIDRV_Dist driver ---------------------------END-OF-HEADER------------------------------ */ #ifndef GUIDRV_DIST_H #define GUIDRV_DIST_H #if defined(__cplusplus) extern "C" { /* Make sure we have C-declarations in C++ programs */ #endif /********************************************************************* * * Display driver */ // // Address // extern const GUI_DEVICE_API GUIDRV_Dist_API; // // Macros to be used in configuration files // #if defined(WIN32) && !defined(LCD_SIMCONTROLLER) #define GUIDRV_DIST &GUIDRV_Win_API #else #define GUIDRV_DIST &GUIDRV_Dist_API #endif /********************************************************************* * * Public routines */ #if defined(WIN32) && !defined(LCD_SIMCONTROLLER) #define GUIDRV_Dist_AddDriver(pDevice, pDriver, pRect) #else void GUIDRV_Dist_AddDriver(GUI_DEVICE * pDevice, GUI_DEVICE * pDriver, GUI_RECT * pRect); #endif #if defined(__cplusplus) } #endif #endif /* GUIDRV_DIST_H */ /*************************** End of file ****************************/
3077e697336e3b20028dca12719c0c043266dd4b
14c77d6dee2f0fd522ea8cbf31ee68786856f11f
/7079_Big_Mod.c
271e16f31fe464f669ee00a4cfb593526e397279
[]
no_license
hydai/NTHU-OJ-Code
c3d10dddb6748b7df0c299b69ad9101fe0386b4c
6016952e3e44243413f9b5eab3dd1f70cd347b18
refs/heads/master
2021-01-17T08:37:41.216000
2016-07-09T02:26:45
2016-07-09T02:26:45
12,322,536
6
0
null
null
null
null
UTF-8
C
false
false
893
c
#include <stdio.h> #include <stdlib.h> /*value*/ int m; /*function*/ long long int mode(int b, int p); int main(int argc, char *argv[]) { int b, p; long long int ans; while (EOF != scanf("%d%d%d", &b, &p, &m)) { if (b%m==0) { ans = 0; } ans = mode(b, p); printf("%lld\n", ans); } return 0; } long long int mode(int b, int p) { long long int ans = 1; if (p==0 || b==1) { return 1; } if (p==1) { return b; } if (p%2==0) { if (b>m) { ans = mode(b%m, p); } else if (b<m) { ans = mode(b*b, p/2); } } else { if (b>m) { ans = mode(b%m, p-1)*b; } else if (b<m) { ans = mode(b*b, (p-1)/2)*b; } if (ans>m) { ans%=m; } } return ans; }
19da40db10975e1c5c7e00f101a3bea0d05cb264
50e7f29b07531bf3db585e420fb7a4209bacf102
/unity-samples/Temp/il2cppOutput/il2cppOutput/Mono_Security_Mono_Security_Protocol_Tls_Handshake_Handshake.h
e25e05b3de9837230285b4552ac21a01bfe6a7b8
[]
no_license
golergka/appboy-unity-sdk
0d7a8732c6dfd66ffbf30c9214c932a04f2b6d59
deeeba3849bd3a8e6a1166e95a6a5be6f5038646
refs/heads/master
2021-01-18T11:53:22.096000
2016-03-17T12:24:52
2016-03-17T12:24:52
54,115,484
0
0
null
2016-03-17T12:18:57
2016-03-17T12:18:56
null
UTF-8
C
false
false
436
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_Enum.h" #include "Mono_Security_Mono_Security_Protocol_Tls_Handshake_Handshake.h" // Mono.Security.Protocol.Tls.Handshake.HandshakeType struct HandshakeType_t1350 { // System.Byte Mono.Security.Protocol.Tls.Handshake.HandshakeType::value__ uint8_t ___value___1; };
f85279fed26ed221e934ec0179c20fbdbd9d1b1d
9bfd1035daefdc9037289089ed4e6d00b208b672
/src/image.h
8f64fd652643b8e2dddbdd1818a34d0c58f41f37
[]
no_license
pjreddie/dl-hw1
bbb2a22e91b37b60a9ba6fb61b0ea2954a1bf63d
8440db1f85807f2fd33b18498a212a5f46619e8a
refs/heads/master
2020-04-01T08:39:07.358000
2018-10-25T19:31:17
2018-10-25T19:31:17
153,040,722
19
28
null
null
null
null
UTF-8
C
false
false
1,274
h
#ifndef IMAGE_H #define IMAGE_H #include <stdio.h> // DO NOT CHANGE THIS FILE #include "matrix.h" #define TWOPI 6.2831853 #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) typedef struct{ int w,h,c; float *data; } image; // Basic operations float get_pixel(image im, int x, int y, int c); void set_pixel(image im, int x, int y, int c, float v); image copy_image(image im); void shift_image(image im, int c, float v); void scale_image(image im, int c, float v); void clamp_image(image im); image get_channel(image im, int c); int same_image(image a, image b); image sub_image(image a, image b); image add_image(image a, image b); // Loading and saving typedef enum{ PNG, BMP, TGA, JPG } IMAGE_TYPE; image make_image(int w, int h, int c); image float_to_image(float *data, int w, int h, int c); image load_image(char *filename); void save_image_options(image im, const char *name, IMAGE_TYPE f, int quality); void save_image(image im, const char *name); void free_image(image im); // Resizing float nn_interpolate(image im, float x, float y, int c); image nn_resize(image im, int w, int h); float bilinear_interpolate(image im, float x, float y, int c); image bilinear_resize(image im, int w, int h); // Used for saving images #endif
b217cf352fd01dcd53f6d84df5144c03be758dd5
43441cde04695a2bf62a7a5f7db4072aa0a6d366
/vc60/G3D/Stdafx.h
52bd5687350a089aee5d51cb0558126e1952c8f6
[]
no_license
crespo2014/cpp-lib
a8aaf4b963d3bf41f91db3832dd51bcf601d54ee
de6b653bf4c689fc5ceb3e9fe0f4fe47d79acf95
refs/heads/master
2020-12-24T15:23:32.396000
2016-03-21T11:53:37
2016-03-21T11:53:37
26,559,932
0
0
null
null
null
null
UTF-8
C
false
false
1,529
h
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__8FC3CE27_AEEE_11D3_A036_0000E8DE4B3B__INCLUDED_) #define AFX_STDAFX_H__8FC3CE27_AEEE_11D3_A036_0000E8DE4B3B__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #ifndef _AFX_NO_OLE_SUPPORT #include <afxole.h> // MFC OLE classes #include <afxodlgs.h> // MFC OLE dialog classes #include <afxdisp.h> // MFC Automation classes #endif // _AFX_NO_OLE_SUPPORT #ifndef _AFX_NO_DB_SUPPORT #include <afxdb.h> // MFC ODBC database classes #endif // _AFX_NO_DB_SUPPORT #ifndef _AFX_NO_DAO_SUPPORT #include <afxdao.h> // MFC DAO database classes #endif // _AFX_NO_DAO_SUPPORT #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT #include <gl\gl.h> #include <gl\glu.h> #include <afxmt.h> #include "math.h" //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__8FC3CE27_AEEE_11D3_A036_0000E8DE4B3B__INCLUDED_)
e959db03dfcb3736ed80c3dccc0a5f0d2a6c349f
caf26a8bb8ffe570e699d9c968c2b447b1f399ba
/firmware/Back_FC/MAVLINK/minimal/mavlink_msg_gps_status.h
d8673bd8688814160361437266db9e9adc5182fe
[]
no_license
bygreencn/Oldx_fly_controller
d07bfd00b29b6ebe4d1c76cc7eb02240ca6d47aa
021cd924378f77e56d89289ee5c4e864ea787402
refs/heads/master
2020-04-13T08:44:30.883000
2018-12-25T14:44:50
2018-12-25T14:44:50
163,090,609
1
2
null
2018-12-25T14:45:53
2018-12-25T14:45:52
null
UTF-8
C
false
false
5,040
h
// MESSAGE GPS_STATUS PACKING #ifndef _MAVLINK_MSG_GPS_STATUS_H_ #define _MAVLINK_MSG_GPS_STATUS_H_ #include "../mavlink_helpers.h" #define MAVLINK_MSG_ID_GPS_STATUS 25 typedef struct __mavlink_gps_status_t { uint8_t satellites_visible; /*< Number of satellites visible*/ uint8_t satellite_prn[20]; /*< Global satellite ID*/ uint8_t satellite_used[20]; /*< 0: Satellite not used, 1: used for localization*/ uint8_t satellite_elevation[20]; /*< Elevation (0: right on top of receiver, 90: on the horizon) of satellite*/ uint8_t satellite_azimuth[20]; /*< Direction of satellite, 0: 0 deg, 255: 360 deg.*/ uint8_t satellite_snr[20]; /*< Signal to noise ratio of satellite*/ } mavlink_gps_status_t; #define MAVLINK_MSG_ID_GPS_STATUS_LEN 101 #define MAVLINK_MSG_ID_25_LEN 101 #define MAVLINK_MSG_ID_GPS_STATUS_CRC 23 #define MAVLINK_MSG_ID_25_CRC 23 #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_PRN_LEN 20 #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_USED_LEN 20 #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_ELEVATION_LEN 20 #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_AZIMUTH_LEN 20 #define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_SNR_LEN 20 #define MAVLINK_MESSAGE_INFO_GPS_STATUS { \ "GPS_STATUS", \ 6, \ { { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_status_t, satellites_visible) }, \ { "satellite_prn", NULL, MAVLINK_TYPE_UINT8_T, 20, 1, offsetof(mavlink_gps_status_t, satellite_prn) }, \ { "satellite_used", NULL, MAVLINK_TYPE_UINT8_T, 20, 21, offsetof(mavlink_gps_status_t, satellite_used) }, \ { "satellite_elevation", NULL, MAVLINK_TYPE_UINT8_T, 20, 41, offsetof(mavlink_gps_status_t, satellite_elevation) }, \ { "satellite_azimuth", NULL, MAVLINK_TYPE_UINT8_T, 20, 61, offsetof(mavlink_gps_status_t, satellite_azimuth) }, \ { "satellite_snr", NULL, MAVLINK_TYPE_UINT8_T, 20, 81, offsetof(mavlink_gps_status_t, satellite_snr) }, \ } \ } /** * @brief Pack a gps_status message * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * * @param satellites_visible Number of satellites visible * @param satellite_prn Global satellite ID * @param satellite_used 0: Satellite not used, 1: used for localization * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg. * @param satellite_snr Signal to noise ratio of satellite * @return length of the message in bytes (excluding serial stream start sign) */ uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr); uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t satellites_visible,const uint8_t *satellite_prn,const uint8_t *satellite_used,const uint8_t *satellite_elevation,const uint8_t *satellite_azimuth,const uint8_t *satellite_snr); uint16_t mavlink_msg_gps_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status); uint16_t mavlink_msg_gps_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status); #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr); #if MAVLINK_MSG_ID_GPS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN void mavlink_msg_gps_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr); #endif #endif // MESSAGE GPS_STATUS UNPACKING uint8_t mavlink_msg_gps_status_get_satellites_visible(const mavlink_message_t* msg); uint16_t mavlink_msg_gps_status_get_satellite_prn(const mavlink_message_t* msg, uint8_t *satellite_prn); uint16_t mavlink_msg_gps_status_get_satellite_used(const mavlink_message_t* msg, uint8_t *satellite_used); uint16_t mavlink_msg_gps_status_get_satellite_elevation(const mavlink_message_t* msg, uint8_t *satellite_elevation); uint16_t mavlink_msg_gps_status_get_satellite_azimuth(const mavlink_message_t* msg, uint8_t *satellite_azimuth); uint16_t mavlink_msg_gps_status_get_satellite_snr(const mavlink_message_t* msg, uint8_t *satellite_snr); void mavlink_msg_gps_status_decode(const mavlink_message_t* msg, mavlink_gps_status_t* gps_status); #endif /*_xx_h_*/
b44fd3b9a001535f1927033ca48a5be1527afbc9
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/abd0265d-4c43-4805-b898-2b1b1c979923.c
23953ab547c8114b260ca41cdefa2d94afd81f67
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944000
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
608
c
#include <string.h> #include <stdio.h> int main() { int i=0; int j=14; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = i/j; l = l/j; l = k%j; l = k-j; k = k-k*i; //variables //random /* START VULNERABILITY */ int a; int b[69]; int c[47]; a = 0; while (( a - 1 ) > -1) { a--; /* START BUFFER SET */ *((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 )); /* END BUFFER SET */ //random } /* END VULNERABILITY */ //random printf("%d%d\n",k,l); return 0; }
cf0612c57b36d6c3644efc482aac3bd55cf2ddac
9a3b9d80afd88e1fa9a24303877d6e130ce22702
/src/Providers/UNIXProviders/StorageRelocationService/UNIX_StorageRelocationServicePrivate.h
9d7da4ab60cb56f61e80e76b7ba21d841b109555
[ "MIT" ]
permissive
brunolauze/openpegasus-providers
3244b76d075bc66a77e4ed135893437a66dd769f
f24c56acab2c4c210a8d165bb499cd1b3a12f222
refs/heads/master
2020-04-17T04:27:14.970000
2015-01-04T22:08:09
2015-01-04T22:08:09
19,707,296
0
0
null
null
null
null
UTF-8
C
false
false
2,554
h
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #if defined(PEGASUS_OS_HPUX) # include "UNIX_StorageRelocationServicePrivate_HPUX.h" #elif defined(PEGASUS_OS_LINUX) # include "UNIX_StorageRelocationServicePrivate_LINUX.h" #elif defined(PEGASUS_OS_DARWIN) # include "UNIX_StorageRelocationServicePrivate_DARWIN.h" #elif defined(PEGASUS_OS_AIX) # include "UNIX_StorageRelocationServicePrivate_AIX.h" #elif defined(PEGASUS_OS_FREEBSD) # include "UNIX_StorageRelocationServicePrivate_FREEBSD.h" #elif defined(PEGASUS_OS_SOLARIS) # include "UNIX_StorageRelocationServicePrivate_SOLARIS.h" #elif defined(PEGASUS_OS_ZOS) # include "UNIX_StorageRelocationServicePrivate_ZOS.h" #elif defined(PEGASUS_OS_VMS) # include "UNIX_StorageRelocationServicePrivate_VMS.h" #elif defined(PEGASUS_OS_TRU64) # include "UNIX_StorageRelocationServicePrivate_TRU64.h" #else # include "UNIX_StorageRelocationServicePrivate_STUB.h" #endif
93aabd81aeb654a4f0c98886f687b127b3124af7
3d0de0f2549d9025540fcec88624c72c079b406f
/BSW/src/bsw/gen/CanIf/src/CanIf_TriggerTransmit.c
86228e4eb3c6f75359a840610685dce687fba441
[]
no_license
ongbut999/Jenkins_Test
ee19936e1577bd93d2755d21299ed3fbec553db6
abb74480c4ce938dd1c7463627c4074071580af4
refs/heads/master
2023-06-23T21:26:57.794000
2021-07-22T08:05:20
2021-07-22T08:05:20
388,372,287
0
0
null
null
null
null
UTF-8
C
false
false
1,714
c
/* *************************************************************************************************** * Includes *************************************************************************************************** */ #include "CanIf_Prv.h" /* *************************************************************************************************** * used functions *************************************************************************************************** */ #if (CANIF_TRIGGERTRANSMIT_SUPPORT == STD_ON) #define CANIF_START_SEC_CODE #include "CanIf_MemMap.h" Std_ReturnType CanIf_TriggerTransmit(PduIdType TxPduId, PduInfoType* PduInfoPtr) { VAR (Std_ReturnType, AUTOMATIC ) lRetVal_en = E_NOT_OK; #if (CANIF_CFG_TX_FEATURE_ENABLED== STD_ON) /* Pointer to Tx Pdu configuration */ P2CONST(CanIf_Cfg_TxPduConfig_tst, AUTOMATIC, CANIF_CFG_CONST) lTxPduConfig_pst; VAR(uint16, AUTOMATIC) ltxPduCustId_t; /* If CAN Interface is uninitialized, report to DET and return E_NOT_OK */ CANIF_DET_REPORT_ERROR_NOT_OK((FALSE == CanIf_Prv_InitStatus_b), CANIF_TRIGGER_TRANSMIT_SID, CANIF_E_UNINIT) ltxPduCustId_t = CanIf_Prv_ConfigSet_tpst->TxPduIdTable_Ptr[TxPduId]; lTxPduConfig_pst = (CanIf_Prv_ConfigSet_tpst->CanIf_TxPduConfigPtr) + ltxPduCustId_t; /*TxPduId passed is always valid as it is sent by Canif to Can*/ if(lTxPduConfig_pst->TxPduTriggerTransmit == TRUE) { if(NULL_PTR != lTxPduConfig_pst->UserTriggerTransmit) { lRetVal_en = lTxPduConfig_pst->UserTriggerTransmit(TxPduId, PduInfoPtr); } } #endif return lRetVal_en; } #define CANIF_STOP_SEC_CODE #include "CanIf_MemMap.h" #endif
8f07dbee6914ea966e7a17f9c878dde87d7c257f
5bcbe7af06d0e47fa8c95041639e5b43f22e153a
/usr/tools/wpm/conf.h
d9183fd840d633462ff253bf681c41a7af28c061
[]
no_license
hongbochen/OS-Zero
d19a84591718fe95b622a60ba5578e70853954a5
a636f512fe31626b6aa463c0f7a635167dee951a
refs/heads/master
2020-04-05T23:30:01.475000
2014-06-24T12:32:12
2014-06-24T12:32:12
null
0
0
null
null
null
null
UTF-8
C
false
false
298
h
#ifndef __WPM_CONF_H__ #define __WPM_CONF_H__ #define WPMPREWARM 1 #define WPMVECFULL 0 #define WPMPROF 1 #define WPMVEC 0 #define PTHREAD 1 #define WPMDB 0 #define WPMDEBUG 0 #define WPMTRACE 0 #define ZASDB 0 #define WPMWORDSIZE 32 #endif /* __WPM_CONF_H__ */
26516eeb302ec10ec5ccb915df2051c0ec08a920
805666a84218be543410ff5089588f1572dd20ec
/d/quanzhou/yongning.c
405b9906349c5168742a6fa1ccc739e6c54c8adc
[]
no_license
mudchina/xkx2001
d47a9caca686ab7c89fe0b9140fbaf9d3601e1f5
4e8f8a13a72884d5dbe4b589542eb34e29e89d70
refs/heads/master
2021-01-10T06:50:29.517000
2016-02-20T14:09:12
2016-02-20T14:09:12
52,156,038
24
23
null
null
null
null
GB18030
C
false
false
801
c
//Cracked by Roath // yongning.c 永宁港 // qfy Nov 3, 1996 // modified by aln #include <ansi.h> inherit HARBOR; void create() { set("short", "永宁港"); set("long", @LONG 永宁港是泉州三大港口之一。这里港阔水深,风平浪静。极目远眺,海天 一色,蔚蓝无暇。岸边停靠着密密麻麻的各种船只。南边的姑嫂塔流传着一个 感人的故事。 LONG ); set("exits", ([ /* sizeof() == 4 */ "south" : __DIR__"gushao", "northwest" : __DIR__"gangkou2", ])); set("objects", ([ __DIR__"npc/tiao-fu" : 1, __DIR__"npc/kuli" : 1, ])); set("no_clean_up", 0); set("outdoors", "quanzhou"); set("navigate/locx", 0); set("navigate/locy", -280); set("cost", 1); setup(); }
723e17d307a937d2a0b8fbcd4834e76b8bde5d40
91ddd17e771f99cd4eb5acec6e9127f2acb833d6
/C-algorithm/ProgrammingPearls/maxSumOfSubsequence/maxSequence_2.c
cee643333950f4be8a7377b4eb28008f864a6184
[]
no_license
jabc1/ProgramLearning
8a5a7d174e9cf6b1d0672704effa8c320380442e
90684a7f5fa76b784375b258658396c9f23f2314
refs/heads/master
2020-05-17T08:38:00.222000
2018-03-11T14:37:30
2018-03-11T14:37:30
null
0
0
null
null
null
null
UTF-8
C
false
false
1,021
c
/** 最大子序列求和 时间复杂度:O(n^2) */ int maxSequence(int *arr, int n){ int maxSum = 0; int currentSum = 0; for (int i = 0; i < n; i++){ currentSum = 0; for (int j = i; j < n; j++){ // 必须有等于号 currentSum += arr[j]; if (maxSum < currentSum){ maxSum = currentSum; } } } return maxSum; } /********************** 第二种方法 *********************/ int maxSequence(int *arr, int n){ if (arr == NULL || n < 1){ return -1; // invalid arguments } int *cumarr = (int *)malloc(n * sizeof(int)); cumarr[0] = arr[0]; for (int i = 1; i < n; i++){ cumarr[i] = cumarr[i-1] + arr[i]; } // partial_sum int maxSum = arr[0]; int currentSum = 0; for (int i = 0; i < n; i++){ for (int j = i; j < n; j++){ if (i == 0){ currentSum = cumarr[j] - 0; } else{ currentSum = cumarr[j] - cumarr[i-1]; } if (maxSum < currentSum){ maxSum = currentSum; } } } return maxSum; }
1ab6078efe73ef412931f3ea46d4b43180afd40b
e81220623f8e27b9df4364cd41cd63ed0edf9d72
/NavigationDG/jni/3rdParty/fftw3/dft/scalar/codelets/t2_4.c
75a1fa2547ed0d038a03aebcafea77b6938909a2
[ "Apache-2.0" ]
permissive
jwietrzykowski/DiamentowyGrant
f04514812e7e4f46815f073e3df3820d5f7501cd
490470eff4cacc04102109e25a17044da8273c89
refs/heads/master
2021-05-30T03:49:11.013000
2015-09-16T11:04:29
2015-09-16T11:04:29
null
0
0
null
null
null
null
UTF-8
C
false
false
5,367
c
/* * Copyright (c) 2003, 2007-8 Matteo Frigo * Copyright (c) 2003, 2007-8 Massachusetts Institute of Technology * * 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-1307 USA * */ /* This file was automatically generated --- DO NOT EDIT */ /* Generated on Sun Jul 12 06:37:48 EDT 2009 */ #include "../../codelet-dft.h" #ifdef HAVE_FMA /* Generated by: ../../../genfft/gen_twiddle -fma -reorder-insns -schedule-for-pipeline -compact -variables 4 -pipeline-latency 4 -twiddle-log3 -precompute-twiddles -n 4 -name t2_4 -include t.h */ /* * This function contains 24 FP additions, 16 FP multiplications, * (or, 16 additions, 8 multiplications, 8 fused multiply/add), * 33 stack variables, 0 constants, and 16 memory accesses */ #include "../t.h" static void t2_4(float *ri, float *ii, const float *W, stride rs, INT mb, INT me, INT ms) { INT m; for (m = mb, W = W + (mb * 4); m < me; m = m + 1, ri = ri + ms, ii = ii + ms, W = W + 4, MAKE_VOLATILE_STRIDE(rs)) { E Ti, Tq, To, Te, Ty, Tz, Tm, Ts; { E T2, T6, T3, T5; T2 = W[0]; T6 = W[3]; T3 = W[2]; T5 = W[1]; { E T1, Tx, Td, Tw, Tj, Tl, Ta, T4, Tk, Tr; T1 = ri[0]; Ta = T2 * T6; T4 = T2 * T3; Tx = ii[0]; { E T8, Tb, T7, Tc; T8 = ri[WS(rs, 2)]; Tb = FNMS(T5, T3, Ta); T7 = FMA(T5, T6, T4); Tc = ii[WS(rs, 2)]; { E Tf, Th, T9, Tv, Tg, Tp; Tf = ri[WS(rs, 1)]; Th = ii[WS(rs, 1)]; T9 = T7 * T8; Tv = T7 * Tc; Tg = T2 * Tf; Tp = T2 * Th; Td = FMA(Tb, Tc, T9); Tw = FNMS(Tb, T8, Tv); Ti = FMA(T5, Th, Tg); Tq = FNMS(T5, Tf, Tp); } Tj = ri[WS(rs, 3)]; Tl = ii[WS(rs, 3)]; } To = T1 - Td; Te = T1 + Td; Ty = Tw + Tx; Tz = Tx - Tw; Tk = T3 * Tj; Tr = T3 * Tl; Tm = FMA(T6, Tl, Tk); Ts = FNMS(T6, Tj, Tr); } } { E Tn, TA, Tu, Tt; Tn = Ti + Tm; TA = Ti - Tm; Tu = Tq + Ts; Tt = Tq - Ts; ii[WS(rs, 3)] = TA + Tz; ii[WS(rs, 1)] = Tz - TA; ri[0] = Te + Tn; ri[WS(rs, 2)] = Te - Tn; ri[WS(rs, 1)] = To + Tt; ri[WS(rs, 3)] = To - Tt; ii[WS(rs, 2)] = Ty - Tu; ii[0] = Tu + Ty; } } } static const tw_instr twinstr[] = { {TW_CEXP, 0, 1}, {TW_CEXP, 0, 3}, {TW_NEXT, 1, 0} }; static const ct_desc desc = { 4, "t2_4", twinstr, &fftwf_dft_t_genus, {16, 8, 8, 0}, 0, 0, 0 }; void fftwf_codelet_t2_4 (planner *p) { fftwf_kdft_dit_register (p, t2_4, &desc); } #else /* HAVE_FMA */ /* Generated by: ../../../genfft/gen_twiddle -compact -variables 4 -pipeline-latency 4 -twiddle-log3 -precompute-twiddles -n 4 -name t2_4 -include t.h */ /* * This function contains 24 FP additions, 16 FP multiplications, * (or, 16 additions, 8 multiplications, 8 fused multiply/add), * 21 stack variables, 0 constants, and 16 memory accesses */ #include "../t.h" static void t2_4(float *ri, float *ii, const float *W, stride rs, INT mb, INT me, INT ms) { INT m; for (m = mb, W = W + (mb * 4); m < me; m = m + 1, ri = ri + ms, ii = ii + ms, W = W + 4, MAKE_VOLATILE_STRIDE(rs)) { E T2, T4, T3, T5, T6, T8; T2 = W[0]; T4 = W[1]; T3 = W[2]; T5 = W[3]; T6 = FMA(T2, T3, T4 * T5); T8 = FNMS(T4, T3, T2 * T5); { E T1, Tp, Ta, To, Te, Tk, Th, Tl, T7, T9; T1 = ri[0]; Tp = ii[0]; T7 = ri[WS(rs, 2)]; T9 = ii[WS(rs, 2)]; Ta = FMA(T6, T7, T8 * T9); To = FNMS(T8, T7, T6 * T9); { E Tc, Td, Tf, Tg; Tc = ri[WS(rs, 1)]; Td = ii[WS(rs, 1)]; Te = FMA(T2, Tc, T4 * Td); Tk = FNMS(T4, Tc, T2 * Td); Tf = ri[WS(rs, 3)]; Tg = ii[WS(rs, 3)]; Th = FMA(T3, Tf, T5 * Tg); Tl = FNMS(T5, Tf, T3 * Tg); } { E Tb, Ti, Tn, Tq; Tb = T1 + Ta; Ti = Te + Th; ri[WS(rs, 2)] = Tb - Ti; ri[0] = Tb + Ti; Tn = Tk + Tl; Tq = To + Tp; ii[0] = Tn + Tq; ii[WS(rs, 2)] = Tq - Tn; } { E Tj, Tm, Tr, Ts; Tj = T1 - Ta; Tm = Tk - Tl; ri[WS(rs, 3)] = Tj - Tm; ri[WS(rs, 1)] = Tj + Tm; Tr = Tp - To; Ts = Te - Th; ii[WS(rs, 1)] = Tr - Ts; ii[WS(rs, 3)] = Ts + Tr; } } } } static const tw_instr twinstr[] = { {TW_CEXP, 0, 1}, {TW_CEXP, 0, 3}, {TW_NEXT, 1, 0} }; static const ct_desc desc = { 4, "t2_4", twinstr, &fftwf_dft_t_genus, {16, 8, 8, 0}, 0, 0, 0 }; void fftwf_codelet_t2_4 (planner *p) { fftwf_kdft_dit_register(p, t2_4, &desc); } #endif /* HAVE_FMA */
e329a6d561f98c7ebb6243011394b7451a6e2b48
7069cb71852cf1a5995133b1858bab3e46b501f9
/source/ekernel/drivers/drv/legacy/deviceman/devices/dev.h
368d04cf99d6cf4e2bdf98d8b8d21bf15c6f04a5
[]
no_license
lindenis-org/lindenis-v833-RTOS-melis-4.0
d2646c7093851d45645679a55bcf1462b8d4d18e
71ab8faeee960e27ef83a9ff2e4ae4b7f33eda20
refs/heads/master
2023-06-24T01:40:55.111000
2021-07-23T08:01:43
2021-07-23T08:09:40
388,733,103
14
13
null
null
null
null
GB18030
C
false
false
2,971
h
/* ********************************************************************************************************* * ePOS * the Easy Portable/Player Operation System * eMOD sub-system * * (c) Copyright 2006-2007, Steven.ZGJ China * All Rights Reserved * * File : devman_private.h * Version: V1.0 * By : steven.zgj ********************************************************************************************************* */ #ifndef __DEV_H__ #define __DEV_H__ #include <typedef.h> #include <sys_device.h> #define NODETYPE_CLASS 0x00000000 #define NODETYPE_DEV 0x00000001 #define DEV_STAT_INACTIVE 0x00 #define DEV_STAT_ACTIVE 0x01 typedef struct __DEV_NODE __dev_node_t; typedef struct __DEV_CLASSNODE __dev_classnode_t; /* 设备类节点 */ struct __DEV_CLASSNODE { __dev_classnode_t *next; __dev_node_t *nodelist; int nodetype; __u8 usedcnt; char *name; }; /* 设备节点句柄,此句柄用于保存一个设备各种信息的数据结构 */ struct __DEV_NODE { __dev_node_t *next; __dev_classnode_t *classnode; /* 类节点 */ int attrib; char *name; char pletter; __u32 opentimes; /* 句柄打开的次数 */ __u32 status; /* 节点状态:0表示正常,0xff表示为死节点(驱动程序代码已经卸载)*/ __dev_devop_t DevOp; /* 保存设备操作句柄 */ void *pOpenArg; __hdle sem; __hdle hDev; /* 设备句柄 */ }; /* ****************************************************** * 设备节点操作句柄,此句柄用于用户打开一个设备节点时返 * 回的句柄,它不同于设备句柄,它是设备节点的实例,而设 * 备句柄是设备的实例。 ****************************************************** */ typedef struct __DEV_DEV { __dev_node_t *devnode; /* 指向设备节点 */ __hdle hDev; /* 设备句柄,直接从__dev_node_t里copy,以方便使用 */ __dev_devop_t DevOp; /* 设备操作入口,直接从__dev_node_t里copy,以方便使用 */ } __dev_dev_t; #endif //#ifndef __DEV_H__
f234d2a5cd7973325b8c1b57ee1768a11488a6c2
ff68c5e9516bba84ad4398e0094f0385ec738661
/hq_source_code/013_test_rd_wr/rd_wr.c
dad377ae0cd255d9bf5fe101a434cd65215868ee
[]
no_license
007skyfall/itop_4412_driver
28e889fb3feaa0248b976c45e3729b2c6e5e359c
8c19cfac84ea9573fdcff16b068355e8030277b0
refs/heads/master
2020-05-07T17:30:54.996000
2019-04-14T01:59:10
2019-04-14T01:59:10
180,729,593
1
2
null
null
null
null
GB18030
C
false
false
1,931
c
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/cdev.h> #include <linux/fs.h> #include <linux/errno.h> #include <asm/uaccess.h> #define NAME "rd_wr_demo" #define MAX 64 char ker_buf[MAX] = {0}; /* 1.模块三要素 2.字符框架相关 2.1 申请设备号 2.2 cdev申请 2.3 cdev初始化 2.4 cdev注册 */ ssize_t demo_read(struct file *file, char __user *user, size_t size, loff_t *loff) { if(size > MAX) size = MAX; //unsigned long copy_to_user(void *to, const void __user *from, unsigned long n) if(raw_copy_to_user(user,ker_buf,size)){ printk("copy_to_user fail...%s,%d\n",__func__,__LINE__); return -EAGAIN; } printk("%s,%d\n",__func__,__LINE__); return size; } ssize_t demo_write(struct file *file, const char __user *user ,size_t size, loff_t *loff) { if(size > MAX) size = MAX; //unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) if(raw_copy_from_user(ker_buf,user,size)){ printk("copy_from_user fail...%s,%d\n",__func__,__LINE__); return -EAGAIN; } printk("%s,%d\n",__func__,__LINE__); return size; } int demo_open (struct inode *inode, struct file *file) { printk("%s,%d\n",__func__,__LINE__); return 0; } int demo_close (struct inode *inode, struct file *file) { printk("%s,%d\n",__func__,__LINE__); return 0; } int major = 0 , minor = 0; struct file_operations f_ops = { .owner = THIS_MODULE, .open = demo_open, .release = demo_close, .read = demo_read, .write = demo_write, }; int __init demo_init(void) { major = register_chrdev(major,NAME,&f_ops); if(major < 0){ printk("register_chrdev fail ...%s,%d\n",__func__,__LINE__); return -EINVAL; } printk("major :%d \t %s,%d\n",major ,__func__,__LINE__); return 0; } void __exit demo_exit(void) { unregister_chrdev(major,NAME); printk("%s,%d\n",__func__,__LINE__); } module_init(demo_init); module_exit(demo_exit); MODULE_LICENSE("GPL");
0607cf2828108a7cebc58f556610ed3b27a33c22
3636d82c2e754fbd60c6e1b48387165ecde79726
/C_Plus/Learning_C/NUMTST.C
6df0e709e530d52dc0ea6a0a9ae46109b8b0a1db
[ "MIT" ]
permissive
MCLifeLeader/MiscProjects
2762fa69ea55a91cc668e7be7e29b178ed6fa6c1
335d7dc0f5819e4aff19860a71d65653aecee2d6
refs/heads/master
2023-08-04T22:08:32.016000
2023-07-08T05:53:45
2023-07-08T05:53:45
115,904,264
0
0
null
null
null
null
UTF-8
C
false
false
415
c
#include "stdio.h" main() { int s, w, x, y, z; unsigned char inpt; w = 0; do { w++; if(w>=255) { w = 0; } inpt = w; printf("%d\n", inpt); x = ((w+x+y)/3)+z; inpt = x; printf("%d\n", inpt); y = ((w+x+y)/3)+x; inpt = y; printf("%d\n", inpt); z = ((w+x+y)/3)+y; inpt = z; printf("%d\n", inpt); } while(s != 1); }
eb5a3df8f01f18570018bc227655aa5b8ed3b91e
e516aa3fce5fc72bb900de01254f252187252096
/wolf3d.h
cbbe1305f4c2b991932871108261974fa51119cd
[]
no_license
Ggrybova/Wolf3D
fe604a3cf33b5936c775c8998b7e19df603dc77b
10bdfcc85d810c3cc4f27b177ec3600ebaf4dfdb
refs/heads/master
2021-05-13T13:41:50.887000
2018-01-08T18:51:20
2018-01-08T18:51:20
116,714,716
0
0
null
null
null
null
UTF-8
C
false
false
2,377
h
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* wolf3d.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ggrybova <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/07/14 19:26:51 by ggrybova #+# #+# */ /* Updated: 2017/11/14 13:04:22 by ggrybova ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef WOLF3D_H # define WOLF3D_H # define WIDTH 640 # define HEIGHT 480 # include "libft/libft.h" # include "minilibx_macos/mlx.h" # include <math.h> typedef struct s_im { int w; int h; void *im; char *addr; int b_p_p; int size_l; int end; } t_im; typedef struct s_col { int red; int green; int blue; int c; } t_col; typedef struct s_mlx { void *mlx; void *win; int map_width; int map_height; int map[24][24]; double px; double py; double dx; double dy; double plane_x; double plane_y; double move_speed; double rot_speed; t_im *wall_tex; t_im image; double camera; double ray_px; double ray_py; double ray_dx; double ray_dy; double dside_x; double dside_y; double side_x; double side_y; double wall_dist; int box_x; int box_y; int wall; int side; int step_x; int step_y; int line_height; int y0; int y1; int tex_n; int tex_x; int tex_y; double wall_x; double fl_wall_x; double fl_wall_y; int fl_tex_x; int fl_tex_y; int ray_y; int music; } t_mlx; void fill_map(t_mlx *m); void fill_data(t_mlx *m); int create_labyrinth(t_mlx *m); void get_img_color(t_im *tex, int x, int y, t_col *c); void pixel_coord_img(t_im *img, int x, int y, t_col *c); void draw_wall(t_mlx *m, int x); void draw_floor_and_ceil(t_mlx *m, int x); int hook_func(int key, t_mlx *m); void *mlx_init(); int hook_func2(t_mlx *m); #endif
cdddeacb82da25ccb2e46fdfcbd46150dc6d8dfb
fe5e5f3e3da1d6199da2161fa4ee1b8516009894
/Midterm_C/Problem3_20/Problem3_20/main.c
a6bd508fdbe30ff284a36adcb13e6449fbf22eac
[]
no_license
alien-house/C
4a4d2f8ebbd2e6a86ae8e1050c2f87fd3a9f57bc
5c9c9e70580a328b761a02bbcd5c2da17c8d8a59
refs/heads/master
2021-06-12T12:10:48.901000
2017-02-03T20:09:57
2017-02-03T20:09:57
53,290,261
0
0
null
null
null
null
UTF-8
C
false
false
463
c
// // main.c // Problem3_20 // // Created by sin on 2017/01/28. // Copyright © 2017年 shinji. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { int a[3] = {1, 2, 3}; int *p = a; int **r = &p; printf("%p \n", a); printf("%d \n", *p); printf("%p \n", p); printf("%d \n", **r); printf("%p \n", &p); printf("%p \n", p); printf("%p \n", r); printf("%p %p", *r, a); return 0; }
e354269707a6613f4991b9bbd1834e80739f4adf
45d1881440cd736dc3624e69026d95922f9e1289
/Silicon/TigerlakePkg/Include/CpuPcieInfo.h
eb02a589cedf48494934c45f14896c7a603f4d12
[ "BSD-2-Clause-Patent", "BSD-3-Clause" ]
permissive
sagraw2/slimbootloader
cf794d9cf593f4c9ee99b958ac17480e4ccbec10
c62c995e496368a4c426da478b054120ebbc8eca
refs/heads/master
2021-06-19T18:16:08.746000
2021-01-07T21:34:59
2021-01-08T04:22:54
160,243,111
0
0
BSD-2-Clause
2018-12-03T19:31:52
2018-12-03T19:31:52
null
UTF-8
C
false
false
3,635
h
/** @file This file contains definitions of PCIe controller information Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef _CPU_PCIE_INFO_H_ #define _CPU_PCIE_INFO_H_ #define PCIE_HWEQ_COEFFS_MAX 5 /** PCIe controller configuration. **/ #define CPU_PCIE_1x16 7 #define CPU_PCIE_1x8_2x4 4 #define CPU_PCIE_2x8 5 #define CPU_PCIE_1x4 0 // // Device 1 Memory Mapped IO Register Offset Equates // #define SA_PEG_BUS_NUM 0x00 #define SA_PEG_DEV_NUM 0x01 #define SA_PEG0_DEV_NUM SA_PEG_DEV_NUM #define SA_PEG0_FUN_NUM 0x00 #define SA_PEG1_DEV_NUM SA_PEG_DEV_NUM #define SA_PEG1_FUN_NUM 0x01 #define SA_PEG2_DEV_NUM SA_PEG_DEV_NUM #define SA_PEG2_FUN_NUM 0x02 #define SA_PEG3_DEV_NUM 0x06 #define SA_PEG3_FUN_NUM 0x00 #define V_SA_PEG_VID 0x8086 #define V_PH3_FS_CR_OVR 0x3E #define B_PH3_FS_CR_OVR_EN BIT8 #define V_PH3_LF_CR_OVR 0x14 #define B_PH3_LF_CR_OVR_EN BIT16 // // Temporary Device & Function Number used for Switchable Graphics DGPU // #define SA_TEMP_DGPU_DEV 0x00 #define SA_TEMP_DGPU_FUN 0x00 #define CPU_PCIE_MAX_ROOT_PORTS 4 #define CPU_PCIE_MAX_CONTROLLERS 3 #define SA_PEG_MAX_FUN 0x04 #define SA_PEG_MAX_LANE 0x14 #define SA_PEG_MAX_BUNDLE 0x0A #define SA_PEG_MAX_FUN_GEN3 0x03 #define SA_PEG_MAX_LANE_GEN3 0x10 #define SA_PEG_MAX_BUNDLE_GEN3 0x08 #define SA_PEG0_CNT_MAX_LANE 0x10 #define SA_PEG0_CNT_MAX_BUNDLE 0x08 #define SA_PEG0_CNT_FIRST_LANE 0x00 #define SA_PEG0_CNT_FIRST_BUNDLE 0x00 #define SA_PEG0_CNT_LAST_LANE 0x0F #define SA_PEG0_CNT_LAST_BUNDLE 0x07 #define SA_PEG3_CNT_MAX_LANE 0x04 #define SA_PEG3_CNT_MAX_BUNDLE 0x02 #define SA_PEG3_CNT_FIRST_LANE 0x00 #define SA_PEG3_CNT_FIRST_BUNDLE 0x00 #define SA_PEG3_CNT_LAST_LANE 0x03 #define SA_PEG3_CNT_LAST_BUNDLE 0x01 #define SA_PEG3_CNT_MAX_LANE_GEN3 0x00 #define SA_PEG3_CNT_MAX_BUNDLE_GEN3 0x00 #define SA_PEG3_CNT_FIRST_LANE_GEN3 0x00 #define SA_PEG3_CNT_FIRST_BUNDLE_GEN3 0x00 #define SA_PEG3_CNT_LAST_LANE_GEN3 0x00 #define SA_PEG3_CNT_LAST_BUNDLE_GEN3 0x00 // // Silicon and SKU- specific MAX defines // #define SA_PEG_CNL_H_MAX_FUN SA_PEG_MAX_FUN // CNL-H- SKU supports 4 controllers with 20 PEG lanes and 10 bundles #define SA_PEG_CNL_H_MAX_LANE SA_PEG_MAX_LANE #define SA_PEG_CNL_H_MAX_BUNDLE SA_PEG_MAX_BUNDLE #define SA_PEG_NON_CNL_H_MAX_FUN 0x03 // All non-CNL-H- SKU supports 3 controllers with 16 PEG lanes and 8 bundles #define SA_PEG_NON_CNL_H_MAX_LANE 0x10 #define SA_PEG_NON_CNL_H_MAX_BUNDLE 0x08 #define DMI_AUTO 0 #define DMI_GEN1 1 #define DMI_GEN2 2 #define DMI_GEN3 3 #define PH3_METHOD_AUTO 0x0 #define PH3_METHOD_HWEQ 0x1 #define PH3_METHOD_SWEQ 0x2 #define PH3_METHOD_STATIC 0x3 #define PH3_METHOD_DISABLED 0x4 #define MAX_PRESETS 9 #define BEST_PRESETS 4 // // The PEG Disable Mask BIT0 ~ BIT3 for PEG0 ~ PEG3 // #define V_PEG_DISABLE_MASK 0x0F #define B_PEG0_DISABLE_MASK BIT0 #define B_PEG1_DISABLE_MASK BIT1 #define B_PEG2_DISABLE_MASK BIT2 #define B_PEG3_DISABLE_MASK BIT3 #define CPU_PCIE_CTRL_060 0 #define CPU_PCIE_CTRL_010 1 #define CPU_PCIE_CTRL_011_012 2 // // SIP version // #define PCIE_SIP16 0 #define PCIE_SIP17 1 #endif
382cdb2c263ecef7ace773b52519020028485ccd
8d66da22764e44dd5680a5ce4bdf165f1546c25e
/Firmware_F411 V1.2/COMMUNICATE/src/radiolink.c
a02d2abcbe136ebfef46847029748e4002200d30
[]
no_license
xindong324/MiniFly
679210b8f00d7f2bac73470ffbb62d5718e9c2a9
21c0679563510728590a306e627fbeeb42a4cdd3
refs/heads/master
2020-03-26T13:19:32.942000
2018-08-16T03:42:51
2018-08-16T03:42:51
144,932,913
3
3
null
null
null
null
GB18030
C
false
false
4,515
c
#include <string.h> #include "config.h" #include "radiolink.h" #include "config_param.h" #include "led.h" #include "ledseq.h" #include "uart_syslink.h" /*FreeRtos includes*/ #include "FreeRTOS.h" #include "task.h" #include "semphr.h" #include "queue.h" /******************************************************************************** * 本程序只供学习使用,未经作者许可,不得用于其它任何用途 * ALIENTEK MiniFly * 无线通信驱动代码 * 正点原子@ALIENTEK * 技术论坛:www.openedv.com * 创建日期:2018/6/22 * 版本:V1.2 * 版权所有,盗版必究。 * Copyright(C) 广州市星翼电子科技有限公司 2014-2024 * All rights reserved ********************************************************************************/ #define RADIOLINK_TX_QUEUE_SIZE 30 /*接收队列个数*/ static enum { waitForStartByte1, waitForStartByte2, waitForMsgID, waitForDataLength, waitForData, waitForChksum1, }rxState; static bool isInit; static atkp_t txPacket; static atkp_t rxPacket; static xQueueHandle txQueue; static void atkpPacketDispatch(atkp_t *rxPacket); //radiolink接收ATKPPacket任务 void radiolinkTask(void *param) { rxState = waitForStartByte1; u8 c; u8 dataIndex = 0; u8 cksum = 0; while(1) { if (uartslkGetDataWithTimout(&c)) { switch(rxState) { case waitForStartByte1: rxState = (c == DOWN_BYTE1) ? waitForStartByte2 : waitForStartByte1; cksum = c; break; case waitForStartByte2: rxState = (c == DOWN_BYTE2) ? waitForMsgID : waitForStartByte1; cksum += c; break; case waitForMsgID: rxPacket.msgID = c; rxState = waitForDataLength; cksum += c; break; case waitForDataLength: if (c <= ATKP_MAX_DATA_SIZE) { rxPacket.dataLen = c; dataIndex = 0; rxState = (c > 0) ? waitForData : waitForChksum1; /*c=0,数据长度为0,校验1*/ cksum += c; } else { rxState = waitForStartByte1; } break; case waitForData: rxPacket.data[dataIndex] = c; dataIndex++; cksum += c; if (dataIndex == rxPacket.dataLen) { rxState = waitForChksum1; } break; case waitForChksum1: if (cksum == c) /*所有校验正确*/ { atkpPacketDispatch(&rxPacket); } else /*校验错误*/ { rxState = waitForStartByte1; IF_DEBUG_ASSERT(1); } rxState = waitForStartByte1; break; default: ASSERT(0); break; } } else /*超时处理*/ { rxState = waitForStartByte1; } } } void radiolinkInit(void) { if (isInit) return; uartslkInit(); /*创建发送队列,CRTP_TX_QUEUE_SIZE个消息*/ txQueue = xQueueCreate(RADIOLINK_TX_QUEUE_SIZE, sizeof(atkp_t)); ASSERT(txQueue); isInit = true; } /*打包ATKPPacket数据通过串口DMA发送*/ static void uartSendPacket(atkp_t *p) { int dataSize; u8 cksum = 0; u8 sendBuffer[36]; ASSERT(p->dataLen <= ATKP_MAX_DATA_SIZE); sendBuffer[0] = UP_BYTE1; sendBuffer[1] = UP_BYTE2; sendBuffer[2] = p->msgID; sendBuffer[3] = p->dataLen; memcpy(&sendBuffer[4], p->data, p->dataLen); dataSize = p->dataLen + 5;//加上cksum /*计算校验和*/ for (int i=0; i<dataSize-1; i++) { cksum += sendBuffer[i]; } sendBuffer[dataSize-1] = cksum; /*串口DMA发送*/ uartslkSendDataDmaBlocking(dataSize, sendBuffer); } /*radiolink接收到ATKPPacket预处理*/ static void atkpPacketDispatch(atkp_t *rxPacket) { atkpReceivePacketBlocking(rxPacket); if( rxPacket->msgID == DOWN_POWER) {;}/*do noting*/ else { ledseqRun(DATA_RX_LED, seq_linkup); /*接收到一个遥控无线数据包则发送一个包*/ if(xQueueReceive(txQueue, &txPacket, 0) == pdTRUE) { ASSERT(txPacket.dataLen <= ATKP_MAX_DATA_SIZE); ledseqRun(DATA_TX_LED, seq_linkup); uartSendPacket(&txPacket); } } } bool radiolinkSendPacket(const atkp_t *p) { ASSERT(p); ASSERT(p->dataLen <= ATKP_MAX_DATA_SIZE); return xQueueSend(txQueue, p, 0); } bool radiolinkSendPacketBlocking(const atkp_t *p) { ASSERT(p); ASSERT(p->dataLen <= ATKP_MAX_DATA_SIZE); return xQueueSend(txQueue, p, portMAX_DELAY); } //获取剩余可用txQueue个数 int radiolinkGetFreeTxQueuePackets(void) { return (RADIOLINK_TX_QUEUE_SIZE - uxQueueMessagesWaiting(txQueue)); }
08113360ad500737a7a5484c45b9eafc178d9774
c4afbfe1885e8d0c7a1c8b928563f7bb8ab6a683
/openETCS_Releases/v0.3-D3.6.3/KCG_GreenField/CAST_int_to_DMI_TEXT_DATA_Varia.c
cc1403d9726ddbafe4826b0732e7b218f84714c1
[]
no_license
VladislavLasmann/srcAndBinary
cd48ebaa2f1f7f697ba5df9f38abb9ed50658e10
13aa76e545b9596f6dac84fb20480dffae7584d8
refs/heads/master
2021-05-08T15:04:05.709000
2016-01-22T12:40:10
2016-01-22T12:40:10
null
0
0
null
null
null
null
UTF-8
C
false
false
1,086
c
/* $**************** KCG Version 6.4 (build i21) **************** ** Command: kcg64.exe -config D:/Github/modeling/model/Scade/System/OBU_PreIntegrations/openETCS_EVC/KCG_GreenField/config.txt ** Generation date: 2015-11-05T08:54:04 *************************************************************$ */ #include "kcg_consts.h" #include "kcg_sensors.h" #include "CAST_int_to_DMI_TEXT_DATA_Varia.h" /* DATA::Variables::CAST_int_to_DMI_TEXT */ void CAST_int_to_DMI_TEXT_DATA_Varia( /* DATA::Variables::CAST_int_to_DMI_TEXT::dmi_text_int_array_in */ DMI_TEXT_INT_Array_T_DATA *dmi_text_int_array_in, /* DATA::Variables::CAST_int_to_DMI_TEXT::dmi_text_string_out */ DMI_TEXT_DMI_Types_Pkg *dmi_text_string_out) { static kcg_int i; /* 1 */ for (i = 0; i < 255; i++) { (*dmi_text_string_out)[i] = /* 1 */ Int_to_Char_Utilities((*dmi_text_int_array_in)[i]); } } /* $**************** KCG Version 6.4 (build i21) **************** ** CAST_int_to_DMI_TEXT_DATA_Varia.c ** Generation date: 2015-11-05T08:54:04 *************************************************************$ */
34bfe63f15c2d0a942627f591bc3308707cd0dfd
a3421ecebedf3ba47a5480776078132be98ee61c
/lib/cmds/players/money.c
4df874fda26619362b1604a0b595da7ebf03eb67
[]
no_license
Muderru/NighmareMUD
7851738d08b0d3d6a46fc7fe32cf25b3cdaffdb0
c8f91447afaa4ff70460e300dd0a6c64e369bfd5
refs/heads/master
2020-03-27T13:45:03.384000
2018-08-29T15:57:52
2018-08-29T15:57:52
146,626,384
1
0
null
null
null
null
UTF-8
C
false
false
1,495
c
// /bin/user/_money.c // from the Nightmare mudlib // a comand to allow players to search their pockets // created by Descartes of Borg 25 april 1993 #include <lib.h> inherit LIB_DAEMON; mixed cmd(string str) { string *currs; string borg; int i, tmp; if(str) return 0; /* to allow the wiz command to work */ if( creatorp(this_player()) ) return "Sorry, coders don't get salaries here!"; currs = (string *)this_player()->GetCurrencies(); currs = filter(currs, (: this_player()->GetCurrency($1) > 0 :)); if( !currs || !sizeof(currs) ) { write("You are broke."); say(this_player()->GetName()+" comes up with empty pockets."); return 1; } say(this_player()->GetName()+" fishes through "+ possessive(this_player())+" pockets examining some money."); message("my_action", "In your pockets you find "+ ((sizeof(currs) > 1) ? "these currencies: " : "only: "), this_player()); for(borg = "", i=0, tmp = sizeof(currs); i<tmp; i++) { borg += ((this_player()->GetCurrency(currs[i]))+" "+currs[i]); if(i == tmp-1) borg +=(".\n"); else if(tmp > 2 && i == tmp-2) borg += (", and "); else if(tmp == 2) borg +=(" and "); else borg +=(", "); } message("my_action", borg, this_player()); return 1; } void help() { write("Syntax: <money>\n\n" "Allows you to search your pockets for all your money\n" "of all currency types.\n" ); }
be5e0fd30545eef4145079ab6832219510e984f0
7774f5fa84edbe372df5bbb536e8b07b51306681
/Temp/StagingArea/Data/il2cppOutput/t1295.h
a44fa6b78fca3271b53f369182495cb1f49677c2
[]
no_license
1jeffcohen/Mr-Turtle-Breaks-Free
677f4792b30ac3041e1454e6027a64478ec18a05
360506196b46e3b8234cf732230b266e655975e1
refs/heads/master
2016-09-01T16:24:29.294000
2015-10-08T21:46:23
2015-10-08T21:46:23
43,917,971
0
0
null
null
null
null
UTF-8
C
false
false
215
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> struct t322; #include "t14.h" struct t1295 : public t14 { t322* f0; };
ecdf48a5e99c03e80d3d0804d4749b5ff8d67d07
5fe634e7327f5f62bcafa356e76d46f07b794b36
/APUE/src/8/8-9_1.c
ef96ceb6650db9d35842bb2a1bc6f18626ff4e23
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
MarsonShine/Books
8433bc1a5757e6d85e9cd649347926cfac59af08
7265c8a6226408ae687c796f604b35320926ed79
refs/heads/master
2023-08-31T05:32:35.202000
2023-08-30T10:29:26
2023-08-30T10:29:26
131,323,678
29
3
Apache-2.0
2022-12-07T13:01:31
2018-04-27T17:00:17
C#
UTF-8
C
false
false
627
c
#include "apue.h" static void charatatime(char *); int main(void) { pid_t pid; if ((pid == fork()) < 0) { err_sys("fork error"); } else if (pid == 0) { // 子进程 charatatime("output from child\n"); } else {// 父进程 charatatime("output from parent\n"); } exit(0); } static void charatatime(char *str) { char *ptr; int c; setbuf(stdout, NULL); // 设置无缓冲 for (ptr = str; (c = *ptr++) != 0;) putc(c, stdout); } // 可能的输出结果: // 1. // ooutput form child // utput from parent // 2. // oooutput from child // utput from parent
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
85