blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
333
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
58
| license_type
stringclasses 2
values | repo_name
stringlengths 5
113
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 604
values | visit_date
timestamp[us]date 2016-08-02 21:20:34
2023-09-06 10:17:08
| revision_date
timestamp[us]date 1970-01-01 00:00:00
2023-09-05 20:12:54
| committer_date
timestamp[us]date 1970-01-01 00:00:00
2023-09-05 20:12:54
| github_id
int64 966
664M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[us]date 2012-06-18 16:43:44
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-02-03 21:17:16
2023-07-07 15:57:14
⌀ | gha_language
stringclasses 121
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 128
17.8k
| extension
stringclasses 134
values | content
stringlengths 128
8.19k
| authors
listlengths 1
1
| author_id
stringlengths 1
143
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
019d67e8c4c27c03e4784a443dccfe8e137bd472 | 6edffbb731e84839969aa5519dcf9b81b06b5921 | /m6e-reader/reader.h | 1c9c9f09cebca6ed3d4e4e6b668c3ddf2683b069 | [] | no_license | haogitcc/YBT_OnBoard | b5ef01be519658fcbb3258ef36475fe53893d235 | 1ddac21c23f1f98a3ee6a3d68d54ab0206cb47f3 | refs/heads/master | 2022-04-15T02:31:47.257047 | 2020-04-10T03:47:53 | 2020-04-10T03:47:53 | 254,539,172 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,164 | h | #ifndef __READER_H__
#define __READER_H__
#include <stdlib.h>
#include <sys/wait.h>
#include <signal.h>
#include "app_sys_setting.h"
#include "mid_timer.h"
#include "mid_task.h"
#include "mid_telnet.h"
#include "mid_net.h"
#include "gpio_init.h"
#define M28X 1
#define MYD 2
#define Board M28X
#if(Board == M28X)
#define DEVICE "/dev/ttySP0"
#define DEVICE_NAME "tmr:///dev/ttySP0"
#define GPO_28 60
#define GPO_29 61
#define GPI_30 62
#define GPI_31 63
//#define GPO1_DEVICE "/sys/class/gpio/gpio108/value"
#define GPO2_DEVICE "/sys/class/gpio/gpio60/value"
#define GPO3_DEVICE "/sys/class/gpio/gpio61/value"
#define GPO4_DEVICE "/sys/class/gpio/gpio62/value"
#define GPO5_DEVICE "/sys/class/gpio/gpio63/value"
#else // MYD
#define DEVICE "/dev/ttymxc1"
#define DEVICE_NAME "tmr:///dev/ttymxc1"
#define GPO_28 44
#define GPO_29 43
#define GPI_30 42
#define GPI_31 41
//#define GPO1_DEVICE "/sys/class/gpio/gpio108/value"
#define GPO2_DEVICE "/sys/class/gpio/gpio44/value"
#define GPO3_DEVICE "/sys/class/gpio/gpio43/value"
#define GPO4_DEVICE "/sys/class/gpio/gpio42/value"
#define GPO5_DEVICE "/sys/class/gpio/gpio41/value"
#endif
#endif//__READER_H__
| [
"[email protected]"
] | |
4f740418808eed05de57e702037e24f8380382b4 | 57cf2e41af7e30aa0de5de82fa2151f943ddf607 | /src/tbox/platform/cache_time.h | 9e30c6e86a5b970fc8d4c1f4e1d7c6dec72007ed | [
"Zlib",
"BSL-1.0",
"Apache-2.0",
"GPL-2.0-only",
"OpenSSL",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | L1MeN9Yu/tbox | 391721e4e67a3d23f16cde28381231c77bfbefc6 | faf2af9eff561ad906d3ef657476fc09511f9a32 | refs/heads/L1MeN9Yu/iOS | 2020-05-06T14:08:09.834091 | 2019-10-23T02:06:18 | 2019-11-18T10:42:16 | 180,174,328 | 0 | 0 | Apache-2.0 | 2019-11-18T10:40:53 | 2019-04-08T15:05:53 | C | UTF-8 | C | false | false | 1,935 | h | /*!The Treasure Box Library
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (C) 2009 - 2019, TBOOX Open Source Group.
*
* @author ruki
* @file cache_time.h
* @ingroup platform
*
*/
#ifndef TB_PLATFORM_CACHE_TIME_H
#define TB_PLATFORM_CACHE_TIME_H
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "prefix.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
*/
__tb_extern_c_enter__
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
*/
/*! the cached time, like tb_time
*
* lower accuracy and faster
*
* @return the now time, s
*/
tb_time_t tb_cache_time(tb_noarg_t);
/*! spak cached time
*
* update the cached time for the external loop thread
*
* @return the now ms-clock
*/
tb_hong_t tb_cache_time_spak(tb_noarg_t);
/*! the cached ms-clock
*
* lower accuracy and faster
*
* @return the now ms-clock
*/
tb_hong_t tb_cache_time_mclock(tb_noarg_t);
/*! the cached s-clock
*
* lower accuracy and faster
*
* @return the now s-clock
*/
tb_hong_t tb_cache_time_clock(tb_noarg_t);
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
*/
__tb_extern_c_leave__
#endif
| [
"[email protected]"
] | |
7d9a6ae904f70044a29a9ac52daa897ae6347817 | aaebaf250aa9a11b25c59051801e8f4357f3caf6 | /disk-files/CHAP11/DEVCAPS1.H | c9cdcfc648f477ff4eb5e798d7cd4752895e56bb | [] | no_license | yeokm1/programming-win31 | c81c788beb9184977f817e7462e7651d1f3794a0 | 6a08e09b88de435f78bf66188abe392dda8de5f0 | refs/heads/master | 2023-07-14T05:17:18.390423 | 2023-07-02T03:59:13 | 2023-07-02T03:59:13 | 220,498,702 | 43 | 8 | null | null | null | null | UTF-8 | C | false | false | 260 | h | /*------------------------
DEVCAPS1.H header file
------------------------*/
#define IDM_SCREEN 1
#define IDM_PRINTER 2
#define IDM_BASIC 3
#define IDM_OTHER 4
#define IDM_CURVE 5
#define IDM_LINE 6
#define IDM_POLY 7
#define IDM_TEXT 8
| [
"[email protected]"
] | |
7342a17e8310eba13ee42d7ef0d47a01638aa5d6 | aed9c5344ba2d6ca7d085db15d0c93a3c69976cd | /software/sensor/thirdparty/lwip/lwip-1.3.2/src/api/netbuf.c | 28704deaec56a21836719f98c9e38b73ec6695e1 | [
"MIT",
"BSD-3-Clause"
] | permissive | ghsecuritylab/project-powerline | 916363f6474e0187fe11e67a1c56d6f37826001b | 6c0ec13bbfc11c3790c506f644db4fe45021440a | refs/heads/master | 2021-02-28T21:55:38.910448 | 2016-06-16T10:39:18 | 2016-06-16T10:39:18 | 245,735,183 | 0 | 0 | MIT | 2020-03-08T01:50:58 | 2020-03-08T01:50:57 | null | UTF-8 | C | false | false | 6,709 | c | /**
* @file
* Network buffer management
*
*/
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <[email protected]>
*
*/
#include "lwip/opt.h"
#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
#include "lwip/netbuf.h"
#include "lwip/memp.h"
#include <string.h>
/**
* Create (allocate) and initialize a new netbuf.
* The netbuf doesn't yet contain a packet buffer!
*
* @return a pointer to a new netbuf
* NULL on lack of memory
*/
struct
netbuf *netbuf_new(void)
{
struct netbuf *buf;
buf = memp_malloc(MEMP_NETBUF);
if (buf != NULL) {
buf->p = NULL;
buf->ptr = NULL;
buf->addr = NULL;
buf->port = 0;
#if LWIP_NETBUF_RECVINFO
buf->toaddr = NULL;
buf->toport = 0;
#endif /* LWIP_NETBUF_RECVINFO */
return buf;
} else {
return NULL;
}
}
/**
* Deallocate a netbuf allocated by netbuf_new().
*
* @param buf pointer to a netbuf allocated by netbuf_new()
*/
void
netbuf_delete(struct netbuf *buf)
{
if (buf != NULL) {
if (buf->p != NULL) {
pbuf_free(buf->p);
buf->p = buf->ptr = NULL;
}
memp_free(MEMP_NETBUF, buf);
}
}
/**
* Allocate memory for a packet buffer for a given netbuf.
*
* @param buf the netbuf for which to allocate a packet buffer
* @param size the size of the packet buffer to allocate
* @return pointer to the allocated memory
* NULL if no memory could be allocated
*/
void *
netbuf_alloc(struct netbuf *buf, u16_t size)
{
LWIP_ERROR("netbuf_alloc: invalid buf", (buf != NULL), return NULL;);
/* Deallocate any previously allocated memory. */
if (buf->p != NULL) {
pbuf_free(buf->p);
}
buf->p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_RAM);
if (buf->p == NULL) {
return NULL;
}
LWIP_ASSERT("check that first pbuf can hold size",
(buf->p->len >= size));
buf->ptr = buf->p;
return buf->p->payload;
}
/**
* Free the packet buffer included in a netbuf
*
* @param buf pointer to the netbuf which contains the packet buffer to free
*/
void
netbuf_free(struct netbuf *buf)
{
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;);
if (buf->p != NULL) {
pbuf_free(buf->p);
}
buf->p = buf->ptr = NULL;
}
/**
* Let a netbuf reference existing (non-volatile) data.
*
* @param buf netbuf which should reference the data
* @param dataptr pointer to the data to reference
* @param size size of the data
* @return ERR_OK if data is referenced
* ERR_MEM if data couldn't be referenced due to lack of memory
*/
err_t
netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size)
{
LWIP_ERROR("netbuf_ref: invalid buf", (buf != NULL), return ERR_ARG;);
if (buf->p != NULL) {
pbuf_free(buf->p);
}
buf->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
if (buf->p == NULL) {
buf->ptr = NULL;
return ERR_MEM;
}
buf->p->payload = (void*)dataptr;
buf->p->len = buf->p->tot_len = size;
buf->ptr = buf->p;
return ERR_OK;
}
/**
* Chain one netbuf to another (@see pbuf_chain)
*
* @param head the first netbuf
* @param tail netbuf to chain after head, freed by this function, may not be reference after returning
*/
void
netbuf_chain(struct netbuf *head, struct netbuf *tail)
{
LWIP_ERROR("netbuf_ref: invalid head", (head != NULL), return;);
LWIP_ERROR("netbuf_chain: invalid tail", (tail != NULL), return;);
pbuf_cat(head->p, tail->p);
head->ptr = head->p;
memp_free(MEMP_NETBUF, tail);
}
/**
* Get the data pointer and length of the data inside a netbuf.
*
* @param buf netbuf to get the data from
* @param dataptr pointer to a void pointer where to store the data pointer
* @param len pointer to an u16_t where the length of the data is stored
* @return ERR_OK if the information was retreived,
* ERR_BUF on error.
*/
err_t
netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
{
LWIP_ERROR("netbuf_data: invalid buf", (buf != NULL), return ERR_ARG;);
LWIP_ERROR("netbuf_data: invalid dataptr", (dataptr != NULL), return ERR_ARG;);
LWIP_ERROR("netbuf_data: invalid len", (len != NULL), return ERR_ARG;);
if (buf->ptr == NULL) {
return ERR_BUF;
}
*dataptr = buf->ptr->payload;
*len = buf->ptr->len;
return ERR_OK;
}
/**
* Move the current data pointer of a packet buffer contained in a netbuf
* to the next part.
* The packet buffer itself is not modified.
*
* @param buf the netbuf to modify
* @return -1 if there is no next part
* 1 if moved to the next part but now there is no next part
* 0 if moved to the next part and there are still more parts
*/
s8_t
netbuf_next(struct netbuf *buf)
{
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return -1;);
if (buf->ptr->next == NULL) {
return -1;
}
buf->ptr = buf->ptr->next;
if (buf->ptr->next == NULL) {
return 1;
}
return 0;
}
/**
* Move the current data pointer of a packet buffer contained in a netbuf
* to the beginning of the packet.
* The packet buffer itself is not modified.
*
* @param buf the netbuf to modify
*/
void
netbuf_first(struct netbuf *buf)
{
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;);
buf->ptr = buf->p;
}
#endif /* LWIP_NETCONN */
| [
"[email protected]"
] | |
1d45e8033a0abd5c097968ff1b1d54a9ba86b30e | 27a93d65dcddd6654bd372351a9f9a5ca138e447 | /w_i18n.h | 0983a28626622686fa481468f68548d15f25affd | [
"Xfig",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause"
] | permissive | coliveira/xfignew | 44182977bb8b5980b0d78db04ddb5b1e3443c6c0 | 770930da640cbe140dfefeddfc6075489abf6435 | refs/heads/master | 2016-09-06T09:50:39.909778 | 2008-04-08T19:56:35 | 2008-04-08T19:56:35 | 98,818 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 170 | h | extern Boolean is_i18n_font ();
extern Boolean is_i18n_font ();
extern void i18n_draw_image_string ();
extern void i18n_draw_string ();
extern void i18n_text_extents ();
| [
"[email protected]"
] | |
79b5a50ccc53978980dcee7c9ef6c39d649d4298 | 5d7d0b6edf6effdb47c295ba755a5a6ab795a4dd | /jnc_bbn-files/h/iobuf.h | 11b135429deefb0e6be85c23088e31f504e75b93 | [] | no_license | gounselor/network-unix-v6 | 26cfb0211fe4995a216b2d92db138dad201e228d | 33ea4eff7cee66a79b81f767400fa818a1185a31 | refs/heads/master | 2022-12-08T10:31:01.780159 | 2022-10-11T17:55:46 | 2022-10-11T18:20:26 | 272,525,060 | 0 | 0 | null | 2020-06-15T19:23:27 | 2020-06-15T19:23:26 | null | UTF-8 | C | false | false | 238 | h | /*
This is the structure used by the buffered IO routines putc(III) and getc(III).
It is not used anywhere in the kernel.
*/
struct iobuf
{
int io_fildes;
int io_nleft;
char *io_nextp;
char io_buff[512];
};
| [
"[email protected]"
] | |
43c380fe5af7c2fb411fa54c9dece6e11dccfd32 | 3a3fec17fba8ecaa8cea7fb0cd63ffb2b34d0f47 | /src/arch/64bit.h | 54643cbb0cd0f6657469580f4d26f220f05373d6 | [
"BSD-2-Clause"
] | permissive | moneytech/WingOS_x64 | 62281b4c5377d6ecbf25505def7e665c8c7564b5 | 51fb255e59b85b9a570e68ff42193fbd6de424b4 | refs/heads/master | 2022-12-28T02:37:01.929032 | 2020-10-11T12:26:05 | 2020-10-11T12:26:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 687 | h | #pragma once
#include <int_value.h>
struct InterruptStackFrame
{
uint64_t r15;
uint64_t r14;
uint64_t r13;
uint64_t r12;
uint64_t r11;
uint64_t r10;
uint64_t r9;
uint64_t r8;
uint64_t rbp;
uint64_t rdi;
uint64_t rsi;
uint64_t rdx;
uint64_t rcx;
uint64_t rbx;
uint64_t rax;
// Contains error code and interrupt number for exceptions
// Contains syscall number for syscalls
// Contains just the interrupt number otherwise
uint32_t error_code;
uint32_t int_no;
// Interrupt stack frame
uint64_t rip;
uint64_t cs;
uint64_t rflags;
uint64_t rsp;
uint64_t ss;
} __attribute__((packed));
| [
"[email protected]"
] | |
932c9efe7edcfc521b0f1ba06fb7340bd1eabfac | d688b09112b385712ddfd3dd84213cc7ccc50e26 | /neovim-master/build/src/nvim/auto/eval/typval.c.generated.h | 9f832ae3fa8072b8e476084f6596ff5555279387 | [
"Apache-2.0",
"MIT",
"Vim",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | srliuLouis/neovim-master | 956ffa965f4671bd6b21aeb3a3fee324f38ce7e9 | 7377bfb035f324d4baa4526e9197ae5b3ddafebf | refs/heads/main | 2023-04-30T21:56:38.056781 | 2021-04-22T15:55:26 | 2021-04-22T15:55:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,577 | h | #define DEFINE_FUNC_ATTRIBUTES
#include "nvim/func_attr.h"
#undef DEFINE_FUNC_ATTRIBUTES
static listitem_T *tv_list_item_alloc(void) FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC;
static int list_join_inner(garray_T *const gap, list_T *const l, const char *const sep, garray_T *const join_gap) FUNC_ATTR_NONNULL_ALL;
static void tv_dict_watcher_free(DictWatcher *watcher) FUNC_ATTR_NONNULL_ALL;
static _Bool tv_dict_watcher_matches(DictWatcher *watcher, const char *const key) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE;
static inline int _nothing_conv_func_start(typval_T *const tv, char_u *const fun) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ARG(1);
static inline void _nothing_conv_func_end(typval_T *const tv, const int copyID) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL;
static inline void _nothing_conv_empty_dict(typval_T *const tv, dict_T **const dictp) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ARG(2);
static inline int _nothing_conv_real_list_after_start(typval_T *const tv, MPConvStackVal *const mpsv) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_WARN_UNUSED_RESULT;
static inline void _nothing_conv_list_end(typval_T *const tv) FUNC_ATTR_ALWAYS_INLINE;
static inline int _nothing_conv_real_dict_after_start(typval_T *const tv, dict_T **const dictp, const void *const nodictvar, MPConvStackVal *const mpsv) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_WARN_UNUSED_RESULT;
static inline void _nothing_conv_dict_end(typval_T *const tv, dict_T **const dictp, const void *const nodictvar) FUNC_ATTR_ALWAYS_INLINE;
#include "nvim/func_attr.h"
| [
"[email protected]"
] | |
fe65d7ef69e646ee47192019d88388d96924caf2 | 8073e2ca234251a693db436c5c3bd2086a57a5a4 | /Function/prime number using function.c | 583053eb35432ecdcad390d93a8e08217740092c | [] | no_license | SamboVisal/C-Program-KIT | f49698240915f0ed37261b1e9eaa5238470bb130 | 5910aa2476620177ebe84383a0dbedbdbb40a4ef | refs/heads/master | 2021-09-01T01:24:54.261698 | 2017-12-24T03:34:53 | 2017-12-24T03:34:53 | 115,237,484 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 470 | c | #include <stdio.h>
void prime();
main(){
prime(); // No argument if passed to prime()
}
void prime()
{
int n, i, c = 0;
printf("Enter a positive integer: ");
scanf("%d",&n);
for(i=2; i<=n/2; ++i)
{
// condition for nonprime number
if(n%i==0)
{
c=1;
break;
}
}
if (c==0)
printf("%d is a prime number.",n);
else
printf("%d is not a prime number.",n);
}
| [
"[email protected]"
] | |
e9faff375a03a7fe72357ff33747b010a18830af | fed3ea2d8f4289feb97f9b1abc6233f29257ec02 | /Linux/LinuxSystem/session/daemon.c | e76f5efb74cca4d4ea8fd0e8504bf49750a16b7e | [] | no_license | Aves-LH/A-rookie | 88b3f0de39ff466b88dc65d21cfaba40aca73c4f | 86613fa3d238f2224fa19fcc877dc72cb982d5e4 | refs/heads/master | 2023-02-19T02:20:30.516144 | 2023-02-10T02:52:12 | 2023-02-10T02:52:12 | 225,284,693 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 839 | c | /*************************************************************************
> File Name: daemon.c
> Author: amoscykl
> Mail: [email protected]
> Created Time: 2020年06月20日 星期六 09时52分47秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <pthread.h>
int main(int argc, char* argv[])
{
pid_t pid;
int ret = 0;
int fd;
pid = fork();
if(pid > 0)
{
exit(0);
}
pid = setsid();
ret = chdir("/home/aves");
if(-1 == ret)
{
perror("chdir error!");
exit(1);
}
umask(0022);
close(0);
fd = open("/dev/null", O_RDWR);
if(-1 == fd)
{
perror("open error!");
exit(1);
}
dup2(STDOUT_FILENO, fd);
dup2(STDIN_FILENO, fd);
while(1);
return 0;
}
| [
"[email protected]"
] | |
5385091cc8419ca3f241602de538bd29269fe646 | 51635684d03e47ebad12b8872ff469b83f36aa52 | /external/gcc-12.1.0/gcc/testsuite/gcc.target/i386/avx512vl-vcvtuqq2ps-2.c | ba390ba77dd430e18c0453e7673483afe0d20b9a | [
"LGPL-2.1-only",
"GPL-3.0-only",
"GCC-exception-3.1",
"GPL-2.0-only",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"FSFAP",
"Zlib",
"LicenseRef-scancode-public-domain"
] | permissive | zhmu/ananas | 8fb48ddfe3582f85ff39184fc7a3c58725fe731a | 30850c1639f03bccbfb2f2b03361792cc8fae52e | refs/heads/master | 2022-06-25T10:44:46.256604 | 2022-06-12T17:04:40 | 2022-06-12T17:04:40 | 30,108,381 | 59 | 8 | Zlib | 2021-09-26T17:30:30 | 2015-01-31T09:44:33 | C | UTF-8 | C | false | false | 402 | c | /* { dg-do run } */
/* { dg-options "-O2 -mavx512dq -mavx512vl" } */
/* { dg-require-effective-target avx512vl } */
/* { dg-require-effective-target avx512dq } */
#define AVX512VL
#define AVX512F_LEN 256
#define AVX512F_LEN_HALF 128
#include "avx512dq-vcvtuqq2ps-2.c"
#undef AVX512F_LEN
#undef AVX512F_LEN_HALF
#define AVX512F_LEN 128
#define AVX512F_LEN_HALF 128
#include "avx512dq-vcvtuqq2ps-2.c"
| [
"[email protected]"
] | |
325ee0bd361169f3ba7cc3b9d88c8f2308c73dca | 49055f014cd819a73a4c0622dfcc8d4ffd9d2e9e | /GlobusSatProject/src/TestingDemos/EpsTestingDemo.c | 881a1900a00072d0fc309f4bcecbfef53801f130 | [] | no_license | ImriYosef/ycube | 47023b63e99a3965fc1bd4027e1f65c4ac6771e4 | d8fecb1e8b4f45e6ecb713994da16d262c23941e | refs/heads/master | 2022-04-23T20:13:39.372270 | 2020-04-24T16:02:09 | 2020-04-24T16:02:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 6,470 | c | #include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <freertos/task.h>
#include "EpsTestingDemo.h"
#include <hal/Utility/util.h>
#include <SubSystemModules/PowerManagment/EPS.h>
#include <SubSystemModules/PowerManagment/EPSOperationModes.h>
#include <stdlib.h>
#ifdef ISISEPS
#include <satellite-subsystems/isis_eps_driver.h>
#endif
#ifdef GOMEPS
#include <satellite-subsystems/GomEPS.h>
#endif
Boolean TestEpsConditioning()
{
int minutes = 2;
printf("\nPlease insert number of minutes to test(0 to 10)\n");
while (UTIL_DbguGetIntegerMinMax((unsigned int*)&minutes, 0, 10) == 0);
printf("Starting test for a period of %d minutes\n\n",minutes);
printf("starting test...\n");
portTickType curr_time = xTaskGetTickCount();
portTickType end_time = MINUTES_TO_TICKS(minutes) + curr_time;
printf("Start tick count: %d\n",(int)curr_time);
printf("End tick count: %d\n",(int)end_time);
voltage_t vbat = 0;
while( curr_time < end_time)
{
curr_time = xTaskGetTickCount();
printf("seconds till finish: %d\n",(int)(end_time - curr_time)/1000);
GetBatteryVoltage(&vbat);
printf("Vbat = %d\n",vbat);
printf("channel state = %X\n",GetSystemChannelState());
switch(GetSystemState()){
case FullMode:
printf("\t\n----------Eps is in Full Mode\n\n");
break;
case CruiseMode:
printf("\t\n----------Eps is in Cruise Mode\n\n");
break;
case SafeMode:
printf("\t\n----------Eps is in Safe Mode\n\n");
break;
case CriticalMode:
printf("\t\n----------Eps is in Critical Mode\n\n");
break;
}
for(int i = 0; i < 4; i++)
{
EPS_Conditioning();
vTaskDelay(1000);
}
}
return TRUE;
}
Boolean TestGetBatteryVoltage()
{
voltage_t vbat = 0;
int err = GetBatteryVoltage(&vbat);
if(0!=err){
printf("error in 'GetBatteryVoltage' = %d",err);
}
printf("battery voltage = %d\n",vbat);
return TRUE;
}
Boolean TestUpdateThreshVoltages()
{
printf("Updating threshold voltages value\n");
voltage_t thresh_volts[NUMBER_OF_THRESHOLD_VOLTAGES] = {6501,7101,7301,7401,7201,6601};
int err = 0;
printf("Updating threshold voltage array to:");
for(int i = 0; i <NUMBER_OF_THRESHOLD_VOLTAGES; i++)
{
printf("thresh[%d] = %d\n",i,thresh_volts[i]);
}
err = UpdateThresholdVoltages(thresh_volts);
if(0 != err){
printf("error in 'UpdateThresholdVoltages' = %d\n",err);
return TRUE;
}
err = GetThresholdVoltages(thresh_volts);
if(0 != err){
printf("error in 'GetThresholdVoltages' = %d\n",err);
return TRUE;
}
for(int i = 0; i <NUMBER_OF_THRESHOLD_VOLTAGES; i ++)
{
printf("threshVolt[%d] = %d\n",i,thresh_volts[i]);
}
return TRUE;
}
Boolean TestGetThreshVoltages()
{
printf("Get threshold voltages value\n");
voltage_t thresh_volts[NUMBER_OF_THRESHOLD_VOLTAGES];
int err = GetThresholdVoltages(thresh_volts);
if(0 != err){
printf("error in 'GetThresholdVoltages' = %d\n",err);
return TRUE;
}
for(int i = 0; i <NUMBER_OF_THRESHOLD_VOLTAGES; i ++)
{
printf("threshVolt[%d] = %d\n",i,thresh_volts[i]);
}
return TRUE;
}
Boolean TestUpdateAlpha()
{
int err = 0;
printf("Updating Alpha to be '0.66666'");
float alpha = 0.66666;
err = UpdateAlpha(alpha);
if(err != 0){
printf("Error in 'UpdateAlpha' = %d\n",err);
return TRUE;
}
err = GetAlpha(&alpha);
if(err != 0){
printf("Error in 'GetAlpha' = %d\n",err);
return TRUE;
}
if(0 == err){
printf("Successfully read Alpha value using 'GetAlpha', alpha = %f",alpha);
}
return TRUE;
}
Boolean TestGetAlpha()
{
float alpha = 0;
int err = GetAlpha(&alpha);
if(err != 0){
printf("error in 'GetAlpha' = %d\n",err);
return TRUE;
}
printf("Alpha value = %f\n",alpha);
return TRUE;
}
Boolean TestRestoreDefaultAlpha()
{
printf("Restoring default alpha value\n");
float alpha = 0.0;
int err = GetAlpha(&alpha);
if(0 != err){
printf("error in 'GetAlpha' = %d\n",err);
return TRUE;
}
printf("old alpha value: a = %f\n",alpha);
err = RestoreDefaultAlpha();
if(0 != err){
printf("error in 'RestoreDefaultAlpha' = %d\n",err);
}
err = GetAlpha(&alpha);
if(0 != err){
printf("error in 'GetAlhpa' = %d\n",err);
return TRUE;
}
printf("new alpha value: a = %f\n",alpha);
return TRUE;
}
Boolean TestRestoreDefaultThresholdVoltages()
{
printf("Restoring default threshold voltages value\n");
voltage_t thresh_volts[NUMBER_OF_THRESHOLD_VOLTAGES];
int err = GetThresholdVoltages(thresh_volts);
if(0 != err){
printf("error in 'GetThresholdVoltages' = %d\n",err);
return TRUE;
}
for(int i = 0; i <NUMBER_OF_THRESHOLD_VOLTAGES; i ++)
{
printf("threshVolt[%d] = %d\n",i,thresh_volts[i]);
}
err = RestoreDefaultThresholdVoltages();
if(0 != err){
printf("error in 'RestoreDefaultThresholdVoltages' = %d\n",err);
}
err = GetThresholdVoltages(thresh_volts);
if(0 != err){
printf("error in 'GetThresholdVoltages' = %d\n",err);
return TRUE;
}
for(int i = 0; i <NUMBER_OF_THRESHOLD_VOLTAGES; i ++)
{
printf("threshVolt[%d] = %d\n",i,thresh_volts[i]);
}
return TRUE;
}
Boolean selectAndExecuteEpsDemoTest()
{
unsigned int selection = 0;
Boolean offerMoreTests = TRUE;
printf( "\n\r Select a test to perform: \n\r");
printf("\t 0) Return to main menu \n\r");
printf("\t 1) Eps Conditioning \n\r");
printf("\t 2) Get Battery Voltage \n\r");
printf("\t 3) Update Threshold Voltages \n\r");
printf("\t 4) Print Threshold Voltages \n\r");
printf("\t 5) Update Alpha \n\r");
printf("\t 6) Print Alpha \n\r");
printf("\t 7) Restore Default Alpha \n\r");
printf("\t 8) Restore Default Threshold Voltages \n\r");
unsigned int number_of_tests = 8;
while(UTIL_DbguGetIntegerMinMax(&selection, 0, number_of_tests) == 0);
switch(selection) {
case 0:
offerMoreTests = FALSE;
break;
case 1:
offerMoreTests = TestEpsConditioning();
break;
case 2:
offerMoreTests = TestGetBatteryVoltage();
break;
case 3:
offerMoreTests = TestUpdateThreshVoltages();
break;
case 4:
offerMoreTests = TestGetThreshVoltages();
break;
case 5:
offerMoreTests = TestUpdateAlpha();
break;
case 6:
offerMoreTests = TestGetAlpha();
break;
case 7:
offerMoreTests = TestRestoreDefaultAlpha();
break;
case 8:
offerMoreTests = TestRestoreDefaultThresholdVoltages();
break;
default:
break;
}
return offerMoreTests;
}
Boolean MainEpsTestBench()
{
Boolean offerMoreTests = FALSE;
while(1)
{
offerMoreTests = selectAndExecuteEpsDemoTest();
if(offerMoreTests == FALSE)
{
return FALSE;
}
}
return FALSE;
}
| [
"[email protected]"
] | |
49d6264d54a95c54608ea1b486398c079cf7078a | 559f7531f811b71b09d10bf3d64e974887782e9e | /discretaq2003/sources/dqbase/matrix_mult.C | 36fda8ba6430103ce248e0572ce237a4bb08ba3d | [] | no_license | GunterMueller/DISCRETA-Q | bb72ebd8a478698a12b2dcc616ddfc0f9a17c4cd | 3870c42b587be72eb8fe388291a3d4b51503a456 | refs/heads/master | 2021-08-20T10:50:22.790931 | 2017-11-29T00:05:18 | 2017-11-29T00:05:18 | 112,403,871 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 492 | c | #include "discretaq.h"
int main(void)
{
int n1,k1;
cin >> n1;
cin >> k1;
matrix<int> A(n1,k1);
int z;
for (int i = 0; i < n1; i++)
for (int j = 0; j < k1; j++)
{
cin >> z;
A[i][j] = z;
}
cout << A;
int n2,k2;
cin >> n2;
cin >> k2;
matrix<int> B(n2,k2);
for (int i = 0; i < n2; i++)
for (int j = 0; j < k2; j++)
{
cin >> z;
B[i][j] = z;
}
cout << B;
matrix<int> C = A * B;
cout << C;
return 0;
}
| [
"[email protected]"
] | |
d3bea008afb4359924eba517f195dee45b0d3b9b | 22ca1c297ad4ab0e4683bda70199f24e0fc50cc1 | /lib/openssl-1.0.0d/crypto/x509v3/pcy_lib.c | 2edf6169f4f8310b30deef9965fa7120b5332c96 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-dco-1.1",
"MIT",
"LicenseRef-scancode-proprietary-license",
"OpenSSL",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows"
] | permissive | achreto/barrelfish | 1a7fbba958403c719abd8170ed3d16725f8f03e9 | 99d8bb79dc31986fd6aa67bab59e0b83cfaa4406 | refs/heads/master | 2021-07-09T11:38:51.008045 | 2021-04-12T22:35:35 | 2021-04-12T22:35:35 | 38,771,948 | 0 | 0 | MIT | 2019-06-13T12:51:56 | 2015-07-08T18:22:22 | C | UTF-8 | C | false | false | 4,706 | c | /* pcy_lib.c */
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
* project 2004.
*/
/* ====================================================================
* Copyright (c) 2004 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [email protected].
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* ([email protected]). This product includes software written by Tim
* Hudson ([email protected]).
*
*/
#include <openssl/local/cryptlib.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include "pcy_int.h"
/* accessor functions */
/* X509_POLICY_TREE stuff */
int X509_policy_tree_level_count(const X509_POLICY_TREE *tree)
{
if (!tree)
return 0;
return tree->nlevel;
}
X509_POLICY_LEVEL *
X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i)
{
if (!tree || (i < 0) || (i >= tree->nlevel))
return NULL;
return tree->levels + i;
}
STACK_OF(X509_POLICY_NODE) *
X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree)
{
if (!tree)
return NULL;
return tree->auth_policies;
}
STACK_OF(X509_POLICY_NODE) *
X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree)
{
if (!tree)
return NULL;
if (tree->flags & POLICY_FLAG_ANY_POLICY)
return tree->auth_policies;
else
return tree->user_policies;
}
/* X509_POLICY_LEVEL stuff */
int X509_policy_level_node_count(X509_POLICY_LEVEL *level)
{
int n;
if (!level)
return 0;
if (level->anyPolicy)
n = 1;
else
n = 0;
if (level->nodes)
n += sk_X509_POLICY_NODE_num(level->nodes);
return n;
}
X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i)
{
if (!level)
return NULL;
if (level->anyPolicy)
{
if (i == 0)
return level->anyPolicy;
i--;
}
return sk_X509_POLICY_NODE_value(level->nodes, i);
}
/* X509_POLICY_NODE stuff */
const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node)
{
if (!node)
return NULL;
return node->data->valid_policy;
}
#if 0
int X509_policy_node_get_critical(const X509_POLICY_NODE *node)
{
if (node_critical(node))
return 1;
return 0;
}
#endif
STACK_OF(POLICYQUALINFO) *
X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node)
{
if (!node)
return NULL;
return node->data->qualifier_set;
}
const X509_POLICY_NODE *
X509_policy_node_get0_parent(const X509_POLICY_NODE *node)
{
if (!node)
return NULL;
return node->parent;
}
| [
"[email protected]"
] | |
a61eb713483a4c1d934cf66c197aa228f6026daa | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/drivers/thermal/extr_uniphier_thermal.c_uniphier_tm_disable_sensor.c | 1ee880b9a39eaf2a9a75eabc1792f6be4db15be7 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,297 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct uniphier_tm_dev {TYPE_1__* data; struct regmap* regmap; } ;
struct regmap {int dummy; } ;
struct TYPE_2__ {scalar_t__ block_base; scalar_t__ map_base; } ;
/* Variables and functions */
scalar_t__ PMALERTINTCTL ;
int /*<<< orphan*/ PMALERTINTCTL_MASK ;
scalar_t__ PVTCTLEN ;
int /*<<< orphan*/ PVTCTLEN_EN ;
int /*<<< orphan*/ regmap_write_bits (struct regmap*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usleep_range (int,int) ;
__attribute__((used)) static void uniphier_tm_disable_sensor(struct uniphier_tm_dev *tdev)
{
struct regmap *map = tdev->regmap;
/* disable alert interrupt */
regmap_write_bits(map, tdev->data->map_base + PMALERTINTCTL,
PMALERTINTCTL_MASK, 0);
/* stop PVT */
regmap_write_bits(map, tdev->data->block_base + PVTCTLEN,
PVTCTLEN_EN, 0);
usleep_range(1000, 2000); /* The spec note says at least 1ms */
} | [
"[email protected]"
] | |
90ac341da419a691ed9414e1e6eb16b301ebf69c | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/mongoose/test/extr_unit_test.c_srv1.c | 64caba0e8f200cbd6b331e61bdb55369a879b935 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 933 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mg_connection {int dummy; } ;
struct http_message {int dummy; } ;
/* Variables and functions */
int MG_EV_HTTP_REQUEST ;
int /*<<< orphan*/ mg_http_serve_file (struct mg_connection*,struct http_message*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mg_mk_str (char*) ;
__attribute__((used)) static void srv1(struct mg_connection *c, int ev, void *ev_data) {
if (ev == MG_EV_HTTP_REQUEST) {
mg_http_serve_file(c, (struct http_message *) ev_data, "unit_test.c",
mg_mk_str("text/plain"), mg_mk_str(""));
}
} | [
"[email protected]"
] | |
2140706dcfff92338a74a6f54141c035390ded01 | af24e7dda2f91ced51d762bfb216464d651a0bcc | /fesBeacon/BeaconTest/Classes/Native/mscorlib_System_Runtime_InteropServices_MarshalDirectiveExce.h | 231100f325ca5f838b0071900cc1a49d0fcdf2a7 | [] | no_license | Toshihiko-Tabata/fesBeacon | f093e97bf83d1c07a1e52adef24962efaac4f0f2 | e52a59dc02883a85487c50de3604a62a97b1d54b | refs/heads/master | 2021-01-10T15:16:56.041075 | 2015-11-27T06:27:12 | 2015-11-27T06:27:12 | 46,953,895 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 243 | h | #pragma once
#include <stdint.h>
// System.SystemException
#include "mscorlib_System_SystemException.h"
// System.Runtime.InteropServices.MarshalDirectiveException
struct MarshalDirectiveException_t1151 : public SystemException_t710
{
};
| [
"[email protected]"
] | |
3e767fff1418e84077532ff1cf52acdf94e05323 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/drivers/md/extr_dm-era-target.c_era_iterate_devices.c | d2dd6da9f2d62668c57a99e3b4e2a589ab3cf462 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 910 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct era {int /*<<< orphan*/ origin_dev; } ;
struct dm_target {struct era* private; } ;
typedef int (* iterate_devices_callout_fn ) (struct dm_target*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*) ;
/* Variables and functions */
int /*<<< orphan*/ get_dev_size (int /*<<< orphan*/ ) ;
__attribute__((used)) static int era_iterate_devices(struct dm_target *ti,
iterate_devices_callout_fn fn, void *data)
{
struct era *era = ti->private;
return fn(ti, era->origin_dev, 0, get_dev_size(era->origin_dev), data);
} | [
"[email protected]"
] | |
af0eecd68efbc62d44b96310443d83e77186cc67 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/mm/extr_hugetlb_cgroup.c_hugetlb_cgroup_commit_charge.c | 20b2ae5859b5d2e7d4fce195da847dba50ca7870 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 804 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct page {int dummy; } ;
struct hugetlb_cgroup {int dummy; } ;
/* Variables and functions */
scalar_t__ hugetlb_cgroup_disabled () ;
int /*<<< orphan*/ set_hugetlb_cgroup (struct page*,struct hugetlb_cgroup*) ;
void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
struct hugetlb_cgroup *h_cg,
struct page *page)
{
if (hugetlb_cgroup_disabled() || !h_cg)
return;
set_hugetlb_cgroup(page, h_cg);
return;
} | [
"[email protected]"
] | |
85016f590d3a49fe406e8d4a4f15edd9798f684e | 08a10fd11ef2fd5f04961ca21cadf21d7829600d | /src/liblsquic/lsquic_xxhash.h | 4a92f415f616e35999d6fb2b891bb1a274ccbc09 | [
"BSD-3-Clause",
"MIT"
] | permissive | yosagi/lsquic | 93150d461caf68ba08e2ee5fd84669cb42522836 | 80f97216907817af46c80c07edac7eb2ff43b8f0 | refs/heads/master | 2023-02-09T08:34:16.385272 | 2021-05-10T13:46:06 | 2021-05-10T13:46:06 | 326,631,755 | 0 | 0 | NOASSERTION | 2021-01-04T13:08:53 | 2021-01-04T09:27:03 | null | UTF-8 | C | false | false | 5,957 | h | /* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
xxHash - Extremely Fast Hash algorithm
Header File
Copyright (C) 2012-2014, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
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.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- xxHash source repository : http://code.google.com/p/xxhash/
*/
/* Notice extracted from xxHash homepage :
xxHash is an extremely fast Hash algorithm, running at RAM speed limits.
It also successfully passes all tests from the SMHasher suite.
Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz)
Name Speed Q.Score Author
xxHash 5.4 GB/s 10
CrapWow 3.2 GB/s 2 Andrew
MumurHash 3a 2.7 GB/s 10 Austin Appleby
SpookyHash 2.0 GB/s 10 Bob Jenkins
SBox 1.4 GB/s 9 Bret Mulvey
Lookup3 1.2 GB/s 9 Bob Jenkins
SuperFastHash 1.2 GB/s 1 Paul Hsieh
CityHash64 1.05 GB/s 10 Pike & Alakuijala
FNV 0.55 GB/s 5 Fowler, Noll, Vo
CRC32 0.43 GB/s 9
MD5-32 0.33 GB/s 10 Ronald L. Rivest
SHA1-32 0.28 GB/s 10
Q.Score is a measure of quality of the hash function.
It depends on successfully passing SMHasher test set.
10 is a perfect score.
*/
#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
/*****************************
Includes
*****************************/
#include <stddef.h> /* size_t */
/*****************************
Type
*****************************/
typedef enum { XXH_OK = 0, XXH_ERROR } XXH_errorcode;
/*****************************
Simple Hash Functions
*****************************/
unsigned int XXH32(const void *input, size_t length, unsigned seed);
unsigned long long XXH64(const void *input, size_t length,
unsigned long long seed);
/*
XXH32() :
Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input".
The memory between input & input+length must be valid (allocated and read-accessible).
"seed" can be used to alter the result predictably.
This function successfully passes all SMHasher tests.
Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s
XXH64() :
Calculate the 64-bits hash of sequence of length "len" stored at memory address "input".
*/
/*****************************
Advanced Hash Functions
*****************************/
typedef struct { long long ll[ 6]; } XXH32_state_t;
typedef struct { long long ll[11]; } XXH64_state_t;
/*
These structures allow static allocation of XXH states.
States must then be initialized using XXHnn_reset() before first use.
If you prefer dynamic allocation, please refer to functions below.
*/
XXH32_state_t *XXH32_createState(void);
XXH_errorcode XXH32_freeState(XXH32_state_t *statePtr);
XXH64_state_t *XXH64_createState(void);
XXH_errorcode XXH64_freeState(XXH64_state_t *statePtr);
/*
These functions create and release memory for XXH state.
States must then be initialized using XXHnn_reset() before first use.
*/
XXH_errorcode XXH32_reset(XXH32_state_t *statePtr, unsigned seed);
XXH_errorcode XXH32_update(XXH32_state_t *statePtr, const void *input,
size_t length);
unsigned int XXH32_digest(const XXH32_state_t *statePtr);
XXH_errorcode XXH64_reset(XXH64_state_t *statePtr,
unsigned long long seed);
XXH_errorcode XXH64_update(XXH64_state_t *statePtr, const void *input,
size_t length);
unsigned long long XXH64_digest(const XXH64_state_t *statePtr);
/*
These functions calculate the xxHash of an input provided in multiple smaller packets,
as opposed to an input provided as a single block.
XXH state space must first be allocated, using either static or dynamic method provided above.
Start a new hash by initializing state with a seed, using XXHnn_reset().
Then, feed the hash state by calling XXHnn_update() as many times as necessary.
Obviously, input must be valid, meaning allocated and read accessible.
The function returns an error code, with 0 meaning OK, and any other value meaning there is an error.
Finally, you can produce a hash anytime, by using XXHnn_digest().
This function returns the final nn-bits hash.
You can nonetheless continue feeding the hash state with more input,
and therefore get some new hashes, by calling again XXHnn_digest().
When you are done, don't forget to free XXH state space, using typically XXHnn_freeState().
*/
#if defined (__cplusplus)
}
#endif
| [
"[email protected]"
] | |
1ce95b8f584730ff8a76e8444f6f360a916442ce | dcc27bf61eaca1dcae14720f532425e600b82c7c | /LC3plus/noise_filling.c | bab7d089dfc5ac957490b353772a3bc29d0f5eab | [] | no_license | hongshui3000/audioToys | 2e11994dc7b6a7ecd16736ae7c4f5664e4ac4c4c | f6b0344a9b2952ce52e7fdf5ffe034245020b4f0 | refs/heads/master | 2020-12-23T11:02:48.096529 | 2020-01-29T11:48:54 | 2020-01-29T11:48:54 | 237,131,519 | 1 | 0 | null | 2020-01-30T03:27:54 | 2020-01-30T03:27:53 | null | UTF-8 | C | false | false | 2,040 | c | /******************************************************************************
* ETSI TS 103 634 V1.1.1 *
* Low Complexity Communication Codec Plus (LC3plus) *
* *
* Copyright licence is solely granted through ETSI Intellectual Property *
* Rights Policy, 3rd April 2019. No patent licence is granted by implication, *
* estoppel or otherwise. *
******************************************************************************/
#include "functions.h"
void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT BW_cutoff_idx, LC3_INT frame_dms)
{
LC3_INT zeroLines[MAX_LEN] = {0};
LC3_INT nTransWidth = 0, startOffset = 0, i = 0, j = 0, k = 0, start = 0, end = 0, allZeros = 0, kZeroLines = 0;
LC3_FLOAT fac_ns = 0;
switch (frame_dms)
{
case 25:
nTransWidth = 1;
startOffset = 6;
break;
case 50:
nTransWidth = 1;
startOffset = 12;
break;
case 100:
nTransWidth = 3;
startOffset = 24;
break;
}
fac_ns = (8.0 - fac_ns_idx) / 16.0;
j = 0;
for (k = startOffset; k < BW_cutoff_idx; k++) {
allZeros = 1;
start = k - nTransWidth;
end = MIN(BW_cutoff_idx - 1, k + nTransWidth);
for (i = start; i <= end; i++) {
if (xq[i] != 0) {
allZeros = 0;
}
}
if (allZeros == 1) {
zeroLines[j] = k;
kZeroLines++;
j++;
}
}
for (k = 0; k < kZeroLines; k++) {
nfseed = (13849 + (nfseed + 32768) * 31821) & 65535;
nfseed -= 32768;
if (nfseed >= 0) {
xq[zeroLines[k]] = fac_ns;
} else {
xq[zeroLines[k]] = -fac_ns;
}
}
return;
}
| [
"[email protected]"
] | |
e24f7e6b670065fd58b71911b9a4844c39066f37 | c616e40ecaa9821c5e1430a369677bebd8401dc0 | /0x02-functions_nested_loops/6-main.c | c1a928b38447371600af92bc67531ca00697e9b8 | [] | no_license | yinez/alx-low_level_programming | a943b65d2fecf39d9cfdfd8887d0bcb5990f6d6a | 2302d54e3c1ee6357df4e1d4572a8223af46dc78 | refs/heads/master | 2023-08-25T11:55:26.164342 | 2021-10-14T08:14:13 | 2021-10-14T08:14:13 | 401,691,964 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 306 | c | #include "main.h"
#include <stdio.h>
/**
* main - check the code for Holberton School students.
*
* Return: Always 0.
*/
int main(void)
{
int r;
r = _abs(-1);
printf("%d\n", r);
r = _abs(0);
printf("%d\n", r);
r = _abs(1);
printf("%d\n", r);
r = _abs(-98);
printf("%d\n", r);
return (0);
}
| [
"[email protected]"
] | |
d0e3618c2bec4bddf08e8cff2fe5741a99546c36 | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/multimedia/wmdm_sr1/common/include/serialnumber.h | deb135c811fe5713e379423516526dafd6956071 | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C | false | false | 981 | h | //-----------------------------------------------------------------------------
//
// File: SerialNumber.h
//
// Microsoft Digital Rights Management
// Copyright (C) Microsoft Corporation, 1998 - 1999, All Rights Reserved
//
// Description:
//
//-----------------------------------------------------------------------------
#ifndef __SERIALNUMBER_H__
#define __SERIALNUMBER_H__
#pragma once
#ifndef WMDMID_LENGTH
// Also defined in WMDM.idl
#define WMDMID_LENGTH 128
typedef struct __WMDMID
{
UINT cbSize;
DWORD dwVendorID;
BYTE pID[ WMDMID_LENGTH ];
UINT SerialNumberLength;
} WMDMID, *PWMDMID;
#endif
HRESULT __stdcall UtilGetSerialNumber(WCHAR *wcsDeviceName, PWMDMID pSerialNumber, BOOL fCreate);
HRESULT __stdcall UtilGetManufacturer(LPWSTR pDeviceName, LPWSTR *ppwszName, UINT nMaxChars);
HRESULT __stdcall UtilStartStopService(bool fStartService);
#endif // __SERIALNUMBER_H__ | [
"[email protected]"
] | |
c95370ebe11799b8bb5124d35010da6b35e5d35e | 49cd18e27ffa44f9b658763a6a60b3555585a002 | /include/ens_rres.h | c512d02581de4836c2ac5cc21a471ef42a461795 | [] | no_license | YvanMokwinski/WFLOW | 72e136634e38a34b687446f1415cc7c8503de927 | 8f9c36c53bbf19e0956b6a2ccf13cf7f493a9573 | refs/heads/master | 2022-09-09T23:08:53.986782 | 2019-12-24T07:41:22 | 2019-12-24T07:41:22 | 229,709,742 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 945 | h | #ifndef __header__ens_rres_h__
#define __header__ens_rres_h__
enum __ens_rres { __ens_rres_error=0,
__ens_rres_t,
__ens_rres_dt,
__ens_rres_nelm,
__ens_rres_nvertex,
__ens_rres_nddlu,
__ens_rres_nddlp,
__ens_rres_nddlf,
__ens_rres_uL1,
__ens_rres_uL2,
__ens_rres_uLInf,
__ens_rres_uH1,
__ens_rres_pL1,
__ens_rres_pL2,
__ens_rres_pLInf,
__ens_rres_pH1,
__ens_rres_fL1,
__ens_rres_fL2,
__ens_rres_fLInf,
__ens_rres_fH1,
__ens_rres_area,
__ens_rres_length_freesurface,
__ens_rres_etime_total,
__ens_rres_etime_loading,
__ens_rres_etime_init_data,
__ens_rres_etime_kill_data,
__ens_rres_etime_algo_diff,
__ens_rres_etime_algo_normal,
__ens_rres_etime_algo_kappa,
__ens_rres_etime_algo_linsol,
__ens_rres_n };
typedef enum __ens_rres ens_rres;
typedef const ens_rres cst_ens_rres;
#endif
| [
"[email protected]"
] | |
5b3b50d3a72f7627f2e4f279f3720f3a83dbdc0a | 84544131b64b6727598f87afd5ef61af6374f2e5 | /programs/iceauth/iceauth.h | 95e9e4edd8fa5be1a3ada563c864002143ac8b16 | [] | no_license | rickgaiser/xfree86-ps2 | 87e3a1a71bb659ed93cb316d2533a80a281d9a1a | 1548767ecf7d211eef424505ef6879c5496be9e9 | refs/heads/master | 2020-12-31T07:55:31.766127 | 2015-10-07T09:21:02 | 2015-10-07T09:21:02 | 43,805,007 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,941 | h | /*
* $XConsortium: iceauth.h,v 1.3 94/04/17 20:39:55 mor Exp $
* $XFree86: xc/programs/iceauth/iceauth.h,v 3.0 1996/06/10 11:00:26 dawes Exp $
*
*
Copyright (c) 1989 X Consortium
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
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
* *
* Author: Jim Fulton, MIT X Consortium
*/
#include <stdio.h>
#include <X11/Xos.h>
#include <X11/ICE/ICElib.h>
#include <X11/ICE/ICEutil.h>
#include <X11/Xfuncs.h>
#ifndef True
typedef int Bool;
#define False 0
#define True 1
#endif
extern char *ProgramName;
#ifdef X_NOT_STDC_ENV
extern char *malloc(), *realloc();
#else
#include <stdlib.h>
#endif
int process_command(), auth_initialize(), auth_finalize();
extern int print_help();
extern int verbose;
extern Bool ignore_locks;
extern Bool break_locks;
| [
"[email protected]"
] | |
6e034a041e27e0a7f8d2463759da81e1b399028d | b3134aea30ab7362ec16590736935ea66c0716c4 | /jewelbots_solo_mode_v117/cores/JWB_nRF51822/ble-nrf51822-master/source/db_discovery.c | b7fe09733765320d243d3e78f51c987371df0ff8 | [
"MIT"
] | permissive | Jewelbots/arduino-library | 6bb0ccb1fef11caba80ccc030297124d74309efa | b925fdbfd0ced1589defbe430780027c12fa02c4 | refs/heads/master | 2021-01-13T07:40:27.352014 | 2018-12-22T20:20:32 | 2018-12-22T20:20:32 | 71,476,833 | 22 | 25 | MIT | 2018-12-22T20:14:53 | 2016-10-20T15:26:36 | C | UTF-8 | C | false | false | 833 | c | #include "app_error.h"
#include "ble_db_discovery.h"
/**@brief Function for handling database discovery events.
*
* @details This function is callback function to handle events from the
* database discovery module.
* Depending on the UUIDs that are discovered, this function should
* forward the events
* to their respective services.
*
* @param[in] p_event Pointer to the database discovery event.
*/
#ifdef __cplusplus
extern "C"{
#endif // __cplusplus
static void db_disc_handler(ble_db_discovery_evt_t *p_evt) {
// ble_rscs_on_db_disc_evt(&m_ble_rsc_c, p_evt);
// ble_hrs_on_db_disc_evt(&m_ble_hrs_c, p_evt);
}
void db_discovery_init(void) {
ret_code_t err_code = ble_db_discovery_init(db_disc_handler);
APP_ERROR_CHECK(err_code);
}
#ifdef __cplusplus
}
#endif // __cplusplus
| [
"[email protected]"
] | |
55c5997fd593285eab0b46b63a0ddf33065cc47c | 97ac5e15bb723f852f86bd7f7acee85fbfcccc37 | /src/mame/video/parodius.c | cd27070ba1c431fe21e6c2a5ade3ea2976254b9d | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | r-type/mame2009-libretro | e2b306b9909bf88407db0abfcd27b9a22de7d08b | 45048806fbc0fea82709a75a523f2eda945e0a47 | refs/heads/master | 2021-01-22T18:02:03.324079 | 2017-09-24T12:15:24 | 2017-09-24T12:15:24 | 100,746,208 | 1 | 2 | null | null | null | null | UTF-8 | C | false | false | 3,041 | c | #include "driver.h"
#include "video/konicdev.h"
static int layer_colorbase[3],sprite_colorbase,bg_colorbase;
static int layerpri[3];
/***************************************************************************
Callbacks for the K052109
***************************************************************************/
void parodius_tile_callback(running_machine *machine, int layer,int bank,int *code,int *color,int *flags,int *priority)
{
*code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13);
*color = layer_colorbase[layer] + ((*color & 0xe0) >> 5);
}
/***************************************************************************
Callbacks for the K053245
***************************************************************************/
void parodius_sprite_callback(running_machine *machine, int *code,int *color,int *priority_mask)
{
int pri = 0x20 | ((*color & 0x60) >> 2);
if (pri <= layerpri[2]) *priority_mask = 0;
else if (pri > layerpri[2] && pri <= layerpri[1]) *priority_mask = 0xf0;
else if (pri > layerpri[1] && pri <= layerpri[0]) *priority_mask = 0xf0|0xcc;
else *priority_mask = 0xf0|0xcc|0xaa;
*color = sprite_colorbase + (*color & 0x1f);
}
/***************************************************************************
Start the video hardware emulation.
***************************************************************************/
/* useful function to sort the three tile layers by priority order */
static void sortlayers(int *layer,int *pri)
{
#define SWAP(a,b) \
if (pri[a] < pri[b]) \
{ \
int t; \
t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
}
SWAP(0,1)
SWAP(0,2)
SWAP(1,2)
}
VIDEO_UPDATE( parodius )
{
const device_config *k053245 = devtag_get_device(screen->machine, "k053245");
const device_config *k053251 = devtag_get_device(screen->machine, "k053251");
const device_config *k052109 = devtag_get_device(screen->machine, "k052109");
int layer[3];
bg_colorbase = k053251_get_palette_index(k053251, K053251_CI0);
sprite_colorbase = k053251_get_palette_index(k053251, K053251_CI1);
layer_colorbase[0] = k053251_get_palette_index(k053251, K053251_CI2);
layer_colorbase[1] = k053251_get_palette_index(k053251, K053251_CI4);
layer_colorbase[2] = k053251_get_palette_index(k053251, K053251_CI3);
k052109_tilemap_update(k052109);
layer[0] = 0;
layerpri[0] = k053251_get_priority(k053251, K053251_CI2);
layer[1] = 1;
layerpri[1] = k053251_get_priority(k053251, K053251_CI4);
layer[2] = 2;
layerpri[2] = k053251_get_priority(k053251, K053251_CI3);
sortlayers(layer, layerpri);
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
bitmap_fill(bitmap,cliprect,16 * bg_colorbase);
k052109_tilemap_draw(k052109, bitmap, cliprect, layer[0], 0,1);
k052109_tilemap_draw(k052109, bitmap, cliprect, layer[1], 0,2);
k052109_tilemap_draw(k052109, bitmap, cliprect, layer[2], 0,4);
k053245_sprites_draw(k053245, bitmap, cliprect);
return 0;
}
| [
"[email protected]"
] | |
246b1d0819435f95a44cd6b69081452acbbfd3d6 | 9f3ad0dcd9eae0ca383494e5ad126431fae23b9f | /BaseTools/Source/C/TianoCompress/TianoCompress.h | b719ad2debe3a7681218e51aae6ba4e0c7a2a22d | [
"BSD-2-Clause"
] | permissive | jljusten/edk2 | fe267abd42fe67aab5f444adecd266c86575058e | aafc4dcf01716ee87abc007e8826a5e057a291d8 | refs/heads/master | 2020-04-05T19:06:33.113267 | 2013-10-25T20:09:26 | 2013-10-25T20:09:26 | 3,841,706 | 6 | 0 | null | 2013-09-04T12:43:16 | 2012-03-27T08:20:11 | C | UTF-8 | C | false | false | 7,369 | h | /** @file
Internal include file for Tiano Decompress Libary.
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: TianoDecompress.h
**/
#ifndef __TIANO_DECOMPRESS_H__
#define __TIANO_DECOMPRESS_H__
#include <stdio.h>
#include <assert.h>
#include <Common/UefiBaseTypes.h>
//
// Decompression algorithm begins here
//
#define UTILITY_NAME "TianoCompress"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 1
//
// Default output file name
//
#define DEFAULT_OUTPUT_FILE "file.tmp"
#define BITBUFSIZ 32
#define MAXMATCH 256
#define THRESHOLD 3
#define CODE_BIT 16
#define BAD_TABLE - 1
typedef INT32 NODE;
//
// C: Char&Len Set; P: Position Set; T: exTra Set
//
#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
#define CBIT 9
#define MAXPBIT 5
#define TBIT 5
#define MAXNP ((1U << MAXPBIT) - 1)
#define NT (CODE_BIT + 3)
#if NT > MAXNP
#define NPT NT
#else
#define NPT MAXNP
#endif
typedef struct {
UINT8 *mSrcBase; // Starting address of compressed data
UINT8 *mDstBase; // Starting address of decompressed data
UINT32 mOutBuf;
UINT32 mInBuf;
UINT16 mBitCount;
UINT32 mBitBuf;
UINT32 mSubBitBuf;
UINT16 mBlockSize;
UINT32 mCompSize;
UINT32 mOrigSize;
UINT16 mBadTableFlag;
UINT16 mLeft[2 * NC - 1];
UINT16 mRight[2 * NC - 1];
UINT8 mCLen[NC];
UINT8 mPTLen[NPT];
UINT16 mCTable[4096];
UINT16 mPTTable[256];
//
// The length of the field 'Position Set Code Length Array Size' in Block Header.
// For EFI 1.1 de/compression algorithm, mPBit = 4
// For Tiano de/compression algorithm, mPBit = 5
//
UINT8 mPBit;
} SCRATCH_DATA;
//
// Function Prototypes
//
EFI_STATUS
GetFileContents (
IN char *InputFileName,
OUT UINT8 *FileBuffer,
OUT UINT32 *BufferLength
);
STATIC
VOID
PutDword(
IN UINT32 Data
);
STATIC
EFI_STATUS
AllocateMemory (
VOID
);
STATIC
VOID
FreeMemory (
VOID
);
STATIC
VOID
InitSlide (
VOID
);
STATIC
NODE
Child (
IN NODE NodeQ,
IN UINT8 CharC
);
STATIC
VOID
MakeChild (
IN NODE NodeQ,
IN UINT8 CharC,
IN NODE NodeR
);
STATIC
VOID
Split (
IN NODE Old
);
STATIC
VOID
InsertNode (
VOID
);
STATIC
VOID
DeleteNode (
VOID
);
STATIC
VOID
GetNextMatch (
VOID
);
STATIC
EFI_STATUS
Encode (
VOID
);
STATIC
VOID
CountTFreq (
VOID
);
STATIC
VOID
WritePTLen (
IN INT32 Number,
IN INT32 nbit,
IN INT32 Special
);
STATIC
VOID
WriteCLen (
VOID
);
STATIC
VOID
EncodeC (
IN INT32 Value
);
STATIC
VOID
EncodeP (
IN UINT32 Value
);
STATIC
VOID
SendBlock (
VOID
);
STATIC
VOID
Output (
IN UINT32 c,
IN UINT32 p
);
STATIC
VOID
HufEncodeStart (
VOID
);
STATIC
VOID
HufEncodeEnd (
VOID
);
STATIC
VOID
MakeCrcTable (
VOID
);
STATIC
VOID
PutBits (
IN INT32 Number,
IN UINT32 Value
);
STATIC
INT32
FreadCrc (
OUT UINT8 *Pointer,
IN INT32 Number
);
STATIC
VOID
InitPutBits (
VOID
);
STATIC
VOID
CountLen (
IN INT32 Index
);
STATIC
VOID
MakeLen (
IN INT32 Root
);
STATIC
VOID
DownHeap (
IN INT32 Index
);
STATIC
VOID
MakeCode (
IN INT32 Number,
IN UINT8 Len[ ],
OUT UINT16 Code[]
);
STATIC
INT32
MakeTree (
IN INT32 NParm,
IN UINT16 FreqParm[],
OUT UINT8 LenParm[ ],
OUT UINT16 CodeParm[]
);
/**
Read NumOfBit of bits from source into mBitBuf
Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
@param Sd The global scratch data
@param NumOfBits The number of bits to shift and read.
**/
VOID
FillBuf (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
);
/**
Get NumOfBits of bits out from mBitBuf
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
NumOfBits of bits from source. Returns NumOfBits of bits that are
popped out.
@param Sd The global scratch data.
@param NumOfBits The number of bits to pop and read.
@return The bits that are popped out.
**/
UINT32
GetBits (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
);
/**
Creates Huffman Code mapping table according to code length array.
Creates Huffman Code mapping table for Extra Set, Char&Len Set
and Position Set according to code length array.
@param Sd The global scratch data
@param NumOfChar Number of symbols in the symbol set
@param BitLen Code length array
@param TableBits The width of the mapping table
@param Table The table
@retval 0 OK.
@retval BAD_TABLE The table is corrupted.
**/
UINT16
MakeTable (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
);
/**
Decodes a position value.
Get a position value according to Position Huffman Table.
@param Sd the global scratch data
@return The position value decoded.
**/
UINT32
DecodeP (
IN SCRATCH_DATA *Sd
);
/**
Reads code lengths for the Extra Set or the Position Set.
Read in the Extra Set or Pointion Set Length Arrary, then
generate the Huffman code mapping for them.
@param Sd The global scratch data.
@param nn Number of symbols.
@param nbit Number of bits needed to represent nn.
@param Special The special symbol that needs to be taken care of.
@retval 0 OK.
@retval BAD_TABLE Table is corrupted.
**/
UINT16
ReadPTLen (
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
);
/**
Reads code lengths for Char&Len Set.
Read in and decode the Char&Len Set Code Length Array, then
generate the Huffman Code mapping table for the Char&Len Set.
@param Sd the global scratch data
**/
VOID
ReadCLen (
SCRATCH_DATA *Sd
);
/**
Decode a character/length value.
Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
Huffman code mapping table for Extra Set, Code&Len Set and
Position Set.
@param Sd The global scratch data.
@return The value decoded.
**/
UINT16
DecodeC (
SCRATCH_DATA *Sd
);
/**
Decode the source data and put the resulting data into the destination buffer.
Decode the source data and put the resulting data into the destination buffer.
@param Sd The global scratch data
**/
VOID
Decode (
SCRATCH_DATA *Sd
);
RETURN_STATUS
EFIAPI
Decompress (
IN VOID *Source,
IN OUT VOID *Destination,
IN OUT VOID *Scratch,
IN UINT32 Version
);
#endif
| [
"lgao4@6f19259b-4bc3-4df7-8a09-765794883524"
] | lgao4@6f19259b-4bc3-4df7-8a09-765794883524 |
e90fe2a2c547090f80c92367a259a93bc1d8fb20 | cfe207f57a19be297b94e5bf1e148bac347043f4 | /hash.murmur3.32.native/hash.h | e33670950fe796b194aed0a5cf6ec3fd9e751862 | [
"MIT"
] | permissive | bigeasy/hash | 21b95ed4ae55f9cfe75d89d4350f4bf23bab0d64 | dec3ffb384498f1ded812eb966a010d912803a24 | refs/heads/master | 2022-02-18T07:13:22.182795 | 2022-02-07T06:27:21 | 2022-02-07T06:27:21 | 11,754,448 | 12 | 1 | null | null | null | null | UTF-8 | C | false | false | 362 | h | #include <stdlib.h>
typedef union {
void* buffer;
uint32_t number;
} hash_t;
hash_t hash_allocate (uint32_t seed);
int hash_block_size();
void hash_update(hash_t*, void* buffer, int length);
void hash_remainder(hash_t*, void* buffer, int length);
hash_t hash_hash(void* buffer, int length, uint32_t seed);
void hash_free (hash_t hash);
char needed[];
| [
"[email protected]"
] | |
af00ec9c1b8b2dae9ed32dd2141397a0dc46ff92 | befb1490520e1141c1118730c3e9688e2ec7dd61 | /NestGfx/old/o_code/fb.h | 1de32a6ea2f96187f7864d598c1583b8be8ee4c6 | [] | no_license | grant-h/nest-toolkit | 72e3c8816bf4c29e90b2c20d51d23b2181457369 | 647fe7d4b3a8707b42a34fa9f8b5ed9c67e037df | refs/heads/master | 2020-03-10T19:31:11.302070 | 2018-04-15T14:19:22 | 2018-04-15T14:19:22 | 129,549,568 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 208 | h | #ifndef FB_H_
#define FB_H_
int fb_init(const char* fbPath);
uint32_t fb_get_x_res(void);
uint32_t fb_get_y_res(void);
void fb_draw_pixel(uint32_t x, uint32_t y, uint32_t color);
void fb_end(void);
#endif
| [
"[email protected]"
] | |
07e6edb499c5cac86e2269a7adeaf10bc623592f | 02bb56da778dfe95b5b158cf46ffe876dc24b172 | /src/ft_rotate_camera.c | 03ff4bb7b4376f8e91bbf63db5f65603256b31bf | [] | no_license | nkuchyna/Wolf3D | 9b31ad91da6c8471e4a8ea499e9d8d0f0a1e16a7 | b1ec06d051782ad1bd38813ff90cba4033a043c7 | refs/heads/master | 2020-04-20T21:18:30.820694 | 2019-02-04T17:09:06 | 2019-02-04T17:09:06 | 169,105,452 | 5 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,254 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rotate_camera.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nkuchyna <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/12 17:55:33 by nkuchyna #+# #+# */
/* Updated: 2018/08/12 17:55:48 by nkuchyna ### ########.fr */
/* */
/* ************************************************************************** */
#include "wolf3d.h"
t_vector ft_rotate_vector(t_vector dir, double ang)
{
double tmp_x;
tmp_x = dir[0];
dir[0] = dir[0] * cos(ang) - dir[1] * sin(ang);
dir[1] = tmp_x * sin(ang) + dir[1] * cos(ang);
return (dir);
}
void ft_rotate_camera(t_sd *sd, double ang)
{
sd->dir = ft_rotate_vector(sd->dir, ang);
sd->plane = ft_rotate_vector(sd->plane, ang);
}
| [
"[email protected]"
] | |
02771c6d3d5fb45121cd6a4076ff3180a20598e3 | 43c3853b23bb97c03b4c3c8936b3222e9c0a4eae | /src/radio/cc2420/include/hal_cc2420.h | ebfb07e6fe0afe9947ed5c1dbc125c43dddc2e0f | [] | no_license | 17S-WSN-PROJ/tdma | 4028bf880828e36e17b0a38770464cc67911f79c | cea5ca19ccf98310705306f38b9a153f478eb318 | refs/heads/master | 2021-01-19T14:06:39.148266 | 2017-05-22T13:55:57 | 2017-05-22T13:55:57 | 88,124,853 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,800 | h | /******************************************************************************
* Nano-RK, a real-time operating system for sensor networks.
* Copyright (C) 2007, Real-Time and Multimedia Lab, Carnegie Mellon University
* All rights reserved.
*
* This is the Open Source Version of Nano-RK included as part of a Dual
* Licensing Model. If you are unsure which license to use please refer to:
* http://www.nanork.org/nano-RK/wiki/Licensing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contributing Authors (specific to this file):
* Chipcon Development Team
*******************************************************************************/
#ifndef HAL_CC2420_H
#define HAL_CC2420_H
#include <cc2420_mcu_hal.h>
#include <cc2420_platform_hal.h>
//-------------------------------------------------------------------------------------------------------
// CC2420 register constants
#define CC2420_SNOP 0x00
#define CC2420_SXOSCON 0x01
#define CC2420_STXCAL 0x02
#define CC2420_SRXON 0x03
#define CC2420_STXON 0x04
#define CC2420_STXONCCA 0x05
#define CC2420_SRFOFF 0x06
#define CC2420_SXOSCOFF 0x07
#define CC2420_SFLUSHRX 0x08
#define CC2420_SFLUSHTX 0x09
#define CC2420_SACK 0x0A
#define CC2420_SACKPEND 0x0B
#define CC2420_SRXDEC 0x0C
#define CC2420_STXENC 0x0D
#define CC2420_SAES 0x0E
#define CC2420_MAIN 0x10
#define CC2420_MDMCTRL0 0x11
#define CC2420_MDMCTRL1 0x12
#define CC2420_RSSI 0x13
#define CC2420_SYNCWORD 0x14
#define CC2420_TXCTRL 0x15
#define CC2420_RXCTRL0 0x16
#define CC2420_RXCTRL1 0x17
#define CC2420_FSCTRL 0x18
#define CC2420_SECCTRL0 0x19
#define CC2420_SECCTRL1 0x1A
#define CC2420_BATTMON 0x1B
#define CC2420_IOCFG0 0x1C
#define CC2420_IOCFG1 0x1D
#define CC2420_MANFIDL 0x1E
#define CC2420_MANFIDH 0x1F
#define CC2420_FSMTC 0x20
#define CC2420_MANAND 0x21
#define CC2420_MANOR 0x22
#define CC2420_AGCCTRL 0x23
#define CC2420_AGCTST0 0x24
#define CC2420_AGCTST1 0x25
#define CC2420_AGCTST2 0x26
#define CC2420_FSTST0 0x27
#define CC2420_FSTST1 0x28
#define CC2420_FSTST2 0x29
#define CC2420_FSTST3 0x2A
#define CC2420_RXBPFTST 0x2B
#define CC2420_FSMSTATE 0x2C
#define CC2420_ADCTST 0x2D
#define CC2420_DACTST 0x2E
#define CC2420_TOPTST 0x2F
#define CC2420_RESERVED 0x30
#define CC2420_TXFIFO 0x3E
#define CC2420_RXFIFO 0x3F
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// Memory
// Sizes
#define CC2420_RAM_SIZE 368
#define CC2420_FIFO_SIZE 128
// Addresses
#define CC2420RAM_TXFIFO 0x000
#define CC2420RAM_RXFIFO 0x080
#define CC2420RAM_KEY0 0x100
#define CC2420RAM_RXNONCE 0x110
#define CC2420RAM_SABUF 0x120
#define CC2420RAM_KEY1 0x130
#define CC2420RAM_TXNONCE 0x140
#define CC2420RAM_CBCSTATE 0x150
#define CC2420RAM_IEEEADDR 0x160
#define CC2420RAM_PANID 0x168
#define CC2420RAM_SHORTADDR 0x16A
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// Status byte
#define CC2420_XOSC16M_STABLE 6
#define CC2420_TX_UNDERFLOW 5
#define CC2420_ENC_BUSY 4
#define CC2420_TX_ACTIVE 3
#define CC2420_LOCK 2
#define CC2420_RSSI_VALID 1
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// SECCTRL0
#define CC2420_SECCTRL0_NO_SECURITY 0x0000
#define CC2420_SECCTRL0_CBC_MAC 0x0001
#define CC2420_SECCTRL0_CTR 0x0002
#define CC2420_SECCTRL0_CCM 0x0003
#define CC2420_SECCTRL0_SEC_M_IDX 2
#define CC2420_SECCTRL0_RXKEYSEL0 0x0000
#define CC2420_SECCTRL0_RXKEYSEL1 0x0020
#define CC2420_SECCTRL0_TXKEYSEL0 0x0000
#define CC2420_SECCTRL0_TXKEYSEL1 0x0040
#define CC2420_SECCTRL0_SEC_CBC_HEAD 0x0100
#define CC2420_SECCTRL0_RXFIFO_PROTECTION 0x0200
//-------------------------------------------------------------------------------------------------------
// RSSI to Energy Detection conversion
// RSSI_OFFSET defines the RSSI level where the PLME.ED generates a zero-value
#define RSSI_OFFSET -38
#define RSSI_2_ED(rssi) ((rssi) < RSSI_OFFSET ? 0 : ((rssi) - (RSSI_OFFSET)))
#define ED_2_LQI(ed) (((ed) > 63 ? 255 : ((ed) << 2)))
//-------------------------------------------------------------------------------------------------------
#endif
| [
"[email protected]"
] | |
72ebb3f280fbb7cfc5a520f812054103a9c08d1b | 3cf6bb62295c532fc0bbe83892035a73798288b7 | /mcm-gps/mcmlocserver/src/loc_srv_send_indications.h | c4b7c62e669934047e7b1cecad374a5b78877e10 | [] | no_license | qiangzai00001/QuectelShare | 4698c270fde9b2a3fb88f9633302553582a34a8c | 92fbb0f6117219f63b3a83887e16e4f8335ab493 | refs/heads/master | 2022-12-14T20:21:13.450593 | 2020-01-14T04:56:44 | 2020-01-14T04:56:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,159 | h | /*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
Copyright (c) 2013-2015, 2017 Qualcomm Technologies, Inc.
All Rights Reserved.
Confidential and Proprietary - Qualcomm Technologies, Inc.
=============================================================================*/
#ifndef LOC_SRV_SEND_INDICATIONS_H
#define LOC_SRV_SEND_INDICATIONS_H
#include <gps_extended_c.h>
#ifdef __cplusplus
extern "C" {
#endif
//#include <loc_extended.h>
//=============================================================================
// FUNCTION: loc_srv_send_location_ind
//
// DESCRIPTION:
// Indication with Location information
//
// @return
// void
//=============================================================================
void loc_srv_send_location_ind (Location location);
//=============================================================================
// FUNCTION: loc_srv_send_status_ind
//
// DESCRIPTION:
// Indication with GPS Status information
//
// @return
// void
//=============================================================================
void loc_srv_send_status_ind (LocGpsStatus* status);
//=============================================================================
// FUNCTION: loc_srv_send_sv_status_ind
//
// DESCRIPTION:
// Indication with Satellites in View information
//
// @return
// void
//=============================================================================
void loc_srv_send_sv_status_ind (GnssSvNotification gnssSvNotification);
//=============================================================================
// FUNCTION: loc_srv_send_nmea_ind
//
// DESCRIPTION:
// Indication with NMEA information
//
// @return
// void
//=============================================================================
void loc_srv_send_nmea_ind (GnssNmeaNotification gnssNmeaNotification);
//=============================================================================
// FUNCTION: loc_srv_send_set_capabilities_ind
//
// DESCRIPTION:
// Indication with capabilities information
//
// @return
// void
//=============================================================================
void loc_srv_send_set_capabilities_ind (uint32_t capabilities);
//=============================================================================
// FUNCTION: loc_srv_send_utc_time_req_ind
//
// DESCRIPTION:
// Indication with UTC time Request
//
// @return
// void
//=============================================================================
void loc_srv_send_utc_time_req_ind ();
//=============================================================================
// FUNCTION: loc_srv_send_gps_xtra_data_req_ind
//
// DESCRIPTION:
// Indication with XTRA Data Request
//
// @return
// void
//=============================================================================
void loc_srv_send_gps_xtra_data_req_ind ();
//=============================================================================
// FUNCTION: loc_srv_send_gps_xtra_report_server_ind
//
// DESCRIPTION:
// Indication with reported XTRA Server URLs
//
// @return
// void
//=============================================================================
void loc_srv_send_gps_xtra_report_server_ind (const char* server1,
const char* server2,
const char* server3);
//=============================================================================
// FUNCTION: loc_srv_send_agps_status_ind
//
// DESCRIPTION:
// Indication with Agps Status information
//
// @return
// void
//=============================================================================
void loc_srv_send_agps_status_ind (AGpsExtStatus * status);
//=============================================================================
// FUNCTION: loc_srv_send_gps_ni_ind
//
// DESCRIPTION:
// Indication with NI Notification
//
// @return
// void
//=============================================================================
void loc_srv_send_gps_ni_ind (uint32_t id, GnssNiNotification gnssNiNotification);
//=============================================================================
// FUNCTION: loc_srv_send_gps_acquire_wakelock
//
// DESCRIPTION:
// GPS Acquire Wakelock
//
// @return
// void
//=============================================================================
void loc_srv_send_gps_acquire_wakelock_ind ();
//=============================================================================
// FUNCTION: loc_srv_send_gps_release_wakelock
//
// DESCRIPTION:
// GPS Release Wakelock
//
// @return
// void
//=============================================================================
void loc_srv_send_gps_release_wakelock_ind ();
//=============================================================================
// FUNCTION: loc_srv_send_gps_create_thread
//
// DESCRIPTION:
// GPS Create thread
//
// @return
// void
//=============================================================================
void loc_srv_send_gps_create_thread_ind ();
#ifdef __cplusplus
}
#endif
#endif // LOC_SRV_SEND_INDICATIONS_H
| [
"[email protected]"
] | |
086c0b6b06dca67141c550743231162667dac969 | 20965ad00f94bab92a9d18c6e0990eb2a9a83e75 | /src/lib/ow/src/ow_steer_local_neigh_ut.c | 9ddcf744c18f5974fbd1b80777ff59524c2fba44 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | plume-design/opensync | 22fe8d0779df5e35057a8dd5fb779e6b088eee58 | 907da96a2a5cc78d308f095323ebc992d524630e | refs/heads/master | 2023-08-16T11:40:56.389400 | 2023-07-21T03:41:00 | 2023-07-21T03:41:00 | 113,587,683 | 80 | 91 | BSD-3-Clause | 2023-08-18T15:20:42 | 2017-12-08T15:20:41 | C | UTF-8 | C | false | false | 3,551 | c | /*
Copyright (c) 2015, Plume Design Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Plume Design Inc. 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 Plume Design Inc. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <osw_ut.h>
#include <osw_drv_common.h>
OSW_UT(ow_steer_local_neigh_ut_typical_usage)
{
struct ow_steer_local_neigh *self = &g_ow_steer_local_neigh;
struct ow_steer_bm_observer *observer = &self->bm_observer;
struct ow_steer_bm_group group = {
.id = "example-group-id",
};
struct ow_steer_bm_bss bss = {
.bssid = { .octet = { 0xd0, 0xab, 0x1e, 0xc0, 0xc0, 0xaa } },
.group = &group,
};
struct ow_steer_bm_vif vif = {
.vif_name = { .buf = "example-vif-name" },
.bss = &bss,
.group = &group,
};
ow_steer_local_neigh_init(self);
observer->vif_added_fn(observer, &vif);
OSW_UT_EVAL(ow_steer_local_neigh_lookup_group(group.id) != NULL);
OSW_UT_EVAL(ow_steer_local_neigh_lookup_group_by_vif_name(vif.vif_name.buf) != NULL);
OSW_UT_EVAL(ow_steer_local_neigh_lookup_neigh_in_group(group.id, vif.vif_name.buf) != NULL);
struct ow_steer_local_neigh_vif_neigh *local_neigh = ow_steer_local_neigh_lookup_neigh_in_group(group.id, vif.vif_name.buf);
bool is_neigh_complete = ow_steer_local_neigh_is_neigh_complete(local_neigh);
OSW_UT_EVAL(is_neigh_complete == false);
/* vif up */
const struct osw_channel channel = { .control_freq_mhz = 2412 };
const uint8_t op_class = 81;
ow_steer_local_neigh_update_local_neigh_cache(group.id,
vif.vif_name.buf,
&bss.bssid,
&channel,
&op_class);
is_neigh_complete = ow_steer_local_neigh_is_neigh_complete(local_neigh);
OSW_UT_EVAL(is_neigh_complete == true);
observer->vif_removed_fn(observer, &vif);
OSW_UT_EVAL(ow_steer_local_neigh_lookup_group(group.id) == NULL);
OSW_UT_EVAL(ow_steer_local_neigh_lookup_group_by_vif_name(vif.vif_name.buf) == NULL);
OSW_UT_EVAL(ow_steer_local_neigh_lookup_neigh_in_group(group.id, vif.vif_name.buf) == NULL);
}
| [
"[email protected]"
] | |
29b4e6f29a4419891402f5d3387db1def01fa2ed | 03ab979bd506e1ebfb798196acde91c739e84d49 | /d/xingyang/npc/tiejiang.c | c5cda5b130acdf452113409f527f4a196e76332e | [] | no_license | hhsiao/DTSL | d0a9f69edce192f0b39578fc4b458013332d8c39 | 50320937f839e28f04cf70c29c6765d26cb31dc2 | refs/heads/master | 2023-04-17T23:20:52.753422 | 2021-05-02T14:08:44 | 2021-05-02T14:08:44 | null | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 1,437 | c |
inherit F_VENDOR_SALE;
inherit F_REPAIR;
void create()
{
reload("xingyang_tiejiang");
set_name("铁匠",({ "tie jiang","tie","jiang","tiejiang" }) );
set("gender", "男性" );
set("age", 40);
set("long", "这是荥阳的铁匠,他打造的兵器都是很好。\n");
set("shop_id",({ "tie jiang","tie","jiang","tiejiang" }) );
set("combat_exp",300000);
set("str",26);
set("per", 22);
set("force",500);
set("max_force",500);
set("kee",800);
set("max_kee",800);
set("sen",500);
set("max_sen",500);
set_skill("dodge",80);
set_skill("parry",80);
set_skill("unarmed",80);
set("attitude", "peaceful");
set("vendor_goods",([
"changjian":__DIR__"obj/changjian",
"blade":__DIR__"obj/blade",
"axe":__DIR__"obj/axe",
"tianhongjian":__DIR__"obj/tianhong-jian",
"canglongjian":__DIR__"obj/canglong-jian",
"zhanmojian":__DIR__"obj/zhanmo-jian",
"wanshengdao":__DIR__"obj/wansheng-blade",
"zilindao":__DIR__"obj/zilin-blade",
"kuangshaqiang":__DIR__"obj/kuangsha-spear",
"yinlongqiang":__DIR__"obj/yinlong-spear",
"zimangbian":__DIR__"obj/zimang-bian",
"duomingbian":__DIR__"obj/duoming-bian",
]));
setup();
carry_object(__DIR__"obj/cloth")->wear();
}
void init()
{
::init();
add_action("do_vendor_list", "list");
add_action("do_repair",({"repair","xiu"}));
}
int regenerate()
{
set("called", 0);
return 1;
} | [
"[email protected]"
] | |
43454b77c9a7b6cc041db3e3b7a4d01656291fd0 | d57fb4a38048d506911ebc5802d1876f69ee221b | /HARDWARE/ADC/adc.c | 4fa66b9db8019ccc2585bc9eb3236aff290e3c89 | [] | no_license | jerryxiee/WirelessDataCollect | 8e4106ac1d4a29076003e46899e0ea2712419adf | 8b8138023d614641b3cca242550eb44a0ae07ccd | refs/heads/master | 2022-02-22T13:42:12.932451 | 2019-10-10T09:05:56 | 2019-10-10T09:05:56 | null | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 5,390 | c | /**
******************************************************************************
* @file adc.c
* @author zju.nesc.iotlab 浙江大学NeSC课题组物联网实验室
* @version V1.0
* @date 13-March-2019
* @brief ad7606 configuration/read functions ad7606相关配置和读写方法
******************************************************************************
*/
//-------------include---------------//
#include "adc.h"
#include "rsi_global.h"
#include "rsi_app.h"
#include "queue.h"
#include "userwifi.h"
/**
* @brief MCU上和ADC通信的时钟配置
* @note MCU时钟
* @param None
* @retval None
*/
void ADC_RCC_Config(void)
{
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);//使能时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);//使能时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);//使能时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);//使能时钟
RCC_APB1PeriphClockCmd(ADC_SPIx_PERIPH, ENABLE);
}
/**
* @brief ADC的控制引脚配置(包括SPI、复位等)配置
* @param None
* @retval None
*/
void ADC_CTRL_Conf(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
ADC_RCC_Config();//时钟配置
/* CS*/
GPIO_InitStructure.GPIO_Pin = ADC_CS_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(ADC_CS_PORT, &GPIO_InitStructure);
ADC_CS_L();
/* CONV*/
GPIO_InitStructure.GPIO_Pin = ADC_CONV_PIN;
GPIO_Init(ADC_CONV_PORT, &GPIO_InitStructure);
ADC_CONV_H();//默认从拉高开始
/* RAGE:5V or 10V*/
GPIO_InitStructure.GPIO_Pin = ADC_RAGE_PIN;
GPIO_Init(ADC_RAGE_PORT, &GPIO_InitStructure);
ADC_Set5V();
/* RST*/
GPIO_InitStructure.GPIO_Pin = ADC_RST_PIN;
GPIO_Init(ADC_RST_PORT, &GPIO_InitStructure);
ADC_RST_L();delay_ms(1);ADC_RST_H();delay_ms(1);ADC_RST_L();//复位
/* OverSample 1/2/3*/
GPIO_InitStructure.GPIO_Pin = ADC_OS1_PIN;
GPIO_Init(ADC_OS1_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADC_OS2_PIN;
GPIO_Init(ADC_OS2_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADC_OS3_PIN;
GPIO_Init(ADC_OS3_PORT, &GPIO_InitStructure);
//!8 OS带宽较高,平均效果好
ADC_8Sample_Mean();
/* BUSY,输入转换的状态*/
GPIO_InitStructure.GPIO_Pin = ADC_BUSY_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(ADC_BUSY_PORT, &GPIO_InitStructure);
/* SPI:CLK;MISO;MOSI*/
GPIO_InitStructure.GPIO_Pin = ADC_CLK_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(ADC_CLK_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADC_MOSI_PIN;
GPIO_Init(ADC_MOSI_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADC_MISO_PIN;
GPIO_Init(ADC_MISO_PORT, &GPIO_InitStructure);
ADC_CS_H();
/* 复用*/
GPIO_PinAFConfig(ADC_CLK_PORT,ADC_CLK_AF_PINSOURCE,ADC_SPIx_AF);
GPIO_PinAFConfig(ADC_MISO_PORT,ADC_MISO_AF_PINSOURCE,ADC_SPIx_AF);
GPIO_PinAFConfig(ADC_MOSI_PORT,ADC_MOSI_AF_PINSOURCE,ADC_SPIx_AF);
/* wifi spi的配置*/
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(ADC_SPIx, &SPI_InitStructure);
SPI_Cmd(ADC_SPIx, ENABLE);
ADC_CS_L();
}
//读取ADC数据,最多8个通道,16bytes数据
//如果使用AD7606-4则只有4个通道,8bytes数据
u8 AD7606_Data_Temp[ADC_MAX_BYTES]={0,0};
/**
* @brief ADC数据读取,返回一个u8指针,存储采集一次的数据
* @note 存储空间一定,后一次覆盖前一次空间
* @param NumByteToRead:要读取的数据字节长度
* @retval AD7606_Data_Temp:ADC数据存储地址
*/
u8 * ADC_Read(u16 NumByteToRead)
{
u16 i;
ADC_CS_L(); //片选
//4四个通道的数据全部保存
for(i=0;(i<NumByteToRead) && (i < ADC_MAX_BYTES);i++)
{
AD7606_Data_Temp[i] = ADC_SPIx_ReadWriteByte(0XFF);//循环读数
}
ADC_CS_H(); //取消片选
return AD7606_Data_Temp;
}
/**
* @brief 读取ADC一个字节
* @param TxData:要写入的字节
* @retval 读取的数据
*/
u8 ADC_SPIx_ReadWriteByte(u8 TxData)
{
u8 retry=0;
while (SPI_I2S_GetFlagStatus(ADC_SPIx, SPI_I2S_FLAG_TXE) == RESET){
retry++;
if(retry>200){
return 0;
}
}
/* 通过外设SPIx发送一个数据*/
SPI_I2S_SendData(ADC_SPIx, TxData);
retry=0;
while (SPI_I2S_GetFlagStatus(ADC_SPIx, SPI_I2S_FLAG_RXNE) == RESET){
retry++;
if(retry>200){
return 0;
}
}
return SPI_I2S_ReceiveData(ADC_SPIx); //返回通过SPIx最近接收的数据
}
| [
"[email protected]"
] | |
6e29ba940b5d43e7c42437c287cfa36d7cd0137c | 303cb679fdcd8a436dbd373f98da679eefefae01 | /3rdParty/DirectFB/lib/direct/os/tls.h | 0b50105fde86d909a96911625b0b5145182983fd | [
"LGPL-2.0-or-later",
"LGPL-2.1-only",
"MIT"
] | permissive | rohmer/LVGL_UI_Creator | d812a66ca8e3f8a736b02f074d6fbb324560b881 | 8ff044064819be0ab52eee89642956a3cc81564b | refs/heads/Dev | 2023-02-16T01:25:33.247640 | 2023-02-09T16:58:50 | 2023-02-09T16:58:50 | 209,129,978 | 37 | 17 | MIT | 2023-02-09T16:58:51 | 2019-09-17T18:35:36 | C | UTF-8 | C | false | false | 2,040 | h | /*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <[email protected]>,
Andreas Shimokawa <[email protected]>,
Marek Pikarski <[email protected]>,
Sven Neumann <[email protected]>,
Ville Syrjälä <[email protected]> and
Claudio Ciccani <[email protected]>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__TLS_H__
#define __DIRECT__OS__TLS_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
__dfb_no_instrument_function__
static __inline__ void * direct_tls_get ( DirectTLS *tls );
__dfb_no_instrument_function__
static __inline__ DirectResult direct_tls_set ( DirectTLS *tls,
void *value );
__dfb_no_instrument_function__
static __inline__ DirectResult direct_tls_register ( DirectTLS *tls, void (*destructor)( void* ) );
__dfb_no_instrument_function__
static __inline__ DirectResult direct_tls_unregister( DirectTLS *tls );
#endif
| [
"[email protected]"
] | |
20479d9bdb418098c66a3354dc79f3d8578c858c | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/drivers/mmc/host/extr_sdhci-omap.c_sdhci_omap_enable_sdio_irq.c | 68c6b1c078a28d5e80afecead23998537529db20 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,563 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct sdhci_pltfm_host {int dummy; } ;
struct sdhci_omap_host {int dummy; } ;
struct sdhci_host {int dummy; } ;
struct mmc_host {int dummy; } ;
/* Variables and functions */
int CON_CLKEXTFREE ;
int CON_CTPL ;
int /*<<< orphan*/ SDHCI_OMAP_CON ;
struct sdhci_host* mmc_priv (struct mmc_host*) ;
int /*<<< orphan*/ sdhci_enable_sdio_irq (struct mmc_host*,int) ;
int sdhci_omap_readl (struct sdhci_omap_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sdhci_omap_writel (struct sdhci_omap_host*,int /*<<< orphan*/ ,int) ;
struct sdhci_omap_host* sdhci_pltfm_priv (struct sdhci_pltfm_host*) ;
struct sdhci_pltfm_host* sdhci_priv (struct sdhci_host*) ;
__attribute__((used)) static void sdhci_omap_enable_sdio_irq(struct mmc_host *mmc, int enable)
{
struct sdhci_host *host = mmc_priv(mmc);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
u32 reg;
reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
if (enable)
reg |= (CON_CTPL | CON_CLKEXTFREE);
else
reg &= ~(CON_CTPL | CON_CLKEXTFREE);
sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
sdhci_enable_sdio_irq(mmc, enable);
} | [
"[email protected]"
] | |
9cffe7fe3c74d72d6ea4182c3b76acc1a6a6d3e3 | 5c255f911786e984286b1f7a4e6091a68419d049 | /code/8c41ff32-3e80-4fce-82d4-bc23da2a6398.c | cbf78ac4ed4d52d1369c531f17cb5f9f65f6a2f9 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 241 | c | #include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = i/j;
l = i-j;
l = l%j;
l = j-j;
k = i-k*i;
printf("vulnerability");
printf("%d%d\n",k,i);
return 0;
}
| [
"[email protected]"
] | |
d6c87565fea8d6bdfac6c9634df0c79564f38a63 | da87c3c4568baf73eafba3bdd0398b721c14fa83 | /app/ned/02/ned0258.c | 3a22898ed81767b1e8341d6b070153158d648efe | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | gonter/hyx-tools | d8b42fc1fb8a296924208838a8fcc196060d884f | 4fefb2d99454f859e7ed452a8d8113aff068aefc | refs/heads/master | 2022-04-08T15:24:52.144996 | 2020-02-27T18:27:43 | 2020-02-27T18:27:43 | 111,293,783 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 418 | c | /*
* FILE %ned/02/ned0258.c
*
* vi emulation: go down one line and place cursor at first no-blank char
*
* written: 1993-07-31
* latest update: 1996-12-19 21:52:00
*
*/
#include "ed.h"
#include "proto.h"
#ifdef MSDOS
#pragma check_stack(off)
#endif
/* ------------------------------------------------------------------------ */
void vi_jmp_next_boln ()
{
ned_cursor_down ();
vi_jmp_boln ();
}
| [
"[email protected]"
] | |
c15eb35c5884d5c28e29fd682e32330d7db6e17f | 08b07d4eff5b9b59a81f9cc341d3bad636082256 | /0x01-variables_if_else_while/5-print_numbers.c | 2b6d87ef2dfb8f4c306ad97412f586afd1df1ff9 | [] | no_license | migarcos/HS_LLP | b83d811f8a9c54749c0a1e19af6423bec3f7b976 | c58b64a201c5454f3cfd7df6689dd9cbe5c84ec1 | refs/heads/master | 2023-05-27T19:24:14.823791 | 2020-07-21T17:48:42 | 2020-07-21T17:48:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 185 | c | #include <stdio.h>
/**
* main - entry block
* @void: no argument
* Return: 0
**/
int main(void)
{
int i;
for (i = 0; i < 10; i++)
printf("%d", i);
printf("\n");
return (0);
}
| [
"[email protected]"
] | |
4236236f918ccf0b57373a5a8e157b22f192fa8e | 12374ee7908f26364e9263289993fb2af1a91766 | /api-tests/ff/ipc/test_i049/test_entry_i049.c | d7225879f7b88b87500082f002e18eaa95c1a167 | [
"Apache-2.0"
] | permissive | ARM-software/psa-arch-tests | fd07d7eb11c61ddd88822240cd31f6a0ec0d2f68 | 41655df4a507ebf41f0b8f730d88d82cda7a118d | refs/heads/main | 2023-09-02T00:18:58.081221 | 2023-08-28T12:41:12 | 2023-08-28T12:41:12 | 136,486,619 | 64 | 149 | Apache-2.0 | 2023-09-01T10:48:08 | 2018-06-07T14:09:03 | C | UTF-8 | C | false | false | 1,837 | c | /** @file
* Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
#include "val_interfaces.h"
#include "val_target.h"
#include "test_i049.h"
#define TEST_NUM VAL_CREATE_TEST_ID(VAL_FF_BASE, 49)
#define TEST_DESC "Testing psa_call with invalid address for outvec\n"
TEST_PUBLISH(TEST_NUM, test_entry);
val_api_t *val = NULL;
psa_api_t *psa = NULL;
void test_entry(val_api_t *val_api, psa_api_t *psa_api)
{
int32_t status = VAL_STATUS_SUCCESS;
val = val_api;
psa = psa_api;
/* test init */
val->test_init(TEST_NUM, TEST_DESC, TEST_FIELD(TEST_ISOLATION_L1, WD_LOW_TIMEOUT));
if (!IS_TEST_START(val->get_status()))
{
goto test_exit;
}
/* Execute list of tests available in test[num]_client_tests_list from Non-secure side*/
status = val->execute_non_secure_tests(TEST_NUM, test_i049_client_tests_list, TRUE);
if (VAL_ERROR(status))
{
goto test_exit;
}
/* Switch to secure side (client_partition.c) and execute list of tests available in
test[num]_client_tests_list from Secure side */
status = val->switch_to_secure_client(TEST_NUM);
if (VAL_ERROR(status))
{
goto test_exit;
}
test_exit:
val->test_exit();
}
| [
"[email protected]"
] | |
2e81598ba5700185b8a6093b9a02819d67a45d77 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/014260ad-d1b2-42c2-93e7-76a4ee9baec4.c | ff36569e7c27653e666f9ee15a64a8015ddd8f65 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 541 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=0;
int j=12;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = i/j;
l = i+j;
l = i-j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
char b[97];
char c[10];
a = 0;
while (a < strlen(b)) {
/* START BUFFER SET */
*((char *)c + a) = *((char *)b + a);
/* END BUFFER SET */
a++;
}
/* END VULNERABILITY */
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
58b11a10ea34ee7d8cfab7ffe24b590b6abc2b50 | 6c96dd89dc56fbf84c0026b527170d9083d26785 | /ft_memccpy.c | ffb54ce862fa1bdcd3fdb938bfb93f40c08780ee | [] | no_license | riking/libft | e269d0f76cbb96f96b5e5ce7d331c1a5d16a582b | 3681c1bf4a5c7ac519c69f64dcc0558d259970ca | refs/heads/master | 2021-01-10T23:19:37.993241 | 2019-07-07T04:39:05 | 2019-07-07T04:39:05 | 70,622,294 | 3 | 1 | null | null | null | null | UTF-8 | C | false | false | 1,216 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kyork <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/09/21 18:38:32 by kyork #+# #+# */
/* Updated: 2016/09/24 17:09:58 by kyork ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
unsigned const char *s;
unsigned char *d;
size_t i;
i = 0;
d = (unsigned char*)dst;
s = (unsigned const char*)src;
while (i < n)
{
*d++ = *s;
if (*s++ == (unsigned char)c)
{
return (d);
}
i++;
}
return (NULL);
}
| [
"[email protected]"
] | |
8aec419b314c8c361d614cb4b91e15956f10cf5d | 257e4c37dc90194815a0d40a2f2e6cde20c24230 | /0x13-more_singly_linked_lists/10-delete_nodeint.c | 688a4bf9de3d8d41332416a387b1ef1c17b108a4 | [] | no_license | EtienneBrJ/holbertonschool-low_level_programming | feeb8a9f629078757e8dc2413abd999c110e1eaa | 57ac0c4f0a90042b1541885988b94273e214c40f | refs/heads/main | 2023-07-18T08:29:10.524467 | 2021-08-31T11:11:25 | 2021-08-31T11:11:25 | 335,563,758 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 642 | c | #include "lists.h"
/**
* delete_nodeint_at_index - deletes the node at index index of a listint_t
* linked list
* @head: pointer to pointer
* @index: index of the list
* Return: 1 if it's succeeded and -1 if it's failed
*/
int delete_nodeint_at_index(listint_t **head, unsigned int index)
{
listint_t *tmp = *head;
listint_t *replace;
unsigned int i = 0;
if (*head == NULL)
return (-1);
if (index == 0)
{
*head = (*head)->next;
free(tmp);
return (1);
}
while (i < index - 1)
{
if (!tmp)
return (-1);
tmp = tmp->next;
i++;
}
replace = tmp->next;
tmp->next = replace->next;
free(replace);
return (1);
}
| [
"[email protected]"
] | |
1d7ec359f118f93825f2fff2ba368a124d098a60 | 256a8eabe095fccb9cbc4da9dd9f2458ff087d60 | /build/doxygen/master/valid_snoop.c | a1ca4c8b23d4e5a389ad2ac386393263fb270f63 | [] | no_license | abathur/ldmud-doc | 9a19d7773072ecad922952e6ce8fd925ee3c9f15 | 1da0d007b136a805a5829721b245fcecc987971a | refs/heads/master | 2021-01-17T08:02:15.519054 | 2017-03-17T01:55:21 | 2017-03-17T01:55:21 | 38,114,413 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 307 | c | public class master {
/**
* Should return 1 if me is allowed to snoop you, 0 if not.
*
* @synopsis{
* int valid_snoop(object me, object you)
* }
*
* @see efun::snoop(), efun::query_snoop(), master::valid_query_snoop()
**/
int valid_snoop(object me, object you);
}
| [
"[email protected]"
] | |
43aa1db01b969bfe46f8d733486625bac77bda2e | 8989de801d1d765b81fc0835cf399299219b10f5 | /codebase/superdarn/src.bin/tk/plot/time_plot.1.7/tplot.c | 7446ab7a0ae6cde1a0ebcc6a7a399fad49b0cd4f | [] | no_license | vtsuperdarn/VTRST3.5 | f7e335755f2eb7523e40e2d60b7e2a0eb034cf48 | cf0b5f7021bd199faced1b617964a0a8c05d065c | refs/heads/develop | 2020-12-20T17:07:59.531585 | 2017-05-10T18:02:12 | 2017-05-10T18:02:12 | 6,176,843 | 0 | 5 | null | 2017-05-26T02:47:49 | 2012-10-11T16:20:12 | C | UTF-8 | C | false | false | 2,597 | c | /* tplot.c
=======
Author: R.J.Barnes
*/
/*
LICENSE AND DISCLAIMER
Copyright (c) 2012 The Johns Hopkins University/Applied Physics Laboratory
This file is part of the Radar Software Toolkit (RST).
RST is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
RST is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with RST. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <math.h>
#include "tplot.h"
int tplotset(struct tplot *ptr,int nrang) {
void *tmp=NULL;
if (ptr==NULL) return -1;
if (ptr->qflg==NULL) tmp=malloc(sizeof(int)*nrang);
else tmp=realloc(ptr->qflg,sizeof(int)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(int)*nrang);
ptr->qflg=tmp;
if (ptr->gsct==NULL) tmp=malloc(sizeof(int)*nrang);
else tmp=realloc(ptr->gsct,sizeof(int)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(int)*nrang);
ptr->gsct=tmp;
if (ptr->p_l==NULL) tmp=malloc(sizeof(double)*nrang);
else tmp=realloc(ptr->p_l,sizeof(double)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(double)*nrang);
ptr->p_l=tmp;
if (ptr->p_l_e==NULL) tmp=malloc(sizeof(double)*nrang);
else tmp=realloc(ptr->p_l_e,sizeof(double)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(double)*nrang);
ptr->p_l_e=tmp;
if (ptr->v==NULL) tmp=malloc(sizeof(double)*nrang);
else tmp=realloc(ptr->v,sizeof(double)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(double)*nrang);
ptr->v=tmp;
if (ptr->v_e==NULL) tmp=malloc(sizeof(double)*nrang);
else tmp=realloc(ptr->v_e,sizeof(double)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(double)*nrang);
ptr->v_e=tmp;
if (ptr->w_l==NULL) tmp=malloc(sizeof(double)*nrang);
else tmp=realloc(ptr->w_l,sizeof(double)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(double)*nrang);
ptr->w_l=tmp;
if (ptr->w_l_e==NULL) tmp=malloc(sizeof(double)*nrang);
else tmp=realloc(ptr->w_l_e,sizeof(double)*nrang);
if (tmp==NULL) return -1;
memset(tmp,0,sizeof(double)*nrang);
ptr->w_l_e=tmp;
return 0;
}
| [
"[email protected]"
] | |
9b33806e4888fe544e145e7886cec656adc5afea | ef2ab21b395a52b250c1bf90d5733a46ba148d69 | /lesson9_2事件标志组的等待与通知/sourse/t_flag_group.h | 9e95b3d1a78fbae6719b6976676941d1ece3575b | [
"MIT"
] | permissive | xupenghu/learning_tinyOS | 7b562e8f6165cb2bc543e0dc785d3f8d5e683c11 | 993a4884f58734182d0e27c9b95beacdf1139839 | refs/heads/master | 2020-03-11T03:24:46.167481 | 2018-04-23T01:25:45 | 2018-04-23T01:25:45 | 129,746,632 | 15 | 10 | null | null | null | null | UTF-8 | C | false | false | 3,927 | h | #ifndef T_FLAG_GROUP__H
#define T_FLAG_GROUP__H
#include "t_event.h"
typedef struct _t_flag_group
{
//定义一个事件控制块
t_event event;
//当前事件标志组 最多可以有32个标志 如果想要更多 可以使用位图来实现
uint32_t flags;
}t_flag_group;
#define TFLAGGROUP_CLEAR (0x0 << 0)
#define TFLAGGROUP_SET (0x1 << 0)
#define TFLAGGROUP_ANY (0x0 << 1)
#define TFLAGGROUP_ALL (0x1 << 1)
#define TFLAGGROUP_SET_ALL (TFLAGGROUP_SET | TFLAGGROUP_ALL)
#define TFLAGGROUP_SET_ANY (TFLAGGROUP_SET | TFLAGGROUP_ANY)
#define TFLAGGROUP_CLEAR_ALL (TFLAGGROUP_CLEAR | TFLAGGROUP_ALL)
#define TFLAGGROUP_CLEAR_ANY (TFLAGGROUP_CLEAR | TFLAGGROUP_ANY)
#define TFLAGGROUP_CONSUME (0x1 << 7)
void t_flag_group_init(t_flag_group * flag_group, uint32_t flag);
/**********************************************************************************************************
** Function name : tFlagGroupCheckAndConsume
** Descriptions : 辅助函数。检查并消耗掉事件标志
** parameters : flagGroup 等待初始化的事件标志组
** parameters : type 事件标志检查类型
** parameters : flags 待检查事件标志存储地址和检查结果存储位置
** Returned value : tErrorNoError 事件匹配;tErrorResourceUnavaliable 事件未匹配
***********************************************************************************************************/
static uint32_t t_flag_group_check_and_consume (t_flag_group * flag_group, uint32_t type, uint32_t * flags);
/**********************************************************************************************************
** Function name : tFlagGroupWait
** Descriptions : 等待事件标志组中特定的标志
** parameters : flagGroup 等待的事件标志组
** parameters : waitType 等待的事件类型
** parameters : requstFlag 请求的事件标志
** parameters : resultFlag 等待标志结果
** parameters : waitTicks 当等待的标志没有满足条件时,等待的ticks数,为0时表示永远等待
** Returned value : 等待结果,tErrorResourceUnavaliable.tErrorNoError,tErrorTimeout
***********************************************************************************************************/
uint32_t t_flag_group_wait (t_flag_group * flag_group, uint32_t wait_type, uint32_t request_flag,
uint32_t * result_flag, uint32_t wait_ticks);
/**********************************************************************************************************
** Function name : tFlagGroupNoWaitGet
** Descriptions : 获取事件标志组中特定的标志
** parameters : flagGroup 获取的事件标志组
** parameters : waitType 获取的事件类型
** parameters : requstFlag 请求的事件标志
** parameters : resultFlag 等待标志结果
** Returned value : 获取结果,tErrorResourceUnavaliable.tErrorNoError
***********************************************************************************************************/
uint32_t t_flag_group_no_wait_get (t_flag_group * flag_group, uint32_t wait_type, uint32_t request_flag, uint32_t * result_flag);
/**********************************************************************************************************
** Function name : tFlagGroupNotify
** Descriptions : 通知事件标志组中的任务有新的标志发生
** parameters : flagGroup 事件标志组
** parameters : isSet 是否是设置事件标志
** parameters : flags 产生的事件标志
***********************************************************************************************************/
void t_flag_group_notify (t_flag_group * flag_group, uint8_t is_set, uint32_t flags);
#endif
| [
"[email protected]"
] | |
bd2289f0e5006af8939c52a68e45b05c09b74020 | 5c255f911786e984286b1f7a4e6091a68419d049 | /code/e0244bdb-4c5f-4b56-90a8-90c39a2b93c2.c | 864a85cae7427f14e201dca136524d2123681d8e | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 241 | c | #include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = l/j;
l = i/j;
l = l%j;
l = i%j;
k = k-k*i;
printf("vulnerability");
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
4ba04b1038caccb0f0a4b496c06f0c7d4b5471ce | 7292a79136cd0c20b88f47c60ba4e41eb79ca515 | /Core/Src/qrs_interface.c | 6e4ee6613217a0057f69443e866dcb30415109de | [] | no_license | evgenyagantaev/f205_new_vest_github | fe77895d6b80e8bc68fedbac96a8dfceebaf0c87 | b5ec81e17576fa56bb2e54121262b8c0e1684d4e | refs/heads/master | 2021-05-21T19:30:47.865639 | 2020-06-05T08:49:43 | 2020-06-05T08:49:43 | 252,770,666 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 6,664 | c | #include "qrs_obj.h"
#include "qrs_interface.h"
#include "heart_rate_interface.h"
#include "gpio.h"
#include "usart.h"
void qrs_action()
{
if(qrs_get_new_sample_flag())
{
qrs_set_new_sample_flag(0); // drop flag
if(qrs_get_local_buffer_ready_flag())
qrsDetect();
UNUSED(message);
//*
//sprintf(message, "%uI%u\r\n", (unsigned int)qrs_window[0], (unsigned int)isoline_window[0]);
//HAL_UART_Transmit(&huart1, (uint8_t *)message, strlen(message), 500); // for production board
/*
if(markers[0] == WHITEMARKER)
HAL_UART_Transmit(&huart1, "W\r\n", 3, 500); // for production board
else if(markers[0] == BLUEMARKER)
HAL_UART_Transmit(&huart1, "B\r\n", 3, 500); // for production board
//*/
if(markers[0] == REDMARKER)
HAL_UART_Transmit(&huart1, (uint8_t *)"R\r\n", 3, 500); // for production board
/*
//debug
if(qrs_detection_task_get_test_flag())
{
//sprintf(&message[1], "%ldI%ld\r\n", qrs_window[0], isoline_window[0]);
//USBD_CUSTOM_HID_SendReport(&USBD_Device, (uint8_t *)message, strlen(message));
}
//*/
}
}
/*
int qrs_detection_task_get_test_flag()
{
return test_flag;
}
void qrs_detection_task_set_test_flag()
{
test_flag = 1;
}
void qrs_detection_task_drop_test_flag()
{
test_flag = 0;
}
*/
void qrs_add_new_sample(int32_t new_sample)
{
qrs_shift_array(qrs_window, WINDOW_LENGTH);
qrs_window[WINDOW_LENGTH-1] = new_sample;
qrs_shift_array(markers, WINDOW_LENGTH);
markers[WINDOW_LENGTH-1] = 0;
qrs_new_sample_added_flag = 1; // set new sample flag
// check if local buffer (full) ready for analysis
if(!local_buffer_ready_flag)
{
// buffer is not ready, so we have not collected enough samples in it,
// so we increment samples counter
qrs_buffer_counter++;
// if buffer is full, set flag of buffer readiness
if(qrs_buffer_counter >= samples_to_drop_in_window)
local_buffer_ready_flag = 1;
}
// inkrementiruem schetchik asistolii, kotoryi obnulyaetsya kazhdyi raz, kogda detektirovan qrs-kompleks
asystolyShiftCounter++;
}
void qrs_add_new_isoline(int32_t isoline_value)
{
qrs_shift_array(isoline_window, WINDOW_LENGTH);
isoline_window[WINDOW_LENGTH-1] = isoline_value;
}
void qrs_add_order_number(uint32_t received_ecg_samples_counter)
{
qrs_shift_array(order_numbers, WINDOW_LENGTH);
order_numbers[WINDOW_LENGTH-1] = received_ecg_samples_counter;
}
int qrs_get_local_buffer_ready_flag()
{
return local_buffer_ready_flag;
}
int qrs_get_new_sample_flag()
{
return qrs_new_sample_added_flag;
}
void qrs_set_new_sample_flag(int flag)
{
qrs_new_sample_added_flag = flag;
}
int get_new_rr_interval_flag()
{
return new_rr_interval_calculated_flag;
}
void set_new_rr_interval_flag(int flag)
{
new_rr_interval_calculated_flag = flag;
}
uint32_t qrs_get_new_rr_interval()
{
return new_rr_interval;
}
//***********************************************
#define DEBUG_MARKERS
//***********************************************
//#include "ecg_ring_buffer_interface.h"
//#include "heart_rate_obj.h"
//#include "rr_window_obj.h"
//debug
//#include "usart.h"
//extern UART_HandleTypeDef huart1;
void qrs_shift_array(int32_t *array, int LENGTH)
{
int i;
for(i=0; i<(LENGTH-1); i++)
array[i] = array[i+1];
}
//---------------------------------------------------------------------------
// Method detects presence of r-pick in the local qrs-window
void qrsDetect(void)
{
if(qrs_suspend_flag) // procedure of qrs detection is suspended (just have found
// a new r-pick)
{
if((order_numbers[0] - qrs_suspend_marker) > QRSSUSPENDPERIOD)
{
//suspend period gone yet; so we reset the suspend flag
qrs_suspend_flag = 0;
//GPIOB->BSRRH=GPIO_Pin_9; //pb9 low
}
}
else // qrs detection is not suspended
{
// first: we detect if there is an excess of threshold level in the window
int excess = 0;
int i = 0;
while(!excess && (i<(QRSWINDOWLENGTH-RIGHT_WINDOW_MARGIN))) // otstupili na 7 semplov ot pravogo kraya chtoby "vlez" ves QRS-kompleks
{
if((qrs_window[i] - isoline_window[i]) > AMPLITUDELEASTTHRESHOLD)
{
excess = 1;
base_isoline = isoline_window[i];
r_start = i;
}
else
i++;
}
// if no excess of threshold level in the local window, we have to drop
// buffer and collect it again
if(!excess)
{
local_buffer_ready_flag = 0;
qrs_buffer_counter = 0;
samples_to_drop_in_window = SAMPLES_TO_DROP_DEFAULT;
// if no qrs more than 4 seconds, then we detect asistoly
//*
if(asystolyShiftCounter >= 1000)
{
if(get_current_heartrate() != 444) // there was real pulse yet
heart_rate_set_asystoly();
}
//*/
}
// second: we detect if there is a drop under isoline level
int drop = 0;
if(excess)
{
while(!drop && (i<QRSWINDOWLENGTH))
{
if(qrs_window[i] < base_isoline)
{
drop = 1;
r_finish = i;
}
else
i++;
}
}// end if(excess)
// third: we detect if the r-pick length is ok
int lengthOk = 0;
if(drop)
{
int length = r_finish - r_start;
if((length <= RMOSTLENGTH) && (length >= RLEASTLENGTH))
lengthOk = 1;
}
// fourth: we check amplitude
int amplitudeOk = 0;
if(lengthOk)
{
int amplitude = qrs_window[r_start];
r_max_index = r_start;
for(int i=(r_start+1); i<r_finish; i++)
{
if(qrs_window[i] > amplitude)
{
amplitude = qrs_window[i];
r_max_index = i;
}
}
amplitude = amplitude - base_isoline;
if(amplitude <= AMPLITUDEMOSTTHRESHOLD)
amplitudeOk = 1;
}// end if(lengthOk)
// now if amplitude OK, so we probably detected good r-pick
if(amplitudeOk)
{
#ifdef DEBUG_MARKERS
// set markers in array of markers
markers[r_start] = WHITEMARKER;
markers[r_finish] = BLUEMARKER;
markers[r_max_index] = REDMARKER;
#endif
// set marker of freshly detected r-pick
old_rmarker = r_marker;
r_marker = order_numbers[r_max_index];
new_rr_interval = (r_marker - old_rmarker)*4;
new_rr_interval_calculated_flag = 1;
// give new rr-interval to Baevsky calculation procedure
//rr_window_set_new_rr_ready_flag(1);
//rr_window_set_new_rr_interval(new_rr_interval);
// reset of asystoly counter
asystolyShiftCounter = 0;
// drop buffer
local_buffer_ready_flag = 0;
qrs_buffer_counter = 0;
samples_to_drop_in_window = r_finish;
// now suspend a qrs detection procedure for a while
qrs_suspend_marker = order_numbers[r_max_index];
qrs_suspend_flag = 1;
//GPIOB->BSRRL=GPIO_Pin_9; //pb9 high
}//end if(amplitudeOk)
}//end if(qrsSuspend)
}//end qrsDetect
//--------------------------end----------------------------------------------
| [
"[email protected]"
] | |
b2527bb9d14d7ce81866f1526e518397e78bf839 | f7b714e8bfecfa0f3df4c1f8e367005e51cc94c0 | /TechnologyPack/ASD-Whitley/12-update-5.00/Modified_OpenSource/jtag_intel_socket_svr-src/dbus_helper.h | 03138486ac3e8c9c060f6b87eb6ddc872f3cbfa9 | [
"BSD-3-Clause"
] | permissive | ami-megarac/OSSW-v12-update-5.00 | 1f3e79f4c54518a007da0680bd6d26d14e218e71 | 51081f292423a6a7fbac3f3ab207ba106a26c693 | refs/heads/main | 2023-07-08T18:17:06.867766 | 2021-08-11T09:46:28 | 2021-08-11T09:46:28 | 386,598,287 | 2 | 2 | null | 2021-08-11T09:46:29 | 2021-07-16T10:29:19 | C | UTF-8 | C | false | false | 5,601 | h | /*
Copyright (c) 2019, Intel Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __ASD_DBUS_HELPER_H_
#define __ASD_DBUS_HELPER_H_
#include <stdbool.h>
#include <systemd/sd-bus.h>
#include "asd_common.h"
#define POWER_SERVICE_HOST "xyz.openbmc_project.State.Host"
#define POWER_INTERFACE_NAME_HOST "xyz.openbmc_project.State.Host"
#define POWER_OBJECT_PATH_HOST "/xyz/openbmc_project/state/host0"
#define HOST_TRANSITION_PROPERTY "RequestedHostTransition"
#define RESET_ARGUMENT_HOST \
"xyz.openbmc_project.State.Host.Transition.ForceWarmReboot"
#define POWER_SERVICE_CHASSIS "xyz.openbmc_project.State.Chassis"
#define POWER_INTERFACE_NAME_CHASSIS "xyz.openbmc_project.State.Chassis"
#define POWER_OBJECT_PATH_CHASSIS "/xyz/openbmc_project/state/chassis0"
#define GET_POWER_STATE_PROPERTY_CHASSIS "CurrentPowerState"
#define SET_POWER_STATE_METHOD_CHASSIS "RequestedPowerTransition"
#define POWER_OFF_PROPERTY_CHASSIS \
"xyz.openbmc_project.State.Chassis.PowerState.Off"
#define POWER_ON_PROPERTY_CHASSIS \
"xyz.openbmc_project.State.Chassis.PowerState.On"
#define POWER_OFF_ARGUMENT_CHASSIS \
"xyz.openbmc_project.State.Chassis.Transition.Off"
#define POWER_ON_ARGUMENT_CHASSIS \
"xyz.openbmc_project.State.Chassis.Transition.On"
#define POWER_REBOOT_ARGUMENT_CHASSIS \
"xyz.openbmc_project.State.Chassis.Transition.Reboot"
#define POWER_RESET_ARGUMENT_CHASSIS \
"xyz.openbmc_project.State.Chassis.Transition.Reset"
#define DBUS_PROPERTIES "org.freedesktop.DBus.Properties"
#define DBUS_SET_METHOD "Set"
#define MATCH_STRING_CHASSIS \
"type='signal',path='/xyz/openbmc_project/state/chassis0',\
member='PropertiesChanged',interface='org.freedesktop.DBus.Properties',\
sender='xyz.openbmc_project.State.Chassis',\
arg0namespace='xyz.openbmc_project.State.Chassis'"
#define OBJECT_MAPPER_SERVICE "xyz.openbmc_project.ObjectMapper"
#define OBJECT_MAPPER_PATH "/xyz/openbmc_project/object_mapper"
#define OBJECT_MAPPER_INTERFACE "xyz.openbmc_project.ObjectMapper"
#define BASEBOARD_PATH "/xyz/openbmc_project/inventory/system/board"
#define MOTHERBOARD_IDENTIFIER \
"xyz.openbmc_project.Inventory.Item.Board.Motherboard"
#define ENTITY_MANAGER_SERVICE "xyz.openbmc_project.EntityManager"
#define ENTITY_MANAGER_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
#define ASD_CONFIG_PATH "xyz.openbmc_project.Configuration.ASD"
#define SD_BUS_ASYNC_TIMEOUT 10000
#define MAX_PLATFORM_PATH_SIZE 120
typedef enum
{
STATE_UNKNOWN = -1,
STATE_OFF = 0,
STATE_ON = 1
} Power_State;
typedef struct Dbus_Handle
{
sd_bus* bus;
int fd;
Power_State power_state;
} Dbus_Handle;
Dbus_Handle* dbus_helper();
STATUS dbus_initialize(Dbus_Handle*);
STATUS dbus_deinitialize(Dbus_Handle*);
STATUS dbus_power_reset(Dbus_Handle*);
STATUS dbus_power_toggle(Dbus_Handle*);
STATUS dbus_power_reboot(Dbus_Handle*);
STATUS dbus_power_on(Dbus_Handle*);
STATUS dbus_power_off(Dbus_Handle*);
int sdbus_callback(sd_bus_message* reply, void* userdata, sd_bus_error* error);
STATUS dbus_process_event(Dbus_Handle* state, ASD_EVENT* event);
STATUS dbus_get_powerstate(Dbus_Handle* state, int* value);
STATUS dbus_get_platform_path(const Dbus_Handle* state, char* path);
STATUS dbus_get_platform_id(const Dbus_Handle* state, uint64_t* pid);
STATUS dbus_read_asd_config(const Dbus_Handle* state, const char* interface,
const char* name, char type, void* var);
STATUS dbus_get_asd_interface_paths(const Dbus_Handle* state,
const char* names[],
char interfaces[][MAX_PLATFORM_PATH_SIZE],
int arr_size);
int match_callback(sd_bus_message* m, void* userdata, sd_bus_error* error);
#endif
| [
"[email protected]"
] | |
41332a1427487c0d7f006464adcb94375fdf3dd3 | 16a76ee66d9b2f59c9beee4a4a0e104ce347e32a | /from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/by_r2dec.c | c5690da3f1c72280d777f442d2c2d6e4cca53176 | [] | no_license | rfalke/decompiler-subjects | 4cee3263fa9116285b4bc4b6373efd2e4efa925f | 7187fa93b285c32325826eecd0128e907a28809b | refs/heads/master | 2023-08-10T08:24:27.198393 | 2023-07-28T19:44:41 | 2023-07-28T19:44:41 | 3,725,678 | 41 | 12 | null | 2023-03-15T16:14:41 | 2012-03-15T06:01:36 | null | UTF-8 | C | false | false | 6,795 | c | /* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400490 */
#include <stdint.h>
void entry0 (int64_t argc, char ** ubp_av, func rtld_fini) {
x0 = rtld_fini;
/* [14] -r-x section size 532 named .text */
x29 = 0x0;
x30 = 0x0;
x5 = x0;
x1 = *(sp);
x2 = sp + 8;
x6 = sp;
x0 = dbg.main;
x3 = sym.__libc_csu_init;
x4 = sym.__libc_csu_fini;
libc_start_main (x0, x1, x2, x3, x4, x5, x6);
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400450 */
#include <stdint.h>
void libc_start_main () {
x16 = 0x411000;
x17 = *(0x411000);
x16 += 0;
return uint64_t (*x17)() ();
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x4004d8 */
#include <stdint.h>
void call_weak_fn () {
x0 = .comment;
if (x0 != 0) {
void (*0x400460)() ();
}
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x4004f0 */
#include <stdint.h>
void deregister_tm_clones () {
x1 = 0x411038;
x0 = 0x411038;
x1 += 7;
x1 -= x0;
if (x1 >= 0xe) {
x1 = .comment;
if (x1 == 0) {
goto label_0;
}
uint64_t (*x1)() ();
}
label_0:
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400530 */
#include <stdint.h>
void register_tm_clones () {
x0 = 0x411038;
x1 -= x0;
x1 >>= 3;
x1 = 0x411038;
x1 >>= 1;
if (x1 != 0) {
x2 = .comment;
if (x2 == 0) {
goto label_0;
}
uint64_t (*x2)() ();
}
label_0:
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400570 */
#include <stdint.h>
void do_global_dtors_aux () {
int64_t var_20h;
int64_t var_20h_2;
int64_t var_10h;
*((sp + -0x20)) = x29;
*((sp + -0x20 + 8)) = x30;
x29 = sp;
*((sp + 0x10)) = x19;
x19 = 0x411000;
w0 = *((x19 + 0x35));
if (w0 == 0) {
deregister_tm_clones ();
w0 = 0x1;
*((x19 + 0x35)) = w0;
}
x19 = *((sp + 0x10));
x29 = *(sp);
x30 = *((sp + 8));
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x4005a0 */
#include <stdint.h>
void entry_init0 () {
int64_t var_10h;
int64_t var_10h_2;
x0 = 0x410df0;
x1 = .comment;
while (x1 == 0) {
void (*0x400530)() ();
x1 = .comment;
}
*((sp + -0x10)) = x29;
*((sp + -0x10 + 8)) = x30;
x29 = sp;
uint64_t (*x1)() ();
x29 = *(sp);
x30 = *((sp + 8));
return void (*0x400530)() ();
}
r2dec has crashed (info: SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x4006a0).
Please report the bug at https://github.com/radareorg/r2dec-js/issues
Use the option '--issue' or the command 'pddi' to generate
the needed data for the issue.
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x4006a4 */
#include <stdint.h>
void fini () {
int64_t var_10h;
int64_t var_10h_2;
/* [15] -r-x section size 16 named .fini */
*((sp + -0x10)) = x29;
*((sp + -0x10 + 8)) = x30;
x29 = sp;
x29 = *(sp);
x30 = *((sp + 8));
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400628 */
#include <stdint.h>
void libc_csu_init (int64_t arg1, int64_t arg2, int64_t arg3) {
int64_t var_40h;
int64_t var_40h_2;
int64_t var_10h;
int64_t var_10h_2;
int64_t var_20h;
int64_t var_20h_2;
int64_t var_30h;
int64_t var_30h_2;
x0 = arg1;
x1 = arg2;
x2 = arg3;
*((sp + -0x40)) = x29;
*((sp + -0x40 + 8)) = x30;
x29 = sp;
*((sp + 0x20)) = x21;
*((sp + 0x20 + 8)) = x22;
*((sp + 0x10)) = x19;
*((sp + 0x10 + 8)) = x20;
x21 = .init_array;
x20 = 0x410de8;
x20 -= x21;
*((sp + 0x30)) = x23;
*((sp + 0x30 + 8)) = x24;
x22 = x2;
w24 = w0;
x23 = x1;
init ();
x20 >>= 3;
if (x20 == 0) {
goto label_0;
}
x19 = 0x0;
do {
offset_0 = x19 << 3;
x3 = *((x21 + offset_0));
x2 = x22;
x1 = x23;
w0 = w24;
x19++;
uint64_t (*x3)(uint32_t, uint64_t, uint64_t, uint64_t) (w0, x1, x2, x3);
} while (x20 != x19);
label_0:
x19 = *((sp + 0x10));
x20 = *((sp + 0x10 + 8));
x21 = *((sp + 0x20));
x22 = *((sp + 0x20 + 8));
x23 = *((sp + 0x30));
x24 = *((sp + 0x30 + 8));
x29 = *(sp);
x30 = *((sp + 8));
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x4005e0 */
#include <stdint.h>
uint64_t dbg_main (int32_t argc) {
int64_t var_10h;
int64_t var_10h_2;
x0 = argc;
/* int main(); */
x8 = 0;
w1 = 0;
x9 = 0x411030;
do {
w10 = *((x9 + x8));
x8++;
w1 = w10 + w1;
} while (x8 != 5);
*((sp + -0x10)) = x29;
*((sp + -0x10 + 8)) = x30;
x29 = sp;
x0 = "Sum is %d\n";
printf (x0);
w0 = 0;
x29 = *(sp);
x30 = *((sp + 8));
return 0x4006b8;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400480 */
#include <stdint.h>
void printf () {
x17 = *(0x411018);
x16 = 0x411018;
return uint64_t (*x17)() ();
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400418 */
#include <stdint.h>
void init () {
int64_t var_10h;
int64_t var_10h_2;
/* [12] -r-x section size 20 named .init */
*((sp + -0x10)) = x29;
*((sp + -0x10 + 8)) = x30;
x29 = sp;
call_weak_fn ();
x29 = *(sp);
x30 = *((sp + 8));
return;
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400470 */
#include <stdint.h>
void abort () {
x17 = *(0x411010);
x16 = 0x411010;
return uint64_t (*x17)() ();
}
/* r2dec pseudo code output */
/* SUBJECTS/from_boomerang/testarray1/arm64_elf_clang_O1_from_rfalke/subject.exe @ 0x400430 */
#include <stdint.h>
void _plt () {
int64_t var_10h;
int64_t var_10h_2;
/* [13] -r-x section size 96 named .plt */
*((sp + -0x10)) = x16;
*((sp + -0x10 + 8)) = x30;
x17 = .comment;
x16 = 0x410ff8;
return uint64_t (*x17)() ();
}
| [
"[email protected]"
] | |
21fe14b63a07d1b320588b757f3ad2a85fffe29c | cc52b1bbbc45714edba67834589844ec11ca8197 | /third_party/silabs/gecko_sdk_suite/v1.0/util/plugin/plugin-common/led-blink-stub/led-blink-stub.c | 57fdea4b0b5fae20bc73ab718e9747e50b9a6e09 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | syin2/openthread | a3d3edbf6a8ef1019f92ca18b508f3bad3bb9237 | a9f42768ec221380f42bfd311bc68e784b2163a6 | refs/heads/master | 2020-05-30T08:36:37.990965 | 2017-06-20T22:50:07 | 2017-06-20T22:50:07 | 94,941,509 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,312 | c | // Copyright 2015 Silicon Laboratories, Inc. *80*
#include PLATFORM_HEADER
#include "stack/include/ember-types.h"
EmberEventControl emberAfPluginLedBlinkLed0EventFunctionEventControl;
EmberEventControl emberAfPluginLedBlinkLed1EventFunctionEventControl;
void emberAfPluginLedBlinkLed0EventFunctionEventHandler(void)
{
}
void emberAfPluginLedBlinkLed1EventFunctionEventHandler(void)
{
}
void halLedBlinkSetActivityLed(uint8_t led)
{
}
void halLedBlinkBlink(uint8_t count, uint16_t blinkTime)
{
}
void halLedBlinkPattern(uint8_t count, uint8_t length, uint16_t *pattern)
{
}
void halLedBlinkLedOff(uint8_t time)
{
}
void halLedBlinkLedOn(uint8_t time)
{
}
void halLedBlinkSleepyClearGpio(uint8_t port, uint8_t pin)
{
}
void halLedBlinkSleepySetGpio(uint8_t port, uint8_t pin)
{
}
void halMultiLedBlinkSetActivityLeds(uint8_t led)
{
}
void halMultiLedBlinkBlink(uint8_t count, uint16_t blinkTimeMs, uint8_t led)
{
}
void halMultiLedBlinkPattern(uint8_t count,
uint8_t length,
uint16_t *pattern,
uint8_t led)
{
}
void halMultiLedBlinkLedOff(uint8_t timeMs, uint8_t led)
{
}
void halMultiLedBlinkLedOn(uint8_t timeMs, uint8_t led)
{
}
void halMultiBlinkSetLedActive(uint8_t led)
{
}
| [
"[email protected]"
] | |
5bb34f54de04b72070dbca1da8d03645a9cee302 | 6a98076e1c468f7d3a45c92306e4e8811ff67403 | /lib/cmds/wiz/targetemote.c | 0587963331eccd03dc1100f7959d8515258fcce6 | [] | no_license | quixadhal/lima | 98954b5e73084ce96c6d3334715df4795ef02e5b | 9d16472877c258cbe7e74edbdf03f3d42695b2ea | refs/heads/master | 2022-02-24T16:56:01.441388 | 2022-02-13T10:46:13 | 2022-02-13T10:46:13 | 3,733,453 | 9 | 6 | null | 2016-02-01T19:20:38 | 2012-03-15T22:16:46 | C | UTF-8 | C | false | false | 862 | c | /* Do not remove the headers from this file! see /USAGE for more info. */
//:COMMAND
//$$ see: feelings, m_messages, addemote, rmemote, showemote, stupidemote
//USAGE: targetemote
//
//This command will create a default emote with the following rules;
// LIV, OBJ, STR, ""
//
//>targetemote swim
//Added.
//
//Lets look at what was created by that command
//>showemote swim
//"LIV" -> $N $vswim at $t.
//"OBJ" -> $N $vswim at $o.
//"STR" -> $N $vswim $o.
//"" -> $N $vswim.
#include <daemons.h>
inherit CMD;
nomask private void main(string str) {
if (!str)
{
out("targetemote verb\n");
return;
}
SOUL_D->add_emote(str, "", "$N $v"+str+".", 0);
SOUL_D->add_emote(str, "STR", "$N $v"+str+" $o.", 0);
SOUL_D->add_emote(str, "OBJ", "$N $v"+str+" at $o.", 0);
SOUL_D->add_emote(str, "LIV", "$N $v"+str+" at $t.", 0);
out("Added.\n");
}
| [
"[email protected]"
] | |
1c212d184a70b059b01f1392206a2d68ba821b54 | 79b6f2e09c0dd5ddaf4c42afb1b2e76823f5fc65 | /srcs/op.c | 18d9d180979a2820fb0203a9c5f4491fff3e4fd7 | [] | no_license | frouinc/ft_ssl_md5 | 4bc81e0f3661668d289efb970f291110b258195c | b016a520dc438c2ef0a75f1d8d705b484a768264 | refs/heads/master | 2020-09-30T18:20:37.438685 | 2020-09-01T09:43:20 | 2020-09-01T09:43:20 | 227,346,360 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,795 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* op.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cfrouin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/11 14:44:13 by cfrouin #+# #+# */
/* Updated: 2020/06/18 14:44:18 by cfrouin ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ssl.h"
void call_operation_string(t_data *data, unsigned char *str)
{
if (data->c_op != NULL)
{
if (data->quiet)
{
data->c_op->operation(str);
ft_printf("\n");
}
else if (data->reverse)
{
data->c_op->operation(str);
ft_printf(" \"%s\"\n", str);
}
else
{
ft_printf("%s (\"%s\") = ", ft_strtoupper(data->c_op->name), str);
data->c_op->operation(str);
ft_printf("\n");
}
data->displayed = 1;
}
}
void call_operation_file(t_data *data, char *filename,
unsigned char *str)
{
if (data->c_op != NULL)
{
if (data->quiet)
{
data->c_op->operation(str);
ft_printf("\n");
}
else if (data->reverse)
{
data->c_op->operation(str);
ft_printf(" %s\n", filename);
}
else
{
ft_printf("%s (%s) = ", ft_strtoupper(data->c_op->name), filename);
data->c_op->operation(str);
ft_printf("\n");
}
data->displayed = 1;
}
}
| [
"[email protected]"
] | |
2e1e352e8f8f2b7dbb8fec25ebfeb2efd07f328e | fbdb3e4df3925b330739e599d7f539a5aea4f163 | /data/room/qiua/qianting.c | 04256a076d05464a0192d6d8d25d4639e1ac4e49 | [] | no_license | MudRen/ZHLib | 2be4566998800d1a8ed50bf379d0e43a7c97e8ac | 73111626fed37f302ca433dd1628730ca07e7dc2 | refs/heads/master | 2020-04-04T15:43:26.136616 | 2018-11-04T04:42:20 | 2018-11-04T04:42:20 | 156,049,634 | 2 | 3 | null | null | null | null | GB18030 | C | false | false | 6,070 | c | // File(/data/room/qiua/qianting.c) of qiua's room
// Create by LUBAN written by Doing Lu
inherit PRIVATE_ROOM;
void create()
{
object ob;
set("short", "密实前庭");
set ("long", @LONG
这里似乎非常安静,听不到什么声响,到是时不时听见鸟儿唧唧
喳喳的叫。院中不少树木已然有遮天之势,肃穆非常。
LONG );
set("exits", ([
"south" : __DIR__"dayuan",
"east" : __DIR__"zuowei",
"west" : __DIR__"youwei",
]));
set("objects", ([
"/d/room/roomnpc/laopu" : 1,
]));
set("outdoors", "quanzhou");
set("no_sleep_room", 1);
set("gate", "close");
setup();
ob = present("saodi laopu", this_object());
ob->set("coagents", ({
([ "startroom" : __DIR__"zuowei",
"id" : "shou wei 2" ]),
([ "startroom" : __DIR__"zuowei",
"id" : "shou wei 1" ]),
([ "startroom" : __DIR__"youwei",
"id" : "shou wei 2" ]),
([ "startroom" : __DIR__"youwei",
"id" : "shou wei 1" ]),
}));
set("room_owner", "净一");
set("room_name", "密实");
set("room_id", "qiua");
set("room_owner_id", "qiua");
set("room_position", "山路");
}
void init()
{
add_action("do_push", "push");
add_action("do_close", "close");
}
int do_push()
{
object ob;
object me;
object room;
if (query("gate") == "open")
return notify_fail("大门开着呢,你还推什么?\n");
me = this_player();
ob = present("saodi laopu", this_object());
if (me && (! ob || ! living(ob) || ob->is_owner_permit(me)))
{
message_vision("$N用力一推大门,就听见大门“吱呀呀”的开了。\n",
me);
} else
if (me && ! ob->is_owner(me))
{
message_vision("$N伸手拦住$n,客客气气道:“对不起,这位" +
RANK_D->query_respect(me) + "还是请回"
"吧!”\n", ob, me);
return 1;
} else
if (ob && living(ob))
{
message_vision("$n连忙跑上前来,对$N道:“主人何必亲"
"劳,我来吧!”\n$n走上前去,用力将大门“吱呀"
"呀”的推开了。\n", me, ob);
} else
{
message("vision", "大门“吱呀呀”的被人打开了。\n",
this_object());
}
room = get_object(__DIR__"zoudao");
message("vision", "大门“吱呀呀”的被人推开了。\n", room);
set("gate", "open");
set("exits/north", __DIR__"zoudao");
room->set("exits/south", __FILE__);
room->set("gate", "open");
remove_call_out("do_close");
call_out("do_close", 10, 0, 1);
return 1;
}
int do_close(string arg, int n)
{
object ob;
object me;
object room;
if (query("gate") == "close")
return notify_fail("大门关着呢,你还再关一遍?\n");
me = this_player();
ob = present("saodi laopu", this_object());
if (! n && me && (! ob || ! living(ob)))
{
message_vision("$N用力一拉大门,就听见大门“吱呀呀”的关上了。\n",
me);
} else
if (! n && me && ! ob->is_owner(me))
{
message_vision("$N走上前去,用力合上大门。\n", me);
} else
if (! n && me && ob->is_owner(me))
{
message_vision("$n连忙跑上前来,对$N道:“主人何必"
"亲劳,我来吧!”\n$n走上前去,用力合上大门。\n",
me, ob);
} else
if (ob && living(ob))
{
message("vision", ob->name() + "走上前去,用力合上大门。\n",
this_object());
} else
{
message("vision", "大门“吱呀呀”的被人关上了。\n",
this_object());
}
room = get_object(__DIR__"zoudao");
message("vision", "大门“吱呀呀”的被人关上了。\n", room);
set("gate", "close");
delete("exits/north");
room->delete("exits/south");
room->set("gate", "close");
return 1;
}
string long()
{
string msg;
msg = " ";
if (present("lao jiaren"))
msg += "一老家人慢慢的挥舞着扫把,打扫着落叶。";
if (query("gate") != "open")
msg += "向北望去,有一扇大门紧紧的关闭着。";
else
msg += "大门畅开,远远望去,隐然可见迎客厅。";
return query("long") + sort_string(msg, 60, 0);
}
int valid_leave(object me, string dir)
{
object ob;
ob = present("saodi laopu", this_object());
if (dir != "north" || ! objectp(ob) || ! living(ob))
return ::valid_leave(me, dir);
if (ob->is_owner(me))
{
message_vision("$N弯腰对$n道:“请进!”\n", ob, me);
return ::valid_leave(me, dir);
}
if (ob->is_owner_permit(me))
{
message_vision("$N对$n道:“即然是主人的朋友,但进无妨。”\n",
ob, me);
return ::valid_leave(me, dir);
}
message_vision("$N伸手拦住$n,道:“非请莫入!”\n", ob, me);
return 0;
}
| [
"[email protected]"
] | |
88ca86e08ce9d8aaf3079006c58008c26a53d8d4 | 24c85532f40d1ea818b7c801fdf6fb28e9ec5cc9 | /BootMultiplier/isim/tb_booth_isim_translate.exe.sim/simprim/a_4181367278_3380326129.c | 5e5e125fa5788e6e0ef5ff95aa05efc34fc639fe | [] | no_license | savmil/TesinaASE | 88208de33c3a87748be95c731d05820c7af9c774 | c55ccb5fcf6cab22de75df69cff6581738b6d3e6 | refs/heads/master | 2021-03-27T15:13:40.841425 | 2018-01-31T20:08:21 | 2018-01-31T20:08:21 | 106,742,160 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,711 | c | /**********************************************************************/
/* ____ ____ */
/* / /\/ / */
/* /___/ \ / */
/* \ \ \/ */
/* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */
/* / / All Right Reserved. */
/* /---/ /\ */
/* \ \ / \ */
/* \___\/\___\ */
/***********************************************************************/
/* This file is designed for use with ISim build 0x2f00eba5 */
#define XSI_HIDE_SYMBOL_SPEC true
#include "xsi.h"
#include <memory.h>
#ifdef __GNUC__
#include <stdlib.h>
#else
#include <malloc.h>
#define alloca _alloca
#endif
static void simprim_a_4181367278_3380326129_p_0(char *t0)
{
char *t1;
char *t2;
char *t3;
int64 t4;
int64 t5;
unsigned char t6;
char *t7;
char *t8;
char *t9;
char *t10;
char *t11;
char *t12;
char *t13;
char *t14;
char *t15;
LAB0: t1 = (t0 + 1488U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: t2 = (t0 + 764U);
t3 = *((char **)t2);
t4 = *((int64 *)t3);
t5 = (0 * 1000LL);
t6 = (t4 <= t5);
if (t6 != 0)
goto LAB4;
LAB6: t2 = (t0 + 1720);
t3 = (t2 + 32U);
t7 = *((char **)t3);
t8 = (t7 + 40U);
t9 = *((char **)t8);
*((unsigned char *)t9) = (unsigned char)3;
xsi_driver_first_trans_delta(t2, 0U, 1, 0LL);
t10 = (t0 + 764U);
t11 = *((char **)t10);
t4 = *((int64 *)t11);
t10 = (t0 + 1720);
t12 = (t10 + 32U);
t13 = *((char **)t12);
t14 = (t13 + 40U);
t15 = *((char **)t14);
*((unsigned char *)t15) = (unsigned char)2;
xsi_driver_subsequent_trans_delta(t10, 0U, 1, t4);
LAB5:
LAB11: *((char **)t1) = &&LAB12;
LAB1: return;
LAB4: if ((unsigned char)0 == 0)
goto LAB7;
LAB8: goto LAB5;
LAB7: t2 = (t0 + 2988);
xsi_report(t2, 58U, (unsigned char)3);
goto LAB8;
LAB9: goto LAB2;
LAB10: goto LAB9;
LAB12: goto LAB10;
}
extern void simprim_a_4181367278_3380326129_0433961640_init()
{
static char *pe[] = {(void *)simprim_a_4181367278_3380326129_p_0};
xsi_register_didat("simprim_a_4181367278_3380326129_0433961640", "isim/tb_booth_isim_translate.exe.sim/simprim/a_4181367278_3380326129_0433961640.didat");
xsi_register_executes(pe);
}
| [
"[email protected]"
] | |
b5a7c46164c280e7a0d91138ac18c9882c45f13e | 10677b2c4809a5dc229a24d8ba15eaa749c2e26f | /libft/src/ft_striteri.c | 2a1e37a6fb356b19a043243a9a37176920ee895b | [] | no_license | lleooell/N-Puzzle | cb146d74990b441e67b4a7517fb5a7afb011d682 | 1770854461a063584ed65ffc8f6d63d5987f8229 | refs/heads/master | 2021-01-20T18:28:15.655004 | 2016-07-08T06:04:47 | 2016-07-08T06:04:47 | 62,863,027 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,054 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rpuccine <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/07 02:21:42 by rpuccine #+# #+# */
/* Updated: 2014/11/10 20:25:13 by rpuccine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_striteri(char *s, void (*f)(unsigned int, char *))
{
unsigned int i;
i = 0;
if (!s || !f)
return ;
while (*s)
f(i++, s++);
}
| [
"[email protected]"
] | |
1766aa405786b052052760703bfc8b8e99a58def | 0868498b01497d9298fcdbd5df221160e766eced | /AnalysisSummaryPlots/GetEwSweightsPlotsPi0K0.C | 91f269fe13599e45c5a1ca7f494fe4783da75c4a | [] | no_license | louiseclark/g8K0Sig | 8daa94813801eb9aeedb6a3cd4defa8ac6328453 | f0de0179d4e38144346a6ccef46b06c140269c03 | refs/heads/master | 2021-06-21T00:45:44.811042 | 2020-12-15T11:00:41 | 2020-12-15T11:00:41 | 149,764,000 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,265 | c | #include <dirent.h>
#include <string>
void GetEwSweightsPlotsPi0K0() {
std::string path = "/home/louise/g8K0Sig/code/sWeights4/out_all_pi0K0_binned/";
auto topDir = opendir(path.c_str());
struct dirent *binDir;
TString outdir = "/home/louise/g8K0Sig/AnalysisSummary/html/images/EwsWeights/";
gStyle->SetOptStat(0);
// read the bin directories
while (binDir=readdir(topDir)) {
// does the directory listing start costh
std::string dirStr2 = binDir->d_name;
if (dirStr2.substr(0, 5) == "costh") {
std::string fileName = path + dirStr2 + "/ResultsHSMinuit2.root";
TFile* infile = TFile::Open(fileName.c_str());
std::string histName = dirStr2+"_M_pip_pim";
TH1F* h = (TH1F*)infile->Get(histName.c_str());
h->Draw();
gPad->Update();
TCanvas* c1 = (TCanvas*) gPad->GetListOfPrimitives()->First();
std::string textName = dirStr2+"TotalPDF_paramBox";
TPaveText *st = (TPaveText*) c1->GetPrimitive(textName.c_str());
st->Delete();
TPaveText* tit = (TPaveText*) c1->GetPrimitive("title");
tit->InsertText(dirStr2.c_str());
gPad->Modified();
gPad->Update();
gPad->Draw();
TString outFilename = outdir+dirStr2+"K0.png";
h->SaveAs(outFilename);
}
}
closedir(topDir);
}
| [
"[email protected]"
] | |
4caf2d40631757a71480a6117227d65f29b14cde | 73169dc21451883cb74f1bc313d4bf58636bffa7 | /include/Field.h | 2a8e7d2c0361801132bca64901ed5bef065c9106 | [
"BSD-3-Clause"
] | permissive | bmunoz07/gamer | 240f2b8252ad5fa822dbbe5b89904aca2bd6ac4f | e0fc0d7c9450c38035bba42e9e29caefe567500d | refs/heads/master | 2023-08-23T00:22:56.879148 | 2021-10-20T07:02:25 | 2021-10-20T07:02:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,689 | h | #ifndef __FIELD_H__
#define __FIELD_H__
#include "Macro.h"
#include "Typedef.h"
const FieldIdx_t Idx_Undefined = -1; // must be outside the range [0, NCOMP_TOTAL-1]
// ***********************************************************
// ** Add new field indices below with the format: **
// ** **
// ** SET_GLOBAL( FieldIdx_t Idx_NewField, Idx_Undefined ); **
// ** **
// ***********************************************************
#if ( MODEL == HYDRO )
// main fields
SET_GLOBAL( FieldIdx_t Idx_Dens, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_MomX, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_MomY, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_MomZ, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_Engy, Idx_Undefined );
#ifdef COSMIC_RAY
SET_GLOBAL( FieldIdx_t Idx_CRay, Idx_Undefined );
#endif
#if ( DUAL_ENERGY == DE_ENPY )
SET_GLOBAL( FieldIdx_t Idx_Enpy, Idx_Undefined );
#elif ( DUAL_ENERGY == DE_EINT )
SET_GLOBAL( FieldIdx_t Idx_Eint, Idx_Undefined );
#endif
// Grackle fields
SET_GLOBAL( FieldIdx_t Idx_e, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HI, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HII, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HeI, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HeII, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HeIII, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HM, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_H2I, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_H2II, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_DI, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_DII, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_HDI, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_Metal, Idx_Undefined );
#elif ( MODEL == ELBDM )
#else
# error : ERROR : unsupported MODEL !!
#endif // MODEL
// ***************************************************************
// ** Add new particle attribute indices below with the format: **
// ** **
// ** SET_GLOBAL( FieldIdx_t Idx_NewAttribute, Idx_Undefined ); **
// ** **
// ***************************************************************
#ifdef PARTICLE
SET_GLOBAL( FieldIdx_t Idx_ParMass, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParPosX, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParPosY, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParPosZ, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParVelX, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParVelY, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParVelZ, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParTime, Idx_Undefined );
#ifdef STORE_PAR_ACC
SET_GLOBAL( FieldIdx_t Idx_ParAccX, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParAccY, Idx_Undefined );
SET_GLOBAL( FieldIdx_t Idx_ParAccZ, Idx_Undefined );
#endif
#ifdef STAR_FORMATION
SET_GLOBAL( FieldIdx_t Idx_ParCreTime, Idx_Undefined );
#endif
SET_GLOBAL( FieldIdx_t Idx_ParMetalFrac, Idx_Undefined );
#endif // #ifdef PARTICLE
// field and particle attribute labels
SET_GLOBAL( char FieldLabel[NCOMP_TOTAL][MAX_STRING] );
#ifdef GRAVITY
SET_GLOBAL( const char *PotLabel, "Pote" ); // potential label is currently fixed
#endif
#ifdef MHD
SET_GLOBAL( char *MagLabel[NCOMP_MAG] );
#endif
#ifdef PARTICLE
SET_GLOBAL( char ParAttLabel[PAR_NATT_TOTAL][MAX_STRING] );
#endif
#endif // #ifndef __FIELD_H__
| [
"[email protected]"
] | |
dd50ab484becbe8a4f8d2350d1a3f4ae7788384a | bec0b0a471f5dc346f1ecb80bbd44597b12ab4d5 | /src/memory/dynapool.c | 49cc59f97d669834a7f38167410167c1f84598cb | [] | no_license | ifplusor/alib | de2331540f68f7e783b068ebf625d6f8607c8468 | ce452393f90647f6f59c18fe3a51d38ec5110d77 | refs/heads/master | 2023-01-01T21:10:26.732474 | 2020-10-28T09:03:14 | 2020-10-28T09:03:14 | 107,664,355 | 2 | 2 | null | null | null | null | UTF-8 | C | false | false | 2,646 | c | /**
* dynapool.c
*
* @author James Yin <[email protected]>
*/
#include "alib/memory/dynapool.h"
typedef struct _alib_dynapool_free_node_ {
deque_node_s header;
} dynapool_free_node_s, *dynapool_free_node_t;
dynapool_t dynapool_construct(size_t node_size) {
if (node_size == 0) {
return NULL;
}
// adjust size for store linked meta
node_size = node_size < sizeof(dynapool_free_node_s) ? sizeof(dynapool_free_node_s) : node_size;
node_size = ROUND_UP_8(node_size); // 8 byte aligned
// alloc some node
dynapool_t self = amalloc(sizeof(dynapool_s) + node_size * DYNAPOOL_INIT_SIZE);
if (self == NULL) {
return NULL;
}
self->_node_pool[0] = self->buf;
for (size_t i = 1; i < DYNAPOOL_REGION_SIZE; i++) {
self->_node_pool[i] = NULL;
}
self->node_size = node_size;
self->alloc_size = DYNAPOOL_INIT_SIZE;
dynapool_reset(self);
return self;
}
bool dynapool_destruct(dynapool_t self) {
if (self != NULL) {
for (size_t i = 1; i < DYNAPOOL_REGION_SIZE; i++) {
afree(self->_node_pool[i]);
}
afree(self);
}
return true;
}
void* dynapool_alloc_node(dynapool_t self) {
deque_node_t deque = &self->_free_list;
if (deque_empty(deque)) {
if (self->alloc_cur >= DYNAPOOL_REGION_SIZE) {
ALOG_FATAL("overflow in dynapool!");
}
size_t new_size = self->alloc_size << (self->alloc_cur - 1);
// extend memory
if (self->_node_pool[self->alloc_cur] == NULL) {
// alloc memory to double
self->_node_pool[self->alloc_cur] = amalloc(self->node_size * new_size);
if (self->_node_pool[self->alloc_cur] == NULL) {
return NULL;
}
}
// init memory
char* pool = self->_node_pool[self->alloc_cur];
for (size_t j = 0; j < new_size; j++) {
void* node = pool + self->node_size * j;
deque_push_back(deque, node, dynapool_free_node_s, header);
}
self->alloc_cur++;
}
return deque_pop_front(deque, dynapool_free_node_s, header);
}
bool dynapool_free_node(dynapool_t self, void* node) {
if (self == NULL || node == NULL) {
return false;
}
deque_push_front(&self->_free_list, node, dynapool_free_node_s, header);
return true;
}
// reset nodepool state, but not free memory
bool dynapool_reset(dynapool_t self) {
if (self == NULL) {
return false;
}
deque_node_t deque = &self->_free_list;
deque_init(deque);
// for init memory
char* pool = self->_node_pool[0];
for (size_t j = 0; j < DYNAPOOL_INIT_SIZE; j++) {
void* node = pool + self->node_size * j;
deque_push_back(deque, node, dynapool_free_node_s, header);
}
self->alloc_cur = 1;
return true;
}
| [
"[email protected]"
] | |
b0067213a977f5985c0ff354917c35b3c88905ec | e3fb700c683d97b466f6d592f744f06ecb7360b6 | /init-a/init-a.c | 03c7dfaaf03dae52c3be83fffd2419067f2c5dc2 | [] | no_license | bobchin/c_jissen_programming | ff0f8daf83c19d5034e5e4770aa917d24bf4f48e | 36c209efbff9de46805aa49216000df5c3e48e02 | refs/heads/master | 2016-09-10T19:56:03.998549 | 2015-09-17T04:38:45 | 2015-09-17T04:38:45 | 42,232,623 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 915 | c | #define MAX 10
/*
* init_array_1 -- 配列の要素をすべて0にする
*
* パラメータ
* data -- 0にする配列
*/
void init_array_1(int data[])
{
int index;
for (index = 0; index < MAX; index++) {
data[index] = 0;
}
}
/*
* init_array_2 -- 配列の要素をすべて0にする
*
* パラメータ
* data_ptr -- 0にする配列を指すポインタ
*/
void init_array_2(int *data_ptr)
{
int index;
for (index = 0; index < MAX; index++) {
*(data_ptr + index) = 0;
}
}
int main()
{
int array[MAX];
void init_array_1();
void init_array_2();
/* 配列を初期化する1つの方法 */
init_array_1(array);
/* 配列を初期化する別の方法 */
init_array_1(&array[0]);
/* 動作するがコンパイラは警告を発する */
init_array_1(&array);
/* 1番目と同じだが、関数が異なる */
init_array_2(array);
return (0);
}
| [
"[email protected]"
] | |
0b127259a4e47c2a849598577a38bb1a1fbbff92 | ce99bd11ca505967277f4689c621479c1987698e | /src/random.h | 104b790d74801d36fe79e827432cdceaac4443f4 | [] | no_license | n64decomp/007 | 5951258890f15431f273e1503674c5e0402c66e0 | c46751089ddc18b12ef7a45b6a3e03de2054c422 | refs/heads/master | 2022-11-08T23:34:54.021033 | 2022-10-29T14:41:01 | 2022-10-29T14:41:01 | 241,212,109 | 359 | 48 | null | 2020-11-21T23:30:31 | 2020-02-17T21:31:00 | C | UTF-8 | C | false | false | 163 | h | #ifndef _RANDOM_H_
#define _RANDOM_H_
#include <ultra64.h>
void randomSetSeed(u32 param_1);
u32 randomGetNext(void);
u32 randomGetNextFrom(u64 *param_1);
#endif
| [
"[email protected]"
] | |
6bd3379983f1fe6f66b55c5b7386cf780d913269 | e700fb5fb51f97e32b89bfa8388fec35f16b0db6 | /product/clark/scp_ramfw/config_timer.c | cd4466426d14c2c219e3d697d39a0edf4ad22cb4 | [
"BSD-3-Clause"
] | permissive | zhengwang721/SCP-firmware | 49a59434d209a45e9647a3873e0d8362545b5c6b | d8db48e9d3a03cbb256bbf13c0d0a7abc249830a | refs/heads/master | 2020-04-25T21:01:58.272528 | 2019-02-22T08:15:41 | 2019-02-26T17:45:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,690 | c | /*
* Arm SCP/MCP Software
* Copyright (c) 2017-2019, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <fwk_id.h>
#include <fwk_module.h>
#include <fwk_module_idx.h>
#include <mod_gtimer.h>
#include <mod_timer.h>
#include <scp_clark_irq.h>
#include <scp_clark_mmap.h>
#include <system_clock.h>
#include <config_clock.h>
/*
* Generic timer driver config
*/
static const struct fwk_element gtimer_dev_table[] = {
[0] = {
.name = "REFCLK",
.data = &((struct mod_gtimer_dev_config) {
.hw_timer = SCP_REFCLK_CNTBASE0_BASE,
.hw_counter = SCP_REFCLK_CNTCTL_BASE,
.control = SCP_REFCLK_CNTCONTROL_BASE,
.frequency = CLOCK_RATE_REFCLK,
.clock_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_CLOCK,
CLOCK_IDX_INTERCONNECT)
})
},
[1] = { 0 },
};
static const struct fwk_element *gtimer_get_dev_table(fwk_id_t module_id)
{
return gtimer_dev_table;
}
const struct fwk_module_config config_gtimer = {
.get_element_table = gtimer_get_dev_table,
};
/*
* Timer HAL config
*/
static const struct fwk_element timer_dev_table[] = {
[0] = {
.name = "REFCLK",
.data = &((struct mod_timer_dev_config) {
.id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_GTIMER, 0),
.timer_irq = TIMREFCLK_IRQ,
}),
.sub_element_count = 8, /* Number of alarms */
},
[1] = { 0 },
};
static const struct fwk_element *timer_get_dev_table(fwk_id_t module_id)
{
return timer_dev_table;
}
const struct fwk_module_config config_timer = {
.get_element_table = timer_get_dev_table,
};
| [
"[email protected]"
] | |
3bcbdba727352545d533beb021dc21e77b3ef5f8 | 6b9fbb31a46a20e1768c2c5a29554356ef10b349 | /chapter_16/xattr_view.c | f0cb42eeb82fc1fbd004302995e44a207b2ef21d | [] | no_license | wejczhu/Interface | 9e02cfee35f1b6065024bd46322b9fc30314da7f | 63752ea98f1858ff4fdd838a9d304d29cf1c8630 | refs/heads/master | 2023-07-28T11:32:48.947713 | 2021-09-14T11:56:34 | 2021-09-14T11:56:34 | 350,745,377 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,541 | c | #include <sys/xattr.h>
#include "tlpi_hdr.h"
#define XATTR_SIZE 10000
static void usageError(char* progName)
{
fprintf(stderr, "Usage: %s [-x] file...\n", progName);
exit(EXIT_FAILURE);
}
int main(int argc, char* argv[])
{
char list[XATTR_SIZE], value[XATTR_SIZE];
ssize_t listLen, valueLen;
int ns, j, k, opt;
boolean hexDisplay;
hexDisplay = 0;
while((opt = geopt(argc, argc, "x")) != -1)
{
switch (opt)
{
case 'x': hexDisplay = 1;
break;
case '?': usageError(argv[0]);
break;
}
}
if(optind >= argc + 2)
{
usageError(argv[0]);
}
for (j = optind; j < argc; j++)
{
listLen = listxattr(argv[j], list, XATTR_SIZE);
if (listLen == -1)
{
errExit("listxattr");
}
printf("%s:\n", argv[j]);
for (ns = 0; ns < listLen; ns += strlen(&list[ns] + 1))
{
printf("name=%s;", &list[ns], value, XATTR_SIZE);
if (valueLen == -1)
{
printf("couldn't get value");
}
else if( !hexDisplay)
{
printf("value=%.*s", (int) valueLen, value);
}
else
{
printf("value=");
for(k = 0; k < valueLen; k++)
{
printf("%02x", (unsigned int) value[k]);
}
}
printf("\n");
}
}
exit(EXIT_SUCCESS);
}
| [
"[email protected]"
] | |
b0a88699ae561677a3da29b1a6a7a0c1a9528f31 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/6a3e0ec9-4038-4ebb-b8ab-03c350e236c8.c | 024b8c79bac3dcbdbb9f206bd271906017e9c7a7 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 546 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
l = 53;
l = 64;
k = i/j;
l = i/j;
l = l/j;
l = i%j;
l = l%j;
k = k-k*i;
//variables
/* START VULNERABILITY */
int a;
long b[47];
long c[30];
a = 0;
while (a > -1) {
/* START BUFFER SET */
*((long *)c + a) = *((long *)b + a);
/* END BUFFER SET */
a--;
}
/* END VULNERABILITY */
//random
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
8459ca9b2e836c125ac0c771c05d7f5d16f02bfc | 948f4e13af6b3014582909cc6d762606f2a43365 | /testcases/juliet_test_suite/testcases/CWE90_LDAP_Injection/CWE90_LDAP_Injection__w32_char_listen_socket_65b.c | e66e2ec495245a80fdb9316faaedac3c409e0e3c | [] | no_license | junxzm1990/ASAN-- | 0056a341b8537142e10373c8417f27d7825ad89b | ca96e46422407a55bed4aa551a6ad28ec1eeef4e | refs/heads/master | 2022-08-02T15:38:56.286555 | 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 | 5,080 | c | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE90_LDAP_Injection__w32_char_listen_socket_65b.c
Label Definition File: CWE90_LDAP_Injection__w32.label.xml
Template File: sources-sink-65b.tmpl.c
*/
/*
* @description
* CWE: 90 LDAP Injection
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Use a fixed string
* Sinks:
* BadSink : data concatenated into LDAP search, which could result in LDAP Injection
* Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
*
* */
#include "std_testcase.h"
#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>
#include <unistd.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 <Winldap.h>
#pragma comment(lib, "wldap32")
#ifndef OMITBAD
void CWE90_LDAP_Injection__w32_char_listen_socket_65b_badSink(char * data)
{
{
LDAP* pLdapConnection = NULL;
ULONG connectSuccess = 0L;
ULONG searchSuccess = 0L;
LDAPMessage *pMessage = NULL;
char filter[256];
/* POTENTIAL FLAW: data concatenated into LDAP search, which could result in LDAP Injection*/
_snprintf(filter, 256-1, "(cn=%s)", data);
pLdapConnection = ldap_initA("localhost", LDAP_PORT);
if (pLdapConnection == NULL)
{
printLine("Initialization failed");
exit(1);
}
connectSuccess = ldap_connect(pLdapConnection, NULL);
if (connectSuccess != LDAP_SUCCESS)
{
printLine("Connection failed");
exit(1);
}
searchSuccess = ldap_search_ext_sA(
pLdapConnection,
"base",
LDAP_SCOPE_SUBTREE,
filter,
NULL,
0,
NULL,
NULL,
LDAP_NO_LIMIT,
LDAP_NO_LIMIT,
&pMessage);
if (searchSuccess != LDAP_SUCCESS)
{
printLine("Search failed");
if (pMessage != NULL)
{
ldap_msgfree(pMessage);
}
exit(1);
}
/* Typically you would do something with the search results, but this is a test case and we can ignore them */
/* Free the results to avoid incidentals */
if (pMessage != NULL)
{
ldap_msgfree(pMessage);
}
/* Close the connection */
ldap_unbind(pLdapConnection);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE90_LDAP_Injection__w32_char_listen_socket_65b_goodG2BSink(char * data)
{
{
LDAP* pLdapConnection = NULL;
ULONG connectSuccess = 0L;
ULONG searchSuccess = 0L;
LDAPMessage *pMessage = NULL;
char filter[256];
/* POTENTIAL FLAW: data concatenated into LDAP search, which could result in LDAP Injection*/
_snprintf(filter, 256-1, "(cn=%s)", data);
pLdapConnection = ldap_initA("localhost", LDAP_PORT);
if (pLdapConnection == NULL)
{
printLine("Initialization failed");
exit(1);
}
connectSuccess = ldap_connect(pLdapConnection, NULL);
if (connectSuccess != LDAP_SUCCESS)
{
printLine("Connection failed");
exit(1);
}
searchSuccess = ldap_search_ext_sA(
pLdapConnection,
"base",
LDAP_SCOPE_SUBTREE,
filter,
NULL,
0,
NULL,
NULL,
LDAP_NO_LIMIT,
LDAP_NO_LIMIT,
&pMessage);
if (searchSuccess != LDAP_SUCCESS)
{
printLine("Search failed");
if (pMessage != NULL)
{
ldap_msgfree(pMessage);
}
exit(1);
}
/* Typically you would do something with the search results, but this is a test case and we can ignore them */
/* Free the results to avoid incidentals */
if (pMessage != NULL)
{
ldap_msgfree(pMessage);
}
/* Close the connection */
ldap_unbind(pLdapConnection);
}
}
#endif /* OMITGOOD */
| [
"[email protected]"
] | |
c30db6c392d0830baaa9a2562617eab8a213f630 | 7faa52e84c9449e6f971c4ff7573b4ec550833a8 | /src/expansion/expnd_redirection.c | b0e5239cc391c805762215cd2a3a2e8935cb1196 | [] | no_license | AlessandroMetta/minishell | 90f1bac2f9a7f99c0306320fcc8e77e5005e3647 | c7c237fecce4671b4c7b1c04cf5b7685e0e23c9f | refs/heads/main | 2023-07-17T09:08:35.219337 | 2021-08-31T13:38:06 | 2021-08-31T13:38:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,670 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* expnd_redirection.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: llucente <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/23 16:05:36 by llucente #+# #+# */
/* Updated: 2021/08/31 15:32:17 by llucente ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../headers/minishell.h"
#include "../../headers/execution.h"
void check_word_expnd_redtion(int redirection, char **expndd,
char **word, char **string)
{
if (redirection == 1)
{
if (*expndd != NULL && (*expndd)[0] != '\0')
{
*string = *expndd;
}
else
{
*string = ft_strdup(*word);
}
}
else
{
*string = *expndd;
}
free(*word);
}
void ft_expnd_redtion(t_simple_cmd **cmd, t_env **env, char **last_env)
{
t_redirection *redis;
redis = NULL;
redis = (*cmd)->redirections;
while (redis)
{
redis->inside_quotes = check_exiting_of_quotes(redis->file_name);
if (redis->inside_quotes != 0)
ft_expnd_word(&redis->file_name, env, last_env, 0);
else
ft_expnd_word(&redis->file_name, env, last_env, 1);
redis = redis->next;
}
}
| [
"[email protected]"
] | |
8bfbb93202f99c83afb0e2b6ec6b64c216033202 | 6e665dcd74541d40647ebb64e30aa60bc71e610c | /800/SharedLib/programs/src/selftest/as_cf_card.h | 8c7b7b58e1551f22dcef15fd83a6c14de94ade35 | [] | no_license | jacklee032016/pbx | b27871251a6d49285eaade2d0a9ec02032c3ec62 | 554149c134e50db8ea27de6a092934a51e156eb6 | refs/heads/master | 2020-03-24T21:52:18.653518 | 2018-08-04T20:01:15 | 2018-08-04T20:01:15 | 143,054,776 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 2,681 | h |
#define __u32 unsigned int
#define __u16 unsigned short int
#define __u8 unsigned char
typedef struct {
/*00*/ __u32 s_inodes_count; /* inodes 计数 */
__u32 s_blocks_count; /* blocks 计数 */
__u32 s_r_blocks_count; /* 保留的 blocks 计数 */
__u32 s_free_blocks_count; /* 空闲的 blocks 计数 */
/*10*/ __u32 s_free_inodes_count; /* 空闲的 inodes 计数 */
__u32 s_first_data_block; /* 第一个数据 block */
__u32 s_log_block_size; /* block 的大小 */
__u32 s_log_frag_size; /* 可以忽略 */
/*20*/ __u32 s_blocks_per_group; /* 每 block group 的 block 数量 */
__u32 s_frags_per_group; /* 可以忽略 */
__u32 s_inodes_per_group; /* 每 block group 的 inode 数量 */
__u32 s_mtime; /* Mount time */
/*30*/ __u32 s_wtime; /* Write time */
__u16 s_mnt_count; /* Mount count */
__u16 s_max_mnt_count; /* Maximal mount count */
__u16 s_magic; /* Magic 签名 */
__u16 s_state; /* File system state */
__u16 s_errors; /* Behaviour when detecting errors */
__u16 s_minor_rev_level; /* minor revision level */
/*40*/ __u32 s_lastcheck; /* time of last check */
__u32 s_checkinterval; /* max. time between checks */
__u32 s_creator_os; /* 可以忽略 */
__u32 s_rev_level; /* Revision level */
/*50*/ __u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
__u32 s_first_ino; /* First non-reserved inode */
__u16 s_inode_size; /* size of inode structure */
__u16 s_block_group_nr; /* block group # of this superblock */
__u32 s_feature_compat; /* compatible feature set */
/*60*/ __u32 s_feature_incompat; /* incompatible feature set */
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
/*78*/ char s_volume_name[16]; /* volume name */
/*88*/ char s_last_mounted[64]; /* directory where last mounted */
/*C8*/ __u32 s_algorithm_usage_bitmap; /* 可以忽略 */
__u8 s_prealloc_blocks; /* 可以忽略 */
__u8 s_prealloc_dir_blocks; /* 可以忽略 */
__u16 s_padding1; /* 可以忽略 */
/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
/*E0*/ __u32 s_journal_inum; /* 日志文件的 inode 号数 */
__u32 s_journal_dev; /* 日志文件的设备号 */
__u32 s_last_orphan; /* start of list of inodes to delete */
/*EC*/ __u32 s_reserved[197]; /* 可以忽略 */
}ext3_super_block;
#define __AS_STR_LENTH 256
#define __AS_RCF_LENTH 2048
#define __AS_DIR_NAME "dev"
#define __AS_DIR_CF_CARD "hda1"
#define S_MAIGC_VALU 0xEF53
| [
"[email protected]"
] | |
e7646c869b1f6cab41ea0bb7074166060fc47710 | ab43ed484ff06385b080e0fbdf1f2f7fdd9a1d5f | /src/get_rooms.c | e463df96c3899d436840383108cc7bf9bc27a3b9 | [] | no_license | Ghostyfied/Legendary_lemin | 8dbc87210f8c1070c63d2dcd2b86b3ea63153bf1 | 73c6a69fa1bb1288252755dbd2490d129f0af043 | refs/heads/master | 2020-12-08T22:29:04.556473 | 2020-01-10T19:08:19 | 2020-01-10T19:08:19 | 233,112,966 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,019 | c | /* ************************************************************************** */
/* */
/* :::::::: */
/* get_rooms.c :+: :+: */
/* +:+ */
/* By: tide-jon <[email protected]> +#+ */
/* +#+ */
/* Created: 2019/09/16 19:14:03 by tide-jon #+# #+# */
/* Updated: 2019/09/30 15:12:17 by tide-jon ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../lem_in.h"
static void set_startend(t_lem_in_lst *node, t_lem_in *data)
{
if (data->set_start == 1)
{
node->type = 1;
data->set_start = 0;
}
if (data->set_end == 1)
{
node->type = 2;
data->set_end = 0;
}
}
static void get_node(char *line, t_lem_in *data)
{
t_lem_in_lst *current;
data->nodes++;
if (data->node_lst == NULL)
{
current = (t_lem_in_lst*)malloc(sizeof(t_lem_in_lst));
current->next = NULL;
}
else
{
current = (t_lem_in_lst*)malloc(sizeof(t_lem_in_lst));
current->next = data->node_lst;
}
current->name = ft_get_first_substr(line);
current->type = 0;
set_startend(current, data);
data->node_lst = current;
}
int create_rooms(t_lem_in *data, char *line)
{
if (line[0] == '#')
check_comment(line, data);
else if (ft_validate_format("%s %d %d", line))
{
if (line[0] == 'L')
ft_error("Error: room names can't start with an L");
get_node(line, data);
add_list(line, data);
}
else if (ft_validate_format("%s-%s", line))
return (0);
else
ft_error("Error: something went wrong with "
"the parsing of rooms or links");
free(line);
return (1);
}
| [
"[email protected]"
] | |
510cc977db7f7ec8cdfa8dd148b3e77b82565036 | 9cd006c670ee59f6d5aa397f5a0c0d63d82b9b57 | /0x12-singly_linked_lists/4-free_list.c | 8c0546aad9365ce6207770b9ed7e7c4e1ebe6309 | [] | no_license | danicelistobon/holbertonschool-low_level_programming | e2eedd8809c3a2e1a787ae0cf1d0c62e8e54abde | 4a4145767cfa4381a464264adcd50d34c144daa4 | refs/heads/master | 2020-06-06T15:18:05.017597 | 2020-04-10T00:12:14 | 2020-04-10T00:12:14 | 192,774,542 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 220 | c | #include "lists.h"
/**
* free_list - frees a 'list_t' list
*
* @head: list
*
* Return: no return
*/
void free_list(list_t *head)
{
if (head == NULL)
return;
free_list(head->next);
free(head->str);
free(head);
}
| [
"[email protected]"
] | |
cc78f8bab4bb569ff491f21a775e30aba86ce23e | fe1d61e7b840804107026727693ec9a92bcc90c8 | /samples/fileserver/fs9p.h | 31f9e6d4a392470da53e1ccd83e7c0ed210c2dc0 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-newlib-historical",
"dtoa",
"MIT"
] | permissive | reltham/flexprop | c7fa962c8f9f0c0c391bde92dceec4dd93f7f907 | 942a8f3f37bb94b9f32842ac58a7bf628a934776 | refs/heads/master | 2023-02-19T12:25:09.931929 | 2021-01-15T02:29:59 | 2021-01-15T02:29:59 | 242,596,155 | 0 | 0 | NOASSERTION | 2021-01-15T02:30:00 | 2020-02-23T21:49:47 | Tcl | UTF-8 | C | false | false | 1,558 | h | #ifndef FS9P_H
#define FS9P_H
#include <compiler.h>
#define NOTAG 0xffffU
#define NOFID 0xffffffffU
enum {
t_version = 100,
r_version,
t_auth = 102,
r_auth,
t_attach = 104,
r_attach,
t_error = 106,
r_error,
t_flush = 108,
r_flush,
t_walk = 110,
r_walk,
t_open = 112,
r_open,
t_create = 114,
r_create,
t_read = 116,
r_read,
t_write = 118,
r_write,
t_clunk = 120,
r_clunk,
};
// maximum length we're willing to send/receive from host
// write: 4 + 1 + 2 + 4 + 8 + 4 + 1024 = 1048
#define MAXLEN 1048
// functions for the 9p file system
typedef struct fsfile {
uint32_t offlo;
uint32_t offhi;
} fs_file;
// send/receive function; sends a buffer to the host
// and reads a reply back
typedef int (*sendrecv_func)(uint8_t *startbuf, uint8_t *endbuf, int maxlen);
// initialize
int fs_init(sendrecv_func fn) _IMPL("fs9p.cc");
// walk a file from fid "dir" along path, creating fid "newfile"
int fs_walk(fs_file *dir, fs_file *newfile, const char *path);
// open a file f using path "path" (relative to root directory)
// for reading or writing
int fs_open(fs_file *f, char *path, int fs_mode);
#define FS_MODE_READ 0
#define FS_MODE_WRITE 1
#define FS_MODE_TRUNC 16
// create a new file if necessary, or truncate an existing one
int fs_create(fs_file *f, const char *path);
// close a file
int fs_close(fs_file *f);
// read/write data
int fs_read(fs_file *f, uint8_t *buf, int count);
int fs_write(fs_file *f, const uint8_t *buf, int count);
#endif
| [
"[email protected]"
] | |
1cbbf2df54883b0ba2bfc0e230ccdc497f47ddbf | e4b212bbcbcf63dd67f651c07ee6541ffcdee764 | /fsinside/fs/FileSystem.h | 296d7386f99d761f91da452f27e0e99790c8a909 | [] | no_license | withmelody/SW_Project | 53a093748634d58af2b8aeea6e17a1b016b5df4b | 6135fdfe843e81323a0a653ec3604b525149452f | refs/heads/master | 2021-01-18T20:53:21.789709 | 2015-04-30T13:19:18 | 2015-04-30T13:19:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,168 | h | #ifndef __FILESYSTEM_H__
#define __FILESYSTEM_H__
#include "FilesysConfig.h"
#include "Buf.h"
#define NUM_OF_INODE_IN_1BLK (BLOCK_SIZE / sizeof(InodeInfo))
#define NUM_OF_DIRENT_IN_1BLK (BLOCK_SIZE / sizeof(DirEntry))
#define MAX_INDEX_OF_DIRBLK (NUM_OF_DIRENT_IN_1BLK)
#define NAME_LEN_MAX (60)
#define NUM_OF_INDIRECT_BLOCK (12)
typedef enum __openFlag {
OPEN_FLAG_READWRITE,
/* 파일을 read/write permission으로 open함.
본 과제에서는 이 flag가 입력되었을 때,
리눅스와 달리 open file table 또는
file descriptor table에 셋팅을 하지 않음.
단순히 파일 open을 수행함*/
OPEN_FLAG_CREATE // 파일이 존재하지 않으면 생성 후 파일을 open함
} OpenFlag;
typedef enum __fileType {
FILE_TYPE_FILE,
FILE_TYPE_DIR,
FILE_TYPE_DEV
} FileType;
typedef enum __fileMode {
FILE_MODE_READONLY,
FILE_MODE_READWRITE,
FILE_MODE_EXEC
}FileMode;
typedef struct __dirEntry {
char name[NAME_LEN_MAX/*60byte 혹은 가변적*/];
int inodeNum;
FileType type;
} DirEntry;
typedef enum __mountType {
MT_TYPE_FORMAT, // 마운트가 되는 해당 파티션은 포맷된다.
MT_TYPE_READWRITE, // 마운트가 되는 해당 파티션은 그대로 유지된다.
} MountType;
typedef struct _fileSysInfo {
int blocks; // 파일 시스템의 설정된 블록 크기
int rootInodeNum; // root inode number 저장
int diskCapacity; // 디스크의 용량. 블록 개수로 저장됨
int numAllocBlocks; // 할당된 블록 개수
int numFreeBlocks; // 할당되지 않은 블록 개수
int numInodes; // 전체 inode의 개수
int numAllocInodes; // 할당된 inode의 개수
int numFreeInodes; // 할당되지 않은 inode의 개수
int inodeBitmapStart; // inode bitmap이 저장된 블록의 번호
int blockBitmapStart; // block bitmap이 저장된 블록 번호
int inodeListStart; // inode list를 저장하는 영역의 시작 블록 번호
int dataStart; // data 영역의 시작 블록 번호
char* pInodeBitmap; // inode bitmap 정보가 저장된 메모리 주소
char* pBlockBitmap; // block bitmap 정보가 저장된 메모리 주소
} FileSysInfo;
typedef struct __inodeInfo {
int size;
FileType type;
FileMode mode;
int blocks;
int i_block[NUM_OF_INDIRECT_BLOCK];
}InodeInfo;
typedef struct __dirBlock {
DirEntry dirEntries[NUM_OF_DIRENT_IN_1BLK];
}DirBlock;
typedef struct __fileDesc {
int valid_bit;
int offset;
int inodeNo;
}FileDesc;
typedef struct __fileDescTable {
FileDesc file[FS_INODE_COUNT];
}FileDescTable;
// function appended from assignment3
int OpenFile(const char* pFileName, OpenFlag flag);
int WriteFile(int fileDesc, char* pBuffer, int length);
int ReadFile(int fileDesc, char* pBuffer, int length);
int CloseFile(int fileDesc);
int RemoveFile(const char* pFileName);
int MakeDir(const char* pDirName);
int RemoveDir(const char* pDirName);
int EnumerateDirStatus(const char* pDirName, DirEntry* pDirEntry, int dirEntries);
void Mount(MountType type);
void Unmount(void);
int IncUseInode(); // Inode 1개 사용
int DecUseInode(); // Inode 1개 해제
int IncUseBlock(); // Block 1개 사용
int DecUseBlock(); // Block 1개 해제
int GetFreeEntry(char* Bitmap, int BitmapBlockSize);
int GetFreeInode();
int GetFreeBlock();
void GetEntryPath(char* abspath, char* filename); // 절대경로에서 파일 혹은 디렉토리가 위치한 절대경로를 구함
int GetEntryName(char* dest, char* abspath); // 절대경로에서 파일 혹은 디렉토리의 이름을 무함
int GetFreeDir(DirBlock* dirBlock);
int SetFreeToAlloc(char* Bitmap, int BitmapBlockSize);
int SetInodeFreeToAlloc();
int SetBlockFreeToAlloc();
int SetInodeAllocToFree(int inodeno);
int SetBlockAllocToFree(int blockno);
void ReadInode(InodeInfo* inodeInfo, int inodeNo);
void ReadDirBlock(DirBlock* dirBlock, int blockNo);
void WriteInode(InodeInfo* inodeInfo, int inodeNo);
void WriteDirBlock(DirBlock* dirBlock, int blockNo);
int MakeDirentry(InodeInfo* inodInfo, char* dirname);
int RemoveDirentry(InodeInfo* inodInfo, char* dirname);
int DirIsEmpty(InodeInfo* inodeInfo);
#endif /* FILESYSTEM_H_ */
| [
"[email protected]"
] | |
e063e44bd3ef3da609e954ae46f5401a28df2c25 | 7eaf54a78c9e2117247cb2ab6d3a0c20719ba700 | /SOFTWARE/A64-TERES/u-boot_new/board/freescale/m547xevb/m547xevb.c | 1e3cb6179f4da90be70cecf4ede8477600109bbf | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"GPL-2.0-or-later"
] | permissive | OLIMEX/DIY-LAPTOP | ae82f4ee79c641d9aee444db9a75f3f6709afa92 | a3fafd1309135650bab27f5eafc0c32bc3ca74ee | refs/heads/rel3 | 2023-08-04T01:54:19.483792 | 2023-04-03T07:18:12 | 2023-04-03T07:18:12 | 80,094,055 | 507 | 92 | Apache-2.0 | 2023-04-03T07:05:59 | 2017-01-26T07:25:50 | C | UTF-8 | C | false | false | 2,164 | c | /*
* (C) Copyright 2000-2003
* Wolfgang Denk, DENX Software Engineering, [email protected].
*
* Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
* TsiChung Liew ([email protected])
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <config.h>
#include <common.h>
#include <pci.h>
#include <asm/immap.h>
#include <asm/io.h>
DECLARE_GLOBAL_DATA_PTR;
int checkboard(void)
{
puts("Board: ");
puts("Freescale FireEngine 5475 EVB\n");
return 0;
};
phys_size_t initdram(int board_type)
{
siu_t *siu = (siu_t *) (MMAP_SIU);
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
u32 dramsize, i;
#ifdef CONFIG_SYS_DRAMSZ1
u32 temp;
#endif
out_be32(&siu->drv, CONFIG_SYS_SDRAM_DRVSTRENGTH);
dramsize = CONFIG_SYS_DRAMSZ * 0x100000;
for (i = 0x13; i < 0x20; i++) {
if (dramsize == (1 << i))
break;
}
i--;
out_be32(&siu->cs0cfg, CONFIG_SYS_SDRAM_BASE | i);
#ifdef CONFIG_SYS_DRAMSZ1
temp = CONFIG_SYS_DRAMSZ1 * 0x100000;
for (i = 0x13; i < 0x20; i++) {
if (temp == (1 << i))
break;
}
i--;
dramsize += temp;
out_be32(&siu->cs1cfg, (CONFIG_SYS_SDRAM_BASE + temp) | i);
#endif
out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
/* Issue PALL */
out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
/* Issue LEMR */
out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000);
udelay(500);
/* Issue PALL */
out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
/* Perform two refresh cycles */
out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
out_be32(&sdram->ctrl,
(CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000F00);
udelay(100);
return dramsize;
};
int testdram(void)
{
/* TODO: XXX XXX XXX */
printf("DRAM test not implemented!\n");
return (0);
}
#if defined(CONFIG_PCI)
/*
* Initialize PCI devices, report devices found.
*/
static struct pci_controller hose;
extern void pci_mcf547x_8x_init(struct pci_controller *hose);
void pci_init_board(void)
{
pci_mcf547x_8x_init(&hose);
}
#endif /* CONFIG_PCI */
| [
"[email protected]"
] | |
901ad9471edd39d11e8a366235a006e647d2c04a | e25c8b65c0115053b14f8ecffaea94a964eefa1f | /ds/open/world1/wilfred/sand/room30.c | c07e36137e9f5ba9122dbc6351ee75a637d0d44e | [] | no_license | zwshen/mudos-game-ds | c985b4b64c586bdc7347bd95d97ab12e78a2f20f | 07ea84ebdff5ee49cb482a520bdf1aaeda886cd0 | refs/heads/master | 2022-03-01T14:55:10.537294 | 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 | 393 | c | inherit ROOM;
void create()
{
set ("short", "亂石崗");
set ("long", @LONG
你在沙漠中亂走,結果赫然發現前方不遠處有座小山,好奇心驅
使你前往一探究竟。
LONG
);
set("exits", ([
"west" : __DIR__"room29",
"eastup" : __DIR__"room31",
]));
set("outdoors", "land");
set("no_clean_up", 0);
setup();
replace_program(ROOM);
}
| [
"[email protected]"
] | |
3fe8dbd02c7e9f24cbaf13c7fa9061cbedbfd31d | ed92b38fcb124629c67d93835425a33a717f7177 | /Source/bmalloc/libpas/src/libpas/pas_fast_megapage_table.c | 32f9d7b089d27904dc5e34f1650360641d3ac7a7 | [
"BSD-2-Clause"
] | permissive | nikolaszimmermann/WebKitIgalia | 725ef1f00f9c77bb8762e4b9b46e691419513ebe | 8fc0a5537b76b55cf4f27a9892a6310cf28c7ade | refs/heads/main | 2022-07-31T20:38:37.715991 | 2021-09-11T08:59:37 | 2021-10-18T21:55:59 | 420,998,021 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 8,097 | c | /*
* Copyright (c) 2018-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pas_config.h"
#if LIBPAS_ENABLED
#include "pas_fast_megapage_table.h"
pas_fast_megapage_table_impl pas_fast_megapage_table_impl_null = {
.index_begin = 0,
.index_end = 0,
.last = NULL,
.bits = { 0 }
};
void pas_fast_megapage_table_initialize_static_by_index(pas_fast_megapage_table* table,
size_t index,
uintptr_t begin,
uintptr_t end,
pas_lock_hold_mode heap_lock_hold_mode)
{
size_t size;
size_t num_fields;
pas_heap_lock_lock_conditionally(heap_lock_hold_mode);
PAS_ASSERT(index < PAS_NUM_STATIC_FAST_MEGAPAGE_TABLES);
PAS_ASSERT(table->instances[index] == &pas_fast_megapage_table_impl_null);
num_fields = end - begin + 1; /* Make end inclusive to allow end to straddle a fast_megapage boundary. */
size = PAS_OFFSETOF(pas_fast_megapage_table_impl, bits) +
sizeof(unsigned) * PAS_BITFIELD_VECTOR_NUM_WORDS(num_fields, PAS_FAST_MEGAPAGE_TABLE_NUM_BITS);
size = pas_round_up_to_power_of_2(size, PAS_MIN_ALIGN);
num_fields = PAS_BITFIELD_VECTOR_NUM_FIELDS(
(size - PAS_OFFSETOF(pas_fast_megapage_table_impl, bits)) /
sizeof(unsigned),
PAS_FAST_MEGAPAGE_TABLE_NUM_BITS);
end = begin + num_fields;
table->instances[index] = pas_immortal_heap_allocate(
size, "pas_fast_megapage_table/instances_array", pas_object_allocation);
pas_zero_memory(table->instances[index], size);
table->instances[index]->index_begin = begin;
table->instances[index]->index_end = end;
pas_heap_lock_unlock_conditionally(heap_lock_hold_mode);
}
void pas_fast_megapage_table_initialize_static(pas_fast_megapage_table* table,
size_t index, uintptr_t begin, uintptr_t end,
pas_lock_hold_mode heap_lock_hold_mode)
{
pas_fast_megapage_table_initialize_static_by_index(table,
index,
begin >> PAS_FAST_MEGAPAGE_SHIFT,
end >> PAS_FAST_MEGAPAGE_SHIFT,
heap_lock_hold_mode);
}
void pas_fast_megapage_table_set_by_index(pas_fast_megapage_table* table,
size_t index, unsigned value,
pas_lock_hold_mode heap_lock_hold_mode)
{
pas_fast_megapage_table_impl* instance;
size_t index_begin;
size_t index_end;
size_t table_index;
pas_heap_lock_lock_conditionally(heap_lock_hold_mode);
if (index < PAS_NUM_FAST_FAST_MEGAPAGE_BITS
&& value == pas_small_segregated_fast_megapage_kind) {
pas_bitvector_set(table->fast_bits, index, true);
return;
}
for (table_index = 0; table_index < PAS_NUM_STATIC_FAST_MEGAPAGE_TABLES; ++table_index) {
instance = table->instances[table_index];
index_begin = instance->index_begin;
index_end = instance->index_end;
if (index < index_begin)
continue;
if (index >= index_end)
continue;
pas_bitfield_vector_set(
instance->bits, PAS_FAST_MEGAPAGE_TABLE_NUM_BITS, index - index_begin, value);
pas_heap_lock_unlock_conditionally(heap_lock_hold_mode);
return;
}
PAS_ASSERT(PAS_USE_DYNAMIC_FAST_MEGAPAGE_TABLE);
instance = table->instances[PAS_DYNAMIC_FAST_MEGAPAGE_TABLE_INDEX];
index_begin = instance->index_begin;
index_end = instance->index_end;
if (PAS_UNLIKELY(index < index_begin || index >= index_end)) {
size_t new_index_begin;
size_t new_index_end;
size_t num_fields;
pas_fast_megapage_table_impl* new_instance;
size_t size;
size_t initialization_index;
if (instance == &pas_fast_megapage_table_impl_null) {
new_index_begin = index;
new_index_end = index + 1;
} else if (index < index_begin) {
PAS_ASSERT(index_begin && index_end);
new_index_begin = PAS_MIN(index,
index_begin - (index_end - index_begin));
new_index_end = index_end;
} else {
PAS_ASSERT(index_begin && index_end);
PAS_ASSERT(index >= index_end);
new_index_begin = index_begin;
new_index_end = PAS_MAX(index + 1,
index_end + (index_end - index_begin));
}
PAS_ASSERT(new_index_end > new_index_begin);
/* make sure we allocate a page. */
num_fields = new_index_end - new_index_begin;
size = PAS_OFFSETOF(pas_fast_megapage_table_impl, bits) +
sizeof(unsigned) * PAS_BITFIELD_VECTOR_NUM_WORDS(num_fields,
PAS_FAST_MEGAPAGE_TABLE_NUM_BITS);
size = pas_round_up_to_power_of_2(size, PAS_INTERNAL_MIN_ALIGN);
num_fields = PAS_BITFIELD_VECTOR_NUM_FIELDS(
(size - PAS_OFFSETOF(pas_fast_megapage_table_impl, bits)) /
sizeof(unsigned),
PAS_FAST_MEGAPAGE_TABLE_NUM_BITS);
new_index_end = new_index_begin + num_fields;
PAS_ASSERT(new_index_end > new_index_begin);
new_instance = pas_immortal_heap_allocate(
size, "pas_fast_megapage_table/instance", pas_object_allocation);
pas_zero_memory(new_instance, size);
new_instance->index_begin = new_index_begin;
new_instance->index_end = new_index_end;
new_instance->last = instance;
for (initialization_index = index_begin;
initialization_index < index_end;
++initialization_index) {
pas_bitfield_vector_set(
new_instance->bits,
PAS_FAST_MEGAPAGE_TABLE_NUM_BITS,
initialization_index - new_index_begin,
pas_bitfield_vector_get(
instance->bits,
PAS_FAST_MEGAPAGE_TABLE_NUM_BITS,
initialization_index - index_begin));
}
pas_fence();
instance = new_instance;
index_begin = new_index_begin;
table->instances[PAS_DYNAMIC_FAST_MEGAPAGE_TABLE_INDEX] = instance;
}
pas_bitfield_vector_set(instance->bits,
PAS_FAST_MEGAPAGE_TABLE_NUM_BITS,
index - index_begin, value);
pas_heap_lock_unlock_conditionally(heap_lock_hold_mode);
}
#endif /* LIBPAS_ENABLED */
| [
"[email protected]"
] | |
674ab008b3a6f54c44e538e9fd9902acea273f64 | 36b66123b13b48b83e870ff922a25a6ae861170f | /tiler/osmdb_tile.h | 0aea5af8cc74cc8943afbfce7db86fad3a6009ad | [] | no_license | jeffboody/osmdb | 5b620118e35b17eebcf143ce2f6181012602dfb5 | ac4d2c0e3fb2e033db56db411f370f8675baa784 | refs/heads/master | 2022-12-04T01:37:18.792355 | 2022-11-17T22:40:11 | 2022-11-17T22:40:11 | 144,783,924 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,045 | h | /*
* Copyright (c) 2021 Jeff Boody
*
* 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 osmdb_tile_H
#define osmdb_tile_H
#include <stdint.h>
#include "../osmdb_range.h"
#define OSMDB_TILE_MAGIC 0xB00D90DB
#define OSMDB_TILE_VERSION 20220523
typedef struct
{
short x;
short y;
} osmdb_point_t;
#define OSMDB_NODE_FLAG_BUILDING 0x0020
#define OSMDB_NODE_FLAG_NAMEREF 0x0040
#define OSMDB_NODE_FLAG_STATE_CAPITAL 0x0100
#define OSMDB_NODE_FLAG_COUNTRY_CAPITAL 0x0200
typedef struct
{
int class;
int flags;
int ele;
osmdb_point_t pt;
int size_name;
// size_name must be multiple of 4 bytes
// char name[];
} osmdb_node_t;
char* osmdb_node_name(osmdb_node_t* self);
// note: check type/joinWay if adding flags
// INNER flag is the osmdb_relData_t role
// OUTER is the default role
// other roles are used to define center
#define OSMDB_WAY_FLAG_FORWARD 0x0001
#define OSMDB_WAY_FLAG_REVERSE 0x0002
#define OSMDB_WAY_FLAG_BRIDGE 0x0004
#define OSMDB_WAY_FLAG_TUNNEL 0x0008
#define OSMDB_WAY_FLAG_CUTTING 0x0010
#define OSMDB_WAY_FLAG_BUILDING 0x0020
#define OSMDB_WAY_FLAG_NAMEREF 0x0040
#define OSMDB_WAY_FLAG_INNER 0x1000
typedef struct
{
int class;
int flags;
int layer;
osmdb_point_t center;
osmdb_range_t range;
int size_name;
int count;
// size_name must be multiple of 4 bytes
// char name[];
// osmdb_point_t pts[];
} osmdb_way_t;
char* osmdb_way_name(osmdb_way_t* self);
osmdb_point_t* osmdb_way_pts(osmdb_way_t* self);
#define OSMDB_REL_FLAG_BUILDING 0x0020
#define OSMDB_REL_FLAG_NAMEREF 0x0040
typedef struct
{
int class;
int flags;
int type;
osmdb_point_t center;
osmdb_range_t range;
int size_name;
int count;
// size_name must be multiple of 4 bytes
// char name[];
// osmdb_way_t ways[];
} osmdb_rel_t;
char* osmdb_rel_name(osmdb_rel_t* self);
// tl: (0.0, 0.0) => (16383, -16384)
// br: (1.0, 1.0) => (-16384, 16383)
// short: -32768 => 32767
typedef struct
{
int magic;
int version;
int64_t changeset;
int zoom;
int x;
int y;
int count_rels;
int count_ways;
int count_nodes;
// osmdb_rel_t rels[];
// osmdb_way_t ways[];
// osmdb_node_t nodes[];
} osmdb_tile_t;
typedef int (*osmdb_tileParser_relFn)(void* priv,
osmdb_rel_t* rel);
typedef int (*osmdb_tileParser_wayFn)(void* priv,
osmdb_way_t* way);
typedef int (*osmdb_tileParser_nodeFn)(void* priv,
osmdb_node_t* node);
typedef struct
{
void* priv;
osmdb_tileParser_relFn rel_fn;
osmdb_tileParser_wayFn member_fn;
osmdb_tileParser_wayFn way_fn;
osmdb_tileParser_nodeFn node_fn;
} osmdb_tileParser_t;
osmdb_tile_t* osmdb_tile_new(size_t size, void* data,
osmdb_tileParser_t* parser);
void osmdb_tile_delete(osmdb_tile_t** _self);
void osmdb_tile_range(osmdb_tile_t* self,
osmdb_range_t* range);
#endif
| [
"[email protected]"
] | |
4cf2d99b3f0a2a198aad5be9d71e3dfcf6a07625 | 3c25bc987733371b29d0b3e8feeaaa6086f712f5 | /Lab_1/Lab_1_Project_Report/Project_1/Design01.cydsn/Design01.cydsn/Generated_Source/PSoC4/BLE_1_scps.h | 9ca8cb46482aa77176a205ce19ad0c2704841375 | [] | no_license | gbauman01/Embedded_Systems_Lab_1 | 4af76426e71101637d46463f3b2af304bfad4853 | 0f17989c5c818ac77a70f1c7aa0f7ffebd55d766 | refs/heads/master | 2021-01-12T12:51:47.590045 | 2016-09-27T18:57:02 | 2016-09-27T18:57:02 | 69,384,837 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 7,492 | h | /*******************************************************************************
File Name: CYBLE_scps.h
Version 1.20
Description:
Contains the function prototypes and constants for the Scan Parameter service.
********************************************************************************
Copyright 2014-2015, Cypress Semiconductor Corporation. All rights reserved.
You may use this file only in accordance with the license, terms, conditions,
disclaimers, and limitations in the end user license agreement accompanying
the software package with which this file was provided.
*******************************************************************************/
#if !defined(CY_BLE_CYBLE_SCPS_H)
#define CY_BLE_CYBLE_SCPS_H
#include "BLE_1.h"
#include "BLE_1_gatt.h"
/***************************************
##Data Struct Definition
***************************************/
/* ScPS Characteristic indexes */
typedef enum
{
CYBLE_SCPS_SCAN_INT_WIN, /* Scan Interval Window characteristic index */
CYBLE_SCPS_SCAN_REFRESH, /* Scan Refresh characteristic index */
CYBLE_SCPS_CHAR_COUNT /* Total count of characteristics */
}CYBLE_SCPS_CHAR_INDEX_T;
/* ScPS Characteristic Descriptors indexes */
typedef enum
{
CYBLE_SCPS_SCAN_REFRESH_CCCD, /* Client Characteristic Configuration descriptor index */
CYBLE_SCPS_DESCR_COUNT /* Total count of descriptors */
}CYBLE_SCPS_DESCR_INDEX_T;
#ifdef CYBLE_SCPS_SERVER
/* Structure with Scan Parameters Service attribute handles */
typedef struct
{
CYBLE_GATT_DB_ATTR_HANDLE_T serviceHandle; /* Scan Parameter Service handle*/
CYBLE_GATT_DB_ATTR_HANDLE_T intervalWindowCharHandle; /* Handle of Scan Interval Window Characteristic */
CYBLE_GATT_DB_ATTR_HANDLE_T refreshCharHandle; /* Handle of Scan Refresh Characteristic */
CYBLE_GATT_DB_ATTR_HANDLE_T refreshCccdHandle; /* Handle of Client Characteristic Configuration Descriptor */
} CYBLE_SCPSS_T;
#endif /* CYBLE_SCPS_SERVER */
#ifdef CYBLE_SCPS_CLIENT
/* Structure with discovered attributes information of Scan Parameters Service */
typedef struct
{
CYBLE_CONN_HANDLE_T connHandle; /* Peer device handle */
CYBLE_SRVR_CHAR_INFO_T intervalWindowChar; /* Handle + properties of Scan Interval Window Characteristic */
CYBLE_SRVR_CHAR_INFO_T refreshChar; /* Handle + properties of Scan Refresh Characteristic */
CYBLE_GATT_DB_ATTR_HANDLE_T refreshCccdHandle; /* Handle of Client Characteristic Configuration Descriptor */
} CYBLE_SCPSC_T;
#endif /* CYBLE_SCPS_SERVER */
/* Scan Parameters Service Characteristic Value parameter structure */
typedef struct
{
CYBLE_CONN_HANDLE_T connHandle; /* Peer device handle */
CYBLE_SCPS_CHAR_INDEX_T charIndex; /* Index of service characteristic */
CYBLE_GATT_VALUE_T *value; /* Characteristic value */
} CYBLE_SCPS_CHAR_VALUE_T;
/* Scan Parameters Service Characteristic Descriptor Value parameter structure */
typedef struct
{
CYBLE_CONN_HANDLE_T connHandle; /* Peer device handle */
CYBLE_SCPS_CHAR_INDEX_T charIndex; /* Index of service characteristic */
CYBLE_SCPS_DESCR_INDEX_T descrIndex; /* Index of service characteristic descriptor */
CYBLE_GATT_VALUE_T *value; /* Descriptor value */
} CYBLE_SCPS_DESCR_VALUE_T;
/***************************************
##API Constants
***************************************/
#define CYBLE_SCAN_REFRESH_ENABLED (0x00u)
#define CYBLE_SCAN_REFRESH_RESERVED (0xFFu)
#define CYBLE_REFRESH_CHAR_LEN (0x01u)
#define CYBLE_INTERVAL_WINDOW_CHAR_LEN (0x04u)
#define CYBLE_SCAN_INTERVAL_WINDOW_MIN (0x0004u)
#define CYBLE_SCAN_INTERVAL_WINDOW_MAX (0x4000u)
/***************************************
##Macro Functions
***************************************/
#ifdef CYBLE_SCPS_CLIENT
#define CyBle_ScpscGetCharacteristicValueHandle(charIndex)\
(((charIndex) >= CYBLE_SCPS_CHAR_COUNT) ?\
CYBLE_GATT_INVALID_ATTR_HANDLE_VALUE :\
((charIndex) == CYBLE_SCPS_SCAN_INT_WIN) ?\
cyBle_scpsc.refreshChar.valueHandle :\
cyBle_scpsc.intervalWindowChar.valueHandle)
#define CyBle_ScpscGetCharacteristicDescriptorHandle(charIndex, descrIndex) \
((((charIndex) != CYBLE_SCPS_SCAN_REFRESH) || \
((descrIndex) >= CYBLE_SCPS_DESCR_COUNT)) ? CYBLE_GATT_INVALID_ATTR_HANDLE_VALUE : \
cyBle_scpsc.refreshCccdHandle)
#endif /* (CYBLE_SCPS_CLIENT) */
/***************************************
##Function Prototypes
***************************************/
void CyBle_ScpsRegisterAttrCallback(CYBLE_CALLBACK_T callbackFunc);
#ifdef CYBLE_SCPS_SERVER
CYBLE_API_RESULT_T CyBle_ScpssSetCharacteristicValue(CYBLE_SCPS_CHAR_INDEX_T charIndex,
uint8 attrSize, uint8 *attrValue);
CYBLE_API_RESULT_T CyBle_ScpssGetCharacteristicValue(CYBLE_SCPS_CHAR_INDEX_T charIndex,
uint8 attrSize, uint8 *attrValue);
CYBLE_API_RESULT_T CyBle_ScpssGetCharacteristicDescriptor(CYBLE_SCPS_CHAR_INDEX_T charIndex,
CYBLE_SCPS_DESCR_INDEX_T descrIndex, uint8 attrSize, uint8 *attrValue);
CYBLE_API_RESULT_T CyBle_ScpssSendNotification(CYBLE_CONN_HANDLE_T connHandle,
CYBLE_SCPS_CHAR_INDEX_T charIndex, uint8 attrSize, uint8 *attrValue);
#endif /* CYBLE_SCPS_SERVER */
#ifdef CYBLE_SCPS_CLIENT
CYBLE_API_RESULT_T CyBle_ScpscSetCharacteristicValue(CYBLE_CONN_HANDLE_T connHandle, CYBLE_SCPS_CHAR_INDEX_T charIndex,
uint8 attrSize, uint8 * attrValue);
CYBLE_API_RESULT_T CyBle_ScpscSetCharacteristicDescriptor(CYBLE_CONN_HANDLE_T connHandle,
CYBLE_SCPS_CHAR_INDEX_T charIndex, CYBLE_SCPS_DESCR_INDEX_T descrIndex, uint8 attrSize, uint8 *attrValue);
CYBLE_API_RESULT_T CyBle_ScpscGetCharacteristicDescriptor(CYBLE_CONN_HANDLE_T connHandle,
CYBLE_SCPS_CHAR_INDEX_T charIndex, CYBLE_SCPS_DESCR_INDEX_T descrIndex);
#endif /* (CYBLE_SCPS_CLIENT) */
/***************************************
##Private Function Prototypes
***************************************/
/* DOM-IGNORE-BEGIN */
void CyBle_ScpsInit(void);
#ifdef CYBLE_SCPS_SERVER
CYBLE_GATT_ERR_CODE_T CyBle_ScpssWriteEventHandler(CYBLE_GATTS_WRITE_REQ_PARAM_T *eventParam);
#endif /* CYBLE_SCPS_SERVER */
#ifdef CYBLE_SCPS_CLIENT
void CyBle_ScpscDiscoverCharacteristicsEventHandler(CYBLE_DISC_CHAR_INFO_T *discCharInfo);
void CyBle_ScpscDiscoverCharDescriptorsEventHandler(CYBLE_DISC_DESCR_INFO_T *discDescrInfo);
void CyBle_ScpscNotificationEventHandler(CYBLE_GATTC_HANDLE_VALUE_NTF_PARAM_T *eventParam);
void CyBle_ScpscReadResponseEventHandler(CYBLE_GATTC_READ_RSP_PARAM_T *eventParam);
void CyBle_ScpscWriteResponseEventHandler(const CYBLE_CONN_HANDLE_T *eventParam);
void CyBle_ScpscErrorResponseEventHandler(const CYBLE_GATTC_ERR_RSP_PARAM_T *eventParam);
#endif /* (CYBLE_SCPS_CLIENT) */
/* DOM-IGNORE-END */
/***************************************
##External data references
***************************************/
#ifdef CYBLE_SCPS_SERVER
extern const CYBLE_SCPSS_T cyBle_scpss;
#endif /* CYBLE_SCPS_SERVER */
#ifdef CYBLE_SCPS_CLIENT
extern CYBLE_SCPSC_T cyBle_scpsc;
#endif /* CYBLE_SCPS_SERVER */
#endif /* CY_BLE_CYBLE_SCPS_H */
/* [] END OF FILE */
| [
"[email protected]"
] | |
2c02a487a3437c5817a1fdec5748ffc5b5d61295 | f8d9195e3b1bbae6a0c96dcebdb0e4f3bd6f01a7 | /lightweight-4over6/TC/linux/tcstateadd/include/ipcmsgdef.h | 734f2f27e74cbff9e7db55f370fdd65df0afbc93 | [] | no_license | yiyuandao/laft6 | d09992a8a48266be8067c335e8c39e030cc69c31 | c3dd8591ccf97fe657c6ca246a2ef158698991f7 | refs/heads/master | 2020-04-13T01:19:19.053123 | 2018-12-23T07:33:04 | 2018-12-23T07:33:04 | 162,871,087 | 0 | 1 | null | null | null | null | GB18030 | C | false | false | 4,707 | h | /*-
* Copyright (c) 2010-2012, China Telecommunication Corporations
* All rights reserved.
*
* Authors:
* Qiong Sun, Chan Zhao, Bo Li, Daobiao Gong
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the China Telecommunication Corporations nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef _IPCMSGDEF_H_
#define _IPCMSGDEF_H_
//
//在线用户数量查询消息请求
//
#define IPC_MSG_ONLINE_USER_NUM_REQ 0x01
//
//在线用户数量查询消息应答
//
#define IPC_MSG_ONLINE_USER_NUM_RSP 0x02
//
//在线用户IP映射关系查询消息请求
//
#define IPC_MSG_ONLINE_USER_MAP_REQ 0x03
//
//在线用户IP映射关系查询消息应答
//
#define IPC_MSG_ONLINE_USER_MAP_RSP 0x04
//
//在线用户添加请求
//
#define IPC_MSG_ONLINE_USER_ADD_REQ 0x05
//
//在线用户添加应答
//
#define IPC_MSG_ONLINE_USER_ADD_RSP 0x06
#define IPC_RESULT_SUCCESS 0
#define IPC_RESULT_EXIST 1
#define IPC_RESULT_FAIL 2
//
//IPC消息头
//
typedef struct _tag_ipcmsghdr
{
unsigned char ipcmsgtype;
}IPC_MSG_HDR, *PIPC_MSG_HDR;
//
//在线用户数量查询请求消息
//
typedef struct _tag_ipc_msg_user_num_req
{
IPC_MSG_HDR ipcmsghdr;
}IPC_MSG_USER_NUM_REQ, *PIPC_MSG_USER_NUM_REQ;
//
//在线用户数量查询应答消息
//
typedef struct _tag_ipc_msg_user_num_rsp
{
IPC_MSG_HDR ipcmsghdr;
unsigned long usernum;
}IPC_MSG_USER_NUM_RSP, *PIPC_MSG_USER_NUM_RSP;
//
//在线用户IP映射关系查询请求消息
//
typedef struct _tag_ipc_msg_user_map_req
{
IPC_MSG_HDR ipcmsghdr;
unsigned long userpagenum; //当前一页需要请求的最大用户数量
unsigned long userpageoffset; //当前请求位置的偏移量
}IPC_MSG_USER_MAP_REQ, *PIPC_MSG_USER_MAP_REQ;
//
//在线用户IP映射关系查询应答消息
//
typedef struct _tag_ipc_msg_user_map_rsp
{
IPC_MSG_HDR ipcmsghdr;
unsigned long usernum; //当前请求的实际用户量
unsigned long usertablelen;//映射关系表的长度
unsigned char usertalbe[1];//变长
//eg.
//ipcmsgusermaprsplen = sizeof(IPC_MSG_USER_MAP_RSP) - sizeof(unsigned char) + usertablelen;
//pipcmsgusermaprsp = (PIPC_MSG_USER_MAP_RSP)malloc(ipcmsgusermaprsplen);
}IPC_MSG_USER_MAP_RSP, *PIPC_MSG_USER_MAP_RSP;
//
//在线用户添加请求消息
//
typedef struct _tag_ipc_msg_user_add_req
{
IPC_MSG_HDR ipcmsghdr;
unsigned long usernum; //当前添加的实际用户量
unsigned long usertablelen;//映射关系表的长度
unsigned char usertalbe[1];//变长
}IPC_MSG_USER_MAP_ADD_REQ, *PIPC_MSG_USER_MAP_ADDR_REQ;
//
//在线用户添加应答消息
//
typedef struct _tag_ipc_msg_user_add_rsp
{
IPC_MSG_HDR ipcmsghdr;
unsigned long usernum; //当前添加失败的实际用户量
unsigned long usertablelen;//映射关系表的长度
unsigned char usertalbe[1];//变长USER_MAP_INFO_ADD_RESULT[]
}IPC_MSG_USER_MAP_ADD_RSP, *PIPC_MSG_USER_MAP_ADD_RSP;
typedef struct _tag_user_map_info
{
unsigned short sport;
unsigned short eport;
unsigned int extip;
unsigned char useraddr[16];
unsigned long lefttime;
}USER_MAP_INFO, *PUSER_MAP_INFO;
typedef struct _tag_user_map_info_add_result
{
USER_MAP_INFO usermapinfo;
int result; //添加的结果
}USER_MAP_INFO_ADD_RESULT, *PUSER_MAP_INFO_ADD_RESULT;
#endif
| [
"[email protected]"
] | |
112ecc07d9944cc30d8449dbef871f2885c47bd9 | ba4ac0b02a3fb51c014e445b59c802b75cf697bc | /final/rush00/ex00/rush01.c | 28d6ad7f73877f09c39e0f0200adf2071e03a9ea | [] | no_license | kizombaciao/Piscine42 | e4520c557ea73364959f6f88f440cb39bc4d4503 | 4c66ed6c8da569af7166578704db92279a7c33dc | refs/heads/master | 2020-04-16T01:40:38.651875 | 2019-02-01T06:49:43 | 2019-02-01T06:49:43 | 165,182,376 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,963 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush00.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchao <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/01/13 14:08:10 by jchao #+# #+# */
/* Updated: 2019/01/13 14:47:58 by jchao ### ########.fr */
/* */
/* ************************************************************************** */
char g_t_left = '/';
char g_t_right = '\\';
char g_b_left = '\\';
char g_b_right = '/';
char g_h_side = '*';
char g_v_side = '*';
char g_space = ' ';
int ft_putchar(char c);
void rush00_top(int width)
{
int i;
i = 0;
while (i < width)
{
if (i == 0)
{
ft_putchar(g_t_left);
}
else if (i == (width - 1))
{
ft_putchar(g_t_right);
}
else
{
ft_putchar(g_h_side);
}
i++;
}
ft_putchar(10);
}
void rush00_bottom(int width)
{
int i;
i = 0;
while (i < width)
{
if (i == 0)
{
ft_putchar(g_b_left);
}
else if (i == (width - 1))
{
ft_putchar(g_b_right);
}
else
{
ft_putchar(g_h_side);
}
i++;
}
}
void rush00_mid(int width)
{
int i;
i = 0;
while (i < width)
{
if (i == 0 || i == (width - 1))
{
ft_putchar(g_v_side);
}
else
{
ft_putchar(g_space);
}
i++;
}
}
void rush00(int width, int height)
{
int i;
int j;
rush00_top(width);
j = 0;
while (j < height - 2)
{
rush00_mid(width);
ft_putchar(10);
j++;
}
if (height > 1)
{
rush00_bottom(width);
ft_putchar(10);
}
}
| [
"[email protected]"
] | |
db7bfbe72f1a4e81bd8f495d1978751417784834 | fddfc3b088994d4b704541bc12b0a59efa267265 | /vm_dir/libft/srcs/2_put/ft_putchar_fd.c | 7ff6a5e089c6a19ec3fd001d40882098f127ec4b | [] | no_license | m4k331/corewar | cb6592e35f3898eeabcf212f7c9941d58f280e27 | b8144b244a5e1fe71d9252579e6ac4cd8803934a | refs/heads/master | 2021-03-15T17:43:49.301053 | 2020-09-14T16:49:04 | 2020-09-14T16:49:04 | 246,869,464 | 0 | 1 | null | 2020-09-13T19:46:57 | 2020-03-12T15:31:36 | C | UTF-8 | C | false | false | 980 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: limry <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/28 18:02:49 by limry #+# #+# */
/* Updated: 2020/06/06 19:02:59 by kona ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_put.h"
int ft_putchar_fd(char c, int fd)
{
return (write(fd, &c, 1));
}
| [
"[email protected]"
] | |
336e9ba10bceeeba7c2fb753ab4c2f963c582aa5 | b0d160156044dd4b21b30ff9c14cd79635f26d2a | /subin 2/command2.c | 34056f4b151d4354aeb6cbc27a12905cdbbc9d3b | [] | no_license | md-ashraful-islam/level-1term-1 | d6b51816aba829f72a8cc1e978c1bf813d7b26da | d322eab389b98ec9de87db503349cf52511b609d | refs/heads/master | 2021-07-02T21:47:07.719680 | 2017-09-18T17:28:25 | 2017-09-18T17:28:25 | 103,970,339 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 174 | c | #include<stdio.h>
#include<stdlib.h>
int main(int argc,char *argv[])
{
printf("Argument count: %d\n",argc);
printf("First argument: %s\n",argv[0]);
return 0;
}
| [
"[email protected]"
] | |
158a94594e020c96399736f8176f40de4253ef76 | 361392b6df3816d447c0d373ebef96db5b90b8e5 | /src/yen.c | c4d2134facdb4db95c53015adce7c9ff7da88286 | [] | no_license | jalalium/Lem-in | 6a644b51801c2c2a656ff256a289cbd854f88068 | 3a3e7fc68e092b2b23d8bfd30c89803a8812eca5 | refs/heads/master | 2020-09-04T13:35:22.221584 | 2019-11-05T13:10:29 | 2019-11-05T13:10:29 | 219,745,570 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,319 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* yen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmaaouni <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/11 20:17:33 by mmaaouni #+# #+# */
/* Updated: 2019/06/23 20:01:54 by zchatoua ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/lem_in.h"
t_paths *init_ypaths(t_info info, t_path *sp)
{
t_paths *all_paths;
all_paths = (t_paths*)malloc(sizeof(t_paths) * 1);
all_paths->count = 0;
all_paths->first = sp;
all_paths->potential = NULL;
all_paths->last = sp;
add_path(&all_paths, sp, info);
return (all_paths);
}
void free_aux(t_path *tmp)
{
free(tmp->path);
free(tmp);
}
void update_potential(t_info info, t_paths *all_paths, t_path *ac_path)
{
int i;
t_room **nodes;
t_room **used;
t_path *tmp;
i = -1;
while (++i < ac_path->length - 1)
{
used = cancel_edge(all_paths, ac_path, i);
nodes = (i > 0 ? cancel_nodes(ac_path, i) : NULL);
tmp = dijkstra_three(info, used, nodes, ac_path->path[i]);
if (tmp != NULL)
{
tmp = concat(ac_path, tmp, i);
if (all_paths->potential == NULL)
add_qpath(&all_paths, tmp);
else
{
if (all_paths->potential->length >= tmp->length)
update_qpath(&all_paths, tmp);
else
free_aux(tmp);
}
}
}
}
t_paths *find_k_paths(t_info info, t_path *sp, int i)
{
t_path *ac_path;
t_paths *all_paths;
all_paths = init_ypaths(info, sp);
ac_path = all_paths->first;
i = 0;
while (all_paths->count < 30)
{
update_potential(info, all_paths, ac_path);
if (all_paths->potential != NULL)
add_path(&all_paths, all_paths->potential, info);
else
break ;
all_paths->potential = NULL;
ac_path = ac_path->next;
}
return (all_paths);
}
| [
"[email protected]"
] | |
83cee0c9451094ddb899ff6150f3d4b025ce7ca3 | 40cd43841d9eed936113f8fe8c9ef03ca98bdb59 | /42-Raytracer/includes/prototypes.h | 0a4c60a6f8dc229cf2fd5c3e8f2924576bc51fbb | [] | no_license | dcognata/42 | dafe0bb43ca4263f272d0b4d473bcf077380d4bd | e642791d7c92d6c12cadc2356b988d38cf9c2d6f | refs/heads/master | 2022-06-28T15:29:32.444834 | 2020-04-13T16:07:45 | 2020-04-13T16:07:45 | 255,374,383 | 0 | 0 | null | 2022-06-21T18:21:26 | 2020-04-13T16:00:00 | C | UTF-8 | C | false | false | 5,422 | h | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* prototypes.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gromon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/26 23:50:54 by gromon #+# #+# */
/* Updated: 2016/11/15 02:40:26 by gromon ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PROTOTYPES_H
# define PROTOTYPES_H
void init(t_env *e, char *filename);
void quit(t_env *e);
void parse_scene(t_scene *s, char *filename);
char *read_file(char *filename);
char *read_data(char *data, char *request);
int read_int_data(char *data, char *request);
double read_double_data(char *data, char *request);
int read_color_data(char *data, char *request);
char *construct_request_int(char *request, int n);
int data_get_i_constructed(char *data, char *request, int i);
double data_get_d_constructed(char *data, char *request, int i);
void load_textures(t_env *e);
void free_textures(t_env *e);
void fill_screen_data(t_scene *s, char *data);
void fill_camera_data(t_scene *s, char *data);
int *fill_counts_data(t_scene *s, char *data);
void fill_lights_data(t_scene *s, char *data);
void fill_spheres_data(t_scene *s, char *data, int counts[4]);
void fill_cylinders_data(t_scene *s, char *data, int counts[4]);
void fill_cones_data(t_scene *s, char *data, int counts[4]);
void fill_planes_data(t_scene *s, char *data, int counts[4]);
void fill_screen_data(t_scene *s, char *data);
void fill_light_data(t_scene *s, char *data);
void loop(t_env *e);
void init_inputs(t_inputs *inputs);
void get_inputs(t_env *e);
void get_inputs_keys(t_env *e, t_bool pressed);
void get_inputs_keys2(t_env *e, t_bool pressed);
void get_inputs_mouse(t_env *e);
void switch_mode(t_env *e);
void move(t_env *e);
void key_hook(t_env *e);
void mouse_hook(t_env *e);
void toggle_fullscreen(t_env *e);
void move_left(t_env *e);
void move_left2(t_env *e);
void move_right(t_env *e);
void move_right2(t_env *e);
void move_up(t_env *e);
void move_down(t_env *e);
void move_forward(t_env *e);
void move_backward(t_env *e);
void rotate_left(t_vec3 *v);
void rotate_normal_left(t_vec3 *v);
void rotate_right(t_vec3 *v);
void rotate_normal_right(t_vec3 *v);
void rotate_up(t_vec3 *v);
void rotate_normal_up(t_vec3 *v);
void rotate_down(t_vec3 *v);
void rotate_normal_down(t_vec3 *v);
void rotate_forward(t_vec3 *v);
void rotate_normal_forward(t_vec3 *v);
void rotate_backward(t_vec3 *v);
void rotate_normal_backward(t_vec3 *v);
void draw(t_env *e);
void draw_pixel(t_env *e, t_pixel p);
void raytrace(t_env *e);
t_color get_pixel_color(t_intersection *inter, t_env *e);
t_color color_median(t_color c[9]);
void create_ray(t_scene *scene, t_vec3 to);
t_intersection throw_ray(t_env *e, t_ray *ray);
void intersect_objects(t_env *e, t_ray *ray,
t_intersection *inter);
t_bool inter_spheres(t_ray *ray, t_obj *s, double *t);
t_bool inter_cylinders(t_ray *ray, t_obj *c, double *t);
t_bool inter_cones(t_ray *ray, t_obj *c, double *t);
t_bool inter_planes(t_ray *ray, t_obj *p, double *t);
t_bool solve_quadratic(t_equation e, double *t);
t_color uint32_to_color(Uint32 color, SDL_Surface *bmp);
double calc_dist(t_vec3 *v1, t_vec3 *v2);
double deg_to_rad(double deg);
double rad_to_deg(double rad);
double pick_value(double value, double min, double max);
t_vec3 get_normal(t_vec3 *pos, t_obj *obj);
t_color get_global_illuminated_color(t_color *c, t_color *ambient);
void flour_color(t_color *color);
void vec_rotate_x(t_vec3 *v, double ang);
void vec_rotate_y(t_vec3 *v, double ang);
void vec_rotate_z(t_vec3 *v, double ang);
void vec_rotate(t_vec3 *v, t_vec3 rot);
void vec_unrotate(t_vec3 *v, t_vec3 rot);
void process_lighting(t_env *e, t_ray *ray,
t_intersection inter, t_color *color);
void final_pixel_color(t_env *e, t_lambert *lamb);
void lambert_point(t_env *e, t_lambert *lamb);
void lambert_directional(t_env *e, t_lambert *lamb);
void lambert_spot(t_env *e, t_lambert *lamb);
void get_brightness(t_env *e, t_lambert *lamb);
t_vec3 vec_add(t_vec3 v1, t_vec3 v2);
t_vec3 vec_sub(t_vec3 v1, t_vec3 v2);
t_vec3 vec_mul(t_vec3 v1, t_vec3 v2);
t_vec3 vec_div(t_vec3 v1, t_vec3 v2);
void vec_normalize(t_vec3 *v);
double vec_add_to_d(t_vec3 v1, t_vec3 v2);
double vec_sub_to_d(t_vec3 v1, t_vec3 v2);
double vec_mul_to_d(t_vec3 v1, t_vec3 v2);
t_vec3 vec_mul_d(t_vec3 v, double d);
void error(int n, char *mes);
void write_informations(t_env *e);
void take_screenshoot(t_env *e);
void mouse_interface(t_env *e);
void select_effects(t_env *e, t_color *color);
void change_effects(t_env *e);
#endif
| [
"[email protected]"
] | |
c6121ea8c3c4c222f0a3abb9ee8ac640b4970626 | 9d23c20ef793c76fc04536597a49c0f665779bfc | /games/myst_16k/utils/calc_address.c | 1a4140ab15b9a2491b5853d4b9fc043d6325efaf | [] | no_license | deater/vcs | ea3d57d05621f61aff0ae268d753c72a0db8a078 | 27e4505381675c63a906d338fccb3a7f82341149 | refs/heads/main | 2023-08-07T15:17:04.691944 | 2023-08-07T02:25:36 | 2023-08-07T02:25:36 | 509,301,472 | 16 | 1 | null | null | null | null | UTF-8 | C | false | false | 1,311 | c | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
static FILE *fff;
static void find_address(char *symbol_name, int routine_offset) {
unsigned int addr=0;
char string[BUFSIZ],*result;
char temp_name[BUFSIZ];
strncpy(temp_name,symbol_name,BUFSIZ);
strncat(temp_name,":",2);
while(1) {
result=fgets(string,BUFSIZ,fff);
if (result==NULL) {
fprintf(stderr,"Error: %s not found!\n",symbol_name);
exit(-1);
}
result=strstr(string,temp_name);
if (result!=NULL) {
string[6]=0;
sscanf(string,"%x",&addr);
break;
}
}
printf("%s\t=$%04x\n",symbol_name,addr+routine_offset);
}
int main(int argc, char **argv) {
int c;
char *filename;
char symbol[BUFSIZ];
int routine_offset=0xd000;
while ( (c=getopt(argc, argv, "a:s:") ) != -1) {
switch(c) {
case 'a':
routine_offset=strtol(optarg, NULL, 0);
break;
case 's':
strncpy(symbol,optarg,BUFSIZ-1);
break;
default:
fprintf(stderr,"Unknown option %c\n",c);
exit(-1);
break;
}
}
filename=strdup(argv[optind]);
fff=fopen(filename,"r");
if (fff==NULL) {
fprintf(stderr,"ERROR! could not open %s\n",filename);
return -1;
}
find_address(symbol,routine_offset);
fclose(fff);
return 0;
}
| [
"[email protected]"
] | |
c46b0d10537d075e06966377368ef5307ede8549 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/5707de1e-0912-4df5-80ba-1019a171b091.c | 59fb976a1b8674d1198e2e3cad1499f5e6587fc0 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 571 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
j = 53;
l = 64;
k = i%j;
l = i/j;
l = l/j;
l = i%j;
l = l-j;
l = k-k*i;
//variables
/* START VULNERABILITY */
int a;
long b[77];
long c[26];
a = 0;
do {
a--;
/* START BUFFER SET */
*((long *)c + ( a - 1 )) = *((long *)b + ( a - 1 ));
/* END BUFFER SET */
} while(( a - 1 ) > -1);
/* END VULNERABILITY */
//random
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
b18fdc40101427203620dd8ea7af85e103f6c492 | fdfbb8f29f7f7d5ad2d683ce8939a87479fcb3ea | /2.1/src/Persistence/Seat_Persist.h | 348fbb6cbf0277452c5fd7160ddf3a4bc3933742 | [] | no_license | SequinYF/TTMS_C | 7559a5d0a0aa447332fa242090075d305e6399b6 | c5073b00ead328d02fa30aefefe3298831d7ecd7 | refs/heads/master | 2021-01-01T12:51:15.252951 | 2017-07-18T09:31:11 | 2017-07-18T09:31:11 | 97,579,136 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 650 | h | /*
* Seat_Persist.h
*
* Created on: 2015年5月23日
* Author: lc
*/
#ifndef SEATPERSIST_H_
#define SEATPERSIST_H_
#include "../Service/Seat.h"
int Seat_Perst_Insert(const seat_t *data);
int Seat_Perst_InsertBatch(seat_list_t list);
int Seat_Perst_Update(const seat_t *data);
int Seat_Perst_DeleteByID(int ID);
int Seat_Perst_DeleteAllByRoomID(int roomID);
int Seat_Perst_SelectByRoomID(seat_list_t list, int roomID);
int Seat_Perst_SelectByID(int ID, seat_t *buf);
int Seat_Perst_SelectAll(seat_list_t list);
int Seat_Perst_SelectByRoomID(seat_list_t list, int roomID);
#endif /* SEATPERSIST_H_ */
| [
"[email protected]"
] | |
03c3ec21c73cf786bd3f412c01b61d0d752495e9 | f026cb616ef14bae15a1d251ca6dbe0f55016d9c | /linux/3019.c | c365ed1b08ba3bb435438be396d706e4f7811fa1 | [] | no_license | jajajasalu2/cocci-lkmp-c-files | 3eb7d451929dca5cb6beb56aabd69fe3f7fc176c | 5da943aabe1589e393a131121dbf8e7a84b3cf2a | refs/heads/master | 2020-12-02T17:30:14.411816 | 2020-01-29T08:36:30 | 2020-01-29T08:36:30 | 231,053,574 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,752 | c | cocci_test_suite() {
struct iort_pci_alias_info cocci_id/* drivers/acpi/arm64/iort.c 952 */;
struct iort_pci_alias_info *cocci_id/* drivers/acpi/arm64/iort.c 918 */;
struct iort_pci_alias_info {
struct device *dev;
struct acpi_iort_node *node;
} cocci_id/* drivers/acpi/arm64/iort.c 911 */;
const struct iommu_ops *cocci_id/* drivers/acpi/arm64/iort.c 864 */;
struct fwnode_handle *cocci_id/* drivers/acpi/arm64/iort.c 863 */;
u32 cocci_id/* drivers/acpi/arm64/iort.c 862 */;
struct iommu_resv_region *cocci_id/* drivers/acpi/arm64/iort.c 835 */;
phys_addr_t cocci_id/* drivers/acpi/arm64/iort.c 831 */;
struct list_head *cocci_id/* drivers/acpi/arm64/iort.c 796 */;
struct iommu_fwspec *cocci_id/* drivers/acpi/arm64/iort.c 769 */;
u32 *cocci_id/* drivers/acpi/arm64/iort.c 742 */;
void *cocci_id/* drivers/acpi/arm64/iort.c 740 */;
u16 cocci_id/* drivers/acpi/arm64/iort.c 739 */;
struct pci_dev *cocci_id/* drivers/acpi/arm64/iort.c 739 */;
int __maybe_unused cocci_id/* drivers/acpi/arm64/iort.c 739 */;
struct irq_domain *cocci_id/* drivers/acpi/arm64/iort.c 732 */;
struct device *cocci_id/* drivers/acpi/arm64/iort.c 730 */;
void cocci_id/* drivers/acpi/arm64/iort.c 730 */;
struct acpi_iort_its_group *cocci_id/* drivers/acpi/arm64/iort.c 601 */;
int *cocci_id/* drivers/acpi/arm64/iort.c 599 */;
unsigned int cocci_id/* drivers/acpi/arm64/iort.c 599 */;
phys_addr_t *cocci_id/* drivers/acpi/arm64/iort.c 571 */;
struct iort_fwnode cocci_id/* drivers/acpi/arm64/iort.c 56 */;
struct pci_bus *cocci_id/* drivers/acpi/arm64/iort.c 488 */;
struct iort_fwnode {
struct list_head list;
struct acpi_iort_node *iort_node;
struct fwnode_handle *fwnode;
} cocci_id/* drivers/acpi/arm64/iort.c 33 */;
u8 cocci_id/* drivers/acpi/arm64/iort.c 301 */;
struct acpi_iort_root_complex *cocci_id/* drivers/acpi/arm64/iort.c 283 */;
struct acpi_iort_named_component *cocci_id/* drivers/acpi/arm64/iort.c 267 */;
struct acpi_device *cocci_id/* drivers/acpi/arm64/iort.c 266 */;
struct acpi_buffer cocci_id/* drivers/acpi/arm64/iort.c 265 */;
struct iort_its_msi_chip {
struct list_head list;
struct fwnode_handle *fw_node;
phys_addr_t base_addr;
u32 translation_id;
} cocci_id/* drivers/acpi/arm64/iort.c 26 */;
iort_find_node_callback cocci_id/* drivers/acpi/arm64/iort.c 225 */;
enum acpi_iort_node_type cocci_id/* drivers/acpi/arm64/iort.c 224 */;
struct iort_its_msi_chip *cocci_id/* drivers/acpi/arm64/iort.c 188 */;
const char *cocci_id/* drivers/acpi/arm64/iort.c 1626 */;
acpi_status cocci_id/* drivers/acpi/arm64/iort.c 1621 */;
void __init cocci_id/* drivers/acpi/arm64/iort.c 1619 */;
struct acpi_table_iort *cocci_id/* drivers/acpi/arm64/iort.c 1573 */;
struct acpi_iort_node cocci_id/* drivers/acpi/arm64/iort.c 1551 */;
struct acpi_iort_id_mapping cocci_id/* drivers/acpi/arm64/iort.c 1544 */;
struct acpi_iort_id_mapping *cocci_id/* drivers/acpi/arm64/iort.c 1541 */;
struct acpi_table_header *cocci_id/* drivers/acpi/arm64/iort.c 146 */;
const struct iort_dev_config *cocci_id/* drivers/acpi/arm64/iort.c 1452 */;
acpi_status (*cocci_id/* drivers/acpi/arm64/iort.c 142 */)(struct acpi_iort_node *node,
void *context);
const struct iort_dev_config cocci_id/* drivers/acpi/arm64/iort.c 1416 */;
struct iort_dev_config {
const char *name;
int (*dev_init)(struct acpi_iort_node *node);
void (*dev_dma_configure)(struct device *dev,
struct acpi_iort_node *node);
int (*dev_count_resources)(struct acpi_iort_node *node);
void (*dev_init_resources)(struct resource *res,
struct acpi_iort_node *node);
int (*dev_set_proximity)(struct device *dev,
struct acpi_iort_node *node);
int (*dev_add_platdata)(struct platform_device *pdev);
} cocci_id/* drivers/acpi/arm64/iort.c 1395 */;
struct platform_device *cocci_id/* drivers/acpi/arm64/iort.c 1381 */;
struct acpi_platform_list cocci_id/* drivers/acpi/arm64/iort.c 1374 */[]__initdata;
struct acpi_iort_pmcg *cocci_id/* drivers/acpi/arm64/iort.c 1342 */;
enum dev_dma_attr cocci_id/* drivers/acpi/arm64/iort.c 1325 */;
u64 cocci_id/* drivers/acpi/arm64/iort.c 1302 */;
u64 *cocci_id/* drivers/acpi/arm64/iort.c 1292 */;
struct acpi_iort_smmu *cocci_id/* drivers/acpi/arm64/iort.c 1271 */;
struct acpi_iort_node *cocci_id/* drivers/acpi/arm64/iort.c 1269 */;
int __init cocci_id/* drivers/acpi/arm64/iort.c 1269 */;
unsigned long cocci_id/* drivers/acpi/arm64/iort.c 1167 */;
bool cocci_id/* drivers/acpi/arm64/iort.c 1149 */;
struct acpi_iort_smmu_v3 *cocci_id/* drivers/acpi/arm64/iort.c 1127 */;
struct resource *cocci_id/* drivers/acpi/arm64/iort.c 1108 */;
int cocci_id/* drivers/acpi/arm64/iort.c 1106 */;
struct iort_fwnode *cocci_id/* drivers/acpi/arm64/iort.c 104 */;
}
| [
"[email protected]"
] | |
eb55d4f4491a2a9aab24f09e8f1904542b18ce05 | cd4d8e97e5b51d100dbc4941ed3990112d970d97 | /src/include/widget/gui_radio.h | 445aa2c2a22a25691e88e3ee25512b4527712900 | [] | no_license | solotic/EasyGUI | 37632abd4acec028ae1c67d45d1257c9a7820d40 | f552a3b4399c0a59312235f99f147fd6eca80385 | refs/heads/master | 2021-09-03T11:54:49.919038 | 2018-01-08T21:46:03 | 2018-01-08T21:46:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,695 | h | /**
* \file gui_radio.h
* \brief Radio box widget
*/
/*
* Copyright (c) 2017 Tilen Majerle
*
* 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.
*
* Author: Tilen Majerle <[email protected]>
*/
#ifndef __GUI_RADIO_H
#define __GUI_RADIO_H
/* C++ detection */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \addtogroup GUI_WIDGETS
* \{
*/
#include "gui_widget.h"
/**
* \defgroup GUI_RADIO Radio box
* \brief Radio box widget
* \{
*/
/**
* \brief List of radio colors
*/
typedef enum GUI_RADIO_COLOR_t {
GUI_RADIO_COLOR_BG = 0x00, /*!< Background color index */
GUI_RADIO_COLOR_FG, /*!< Foreground color index */
GUI_RADIO_COLOR_BORDER, /*!< Border color index */
GUI_RADIO_COLOR_DISABLED_BG, /*!< Background color index when disabled */
} GUI_RADIO_COLOR_t;
#if defined(GUI_INTERNAL) || __DOXYGEN__
#define GUI_FLAG_RADIO_CHECKED 0x01 /*!< Indicates radio is currently checked */
#define GUI_FLAG_RADIO_DISABLED 0x02 /*!< Indicates radio is currently disabled */
/**
* \brief Radio object structure
*/
typedef struct GUI_RADIO_t {
GUI_HANDLE C; /*!< GUI handle object, must always be first on list */
uint8_t GroupId; /*!< Group ID for radio box */
uint32_t Value; /*!< Single radio value when selected */
uint32_t SelectedValue; /*!< Currently selected value in radio group.
All Widgets in the same group share the same value in this field all the time */
uint8_t Flags; /*!< Flags for checkbox */
} GUI_RADIO_t;
#endif /* defined(GUI_INTERNAL) || __DOXYGEN__ */
GUI_HANDLE_p gui_radio_create(GUI_ID_t id, GUI_iDim_t x, GUI_iDim_t y, GUI_Dim_t width, GUI_Dim_t height, GUI_HANDLE_p parent, GUI_WIDGET_CALLBACK_t cb, uint16_t flags);
uint8_t gui_radio_setcolor(GUI_HANDLE_p h, GUI_RADIO_COLOR_t index, GUI_Color_t color);
uint8_t gui_radio_setgroup(GUI_HANDLE_p h, uint8_t groupId);
uint8_t gui_radio_getgroup(GUI_HANDLE_p h);
uint8_t gui_radio_setvalue(GUI_HANDLE_p h, uint32_t value);
uint32_t gui_radio_getvalue(GUI_HANDLE_p h);
uint32_t gui_radio_getselectedvalue(GUI_HANDLE_p h);
uint8_t gui_radio_setdisabled(GUI_HANDLE_p h, uint8_t disabled);
uint8_t gui_radio_isdisabled(GUI_HANDLE_p h);
uint8_t gui_radio_setselected(GUI_HANDLE_p h);
/**
* \}
*/
/**
* \}
*/
/* C++ detection */
#ifdef __cplusplus
}
#endif
#endif /* __GUI_RADIO_H */
| [
"[email protected]"
] | |
f86c9ac96959ebaa552c22adfe300ab1d297c058 | 253b8de714136dc8340a8b5a20ab5738702276f0 | /src/ext/wsh_gpc.h | 5019946c620b480ed42ab95c2f3fdd83413f9b3f | [
"MIT"
] | permissive | rumin4nt/wsh | 6aba9f6e5c9c9218d81ae2f0dc7dab0ba62d9bac | 54c63f62c103a6a323916a62486594a82f1df623 | refs/heads/master | 2021-06-05T22:03:03.152324 | 2019-08-16T23:13:46 | 2019-08-16T23:13:46 | 126,113,614 | 0 | 0 | null | 2018-03-21T02:47:08 | 2018-03-21T02:47:07 | null | UTF-8 | C | false | false | 1,449 | h | //
// wsh_gpc.h
// wsh
//
// Created by vs on 12/10/18.
// Copyright © 2018 vaporstack. All rights reserved.
//
#ifndef wsh_gpc_h
#define wsh_gpc_h
// do not uncomment this unless you have purchased a gpc license or are just testing
// legally unsuitable for release.
#define WSH_ENABLE_EXT_GPC
#ifdef WSH_ENABLE_EXT_GPC
#include "../geo/wsh_line.h"
typedef struct WGPCRec
{
void* polygon;
void* tess;
int num;
} WGPCRec;
void wsh_ext_gpc_tesselate(WGPCRec* rec);
void* wsh_ext_gpc_tess_create(WLine* line);
void wsh_ext_gpc_tess_destroy(void* tess);
void* wsh_ext_gpc_tess_create_wline(WLine* line);
//void* r_gpc_tess_create_rline(RLine* line);
//GPCRec* r_gpc_polygon_create(RLine* line);
void wsh_ext_gpc_polygon_destroy(WGPCRec* rec);
double wsh_ext_gpc_polygon_area(WGPCRec* rec);
//RLine** r_gpc_polygon_boolean_rlines(RLine* a, RLine* b, int op, int* rnum);
//GPCRec* r_gpc_polygon_boolean(RLine* a, RLine* b, int op);
WGPCRec* wsh_ext_gpc_polygon_boolean_raw(WGPCRec* a, WGPCRec* b, int op);
//RLine** r_gpc_rlines_from_gpc(GPCRec* rec, int* rnum);
// unified method that takes N polygons and a single op polygon,
//
//RLine** r_gpc_slice_rline(RLine* input, RLine* op, int* onum);
//RLine** r_gpc_slice_rline_multiple(RLine** inputs, int inum, RLine* op, int* onum);
// this one needs a full rewrite
//int r_gpc_polygon_boolean(RLine* la, RLine* lb, RLine** res_addr, int *num);
#endif
#endif /* wsh_gpc_h */
| [
"[email protected]"
] | |
3420ada4156c84612fb7d41fbfb352d762022315 | 2ce4d599527751787719a7760f54c7378810c33e | /Project23/Project23/三子棋.c | 4319c3a76fd47f4b77ad34d6572a146e170d8b68 | [] | no_license | AventadorSQ/C | 2bf4c546372f80488bf998f6c007d4daa99f58ef | 68ec83daab1f3df84caa09c31bd8109be4ad30a3 | refs/heads/master | 2020-03-29T19:56:25.277891 | 2019-06-26T15:40:05 | 2019-06-26T15:40:05 | 150,288,012 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 2,475 | c |
#include "game.h"
void InitBoard(char arr[ROW][COL], int row, int col)
{
memset(arr, ' ', col*row * sizeof(arr[0][0]));
//int i = 0;
//int j = 0;
//for (i = 0; i < row; i++) {
// for (j = 0; j < col; j++)
// {
// arr[i][j]=' ';
// }
//}
}
void Display(char arr[ROW][COL], int row, int col)
{
int i = 0;
int j = 0;
for (i = 0; i < row; i++)
{
if (i == 0)
{
printf("-------------\n");
}
printf("| %c | %c | %c |\n", arr[i][0], arr[i][1], arr[i][2]);
if (i != row - 1)
{
printf("|---|---|---|\n");
}
if (i == row - 1)
{
printf("-------------\n");
}
}
}
int x = 0;
int y = 0;
void ComputerMove(char arr[ROW][COL])
{
while (1)
{
x = rand() % ROW;
y = rand() % COL;
if (arr[x][y] == ' ')
{
arr[x][y] = '0';
break;
}
}
}
void PlayerMove(char arr[ROW][COL], int row, int col)
{
int x = 0;
int y = 0;
while (1)
{
printf("请输入坐标:");
scanf("%d%d", &x, &y);
x--;
y--;
if ((x >= 0) && (x <= 2) && (y >= 0) && (y <= 2))
{
if (arr[x][y] == ' ')
{
arr[x][y] = '*';
break;
}
else
{
printf("坐标有误!!!\n");
}
}
else
{
printf("坐标有误!!!\n");
}
}
}
int IsFull(char arr[ROW][COL], int row, int col)
{
int i = 0, j = 0;
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
if (arr[i][j] == ' ')
return 0;
break;
}
}
return 1;
}
char IsWin(char arr[ROW][COL], int row, int col)
{
int i = 0, j = 0;
for (i = 0; i < row; i++)
{
for (j = 0; j <= col - 3; j++)//3是三子棋,3可以替换
{
if ((arr[i][j] == arr[i][j + 1]) && (arr[i][j + 1] == arr[i][j + 2]) && (arr[i][j] != ' '))
{
return arr[i][j];
}
}
}
for (i = 0; i < col; i++)
{
for (j = 0; j <= row - 3; j++)//3是三子棋,3可以替换
{
if ((arr[i][j] == arr[i][j + 1]) && (arr[i][j + 1] == arr[i][j + 2]) && (arr[i][j] != ' '))
{
return arr[i][j];
}
}
}
for (i = 0; i <= row - 3; i++)
{
for (j = 0; j <= col - 3; j++)
{
if ((arr[i][j] == arr[i + 1][j + 1]) && (arr[i][i] == arr[i + 1][j + 1]) && (arr[i + 1][j + 1] == arr[i + 2][j + 2]) && (arr[i][j] != ' '))
{
return arr[i][j];
}
}
}
for (i = 0; i = row - 3; i++)
{
for (j = col - 3; j >= 0; j--)
{
if ((arr[i][j + 2] == arr[i + 1][j + 1]) && (arr[i][i] == arr[i + 1][j + 1]) && (arr[i + 1][j + 1] == arr[i + 2][j]) && (arr[i][j] != ' '))
{
return arr[i][j];
}
}
}
if (IsFull(arr, row, col))
{
return'q';
}
return' ';
} | [
"[email protected]"
] | |
06fea2b850eb476bd482f77d984ae770b2b0f419 | 5fe1b1dac10acfa0ef9a82d662a7e2955094514f | /src/dsp/core/getintegercoefficients8.c | 6ef649771bcea2d7232bd9df439fa076d6bf4487 | [
"ISC"
] | permissive | nicholatian/cosmo-cstar | e8e4d68d69689906661b562ad9b206e1a8385e46 | 3d4d050346c34374679f19c3f39fc555502a0f72 | refs/heads/master | 2023-02-26T14:46:00.002905 | 2021-02-01T21:46:48 | 2021-02-01T21:46:48 | 334,593,188 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,516 | c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2020 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for │
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "dsp/core/core.h"
#include "dsp/core/q.h"
#include "libc/dce.h"
#include "libc/macros.h"
#include "libc/math.h"
#include "libc/str/str.h"
/**
* Same as GetIntegerCoefficients() but with eight terms.
* @cost ~3ms
*/
long GetIntegerCoefficients8(long N[static 8], const double C[static 8], long M,
long L, long H) {
int i;
int j[8], J[8];
int O[8] = {0};
int S[3] = {0, -1, +1};
double R[8], K[8], D[8], Z, least, error;
least = 1;
Z = 1L << M;
for (i = 0; i < ARRAYLEN(J); ++i) {
least *= H - L;
if (fabs(C[i]) > DBL_MIN) {
J[i] = ARRAYLEN(S);
R[i] = C[i] * Z;
K[i] = rint(R[i]);
N[i] = K[i];
} else {
J[i] = 1;
R[i] = 0;
K[i] = 0;
N[i] = 0;
}
}
if (least > 1) {
for (j[0] = 0; j[0] < J[0]; ++j[0]) {
for (j[1] = 0; j[1] < J[1]; ++j[1]) {
for (j[2] = 0; j[2] < J[2]; ++j[2]) {
for (j[3] = 0; j[3] < J[3]; ++j[3]) {
for (j[4] = 0; j[4] < J[4]; ++j[4]) {
for (j[5] = 0; j[5] < J[5]; ++j[5]) {
for (j[6] = 0; j[6] < J[6]; ++j[6]) {
for (j[7] = 0; j[7] < J[7]; ++j[7]) {
for (i = 0; i < ARRAYLEN(J); ++i) {
D[i] = S[j[i]] + K[i] - R[i];
}
if ((error = DifferSumSq8(D, L, H) / Z) < least) {
least = error;
memcpy(O, j, sizeof(j));
}
}
}
}
}
}
}
}
}
for (i = 0; i < 8; ++i) {
N[i] += S[O[i]];
}
}
return lround(least);
}
| [
"[email protected]"
] | |
4f0d6d524587ae744cc1b3388740535278be0b5c | 24d9849367a4348edc3faa679af0ee00e47559eb | /pipe/pipe_error_1.c | adf40219f5a96935ccfc7f3b9418e6e7e70740c1 | [] | no_license | LUOLE96/C-practice | 500e7d4f38e92899a76fd09930171801a1f0258b | c23bef18f3c674317c5af873860a344e0d0b8053 | refs/heads/master | 2020-08-22T07:40:00.124579 | 2020-01-19T10:39:43 | 2020-01-19T10:39:43 | 216,349,975 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 560 | c | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
int main()
{
int fds[2] = {0};
int res = pipe(fds); //创建无名管道
if(res < 0)
{
perror("pipe error");
return -1;
}
const char *str = "hello world";
int len = write(fds[0],str,strlen(str)); //向管道写入数据
printf("wirte to pipe len = %d,str = %s\n",len,str);
char buf[128] = {0};
len = read(fds[1],buf,sizeof(buf) - 1); //从管道读取数据
printf("read from pipe len = %d,str = %s\n",len,buf);
close(fds[0]); //关闭管道
close(fds[1]);
}
| [
"[email protected]"
] | |
3a993ff0f4ded2a2dd515f2a79bec1575e93c6a8 | 48708090d67209c6daa8ccc3badbb1967e7d14a0 | /Source/UsbFifoData.h | cd63af43893edd2aef0aa704de8933f1cdfa0dd8 | [] | no_license | paoloach/UsbDongleZBee | e8a95f13b62e11b3b96183cd5aad7d5332d82cfe | 629b276e92a00ddaf206e49a9604efda90eb2235 | refs/heads/master | 2020-04-15T14:29:59.386465 | 2017-05-24T04:56:06 | 2017-05-24T04:56:06 | 54,870,390 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 678 | h | /**************************************************************************************************
DESCRIPTION:
--
CREATED: 03/03/2015, by Paolo Achdjian
FILE: UsbFifoData.h
***************************************************************************************************/
#ifndef __USB_FIFO_DATA__H__
#define __USB_FIFO_DATA__H__
#include "hal_types.h"
struct UsbFifoData {
uint8 dataLen;
struct UsbFifoData * next;
uint8 data[];
};
void usbFifoDataPush(const uint8 * data, uint8 len);
void usbFifoDataPushWithType(uint8 type, const uint8 * data, uint8 len);
struct UsbFifoData * getUsbFifoHead(void);
void usbFifoPop(void);
uint8 isFifoEmpty(void);
#endif | [
"[email protected]"
] | |
7274bdf6c3b953dea5747544fdd0f4cbc1c9f548 | ab1c643f224197ca8c44ebd562953f0984df321e | /pchealth/helpctr/shell/binarybehaviors/behaviorstypelibdid.h | 2b6507eb703f8f925cecd59eeb7857a8591778ec | [] | no_license | KernelPanic-OpenSource/Win2K3_NT_admin | e162e0452fb2067f0675745f2273d5c569798709 | d36e522f16bd866384bec440517f954a1a5c4a4d | refs/heads/master | 2023-04-12T13:25:45.807158 | 2021-04-13T16:33:59 | 2021-04-13T16:33:59 | 357,613,696 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 5,362 | h | /******************************************************************************
Copyright (c) 1999 Microsoft Corporation
Module Name:
BehaviorsTypeLibDID.h
Abstract:
This file contains the definition of some constants used by
the Help Center Application.
Revision History:
Davide Massarenti (Dmassare) 08/16/2000
created
******************************************************************************/
#if !defined(__INCLUDED___PCH___BEHAVIORSTYPELIBDID_H___)
#define __INCLUDED___PCH___BEHAVIORSTYPELIBDID_H___
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_BASE 0x08010000
#define DISPID_PCH_BEHAVIORS_BASE_PRIV (DISPID_PCH_BEHAVIORS_BASE + 0x0000)
#define DISPID_PCH_BEHAVIORS_BASE_COMMON (DISPID_PCH_BEHAVIORS_BASE + 0x0100)
#define DISPID_PCH_BEHAVIORS_BASE_SUBSITE (DISPID_PCH_BEHAVIORS_BASE + 0x0200)
#define DISPID_PCH_BEHAVIORS_BASE_TREE (DISPID_PCH_BEHAVIORS_BASE + 0x0300)
#define DISPID_PCH_BEHAVIORS_BASE_TREENODE (DISPID_PCH_BEHAVIORS_BASE + 0x0400)
#define DISPID_PCH_BEHAVIORS_BASE_CONTEXT (DISPID_PCH_BEHAVIORS_BASE + 0x0500)
#define DISPID_PCH_BEHAVIORS_BASE_STATE (DISPID_PCH_BEHAVIORS_BASE + 0x0600)
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_PRIV__NEWDATAAVAILABLE (DISPID_PCH_BEHAVIORS_BASE_PRIV + 0x00)
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_COMMON__DATA (DISPID_PCH_BEHAVIORS_BASE_COMMON + 0x00)
#define DISPID_PCH_BEHAVIORS_COMMON__ELEMENT (DISPID_PCH_BEHAVIORS_BASE_COMMON + 0x01)
#define DISPID_PCH_BEHAVIORS_COMMON__LOAD (DISPID_PCH_BEHAVIORS_BASE_COMMON + 0x10)
#define DISPID_PCH_BEHAVIORS_COMMON__SAVE (DISPID_PCH_BEHAVIORS_BASE_COMMON + 0x11)
#define DISPID_PCH_BEHAVIORS_COMMON__LOCATE (DISPID_PCH_BEHAVIORS_BASE_COMMON + 0x12)
#define DISPID_PCH_BEHAVIORS_COMMON__UNSELECT (DISPID_PCH_BEHAVIORS_BASE_COMMON + 0x13)
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_SUBSITE__ROOT (DISPID_PCH_BEHAVIORS_BASE_SUBSITE + 0x00)
#define DISPID_PCH_BEHAVIORS_SUBSITE__SELECT (DISPID_PCH_BEHAVIORS_BASE_SUBSITE + 0x10)
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_TREE__POPULATE (DISPID_PCH_BEHAVIORS_BASE_TREE + 0x00)
#define DISPID_PCH_BEHAVIORS_TREENODE__TYPE (DISPID_PCH_BEHAVIORS_BASE_TREENODE + 0x00)
#define DISPID_PCH_BEHAVIORS_TREENODE__KEY (DISPID_PCH_BEHAVIORS_BASE_TREENODE + 0x01)
#define DISPID_PCH_BEHAVIORS_TREENODE__TITLE (DISPID_PCH_BEHAVIORS_BASE_TREENODE + 0x02)
#define DISPID_PCH_BEHAVIORS_TREENODE__DESCRIPTION (DISPID_PCH_BEHAVIORS_BASE_TREENODE + 0x03)
#define DISPID_PCH_BEHAVIORS_TREENODE__ICON (DISPID_PCH_BEHAVIORS_BASE_TREENODE + 0x04)
#define DISPID_PCH_BEHAVIORS_TREENODE__URL (DISPID_PCH_BEHAVIORS_BASE_TREENODE + 0x05)
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_CONTEXT__MINIMIZED (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x00)
#define DISPID_PCH_BEHAVIORS_CONTEXT__MAXIMIZED (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x01)
#define DISPID_PCH_BEHAVIORS_CONTEXT__X (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x02)
#define DISPID_PCH_BEHAVIORS_CONTEXT__Y (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x03)
#define DISPID_PCH_BEHAVIORS_CONTEXT__WIDTH (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x04)
#define DISPID_PCH_BEHAVIORS_CONTEXT__HEIGHT (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x05)
#define DISPID_PCH_BEHAVIORS_CONTEXT__CHANGECONTEXT (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x10)
#define DISPID_PCH_BEHAVIORS_CONTEXT__SETWINDOWDIMENSIONS (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x11)
#define DISPID_PCH_BEHAVIORS_CONTEXT__BRINGTOFOREGROUND (DISPID_PCH_BEHAVIORS_BASE_CONTEXT + 0x12)
/////////////////////////////////////////////////////////////////////////
#define DISPID_PCH_BEHAVIORS_STATE__PROPERTY (DISPID_PCH_BEHAVIORS_BASE_STATE + 0x00)
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
#endif // !defined(__INCLUDED___PCH___BEHAVIORSTYPELIBDID_H___)
| [
"[email protected]"
] | |
28912b526ae2ac80a6f0fac0ca0934f51df768b7 | ac87fe518bd11025ff96a603081b0583f0da50dc | /COM/e403/GTW/SRC/TSTFLASH.H | a68b19e55d4c4a51d6d5d93b522f3f829532c5ae | [] | no_license | gugus1974/test-com-gs | 0d4a356730585e6d210d743ab341bd7e6fb5cb19 | 34955f3ae7961fdfea64fda65947b514513a0e93 | refs/heads/master | 2016-09-06T14:31:01.140508 | 2014-12-10T00:06:36 | 2014-12-10T00:06:36 | 32,227,881 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 862 | h | /*********************************************************************************
* lun.08.sett.03 v.1.00 \sw_st\sw_stb\tststbxx\header\tstflash.h *
**********************************************************************************
* Funzioni per il test della flash memory *
**********************************************************************************
* *
*********************************************************************************/
void tstflash(void );
short tstflash_vel(short argc, char *argv[] );
void save_stato (unsigned short stato);
void prn_stato (unsigned int prg, unsigned int cod);
short w_cmd(short argc, char *argv[]);
int chip_erase(void);
void ram2flash (void );
short prn_report(short argc, char *argv[]);
| [
"[email protected]@5a3c8d3f-459e-e8cb-f836-5f6cccefa851"
] | [email protected]@5a3c8d3f-459e-e8cb-f836-5f6cccefa851 |
dec2915337fa46258beb6c2df817bf4b4ea30fe4 | 37c593b4c9b42d38ebfcac8d7160282c43fdb324 | /model/Scade/System/TracksideDynamicModel/TestTracks/UtrechtAmsterdam_oETCS/AmstredamUtrechNoExp/Send_P137_MessageLibBaseline2.c | 734714087545681c399f420d24651854585785ac | [] | no_license | stefan-karg/modeling | d4211778a2e7f2d4948ea38442096edb0f317051 | c0855d85430e5d8313c04a9b8918cd3d596e48ec | refs/heads/master | 2021-01-16T19:56:51.201532 | 2015-08-26T13:55:57 | 2015-08-26T13:55:57 | 26,961,581 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,888 | c | /* $*************** KCG Version 6.1.3 (build i6) ****************
** Command: s2c613 -config C:/GITHUB/modeling/model/Scade/System/TracksideDynamicModel/TestTracks/UtrechtAmsterdam_oETCS/AmstredamUtrechNoExp\kcg_s2c_config.txt
** Generation date: 2015-07-22T11:03:51
*************************************************************$ */
#include "kcg_consts.h"
#include "kcg_sensors.h"
#include "Send_P137_MessageLibBaseline2.h"
/* MessageLibBaseline2::Send_P137 */
void Send_P137_MessageLibBaseline2(
/* MessageLibBaseline2::Send_P137::B_data_in */CompressedPackets_T_Common_Types_Pkg *B_data_in,
/* MessageLibBaseline2::Send_P137::P137 */P137_trackside_int_T_TM *P137,
/* MessageLibBaseline2::Send_P137::B_data_out */CompressedPackets_T_Common_Types_Pkg *B_data_out)
{
/* TM_trackside::Write_P137::_L21 */
static kcg_int _L21_1;
/* TM_trackside::Write_P137::_L22 */
static kcg_int _L22_1;
/* TM_trackside::Write_P137::_L44 */
static CompressedPacketData_T_Common_Types_Pkg _L44_1;
/* TM_trackside::Write_P137::_L43 */
static MetadataElement_T_Common_Types_Pkg _L43_1;
if ((*P137).valid) {
/* 1_1 */ C_P137_tracksim_compr_TM_conversions(P137, &_L43_1, &_L44_1);
/* 1_1 */
SEND_WriteBaliseMessageHeader_TM_lib_internal(
&(*B_data_in).PacketHeaders,
&_L43_1,
&(*B_data_out).PacketHeaders,
&_L21_1,
&_L22_1);
/* 1_1 */
SEND_MessageData_TM_lib_internal(
_L21_1,
_L22_1,
&(*B_data_in).PacketData,
&_L44_1,
&(*B_data_out).PacketData);
}
else {
kcg_copy_CompressedPackets_T_Common_Types_Pkg(B_data_out, B_data_in);
}
}
/* $*************** KCG Version 6.1.3 (build i6) ****************
** Send_P137_MessageLibBaseline2.c
** Generation date: 2015-07-22T11:03:51
*************************************************************$ */
| [
"[email protected]"
] | |
67b3f461c89c7e82e4835716ccf5789b8340e8c0 | 5896167027f07d1e53672ebb76b60ed7bf2f09c8 | /Win10_1803_RS4/x86/System32/ntoskrnl.exe/Standalone/_POWER_INFORMATION_LEVEL_INTERNAL.h | 1d8580936701626a84741df55a93f9ca35c013db | [] | no_license | antiwar3/headers | c776e1de8b552e1284901361907f5e7515ef20ae | e3ec0f11f62cdc76b6c0b6b9fa0d6ffe55e476f0 | refs/heads/master | 2021-05-25T22:49:20.063532 | 2020-02-24T21:43:26 | 2020-02-24T21:44:11 | 253,953,543 | 1 | 2 | null | 2020-04-08T01:25:44 | 2020-04-08T01:25:44 | null | UTF-8 | C | false | false | 2,014 | h | typedef enum _POWER_INFORMATION_LEVEL_INTERNAL
{
PowerInternalAcpiInterfaceRegister = 0,
PowerInternalS0LowPowerIdleInfo = 1,
PowerInternalReapplyBrightnessSettings = 2,
PowerInternalUserAbsencePrediction = 3,
PowerInternalUserAbsencePredictionCapability = 4,
PowerInternalPoProcessorLatencyHint = 5,
PowerInternalStandbyNetworkRequest = 6,
PowerInternalDirtyTransitionInformation = 7,
PowerInternalSetBackgroundTaskState = 8,
PowerInternalTtmOpenTerminal = 9,
PowerInformationInternalTtmFirst = 9,
PowerInternalTtmCreateTerminal = 10,
PowerInternalTtmEvacuateDevices = 11,
PowerInternalTtmCreateTerminalEventQueue = 12,
PowerInternalTtmGetTerminalEvent = 13,
PowerInternalTtmSetDefaultDeviceAssignment = 14,
PowerInternalTtmAssignDevice = 15,
PowerInternalTtmSetDisplayState = 16,
PowerInternalTtmSetDisplayTimeouts = 17,
PowerInformationInternalTtmLast = 17,
PowerInternalBootSessionStandbyActivationInformation = 18,
PowerInternalSessionPowerState = 19,
PowerInternalSessionTerminalInput = 20,
PowerInternalSetWatchdog = 21,
PowerInternalPhysicalPowerButtonPressInfoAtBoot = 22,
PowerInternalExternalMonitorConnected = 23,
PowerInternalHighPrecisionBrightnessSettings = 24,
PowerInternalWinrtScreenToggle = 25,
PowerInternalPpmQosDisable = 26,
PowerInternalTransitionCheckpoint = 27,
PowerInternalInputControllerState = 28,
PowerInternalFirmwareResetReason = 29,
PowerInternalPpmSchedulerQosSupport = 30,
PowerInternalBootStatGet = 31,
PowerInternalBootStatSet = 32,
PowerInternalCallHasNotReturnedWatchdog = 33,
PowerInternalBootStatCheckIntegrity = 34,
PowerInternalBootStatRestoreDefaults = 35,
PowerInternalHostEsStateUpdate = 36,
PowerInternalGetPowerActionState = 37,
PowerInternalBootStatUnlock = 38,
PowerInternalWakeOnVoiceState = 39,
PowerInternalDeepSleepBlock = 40,
PowerInternalIsPoFxDevice = 41,
PowerInformationInternalMaximum = 42,
} POWER_INFORMATION_LEVEL_INTERNAL, *PPOWER_INFORMATION_LEVEL_INTERNAL;
| [
"[email protected]"
] | |
aa9627a9419234a3ec9be03c82a83be172a3d949 | 11bd354c40e1c6a0e9a995b184df351d39eac3ee | /Level4/ft_itoa_base/main.c | 17a9bae1c3cf545559b5cf53a2945c6cf32f28bc | [] | no_license | lnicosia/C-Exam-Alone-In-The-Dark---Beginner-Subjects | 9ec757b7920e1b0736ae87ab48da5910f8ef9aa1 | 7247192bfcf88a74b36e083503b8885524c58110 | refs/heads/master | 2020-04-06T11:06:27.169480 | 2019-03-25T15:56:00 | 2019-03-25T15:56:00 | 157,404,112 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,088 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lnicosia <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/19 14:49:32 by lnicosia #+# #+# */
/* Updated: 2018/11/19 14:53:05 by lnicosia ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
char *ft_itoa_base(int value, int base);
int main(int ac, char **av)
{
(void)ac;
printf("%s\n", ft_itoa_base(atoi(av[1]), atoi(av[2])));
return (0);
}
| [
"[email protected]"
] | |
0640b8a23858fda1f70e1bb4beeb29a3a0797780 | d5ed71ee93a63bcb2892978f4bb04c10cb270ed6 | /library/libsoft1/libalgo/graph/graph.forcedirected.c | 5e5d02df99ca1e8aac63f5f7e55065fd9b3355fd | [] | no_license | ifbe/42 | 64be341f94289a4901fef6bcc540980a0e71dfad | 7c6f286e7c64300ada0e606cbb061174ae96e896 | refs/heads/master | 2023-08-10T08:57:24.374770 | 2023-08-02T16:25:18 | 2023-08-02T16:25:18 | 33,355,771 | 4 | 2 | null | null | null | null | UTF-8 | C | false | false | 2,579 | c | #include "libsoft.h"
double squareroot(double);
struct pair
{
u16 parent;
u16 child;
};
void forcedirected_2d(
vec3 obuf[], int olen,
vec3 vbuf[], int vlen,
struct pair* lbuf, int llen)
{
int j,k;
float x,y,t;
//say("vlen=%d\n",vlen);
//coulomb force
for(j=0;j<vlen;j++)
{
obuf[j][0] = obuf[j][1] = 0.0;
for(k=0;k<vlen;k++)
{
if(j == k)continue;
x = vbuf[j][0] - vbuf[k][0];
y = vbuf[j][1] - vbuf[k][1];
//F = (vec/r)*(k*q1*q2)/(r^2)
//F = vec*(k*q1*q2*)/(r^3)
t = x*x + y*y;
t = 0.01 / t / squareroot(t);
x *= t;
y *= t;
obuf[j][0] += x;
obuf[j][1] += y;
//say("%d,%d,%f,%f\n",j,k,x,y);
}
}
//spring force
for(j=0;j<llen;j++)
{
x = vbuf[lbuf[j].parent][0] - vbuf[lbuf[j].child][0];
y = vbuf[lbuf[j].parent][1] - vbuf[lbuf[j].child][1];
//F = vec*k*r
t = squareroot(x*x + y*y);
x /= t;
y /= t;
obuf[lbuf[j].child][0] += x;
obuf[lbuf[j].child][1] += y;
obuf[lbuf[j].parent][0] -= x;
obuf[lbuf[j].parent][1] -= y;
}
//move point
for(j=0;j<vlen;j++)
{
/*
say("%f,%f -> %f,%f\n",
vbuf[j][0], vbuf[j][1],
obuf[j][0], obuf[j][1]
);
*/
vbuf[j][0] += obuf[j][0] / 50.0;
vbuf[j][1] += obuf[j][1] / 50.0;
}
//say("\n");
}
void forcedirected_3d(
vec3 obuf[], int olen,
vec3 vbuf[], int vlen,
struct pair* lbuf, int llen)
{
int j,k;
float x,y,z,t;
//coulomb force
for(j=0;j<vlen;j++)
{
obuf[j][0] = obuf[j][1] = obuf[j][2] = 0.0;
for(k=0;k<vlen;k++)
{
if(j == k)continue;
x = vbuf[j][0] - vbuf[k][0];
y = vbuf[j][1] - vbuf[k][1];
z = vbuf[j][2] - vbuf[k][2];
//F = (vec/r)*(k*q1*q2)/(r^2)
//F = vec*(k*q1*q2*)/(r^3)
t = x*x + y*y + z*z;
t = 10000.0 / t / squareroot(t);
x *= t;
y *= t;
z *= t;
obuf[j][0] += x;
obuf[j][1] += y;
obuf[j][2] += z;
}
}
//spring force
for(j=0;j<llen;j++)
{
x = vbuf[lbuf[j].parent][0] - vbuf[lbuf[j].child][0];
y = vbuf[lbuf[j].parent][1] - vbuf[lbuf[j].child][1];
z = vbuf[lbuf[j].parent][2] - vbuf[lbuf[j].child][2];
//F = vec*k*r
t = squareroot(x*x + y*y + z*z);
x /= t;
y /= t;
z /= t;
obuf[lbuf[j].child][0] += x;
obuf[lbuf[j].child][1] += y;
obuf[lbuf[j].child][2] += z;
obuf[lbuf[j].parent][0] -= x;
obuf[lbuf[j].parent][1] -= y;
obuf[lbuf[j].parent][2] -= z;
}
//move point
for(j=0;j<vlen;j++)
{
/*
say("%f,%f,%f -> %f,%f,%f\n",
vbuf[j][0], vbuf[j][1], vbuf[j][2],
obuf[j][0], obuf[j][1], obuf[j][2]
);
*/
vbuf[j][0] += obuf[j][0] / 50.0;
vbuf[j][1] += obuf[j][1] / 50.0;
vbuf[j][2] += obuf[j][2] / 50.0;
}
//say("\n");
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.