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
d3e778ee3e85634511a5fd3bf3f1ebb443199e75
d0dc556f8b1d18ecbadef182bafd97b632dd3104
/common/esp-idf-lib/components/ads111x/ads111x.c
0919600ec7269ef5883c40d4dccf36ba36ee4fad
[ "BSD-2-Clause", "MIT" ]
permissive
PacktPublishing/Internet-of-Things-with-ESP32
da3f2c57e2bd871b134b22841fd275c51f88d487
3ada8b905e53961940511636991a839059de7cd1
refs/heads/main
2023-02-08T13:58:32.585403
2023-01-30T10:03:23
2023-01-30T10:03:23
315,618,086
114
36
null
null
null
null
UTF-8
C
false
false
8,016
c
/** * @file ads111x.c * * ESP-IDF driver for ADS1113/ADS1114/ADS1115, ADS1013/ADS1014/ADS1015 I2C ADC * * Ported from esp-open-rtos * * Copyright (C) 2016, 2018 Ruslan V. Uss <[email protected]> * Copyright (C) 2020 Lucio Tarantino (https://github.com/dianlight) * * BSD Licensed as described in the file LICENSE */ #include <esp_log.h> #include <esp_idf_lib_helpers.h> #include "ads111x.h" #define I2C_FREQ_HZ 1000000 // Max 1MHz for esp32 #define REG_CONVERSION 0 #define REG_CONFIG 1 #define REG_THRESH_L 2 #define REG_THRESH_H 3 #define COMP_QUE_OFFSET 1 #define COMP_QUE_MASK 0x03 #define COMP_LAT_OFFSET 2 #define COMP_LAT_MASK 0x01 #define COMP_POL_OFFSET 3 #define COMP_POL_MASK 0x01 #define COMP_MODE_OFFSET 4 #define COMP_MODE_MASK 0x01 #define DR_OFFSET 5 #define DR_MASK 0x07 #define MODE_OFFSET 8 #define MODE_MASK 0x01 #define PGA_OFFSET 9 #define PGA_MASK 0x07 #define MUX_OFFSET 12 #define MUX_MASK 0x07 #define OS_OFFSET 15 #define OS_MASK 0x01 #define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0) #define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0) static const char *TAG = "ADS111x"; const float ads111x_gain_values[] = { [ADS111X_GAIN_6V144] = 6.144, [ADS111X_GAIN_4V096] = 4.096, [ADS111X_GAIN_2V048] = 2.048, [ADS111X_GAIN_1V024] = 1.024, [ADS111X_GAIN_0V512] = 0.512, [ADS111X_GAIN_0V256] = 0.256, [ADS111X_GAIN_0V256_2] = 0.256, [ADS111X_GAIN_0V256_3] = 0.256 }; static esp_err_t read_reg(i2c_dev_t *dev, uint8_t reg, uint16_t *val) { uint8_t buf[2]; esp_err_t res; if ((res = i2c_dev_read_reg(dev, reg, buf, 2)) != ESP_OK) { ESP_LOGE(TAG, "Could not read from register 0x%02x", reg); return res; } *val = (buf[0] << 8) | buf[1]; return ESP_OK; } static esp_err_t write_reg(i2c_dev_t *dev, uint8_t reg, uint16_t val) { uint8_t buf[2] = { val >> 8, val }; esp_err_t res; if ((res = i2c_dev_write_reg(dev, reg, buf, 2)) != ESP_OK) { ESP_LOGE(TAG, "Could not write 0x%04x to register 0x%02x", val, reg); return res; } return ESP_OK; } static esp_err_t read_conf_bits(i2c_dev_t *dev, uint8_t offs, uint16_t mask, uint16_t *bits) { CHECK_ARG(dev); uint16_t val; I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, read_reg(dev, REG_CONFIG, &val)); I2C_DEV_GIVE_MUTEX(dev); ESP_LOGD(TAG, "Got config value: 0x%04x", val); *bits = (val >> offs) & mask; return ESP_OK; } static esp_err_t write_conf_bits(i2c_dev_t *dev, uint16_t val, uint8_t offs, uint16_t mask) { CHECK_ARG(dev); uint16_t old; I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, read_reg(dev, REG_CONFIG, &old)); I2C_DEV_CHECK(dev, write_reg(dev, REG_CONFIG, (old & ~(mask << offs)) | (val << offs))); I2C_DEV_GIVE_MUTEX(dev); return ESP_OK; } #define READ_CONFIG(OFFS, MASK, VAR) do { \ CHECK_ARG(VAR); \ uint16_t bits; \ CHECK(read_conf_bits(dev, OFFS, MASK, &bits)); \ *VAR = bits; \ return ESP_OK; \ } while(0) /////////////////////////////////////////////////////////////////////////////// esp_err_t ads111x_init_desc(i2c_dev_t *dev, uint8_t addr, i2c_port_t port, gpio_num_t sda_gpio, gpio_num_t scl_gpio) { CHECK_ARG(dev); if (addr != ADS111X_ADDR_GND && addr != ADS111X_ADDR_VCC && addr != ADS111X_ADDR_SDA && addr != ADS111X_ADDR_SCL) { ESP_LOGE(TAG, "Invalid I2C address"); return ESP_ERR_INVALID_ARG; } dev->port = port; dev->addr = addr; dev->cfg.sda_io_num = sda_gpio; dev->cfg.scl_io_num = scl_gpio; #if HELPER_TARGET_IS_ESP32 dev->cfg.master.clk_speed = I2C_FREQ_HZ; #endif return i2c_dev_create_mutex(dev); } esp_err_t ads111x_free_desc(i2c_dev_t *dev) { CHECK_ARG(dev); return i2c_dev_delete_mutex(dev); } esp_err_t ads111x_is_busy(i2c_dev_t *dev, bool *busy) { READ_CONFIG(OS_OFFSET, OS_MASK, busy); } esp_err_t ads111x_start_conversion(i2c_dev_t *dev) { return write_conf_bits(dev, 1, OS_OFFSET, OS_MASK); } esp_err_t ads111x_get_value(i2c_dev_t *dev, int16_t *value) { CHECK_ARG(dev && value); I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, read_reg(dev, REG_CONVERSION, (uint16_t *)value)); I2C_DEV_GIVE_MUTEX(dev); return ESP_OK; } esp_err_t ads101x_get_value(i2c_dev_t *dev, int16_t *value) { CHECK_ARG(dev && value); I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, read_reg(dev, REG_CONVERSION, (uint16_t *)value)); I2C_DEV_GIVE_MUTEX(dev); *value = *value >> 4; if (*value > 0x07FF) { // negative number - extend the sign to 16th bit *value |= 0xF000; } return ESP_OK; } esp_err_t ads111x_get_gain(i2c_dev_t *dev, ads111x_gain_t *gain) { READ_CONFIG(PGA_OFFSET, PGA_MASK, gain); } esp_err_t ads111x_set_gain(i2c_dev_t *dev, ads111x_gain_t gain) { return write_conf_bits(dev, gain, PGA_OFFSET, PGA_MASK); } esp_err_t ads111x_get_input_mux(i2c_dev_t *dev, ads111x_mux_t *mux) { READ_CONFIG(MUX_OFFSET, MUX_MASK, mux); } esp_err_t ads111x_set_input_mux(i2c_dev_t *dev, ads111x_mux_t mux) { return write_conf_bits(dev, mux, MUX_OFFSET, MUX_MASK); } esp_err_t ads111x_get_mode(i2c_dev_t *dev, ads111x_mode_t *mode) { READ_CONFIG(MODE_OFFSET, MODE_MASK, mode); } esp_err_t ads111x_set_mode(i2c_dev_t *dev, ads111x_mode_t mode) { return write_conf_bits(dev, mode, MODE_OFFSET, MODE_MASK); } esp_err_t ads111x_get_data_rate(i2c_dev_t *dev, ads111x_data_rate_t *rate) { READ_CONFIG(DR_OFFSET, DR_MASK, rate); } esp_err_t ads111x_set_data_rate(i2c_dev_t *dev, ads111x_data_rate_t rate) { return write_conf_bits(dev, rate, DR_OFFSET, DR_MASK); } esp_err_t ads111x_get_comp_mode(i2c_dev_t *dev, ads111x_comp_mode_t *mode) { READ_CONFIG(COMP_MODE_OFFSET, COMP_MODE_MASK, mode); } esp_err_t ads111x_set_comp_mode(i2c_dev_t *dev, ads111x_comp_mode_t mode) { return write_conf_bits(dev, mode, COMP_MODE_OFFSET, COMP_MODE_MASK); } esp_err_t ads111x_get_comp_polarity(i2c_dev_t *dev, ads111x_comp_polarity_t *polarity) { READ_CONFIG(COMP_POL_OFFSET, COMP_POL_MASK, polarity); } esp_err_t ads111x_set_comp_polarity(i2c_dev_t *dev, ads111x_comp_polarity_t polarity) { return write_conf_bits(dev, polarity, COMP_POL_OFFSET, COMP_POL_MASK); } esp_err_t ads111x_get_comp_latch(i2c_dev_t *dev, ads111x_comp_latch_t *latch) { READ_CONFIG(COMP_LAT_OFFSET, COMP_LAT_MASK, latch); } esp_err_t ads111x_set_comp_latch(i2c_dev_t *dev, ads111x_comp_latch_t latch) { return write_conf_bits(dev, latch, COMP_LAT_OFFSET, COMP_LAT_MASK); } esp_err_t ads111x_get_comp_queue(i2c_dev_t *dev, ads111x_comp_queue_t *queue) { READ_CONFIG(COMP_QUE_OFFSET, COMP_QUE_MASK, queue); } esp_err_t ads111x_set_comp_queue(i2c_dev_t *dev, ads111x_comp_queue_t queue) { return write_conf_bits(dev, queue, COMP_QUE_OFFSET, COMP_QUE_MASK); } esp_err_t ads111x_get_comp_low_thresh(i2c_dev_t *dev, int16_t *th) { CHECK_ARG(dev && th); I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, read_reg(dev, REG_THRESH_L, (uint16_t *)th)); I2C_DEV_GIVE_MUTEX(dev); return ESP_OK; } esp_err_t ads111x_set_comp_low_thresh(i2c_dev_t *dev, int16_t th) { CHECK_ARG(dev); I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, write_reg(dev, REG_THRESH_L, th)); I2C_DEV_GIVE_MUTEX(dev); return ESP_OK; } esp_err_t ads111x_get_comp_high_thresh(i2c_dev_t *dev, int16_t *th) { CHECK_ARG(dev && th); I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, read_reg(dev, REG_THRESH_H, (uint16_t *)th)); I2C_DEV_GIVE_MUTEX(dev); return ESP_OK; } esp_err_t ads111x_set_comp_high_thresh(i2c_dev_t *dev, int16_t th) { CHECK_ARG(dev); I2C_DEV_TAKE_MUTEX(dev); I2C_DEV_CHECK(dev, write_reg(dev, REG_THRESH_H, th)); I2C_DEV_GIVE_MUTEX(dev); return ESP_OK; }
9f3bb90bceaf8417f9f928e751da6e234546ee99
4d1614ba0104bb2b4528b32fa0a2a1e8caa3bfa3
/code/dpdk/app/test/test_pdump.c
ad183184cee9098fc6dd67390d5e5f6b65856139
[ "MIT", "GPL-2.0-only", "BSD-3-Clause" ]
permissive
Lossless-Virtual-Switching/Backdraft
c292c87f8d483a5dbd8d28009cb3b5e263e7fb36
4cedd1403c7c9fe5e1afc647e374173c7c5c46f0
refs/heads/master
2023-05-24T03:27:49.553264
2023-03-01T14:59:00
2023-03-01T14:59:00
455,533,889
11
4
MIT
2022-04-20T16:34:22
2022-02-04T12:09:31
C
UTF-8
C
false
false
4,815
c
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Intel Corporation */ #include <stdio.h> #include <unistd.h> #include <stdint.h> #include <limits.h> #include <rte_ethdev_driver.h> #include <rte_pdump.h> #include "rte_eal.h" #include "rte_lcore.h" #include "rte_mempool.h" #include "rte_ring.h" #include "sample_packet_forward.h" #include "test.h" #include "process.h" #include "test_pdump.h" #define launch_p(ARGV) process_dup(ARGV, RTE_DIM(ARGV), __func__) struct rte_ring *ring_server; uint16_t portid; uint16_t flag_for_send_pkts = 1; int test_pdump_init(void) { int ret = 0; ret = rte_pdump_init(); if (ret < 0) { printf("rte_pdump_init failed\n"); return -1; } ret = test_ring_setup(&ring_server, &portid); if (ret < 0) { printf("test_ring_setup failed\n"); return -1; } printf("pdump_init success\n"); return ret; } int run_pdump_client_tests(void) { int flags = RTE_PDUMP_FLAG_TX, ret = 0, itr; char deviceid[] = "net_ring_net_ringa"; struct rte_ring *ring_client; struct rte_mempool *mp = NULL; struct rte_eth_dev *eth_dev = NULL; char poolname[] = "mbuf_pool_client"; ret = test_get_mempool(&mp, poolname); if (ret < 0) return -1; mp->flags = 0x0000; ring_client = rte_ring_create("SR0", RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); if (ring_client == NULL) { printf("rte_ring_create SR0 failed"); return -1; } eth_dev = rte_eth_dev_attach_secondary(deviceid); if (!eth_dev) { printf("Failed to probe %s", deviceid); return -1; } rte_eth_dev_probing_finish(eth_dev); ring_client->prod.single = 0; ring_client->cons.single = 0; printf("\n***** flags = RTE_PDUMP_FLAG_TX *****\n"); for (itr = 0; itr < NUM_ITR; itr++) { ret = rte_pdump_enable(portid, QUEUE_ID, flags, ring_client, mp, NULL); if (ret < 0) { printf("rte_pdump_enable failed\n"); return -1; } printf("pdump_enable success\n"); ret = rte_pdump_disable(portid, QUEUE_ID, flags); if (ret < 0) { printf("rte_pdump_disable failed\n"); return -1; } printf("pdump_disable success\n"); ret = rte_pdump_enable_by_deviceid(deviceid, QUEUE_ID, flags, ring_client, mp, NULL); if (ret < 0) { printf("rte_pdump_enable_by_deviceid failed\n"); return -1; } printf("pdump_enable_by_deviceid success\n"); ret = rte_pdump_disable_by_deviceid(deviceid, QUEUE_ID, flags); if (ret < 0) { printf("rte_pdump_disable_by_deviceid failed\n"); return -1; } printf("pdump_disable_by_deviceid success\n"); if (itr == 0) { flags = RTE_PDUMP_FLAG_RX; printf("\n***** flags = RTE_PDUMP_FLAG_RX *****\n"); } else if (itr == 1) { flags = RTE_PDUMP_FLAG_RXTX; printf("\n***** flags = RTE_PDUMP_FLAG_RXTX *****\n"); } } if (ring_client != NULL) test_ring_free(ring_client); if (mp != NULL) test_mp_free(mp); return ret; } int test_pdump_uninit(void) { int ret = 0; ret = rte_pdump_uninit(); if (ret < 0) { printf("rte_pdump_uninit failed\n"); return -1; } if (ring_server != NULL) test_ring_free(ring_server); printf("pdump_uninit success\n"); test_vdev_uninit("net_ring_net_ringa"); return ret; } void * send_pkts(void *empty) { int ret = 0; struct rte_mbuf *pbuf[NUM_PACKETS] = { }; struct rte_mempool *mp; char poolname[] = "mbuf_pool_server"; ret = test_get_mbuf_from_pool(&mp, pbuf, poolname); if (ret < 0) printf("get_mbuf_from_pool failed\n"); do { ret = test_packet_forward(pbuf, portid, QUEUE_ID); if (ret < 0) printf("send pkts Failed\n"); } while (flag_for_send_pkts); test_put_mbuf_to_pool(mp, pbuf); return empty; } /* * This function is called in the primary i.e. main test, to spawn off secondary * processes to run actual mp tests. Uses fork() and exec pair */ int run_pdump_server_tests(void) { int ret = 0; char coremask[10]; #ifdef RTE_EXEC_ENV_LINUX char tmp[PATH_MAX] = { 0 }; char prefix[PATH_MAX] = { 0 }; get_current_prefix(tmp, sizeof(tmp)); snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); #else const char *prefix = ""; #endif /* good case, using secondary */ const char *const argv1[] = { prgname, "-c", coremask, "--proc-type=secondary", prefix }; snprintf(coremask, sizeof(coremask), "%x", (1 << rte_get_master_lcore())); ret = test_pdump_init(); ret |= launch_p(argv1); ret |= test_pdump_uninit(); return ret; } int test_pdump(void) { int ret = 0; if (rte_eal_process_type() == RTE_PROC_PRIMARY) { printf("IN PRIMARY PROCESS\n"); ret = run_pdump_server_tests(); if (ret < 0) return TEST_FAILED; } else if (rte_eal_process_type() == RTE_PROC_SECONDARY) { printf("IN SECONDARY PROCESS\n"); sleep(5); ret = run_pdump_client_tests(); if (ret < 0) return TEST_FAILED; } return TEST_SUCCESS; } REGISTER_TEST_COMMAND(pdump_autotest, test_pdump);
25d50ba19ce54df2cd24ac30013358530a005c46
c84462fed944505922efe37630e5da120ede84de
/components/voice_assistant/include/aia.h
dfcc1181fec2ca7833a70daab47ebfd2b2f4bf02
[ "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
stone-tong/esp-va-sdk
46c52195a4532fc8d2e1dfbec5a381cdd93c0e34
d2f67dbfb127fb8d48b708612304194070cb18be
refs/heads/master
2023-08-25T03:47:35.847499
2021-10-08T07:47:47
2021-10-08T07:47:47
null
0
0
null
null
null
null
UTF-8
C
false
false
2,038
h
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD // All rights reserved. #ifndef _AIA_H_ #define _AIA_H_ #include "voice_assistant.h" #include "auth_delegate.h" #include <mqtt_client.h> #include <alexa_smart_home.h> /* Once assigned by the application, these should not be freed as long as the device is working. */ typedef struct { /* Certificate of aws root CA */ char *aws_root_ca_pem_cert; /* Device certificate */ char *certificate_pem_crt_cert; /* Private Key */ char *private_pem_crt_cert; /* AWS Account ID */ char *aws_account_id; /* AWS End Point */ char *aws_endpoint; /* Client id used to communicate with the cloud */ char *client_id; } device_config_t; /** The Alexa Configuration Structure */ typedef struct { char *device_serial_num; char *product_id; device_config_t device_config; } aia_config_t; /** Initialize Alexa * * This call must be made after the Wi-Fi connection has been established with the configured Access Point. * * \param[in] cfg The Alexa Configuration * * \return * - 0 on Success * - an error code otherwise */ int aia_init(aia_config_t *cfg); int aia_early_init(); /** Initialise Alexa Bluetooth * * This enables Alexa's Bluetooth A2DP sink functionality. */ int alexa_bluetooth_init(); /** Enable Larger tones. * * This API will enable a tone which would be played if dialog is in progress and timer/alarm goes off. * Enabling this tone would increase size of binary by around 356 KB. */ void alexa_tone_enable_larger_tones(); void alexa_auth_delegate_signin(auth_delegate_config_t *cfg); void alexa_auth_delegate_signout(); void alexa_signin_handler(const char *client_id, const char *refresh_token); void alexa_signout_handler(); /* These APIs can be called to use the existing AIS mqtt client. */ /* This api givies the status of the aws_iot connection. */ bool alexa_mqtt_is_connected(); /** * @brief Get pointer to Alexa config */ aia_config_t *aia_get_cfg(); #endif /*_AIA_H_ */
6a9888a8110533c69354af0403faddd51b2a49f8
306ccac7f385456cb284f932a1952279df544da4
/main.c
5f3e39ce2673dc95fac9deb1ff0a3aaa858408d3
[]
no_license
hsdhatt/rb-tree
4d5c9f8dc33ad2b023dd18db7f84d8d238ca018d
a682ff6ceef6ec9d793c37e02e0246d8e76fa9b7
refs/heads/master
2016-08-10T23:19:59.021677
2016-01-31T08:40:33
2016-01-31T08:40:33
49,702,484
0
0
null
null
null
null
UTF-8
C
false
false
1,301
c
#include "tree.h" struct tree_node *rootptr; void insert(struct tree_node **ptr, int input_val) { if (*ptr == NULL) { *ptr = (struct tree_node *)malloc((sizeof(struct tree_node))); (*ptr)->val = input_val; (*ptr)->left = NULL; (*ptr)->right = NULL; (*ptr)->height = -1; (*ptr)->color = RED; LOG("node %p val %d\n", *ptr, (*ptr)->val); return; } if (input_val < (*ptr)->val) insert(&(*ptr)->left, input_val); else if (input_val > (*ptr)->val) insert(&(*ptr)->right, input_val); return; } void free_tree(struct tree_node *ptr) { if (ptr == NULL) return; free_tree(ptr->left); free_tree(ptr->right); LOG("free ptr %p data %d\n", ptr, ptr->val); free(ptr); return; } int main(int argc, char *argv[]) { int input_val; while(1) { printf("please enter a number, or 0 to exit\n"); scanf("%d",&input_val); if (input_val == 0) break; else { if (rootptr == NULL) { rootptr = (struct tree_node*)malloc(sizeof(*rootptr)); rootptr->val = input_val; rootptr->left = NULL; rootptr->right = NULL; rootptr->height = -1; rootptr->color = BLACK; } else { insert(&rootptr, input_val); check_properties(&rootptr, NULL); height(&rootptr, NULL); pretty_print(rootptr); } } } free_tree(rootptr); return 0; }
2aa95f124ece962d6667b63fb33b4614cc5c5f5e
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/reactos/dll/win32/usp10/extr_opentype.c_GPOS_get_value_record.c
d33d5e9d7ef555a91e3f50cdf3d42d5f811120ac
[]
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,679
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_3__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; struct TYPE_3__ {void* YAdvDevice; void* XAdvDevice; void* YPlaDevice; void* XPlaDevice; void* YAdvance; void* XAdvance; void* YPlacement; void* XPlacement; } ; typedef size_t INT ; typedef TYPE_1__ GPOS_ValueRecord ; /* Variables and functions */ void* GET_BE_WORD (int const) ; __attribute__((used)) static INT GPOS_get_value_record(WORD ValueFormat, const WORD data[], GPOS_ValueRecord *record) { INT offset = 0; if (ValueFormat & 0x0001) { if (data) record->XPlacement = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0002) { if (data) record->YPlacement = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0004) { if (data) record->XAdvance = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0008) { if (data) record->YAdvance = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0010) { if (data) record->XPlaDevice = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0020) { if (data) record->YPlaDevice = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0040) { if (data) record->XAdvDevice = GET_BE_WORD(data[offset]); offset++; } if (ValueFormat & 0x0080) { if (data) record->YAdvDevice = GET_BE_WORD(data[offset]); offset++; } return offset; }
b38cfbe692b31cc6b0005f9fc695a9b8aa93b5cb
cbd6c6a7c4e555e26c76dea6c827a3f36f8f449a
/SoftC/02/complex/complex_div.c
09c2f4b84a61a055327aad8e5a2ac71f5b8aa647
[ "MIT" ]
permissive
her0m31/Studys
8a71d4ae2552cf285d7a5e16b8a6c0f81e259106
f765310cd826356af04008a055905cade21fda4a
refs/heads/master
2020-12-24T08:46:39.155718
2016-08-17T16:48:51
2016-08-17T16:48:51
23,060,547
0
0
null
null
null
null
UTF-8
C
false
false
381
c
/* complex_div.c */ #include <stdio.h> #include "complex.h" struct complex div(struct complex x, struct complex y) { struct complex z; z.real = (x.real * y.real - x.imaginary * y.imaginary) / (x.real * x.real) + (y.imaginary * y.imaginary); z.imaginary = (x.real * y.imaginary + y.real * x.imaginary) / (x.real * x.real) + (y.imaginary * y.imaginary); return z; }
a5d16d0bdb0a64239f3691f33f69993f488e2a3f
bd1fea86d862456a2ec9f56d57f8948456d55ee6
/000/247/863/CWE78_OS_Command_Injection__wchar_t_file_execlp_64a.c
5a01812da3bbd079e6d6272c02e393a68af78702
[]
no_license
CU-0xff/juliet-cpp
d62b8485104d8a9160f29213368324c946f38274
d8586a217bc94cbcfeeec5d39b12d02e9c6045a2
refs/heads/master
2021-03-07T15:44:19.446957
2020-03-10T12:45:40
2020-03-10T12:45:40
246,275,244
0
1
null
null
null
null
UTF-8
C
false
false
3,561
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_file_execlp_64a.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-64a.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: file Read input from a file * GoodSource: Fixed string * Sinks: execlp * BadSink : execute command with wexeclp * Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"-c" #define COMMAND_ARG2 L"ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #ifdef _WIN32 #include <process.h> #define EXECLP _wexeclp #else /* NOT _WIN32 */ #define EXECLP execlp #endif #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__wchar_t_file_execlp_64b_badSink(void * dataVoidPtr); void CWE78_OS_Command_Injection__wchar_t_file_execlp_64_bad() { wchar_t * data; wchar_t dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; { /* Read input from a file */ size_t dataLen = wcslen(data); FILE * pFile; /* if there is room in data, attempt to read the input from a file */ if (100-dataLen > 1) { pFile = fopen(FILENAME, "r"); if (pFile != NULL) { /* POTENTIAL FLAW: Read data from a file */ if (fgetws(data+dataLen, (int)(100-dataLen), pFile) == NULL) { printLine("fgetws() failed"); /* Restore NUL terminator if fgetws fails */ data[dataLen] = L'\0'; } fclose(pFile); } } } CWE78_OS_Command_Injection__wchar_t_file_execlp_64b_badSink(&data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__wchar_t_file_execlp_64b_goodG2BSink(void * dataVoidPtr); static void goodG2B() { wchar_t * data; wchar_t dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; /* FIX: Append a fixed string to data (not user / external input) */ wcscat(data, L"*.*"); CWE78_OS_Command_Injection__wchar_t_file_execlp_64b_goodG2BSink(&data); } void CWE78_OS_Command_Injection__wchar_t_file_execlp_64_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__wchar_t_file_execlp_64_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__wchar_t_file_execlp_64_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
144a48d076963fdb482bc1724b2ced8c01a66316
bade93cbfc1f25160dfbe9493bfa83f853326475
/mwc/romana/relic/f/usr/include/sys/haiscsi.h
106602ae6c0478ed03c0fd62e3ea9bad217ee938
[ "BSD-3-Clause" ]
permissive
gspu/Coherent
c8a9b956b1126ffc34df3c874554ee2eb7194299
299bea1bb52a4dcc42a06eabd5b476fce77013ef
refs/heads/master
2021-12-01T17:49:53.618512
2021-11-25T22:27:12
2021-11-25T22:27:12
214,182,273
26
6
null
null
null
null
UTF-8
C
false
false
6,948
h
/*********************************************************************** * Module: haiscsi.h * * Constants and structures used to access SCSI devices through the * SCSI Driver in a Host Adapter inspecific manner. * * Copyright (c) 1993, Christopher Sean Hilton, All rights reserved. * * Last Modified: Fri Jul 23 15:38:08 1993 by [chris] * */ #ifndef __SYS_HAISCSI_H__ #define __SYS_HAISCSI_H__ #define SCSIMAJOR 13 #define MAXTID 7 #define MAXDEVS (MAXTID + 1) #define MAXLUN 7 #define MAXUNITS (MAXLUN + 1) #define ST_GOOD 0x00 /* Status Good. */ #define ST_CHKCOND 0x02 /* Check Condition */ #define ST_CONDMET 0x04 /* Condition Met */ #define ST_BUSY 0x08 /* Busy */ #define ST_INTERM 0x10 /* Intermediate */ #define ST_INTCDMET 0x14 /* Intermediate Condtion Met */ #define ST_RESCONF 0x18 /* Reservation Conflict */ #define ST_COMTERM 0x22 /* Command Terminated */ #define ST_QFULL 0x28 /* Queue Full */ #define ST_TIMEOUT 0x0101 /* Command Timed out */ #define ST_USRABRT 0x0102 /* User pressed ^C */ #define ST_DRVABRT 0x0103 /* Command Aborted by driver */ #define ST_HATMOUT 0x0201 /* Host adapter Timed out command */ #define ST_PENDING 0xffff /* Command Pending */ #define DMAREAD 0x0001 /* Command Reads from SCSI device */ #define DMAWRITE 0x0002 /* Command Writes to SCSI device */ #define SENSELEN 18 #define PHYS_ADDR 0x0000 /* Physical Address - (who knows) */ #define KRNL_ADDR 0x0001 /* Kernal Address */ #define USER_ADDR 0x0002 /* User Address (Anything goes) */ #define SYSGLBL_ADDR 0x0003 /* System Global address (yeah) */ /***** Minor Device Number Bits *****/ #define SPECIAL 0x80 /* Special Bit to flag boot block / Tape */ #define TIDMASK 0x70 #define LUNMASK 0x0c #define PARTMASK 0x03 #define TAPE 0x01 #define REWIND 0x02 #pragma align 1 typedef struct g0cmd_s *g0cmd_p; typedef struct g0cmd_s { unsigned char opcode; /* From opcode Table */ unsigned char lun_lba; /* LUN and high part of LBA */ unsigned char lba_mid; /* LBA Middle. */ unsigned char lba_low; /* LBA Low. */ unsigned char xfr_len; /* Transfer Length */ unsigned char control; /* Control byte. */ } g0cmd_t; typedef struct g1cmd_s *g1cmd_p; typedef struct g1cmd_s { unsigned char opcode; /* From opcode Table */ unsigned char lun; /* LUN */ unsigned long lba; /* LBA */ unsigned char pad1; /* Reserved */ unsigned short xfr_len; /* Transfer Length's MSB. */ unsigned char control; /* Control byte. */ } g1cmd_t; #define g2cmd_t g1cmd_t /* SCSI-2 Added Group 2 commands */ #define g2cmd_s g1cmd_s /* with the same size and layout as */ #define g2cmd_p g1cmd_p /* g1 commands. */ typedef struct g5cmd_s *g5cmd_p; typedef struct g5cmd_s { unsigned char opcode; /* From opcode Table */ unsigned char lun; /* LUN */ unsigned long lba; /* LBA's MSB */ unsigned char pad1[3]; /* Reserved */ unsigned short xfr_len; /* Transfer Length */ unsigned char control; /* Control byte. */ } g5cmd_t; typedef union cdb_u *cdb_p; typedef union cdb_u { g0cmd_t g0; g1cmd_t g1; g5cmd_t g5; } cdb_t; typedef struct sense_s *sense_p; typedef struct sense_s { unsigned char errorcode; /* Error Code: 0x0? */ unsigned char lba_msb; /* LSB's MS 5 Bits */ unsigned char lba_mid; /* Middle 8 bits */ unsigned char lba_lsb; /* LS 8 Bits */ } sense_t; typedef struct extsense_s *extsense_p; typedef struct extsense_s { unsigned char errorcode; /* Error Code (70H) */ unsigned char segmentnum; /* Number of current segment descriptor */ unsigned char sensekey; /* Sense Key(See bit definitions too) */ long info; /* Information MSB */ unsigned char addlen; /* Additional Sense Length */ unsigned char addbytes[1]; /* Additional Sense unsigned chars */ } extsense_t; #ifdef __KERNEL__ /***** Device Control Array *****/ typedef struct dca_s *dca_p; typedef struct dca_s { int (*d_open)(); /* open routine for device */ int (*d_close)(); /* close routine */ int (*d_block)(); /* Block request routine (Strategy) */ int (*d_read)(); /* Character Read routine */ int (*d_write)(); /* Character Write routine */ int (*d_ioctl)(); /* I/O Control routine */ int (*d_load)(); /* Load or Init routine */ int (*d_unload)(); /* Unload routine */ int (*d_poll)(); /* Poll routine */ } dca_t; typedef struct bufaddr_s *bufaddr_p; typedef struct bufaddr_s { int space; /* Address space */ union { paddr_t paddr; /* Physical Address */ caddr_t caddr; /* Virtual Address */ } addr; size_t size; /* Size of buffer */ } bufaddr_t; typedef struct srb_s *srb_p; /* SCSI Request Block */ typedef struct srb_s { unsigned short status; /* SCSI Status Byte */ unsigned short hastat; /* Host Adapter Status Byte */ dev_t dev; /* Device number (major/minor) */ unsigned char target; /* Target ID */ unsigned char lun; /* Logical Unit Number */ unsigned short tries; /* Current tries */ unsigned short timeout; /* Seconds til timeout */ bufaddr_t buf; /* Buffer to use */ unsigned short xferdir; /* Transfer Direction */ int (*cleanup)(); /* Cleanup Function. */ cdb_t cdb; /* Command to execute */ char sensebuf[SENSELEN]; } srb_t; #pragma align #ifdef HA_MODULE extern dca_p mdca[MAXDEVS]; #else extern int hapresent; #endif /*********************************************************************** * Host Adapter routines. * * These must be defined by the host adapter module. For each individual * routine's functionality see the host adapter module aha154x.c. */ extern void hatimer(); extern void haintr(); extern int hainit(); extern int startscsi(); extern void abortscsi(); extern void resetdevice(); extern void haihdgeta(); extern void haihdseta(); extern char iofailmsg[]; extern int HAI_HAID; #define bit(n) (1 << (n)) #define tid(d) (((d) & TIDMASK) >> 4) #define lun(d) (((d) & LUNMASK) >> 2) #define partn(d) (((d) & SPECIAL) ? 4 : ((d) & PARTMASK)) char *swapbytes(); #define flip(o) swapbytes(&(o), sizeof(o)) int cpycdb(); void reqsense(); void doscsi(); void printsense(); int printerror(); void haiioctl(); void hainonblk(); #endif /* KERNEL */ #endif /* !defined( __SYS_HAISCSI_H__ ) */ /* End of file */
f41288c4981852b82ef664c0f8020a277fed3b12
0edbcda83b7a9542f15f706573a8e21da51f6020
/private/inet/mshtml/tried/triedit/resource.h
137d94c6d92e08037125c1b06812c92c280e6e25
[]
no_license
yair-k/Win2000SRC
fe9f6f62e60e9bece135af15359bb80d3b65dc6a
fd809a81098565b33f52d0f65925159de8f4c337
refs/heads/main
2023-04-12T08:28:31.485426
2021-05-08T22:47:00
2021-05-08T22:47:00
365,623,923
1
3
null
null
null
null
UTF-8
C
false
false
2,131
h
//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Copyright (c)1997-1999 Microsoft Corporation, All Rights Reserved // Used by triedit.rc // #define IDS_PROJNAME 100 #define IDR_TRIEDITDOCUMENT 101 #define IDR_FEEDBACKRECTBMP 102 #define IDS_HTML 101 #define IDS_IEXP3 103 #define IDR_HTML 104 #define IDS_RFC1866 105 #define IDR_ASP 106 #define IDR_HTMPARSE 107 #define IDR_TRIEDITPARSE 107 #define IDS_GLYPHTABLE1 201 #define IDS_GLYPHTABLE2 202 #define IDS_GLYPHTABLE3 203 #define IDS_GLYPHTABLE4 204 #define IDS_GLYPHTABLE5 205 #define IDS_GLYPHTABLE6 206 #define IDS_GLYPHTABLE7 207 #define IDS_GLYPHTABLE8 208 #define IDS_GLYPHTABLE9 209 #define IDS_GLYPHTABLE10 210 #define IDS_GLYPHTABLE11 211 #define IDS_GLYPHTABLE12 212 #define IDS_GLYPHTABLE13 213 #define IDS_GLYPHTABLE14 214 #define IDS_GLYPHTABLE15 215 #define IDS_GLYPHTABLE16 216 #define IDS_GLYPHTABLE17 217 #define IDS_GLYPHTABLE18 218 #define IDS_GLYPHTABLE19 219 #define IDS_GLYPHTABLE20 220 #define IDS_GLYPHTABLE21 221 #define IDS_GLYPHTABLE22 222 #define IDS_GLYPHTABLE23 223 #define IDS_GLYPHTABLE24 224 #define IDS_GLYPHTABLESTART IDS_GLYPHTABLE1 #define IDS_GLYPHTABLEFORMEND IDS_GLYPHTABLE2 #define IDS_GLYPHTABLEEND IDS_GLYPHTABLE24 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 202 #define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_CONTROL_VALUE 201 #define _APS_NEXT_SYMED_VALUE 150 #endif #endif
f99a05d417f67388b33cffb87f65d36dab84e401
e4c82b7f3f0b00ef9ec41e40519ce4418243a792
/examples/drivers_bm/inc/led.h
e33309a60a1d3e87bfffb99555948afa2879e2bf
[]
no_license
sambranaivan/CIAA-Firmware
227f4b1d84fb1f9f5b048d3fc910c0f6b684d7bb
c4f688a50330d0d5ed15499c08aa5e17b75085f5
refs/heads/master
2021-01-22T23:07:23.526595
2017-06-21T20:55:36
2017-06-21T20:55:36
85,613,316
0
0
null
null
null
null
UTF-8
C
false
false
3,072
h
/* Copyright 2016, XXXXXXXXXX * All rights reserved. * * This file is part of CIAA Firmware. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #ifndef LED_H #define LED_H /** \brief Bare Metal example header file ** ** This is a mini example of the CIAA Firmware ** **/ /** \addtogroup CIAA_Firmware CIAA Firmware ** @{ */ /** \addtogroup Examples CIAA Firmware Examples ** @{ */ /** \addtogroup Baremetal Bare Metal example header file ** @{ */ /* * Initials Name * --------------------------- * */ /* * modification history (new versions first) * ----------------------------------------------------------- * yyyymmdd v0.0.1 initials initial version */ /*==================[inclusions]=============================================*/ #include "stdint.h" /*==================[macros]=================================================*/ #define lpc4337 1 #define mk60fx512vlq15 2 //#define TRUE 1 //#define FALSE 0 #define LED_ROJO 1 #define LED_VERDE 2 #define LED_AZUL 3 #define LED1 4 #define LED2 5 #define LED3 6 #define LED_PROTO 7 #define LED_GPIO8 8 /*==================[typedef]================================================*/ /*==================[external data declaration]==============================*/ void InitLed(void); void EncenderLed(uint8_t led); void ApagarLed(uint8_t led); void ApagarLeds(void); void CambiarLed(uint8_t led); /*==================[external functions declaration]=========================*/ /*==================[end of file]============================================*/ #endif /* #ifndef MI_NUEVO_PROYECTO_H */
4ae3d60c82ad0a184541b4426a71026ecb84d361
f79ef81e6e4e989ed14ed0283a9737f731101aab
/Unix Family/Linux.Urk/login/mailpath.c
4abf5cf49069b0457961af8181a5ee0af3cdb775
[ "MIT" ]
permissive
TheWover/Family
9d5597eda68aeee5e99de993176b6bd1366b57f1
f3ed1713c6b71823d8236b80148b60982dd906e1
refs/heads/master
2020-09-11T15:11:21.601776
2019-10-30T04:33:43
2019-10-30T04:33:43
222,106,609
3
4
MIT
2019-11-16T13:54:02
2019-11-16T13:54:01
null
UTF-8
C
false
false
2,495
c
#include "sys_defs.h" #include <stdio.h> #include <sys/param.h> #include <string.h> char *realpath(); #define _PATH_MAILDIR "/var/spool/mail" /* Macros to hide the differences between SunOS 4.x and SunOS 5.x. */ #ifdef USE_SYS_MNTTAB_H #include <sys/mnttab.h> #define _PATH_MTAB "/etc/mnttab" #define SETMNTENT(file,mode) fopen(file,mode) #define GETMNTENT(fp,mp) (getmntent(fp, mp) == 0) #define ENDMNTENT(fp) fclose(fp) #define SPECIAL(mp) (mp)->mnt_special #define MOUNTPOINT(mp) (mp)->mnt_mountp #else #include <mntent.h> #define _PATH_MTAB "/etc/mtab" #define SETMNTENT(file,mode) setmntent(file,mode) #define GETMNTENT(fp,mp) ((mp = getmntent(fp)) != 0) #define ENDMNTENT(fp) endmntent(fp) #define SPECIAL(mp) (mp)->mnt_fsname #define MOUNTPOINT(mp) (mp)->mnt_dir #endif /* mailpath - map homedir to mailbox path */ char *mail_path(home, user) char *home; char *user; { static char mailpath[BUFSIZ]; char home_info[BUFSIZ]; char real_home[MAXPATHLEN]; FILE *fp; int longest_match = 0; int len_mountp; char *cp; #ifdef SYSV4 struct mnttab mnt; #define mp (&mnt) #else struct mntent *mp; #endif /* * Try to deduce mailpath from home directory mount information. Use * /var/spool/mail/user when the mount is local, otherwise insert the * unqualified name of the home directory file server before the * username. */ if (realpath(home, real_home) && (fp = SETMNTENT(_PATH_MTAB, "r")) != 0) { while (GETMNTENT(fp, mp)) { len_mountp = strlen(MOUNTPOINT(mp)); if (len_mountp > longest_match && real_home[len_mountp] == '/' && strncmp(real_home, MOUNTPOINT(mp), len_mountp) == 0) { longest_match = len_mountp; strcpy(home_info, SPECIAL(mp)); } } ENDMNTENT(fp); } /* * If the home directory comes from a remote host the filesystem name is * of the form host:/some/path. Truncate the host to unqualified form. */ if (longest_match > 0 && (cp = strchr(home_info, ':')) != 0) { *cp = 0; if ((cp = strchr(home_info, '.')) != 0) *cp = 0; sprintf(mailpath, "%s/%s/%s", _PATH_MAILDIR, home_info, user); } else { sprintf(mailpath, "%s/%s", _PATH_MAILDIR, user); } return (mailpath); } #ifdef STANDALONE #include <pwd.h> main() { struct passwd *pwd; if ((pwd = getpwuid(getuid())) == 0) { fprintf(stderr, "Who are you?\n"); exit(1); } printf("%s\n", mail_path(pwd->pw_dir, pwd->pw_name)); } #endif
940c7c38f1a8ed5950786b52ae39a27919fc07e4
230764d82733fac64c3e0eae1ce0a4030965dc4a
/third_party/gst-plugins-bad/ext/sctp/gstsctpdec.h
845fac4d41e1a7d5e07f95d71731f5ea009ba3bd
[ "BSD-3-Clause", "LGPL-2.1-only", "LGPL-2.0-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
isabella232/aistreams
478f6ae94189aecdfd9a9cc19742bcb4b4e20bcc
209f4385425405676a581a749bb915e257dbc1c1
refs/heads/master
2023-03-06T14:49:27.864415
2020-09-25T19:48:04
2020-09-25T19:48:04
298,772,653
0
0
Apache-2.0
2021-02-23T10:11:29
2020-09-26T08:40:34
null
UTF-8
C
false
false
2,392
h
/* * Copyright (c) 2015, Collabora Ltd. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT 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 __GST_SCTP_DEC_H__ #define __GST_SCTP_DEC_H__ #include <gst/gst.h> #include "sctpassociation.h" G_BEGIN_DECLS #define GST_TYPE_SCTP_DEC (gst_sctp_dec_get_type()) #define GST_SCTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_SCTP_DEC, GstSctpDec)) #define GST_SCTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SCTP_DEC, GstSctpDecClass)) #define GST_IS_SCTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SCTP_DEC)) #define GST_IS_SCTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SCTP_DEC)) typedef struct _GstSctpDec GstSctpDec; typedef struct _GstSctpDecClass GstSctpDecClass; struct _GstSctpDec { GstElement element; GstPad *sink_pad; guint sctp_association_id; guint local_sctp_port; GstSctpAssociation *sctp_association; gulong signal_handler_stream_reset; }; struct _GstSctpDecClass { GstElementClass parent_class; void (*on_reset_stream) (GstSctpDec * sctp_dec, guint stream_id); }; GType gst_sctp_dec_get_type (void); G_END_DECLS #endif /* __GST_SCTP_DEC_H__ */
cc9fbe2e0c31cb370023e9c0c0501c0a296de073
9d9aca7551e69a2538fb47d001bbdc3eea8c3f08
/src/utils/dynamic_string_utils.c
95f853af9a6edeea6703c310cd9cace33771123f
[]
no_license
hugoBuissez/42sh
d226d09b36d5ec8d70358d54baee1969d42e07ca
ad85735ce87edbcaad102b5d68f54e738b309ff6
refs/heads/master
2023-03-30T12:24:33.448736
2021-03-29T19:19:16
2021-03-29T19:19:16
337,054,088
0
0
null
null
null
null
UTF-8
C
false
false
318
c
#include <string.h> #include "dynamic_string.h" #include "dynamic_string_internals.h" size_t string_len(struct d_string *string) { return string->len; } char *string_value(struct d_string *string) { return string->buf; } char *string_value_copy(struct d_string *string) { return strdup(string->buf); }
1a84fd48db74e0b1d33acc91009783f1086d8965
f363fdb9445d8dec088fb02c8faae8e23570a33e
/d/mingjiao/obj/bag.c
d9ad524752f60078e1e2a34f5de2050b84bd441a
[]
no_license
MudRen/zjmud
0999a492ac0717911c047936ee2c696b3b5cb20a
c56a166380d74858d7b4f0ba2817478ccea6b83d
refs/heads/main
2023-07-24T21:02:00.246591
2021-09-07T12:50:20
2021-09-07T12:50:20
403,973,627
1
1
null
null
null
null
GB18030
C
false
false
1,051
c
// bag.c #include <ansi.h> inherit ITEM; void create() { set_name("油布包", ({ "bag", "bao" })); set_weight(200); if (clonep()) set_default_object(__FILE__); else { set("unit", "个"); set("long", "这是一个油布包裹。\n"); set("value", 500); set("material", "cloth"); } set("book_count", 0); } void init() { if (this_player() == environment()) { add_action("do_open", "open"); add_action("do_open", "unpack"); add_action("do_open", "dakai"); } } int do_open(string arg) { object me, book; object where; if (! arg || ! id(arg)) return 0; if (query("book_count") < 1) { write("油布包里面什么也没有了。\n"); return 1; } me = this_player(); where = environment(me); message_vision("$N轻轻地把油布包来看时,里面原来是一本" "薄薄的经书,只因油布包得紧密,虽长期藏" "在猿腹之中,书页仍然完好无损。\n", me); book = new("/clone/book/jiuyang-book"); book->move(file_name(where)); add("book_count", -1); return 1; }
ce3257df27c9ca159eb2b44594d23cce7b01e0f8
45a175e1a470bf15f4a2aa5b066250d6f8ec5327
/embox/src/profiler/tracing/no_trace.c
e7ebc4585e357a421dbd9651566018fd80530d77
[ "BSD-2-Clause" ]
permissive
Walkingmind/embox
8315ee532d9e0a0ccd5e566bf4feac5ffe58d683
67cc5f73466e1a4c33891b946fc8e8217ce26ade
refs/heads/master
2021-01-01T17:22:48.903024
2015-04-14T20:24:43
2015-04-14T20:24:43
35,509,406
2
0
null
null
null
null
UTF-8
C
false
false
435
c
/** * @file * @brief * * @author Anton Kozlov * @date 29.04.2013 */ #include <stddef.h> #include <profiler/tracing/trace.h> time64_t trace_block_diff(struct __trace_block *tb) { return -1; } time64_t trace_block_get_time(struct __trace_block *tb) { return -1; } int trace_point_get_value(struct __trace_point *tp) { return -1; } struct __trace_point *trace_point_get_by_name(const char *name) { return NULL; }
[ "drakon.mega@5c469cbc-2eb3-11df-bba7-995ec2794b1c" ]
drakon.mega@5c469cbc-2eb3-11df-bba7-995ec2794b1c
68eeeb84c8d955af76bca65e578796fde7276871
4a7d20f21763809b9a061b95d1f308055f5a3fdf
/binarisation/bin_treshold.c
052676fb3be42becbe987e51239967f5295b5c5c
[]
no_license
multun/OCRe
ecd6b1bd57de25a91d4eea75edaa706a3b6b553e
c83b0a39af5136aa34e6921df1974a0efffad081
refs/heads/master
2021-01-19T03:09:44.697167
2016-12-05T14:54:45
2016-12-05T14:54:45
67,486,305
0
0
null
null
null
null
UTF-8
C
false
false
609
c
#include <stdlib.h> #include "binarise.h" #include "../bitmap/img.h" void bw_img_treshold(unsigned char treshold, t_bw_img *img) { unsigned int width = img->width; unsigned int height = img->height; for(unsigned int x = 0; x < width; x++) for(unsigned int y = 0; y < height; y++) { unsigned int offset = y * width + x; img->pixels[offset] = (img->pixels[offset] > treshold) ? 255 : 0; } } t_bw_img *bin_treshold(unsigned char treshold, const t_color_img *orig_img) { t_bw_img *bw_img = greyscale(intensity, orig_img); bw_img_treshold(treshold, bw_img); return bw_img; }
6768b81c1820aa74ee43e72bf88812a00df5642b
e5b45ef28d128f072e5cc318371731b0fbdd4399
/DataStructure/Tree/BinaryTree/BinaryTree/LinkedQueue.c
dd4c2ddac6548ea823c1cf46c05ec72b2b660a17
[]
no_license
KianaGX/test
8e12550bef48f689d9d9abace0bd1efefe045586
15ba7dcd6cf114b6ca45a4f8442f08c202bfaff9
refs/heads/master
2022-12-08T08:00:03.152204
2020-08-29T15:42:56
2020-08-29T15:42:56
null
0
0
null
null
null
null
UTF-8
C
false
false
1,074
c
#include "BinaryTree.h" #include "LinkedQueue.h" void QueueInit(Queue* q) { q->front = q->rear = NULL; } DataType QueueFront(Queue* q) { assert(q); return q->front->val; } DataType QueueBack(Queue* q) { assert(q); return q->rear->val; } int QueueEmpty(Queue* q) { return q->front ? 0 : 1; } int QueueSize(Queue* q) { assert(q); QNode* cur = q->front; int count = 0; while (cur) { count++; cur = cur->next; } return count; } void QueuePush(Queue* q, DataType val) { assert(q); QNode* node = (QNode*)malloc(sizeof(QNode)); node->val = val; node->next = NULL; if (q->rear) { q->rear->next = node; q->rear = node; } else { q->front = q->rear = node; } } void QueuePop(Queue* q) { assert(q); if (NULL == q->front->next) { free(q->front); q->front = q->rear = NULL; } else { QNode* next = q->front->next; free(q->front); q->front = next; } } void QueueDestroy(Queue* q) { assert(q); QNode* cur = q->front; while (cur) { QNode* next = cur->next; free(cur); cur = next; } q->front = q->rear = NULL; }
f14c1817cd3baa4613c4c7510c4b367ba5a67976
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/media/usb/cx231xx/extr_cx231xx-i2c.c_cx231xx_i2c_mux_unregister.c
2bb4865bfe7f8ebe5de35cbfb65d2c612f2ce254
[]
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
594
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 cx231xx {int /*<<< orphan*/ muxc; } ; /* Variables and functions */ int /*<<< orphan*/ i2c_mux_del_adapters (int /*<<< orphan*/ ) ; void cx231xx_i2c_mux_unregister(struct cx231xx *dev) { i2c_mux_del_adapters(dev->muxc); }
14f2918893608dcbda814d000ec27731854b2efb
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/media/usb/gspca/extr_stk1135.c_stk1135_camera_disable.c
e22540920d879d43fd93bf2f3e8ff9b920e0cf26
[]
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,635
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 gspca_dev {int dummy; } ; /* Variables and functions */ scalar_t__ STK1135_REG_CIEPO ; scalar_t__ STK1135_REG_GCTRL ; scalar_t__ STK1135_REG_SCTRL ; scalar_t__ STK1135_REG_SENSO ; scalar_t__ STK1135_REG_TMGEN ; int /*<<< orphan*/ reg_w (struct gspca_dev*,scalar_t__,int) ; int /*<<< orphan*/ reg_w_mask (struct gspca_dev*,scalar_t__,int,int) ; int /*<<< orphan*/ sensor_write_mask (struct gspca_dev*,int,int,int) ; __attribute__((used)) static void stk1135_camera_disable(struct gspca_dev *gspca_dev) { /* set capture end Y position to 0 */ reg_w(gspca_dev, STK1135_REG_CIEPO + 2, 0x00); reg_w(gspca_dev, STK1135_REG_CIEPO + 3, 0x00); /* disable capture */ reg_w_mask(gspca_dev, STK1135_REG_SCTRL, 0x00, 0x80); /* enable sensor standby and diasble chip enable */ sensor_write_mask(gspca_dev, 0x00d, 0x0004, 0x000c); /* disable PLL */ reg_w_mask(gspca_dev, STK1135_REG_SENSO + 2, 0x00, 0x01); /* disable timing generator */ reg_w(gspca_dev, STK1135_REG_TMGEN, 0x00); /* enable STOP clock */ reg_w(gspca_dev, STK1135_REG_SENSO + 1, 0x20); /* disable CLKOUT for sensor */ reg_w(gspca_dev, STK1135_REG_SENSO, 0x00); /* disable sensor (GPIO5) and enable GPIO0,3,6 (?) - sensor standby? */ reg_w(gspca_dev, STK1135_REG_GCTRL, 0x49); }
7621f686f4f137181a8477b3f7270dd9ce2e0214
20673ba95c7aae14500531d3bb909ec3a10f2553
/src/renderer.c
f8917f4913913cbba246544337a0608ee7d427e8
[]
no_license
NaviRice/renderer
514bd73791d91af8d8be057aea9986c470e0d6ca
9e138968a3b588e36da2623395495a1b17e9527f
refs/heads/master
2021-09-12T19:24:51.640404
2018-04-20T03:33:30
2018-04-20T03:33:30
110,404,707
1
0
null
2017-12-02T22:10:26
2017-11-12T04:28:52
C
UTF-8
C
false
false
2,944
c
//Sys includes //local includes #include "globaldefs.h" #include "renderer.h" //#include "glmanager.h" #include "glfwmanager.h" //init #include "glmanager.h" //init #include "cvarmanager.h" #include "matrixlib.h" #include "entitymanager.h" //init #include "contextmanager.h" #include "headclient.h" #include "naviclient.h" #include "navmanager.h" #include "gamecodemanager.h" extern double glfwGetTime(void); int shutitdown(){ printf("Shutting down\n"); gl_shutdown(); glfw_shutdown(); entity_shutdown(); cvar_shutdown(); //todo return FALSE; } cvarcallback_t CVAR_test_callbacks[] = {cvar_print, 0}; cvar_t CVAR_test = {CVAR_SAVEABLE, "test", "testing help text", "53.5"}; int main(int argc, char *argv[]){ if(!cvar_init()){printf("Unable to init cvar\n"); shutitdown(); return 1;} cvar_register(&CVAR_test); cvar_t *ctest = cvar_findByNameRPOINT("test"); cvar_print(ctest); CVAR_test.onchanges = CVAR_test_callbacks; cvar_set("test", "127.1 101.0 53.2222"); cvar_unregister(ctest->myid); // if(!entity_init()){printf("Unable to init entity\n"); shutitdown(); return 4;} if(!glfw_init(800, 600, 24,1)){printf("Unable to init glfw\n"); shutitdown(); return 2;} if(!gl_init()){printf("Unable to init gl\n"); shutitdown(); return 3;} if(!gamecode_init()){printf("Unable to init gamecode\n"); shutitdown(); return 4;} //todo move to gamecode but whatever naviclient_init(); headclient_init(); nav_init(); double t, to; to=glfwGetTime(); double timesincelastfpsupdate = 0.0; int framecount = 0; double accum = 0.0; while(TRUE){ //temp t = glfwGetTime(); double delta = t-to; to = t; timesincelastfpsupdate+=delta; if(timesincelastfpsupdate > 5.0){ printf("%f fps: %i frames in %f seconds: %f ms per frame\n", (float)framecount/(float)timesincelastfpsupdate, framecount, timesincelastfpsupdate, 1000.0*(float)timesincelastfpsupdate / (float) framecount); framecount = 0; timesincelastfpsupdate = 0; } framecount++; accum += delta; //grab most recent head glfw_checkEvent(); //todo figure out if thise should be reordered headclient_update(t); naviclient_update(t); // if(t > 1.0){ // t = 1.0; // accum = 0.0; // } // t = 7.0; while(accum * 1000.0 > GCTIMESTEP){ gamecode_tick(); accum -= (double)GCTIMESTEP/1000.0; } // headclient_update(); #ifdef USENEWRENDERER context_switch(0); gl_setupFirstbounceForRender(t); gl_setupWorldForRender(t); gl_setupDebugForRender(t); gl_renderFirstbounce(t); gl_renderScreen(t); glfw_swapBuffers(); context_switch(1); gl_renderDebug(t); glfw_swapBuffers(); #else //todo recalc viewport stuff here context_switch(0); gl_renderWorld(t); gl_renderFirstbounce(t); gl_renderFrame(t); glfw_swapBuffers(); context_switch(1); //todo move to context 1 once i verify that it worky gl_renderDebug(t); glfw_swapBuffers(); #endif } shutitdown(); return FALSE; }
22d8c27df35e15fd5827d0a9e19caa737dced759
97aab27d4410969e589ae408b2724d0faa5039e2
/CPU/SRCS/kos-1.2.0/kernel/arch/dreamcast/hardware/pvr/pvr_fog_tables.h
702ee3a2648117851c2bfcf3a2078a85db2e3241
[]
no_license
FutureWang123/dreamcast-docs
82e4226cb1915f8772418373d5cb517713f858e2
58027aeb669a80aa783a6d2cdcd2d161fd50d359
refs/heads/master
2021-10-26T00:04:25.414629
2018-08-10T21:20:37
2018-08-10T21:20:37
null
0
0
null
null
null
null
UTF-8
C
false
false
7,909
h
/* Kallistios 1.2.0 pvr_fog_tables.h (C)2002 Paul Boese Portions (C)1999-2001, Brian Paul $Id: pvr_fog_tables.h,v 1.2 2002/02/17 03:43:16 axlen Exp $ */ #ifndef __PVR_FOG_TABLES_H #define __PVR_FOG_TABLES_H /* This table is used by the pvr_fog.c module to scale values for the PVR's fog table. It can be used directly with each value multiplied by 255 to make perspectively correct table values for linear fog. The table does not include the value of 1.0 which represents full visual occlusion. */ float inverse_w_depth[] = { 0.94118, 0.88889, 0.84211, 0.80000, 0.76190, 0.72727, 0.69565, 0.66667, 0.64000, 0.61538, 0.59259, 0.57143, 0.55172, 0.53333, 0.51613, 0.50000, 0.47059, 0.44444, 0.42105, 0.40000, 0.38095, 0.36364, 0.34783, 0.33333, 0.32000, 0.30769, 0.29630, 0.28571, 0.27586, 0.26667, 0.25806, 0.25000, 0.23529, 0.22222, 0.21053, 0.20000, 0.19048, 0.18182, 0.17391, 0.16667, 0.16000, 0.15385, 0.14815, 0.14286, 0.13793, 0.13333, 0.12903, 0.12500, 0.11765, 0.11111, 0.10526, 0.10000, 0.09524, 0.09091, 0.08696, 0.08333, 0.08000, 0.07692, 0.07407, 0.07143, 0.06897, 0.06667, 0.06452, 0.06250, 0.05882, 0.05556, 0.05263, 0.05000, 0.04762, 0.04545, 0.04348, 0.04167, 0.04000, 0.03846, 0.03704, 0.03571, 0.03448, 0.03333, 0.03226, 0.03125, 0.02941, 0.02778, 0.02632, 0.02500, 0.02381, 0.02273, 0.02174, 0.02083, 0.02000, 0.01923, 0.01852, 0.01786, 0.01724, 0.01667, 0.01613, 0.01562, 0.01471, 0.01389, 0.01316, 0.01250, 0.01190, 0.01136, 0.01087, 0.01042, 0.01000, 0.00962, 0.00926, 0.00893, 0.00862, 0.00833, 0.00806, 0.00781, 0.00735, 0.00694, 0.00658, 0.00625, 0.00595, 0.00568, 0.00543, 0.00521, 0.00500, 0.00481, 0.00463, 0.00446, 0.00431, 0.00417, 0.00403, 0.00391, }; /* Code to generate the preceeding inverse_w_depth[] table #include <stdio.h> #include <math.h> int main () { int i, j; float t; printf("float inverse_w_depth[] = {\n\t"); for( i=1; i<=128; i++) { j = i; t = (pow(2.0, j>>4) * ((j&0xf)+16)/16.0f)/1.0f; printf("%01.5f,%s", 1.0f/t, ((i)%8)?" ":"\n\t"); } printf("\n};\n"); return 0; } */ /* * This is essentially the same table as above except each value has been * multiplied by 259.999999. This table is used by the EXP and EXP2 * fog functions in pvr_fog.c. It just saves us one multiplcation per table * entry. */ float inverse_w_depth260[] = { 244.706, 231.111, 218.947, 208.000, 198.095, 189.091, 180.870, 173.333, 166.400, 160.000, 154.074, 148.571, 143.448, 138.667, 134.194, 130.000, 122.353, 115.556, 109.474, 104.000, 99.048, 94.545, 90.435, 86.667, 83.200, 80.000, 77.037, 74.286, 71.724, 69.333, 67.097, 65.000, 61.176, 57.778, 54.737, 52.000, 49.524, 47.273, 45.217, 43.333, 41.600, 40.000, 38.519, 37.143, 35.862, 34.667, 33.548, 32.500, 30.588, 28.889, 27.368, 26.000, 24.762, 23.636, 22.609, 21.667, 20.800, 20.000, 19.259, 18.571, 17.931, 17.333, 16.774, 16.250, 15.294, 14.444, 13.684, 13.000, 12.381, 11.818, 11.304, 10.833, 10.400, 10.000, 9.630, 9.286, 8.966, 8.667, 8.387, 8.125, 7.647, 7.222, 6.842, 6.500, 6.190, 5.909, 5.652, 5.417, 5.200, 5.000, 4.815, 4.643, 4.483, 4.333, 4.194, 4.062, 3.824, 3.611, 3.421, 3.250, 3.095, 2.955, 2.826, 2.708, 2.600, 2.500, 2.407, 2.321, 2.241, 2.167, 2.097, 2.031, 1.912, 1.806, 1.711, 1.625, 1.548, 1.477, 1.413, 1.354, 1.300, 1.250, 1.204, 1.161, 1.121, 1.083, 1.048, 1.016, }; /* Code to generate the preceeding inverse_w_depth260[] table #include <stdio.h> #include <math.h> int main () { int i, j; float t; printf("float inverse_w_depth260[] = {\n\t"); for( i=1; i<=128; i++) { j = i; t = (pow(2.0, j>>4) * ((j&0xf)+16)/16.0f)/259.999999f; printf("%03.3f,%s", 1.0f/t, ((i)%8)?" ":"\n\t"); } printf("\n};\n"); return 0; } */ /* lookup table for the fast neg_exp function */ static float exp_table[] = { 1.00000000, 0.96169060, 0.92484879, 0.88941842, 0.85534531, 0.82257754, 0.79106510, 0.76075989, 0.73161560, 0.70358789, 0.67663383, 0.65071243, 0.62578398, 0.60181057, 0.57875562, 0.55658382, 0.53526145, 0.51475590, 0.49503589, 0.47607136, 0.45783335, 0.44029403, 0.42342663, 0.40720543, 0.39160562, 0.37660345, 0.36217600, 0.34830126, 0.33495805, 0.32212600, 0.30978554, 0.29791784, 0.28650481, 0.27552897, 0.26497361, 0.25482264, 0.24506053, 0.23567241, 0.22664395, 0.21796136, 0.20961139, 0.20158130, 0.19385885, 0.18643223, 0.17929012, 0.17242162, 0.16581626, 0.15946393, 0.15335497, 0.14748003, 0.14183016, 0.13639674, 0.13117145, 0.12614636, 0.12131377, 0.11666631, 0.11219689, 0.10789870, 0.10376516, 0.09978998, 0.09596708, 0.09229065, 0.08875505, 0.08535489, 0.08208500, 0.07894037, 0.07591622, 0.07300791, 0.07021102, 0.06752128, 0.06493458, 0.06244697, 0.06005467, 0.05775401, 0.05554149, 0.05341373, 0.05136748, 0.04939962, 0.04750715, 0.04568718, 0.04393693, 0.04225374, 0.04063502, 0.03907832, 0.03758125, 0.03614154, 0.03475698, 0.03342546, 0.03214495, 0.03091349, 0.02972922, 0.02859031, 0.02749503, 0.02644171, 0.02542875, 0.02445459, 0.02351775, 0.02261679, 0.02175036, 0.02091712, 0.02011579, 0.01934517, 0.01860407, 0.01789136, 0.01720595, 0.01654680, 0.01591290, 0.01530329, 0.01471703, 0.01415323, 0.01361103, 0.01308960, 0.01258814, 0.01210590, 0.01164213, 0.01119613, 0.01076721, 0.01035472, 0.00995804, 0.00957655, 0.00920968, 0.00885686, 0.00851756, 0.00819126, 0.00787746, 0.00757568, 0.00728546, 0.00700636, 0.00673795, 0.00647982, 0.00623158, 0.00599285, 0.00576327, 0.00554248, 0.00533015, 0.00512596, 0.00492959, 0.00474074, 0.00455912, 0.00438447, 0.00421650, 0.00405497, 0.00389962, 0.00375023, 0.00360656, 0.00346840, 0.00333553, 0.00320774, 0.00308486, 0.00296668, 0.00285303, 0.00274373, 0.00263862, 0.00253753, 0.00244032, 0.00234684, 0.00225693, 0.00217047, 0.00208732, 0.00200735, 0.00193045, 0.00185650, 0.00178538, 0.00171698, 0.00165120, 0.00158795, 0.00152711, 0.00146861, 0.00141235, 0.00135824, 0.00130621, 0.00125617, 0.00120805, 0.00116177, 0.00111726, 0.00107446, 0.00103330, 0.00099371, 0.00095564, 0.00091903, 0.00088383, 0.00084997, 0.00081741, 0.00078609, 0.00075598, 0.00072702, 0.00069916, 0.00067238, 0.00064662, 0.00062185, 0.00059803, 0.00057512, 0.00055308, 0.00053190, 0.00051152, 0.00049192, 0.00047308, 0.00045495, 0.00043753, 0.00042076, 0.00040465, 0.00038914, 0.00037424, 0.00035990, 0.00034611, 0.00033285, 0.00032010, 0.00030784, 0.00029604, 0.00028470, 0.00027380, 0.00026331, 0.00025322, 0.00024352, 0.00023419, 0.00022522, 0.00021659, 0.00020829, 0.00020031, 0.00019264, 0.00018526, 0.00017816, 0.00017134, 0.00016477, 0.00015846, 0.00015239, 0.00014655, 0.00014094, 0.00013554, 0.00013035, 0.00012535, 0.00012055, 0.00011593, 0.00011149, 0.00010722, 0.00010311, 0.00009916, 0.00009536, 0.00009171, 0.00008820, 0.00008482, 0.00008157, 0.00007844, 0.00007544, 0.00007255, 0.00006977, 0.00006710, 0.00006453, 0.00006205, 0.00005968, 0.00005739, 0.00005519, 0.00005308, 0.00005104, 0.00004909, 0.00004721, }; /* code to generate the preceeding table #include <stdio.h> #include <math.h> #define FOG_EXP_TABLE_SIZE 256 #define FOG_MAX (10.0) #define FOG_INCR (FOG_MAX/FOG_EXP_TABLE_SIZE) int main () { float value, f = 0.0F; int i = 0; printf("static float exp_table[FOG_EXP_TABLE_SIZE] = {\n\t"); for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { value = (float) exp(-f); printf("%01.8f, %s", value, ((i+1)%4)?" ":"\n\t"); } printf("\n};\n"); return 0; } */ #endif
27e510a7b3c18aec93f737171bf71ac1ef87bf19
86e708d6eea4b2be0a6f54667dcc08dac7ec3a37
/os/lib/fork.c
ba45119a17f3c8f0dffe2d64b3a4380a5ed4032c
[]
no_license
aaandrewww/authcontrol
0566acac31043e9c39d10ca3af1ddae0100a4563
98dc3249484fdc692bcba8e788f479121f7be808
refs/heads/master
2021-01-17T13:00:37.475296
2015-08-31T00:46:49
2015-08-31T00:46:49
41,648,058
0
0
null
null
null
null
UTF-8
C
false
false
5,337
c
// implement fork from user space #include <inc/string.h> #include <inc/lib.h> // PTE_COW marks copy-on-write page table entries. // It is one of the bits explicitly allocated to user processes (PTE_AVAIL). #define PTE_COW 0x800 static bool is_mapped(uintptr_t va, pte_t *pte_store) { if ((vpd[PDX(va)] & PTE_P) && (vpt[PGNUM(va)] & PTE_P)) { if (pte_store) *pte_store = vpt[PGNUM(va)]; return true; } else { return false; } } // // Custom page fault handler - if faulting page is copy-on-write, // map in our own private writable copy and call resume(utf). // static void pgfault(struct UTrapframe *utf) { void *addr = (void *) utf->utf_fault_va; uint32_t err = utf->utf_err; int r; void *faultpage = (void *)ROUNDDOWN((uintptr_t)addr,PGSIZE); pte_t pte; // Check that the faulting access was (1) a write, and (2) to a // copy-on-write page. If not, return 0. // Hint: Use vpd and vpt. // cprintf(">> in page fault handler!\n"); // Check fault was a write if (!(err & 2)) return; // cprintf(">> was a write!\n"); // Check that the page was COW if ((r = is_mapped((uintptr_t)faultpage, &pte)) < 0) return; if (!(pte & PTE_COW)) return; // cprintf(">> was COW\n"); // Allocate a new page, map it at a temporary location (PFTEMP), // copy the data from the old page to the new page, then move the new // page to the old page's address. // Hint: // You should make three system calls. // No need to explicitly delete the old page's mapping. // LAB 4: Your code here. if ((r = sys_page_alloc(0, PFTEMP, PTE_U | PTE_W)) < 0) panic("Couldn't allocate PFTEMP"); memcpy(PFTEMP,faultpage,PGSIZE); if ((r = sys_page_map(0, PFTEMP, 0, faultpage, PTE_U | PTE_W)) < 0) panic("Couldn't remap faulted page"); if ((r = sys_page_unmap(0, PFTEMP)) < 0) panic("Couldn't unmap PFTEMP"); resume(utf); } // // Map our virtual page pn (address pn*PGSIZE) into the target envid // at the same virtual address. If the page is writable or copy-on-write, // the new mapping must be created copy-on-write, and then our mapping must be // marked copy-on-write as well. (Exercise: Why do we need to mark ours // copy-on-write again if it was already copy-on-write at the beginning of // this function?) // // Returns: 0 on success, < 0 on error. // It is also OK to panic on error. // static int duppage(envid_t envid, uintptr_t va) { int r; pte_t pte; pte_t perms; if (is_mapped(va, &pte)) { perms = pte & PTE_SYSCALL; // pa is the physical address corresponding to va if (pte & PTE_SHARE) { if ((r = sys_page_map(0, (void *)va, envid, (void *)va, perms)) < 0) return r; } else if ((pte & PTE_W) || (pte & PTE_COW)) { // cprintf("[%08x] Duplicating W or COW page %p\n", thisenv->env_id, va); perms = (perms & ~PTE_W) | PTE_COW; if ((r = sys_page_map(0, (void *)va, envid, (void *)va, perms)) < 0) return r; // Change perms to COW if ((r = sys_page_map(0, (void *)va, 0, UTEMP, perms)) < 0) return r; if ((r = sys_page_map(0, UTEMP, 0, (void *)va, perms)) < 0) return r; if ((r = sys_page_unmap(0, UTEMP)) < 0) return r; } else { // cprintf("[%08x] Duplicating R page %p\n", thisenv->env_id, va); if ((r = sys_page_map(0, (void *)va, envid, (void *)va, perms)) < 0) return r; } } return 0; } // // User-level fork with copy-on-write. // Set up our page fault handler appropriately. // Create a child. // Copy our address space and page fault handler setup to the child. // Then mark the child as runnable and return. // // Returns: child's envid to the parent, 0 to the child, < 0 on error. // It is also OK to panic on error. // // Hint: // Use vpd, vpt, and duppage. // Remember to fix "thisenv" in the child process. // Neither user exception stack should ever be marked copy-on-write, // so you must allocate a new page for the child's user exception stack. // envid_t fork(void) { int ret; envid_t child; // LAB 4: Your code here. // 1. Install pgfault() as the page fault handler add_pgfault_handler(pgfault); // cprintf("pgfault handler %p\n", pgfault); // 2. Allocate a child environment with sys_exofork() if ((child = sys_exofork()) < 0) return child; // cprintf("child [%08x]\n", child); if (child == 0) { // Fix thisenv and return 0 thisenv = &envs[ENVX(sys_getenvid())]; return 0; } // cprintf("Set up COW pages\n"); // 3. Set up COW pages for (uintptr_t page = 0; page < UTOP; page += PGSIZE) { if (page == UXSTACKTOP-PGSIZE) continue; if (is_mapped(page,NULL)) { if ((ret = duppage(child,page)) < 0) { sys_env_destroy(child); return ret; } } } // cprintf("Allocated exception stack at %p\n", UXSTACKTOP-PGSIZE); // 4. Allocate exception stack if ((ret = sys_page_alloc(child, (void *)(UXSTACKTOP-PGSIZE), PTE_U | PTE_W)) < 0) { sys_env_destroy(child); return ret; } // cprintf("Set up the page fault handler\n"); // 5. Set up the page fault handler in the child if ((ret = sys_env_set_pgfault_upcall(child, (void *)thisenv->env_pgfault_upcall)) < 0) { sys_env_destroy(child); return ret; } // cprintf("Make the child runnable\n"); // 6. Mark the child runnable if ((ret = sys_env_set_status(child, ENV_RUNNABLE)) < 0) { sys_env_destroy(child); return ret; } return child; } // Challenge! int sfork(void) { panic("sfork not implemented"); return -E_INVAL; }
2ad1dab2671c5ab440f9cc78e71695268655b683
05c9e83414ffd72e9d2ff51a714f0152b8ad5d5d
/src/sys/arch/amd64/compile/MYKERNEL/opt_x86emu.h
4621793b634a462d5bc879706283fd47db4071b7
[]
no_license
marwadesouky96/GSoC-NetBSD
52152a02acfcaa4bf722abf119c66187c7147c2d
5e3be60a17e3194f11264e0be0474f301d2e8e5f
refs/heads/master
2020-03-19T11:14:52.539500
2018-06-12T01:22:16
2018-06-12T01:22:16
136,442,332
0
0
null
null
null
null
UTF-8
C
false
false
248
h
#define X86EMU 1 #ifdef _LOCORE .ifndef _KERNEL_OPT_X86EMU .global _KERNEL_OPT_X86EMU .equiv _KERNEL_OPT_X86EMU,0x1 .endif #else __asm(" .ifndef _KERNEL_OPT_X86EMU\n .global _KERNEL_OPT_X86EMU\n .equiv _KERNEL_OPT_X86EMU,0x1\n .endif"); #endif
122675c9fae2064117470a518f4493c674983c00
24d856d98c85a319d53be2768ccc176a50873fa3
/linux-lts-quantal-3.5.0/net/mac80211/rc80211_minstrel_ht_debugfs.c
e788f76a1dfe5811fb81614a88fc08f139f37f00
[ "GPL-1.0-or-later", "Linux-syscall-note", "GPL-2.0-only", "BSD-2-Clause" ]
permissive
dozenow/shortcut
a4803b59c95e72a01d73bb30acaae45cf76b0367
b140082a44c58f05af3495259c1beaaa9a63560b
refs/heads/jumpstart-php
2020-06-29T11:41:05.842760
2019-03-28T17:28:56
2019-03-28T17:28:56
200,405,626
2
2
BSD-2-Clause
2019-08-03T19:45:44
2019-08-03T17:57:58
C
UTF-8
C
false
false
3,366
c
/* * Copyright (C) 2010 Felix Fietkau <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/netdevice.h> #include <linux/types.h> #include <linux/skbuff.h> #include <linux/debugfs.h> #include <linux/ieee80211.h> #include <linux/export.h> #include <net/mac80211.h> #include "rc80211_minstrel.h" #include "rc80211_minstrel_ht.h" static int minstrel_ht_stats_open(struct inode *inode, struct file *file) { struct minstrel_ht_sta_priv *msp = inode->i_private; struct minstrel_ht_sta *mi = &msp->ht; struct minstrel_debugfs_info *ms; unsigned int i, j, tp, prob, eprob; char *p; int ret; if (!msp->is_ht) { inode->i_private = &msp->legacy; ret = minstrel_stats_open(inode, file); inode->i_private = msp; return ret; } ms = kmalloc(sizeof(*ms) + 8192, GFP_KERNEL); if (!ms) return -ENOMEM; file->private_data = ms; p = ms->buf; p += sprintf(p, "type rate throughput ewma prob this prob " "this succ/attempt success attempts\n"); for (i = 0; i < MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; i++) { char htmode = '2'; char gimode = 'L'; if (!mi->groups[i].supported) continue; if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) htmode = '4'; if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI) gimode = 'S'; for (j = 0; j < MCS_GROUP_RATES; j++) { struct minstrel_rate_stats *mr = &mi->groups[i].rates[j]; int idx = i * MCS_GROUP_RATES + j; if (!(mi->groups[i].supported & BIT(j))) continue; p += sprintf(p, "HT%c0/%cGI ", htmode, gimode); *(p++) = (idx == mi->max_tp_rate) ? 'T' : ' '; *(p++) = (idx == mi->max_tp_rate2) ? 't' : ' '; *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; p += sprintf(p, "MCS%-2u", (minstrel_mcs_groups[i].streams - 1) * MCS_GROUP_RATES + j); tp = mr->cur_tp / 10; prob = MINSTREL_TRUNC(mr->cur_prob * 1000); eprob = MINSTREL_TRUNC(mr->probability * 1000); p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " "%3u(%3u) %8llu %8llu\n", tp / 10, tp % 10, eprob / 10, eprob % 10, prob / 10, prob % 10, mr->last_success, mr->last_attempts, (unsigned long long)mr->succ_hist, (unsigned long long)mr->att_hist); } } p += sprintf(p, "\nTotal packet count:: ideal %d " "lookaround %d\n", max(0, (int) mi->total_packets - (int) mi->sample_packets), mi->sample_packets); p += sprintf(p, "Average A-MPDU length: %d.%d\n", MINSTREL_TRUNC(mi->avg_ampdu_len), MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); ms->len = p - ms->buf; return nonseekable_open(inode, file); } static const struct file_operations minstrel_ht_stat_fops = { .owner = THIS_MODULE, .open = minstrel_ht_stats_open, .read = minstrel_stats_read, .release = minstrel_stats_release, .llseek = no_llseek, }; void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) { struct minstrel_ht_sta_priv *msp = priv_sta; msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp, &minstrel_ht_stat_fops); } void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) { struct minstrel_ht_sta_priv *msp = priv_sta; debugfs_remove(msp->dbg_stats); }
[ "jflinn" ]
jflinn
807b71e373db16f33ff8e8e12c59211783de43bc
6f0b0136f95c42fac9889497e9529fa911efb2b0
/Software PWM/FR5994_softPWM/msp430fr599x_1.c
4b069f659fe2726bf35cd4b87bb2d1546fdb4f53
[]
no_license
RU09342/lab-4-timers-and-pwm-apranvoku
bcc1366264b202feabe37e412d3930a37967a699
c3210d3318ab4aa879bcb51594bf7bc8c28d8149
refs/heads/master
2021-05-16T04:52:21.628795
2017-10-16T07:36:19
2017-10-16T07:36:19
106,218,615
0
1
null
null
null
null
UTF-8
C
false
false
2,782
c
//****************************************************************************** // Ardit Pranvoku Collab with Thai Nghiem // Built with CCSv4 and IAR Embedded Workbench Version: 4.21 //****************************************************************************** #include <msp430.h> #include <Math.h> volatile unsigned int j; int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings P1DIR |= BIT0; // Set P1.0 to output direction P1OUT &= ~BIT0; // Switch LED off P1DIR |=BIT1; //set Port 1.1 output ---LED P1OUT &= ~BIT1; //Clear P1.1 P5DIR &= ~BIT5; // Set P5.5 as input P5OUT |= BIT5; // Configure P5.5 for Pull-Up P5REN |= BIT5; // Enable Pull Up of P5.5 P5IE |= BIT5; //enable the interrupt on Port 5.5 P5IES &= ~BIT5; //set as falling edge P5IFG &= ~(BIT5); //clear interrupt flag TA0CTL = TASSEL_2 + MC_1 ; // SMCLK / Upmode TA0CCTL1 = (CCIE); //CCTL1 Compare/Capture Interrupt Enable TA0CCTL0 = (CCIE); //CCTL1 Compare/Capture Interrupt Enable TA0CCR0 = 1000-1; // PWM Frequency 10 kHz TA0CCR1 = 500; // 50% Duty Cycle __bis_SR_register(GIE); while(1) { if((P5IN & BIT5)) P1OUT &= ~BIT1; //Clear P1.1 } } #pragma vector=PORT5_VECTOR __interrupt void PORT5_IRS(void) { P5IE &= ~BIT5; //Port 5 interrupt enable is turned off __delay_cycles(1000); //Debounce P5IE |= BIT5; //Port 1 interrupt enable is turned back on P1OUT |= BIT1; //Sets P1.1 if(TA0CCR1 >= 1000) // If the brightness is at 100% { TA0CCR0 = 0; // Reset CCR0 TA0CCR1 = 0;// Reset CCR1 TA0CCR0 = 1000; // Set CCR0 back to 10 kHz } else if (TA0CCR1 < 1000){ // If the brightness is <= than 90% TA0CCR0 = 0; // Reset CCR0 TA0CCR1 += 100; // Add 10% TA0CCR0 = 1000;// Set CCR0 back to 10 kHz } P5IFG &= ~BIT5; //Clear flag } //Timer A interrupt vectors #pragma vector=TIMER0_A1_VECTOR __interrupt void Timer0_A1_ISR (void) { if(TA0CCR1 != 1000) { P1OUT &= ~(BIT0); //turns off red led } TA0CCTL1 &= ~BIT0; //clears flag } #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer0_A0_ISR (void) { if(TA0CCR1 != 0){ P1OUT |= (BIT0); //turns on red led } TA0CCTL0 &= ~BIT0; //clears flag }
fbe45d6df55bb99cea29fa60b928f53b44d510b8
287230b6695941701830dd513273d516c7235ba9
/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/6.3.1/plugin/include/tree-data-ref.h
d5efcbb537305987e190d1fe8787812e714f70be
[]
no_license
haohlliang/rv1126
8279c08ada9e29d8973c4c5532ca4515bd021454
d8455921b05c19b47a2d7c8b682cd03e61789ee9
refs/heads/master
2023-08-10T05:56:01.779701
2021-06-27T14:30:42
2021-06-27T14:30:42
null
0
0
null
null
null
null
UTF-8
C
false
false
130
h
version https://git-lfs.github.com/spec/v1 oid sha256:28400ff222a0035ae51d7c0889d18e69d55a3c895c82b03e044201c8295bf511 size 17091
2103c96b595c45feda2791208eb255e2a5bcb97c
76a3d8485ecfe4d9ee51ffa5862946f3223bfa1a
/module/rdpComposite.h
08fd7da95dc74d144e9b0a812eae8656ee549d98
[ "MIT-open-group", "X11" ]
permissive
neutrinolabs/xorgxrdp
59ab958a60ae1b2af98bc6cd481ee36c57de8ce7
bf49ee19f8478bd37920da3ea45e2f285b4c9997
refs/heads/devel
2023-09-06T05:58:07.907521
2023-05-29T13:08:07
2023-05-29T13:08:07
24,623,762
397
128
NOASSERTION
2023-09-09T23:13:42
2014-09-30T03:55:45
C
UTF-8
C
false
false
1,295
h
/* Copyright 2005-2017 Jay Sorg Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. 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 OPEN GROUP 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. composite(alpha blending) calls */ #ifndef _RDPCOMPOSITE_H #define _RDPCOMPOSITE_H #include <xorg-server.h> #include <xorgVersion.h> #include <xf86.h> extern _X_EXPORT void rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); #endif
5a4facdc1485d9534e9a895ef9ca1e7720365ce9
d1c4f9487dd0db03b1d118ee22c0bbfcac052547
/aosp/external/libnfc-nci/halimpl/pn54x/utils/phNxpConfig.h
c6154f90a73e3ecb89be18fb2ff141f11a7e377b
[]
no_license
NXPNFCLinux/nxpnfc_android_kitkat
441499bbf2d367d581606bd3bd7a5c307b8ef1a0
a5ff49373e28faef06d70ff5e31a09b126e3a76a
refs/heads/master
2020-12-26T04:49:10.403201
2020-10-14T08:29:15
2020-10-14T08:29:15
53,134,410
4
7
null
null
null
null
UTF-8
C
false
false
3,651
h
/****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ /****************************************************************************** * * The original Work has been changed by NXP Semiconductors. * * Copyright (C) 2013-2014 NXP Semiconductors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ #ifndef __CONFIG_H #define __CONFIG_H #ifdef __cplusplus extern "C" { #endif int GetNxpStrValue(const char* name, char* p_value, unsigned long len); int GetNxpNumValue(const char* name, void* p_value, unsigned long len); int GetNxpByteArrayValue(const char* name, char* pValue,long bufflen, long *len); void resetNxpConfig(void); int isNxpConfigModified(); int updateNxpConfigTimestamp(); #ifdef __cplusplus }; #endif #define NAME_NXPLOG_EXTNS_LOGLEVEL "NXPLOG_EXTNS_LOGLEVEL" #define NAME_NXPLOG_NCIHAL_LOGLEVEL "NXPLOG_NCIHAL_LOGLEVEL" #define NAME_NXPLOG_NCIX_LOGLEVEL "NXPLOG_NCIX_LOGLEVEL" #define NAME_NXPLOG_NCIR_LOGLEVEL "NXPLOG_NCIR_LOGLEVEL" #define NAME_NXPLOG_FWDNLD_LOGLEVEL "NXPLOG_FWDNLD_LOGLEVEL" #define NAME_NXPLOG_TML_LOGLEVEL "NXPLOG_TML_LOGLEVEL" #define NAME_MIFARE_READER_ENABLE "MIFARE_READER_ENABLE" #define NAME_FW_STORAGE "FW_STORAGE" #define NAME_NXP_SYS_CLK_SRC_SEL "NXP_SYS_CLK_SRC_SEL" #define NAME_NXP_SYS_CLK_FREQ_SEL "NXP_SYS_CLK_FREQ_SEL" #define NAME_NXP_SYS_CLOCK_TO_CFG "NXP_SYS_CLOCK_TO_CFG" #define NAME_NXP_ACT_PROP_EXTN "NXP_ACT_PROP_EXTN" #define NAME_NXP_RF_CONF_BLK_1 "NXP_RF_CONF_BLK_1" #define NAME_NXP_RF_CONF_BLK_2 "NXP_RF_CONF_BLK_2" #define NAME_NXP_RF_CONF_BLK_3 "NXP_RF_CONF_BLK_3" #define NAME_NXP_RF_CONF_BLK_4 "NXP_RF_CONF_BLK_4" #define NAME_NXP_RF_CONF_BLK_5 "NXP_RF_CONF_BLK_5" #define NAME_NXP_RF_CONF_BLK_6 "NXP_RF_CONF_BLK_6" #define NAME_NXP_CORE_CONF_EXTN "NXP_CORE_CONF_EXTN" #define NAME_NXP_CORE_CONF "NXP_CORE_CONF" #define NAME_NXP_CORE_MFCKEY_SETTING "NXP_CORE_MFCKEY_SETTING" #define NAME_NXP_CORE_STANDBY "NXP_CORE_STANDBY" #define NAME_NXP_NFC_PROFILE_EXTN "NXP_NFC_PROFILE_EXTN" #define NAME_NXP_SWP_FULL_PWR_ON "NXP_SWP_FULL_PWR_ON" #define NAME_NXP_CORE_RF_FIELD "NXP_CORE_RF_FIELD" #define NAME_NXP_NFC_MERGE_RF_PARAMS "NXP_NFC_MERGE_RF_PARAMS" /* default configuration */ #define default_storage_location "/data/nfc" #endif
e77c3a29079f0438c6b0f9c279e6c3cf29bc7dc1
957c488487158d509f6b1d490e56129bbc5e0645
/programs/wolfportal/src/ft_rot_pos.c
8457386ba24df45f9bd5903b0c3ea9baa177831f
[]
no_license
sclolus/Turbofish
4412d94dff5aef99e1d453413a13f5375e2d4f4d
972e470f4144b62ce90765f32666d5c3b16d68d1
refs/heads/master
2022-06-21T04:01:25.338170
2019-12-05T17:36:09
2019-12-05T17:37:28
263,923,507
9
0
null
null
null
null
UTF-8
C
false
false
1,386
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_rot_pos.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vcombey <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/04/25 21:15:56 by vcombey #+# #+# */ /* Updated: 2017/04/26 14:36:40 by vcombey ### ########.fr */ /* */ /* ************************************************************************** */ #include "wolf.h" void ft_swap_double_pos(t_double_pos *a) { double tmp; tmp = a->y; a->y = a->x; a->x = tmp; } void ft_rev_rot_int(t_int_pos *a) { int tmp; tmp = a->y; a->y = -a->x; a->x = tmp; } void ft_rev_rot_double(t_double_pos *a) { double tmp; tmp = a->y; a->y = -a->x; a->x = tmp; } void ft_rot_int(t_int_pos *a) { int tmp; tmp = -a->y; a->y = a->x; a->x = tmp; } void ft_rot_double(t_double_pos *a) { double tmp; tmp = -a->y; a->y = a->x; a->x = tmp; }
5062a559c3c39cc6cec097fc575e89310242f320
485741c6f00d939c2a1bc5011d01f5666325b0dd
/uspace/include/types/packet.h
ca39790009255a36926c6a6d2f8e29b546a2f944
[]
no_license
frankfanslc/ustack
f623881cb6d6327741969758fe2caedd329c68d6
7fb7296601c3f92827fa0ae8d24e41e4af71edf6
refs/heads/master
2022-02-12T12:03:59.888457
2016-10-09T22:09:22
2016-10-09T22:09:22
null
0
0
null
null
null
null
UTF-8
C
false
false
1,559
h
/* * types/packet.h * * Copyright (C) 2012-2013 Peng Jianzhang * * Author: Peng Jianzhang * Email: [email protected] * Time: 2013.2.11 * */ #ifndef _TYPES_PACKET_H #define _TYPES_PACKET_H #include "common/types.h" #include "common/list.h" #include "types/lf_queue.h" struct packet { struct list_head next; /*link package tDo freelist ... */ u64 phys; /* physical address */ u16 len; /* data length */ u16 size; /* 2k */ u16 protocol_eth; /* protocol at ethhdr */ u8 protocol_ip; /* protocl at iphdr */ u8 family; /* AF_INET, AF_INET6 */ u8 adapter_idx; /* adapter recv this packagyee */ // u8 queue_idx; /* rx queue recv this package */ enum lfq_state lfq_state; /* lfq state */ int id; /* this packet is alloced to a process,ynot changed from init */ struct net_address saddr; /*src address ip:port */ struct net_address daddr; /*dst address ip:port */ int transport_header; /* offset of transport layer header */ int network_header; /* offset of network layer header */ int mac_header; /* offset of mac layer header */ }; struct packet_pool { __u64 num; struct list_head list; }; struct packet_zone { u64 start_all; /* packet memory address */ u64 phys_all; /* physical address of the total packet memory */ __u64 start; //package start __u64 phys; //physical address of <start> __u64 size; __u64 packet_num; __u16 packet_size; //2k __u16 packet_offset; //packet info offset from packet data head int id; struct packet_pool free_packet_pool; }; #endif
a6f3c46dcbb7603eff99d0068f7e9e2e06da8c45
72c8ed81a3e997fa93559a3e00c6a0d43fdaa685
/wsfont/spleen-16x32.c
d4e8635e86d22cc72b713ea1eac9ee681f64b01d
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
AVykhovanets/spleen
ff0902f434955b0d65c98b159ff77fa98ff1ab87
a356d2b16a52fa252f9135936348f02180ddd6aa
refs/heads/master
2023-08-27T01:00:37.214009
2021-10-09T19:42:41
2021-10-09T19:42:41
null
0
0
null
null
null
null
UTF-8
C
false
false
609
c
/* * Spleen 1.9.1 * Copyright (c) 2018-2021, Frederic Cambus * https://www.cambus.net/ * * Created: 2020-06-20 * Last Updated: 2020-07-08 * * Spleen is released under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #include <stdio.h> #include <time.h> #include <dev/wscons/wsconsio.h> #include <dev/wsfont/spleen16x32.h> int main(int argc, char *argv[]) { size_t loop; for (loop = 0; loop < 32 * 2 * 32; loop++) printf("%c", 0); for (loop = 0; loop < 224 * 2 * 32; loop++) printf("%c", spleen16x32_data[loop]); return 0; }
4f4d7acb58840aaa07fc5e3841d49c141f8c0ddb
62ee3292c00562e718adc9ced13e8ba2d44548ec
/TouchSensor/TouchSensorFirmware/src/smc_gen/Config_CMT0/Config_CMT0.h
ff1f7f268dc007257ab1103c90b65453bd451d2e
[]
no_license
tamapochi1/DigitalViolin
632b32f64f89e834346ede623141cae819744fae
a5f46f305b7ab205296587d07c080f8c38ca49e1
refs/heads/master
2020-03-27T04:38:47.322488
2019-01-19T14:51:40
2019-01-19T14:51:40
145,957,743
1
2
null
null
null
null
UTF-8
C
false
false
3,728
h
/*********************************************************************************************************************** * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. * No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all * applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED * OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY * LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT, * INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR * ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability * of this software. By using this software, you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * * Copyright (C) 2016, 2017 Renesas Electronics Corporation. All rights reserved. ***********************************************************************************************************************/ /*********************************************************************************************************************** * File Name : Config_CMT0.h * Version : 1.2.0 * Device(s) : R5F51303AxFN * Description : This file implements device driver for Config_CMT0. * Creation Date: 2018-10-24 ***********************************************************************************************************************/ #ifndef Config_CMT0_H #define Config_CMT0_H /*********************************************************************************************************************** Includes ***********************************************************************************************************************/ #include "r_cg_cmt.h" /*********************************************************************************************************************** Macro definitions (Register bit) ***********************************************************************************************************************/ /*********************************************************************************************************************** Macro definitions ***********************************************************************************************************************/ /* Compare Match Constant Register (CMCOR) */ #define _03A9_CMT0_CMCOR_VALUE (0x03A9U) /*********************************************************************************************************************** Typedef definitions ***********************************************************************************************************************/ /*********************************************************************************************************************** Global functions ***********************************************************************************************************************/ void R_Config_CMT0_Create(void); void R_Config_CMT0_Start(void); void R_Config_CMT0_Stop(void); void R_Config_CMT0_Create_UserInit(void); /* Start user code for function. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ #endif
16f31992795045b633936c516c09a4ade04a8e32
c2022f6b679e53cbd566c0b7d0ef652279e75d27
/clan/2562.c
40d53e03c7818aebb31c97781426f13b572eb053
[]
no_license
ggjae/Algorithm-CS
4663589e4e4bdb79a5255634933864408b06dca2
5598e7121b1b54bdcdf2c779d68577d25cfa75e9
refs/heads/master
2023-08-22T08:09:25.718005
2021-10-22T11:43:15
2021-10-22T11:43:15
275,533,281
0
0
null
null
null
null
UTF-8
C
false
false
267
c
#include <stdio.h> int main(){ int a[9]; int max = -1; int tmp = 0; for(int i=0;i<9;i++){ scanf("%d",&a[i]); if(max < a[i]){ max = a[i]; tmp = i; } } printf("%d\n",max); printf("%d",tmp+1); }
9b6ecb50f5db82179f459a0ba2be385de0c32599
4fa979e7fe0e4a237b8ba6542d29b9304e8bb08d
/0x09-static_libraries/holberton.h
6c3302b8cc87535f84e26357c69f6e1add930422
[]
no_license
oumaymabg/holbertonschool-low_level_programming
0d6d3e2f73aef4d7e3126d7194a61f4e1f7292bb
b401c437e6319caf30e968bca9d4047835c5522a
refs/heads/master
2023-03-08T22:10:52.478970
2021-02-27T22:22:25
2021-02-27T22:22:25
271,235,619
1
0
null
null
null
null
UTF-8
C
false
false
651
h
int _putchar(char *c); int _islower(int c); int _isalpha(int c); int _abs(int n); int _isupper(int c); int _isdigit(int c); int _strlen(char *s); void _puts(char *s); char *_strcpy(char *dest, char *src); int _atoi(char *s); char *_strcat(char *dest, char *src); char *_strncat(char *dest, char *src, int n); char *_strncpy(char *dest, char *src, int n); int _strcmp(char *s1, char *s2); char *_memset(char *s, char b, unsigned int n); char *_memcpy(char *dest, char *src, unsigned int n); char *_strchr(char *s, char c); unsigned int _strspn(char *s, char *accept); char *_strpbrk(char *s, char *accept); char *_strstr(char *haystack, char *needle);
3131d33469d72740aeae3c2296d6758fe4b1102b
699751f70d8320173e811d46df5ee33e93485c66
/0x04-more_functions_nested_loops/9-fizz_buzz.c
cb5d7033d37a3075c291659e8dc87c0d4560daf5
[]
no_license
jenntang1/holbertonschool-low_level_programming
d32296e0c565d54447bf929dd4681af44e6173a8
ec07919d0f384cfac32ca773cf63172296c5d940
refs/heads/master
2020-07-28T04:46:50.733071
2020-04-17T15:22:40
2020-04-17T15:22:40
209,313,514
0
1
null
null
null
null
UTF-8
C
false
false
466
c
#include <stdio.h> /** * main - function to print Fizz-Buzz * * Description: The Fizz-Buzz test * Return: 0 for success. */ int main(void) { int test; for (test = 1; test <= 100; test++) { if (!(test % 15)) { printf("FizzBuzz"); } else if (!(test % 3)) { printf("Fizz"); } else if (!(test % 5)) { printf("Buzz"); } else { printf("%d", test); } if (test != 100) { printf(" "); } } printf("\n"); return (0); }
35cb1163c97eabd367a1aaa6bbc8d8149a22dd89
22b817c31ce2a54cba4f7a8597a6867dd0414f87
/fkn/StdAfx.h
89911afd2d0f96ac5f3e288cc1207a7f456ef6d8
[ "MIT" ]
permissive
philm001/FEMM
904c72e653f89784693bf1b83aefb3b26aed4848
e091281e86ac22ed31a3bfc7d854ff42527ffdc7
refs/heads/master
2020-03-14T23:56:28.511905
2018-05-02T13:41:10
2018-05-02T13:41:10
131,856,027
0
0
null
2018-05-02T13:38:43
2018-05-02T13:38:42
null
UTF-8
C
false
false
575
h
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define _CRT_SECURE_NO_WARNINGS #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows 95 Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT int MsgBox(CString s); int MsgBox(PSTR sz,...);
3dad866f15ee53c10707d0dd148e86fa5d9bf691
59dd61ebf101f8f037018d026231301ead18aa32
/Code/Rockstar Games/File Format/Raw/IMG/CIMGFormat_Version2_Header1.h
dbef2ea840fa369a223ff407e86e8a92dfd35289
[]
no_license
X-Seti/KGM
d4e6900d590bc22c9be90e6a7129699a1119902c
edc034930f1dfbb61027992f9347ef5f0bdb0cb4
refs/heads/master
2020-12-30T19:36:52.838360
2017-07-11T16:45:43
2017-07-11T16:45:43
60,021,522
0
0
null
2016-05-30T15:46:12
2016-05-30T15:46:12
null
UTF-8
C
false
false
266
h
#ifndef CIMGFormat_Version2_Header1_H #define CIMGFormat_Version2_Header1_H #include "Types.h" #include "Namespace.h" #pragma pack(push, 1) struct RG::CIMGFormat_Version2_Header1 { uint8 m_ucMagicNumber[4]; uint32 m_uiEntryCount; }; #pragma pack(pop) #endif
6493ae047bf03a9665bce64b2a10116f1f33eff7
83214753e9183327e98af0e6768e9be5385e5282
/kungfu/class/qingcheng/npc/luo.c
7ed83a7108971c0449e6ff6ef69fd81107abb28f
[]
no_license
MudRen/hymud
f5b3bb0e0232f23a48cb5f1db2e34f08be99614e
b9433df6cf48e936b07252b15b60806ff55bb2f3
refs/heads/main
2023-04-04T22:44:23.880558
2021-04-07T15:45:16
2021-04-07T15:45:16
318,484,633
1
5
null
null
null
null
GB18030
C
false
false
1,251
c
// luo.c inherit NPC; //inherit F_SKILL; #include <ansi.h> void create() { set_name("罗人杰", ({ "luo renjie", "luo", "renjie" })); set("gender", "男性"); set("nickname", HIC"青城四秀"NOR); set("age", 25); set("long", "他就是「英雄豪杰,青城四秀」之一,武功也远高同门。\n"); set("combat_exp", 80000); set("shen_type", -1); set_skill("sword", 80); set_skill("dodge", 80); set_skill("parry", 80); set_skill("strike", 80); set_skill("unarmed", 80); set_skill("force", 180); set_skill("pixie-sword", 80); set_skill("songfeng-jian", 80); set_skill("chuanhua", 80); set_skill("wuying-leg", 80); set_skill("cuixin-strike", 80); set_skill("qingming-xuangong", 80); map_skill("force", "qingming-xuangong"); map_skill("unarmed", "wuying-leg"); map_skill("strike", "cuixin-strike"); map_skill("dodge", "chuanhua"); map_skill("parry", "bixie-sword"); map_skill("sword", "songfeng-jian"); prepare_skill("unarmed", "wuying-leg"); prepare_skill("strike", "cuixin-strike"); map_skill("parry", "bixie-sword"); map_skill("sword", "bixie-sword"); create_family("青城派", 6, "弟子"); setup(); carry_object("/clone/weapon/changjian")->wield(); carry_object("/d/wudang/obj/bluecloth")->wear(); }
d48157e2a0992de1595aac5218a1713d5bf762fd
9afdd0184d38855bbede2fe396762b9faf264510
/src/itoa.c
f30389550df31482af27a93d34908494c15bbbe5
[ "BSD-3-Clause" ]
permissive
pabigot/embtextf
a45d23a6480401e616b9e5f438d829c897a991d0
a114a91bb4a82001c6b6b3a03facb78b4e980a62
refs/heads/master
2021-01-01T16:25:27.150996
2015-02-09T03:52:26
2015-02-09T03:52:26
8,961,773
3
0
null
null
null
null
UTF-8
C
false
false
128
c
#include <embtextf/xtoa.h> #define INT_T int #define STOA embtextf_itoa #define UTOA embtextf_utoa #include "embtextf/xtoa.inc"
47641523da5c5471801de469cdf2b0b1d43f8458
c512a52861f552c1b1935a0ca94cc4fce41ecae9
/SystemCall/syscall.c
dd10880e23253f60e1d4abd3ea7970affb92b463
[]
no_license
KenanRico/crefs
1bb97c5756cd50bbc8b5e213640a9394bfac0dca
e53b204c5c1f8ed59af51d71941a1a70cb6b052e
refs/heads/master
2020-04-14T00:56:16.302566
2019-10-20T14:24:42
2019-10-20T14:24:42
163,546,500
0
0
null
null
null
null
UTF-8
C
false
false
7,624
c
#include <types.h> #include <kern/errno.h> #include <lib.h> #include <machine/pcb.h> #include <machine/spl.h> #include <machine/trapframe.h> #include <kern/callno.h> #include <syscall.h> #include <thread.h> #include "addrspace.h" #include "vfs.h" /* * System call handler. * * A pointer to the trapframe created during exception entry (in * exception.S) is passed in. * * The calling conventions for syscalls are as follows: Like ordinary * function calls, the first 4 32-bit arguments are passed in the 4 * argument registers a0-a3. In addition, the system call number is * passed in the v0 register. * * On successful return, the return value is passed back in the v0 * register, like an ordinary function call, and the a3 register is * also set to 0 to indicate success. * * On an error return, the error code is passed back in the v0 * register, and the a3 register is set to 1 to indicate failure. * (Userlevel code takes care of storing the error code in errno and * returning the value -1 from the actual userlevel syscall function. * See src/lib/libc/syscalls.S and related files.) * * Upon syscall return the program counter stored in the trapframe * must be incremented by one instruction; otherwise the exception * return code will restart the "syscall" instruction and the system * call will repeat forever. * * Since none of the OS/161 system calls have more than 4 arguments, * there should be no need to fetch additional arguments from the * user-level stack. * * Watch out: if you make system calls that have 64-bit quantities as * arguments, they will get passed in pairs of registers, and not * necessarily in the way you expect. We recommend you don't do it. * (In fact, we recommend you don't use 64-bit quantities at all. See * arch/mips/include/types.h.) */ extern struct thread* curthread; void mips_syscall(struct trapframe *tf) { int callno; int32_t retval; int err; assert(curspl == 0); callno = tf->tf_v0; /* * Initialize retval to 0. Many of the system calls don't * really return a value, just 0 for success and -1 on * error. Since retval is the value returned on success, * initialize it to 0 by default; thus it's not necessary to * deal with it except for calls that return other values, * like write. */ retval = 0; switch (callno) { case SYS_reboot: err = sys_reboot(tf->tf_a0); break; case SYS_fork: err = fork(tf, &retval); break; case SYS_getpid: err = 0; retval = curthread->process_id; break; case SYS_waitpid: err = waitpid(tf->tf_a0, tf->tf_a1, tf->tf_a2, &retval); break; case SYS__exit: exit(tf->tf_a0); break; case SYS_read: err = sys_read(tf->tf_a0, (char *) tf->tf_a1, tf->tf_a2, &retval); break; case SYS_write: err = sys_write(tf->tf_a0, (void *) tf->tf_a1, tf->tf_a2, &retval); break; case SYS_execv: err = execv((const char *)tf->tf_a0, (char *const*)tf->tf_a1, &retval); break; /* Add stuff here */ default: kprintf("Unknown syscall %d\n", callno); err = ENOSYS; break; } if (err) { /* * Return the error code. This gets converted at * userlevel to a return value of -1 and the error * code in errno. */ tf->tf_v0 = err; tf->tf_a3 = 1; /* signal an error */ } else { /* Success. */ tf->tf_v0 = retval; tf->tf_a3 = 0; /* signal no error */ } /* * Now, advance the program counter, to avoid restarting * the syscall over and over again. */ tf->tf_epc += 4; /* Make sure the syscall code didn't forget to lower spl */ assert(curspl == 0); } int fork(struct trapframe *tf, int* retval) { int s = splhigh(); struct addrspace *childSpace; struct thread *childthread; struct trapframe *child_tf; int value = as_copy(curthread->t_vmspace, &childSpace); if (value != 0) { splx(s); return value; } if (childSpace == NULL) { splx(s); return -1; } child_tf = kmalloc(sizeof (struct trapframe)); if (child_tf == NULL) { splx(s); return ENOMEM; } memcpy(child_tf, tf, sizeof (struct trapframe)); value = thread_fork(curthread->t_name, (void*) child_tf, (unsigned long) childSpace, md_forkentry, &childthread); if (value != 0) { splx(s); return ENOMEM; } *retval = childthread->process_id; splx(s); return 0; } void md_forkentry(void *tf, unsigned long childSpace) { struct trapframe child_tf = *(struct trapframe*) tf; child_tf.tf_v0 = 0; child_tf.tf_a3 = 0; child_tf.tf_epc += 4; curthread->t_vmspace = (struct addrspace*) childSpace; as_activate(curthread->t_vmspace); mips_usermode(&child_tf); } void exit(int code) { process_exitcode[curthread->process_id] = code; process_exit[curthread->process_id] = 1; if (curthread->process_id >= 10) V(process_sem[curthread->process_id]); thread_exit(); } int waitpid(pid_t pid, int* status, int options, int* retval) { if (process_occupied[pid] == 0 || options != 0) return EINVAL; if (parent_thread[pid] != curthread) return EINVAL; if (status == NULL) return EFAULT; P(process_sem[pid]); *status = process_exitcode[pid]; *retval = pid; process_exit[pid] = 0; process_exitcode[pid] = 0; parent_thread[pid] = NULL; sem_destroy(process_sem[pid]); process_occupied[pid] = 0; return 0; } int sys_read(int fd, char *buf1, size_t buflen, int* retval) { if (buf1 == NULL) { *retval = -1; return EFAULT; } if (fd != 0) { *retval = -1; return EBADF; } if (buflen == 0){ *retval = -1; return EIO; } int counter; for (counter = 0; counter < buflen; counter++) { char* charbuf; *charbuf = (char) getch(); if (charbuf == NULL){ *retval = -1; return EFAULT; } int a = copyout((void*)charbuf, (userptr_t) buf1 + counter, 1); if (a != 0){ *retval = -1; return a; } buf1++; } *retval = buflen; return 0; } int sys_write(int fd, void *buf1, size_t buflen, int* retval) { char *buf; buf = kmalloc(sizeof(char) * (buflen + 1)); if (buf == NULL) { *retval = -1; return ENOMEM; } if (buf1 == NULL) { *retval = -1; return EFAULT; } if (buflen == 0){ *retval = -1; return EIO; } if (fd != 1 && fd != 2) { *retval = -1; return EBADF; } copyin((const_userptr_t)buf1, buf, buflen); buf[buflen] = '\0'; int i; for(i = 0; i < buflen; i++){ putch((int)buf[i]); } *retval = buflen; kfree(buf); return 0; } int execv(const char *program, char *const *args,int *retval){ int spl=splhigh(); if(program==NULL){ return EINVAL; } struct vnode *v; char* path = (char *) kmalloc(128 * sizeof(char)); curthread->t_vmspace=as_create(); if(curthread->t_vmspace){ vfs_close(v); return ENOMEM; } }
918d0693a28fe0a5bd35da58378a01ea16b3bbae
66862c422fda8b0de8c4a6f9d24eced028805283
/cmake-3.17.5/Tests/Plugin/src/example_mod_1.c
2b740b8db3491b01cd2bdbace8339750a583f633
[ "BSD-3-Clause", "MIT" ]
permissive
zhh2005757/slambook2_in_Docker
57ed4af958b730e6f767cd202717e28144107cdb
f0e71327d196cdad3b3c10d96eacdf95240d528b
refs/heads/main
2023-09-01T03:26:37.542232
2021-10-27T11:45:47
2021-10-27T11:45:47
416,666,234
17
6
MIT
2021-10-13T09:51:00
2021-10-13T09:12:15
null
UTF-8
C
false
false
378
c
#include <example.h> #include <stdio.h> #if defined(_WIN32) # define MODULE_EXPORT __declspec(dllexport) #else # define MODULE_EXPORT #endif #ifdef __WATCOMC__ # define MODULE_CCONV __cdecl #else # define MODULE_CCONV #endif MODULE_EXPORT int MODULE_CCONV example_mod_1_function(int n) { int result = example_exe_function() + n; printf("world\n"); return result; }
80d8e1d682f6fbfeb76707fbf1d463205426c9a5
f38480d2880b57a0af7113fef89b58c339247caa
/Sources/fnet_stack/fnet.h
246175d18d3dc1b838e110355efe46e4a1174d7d
[]
no_license
SoFiHa/twrk60_fnet_test
4aac2d1867bd3846064b9d86b077f1232b490909
f836675189bf4c1d713f52e573d6d9f633312b98
refs/heads/master
2021-01-20T20:21:49.612846
2016-07-26T07:34:00
2016-07-26T07:34:00
64,200,557
0
0
null
null
null
null
UTF-8
C
false
false
3,105
h
/************************************************************************** * * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. * *************************************************************************** * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * **********************************************************************/ /*! * * @file fnet.h * * @author Andrey Butok * * @brief Main including header for the FNET project. * ***************************************************************************/ #ifndef _FNET_H_ #define _FNET_H_ #include "fnet_config.h" #include "port/compiler/fnet_comp.h" #include "port/cpu/fnet_cpu.h" #include "stack/fnet_stack.h" #include "services/fnet_services.h" #include "port/os/fnet_os.h" /*! @addtogroup fnet_define * These definitions are used for reference purposes only. * @n */ /*! @{*/ /**************************************************************************/ /*! * @def FNET_DESCRIPTION * @brief Description string of the FNET TCP/IP stack. * @showinitializer ******************************************************************************/ #define FNET_DESCRIPTION "FNET TCP/IP Stack" /**************************************************************************/ /*! * @def FNET_LICENSE * @brief License string of the FNET TCP/IP stack. * @showinitializer ******************************************************************************/ #define FNET_LICENSE "APACHEv2" /**************************************************************************/ /*! * @def FNET_COPYRIGHT * @brief Copyright string of the FNET TCP/IP stack. * @showinitializer ******************************************************************************/ #define FNET_COPYRIGHT "Copyright by FNET Community" /**************************************************************************/ /*! * @def FNET_BUILD_DATE * @brief Build date and time of the project as a string. * @showinitializer ******************************************************************************/ #define FNET_BUILD_DATE __DATE__ " at " __TIME__ /**************************************************************************/ /*! * @def FNET_VERSION * @brief Current version number of the FNET TCP/IP stack. * The resulting value format is xx.xx.xx = major.minor.revision, as a * string. * @showinitializer ******************************************************************************/ #define FNET_VERSION "3.3.0" /*! @} */ #endif /* _FNET_H_ */
f698464e63659abfe0ba14579f2d706f6b711dc3
37c593b4c9b42d38ebfcac8d7160282c43fdb324
/model/Scade/System/TracksideDynamicModel/TestTracks/UtrechtAmsterdam_oETCS/Simulation/TestP057_Internal_Tests_inputs.c
cf822e6a1ff7233454d1ab8242aef2275a930d3e
[]
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
583
c
/* $*************** KCG Version 6.1.3 (build i6) **************** ** Command: s2c613 -config C:/GITHUB/modeling/model/Scade/System/TracksideDynamicModel/TestTracks/UtrechtAmsterdam_oETCS/Simulation\kcg_s2c_config.txt ** Generation date: 2015-08-20T16:18:38 *************************************************************$ */ #include "TestP057_Internal_Tests.h" /* $*************** KCG Version 6.1.3 (build i6) **************** ** TestP057_Internal_Tests_inputs.c ** Generation date: 2015-08-20T16:18:38 *************************************************************$ */
fe9e8e6f19e9ed346657d81038066b5a7bb9898d
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
/sys/external/bsd/drm2/dist/drm/amd/display/dc/gpio/dcn21/hw_factory_dcn21.h
e19085a2addba44cce07c732db2abede44022561
[]
no_license
NetBSD/src
1a9cbc22ed778be638b37869ed4fb5c8dd616166
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
refs/heads/trunk
2023-08-31T13:24:58.105962
2023-08-27T15:50:47
2023-08-27T15:50:47
88,439,547
656
348
null
2023-07-20T20:07:24
2017-04-16T20:03:43
null
UTF-8
C
false
false
1,464
h
/* $NetBSD: hw_factory_dcn21.h,v 1.2 2021/12/18 23:45:05 riastradh Exp $ */ /* * Copyright 2018 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. * * Authors: AMD * */ #ifndef __DAL_HW_FACTORY_DCN21_H__ #define __DAL_HW_FACTORY_DCN21_H__ /* Initialize HW factory function pointers and pin info */ void dal_hw_factory_dcn21_init(struct hw_factory *factory); #endif /* __DAL_HW_FACTORY_DCN20_H__ */
2e7ef46c39adb52c71a7c85c9f7b72076e1a09b5
76f7459a09acb9be2d52407132f5ff8955627da2
/frame/compat/attic/bla_rot.c
5c97d3961166ac336897f4aa485a475359335487
[ "BSD-3-Clause" ]
permissive
flame/blis
448bc0ad139b726188129c5627c304274b41c3c1
6dcf7666eff14348e82fbc2750be4b199321e1b9
refs/heads/master
2023-09-01T14:56:11.920485
2023-08-27T19:18:57
2023-08-27T19:18:57
16,143,904
1,696
361
NOASSERTION
2023-08-27T19:18:58
2014-01-22T15:58:24
C
UTF-8
C
false
false
2,725
c
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas at Austin 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(s) of the copyright holder(s) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "blis.h" // // Define BLAS-to-BLIS interfaces. // #undef GENTFUNCR2 #define GENTFUNCR2( ftype_xy, ftype_r, chxy, chr, blasname, blisname ) \ \ void PASTEF772(chxy,chr,blasname)( \ f77_int* n, \ ftype_xy* x, f77_int* incx, \ ftype_xy* y, f77_int* incy, \ ftype_r* c, \ ftype_r* s \ ) \ { \ dim_t n0; \ ftype_xy* x0; \ ftype_xy* y0; \ inc_t incx0; \ inc_t incy0; \ \ /* Convert/typecast negative values of n to zero. */ \ bli_convert_blas_dim1( *n, n0 ); \ \ /* If the input increments are negative, adjust the pointers so we can use positive increments instead. */ \ bli_convert_blas_incv( n0, x, *incx, x0, incx0 ); \ bli_convert_blas_incv( n0, y, *incy, y0, incy0 ); \ \ bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED ); \ } #ifdef BLIS_ENABLE_BLAS INSERT_GENTFUNCR2_BLAS( rot, ROT_KERNEL ) #endif
b2a780459176982e2b7f2fb94c72a329e6a99638
7a288556ef88974e6877472740fd76e1014fe5a7
/thirdparty/freertos/demo/oled1_event_groups_xpro_example/samd20_xplained_pro/iar/asf.h
f0ad2bce9c79856f3fab7d73554c62430a964ba0
[]
no_license
Realtime-7/asf
0452a55c62b869da48a771811dc9157d352c6470
2062737bc4a5f1eada3d43b2987c365b8b8c1881
refs/heads/master
2021-01-14T10:26:32.948063
2014-11-25T16:19:51
2014-11-25T16:19:51
null
0
0
null
null
null
null
UTF-8
C
false
false
3,839
h
/** * \file * * \brief Autogenerated API include file for the Atmel Software Framework (ASF) * * Copyright (c) 2012 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * \asf_license_stop * */ #ifndef ASF_H #define ASF_H /* * This file includes all API header files for the selected drivers from ASF. * Note: There might be duplicate includes required by more than one driver. * * The file is automatically generated and will be re-written when * running the ASF driver selector tool. Any changes will be discarded. */ // From module: Common SAM0 compiler driver #include <compiler.h> #include <status_codes.h> // From module: Delay routines #include <delay.h> // From module: FreeRTOS - kernel 8.0.1 #include <FreeRTOS.h> #include <StackMacros.h> #include <croutine.h> #include <event_groups.h> #include <list.h> #include <mpu_wrappers.h> #include <portable.h> #include <projdefs.h> #include <queue.h> #include <semphr.h> #include <task.h> #include <timers.h> // From module: GFX Monochrome - Monochrome Graphic Library #include <gfx_mono.h> // From module: GFX Monochrome - System Font #include <sysfont.h> // From module: Generic board support #include <board.h> // From module: Interrupt management - SAM implementation #include <interrupt.h> // From module: PORT - GPIO Pin Control #include <port.h> // From module: Part identification macros #include <parts.h> // From module: SERCOM Callback API #include <sercom.h> #include <sercom_interrupt.h> // From module: SERCOM SPI - Serial Peripheral Interface (Callback APIs) #include <spi.h> #include <spi_interrupt.h> // From module: SERCOM USART - Serial Communications (Callback APIs) #include <usart.h> #include <usart_interrupt.h> // From module: SSD1306 OLED controller #include <ssd1306.h> // From module: SYSTEM - Clock Management for SAMD20 #include <clock.h> #include <gclk.h> // From module: SYSTEM - Core System Driver #include <system.h> // From module: SYSTEM - I/O Pin Multiplexer #include <pinmux.h> // From module: SYSTEM - Interrupt Driver #include <system_interrupt.h> // From module: User I/O driver for FreeRTOS demo #include <cdc.h> #include <oled1.h> #endif // ASF_H
ce832fe55a21cdc24b2988b3974b2e6e96a4e77e
0725729da64cd6fa2202b38b642ea3d68a858350
/src/wsnos/platform/WSN-JH02-ZD/driver/spi.h
3e585607ae4dc736d41a2d1fdb1d29d004b4334f
[]
no_license
wjf3310105/can_send_recv
b69d731c5fb102b5ab708475965222b6bdf2cf54
93fd70b5498a9583a81fe2e08c035bd1ee7201f8
refs/heads/master
2021-06-30T07:28:16.219221
2017-09-20T06:32:27
2017-09-20T06:32:27
104,175,227
1
1
null
null
null
null
UTF-8
C
false
false
1,998
h
/** * @brief : this * @file : spi.h * @version : v0.0.1 * @author : gang.cheng * @date : 2017-04-24 * change logs : * Date Version Author Note * 2017-04-24 v0.0.1 gang.cheng first version */ #ifndef __SPI_H__ #define __SPI_H__ #include "common/lib/data_type_def.h" typedef enum { SPI1, SPI2 } spi_enum; typedef struct spi_s { uint8_t Spi; pin_id_t Mosi; pin_id_t Miso; pin_id_t Sclk; pin_id_t Nss; } Spi_t; void spi_com_set(Spi_t *spi, uint8_t com); /*! * \brief Initializes the SPI object and MCU peripheral * * \remark When NSS pin is software controlled set the pin name to NC otherwise * set the pin name to be used. * * \param [IN] spi SPI object * \param [IN] mosi SPI MOSI pin name to be used * \param [IN] miso SPI MISO pin name to be used * \param [IN] sclk SPI SCLK pin name to be used * \param [IN] nss SPI NSS pin name to be used */ void spi_init(Spi_t *spi, pin_name_e mosi, pin_name_e miso, pin_name_e sclk, pin_name_e nss); void spi_disable(Spi_t *spi); void spi_enable(Spi_t *spi); void spi_deinit(Spi_t *spi); /*! * \brief Configures the SPI peripheral * * \remark Slave mode isn't currently handled * * \param [IN] obj SPI object * \param [IN] bits Number of bits to be used. [8 or 16] * \param [IN] cpol Clock polarity * \param [IN] cpha Clock phase * \param [IN] slave When set the peripheral acts in slave mode */ void spi_format(Spi_t *spi, int8_t bits, int8_t cpol, int8_t cpha, int8_t slave); /*! * \brief Sets the SPI speed * * \param [IN] obj SPI object * \param [IN] hz SPI clock frequency in hz */ void spi_frequency( Spi_t *spi, uint32_t hz ); /*! * \brief Sends outData and receives inData * * \param [IN] spi SPI object * \param [IN] outData Byte to be sent * \retval inData Received byte. */ uint16_t spi_inout( Spi_t *spi, uint16_t out_data ); #endif
0f2532147727eca8cb52684aef4e87659227ce5d
d1dd4b53ae028b086ebc5497371e98fd2b9b5dab
/ds/so05.c
baf087dc479bc0172d625f2a108b7c0afa54daac
[]
no_license
lioren/practice
b736760344d56b766b959a598bee281882e8230e
d9545a88b60479fc2c9970318d3149c0f91d40f7
refs/heads/master
2021-01-20T19:18:50.308294
2016-08-09T07:58:09
2016-08-09T07:58:09
65,091,173
0
0
null
null
null
null
UTF-8
C
false
false
566
c
#include<stdio.h> #include<stdlib.h> #include<string.h> main() { int a,b,i,j,k; scanf("%d",&a); while(a>0){ a--; scanf("%d",&b); int c[b]; int d[b]; int e[2*b]; for(i=0;i<b;i++) scanf("%d",&c[i]); for(i=0;i<b;i++) scanf("%d",&d[i]); for(i=0,j=0,k=0;k<b;){ if(c[i]>=d[j]){ e[k]=d[j]; k++; j++; } else { e[k]=c[i]; k++; i++; } } printf("%d\n",e[b-1]); } }
b7d35f6d3090f68f108a0f610bd200072292e8c2
2c9e0541ed8a22bcdc81ae2f9610a118f62c4c4d
/harmony/tests/vts/vm/src/test/vm/jni/object_methods/CallIntMethodVTest/CallIntMethodVTest.c
f1ba963a4ec143e6b362a93dbfbda01f0df195cc
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
JetBrains/jdk8u_tests
774de7dffd513fd61458b4f7c26edd7924c7f1a5
263c74f1842954bae0b34ec3703ad35668b3ffa2
refs/heads/master
2023-08-07T17:57:58.511814
2017-03-20T08:13:25
2017-03-20T08:16:11
70,048,797
11
9
null
null
null
null
UTF-8
C
false
false
5,415
c
/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable 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 <jni.h> #define ARG1 ((jint)1000000) #define RES1 ((jint)ARG1) #define ARG22 ((jint)-150012) #define RES2 ((jint)(ARG1 + ARG22)) #define ARG3_LENGTH 2 #define ARG31 ((jint)-327551212) #define ARG32 ((jint)13211143) #define RES3 ((jint)(ARG31 + ARG32)) #define ARG42_LENGTH 3 #define ARG421 ((jint)8814231) #define ARG422 ((jint)-1) #define ARG423 ((jint)327564324) #define RES4 ((jint)((ARG31 + ARG32) + (ARG421 + ARG422 + ARG423))) #define ARG5 ((jint)1002112321) #define RES5 ((jint)ARG5) #define ARG62 ((jint)480091) #define RES6 ((jint)(ARG5 + ARG62)) static jint callNI(JNIEnv *env, jobject obj, jmethodID mid, ...) { va_list args; jint result; va_start(args, mid); result = (*env)->CallIntMethodV(env, obj, mid, args); va_end(args); return result; } /* * Method: org.apache.harmony.vts.test.vm.jni.object_methods.CallIntMethodVTest.nativeExecute(Lorg/apache/harmony/vts/test/vm/jni/object_methods/TestClass;Lorg/apache/harmony/vts/test/vm/jni/object_methods/NativeTestClass;)Z */ JNIEXPORT jboolean JNICALL Java_org_apache_harmony_vts_test_vm_jni_object_1methods_CallIntMethodVTest_nativeExecute (JNIEnv *env, jobject this_object, jobject tc, jobject ntc) { jclass ic, class1, class2; char *sig1 = "(I)I"; char *sig2 = "(II)I"; char *sig3 = "([I)I"; char *sig4 = "([I[I)I"; char *sig5 = "(Ljava/lang/Integer;)I"; char *sig6 = "(Ljava/lang/Integer;Ljava/lang/Integer;)I"; jobject io5, io62; jintArray ar3, ar42; jint *elements3, *elements42; jint result1, result2, result3, result4, result5, result6; jint nresult1, nresult2, nresult3, nresult4, nresult5, nresult6; jmethodID m1, m2, m3, m4, m5, m6; jmethodID nm1, nm2, nm3, nm4, nm5, nm6; jmethodID int_init; ar3 = (*env)->NewIntArray(env, ARG3_LENGTH); ar42 = (*env)->NewIntArray(env, ARG42_LENGTH); if (NULL == ar3 || NULL == ar42) return JNI_FALSE; elements3 = (*env)->GetIntArrayElements(env, ar3, NULL); elements42 = (*env)->GetIntArrayElements(env, ar42, NULL); if (NULL == elements3 || NULL == elements42) return JNI_FALSE; elements3[0] = ARG31; elements3[1] = ARG32; elements42[0] = ARG421; elements42[1] = ARG422; elements42[2] = ARG423; (*env)->ReleaseIntArrayElements(env, ar3, elements3, 0); (*env)->ReleaseIntArrayElements(env, ar42, elements42, 0); ic = (*env)->FindClass(env, "java/lang/Integer"); if (NULL == ic) return JNI_FALSE; int_init = (*env)->GetMethodID(env, ic, "<init>", "(I)V"); if (NULL == int_init) return JNI_FALSE; io5 = (*env)->NewObject(env, ic, int_init, ARG5); io62 = (*env)->NewObject(env, ic, int_init, ARG62); if (NULL == io5 || NULL == io62) return JNI_FALSE; class1 = (*env)->GetObjectClass(env, tc); class2 = (*env)->GetObjectClass(env, ntc); m1 = (*env)->GetMethodID(env, class1, "method", sig1); m2 = (*env)->GetMethodID(env, class1, "method", sig2); m3 = (*env)->GetMethodID(env, class1, "method", sig3); m4 = (*env)->GetMethodID(env, class1, "method", sig4); m5 = (*env)->GetMethodID(env, class1, "method", sig5); m6 = (*env)->GetMethodID(env, class1, "method", sig6); if (NULL == m1 || NULL == m2 || NULL == m3 || NULL == m4 || NULL == m5 || NULL == m6) return JNI_FALSE; nm1 = (*env)->GetMethodID(env, class2, "method", sig1); nm2 = (*env)->GetMethodID(env, class2, "method", sig2); nm3 = (*env)->GetMethodID(env, class2, "method", sig3); nm4 = (*env)->GetMethodID(env, class2, "method", sig4); nm5 = (*env)->GetMethodID(env, class2, "method", sig5); nm6 = (*env)->GetMethodID(env, class2, "method", sig6); if (NULL == nm1 || NULL == nm2 || NULL == nm3 || NULL == nm4 || NULL == nm5 || NULL == nm6) return JNI_FALSE; result1 = callNI(env, tc, m1, ARG1); result2 = callNI(env, tc, m2, ARG1, ARG22); result3 = callNI(env, tc, m3, ar3); result4 = callNI(env, tc, m4, ar3, ar42); result5 = callNI(env, tc, m5, io5); result6 = callNI(env, tc, m6, io5, io62); nresult1 = callNI(env, ntc, nm1, ARG1); nresult2 = callNI(env, ntc, nm2, ARG1, ARG22); nresult3 = callNI(env, ntc, nm3, ar3); nresult4 = callNI(env, ntc, nm4, ar3, ar42); nresult5 = callNI(env, ntc, nm5, io5); nresult6 = callNI(env, ntc, nm6, io5, io62); if (result1 != RES1 || nresult1 != RES1 || result2 != RES2 || nresult2 != RES2 || result3 != RES3 || nresult3 != RES3 || result4 != RES4 || nresult4 != RES4 || result5 != RES5 || nresult5 != RES5 || result6 != RES6 || nresult6 != RES6) return JNI_FALSE; else return JNI_TRUE; }
4ed576c7d1cd1428b3daa9fe5946d12b2252c895
c94fae6bc7779ce06e05b60a0753e82430f830b8
/MFC图形绘制/一般函数绘图/Resource.h
1dd0c4d202fe9c143eab9827157b07c67eeae25a
[]
no_license
MrsZ/MFC_VS2012
f4bbfc56f2b89c4c99c2ddc55d77e4138d3db4d0
bc623f1d13cf2fa0eb18b4f2b4f20cb5a762ad96
refs/heads/master
2021-05-29T06:00:47.703364
2015-08-19T13:16:52
2015-08-19T13:16:52
110,326,425
0
1
null
2017-11-11T07:19:09
2017-11-11T07:19:09
null
GB18030
C
false
false
501
h
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by 一般函数绘图.rc // #define IDD_ABOUTBOX 100 #define IDP_OLE_INIT_FAILED 100 #define IDR_MAINFRAME 128 #define IDR_MyTYPE 130 // 新对象的下一组默认值 // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 310 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 310 #define _APS_NEXT_COMMAND_VALUE 32771 #endif #endif
1f95d842703fc8dcafca2b1cd679c1359c84b97c
c7377c3dec984c45e43b3138bd94e5e0abc1f5a4
/includes/components/ty_gpio_base_test.h
e0017fb4e1be50a4ae673f9a8da503181bcaf6b5
[]
no_license
wwpcwzf/TuyaBTSigSDK_Reengineering
6117dce2ea4a41e4052ebdd2695a99e9438c2412
5d56b21019e2dc93c56d6521d9e3e5419492f9d5
refs/heads/master
2023-06-03T03:16:23.541895
2021-06-23T08:07:06
2021-06-23T08:07:06
332,637,793
0
0
null
null
null
null
UTF-8
C
false
false
764
h
/************************************************************************* > File Name: ty_gpio_base_test.h > Author: > Mail: > Created Time: Tue 26 Mar 2019 15:11:13 CST ************************************************************************/ #ifndef _TY_GPIO_BASE_TEST_H #define _TY_GPIO_BASE_TEST_H #include "board.h" #define MAX_GPIO_TEST_PIN 10 #define MAX_GPIO_TEST_PIN_MORE (MAX_GPIO_TEST_PIN + 1) //=8+1 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a)) typedef struct{ u8 pin_num; u32 pin[MAX_GPIO_TEST_PIN]; u8 map[MAX_GPIO_TEST_PIN]; u8 ret[MAX_GPIO_TEST_PIN_MORE]; }ty_gpio_base_test_s; typedef struct{ u8 num; u32 pin; }num2pin_t; extern u8 ty_gpio_base_test_auto(u8 *para, u8 len); #endif
e738525a2cfc57654b86b3b957775cb173528e99
2911910bbd05a77ba23c83e6a58e942b7aeccf05
/1-nbiot-liteos-oceanconnect/miniprojects/LiteOS_ThunderSoft_STM32FL476VETx/LiteOS_Kernel/base/include/los_fs.h
16025774d01f16aba1eb89df57ff260425d48b73
[ "BSD-3-Clause", "MIT" ]
permissive
zhangmeiRZ/iot-codelabs
20f85501145852a37fbb78a43e448c678804e04a
36b7b4b3d35949e0223bf4e4d92d7995fcc832c9
refs/heads/master
2020-04-09T02:47:09.391611
2018-01-08T15:22:03
2018-01-08T15:22:03
null
0
0
null
null
null
null
UTF-8
C
false
false
3,258
h
#ifndef __LOS_FS_H #define __LOS_FS_H /* Includes ------------------------------------------------------------------*/ #include <stddef.h> #include "stdint.h" #include "string.h" #define LOS_FS_READ 0x01 #define LOS_FS_OPEN_EXISTING 0x00 #define LOS_FS_WRITE 0x02 #define LOS_FS_CREATE_NEW 0x04 #define LOS_FS_CREATE_ALWAYS 0x08 #define LOS_FS_OPEN_ALWAYS 0x10 #define LOS_FS__WRITTEN 0x20 #define LOS_FS__DIRTY 0x40 /* File function return code (LOS_FRESULT) */ typedef enum { LOS_FS_OK = 0, /* (0) Succeeded */ LOS_FS_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */ LOS_FS_INT_ERR, /* (2) Assertion failed */ LOS_FS_NOT_READY, /* (3) The physical drive cannot work */ LOS_FS_NO_FILE, /* (4) Could not find the file */ LOS_FS_NO_PATH, /* (5) Could not find the path */ LOS_FS_INVALID_NAME, /* (6) The path name format is invalid */ LOS_FS_DENIED, /* (7) Access denied due to prohibited access or directory full */ LOS_FS_EXIST, /* (8) Access denied due to prohibited access */ LOS_FS_INVALID_OBJECT, /* (9) The file/directory object is invalid */ LOS_FS_WRITE_PROTECTED, /* (10) The physical drive is write protected */ LOS_FS_INVALID_DRIVE, /* (11) The logical drive number is invalid */ LOS_FS_NOT_ENABLED, /* (12) The volume has no work area */ LOS_FS_NO_FILESYSTEM, /* (13) There is no valid FAT volume */ LOS_FS_MKFS_ABORTED, /* (14) The LOS_fmkfs() aborted due to any parameter error */ LOS_FS_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */ LOS_FS_LOCKED, /* (16) The operation is rejected according to the file sharing policy */ LOS_FS_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */ LOS_FS_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */ LOS_FS_INVALID_PARAMETER /* (19) Given parameter is invalid */ } LOS_FRESULT; /*---------------------------------------------------------------------------*/ /* Fs application interface */ int LOS_fopen (const char * path, unsigned char mode); /* Open or create a file */ LOS_FRESULT LOS_fclose (int fd); /* Close an open file object */ size_t LOS_fread (void* buffer, size_t size, size_t count,int fd); /* Read data from a file */ size_t LOS_fwrite(const void* buffer, size_t size, size_t count, int fd); /* Write data to a file */ LOS_FRESULT LOS_fseek( int fd, long offset); /* Move file pointer of a file object */ LOS_FRESULT LOS_fsync (int fd); /* Flush cached data of a writing file */ LOS_FRESULT LOS_fmount (const char* path, unsigned char opt); /* Mount/Unmount a logical drive */ LOS_FRESULT LOS_fmkfs (const char* path, unsigned char sfd, unsigned int au); /* Create a file system on the volume */ #endif /* __LOS_FS_H */
6eeb241bcacaad231a9f817da29367f9a8926f7f
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/sound/pci/nm256/extr_nm256.c_snd_nm256_writel.c
681b50c7f8ff86667793710309241206b7ce35a7
[]
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
664
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 /*<<< orphan*/ u32 ; struct nm256 {scalar_t__ cport; } ; /* Variables and functions */ int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static inline void snd_nm256_writel(struct nm256 *chip, int offset, u32 val) { writel(val, chip->cport + offset); }
45ae5fcebf09a6a1a934abe06730364aaf5dc043
f3b85ae8251c0d32b0b13f5f58896049cdc0f456
/sys/dietlibc/include/signal.h
670b2471fa51a71acf7f933923d6e31f5da39dca
[]
no_license
walafc0/almos-mk
9f8e1540f48bdfee08dd82336687a6555e7dd730
885636fce42faa73f7f9218124d1a40ce2a61907
refs/heads/master
2020-12-30T14:56:07.781381
2015-08-18T15:44:22
2015-08-18T15:44:22
40,980,913
1
0
null
null
null
null
UTF-8
C
false
false
3,690
h
#ifndef _SIGNAL_H #define _SIGNAL_H #include <stdint.h> #include <sys/types.h> /* START COPY FROM KERNEL */ #define SIG_DEFAULT 0L #define SIG_IGNORE 1L #define SIG_ERROR -1L #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGURG 16 /* urgent condition on IO channel */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGCLD 20 /* System V name for SIGCHLD */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */ #define SIGIO 23 /* input/output possible signal */ #define SIGPOLL SIGIO /* System V name for SIGIO */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #define SIGWINCH 28 /* window changed */ #define SIGLOST 29 /* resource lost (eg, record-lock lost) */ #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ #define NSIG 32 /* signal 0 implied */ typedef uint32_t sigval_t; typedef uint32_t sigset_t; typedef struct siginfo_s { int si_signo; /* Signal number */ int si_errno; /* An errno value */ int si_code; /* Signal code */ pid_t si_pid; /* Sending process ID */ uid_t si_uid; /* Real user ID of sending process */ int si_status; /* Exit value or signal */ clock_t si_utime; /* User time consumed */ clock_t si_stime; /* System time consumed */ sigval_t si_value; /* Signal value */ int si_int; /* POSIX.1b signal */ void *si_ptr; /* POSIX.1b signal */ void *si_addr; /* Memory location which caused fault */ int si_band; /* Band event */ int si_fd; /* File descriptor */ }siginfo_t; struct sigaction_s { sigset_t sa_mask; uint32_t sa_flags; union { void (*sa_handler)(int); void (*sa_sigaction)(int, siginfo_t *, void *); }; }; /* END COPY FROM KERNEL */ typedef void (*__sighandler_t)(int); #ifdef _BSD_SOURCE typedef sighandler_t sig_t; #endif #ifdef _GNU_SOURCE typedef __sighandler_t sighandler_t; #endif #define SIG_DFL ((void*)SIG_DEFAULT) /* default signal handling */ #define SIG_IGN ((void*)SIG_IGNORE) /* ignore signal */ #define SIG_ERR ((void*)SIG_ERROR) /* error return from signal */ void* signal(int sig, void (*func)(int)); int kill(pid_t pid, int sig); int raise(int sig); #endif /* _SIGNAL_H_ */
62b635934b4cb221806605048b1c31dd7c5a70c6
085d238ad8c986c3bd3032a96a8c936f12419b6f
/C/ClassWork/SecondProgram/main.c
ca49f6a180bac377ffb8c46cabf8b0cfb0c6e5c0
[]
no_license
andrewtroyan/troyandz
26b7340828dc733e8d270b5650ee3aee734a5a98
6b0759d88628d16e92a81111fc1ad2ddff59f0d2
refs/heads/master
2021-01-17T16:05:42.335137
2015-05-21T08:58:28
2015-05-21T08:58:28
27,066,746
0
0
null
null
null
null
UTF-8
C
false
false
132
c
#include <stdio.h> #include <stdlib.h> int main() { int a; scanf("%d", &a); printf("2*%d=%d", a, 2*a); return 0; }
e400aa3ebaa3710f32c32c0530c851c4ffa6906b
dd71a0718b058377d83d46ca1ef09bb4a311aa6d
/src/nwpw/nwpwlib/pseudopotential/paw_atom/paw_kinetic_energy.c
b74c60daa82d365a00a4ad769c1b1e30913e3812
[ "ECL-2.0" ]
permissive
wadejong/NWChem-Json
fad5c12663311b9f24ad8e940f3977bd1b6ae335
b33e56edc54b95b003cf8c7a444febd90ce335ac
refs/heads/master
2021-01-10T01:31:59.201471
2017-08-16T01:36:27
2017-08-16T01:36:27
45,052,326
2
2
null
2017-08-14T17:19:21
2015-10-27T15:59:03
Fortran
UTF-8
C
false
false
1,006
c
/* $Id: paw_kinetic_energy.c 19707 2010-10-29 17:59:36Z d3y133 $ */ #include <stdio.h> #include <math.h> #include <stdlib.h> #include "paw_loggrid.h" double paw_get_kinetic_energy(int num_states, int *l, double *fill, double **psi, double **psi_prime) { int i; int k; int Ngrid; double ekin; double ekin_total; double log_amesh; double *f; double *r; Ngrid = paw_N_LogGrid(); log_amesh = paw_log_amesh_LogGrid(); r = paw_r_LogGrid(); f = paw_alloc_LogGrid(); ekin_total = 0.0; for (i=0; i<=num_states-1; i++) { for (k=0; k<=Ngrid-1; k++) { f[k] = 0.5*psi_prime[i][k]/(r[k]*log_amesh)* psi_prime[i][k]/(r[k]*log_amesh) +0.5*l[i]*(l[i]+1)/(r[k]*r[k])*psi[i][k]*psi[i][k]; } ekin = paw_Def_Integr(0.0,f,0.0,Ngrid-1); ekin_total = ekin_total + ekin*fill[i]; } paw_dealloc_LogGrid(f); return ekin_total; }
2b42ca9fa4377e1e27dbf9e601275c870de4aad5
a9381494ca0b5769a3dc4d9851317aa1db96b310
/kernel/tasking/Launchpad.c
0a3fbe9af0fb459b2414c661f4351435ea23685d
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ANSUUVIOUS/skift
0bacfd1ecedb5eb1b802c9c550d091005fa707e6
42c1f50ba2ea67b7576136aad200c0a799dfc3f3
refs/heads/master
2022-08-07T10:24:26.323153
2020-05-26T16:30:09
2020-05-26T16:30:09
null
0
0
null
null
null
null
UTF-8
C
false
false
3,847
c
#include <libfile/elf.h> #include <libsystem/Assert.h> #include <libsystem/CString.h> #include "kernel/tasking.h" Result task_launch_load_elf(Task *parent_task, Task *child_task, Stream *elf_file, elf_program_t *program_header) { if (program_header->vaddr <= 0x100000) { logger_error("ELF program no in user memory (0x%08x)!", program_header->vaddr); return ERR_EXEC_FORMAT_ERROR; } PageDirectory *parent_page_directory = task_switch_pdir(parent_task, child_task->pdir); paging_load_directory(child_task->pdir); task_memory_map(child_task, program_header->vaddr, PAGE_ALIGN_UP(program_header->memsz) / PAGE_SIZE); memset((void *)program_header->vaddr, 0, program_header->memsz); stream_seek(elf_file, program_header->offset, WHENCE_START); size_t read = stream_read(elf_file, (void *)program_header->vaddr, program_header->filesz); if (read != program_header->filesz) { logger_error("Didn't read the right amount from the ELF file!"); task_switch_pdir(parent_task, parent_page_directory); return ERR_EXEC_FORMAT_ERROR; } else { task_switch_pdir(parent_task, parent_page_directory); return SUCCESS; } } void task_launch_passhandle(Task *parent_task, Task *child_task, Launchpad *launchpad) { lock_acquire(parent_task->handles_lock); for (int i = 0; i < PROCESS_HANDLE_COUNT; i++) { int child_handle_id = i; int parent_handle_id = launchpad->handles[i]; if (parent_handle_id >= 0 && parent_handle_id < PROCESS_HANDLE_COUNT && parent_task->handles[parent_handle_id] != NULL) { fshandle_acquire_lock(parent_task->handles[parent_handle_id], scheduler_running_id()); child_task->handles[child_handle_id] = fshandle_clone(parent_task->handles[parent_handle_id]); fshandle_release_lock(parent_task->handles[parent_handle_id], scheduler_running_id()); } } lock_release(parent_task->handles_lock); } Result task_launch(Task *parent_task, Launchpad *launchpad, int *pid) { assert(parent_task == scheduler_running()); *pid = -1; __cleanup(stream_cleanup) Stream *elf_file = stream_open(launchpad->executable, OPEN_READ); if (handle_has_error(elf_file)) { logger_error("Failled to open ELF file %s: %s!", launchpad->executable, handle_error_string(elf_file)); return handle_get_error(elf_file); } elf_header_t elf_header; { size_t elf_header_size = stream_read(elf_file, &elf_header, sizeof(elf_header_t)); if (elf_header_size != sizeof(elf_header_t) || !elf_valid(&elf_header)) { logger_error("Failled to load ELF file %s: bad exec format!", launchpad->executable); return ERR_EXEC_FORMAT_ERROR; } } { Task *child_task = task_spawn_with_argv(parent_task, launchpad->name, (TaskEntry)elf_header.entry, (const char **)launchpad->argv, true); for (int i = 0; i < elf_header.phnum; i++) { elf_program_t elf_program_header; stream_seek(elf_file, elf_header.phoff + (elf_header.phentsize) * i, WHENCE_START); if (stream_read(elf_file, &elf_program_header, sizeof(elf_program_t)) != sizeof(elf_program_t)) { task_destroy(child_task); return ERR_EXEC_FORMAT_ERROR; } Result result = task_launch_load_elf(parent_task, child_task, elf_file, &elf_program_header); if (result != SUCCESS) { task_destroy(child_task); return result; } } task_launch_passhandle(parent_task, child_task, launchpad); *pid = child_task->id; task_go(child_task); } return SUCCESS; }
c1352170ae9d3f379147f3e606a10e3bd5d6b941
de4620a726a0e2b4391f51ced025fb7ec1f8f85f
/3_sem/lab_09/lab_09_1/mystring.c
c7b1ec38cff090a7b12a3a230f1f2461073821c5
[]
no_license
Winterpuma/bmstu_C
5b6c3cddaa53370580831b2e80c79b80e38b6994
5b37d836f14ef814dba34e027210dda48a19378d
refs/heads/master
2020-03-21T11:02:04.147940
2019-01-24T22:18:52
2019-01-24T22:18:52
138,485,423
18
0
null
null
null
null
UTF-8
C
false
false
399
c
#include <string.h> /** My realisation of strrchr @param str [in] @param ch [in] - char to find @return index of last ch in str or null */ char *my_strrchr(const char *str, int ch) { char *last_found = 0; while (*str) { if (*str == ch) last_found = (char *)str; str++; } if (ch == '\0') last_found = (char *)str; return last_found; }
2a2b0421c84147fa9b840f8f21313eee5e543028
e0548caf7bd8153f8d991b7d7c1bed487402f0bc
/semestr-5/Algorytmy i struktury danych 1/PPR/programy-z-cwiczen/2018-wiosna/dzienne/C05/03_Cz_10_15-P05/Prg_0013.c
d3a84699999135b9609977bccdd90221037a9cce
[]
no_license
Ch3shireDev/WIT-Zajecia
58d9ca03617ba07bd25ce439aeeca79533f0bcb6
3cd4f7dea6abdf7126c44a1d856ca5b6002813ca
refs/heads/master
2023-09-01T11:32:12.636305
2023-08-28T16:48:03
2023-08-28T16:48:03
224,985,239
19
24
null
2023-07-02T20:54:18
2019-11-30T08:57:27
C
UTF-8
C
false
false
693
c
#include <stdio.h> #include <stdlib.h> int main(){ int * myT; int sizeT; int i; /** 2, 3, 4 size ?= 3 T[0] ?= 5 T[1] ?= 6 T[2] ?= 1 **************** T[0] = 5 T[1] = 6 T[2] = 1 */ printf("size ?="); scanf("%d", &sizeT); myT = (int*)malloc(sizeof(int)*sizeT); for(i = 0; i<sizeT; ++i){ printf("T[%2d] ?=", i); scanf("%d", &myT[i]);/** scanf("%d", myT+i); */ } printf("*****************************\n"); for(i = 0; i<sizeT; ++i){ printf("T[%2d] = %2d\n", i, myT[i]); } return 0; }
4ee4721efb44d27e68c95233542051ebc67086c7
fa2e34373e8f1f4261cd4d4991b738ec1fd06ad5
/C Programming/DS_Day5_sol/BubbleSort/BubbleSort.c
3fdc95d3695d512cce8b2a8cb2584d0442d354df
[]
no_license
THLEE-KR/C_Programming_2019
84ba05e3a9c69c11d58f52c39d0cfb3bf9b431f7
323449f95138baf09e1e49bd314863caee78d57b
refs/heads/master
2020-05-16T21:52:54.239478
2019-04-25T06:51:39
2019-04-25T06:51:39
183,320,986
0
0
null
null
null
null
UHC
C
false
false
899
c
#include <stdio.h> #include <time.h> /* time() */ #include <stdlib.h> /* rand(), srand() */ #include "BubbleSort.h" void initArray(int *ary, int n) { int i; for(i=0; i<n; ++i) { ary[i] = rand() % 20 + 1; } } void printArray(int *ary, int n) { int i; printf("배열 내용 : "); for(i=0; i<n; ++i) { printf("%4d", ary[i]); } printf("\n"); } /*---------------------------------------------------------------- Function Name : bubbleSort() - 거품정렬 함수 Argument : ary - 정렬 데이터 저장 배열 n - 배열 원소의 수 Return : 없음 ----------------------------------------------------------------*/ void bubbleSort(int *ary, int n) { /* * TO DO */ int i; int j; int temp; for (i=(n-1) ; i>0 ; --i) { for (j=0 ; j<i ; j++) { if (ary[j] > ary[j+1]) { temp = ary[j]; ary[j] = ary[j + 1]; ary[j + 1] = temp; } } } }
f71439e5076e467c58e189b3016436d1eeb13fdb
052b2b2f37b679547a62153b98157a399faeac54
/0x12-more_singly_linked_lists/7-get_nodeint.c
7b560e4838a2816ca92b57e41785018dbd3a2179
[]
no_license
seleniadelgado/holbertonschool-low_level_programming
2ca76c53a76870347d21f6ba81f3ceb61570f1c5
3cc0c372bc0b93ff691170aea106170866ced8e8
refs/heads/master
2020-03-28T14:58:28.015754
2019-04-19T00:27:18
2019-04-19T00:27:18
148,542,057
0
0
null
null
null
null
UTF-8
C
false
false
477
c
#include "lists.h" #include <stdlib.h> #include <stdio.h> /** * get_nodeint_at_index - function that returns the nth node of a listint_t * linked list. * @head: head of the list. * @index: index of the node. * Return: temp. */ listint_t *get_nodeint_at_index(listint_t *head, unsigned int index) { listint_t *temp = head; unsigned int ct = 0; if (temp == NULL) return (NULL); while (temp != NULL && ct < index) { temp = temp->next; ct++; } return (temp); }
13e419aeb7ddbae07a8bf56fd3cc0f20a8dd5173
1fabbdfd1ca9ea1b6808893e12bd907eb74de414
/xcode/Classes/Native/mscorlib_System_Collections_Generic_Comparer_1_gen_216.h
eefb5518122044f137a8343a05c6ee9af7d968dd
[]
no_license
Klanly/TutorialPackageClient
6f889e96c40ab13c97d107708ae8f3c71a484301
b9d61ba2f287c491c9565b432f852980ec3fee28
refs/heads/master
2020-12-03T01:42:35.256114
2016-11-01T02:40:21
2016-11-01T02:40:21
null
0
0
null
null
null
null
UTF-8
C
false
false
460
h
#pragma once #include <stdint.h> // System.Collections.Generic.Comparer`1<EventDelegate> struct Comparer_1_t16729; // System.Object #include "mscorlib_System_Object.h" // System.Collections.Generic.Comparer`1<EventDelegate> struct Comparer_1_t16729 : public Object_t { }; struct Comparer_1_t16729_StaticFields{ // System.Collections.Generic.Comparer`1<T> System.Collections.Generic.Comparer`1<EventDelegate>::_default Comparer_1_t16729 * ____default; };
a260b8c894be5a09a331abef9834472f873dde13
6f37f529bae8bbcc99244468477f14e9f96ff95c
/wxWidgets-2.8.12/contrib/include/wx/gizmos/statpict.h
63a93162427db38db36671014efc673bc4f8acb3
[]
no_license
darknebuli/darknebuli-RM-graph
13326ddbc9a210605926f7ad4b70672a48b1b2f2
bf169c01f787fdd144e19fae6732a5b58fdbdafd
refs/heads/master
2020-05-16T23:40:56.853727
2012-04-30T22:14:24
2012-04-30T22:14:24
null
0
0
null
null
null
null
UTF-8
C
false
false
4,400
h
U2FsdGVkX19fTms3OENxUoetnOKy1AyJ49jWWmkNc76HrZzistQMiePY1lppDXO+ h62c4rLUDInj2NZaaQ1zvoetnOKy1AyJ49jWWmkNc758g4KpHaB8LwCS1iqVEAa/ Hm5QCwo6MZ/eqi24hkMjqT8n795o+LjO96wsYRCgGCK/H9eB6Qcfvl/3i5bc1Q74 IBVF49f/KCa2wMsUWXEVHBbooUCkMZf9xi4UygPAhG8IqWx9FWgly1MY1MmWQmw1 icpteBeH4WMdDJUQbhb4U48T5rCD8iOIuO7pKiRLb9EnPpUXXKA8/Yoa04Sq5A07 i1GZZfOjOBwT1t2Xv3EHREjF2Nmd8TyjEZA5HkAc4etCcQUAOVdaI6xCeh44aTWL L/q+QFPOOiglkNCmTylW40zrV2CBLlc37ZkcQlS4ppmHrZzistQMiePY1lppDXO+ h62c4rLUDInj2NZaaQ1zvoetnOKy1AyJ49jWWmkNc76HrZzistQMiePY1lppDXO+ PkofRZ6lEnHnOx6kbi2zyMwkyd2FOlclDwBgZxWrQTT0JAaZclCcBlkFhnFV4cuV oPEFeww0wS1eEKaQ3xVHsJNre4sNq+HwQKqysYZnfeljvOtikQhjrkiRJgM5Y1g1 f8+XbBW2TQXHxAewa0RCEMZ5lSka3zVXz7fBph4kjc7F1agJPS7A03EVFRSJ4D8S gHU/EFPs+XhfR4jtHCUlT0FiyumR3aG/GWH6CSZlRCQRqJypgAowCfsiowLHJr/n ZqSpOHxx+ABxRA71FQAa2AgQHmYsEjdm1jwAitWLsea89kiDD/SdXNp0hRICQSRm t/7+vZgvMtT+u/bK4DHSeGQbJxQ8+/PPOhpPEKR2+yivksw5i6lMKEHLAG51Uuad 7/XKAQXw7lamaVJcWimmXb+Jhs0icaHKPpS2hphLYkw+g9QZ7jmZmvQ6cCiqoFWV ioFJ2uNHh8fqmIj+X1lZ0RebFpmkKd4zF6Yxg17ONwJaMQNr+xAa3k+BziYaR1zN 3X6u5bfnRDt0q1Wxyzc7pfG81yNwVoX1dlzuagtgewYrF5DrEVa6/5ZmANOoBMRV y+wyohYCJkZ5YHT/Sx/R/kr3CSUrt9At1Rys9p+EnDblFoUgU9csvX28aRo++s33 B09oDghEGNxHRsLm15hyy0n/VSO95TIBITHEzwJZD0gTkcK0bryb/U4bZioM8eVd xldQ9V3gi7q3DUxU4YBxESbH9v54/szBSckoym0XZDjpFUGCeFY/l0DJDYhKRnhK KPbES+cXeY0lGuPRAUSdqZtN3gwK6U3XB+WSOnIAVDtx4ApqNqX8ptaE2RmRzYhF zZZWsxP6JPS+JVwUJfMTNna8h4LYCWR3qQsVfp4WDPksHd+h/DvdAInIrQvRw+I+ nD6vrcZGm8ZH/mO+fr5sdJ8Ehpkk4oSEvkgSMQTyqpFtkFs5H/RTwm1rxD7ixam1 ZiXUyXumdqppu8jDU2zhZuLzlin6ZmvP53omliLp1jPsUDdwaadpQBO6LPyxP14i X6VeIdDDS1Q5vSVPHU38wTkTHPOqyjEbdk2erYyg0l352RnE/uqclNKEgM0S51xi AmmLcm915o2+hhAI+SKwcdf/RbAhxjpwSKtFM5olVKafzVYY8kGyTUKa1GPUBOYu zWA3MDnA2/wcFdzUoi/axy2HO+j2W9nxmZUWv0PNjGVBGVun0R/M3Aa8ea088voG 8EuV52bVAphSKNR6kINfNMtiwEUm9sOVuZVuCB4vn4N39Al7wO0xOBccjC5ZPYGv AbJcYphCX5GeacTRIZRum6nv4vd4bb7L/7UcC+gFFS8zVx6P0aHAj07AUlaaGf2n vGO0HRQvoFbFUxlJ2oCO5MkABzKIE86e22WUqPmQWbmv8+lV++Wdojq8BBtnGAPd EBgjqT5YeEgk/FNslytOp6L1oG9fb36zabP2NZ71ALca6Q7wFe8xuuTP24SnSsAT 7vWxKAnbn/SIM8puvdC0y5sJ6MVuolSD8PNfRGIKW6n5huN9ekJH6gfl6GxFf2o6 WHPohbLc6lirfPWyKrfEhk7fTQiOM44V8YJ2GKjAEnCbKeKD5CeyzANt/rw+vumo d0bFCtkAPsT4jkRe9AiLiCblx/LtG1T3ENZEe3mD1RWu0ZIdNJh//jKou75jokU8 7tUnQ83RjCDSIm0fpdascdT6jn+2f3U+E5gcdaHGoAVNZ2LEGvbFvn0uh69Gd7T5 AmBvZLy8sLxbPykfOVNH483fLRrmVb6WyCukQ/4OTs2Wue+Uc2/Dv7NSP/secePX c+rpJxToTZUglSx9InlHR7+6k5Gi51OuY0ut91jeaMeXGkVrJU9Ki6HPB9TSC+t/ b2MkiiMx5wjCyhHpOlTq1KtH9sQbgcDfjUdFPa7IUJ2Nrb0pHP2vNEisLAuoIdxA v3BkqZiRCJJ3COnwcbR2IIguUJnuy/WYt79LkTJBfNPPrXxbKL7FpOwPR8NgaxKL zJAfercjTmDy91kR3ccAuTp96TNySUZ+z5IqarNlWEh+c8nAMa1HmdC9LhWK1trd 2C0cXz5Gz1MI+6dZecFC3T0J2Md+tbKVzEBUtqoo0YHrD5nqbqTRCmPnG9pdo1Ny rMu9NYfGF8bDeomBLur4u2pT6JhzhN9llK4hPTT4hrYTAIa2iafHgN8Nk8BpBBTd q4uLnqByA7MjzG7nQwa5zVLZ+MU27a5+eQZa0enYi82BeVfK7eSbuOnwdFIKm3eG wvJrzQl46zhBoaOQU1bREevVDpj1CsLE0KynLqSytYJ1s6m2mpk7Zt9hiehN9yxo buygm48Vrfx7AQt68kk0laR3cwXNWmRba6suzsh6Amm8L2GomuPfXEx4kv34M1OW d+y6nZA0e05St1E6VKh1tLtqm5Hi8LSWXfdBMvcV52cj9+TlDKpTfYjvx4a+tjJN TPTWHpop2i2btZMXZM1bgqBS/LSXJI7bpst2lS1amEJDwfKLpuSR/yF04/DD7oWk a4lQu2aOwgSv92UkfujaM1fnUFqLqy47kGAV2xq3XfHeWcCpvfijAXd7fRG6t0d8 1kW5A0FlrSZmDJEnjCGqUzERTZEU98q09Uy2rQIxfBbIS/dpywkW1PZbRA7i2ib6 F26VFYH7OmmBWpjwI54JDK1jPu5gl+RvF/xv4Zewrr+d/z9a5LFC6FPy2DObCFz2 QrbJOsH5U3V1lPrm1oVK/WlIdgb9hfMfQoMqCslE93gfYTSfbtx+KTm05RTjeI73 JYETjJ7NnLpyGB3H0NcJAa6B1sLDByfBpzI5doocq7e+cV8JAi2f7JW99yl5RvDw +xaU2GWfCfyvE4fPPEmiwoP7zdphxn3HK/R1CYdP7wq9S9aR9iO4OgyU5K74NtYj Ljf6vMDjyJRFnnORS5JyJl3pUjvDXHP2kSkbvZ6TwFPX1Ms6XLDeSMy8Gg5nUnEi HqasyD4qpE/kja0tb9WtsPfcfe+HWZSYoHtrAs6qXkiZ6LEoBBGQFEl3AHMIeNxM UV2ivK/b49nRhVpfiLWH1aZX3aIx90yJdovuYy4SoUHW3TnDeqkaDaB4nE+8Fzdn ndhQsPb+898BcHzK2/n3YjbTEDyOq4ZTIK/pxpTWDVdlMdw7dhSFZIeG5pL6LNWV KaGqj4NntB0y5XF9Q1XSWUDNoN0ugRTUNjHZNTFUtgEYVrbRqt1N+ltrI1OiNu5F dKmQupIbWYBhm5UyFifF8kjomEqyt/I7ngr92ozE9mRd+NYlLL9n5dZTYMZtqL8E Iwe8jSUeRxvcHgYt2Hn9QkgWZEE0xvjRMVsnhDCg/tK/XAIjDrp8WI2qWKox2X+1 uWvJ46vv9Yr4ZH3CTmMpJ7QgFBQ9G0i4sPBlHlZlijnFL11w5odUNZkGHag5DtNh 6t4dy4RuBjyWZBj1wdHgKD3wIJYaojwS6WuUuCkR+6ad/4JS8pnlAY1L4KyqwoSb bqQrVtBkKx/FKRwPRUMqhqcV5AZVP6BJczxSbSeWh7MetnWcOd9Cz6DBR3A5LR/K O/uQPyGz7PT13jJPfIiOCd1iHljnUFH/sjhvThTXMLscYPYnyBPBkLENTGxuxBIR G2uwlPZodVplJ3GE+elbLUTDh1VlkDujqiakPcc4SvhMTwnNceORXSNWhEDNjk6U 6Hoy8WJChYs0HSOnNC02eb5KyAFHiixitHu0jYxR6pPYUlN/1hwHLfPVSrde077A IqBwY2ua7HvuHj3/pyNi1myIzCxOw8zT+tY2NUFAbIw8cDMent1hizqsB+N4w0Wy oj7U9OnMBNIQMl41CHasHgli1FQcivtZWgQfLv4g5o0=
63760b7ad999d39a66955a5ecc04865f088300a6
110b235080393481d4c8d2e0bf47ceafe0402be1
/libft/ft_memchr.c
91ba20460ad94dc3c460603adb9dcb4d0ca88b55
[]
no_license
dkarthus/myshell
e66244bf29e3fe7dc185aaf500bf941c89ca64db
fde48de048c7d8ae8eff43fc73bf71ff36e9cb1e
refs/heads/main
2023-07-18T10:02:10.237533
2021-09-02T18:46:13
2021-09-02T18:46:13
388,801,758
0
0
null
2021-08-11T11:37:10
2021-07-23T12:56:20
C
UTF-8
C
false
false
1,138
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dkarthus <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/11/02 13:56:41 by dkarthus #+# #+# */ /* Updated: 2020/12/02 20:03:43 by dkarthus ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_memchr(const void *s, int c, size_t n) { const unsigned char *ptr; ptr = (const unsigned char *)s; while (n != 0) { if (*ptr == (unsigned char)c) return ((void *)(ptr)); ptr++; n--; } return (NULL); }
2b0e3c1c22a932aa3eebb4554898a995572ed12d
6fe1d7b5fedd758032da59557ac63bcc8ece5573
/Info-001/wolf3d/libft/srcs/ft_strdup.c
929ae117e1f0b7375fb6be35ad6c6524ea455d9a
[]
no_license
atipex/Projets
21d1759ff7877fd91cdd3247ba782dd4c19d7d68
fa105ff869f273799ea7554951a9951e79b1b547
refs/heads/master
2021-01-02T09:02:29.606143
2014-07-07T16:09:42
2014-07-07T16:09:42
null
0
0
null
null
null
null
UTF-8
C
false
false
1,186
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: mrebours <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2014/04/27 03:49:35 by mrebours #+# #+# */ /* Updated: 2014/04/27 03:49:36 by mrebours ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdlib.h> #include "libft.h" char *ft_strdup(const char *s) { int i; char *dest; i = 0; dest = (char*)malloc(sizeof(*dest) * ft_strlen(s) + 1); if (dest) { while (s[i]) { dest[i] = s[i]; i++; } dest[i] = '\0'; } else return (NULL); return (dest); }
b58376cc411abaef6ce5318e942f32bb030413d5
da1bb34fdb8d93e8e909010d50b701e023a983f2
/petsc/convect/convect.c
f230952989eab9ad3a6161a6436b278272b18f35
[]
no_license
zzyatlantise/cfdlab
cbb795c48ac3a0751179d561c3e7f2e44dd810d6
db2cffd3d3ac4b447e1f83ca15399f8ce9fac768
refs/heads/master
2021-01-23T02:16:32.599910
2016-12-28T06:21:22
2016-12-28T06:21:22
null
0
0
null
null
null
null
UTF-8
C
false
false
6,446
c
static char help[] = "Solves u_t + u_x = 0.\n\n"; #include <petscsys.h> #include <petscdm.h> #include <petscdmda.h> #include <petscvec.h> const double ark[] = {0.0, 3.0/4.0, 1.0/3.0}; const double xmin = -1.0; const double xmax = +1.0; double initcond(double x) { if(x >= -0.8 && x <= -0.6) return exp(-log(2)*pow(x+0.7,2)/0.0009); else if(x >= -0.4 && x <= -0.2) return 1.0; else if(x >= 0.0 && x <= 0.2) return 1.0 - fabs(10*(x-0.1)); else if(x>= 0.4 && x <= 0.6) return sqrt(1 - 100*pow(x-0.5,2)); else return 0.0; } //------------------------------------------------------------------------------ // Weno reconstruction // Return left value for face between u0, up1 //------------------------------------------------------------------------------ double weno5(double um2, double um1, double u0, double up1, double up2) { double eps = 1.0e-6; double gamma1=1.0/10.0, gamma2=3.0/5.0, gamma3=3.0/10.0; double beta1, beta2, beta3; double u1, u2, u3; double w1, w2, w3; beta1 = (13.0/12.0)*pow((um2 - 2.0*um1 + u0),2) + (1.0/4.0)*pow((um2 - 4.0*um1 + 3.0*u0),2); beta2 = (13.0/12.0)*pow((um1 - 2.0*u0 + up1),2) + (1.0/4.0)*pow((um1 - up1),2); beta3 = (13.0/12.0)*pow((u0 - 2.0*up1 + up2),2) + (1.0/4.0)*pow((3.0*u0 - 4.0*up1 + up2),2); w1 = gamma1 / pow(eps+beta1, 2); w2 = gamma2 / pow(eps+beta2, 2); w3 = gamma3 / pow(eps+beta3, 2); u1 = (1.0/3.0)*um2 - (7.0/6.0)*um1 + (11.0/6.0)*u0; u2 = -(1.0/6.0)*um1 + (5.0/6.0)*u0 + (1.0/3.0)*up1; u3 = (1.0/3.0)*u0 + (5.0/6.0)*up1 - (1.0/6.0)*up2; return (w1 * u1 + w2 * u2 + w3 * u3)/(w1 + w2 + w3); } //------------------------------------------------------------------------------ // Save solution to file //------------------------------------------------------------------------------ PetscErrorCode savesol(int nx, double dx, Vec ug) { int i, rank; static int count = 0; PetscErrorCode ierr; MPI_Comm_rank(PETSC_COMM_WORLD, &rank); // Gather entire solution on rank=0 process. This is bad thing to do // in a real application. VecScatter ctx; Vec uall; ierr = VecScatterCreateToZero(ug,&ctx,&uall); CHKERRQ(ierr); // scatter as many times as you need ierr = VecScatterBegin(ctx,ug,uall,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr); ierr = VecScatterEnd(ctx,ug,uall,INSERT_VALUES,SCATTER_FORWARD); CHKERRQ(ierr); // destroy scatter context and local vector when no longer needed ierr = VecScatterDestroy(&ctx); CHKERRQ(ierr); if(rank==0) { PetscScalar *uarray; ierr = VecGetArray(uall, &uarray); CHKERRQ(ierr); FILE *f; f = fopen("sol.dat","w"); for(i=0; i<nx; ++i) fprintf(f, "%e %e\n", xmin+i*dx, uarray[i]); fclose(f); printf("Wrote solution into sol.dat\n"); ierr = VecRestoreArray(uall, &uarray); CHKERRQ(ierr); if(count==0) { // Initial solution is copied to sol0.dat system("cp sol.dat sol0.dat"); count = 1; } } ierr = VecDestroy(&uall); CHKERRQ(ierr); return(0); } //------------------------------------------------------------------------------ int main(int argc, char *argv[]) { PetscErrorCode ierr; DM da; Vec ug, ul; PetscInt i, ibeg, nloc, nx=200; const PetscInt sw = 3, ndof = 1; // stencil width PetscMPIInt rank, size; double cfl = 0.4; ierr = PetscInitialize(&argc, &argv, (char*)0, help); CHKERRQ(ierr); MPI_Comm_rank(PETSC_COMM_WORLD, &rank); MPI_Comm_size(PETSC_COMM_WORLD, &size); ierr = DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_PERIODIC, -nx, ndof, sw, NULL, &da); CHKERRQ(ierr); ierr = DMCreateGlobalVector(da, &ug); CHKERRQ(ierr); ierr = DMDAGetCorners(da, &ibeg, 0, 0, &nloc, 0, 0); CHKERRQ(ierr); ierr = DMDAGetInfo(da,0,&nx,0,0,0,0,0,0,0,0,0,0,0); CHKERRQ(ierr); PetscReal dx = (xmax - xmin) / (PetscReal)(nx); PetscPrintf(PETSC_COMM_WORLD,"nx = %d, dx = %e\n", nx, dx); for(i=ibeg; i<ibeg+nloc; ++i) { PetscReal x = xmin + i*dx; PetscReal v = initcond(x); ierr = VecSetValues(ug,1,&i,&v,INSERT_VALUES); CHKERRQ(ierr); } ierr = VecAssemblyBegin(ug); CHKERRQ(ierr); ierr = VecAssemblyEnd(ug); CHKERRQ(ierr); savesol(nx, dx, ug); // Get local view ierr = DMGetLocalVector(da, &ul); CHKERRQ(ierr); PetscInt il, nl; ierr = DMDAGetGhostCorners(da,&il,0,0,&nl,0,0); CHKERRQ(ierr); double res[nloc], uold[nloc]; double dt = cfl * dx; double lam= dt/dx; double tfinal = 2.0, t = 0.0; while(t < tfinal) { if(t+dt > tfinal) { dt = tfinal - t; lam = dt/dx; } for(int rk=0; rk<3; ++rk) { ierr = DMGlobalToLocalBegin(da, ug, INSERT_VALUES, ul); CHKERRQ(ierr); ierr = DMGlobalToLocalEnd(da, ug, INSERT_VALUES, ul); CHKERRQ(ierr); PetscScalar *u; ierr = DMDAVecGetArrayRead(da, ul, &u); CHKERRQ(ierr); PetscScalar *unew; ierr = DMDAVecGetArray(da, ug, &unew); CHKERRQ(ierr); if(rk==0) for(i=ibeg; i<ibeg+nloc; ++i) uold[i-ibeg] = u[i]; for(i=0; i<nloc; ++i) res[i] = 0.0; // Loop over faces and compute flux for(i=0; i<nloc+1; ++i) { // face between j-1, j int j = il+sw+i; int jm1 = j-1; int jm2 = j-2; int jm3 = j-3; int jp1 = j+1; double uleft = weno5(u[jm3],u[jm2],u[jm1],u[j],u[jp1]); double flux = uleft; if(i==0) { res[i] -= flux; } else if(i==nloc) { res[i-1] += flux; } else { res[i] -= flux; res[i-1] += flux; } } // Update solution for(i=ibeg; i<ibeg+nloc; ++i) unew[i] = ark[rk]*uold[i-ibeg] + (1-ark[rk])*(u[i] - lam * res[i-ibeg]); ierr = DMDAVecRestoreArrayRead(da, ul, &u); CHKERRQ(ierr); ierr = DMDAVecRestoreArray(da, ug, &unew); CHKERRQ(ierr); } t += dt; PetscPrintf(PETSC_COMM_WORLD,"t = %f\n", t); } savesol(nx, dx, ug); // Destroy everything before finishing ierr = DMDestroy(&da); CHKERRQ(ierr); ierr = VecDestroy(&ug); CHKERRQ(ierr); ierr = PetscFinalize(); CHKERRQ(ierr); }
89357b77b41057afe9cf56bb565d39d5c55e1388
7413c4758b71d0cfe42dc00873036b1fc8cb3a1a
/mtcp/src/include/tcp_ring_buffer.h
70727e4c471bb239913250b3e3e8f80444846ae3
[ "BSD-3-Clause" ]
permissive
yoannd/mtcp
c310f689bf2b2bee62832afbf2f1c234ddc7a8ae
19df23d1c4f7c7851be9f1dfe5b86dc13928bd38
refs/heads/master
2021-01-21T01:43:31.383133
2016-04-27T14:56:48
2016-04-27T14:57:57
42,746,995
4
0
null
2015-09-18T21:05:36
2015-09-18T21:05:35
null
UTF-8
C
false
false
2,694
h
/* * 2010.12.10 Shinae Woo * Ring buffer structure for managing dynamically allocating ring buffer * * put data to the tail * get/pop/remove data from the head * * always garantee physically continuous ready in-memory data from data_offset to the data_offset+len * automatically increase total buffer size when buffer is full * for efficiently managing packet payload and chunking * */ #ifndef __NRE_RING_BUFFER_ #define __NRE_RING_BUFFER_ #include <stdint.h> #include <sys/types.h> /*----------------------------------------------------------------------------*/ enum rb_caller { AT_APP, AT_MTCP }; /*----------------------------------------------------------------------------*/ typedef struct rb_manager* rb_manager_t; /*----------------------------------------------------------------------------*/ struct fragment_ctx { uint32_t seq; uint32_t len : 31; uint32_t is_calloc : 1; struct fragment_ctx *next; }; /*----------------------------------------------------------------------------*/ struct tcp_ring_buffer { u_char* data; /* buffered data */ u_char* head; /* pointer to the head */ uint32_t head_offset; /* offset for the head (head - data) */ uint32_t tail_offset; /* offset fot the last byte (null byte) */ int merged_len; /* contiguously merged length */ uint64_t cum_len; /* cummulatively merged length */ int last_len; /* currently saved data length */ int size; /* total ring buffer size */ /* TCP payload features */ uint32_t head_seq; uint32_t init_seq; struct fragment_ctx* fctx; }; /*----------------------------------------------------------------------------*/ uint32_t RBGetCurnum(rb_manager_t rbm); void RBPrintInfo(struct tcp_ring_buffer* buff); void RBPrintStr(struct tcp_ring_buffer* buff); void RBPrintHex(struct tcp_ring_buffer* buff); /*----------------------------------------------------------------------------*/ rb_manager_t RBManagerCreate(size_t chunk_size, uint32_t cnum); /*----------------------------------------------------------------------------*/ struct tcp_ring_buffer* RBInit(rb_manager_t rbm, uint32_t init_seq); void RBFree(rb_manager_t rbm, struct tcp_ring_buffer* buff); uint32_t RBIsDanger(rb_manager_t rbm); /*----------------------------------------------------------------------------*/ /* data manupulation functions */ int RBPut(rb_manager_t rbm, struct tcp_ring_buffer* buff, void* data, uint32_t len , uint32_t seq); size_t RBGet(rb_manager_t rbm, struct tcp_ring_buffer* buff, size_t len); size_t RBRemove(rb_manager_t rbm, struct tcp_ring_buffer* buff, size_t len, int option); /*----------------------------------------------------------------------------*/ #endif
ace6c65f926942c046672f2bc6bc3371b6d899b5
3748cf9cb8b6944380491f9022ae0d4e90d174ca
/swa.c
885676c0d1922eaa833a2df099eab4b891f53caf
[]
no_license
rajma996/cprograms
b979600024f7a508299f5641c48d855afa2a6c63
7b59d93d12f6fafc3467bb6ff6f0c4292bc3c380
refs/heads/master
2020-03-27T19:01:15.371603
2014-11-24T17:53:21
2014-11-24T17:53:21
null
0
0
null
null
null
null
UTF-8
C
false
false
198
c
#include<stdio.h> void swap(int *p,int *q){ int k; k=*p; *p=*q; *q=k; } int main(){ int n,m; scanf("%d %d",&n,&m); int *p,*q; p=&n; q=&m; swap(p,q); printf("n=%d m=%d",n,m); return 0; }
379d1f78ee19974e8d92b004138d5f730717ffdb
ce6dc33bfee278cd96302a1a22a3b41df281fb87
/marathon/race02/src/mx_resultPrinting.c
70aa0664128ae6910f7305910d0d8ee66a2bb739
[]
no_license
EricGolovin/Marathon-C
2c18f1b81619fd862e3e6ec4450397e3917049b4
b64fcd9643f85aaca2accc6b07e5e441b3e0e2ec
refs/heads/master
2020-09-11T23:11:15.611418
2020-02-04T23:52:34
2020-02-04T23:52:34
222,221,302
2
0
null
null
null
null
UTF-8
C
false
false
271
c
#include "../inc/header.h" void mx_resultPrinting(int val1, int val2, char operation, int result) { mx_printint(val1); mx_printchar(' '); mx_printchar(operation); mx_printchar(' '); mx_printint(val2); mx_printchar(' '); mx_printint(result); mx_printchar('\n'); }
760220a91dfa388108f6671813317da657d92105
487e96b2756a614bb8b2b0e68f050f880602930c
/BF5823AM48_v1.0.3_SDK.si4project/Backup/main(5626).c
0d29c49fd3025bfcaabe3bd8202ccd87ca835227
[]
no_license
mmiker/DS08_BF5823AM48
dd6659892c96bf4c542315dcb2ed4af10284fdcd
99392463fb2fa57d0272fae402189df5434f1081
refs/heads/master
2023-05-03T19:49:09.501401
2021-04-28T09:41:07
2021-04-28T09:41:07
null
0
0
null
null
null
null
UTF-8
C
false
false
1,150
c
/*! \file main.c \brief main file */ #include "main.h" #include "dqiot_drv.h" #include "mmi_ms.h" #include "mmi_sys.h" #include "mmi_audio.h" extern uint16_t timer0_count; extern unsigned char uart_get_buf[]; extern unsigned char uart_getbuflen; uint8_t send_head = 0xF1; int main(void) { u8 i = 0; #if MIFARE_EN u8 ret; u8 gbuff[6]; #endif WDT_DISABLE(); byd_init(); WDT_ENABLE(); drv_ext_ldo_on(); drv_key_led_on(); drv_fp_init(); mmi_dq_sys_init(); //mmi_dq_aud_play_with_id(6,NULL); delay_ms(2000); drv_fp_test(); delay_ms(500); dqiot_drv_uart0_sendData(&send_head,1); dqiot_drv_uart0_sendData(&uart_getbuflen,1); dqiot_drv_uart0_sendData(uart_get_buf,uart_getbuflen); delay_ms(5000); dqiot_drv_uart0_sendData(&send_head,1); dqiot_drv_uart0_sendData(&uart_getbuflen,1); dqiot_drv_uart0_sendData(uart_get_buf,uart_getbuflen); while(1) { WDT_CTRL = WDT_TIME_2304MS; //mmi_task_proc(); #if BYD_CTK_EN byd_ctk_work(); #endif #if MIFARE_EN ret = get_card_number(gbuff); if(RETURN_OK == ret) { if(RETURN_OK == M1_Example(gbuff)) { ; } } #endif } }
e0136f92071dacd36033df925fa08c118da4ad1d
8d753bb8f19b5b1f526b0688d3cb199b396ed843
/osp_sai_2.1.8/system/lib/libasn1/constr_TYPE.h
37d21f6d9b2e5818af55948e377ad7a2b42914b0
[]
no_license
bonald/vim_cfg
f166e5ff650db9fa40b564d05dc5103552184db8
2fee6115caec25fd040188dda0cb922bfca1a55f
refs/heads/master
2023-01-23T05:33:00.416311
2020-11-19T02:09:18
2020-11-19T02:09:18
null
0
0
null
null
null
null
UTF-8
C
false
false
6,383
h
/*- * Copyright (c) 2003, 2004, 2005 Lev Walkin <[email protected]>. * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * This file contains the declaration structure called "ASN.1 Type Definition", * which holds all information necessary for encoding and decoding routines. * This structure even contains pointer to these encoding and decoding routines * for each defined ASN.1 type. */ #ifndef _CONSTR_TYPE_H_ #define _CONSTR_TYPE_H_ #include <ber_tlv_length.h> #include <ber_tlv_tag.h> #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ struct asn_TYPE_member_s; /* Forward declaration */ /* * This type provides the context information for various ASN.1 routines, * primarily ones doing decoding. A member _asn_ctx of this type must be * included into certain target language's structures, such as compound types. */ typedef struct asn_struct_ctx_s { short phase; /* Decoding phase */ short step; /* Elementary step of a phase */ int context; /* Other context information */ void *ptr; /* Decoder-specific stuff (stack elements) */ ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */ } asn_struct_ctx_t; #include <ber_decoder.h> /* Basic Encoding Rules decoder */ #include <der_encoder.h> /* Distinguished Encoding Rules encoder */ #include <xer_decoder.h> /* Decoder of XER (XML, text) */ #include <xer_encoder.h> /* Encoder into XER (XML, text) */ #include <per_decoder.h> /* Packet Encoding Rules decoder */ #include <constraints.h> /* Subtype constraints support */ /* * Free the structure according to its specification. * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) * will not be freed. (It may be useful in case the structure is allocated * statically or arranged on the stack, yet its elements are allocated * dynamically.) */ typedef void (asn_struct_free_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, int free_contents_only); /* * Print the structure according to its specification. */ typedef int (asn_struct_print_f)( struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int level, /* Indentation level */ asn_app_consume_bytes_f *callback, void *app_key); /* * Return the outmost tag of the type. * If the type is untagged CHOICE, the dynamic operation is performed. * NOTE: This function pointer type is only useful internally. * Do not use it in your application. */ typedef ber_tlv_tag_t (asn_outmost_tag_f)( struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); /* The instance of the above function type; used internally. */ asn_outmost_tag_f asn_TYPE_outmost_tag; /* * The definitive description of the destination language's structure. */ typedef struct asn_TYPE_descriptor_s { char *name; /* A name of the ASN.1 type. "" in some cases. */ char *xml_tag; /* Name used in XML tag */ /* * Generalized functions for dealing with the specific type. * May be directly invoked by applications. */ asn_struct_free_f *free_struct; /* Free the structure */ asn_struct_print_f *print_struct; /* Human readable output */ asn_constr_check_f *check_constraints; /* Constraints validator */ ber_type_decoder_f *ber_decoder; /* Generic BER decoder */ der_type_encoder_f *der_encoder; /* Canonical DER encoder */ xer_type_decoder_f *xer_decoder; /* Generic XER decoder */ xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */ per_type_decoder_f *uper_decoder; /* Unaligned PER decoder */ /*********************************************************************** * Internally useful members. Not to be used by applications directly. * **********************************************************************/ /* * Tags that are expected to occur. */ asn_outmost_tag_f *outmost_tag; /* <optional, internal> */ ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ int tags_count; /* Number of tags which are expected */ ber_tlv_tag_t *all_tags;/* Every tag for BER/containment */ int all_tags_count; /* Number of tags */ asn_per_constraints_t *per_constraints; /* PER compiled constraints */ /* * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). */ struct asn_TYPE_member_s *elements; int elements_count; /* * Additional information describing the type, used by appropriate * functions above. */ void *specifics; } asn_TYPE_descriptor_t; /* * This type describes an element of the constructed type, * i.e. SEQUENCE, SET, CHOICE, etc. */ enum asn_TYPE_flags_e { ATF_NOFLAGS, ATF_POINTER = 0x01, /* Represented by the pointer */ ATF_OPEN_TYPE = 0x02 /* ANY type, without meaningful tag */ }; typedef struct asn_TYPE_member_s { enum asn_TYPE_flags_e flags; /* Element's presentation flags */ int optional; /* Following optional members, including current */ int memb_offset; /* Offset of the element */ ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ asn_TYPE_descriptor_t *type; /* Member type descriptor */ asn_constr_check_f *memb_constraints; /* Constraints validator */ asn_per_constraints_t *per_constraints; /* PER compiled constraints */ int (*default_value)(void **sptr); /* DEFAULT <value> */ char *name; /* ASN.1 identifier of the element */ } asn_TYPE_member_t; /* * BER tag to element number mapping. */ typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ int el_no; /* Index of the associated member, base 0 */ int toff_first; /* First occurence of the el_tag, relative */ int toff_last; /* Last occurence of the el_tag, relatvie */ } asn_TYPE_tag2member_t; /* * This function is a wrapper around (td)->print_struct, which prints out * the contents of the target language's structure (struct_ptr) into the * file pointer (stream) in human readable form. * RETURN VALUES: * 0: The structure is printed. * -1: Problem dumping the structure. * (See also xer_fprint() in xer_encoder.h) */ int asn_fprint(FILE *stream, /* Destination stream descriptor */ asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ const void *struct_ptr); /* Structure to be printed */ #ifdef __cplusplus } #endif #endif /* _CONSTR_TYPE_H_ */
9c73ff8f659424e0f11e8328fd6bdcd8aa8a248e
345b4f965b515a3387fdba062a075816398e384c
/src/lib/rt/src/os_eln/rt_io_m_co_7437_33.c
a0ce3db837ed3446ec11f39956b011e265e7a755
[]
no_license
hfuhuang/proview
4fd0bf089aa6e3a303aea666652e5046cf5855d7
4172df2ae577ff3202e29f28e0afdbe0cc8780a6
refs/heads/master
2020-12-24T17:17:05.556911
2010-01-14T15:16:16
2010-01-14T15:16:16
null
0
0
null
null
null
null
ISO-8859-1
C
false
false
6,270
c
/* * Proview $Id: rt_io_m_co_7437_33.c,v 1.2 2005-09-01 14:57:56 claes Exp $ * Copyright (C) 2005 SSAB Oxelösund AB. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the program, if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* io_m_ssab_pi.c -- io methods for ssab cards. */ #if defined(OS_ELN) # include string # include stdlib # include stdio # include descrip #else # include <string.h> # include <stdlib.h> # include <stdio.h> # include <descrip.h> #endif #include "pwr.h" #include "rt_errh.h" #include "pwr_baseclasses.h" #include "rt_io_base.h" #include "rt_io_msg.h" #if defined(OS_ELN) #include "rt_io_rtp.h" #endif #include "rt_io_card_init.h" #include "rt_io_card_close.h" #include "rt_io_card_read.h" #define IO_MAXCHAN 4 #define RTP_CO_7435_33 40 #define RTP_CO_7437_33 41 /*----------------------------------------------------------------------------*\ \*----------------------------------------------------------------------------*/ /*** VMS Test ****/ #if defined(OS_VMS) typedef int DEVICE; #endif /*** Slut VMS Test ****/ typedef struct { pwr_tInt16 RackAddress; pwr_tInt32 Address; pwr_tInt16 CardType; pwr_tInt32 OldValue[IO_MAXCHAN]; int FirstScan[IO_MAXCHAN]; } io_sLocal; /*** VMS Test ****/ #if defined(OS_VMS) static void rtpco_read( pwr_tUInt16 *data, pwr_tInt16 rack_address, pwr_tInt32 card_address, int nr, pwr_tInt16 card_type) { *data = 21845; } static void rtpco_write( int chan, pwr_tInt16 rack_address, pwr_tInt32 card_address, pwr_tInt16 card_type) { } #endif /*** Slut VMS Test ****/ static pwr_tStatus IoCardInit ( io_tCtx ctx, io_sAgent *ap, io_sRack *rp, io_sCard *cp ) { pwr_tStatus sts; io_sLocal *local; int i, j; pwr_sClass_Co_7435_33 *op; /* Rtp 12/16 bit single counter */ pwr_sClass_Co_7437_33 *op_7437; /* RTP 4 x16 bit counter crad */ op = (pwr_sClass_Co_7435_33 *) cp->op; local = calloc( 1, sizeof(*local)); local->RackAddress = ((pwr_sClass_Rack_RTP *) rp->op)->RackAddress; local->Address = 1; if ( cp->Class == pwr_cClass_Co_7435_33) local->CardType = RTP_CO_7435_33; else if ( cp->Class == pwr_cClass_Co_7437_33) local->CardType = RTP_CO_7437_33; for ( i = 0; i < IO_MAXCHAN; i++) local->FirstScan[i] = 1; cp->Local = local; if ( op->MaxNoOfCounters == 1) /* If one RTP_CO 7435_33 */ { rtpco_write( 0, local->RackAddress, op->CardAddress, local->CardType); } else { op_7437 = (pwr_sClass_Co_7437_33 *) op; for (i = 0; i < op_7437->MaxNoOfCounters; i++) rtpco_write( (i << 8) | 0x440, local->RackAddress, op_7437->CardAddress, local->CardType); } for ( i = 0; i < op->MaxNoOfCounters; i++) * (pwr_tUInt32 *) cp->chanlist[i].vbp = 0; errh_Info( "Init of co card '%s'", cp->Name); return 1; } /*----------------------------------------------------------------------------*\ \*----------------------------------------------------------------------------*/ static pwr_tStatus IoCardRead ( io_tCtx ctx, io_sAgent *ap, io_sRack *rp, io_sCard *cp ) { io_sLocal *local; pwr_sClass_Co_7435_33 *op; /* Rtp 12/16 bit single counter */ pwr_sClass_Co_7437_33 *op_7437; /* RTP 4 x16 bit counter crad */ pwr_tUInt16 invmask; pwr_tUInt16 convmask; int i; pwr_tInt32 diff; pwr_tUInt16 uco16_data; if ( cp->AgentControlled) return IO__SUCCESS; local = (io_sLocal *) cp->Local; op = (pwr_sClass_Co_7435_33 *) cp->op; /* RTP produces two diffrent counter cards 7435_33 that is a 12 or 16 bit single channel card 7437_33 is a 4 channel 16 bit wide card. The only way to diffrentiate between these cards is to look at MaxNoOfChannels The RTP cards can only count upwards */ /* Check if conversion should be done for this channel, if not just don't do anything */ for ( i = 0; i < op->MaxNoOfCounters; i++) { if ( op->ConvMask & (1 << i)) { /* Conversion is on */ if ( op->MaxNoOfCounters == 1) /* Check card type */ { rtpco_read( &uco16_data, local->RackAddress, op->CardAddress, 0, local->CardType); } else { op_7437 = (pwr_sClass_Co_7437_33 *) op; /* Select channel */ rtpco_write( i << 8, local->RackAddress, op_7437->CardAddress, local->CardType); rtpco_read( &uco16_data, local->RackAddress, op_7437->CardAddress, 0, local->CardType); } /* Save the counter value */ *(pwr_tUInt32 *) cp->chanlist[i].vbp = uco16_data; if ( local->CardType == RTP_CO_7435_33 && op->NoOfBits == 12) /* Check for type and range*/ { if ( uco16_data >= local->OldValue[i]) /* Ok we haven't counted through zero */ diff = uco16_data - local->OldValue[i]; else diff = uco16_data + (4095 - local->OldValue[i]); } else { if ( uco16_data >= local->OldValue[i]) /* Ok we haven't counted through zero */ diff = uco16_data - local->OldValue[i]; else diff = uco16_data + (0xffff - local->OldValue[i]); } *(pwr_tUInt32 *) cp->chanlist[i].abs_vbp += diff; local->OldValue[i] = uco16_data; } local->FirstScan[i] = 0; } return 1; } /*----------------------------------------------------------------------------*\ Every method to be exported to the workbench should be registred here. \*----------------------------------------------------------------------------*/ pwr_dExport pwr_BindIoMethods(Co_7435_33) = { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead), pwr_NullMethod }; pwr_dExport pwr_BindIoMethods(Co_7437_33) = { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead), pwr_NullMethod };
[ "claes" ]
claes
6cd0bc2fa9cb0fb74b5a36e1c24d6d92d2ea9314
488378d66dfb12d3292886b160243aa24e27c420
/linux-3.16/tools/perf/ui/gtk/annotate.c
9c7ff8d31b274e32d22147664cb622437db514f1
[ "GPL-1.0-or-later", "Linux-syscall-note", "GPL-2.0-only", "Unlicense" ]
permissive
jj1232727/system_call
3ec72bdecad15a43638cc5eb91ba1ae229d651bb
145315cdf532c45b6aa753d98260d2b1c0b63abc
refs/heads/master
2020-08-11T13:56:16.335620
2019-10-12T11:12:53
2019-10-12T11:12:53
214,575,269
0
0
Unlicense
2019-10-12T04:06:22
2019-10-12T04:06:22
null
UTF-8
C
false
false
6,004
c
#include "gtk.h" #include "util/debug.h" #include "util/annotate.h" #include "util/evsel.h" #include "ui/helpline.h" enum { ANN_COL__PERCENT, ANN_COL__OFFSET, ANN_COL__LINE, MAX_ANN_COLS }; static const char *const col_names[] = { "Overhead", "Offset", "Line" }; static int perf_gtk__get_percent(char *buf, size_t size, struct symbol *sym, struct disasm_line *dl, int evidx) { struct sym_hist *symhist; double percent = 0.0; const char *markup; int ret = 0; strcpy(buf, ""); if (dl->offset == (s64) -1) return 0; symhist = annotation__histogram(symbol__annotation(sym), evidx); if (!symbol_conf.event_group && !symhist->addr[dl->offset]) return 0; percent = 100.0 * symhist->addr[dl->offset] / symhist->sum; markup = perf_gtk__get_percent_color(percent); if (markup) ret += scnprintf(buf, size, "%s", markup); ret += scnprintf(buf + ret, size - ret, "%6.2f%%", percent); if (markup) ret += scnprintf(buf + ret, size - ret, "</span>"); return ret; } static int perf_gtk__get_offset(char *buf, size_t size, struct symbol *sym, struct map *map, struct disasm_line *dl) { u64 start = map__rip_2objdump(map, sym->start); strcpy(buf, ""); if (dl->offset == (s64) -1) return 0; return scnprintf(buf, size, "%"PRIx64, start + dl->offset); } static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl) { int ret = 0; char *line = g_markup_escape_text(dl->line, -1); const char *markup = "<span fgcolor='gray'>"; strcpy(buf, ""); if (!line) return 0; if (dl->offset != (s64) -1) markup = NULL; if (markup) ret += scnprintf(buf, size, "%s", markup); ret += scnprintf(buf + ret, size - ret, "%s", line); if (markup) ret += scnprintf(buf + ret, size - ret, "</span>"); g_free(line); return ret; } static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, struct map *map, struct perf_evsel *evsel, struct hist_browser_timer *hbt __maybe_unused) { struct disasm_line *pos, *n; struct annotation *notes; GType col_types[MAX_ANN_COLS]; GtkCellRenderer *renderer; GtkListStore *store; GtkWidget *view; int i; char s[512]; notes = symbol__annotation(sym); for (i = 0; i < MAX_ANN_COLS; i++) { col_types[i] = G_TYPE_STRING; } store = gtk_list_store_newv(MAX_ANN_COLS, col_types); view = gtk_tree_view_new(); renderer = gtk_cell_renderer_text_new(); for (i = 0; i < MAX_ANN_COLS; i++) { gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, col_names[i], renderer, "markup", i, NULL); } gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store)); g_object_unref(GTK_TREE_MODEL(store)); list_for_each_entry(pos, &notes->src->source, node) { GtkTreeIter iter; int ret = 0; gtk_list_store_append(store, &iter); if (perf_evsel__is_group_event(evsel)) { for (i = 0; i < evsel->nr_members; i++) { ret += perf_gtk__get_percent(s + ret, sizeof(s) - ret, sym, pos, evsel->idx + i); ret += scnprintf(s + ret, sizeof(s) - ret, " "); } } else { ret = perf_gtk__get_percent(s, sizeof(s), sym, pos, evsel->idx); } if (ret) gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1); if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos)) gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1); if (perf_gtk__get_line(s, sizeof(s), pos)) gtk_list_store_set(store, &iter, ANN_COL__LINE, s, -1); } gtk_container_add(GTK_CONTAINER(window), view); list_for_each_entry_safe(pos, n, &notes->src->source, node) { list_del(&pos->node); disasm_line__free(pos); } return 0; } static int symbol__gtk_annotate(struct symbol *sym, struct map *map, struct perf_evsel *evsel, struct hist_browser_timer *hbt) { GtkWidget *window; GtkWidget *notebook; GtkWidget *scrolled_window; GtkWidget *tab_label; if (map->dso->annotate_warned) return -1; if (symbol__annotate(sym, map, 0) < 0) { ui__error("%s", ui_helpline__current); return -1; } if (perf_gtk__is_active_context(pgctx)) { window = pgctx->main_window; notebook = pgctx->notebook; } else { GtkWidget *vbox; GtkWidget *infobar; GtkWidget *statbar; signal(SIGSEGV, perf_gtk__signal); signal(SIGFPE, perf_gtk__signal); signal(SIGINT, perf_gtk__signal); signal(SIGQUIT, perf_gtk__signal); signal(SIGTERM, perf_gtk__signal); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "perf annotate"); g_signal_connect(window, "delete_event", gtk_main_quit, NULL); pgctx = perf_gtk__activate_context(window); if (!pgctx) return -1; vbox = gtk_vbox_new(FALSE, 0); notebook = gtk_notebook_new(); pgctx->notebook = notebook; gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); infobar = perf_gtk__setup_info_bar(); if (infobar) { gtk_box_pack_start(GTK_BOX(vbox), infobar, FALSE, FALSE, 0); } statbar = perf_gtk__setup_statusbar(); gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); } scrolled_window = gtk_scrolled_window_new(NULL, NULL); tab_label = gtk_label_new(sym->name); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label); perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt); return 0; } int hist_entry__gtk_annotate(struct hist_entry *he, struct perf_evsel *evsel, struct hist_browser_timer *hbt) { return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt); } void perf_gtk__show_annotations(void) { GtkWidget *window; if (!perf_gtk__is_active_context(pgctx)) return; window = pgctx->main_window; gtk_widget_show_all(window); perf_gtk__resize_window(window); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_main(); perf_gtk__deactivate_context(&pgctx); }
[ "jj1232727" ]
jj1232727
aa86ef102811c14af533f007674455cdaa23f88b
92f785de480914abbc6cd38eb24b50860a8e8f60
/platforms/aliyun/IoT-SDK_V2.0/sample/coap/iotx_coap_client.c
20a58eeb6fd97eb06ffa61abfc324792cba5181a
[ "Apache-2.0" ]
permissive
Poco-Ye/aliyun-iot-hub
ffa22e5ea2ea98f89cb61a30d120c9e88109ea8d
1898633c35a2ac926f03296ac93ca459f270fd5f
refs/heads/master
2021-05-05T10:48:07.135085
2017-12-08T07:30:41
2017-12-08T07:30:41
118,084,148
4
0
null
null
null
null
UTF-8
C
false
false
5,285
c
/* * Copyright (c) 2014-2016 Alibaba Group. All rights reserved. * 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 <stdio.h> #include <arpa/inet.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include "iot_import.h" #include "iot_export.h" #define IOTX_PRE_DTLS_SERVER_URI "coaps://pre.iot-as-coap.cn-shanghai.aliyuncs.com:5684" #define IOTX_PRE_NOSEC_SERVER_URI "coap://pre.iot-as-coap.cn-shanghai.aliyuncs.com:5683" #define IOTX_ONLINE_DTLS_SERVER_URL "coaps://%s.iot-as-coap.cn-shanghai.aliyuncs.com:5684" char m_coap_client_running = 0; static void iotx_response_handler(void * arg, void * p_response) { int len = 0; unsigned char *p_payload = NULL; iotx_coap_resp_code_t resp_code; IOT_CoAP_GetMessageCode(p_response, &resp_code); IOT_CoAP_GetMessagePayload(p_response, &p_payload, &len); printf("[APPL]: Message response code: %d\r\n", resp_code); printf("[APPL]: Len: %d, Payload: %s, \r\n", len, p_payload); } #define IOTX_PRODUCT_KEY "*******************" #define IOTX_DEVICE_NAME "*******************" #define IOTX_DEVICE_SECRET "*******************" #define IOTX_DEVICE_ID "*******************" int iotx_set_devinfo(iotx_deviceinfo_t *p_devinfo) { if(NULL == p_devinfo){ return IOTX_ERR_INVALID_PARAM; } memset(p_devinfo, 0x00, sizeof(iotx_deviceinfo_t)); strncpy(p_devinfo->device_id, IOTX_DEVICE_ID, IOTX_DEVICE_ID_LEN); strncpy(p_devinfo->product_key, IOTX_PRODUCT_KEY, IOTX_PRODUCT_KEY_LEN); strncpy(p_devinfo->device_secret,IOTX_DEVICE_SECRET, IOTX_DEVICE_SECRET_LEN); strncpy(p_devinfo->device_name, IOTX_DEVICE_NAME, IOTX_DEVICE_NAME_LEN); fprintf(stderr, "*****The Product Key : %s *****\r\n", p_devinfo->product_key); fprintf(stderr, "*****The Device Name : %s *****\r\n", p_devinfo->device_name); fprintf(stderr, "*****The Device Secret: %s *****\r\n", p_devinfo->device_secret); fprintf(stderr, "*****The Device ID : %s *****\r\n", p_devinfo->device_id); return IOTX_SUCCESS; } static void iotx_post_data_to_server(void *param) { char path[IOTX_URI_MAX_LEN+1] = {0}; iotx_message_t message; iotx_deviceinfo_t devinfo; message.p_payload = (unsigned char *)"{\"name\":\"hello world\"}"; message.payload_len = strlen("{\"name\":\"hello world\"}"); message.resp_callback = iotx_response_handler; message.msg_type = IOTX_MESSAGE_CON; message.content_type = IOTX_CONTENT_TYPE_JSON; iotx_coap_context_t *p_ctx = (iotx_coap_context_t *)param; iotx_set_devinfo(&devinfo); snprintf(path, IOTX_URI_MAX_LEN, "/topic/%s/%s/update/", (char *)devinfo.product_key, (char *)devinfo.device_name); IOT_CoAP_SendMessage(p_ctx, path, &message); } int main(int argc, char **argv) { int opt; char secur[32] = {0}; char env[32] = {0}; iotx_coap_config_t config; iotx_deviceinfo_t deviceinfo; printf("[COAP-Client]: Enter Coap Client\r\n"); while ((opt = getopt(argc, argv, "e:s:lh")) != -1){ switch(opt){ case 's': strncpy(secur, optarg, strlen(optarg)); break; case 'e': strncpy(env, optarg, strlen(optarg)); break; case 'l': m_coap_client_running = 1; break; case 'h': // TODO: break; default: break; } } memset(&config, 0x00, sizeof(iotx_coap_config_t)); if(0 == strncmp(env, "pre", strlen("pre"))){ if(0 == strncmp(secur, "dtls", strlen("dtls"))){ config.p_url = IOTX_PRE_DTLS_SERVER_URI; } else{ config.p_url = IOTX_PRE_NOSEC_SERVER_URI; } } else if(0 == strncmp(env, "online", strlen("online"))){ if(0 == strncmp(secur, "dtls", strlen("dtls"))){ char url[256] = {0}; snprintf(url, sizeof(url), IOTX_ONLINE_DTLS_SERVER_URL, IOTX_PRODUCT_KEY); config.p_url = url; } else{ printf("Online environment must access with DTLS\r\n"); return -1; } } iotx_set_devinfo(&deviceinfo); config.p_devinfo = &deviceinfo; iotx_coap_context_t *p_ctx = NULL; p_ctx = IOT_CoAP_Init(&config); if(NULL != p_ctx){ IOT_CoAP_DeviceNameAuth(p_ctx); do{ iotx_post_data_to_server((void *)p_ctx); IOT_CoAP_Yield(p_ctx); }while(m_coap_client_running); IOT_CoAP_Deinit(&p_ctx); } else{ printf("IoTx CoAP init failed\r\n"); } return 0; }
723ab10c2a7d4439fdbdc894f07338d98cf63481
49780f24a92fcc9a7c855144fb195ae3736bf390
/examples/devices/MSP430F1xx/MSP430x11x1_MSP430F21x1_Code_Examples/C/msp430x11x1_hfxtal.c
03f3c9677d266e69539360271cc19eb28029e75c
[]
no_license
PiBoxY/msp430ware
81fb264c86ff1f68f711965b793aa58794ae2f00
7c96db00f97bbfd3119843e18ac895a54b4a6d39
refs/heads/master
2020-04-21T07:29:13.386144
2019-02-06T11:32:42
2019-02-06T11:32:42
169,394,007
2
1
null
null
null
null
UTF-8
C
false
false
4,301
c
/* --COPYRIGHT--,BSD_EX * Copyright (c) 2012, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated 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. * ******************************************************************************* * * MSP430 CODE EXAMPLE DISCLAIMER * * MSP430 code examples are self-contained low-level programs that typically * demonstrate a single peripheral function or device feature in a highly * concise manner. For this the code may rely on the device's power-on default * register values and settings such as the clock configuration and care must * be taken when combining code from several examples to avoid potential side * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware * for an API functional library-approach to peripheral configuration. * * --/COPYRIGHT--*/ //****************************************************************************** // MSP430x11x1 Demo - Basic Clock, MCLK Sourced from HF XTAL // // Description: Proper selection of an external HF XTAL for MCLK is shown by // first polling the OSC fault until XTAL is stable - only then is MCLK // sourced by LFXT1. MCLK/10 is on P1.1 driven by a software loop taking // exactly 10 CPU cycles. // ACLK = MCLK = LFXT1 = HF XTAL // //* HF XTAL NOT INSTALLED ON FET *// // //* Min Vcc required varies with MCLK frequency - refer to datasheet *// // // MSP430F1121 // ----------------- // /|\| XIN|- // | | | HF XTAL (455k - 8Mhz) // --|RST XOUT|- // | | // | P1.1|-->MCLK/10 = HFXTAL/10 // | P2.0|-->ACLK = HFXTAL // // // M. Buccini // Texas Instruments Inc. // Feb 2005 // Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.21A //****************************************************************************** #include <msp430.h> int main(void) { volatile unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL P2DIR |= 0x01; // P2.0 = output direction P2SEL |= 0x01; // P2.0 = ACLK function P1DIR |= 0x02; // P1.1 = output direction do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while ((IFG1 & OFIFG)); // OSCFault flag still set? BCSCTL2 |= SELM_3; // MCLK = LFXT1 (safe) for (;;) // Infinate loop { P1OUT |= 0x02; // P1.1 = 1 P1OUT &= ~0x02; // P1.1 = 0 } }
22abcfd4c3e4d790ead67b2c04a7fe40e8a2a88a
ec7d1269672e09ff8ff2720b60f350677c8c15f1
/arm-linux-gcc-4.5.1/4.5.1/arm-none-linux-gnueabi/sys-root/usr/include/openssl/stack.h
c555128cf97d841c6f233b1abf0945f70082cce3
[]
no_license
ElevenH/First-Blood
6a4d8ed48e93660c44b0623405bf30530eeea16b
44ee02b8126c5609dc78d917633bde9caf4d0d68
refs/heads/master
2022-02-07T16:20:43.634359
2022-01-28T08:04:42
2022-01-28T08:04:42
46,023,766
0
0
null
null
null
null
UTF-8
C
false
false
4,396
h
/* crypto/stack/stack.h */ /* Copyright (C) 1995-1998 Eric Young ([email protected]) * All rights reserved. * * This package is an SSL implementation written * by Eric Young ([email protected]). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code;not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson ([email protected]). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * 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 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 acknowledgement: * "This product includes cryptographic software written by * Eric Young ([email protected])" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson ([email protected])" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES;LOSS OF USE, DATA, OR PROFITS;OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_STACK_H #define HEADER_STACK_H #ifdef __cplusplus extern "C"{ #endif typedef struct stack_st { int num; char **data; int sorted; int num_alloc; int (*comp)(const void *, const void *); } _STACK;/* Use STACK_OF(...) instead */ #define M_sk_num(sk) ((sk) ? (sk)->num:-1) #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) int sk_num(const _STACK *); void *sk_value(const _STACK *, int); void *sk_set(_STACK *, int, void *); _STACK *sk_new(int (*cmp)(const void *, const void *)); _STACK *sk_new_null(void); void sk_free(_STACK *); void sk_pop_free(_STACK *st, void (*func)(void *)); int sk_insert(_STACK *sk, void *data, int where); void *sk_delete(_STACK *st, int loc); void *sk_delete_ptr(_STACK *st, void *p); int sk_find(_STACK *st, void *data); int sk_find_ex(_STACK *st, void *data); int sk_push(_STACK *st, void *data); int sk_unshift(_STACK *st, void *data); void *sk_shift(_STACK *st); void *sk_pop(_STACK *st); void sk_zero(_STACK *st); int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *))) (const void *, const void *); _STACK *sk_dup(_STACK *st); void sk_sort(_STACK *st); int sk_is_sorted(const _STACK *st); #ifdef __cplusplus } #endif #endif
c77e475478b1b5615d7909948e781fddffc95ea9
baed6f2ef8b26339af8b4f7a9096c446a9da3b3f
/A025_ESP8266固件/Source/func/func.h
02ac90acfbeebc21b473b8626bd3264f6100e83e
[]
no_license
742117806/A025_Plus
b2bbe7fc903418a1e5d11e7853a26240be31b860
c836b116545837509ca3043e865e1afeb1592f91
refs/heads/master
2020-04-11T04:14:20.363457
2018-12-12T15:25:29
2018-12-12T15:25:29
161,505,898
0
0
null
null
null
null
GB18030
C
false
false
4,158
h
/************************************************************ Copyright (C), 2013-2015, SOSCI.Co.,Ltd. @FileName: func.h @Author : 糊读虫 @Version : 1.0 @Date : 2015-8-12 @Description: 系统操作功能 @Function List: @History : <author> <time> <version > <desc> Lennon 2015/8/12 1.0 ***********************************************************/ #ifndef _FUNCTION_H #define _FUNCTION_H //#include "include.h" #include "sys.h" void NullFucn(void); void ManualSetMenu(void); void Help(void); void SetDataTime(void); void LoadDefault(void); void Version(void); void PreviewTimer(void); void Desktop(void); void WifiApModeConfig(void); void WifiStaModeConfig(void); void WifiInfo(void); void ReturnToMenu(void); //void TimerSetup(void); void SunriseSet(void); void SundownSet(void); void SunlightSet(void); void MoonlightSet(void); void TempFan(void); void ShowCurrentPwmMenu(void); void ViewFlashEffect(void); void ViewCloudEffect(void); void ResetPreviewTimer(void); void LedOnOff(void); void Language(void);//语言切换 void saveLanguage(void); void PilotLight(void); //LED指示灯 void CheckUdataKey(void); //升级按键功能 void ShowUpdataProgress(void);//升级进度 void SetPreveiwTime(u8 hour,u8 minute); void SystemLoadDefault(void);//系统默认设置 void AdjFanByTmp(void); void ConfigWifiStaConn(void); //配置STA模式连网 //----------------------------------- void SetCustomCode(u16 code1);//设置客户代码 u16 GetCustomCode(void);//获取客户代码 void SetPwmNumber(u8 num);//设置调光路数 u8 GetPwmNumber(void);//获取调光路数 u8 GetGUID(u8 index);//获取GUID,index = 0~11 void ReadGUID(void); //读取GUID到数组中 void LedIndicatorFlash(void); //指示灯闪烁 void BeepSong(void);//蜂鸣器发声 void ErasureUserLogo(void); void DisplayUserLogo(void); extern void(*ClockFunc)(void); #define SetClockFun(X) ClockFunc=X //设置每秒要执行的函数 #define START_TMP 38 //风扇启动温度 #define MAX_TMP 46 //上限温度 #define OVER_TMP 68 //过温保护 //系统信息结构体 typedef struct _SysInfo{ u16 ledIndicator; //LED指示灯闪烁方式 u8 workmode; //工作模式 u8 indexTimer; //当前定时点 u8 nextTimer; //下一个定时点 u8 pwmNumber; //调光路数 u8 pwmSpeed; //PWM变化的速度 u8 language; //语言 0:英文 1:中文 u8 updataType; //升级类型 u8 temperature; //灯具温度 u8 OverProtect; //过温保护 u8 MunualFan; //手动测试FAN u8 Beep_type; //喇叭声音类型 }SYSINFO; //电机相关信息 typedef struct { u8 enable; u8 s_hour1; u8 s_minute1; u8 e_hour1; u8 e_minute1; u8 s_hour2; u8 s_minute2; u8 e_hour2; u8 e_minute2; u8 s_hour3; u8 s_minute3; u8 e_hour3; u8 e_minute3; u8 angle_h; u8 angle_l; u8 speed; }MotorInfo_s; //联合体 位标志 typedef union _flag{ u16 bytes; struct _b{ u16 LED_sta :1; //工作指示灯 // u16 LED_wifi :1; //WIFI指示灯 u16 LED_SAVE :1; //保存指示灯状态 uint16_t WIFI_MODE:2; //WiFi工作模式1STA,2AP,3AP+STA }Bits; }SYSFLAG; extern SYSINFO sysInfo; extern SYSFLAG sysFlag; extern MotorInfo_s motorInfo; //电机相关信息 //extern uint8_t connectingWiFiFlag; //正在连接WiFi路由器指示灯 #define SetWorkMode(X) sysInfo.workmode=X #define SetLedIndicator(X) sysInfo.ledIndicator=X //设置指示灯闪烁方式 #define SetPwmSpeed(X) sysInfo.pwmSpeed=X //设置PWM变化速度 #define SetBeepType(X) sysInfo.Beep_type=X //设置蜂鸣器 #define ENGELISH 0 //英文 #define CHINESE 1 //中文 #define IF_EN() if(sysInfo.language==ENGELISH) #define IF_CN() if(sysInfo.language==CHINESE) //LED指示灯闪烁方式 #define LED_ITR_OFF 0x0000 //关闭 #define LED_ITR_ONE 0x0F0F //1秒闪一次 #define LED_ITR_TWO 0x0009 //闪两下,灭1秒 #define LED_ITR_THREE 0x0049 //闪三下,灭一秒 #define LED_ITR_FLASH 0x5555 //狂闪 #define LED_ITR_ON 0xFFFF //一直亮 //蜂鸣器响 #define BEEP_OFF 0x00 //关闭 #define BEEP_ONE 0x80 //响一次 #define BEEP_TWO 0xA0 //响两次 #define BEEP_THREE 0xA8 //响三次 void ShowTwoNum(u8 x,u8 y,u8 num,u8 mode); #endif
0f0244dbca525bbf4c6b1a08c568a8fdbe87291a
751d837b8a4445877bb2f0d1e97ce41cd39ce1bd
/leetcode/shortest-completing-word.c
b23b86d9e1eb08fdbc82938d6f679a320f072da0
[ "MIT" ]
permissive
qeedquan/challenges
d55146f784a3619caa4541ac6f2b670b0a3dd8ba
56823e77cf502bdea68cce0e1221f5add3d64d6a
refs/heads/master
2023-08-11T20:35:09.726571
2023-08-11T13:02:43
2023-08-11T13:02:43
115,886,967
2
1
null
null
null
null
UTF-8
C
false
false
2,068
c
/* Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given string licensePlate Here, for letters we ignore case. For example, "P" on the licensePlate still matches "p" on the word. It is guaranteed an answer exists. If there are multiple answers, return the one that occurs first in the array. The license plate might have the same letter occurring multiple times. For example, given a licensePlate of "PP", the word "pair" does not complete the licensePlate, but the word "supper" does. Note: licensePlate will be a string with length in range [1, 7]. licensePlate will contain digits, spaces, or letters (uppercase or lowercase). words will have a length in the range [10, 1000]. Every words[i] will consist of lowercase letters, and have length in range [1, 15]. */ #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdint.h> #define nelem(x) (sizeof(x) / sizeof(x[0])) const char * shcw(const char *l, const char **w, size_t n) { size_t h1[256], h2[256]; size_t i, j, k, l1, l2; memset(h1, 0, sizeof(h1)); for (i = 0; l[i]; i++) { if (isalpha(l[i])) h1[tolower(l[i]) & 0xff]++; } k = SIZE_MAX; l2 = SIZE_MAX; for (i = 0; i < n; i++) { memset(h2, 0, sizeof(h2)); for (j = 0; w[i][j]; j++) h2[tolower(w[i][j]) & 0xff]++; l1 = j; if (l1 >= l2) continue; for (j = 0; j < nelem(h2); j++) h2[j] &= h1[j]; if (memcmp(h1, h2, sizeof(h1)) == 0) { l2 = l1; k = i; } } if (k == SIZE_MAX) return ""; return w[k]; } int main(void) { const char *s1[] = {"step", "steps", "stripe", "stepple"}; const char *s2[] = {"looks", "pest", "stew", "show"}; const char *s3[] = {"pair", "supper"}; printf("%s\n", shcw("1s3 PSt", s1, nelem(s1))); printf("%s\n", shcw("1s3 456", s2, nelem(s2))); printf("%s\n", shcw("1Z3 456", s2, nelem(s2))); printf("%s\n", shcw("130", s2, nelem(s2))); printf("%s\n", shcw("130", s2, nelem(s2))); printf("%s\n", shcw("20304 PP", s3, nelem(s3))); return 0; }
69aa2d8f88a8044afd1d04c86c1be3dcec5d079e
1053723697cb4e44e4a4603c258de1dccf600206
/MSP430/MSP430F5529/MSP430图形库/examples/MSP-EXP430F5438_Grlib_Example/LcdDriver/HAL_MSP_EXP430F5438_HITACHI138x110_HD66753.h
745ac3bb3bb61763904128741be027c5e7f242dd
[]
no_license
walliak/Control
9ab9590aefef5006e76318299ad634066b50c3ce
97d8d8aa1c6c0fc0315ed5217248fc3243d03d09
refs/heads/master
2020-04-27T15:59:27.424760
2019-07-31T02:45:32
2019-07-31T02:45:32
174,467,772
1
1
null
null
null
null
UTF-8
C
false
false
5,327
h
/* --COPYRIGHT--,BSD * Copyright (c) 2016, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated 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. * --/COPYRIGHT--*/ //TODO //***************************************************************************** // // HAL_MSP_EXP430F5438_HITACHI138x110_HD66753.h - Prototypes for the // Hitachi 138x110 HD66753 LCD display driver. // There is no output from Sharp96x96 LCD. // // MSP430FR5969 LCD HD66753 // ----------------- ------------ // | P9.1/UCB2SIMO|-*-LCD_DATA--> |SDA | // /|\| P9.2/UCB2SOMI|_| | | // | | P9.3/UCB2CLK|---LCD_CLK---> |SCL | // --|RST | | | // | P9.6|---LCD_CS----> |CS | // | | | | // | P9.7|---LCD_RST---> |RESET | // | | ------------ // | | // | | TPS61043 // | | ---------- // | | | | // | P8.3/TA0.4 |----BKLT_EN --> |CTRL | // | | | | // | | ---------- // ------------------ //**************************************************************************** #ifndef __HAL_MSP_EXP430F5438_HITACHI138x110_HD66753__ #define __HAL_MSP_EXP430F5438_HITACHI138x110_HD66753__ //***************************************************************************** // // User Configuration for the LCD Driver // //***************************************************************************** // Ports from MSP430 connected to LCD #define LCD_BKLT_EN_PORT GPIO_PORT_P8 #define LCD_CS_PORT GPIO_PORT_P9 #define LCD_RST_PORT GPIO_PORT_P9 #define LCD_SIMO_PORT GPIO_PORT_P9 #define LCD_SOMI_PORT GPIO_PORT_P9 #define LCD_CLK_PORT GPIO_PORT_P9 // Pins from MSP430 connected to LCD #define LCD_BKLT_EN_PIN GPIO_PIN3 #define LCD_CS_PIN GPIO_PIN6 #define LCD_RST_PIN GPIO_PIN7 #define LCD_SIMO_PIN GPIO_PIN1 #define LCD_SOMI_PIN GPIO_PIN2 #define LCD_CLK_PIN GPIO_PIN3 // Definition of USCI base address to be used for SPI communication #define LCD_USCI_BASE USCI_B2_BASE // Definition of TIMER_A base address to be used for backlight control #define LCD_TIMER_BASE_BKLT TIMER_A0_BASE //***************************************************************************** // // Deprecated names. These definitions ensure backwards compatibility // but new code should avoid using deprecated struct names since these will // be removed at some point in the future. // //***************************************************************************** //***************************************************************************** // // Prototypes for the globals exported by this driver. // //***************************************************************************** extern void HAL_LCD_initLCD(void); extern void HAL_LCD_writeCommand(uint8_t *command); extern void HAL_LCD_clearCS(void); extern void HAL_LCD_setCS(void); extern void HAL_LCD_initTimer(uint16_t captureCompareVal); extern uint16_t HAL_LCD_getTimerCaptureCompare(); extern void HAL_LCD_setTimerDutyCycle(uint16_t dutyCycle); extern void HAL_LCD_startTimerCounter(void); extern void HAL_LCD_stopTimerCounter(void); extern void HAL_LCD_turnOffBackLight(void); #endif // __HAL_MSP_EXP430F5438_HITACHI138x110_HD66753__
57470872219f0579a3ce9dbb8a1fdcfb8fa0f9d2
7eaaa10e3d78c3875441ccf2216a54ce6b4d6261
/ZLinky/SDK_2_6_4_JN5189DK6/boards/jn5189dk6/project_template/clock_config.h
f52c1e54546ed0c9de41fd1cb39a805eb3adcc0b
[]
no_license
bricodx/Zlinky_TIC
069eff9ccf1973b8f4e0480fbb474c73b6a81c4b
161f1577c2531a9cdd3470d4dff105b0f1f64218
refs/heads/master
2023-08-28T09:50:37.515687
2021-11-13T09:07:02
2021-11-13T09:07:02
null
0
0
null
null
null
null
UTF-8
C
false
false
2,257
h
/* * Copyright 2019-2020 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. **********************************************************************************************************************/ #ifndef _CLOCK_CONFIG_H_ #define _CLOCK_CONFIG_H_ #include "fsl_common.h" /******************************************************************************* * Definitions ******************************************************************************/ /******************************************************************************* ************************ BOARD_InitBootClocks function ************************ ******************************************************************************/ #if defined(__cplusplus) extern "C" { #endif /* __cplusplus*/ /*! * @brief This function executes default configuration of clocks. * */ void BOARD_InitBootClocks(void); #if defined(__cplusplus) } #endif /* __cplusplus*/ /******************************************************************************* ********************** Configuration BOARD_BootClockRUN *********************** ******************************************************************************/ /******************************************************************************* * Definitions for BOARD_BootClockRUN configuration ******************************************************************************/ #define BOARD_BOOTCLOCKRUN_CORE_CLOCK 48000000U /*!< Core clock frequency: 48000000Hz */ /******************************************************************************* * API for BOARD_BootClockRUN configuration ******************************************************************************/ #if defined(__cplusplus) extern "C" { #endif /* __cplusplus*/ /*! * @brief This function executes configuration of clocks. * */ void BOARD_BootClockRUN(void); #if defined(__cplusplus) } #endif /* __cplusplus*/ #endif /* _CLOCK_CONFIG_H_ */
c9f04f786abc00a2a9e1dfb81508921f57fee0ed
a72a706c9fddc1aeccd969ecce4661a7761c7e72
/inc/controller.h
22369d14b0de0413bda46f6b58970b1cd85550a8
[]
no_license
misterdoud/CC3D-CableCam-Controller
ed607902406863695a374e9b2292f6f2ed361025
249660f534dcde9e865e97d843cdfaaf2d4af315
refs/heads/master
2021-06-24T22:02:49.876812
2017-09-03T04:56:15
2017-09-03T04:56:42
null
0
0
null
null
null
null
UTF-8
C
false
false
605
h
#ifndef CONTROLLER_H_ #define CONTROLLER_H_ #include "stm32f4xx.h" #define APP_TX_BUF_SIZE 512 void setServoNeutralRange(uint16_t forward, uint16_t reverse); void initController(void); void controllercycle(void); void setPIDValues(double, double, double); void setPValue(double); void setIValue(double); void setDValue(double); int32_t getTargetPos(void); int32_t getPos(void); int16_t getStick(void); void resetThrottle(void); void resetPosTarget(void); uint16_t getProgrammingSwitch(void); uint16_t getEndPointSwitch(void); uint16_t getMaxAccelPoti(void); uint16_t getMaxSpeedPoti(void); #endif
b850d48e1cc37091751c2cc5c882a431ff562358
c55d472c09da4d0f62997bcfc7e8bfe7d8be7fdb
/apue/pthread/abcde_cond.c
23fb87be4cd95d8831eb99dd05eb277609f0faa8
[]
no_license
zzy0119/emb20210322
83492cf990541f98250038118fd804127ba85818
7adb8ac29fca551cf2e068f0096a2e0633508577
refs/heads/master
2023-05-15T19:52:18.701457
2021-06-18T03:47:35
2021-06-18T03:47:35
357,404,476
0
0
null
null
null
null
UTF-8
C
false
false
1,106
c
#include <stdio.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> #include <sched.h> #define THRNR 5 static int jobid = -1; static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static void *thrJob(void *arg) { int selfid = (int)arg; while (1) { pthread_mutex_lock(&mut); while (jobid != selfid) { pthread_cond_wait(&cond, &mut); } fprintf(stdout, "%c", 'a'+selfid); fflush(NULL); jobid = -1; sleep(1); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mut); } } int main(void) { pthread_t tids[THRNR] = {}; int i; int err; alarm(50); for (i = 0; i < THRNR; i++) { err = pthread_create(tids+i, NULL, thrJob, (void *)i); if (err) { fprintf(stderr, "pthread_create():%s\n", \ strerror(err)); exit(1); } } for (i = 0; ; i = (i+1) % THRNR) { pthread_mutex_lock(&mut); while (jobid != -1) { pthread_cond_wait(&cond, &mut); } jobid = i; pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mut); } pthread_mutex_destroy(&mut); exit(0); }
1b5e2255b6461c4f8d247bb6e5c10d097cadcbb6
c9b1d9481663f35a745533e215e512c31f00f945
/libraries/c_sdk/standard/ble/include/iot_ble_mqtt_transport.h
4d79123aa7a1bf31c87617e1fa86ce094de247fa
[ "Apache-2.0", "MIT" ]
permissive
ambiot/amazon-freertos
199d8c8cfebf7d4ce41cdf0377a6622c56ea3f7c
ef61d5f521de921cc931d9262e3d5af9b75fbd2e
refs/heads/master
2023-08-24T08:06:28.437220
2021-07-08T13:33:49
2021-07-08T13:33:49
191,755,880
14
16
MIT
2022-09-20T23:47:06
2019-06-13T12:09:22
C
UTF-8
C
false
false
3,750
h
/* * FreeRTOS BLE V2.2.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 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 IOT_BLE_MQTT_TRANSPORT_H #define IOT_BLE_MQTT_TRANSPORT_H /* Standard includes. */ #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include "FreeRTOS.h" #include "stream_buffer.h" #include "iot_ble_mqtt_transport_config.h" #include "iot_ble_mqtt_serialize.h" #include "iot_ble_data_transfer.h" typedef struct NetworkContext { IotBleDataTransferChannel_t * pChannel; StreamBufferHandle_t xStreamBuffer; StaticStreamBuffer_t xStreamBufferStruct; MQTTBLEPublishInfo_t publishInfo; } NetworkContext_t; /** * @brief Initiailzes the Circular buffer to store the received data * * @param[in] pBuffer Pointer to the buffer allocated by the application and used by the transport interface to * stream MQTT data. * @param[in] bufSize The size of the buffer allocated. * @param[out] pContext An opaque used by transport interface and to be passed to the MQTT library. * @return status of the initialization. */ bool IotBleMqttTransportInit( void * pBuffer, size_t bufSize, NetworkContext_t * pContext ); /** * @brief Cleans up the Circular buffer. * * @param[in] pContext An opaque used by transport interface. */ void IotBleMqttTransportCleanup( const NetworkContext_t * pContext ); /** * @brief Function to accept data from the channel * * @param[in] pContext An opaque used by transport interface. * @return the status of the accept */ MQTTBLEStatus_t IotBleMqttTransportAcceptData( const NetworkContext_t * pContext ); /** * @brief Transport interface write function. * * @param[in] pContext An opaque used by transport interface. * @param[in] pBuffer A pointer to a buffer containing data to be sent out. * @param[in] bytesToWrite number of bytes to write from the buffer. * @return the number of bytes sent. */ int32_t IotBleMqttTransportSend( NetworkContext_t * pContext, const void * pBuffer, size_t bytesToWrite ); /** * @brief Transport interface read function. * * @param[in] pContext An opaque used by transport interface. * @param[in] pBuffer A pointer to a buffer where incoming data will be stored. * @param[in] bytesToRead number of bytes to read from the transport layer. * @return the number of bytes successfully read. */ int32_t IotBleMqttTransportReceive( NetworkContext_t * pContext, void * pBuffer, size_t bytesToRead ); #endif /* ifndef IOT_BLE_MQTT_TRANSPORT_H */
bf06890ab72e935eea215f63cb1e7531c43c9a01
20fd55cec00f7212e3361040907b2f0f5fc9f403
/prbFuzzer/IE/fuzzIBSS.c
598db58b28f3e70491528166a15767cab84fe8e5
[]
no_license
b4rt-dev/cfuzz
a5144a4f6932624b4b71ba98d5fd0219e57a2955
243e52af0163b476e27f16453ddf3e3acfc42ec9
refs/heads/master
2020-12-27T18:14:48.986513
2020-01-09T10:17:17
2020-01-09T10:17:17
238,001,659
0
0
null
null
null
null
UTF-8
C
false
false
5,557
c
/* Fuzzes ibss Information element */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "../frameDefinitions.h" //Indecates whether the ibssFuzzer is running int ibssRunningState = 0; //Number of fuzzing states const int ibssStates = 4; //Steps of fuzzers for each fuzzing state const int ibssSteps[] = {1, 2, 16, 16}; //Current state and step of the ibssFuzzer int fuzzState; int fuzzStep; void ibssPrintCurrentState() { switch (fuzzState) { case 0: { printf("\e[33mFuzzing ibss IE\e[39m\n"); printf("Trying 255*0xFF data\n"); break; } case 1: { printf("Fuzzing ATIM Window\n"); break; } case 2: { printf("Fuzzing lengths with 0xFF data\n"); break; } case 3: { printf("Fuzzing lengths with 0x00 data\n"); break; } case 4: { printf("\e[33mDone with fuzzing ibss\e[39m\n"); break; } } } //Updates ibssFuzzer //Status 0 indicates start //Status 1 indicates increaseStep //Status 2 indicates stop //Returns -1 if done with fuzzing int ibssFuzzUpdate(int status) { switch (status) { case 0: //start fuzzer { ibssRunningState = 1; fuzzState = 0; fuzzStep = 0; ibssPrintCurrentState(); break; } case 1: //update fuzzer { if (ibssRunningState == 1) //sanity check { //increase steps until all steps are done if (fuzzStep < ibssSteps[fuzzState]-1) fuzzStep = fuzzStep + 1; //then increase state and notify else { fuzzStep = 0; fuzzState = fuzzState + 1; ibssPrintCurrentState(); } //when all states are done, stop if (fuzzState == ibssStates) { ibssRunningState = 0; return -1; } } break; } case 2: //stop fuzzer { ibssRunningState = 0; break; } } return 0; } //Returns an ibss information element infoElem ibssFuzz() { infoElem ibss; //What to return when not fuzzed if (ibssRunningState == 0) { ibss.id = 0; ibss.len = 1; ibss.len_data = -1; ibss.data = "\xab"; } else { switch (fuzzState) //update this { case 0: //255*0xff { ibss.id = 6; ibss.len = 255; ibss.len_data = 255; //create data of 255 times 0xff u_char *data = malloc(255); memset(data, 0xff, 255); ibss.data = data; break; } case 1: //ibss null data { if (fuzzStep == 0) { ibss.id = 6; ibss.len = 2; ibss.len_data = 2; ibss.data = "\x00\x00"; } else { ibss.id = 6; ibss.len = 2; ibss.len_data = 2; ibss.data = "\xFF\xFF"; } break; } case 2: //length with 0xff data { if (fuzzStep < 8) { int dataSize = fuzzStep; ibss.id = 6; ibss.len = dataSize; ibss.len_data = dataSize; //create data of datasize times 0xff u_char *data = malloc(dataSize); memset(data, 0xff, dataSize); ibss.data = data; } else { int dataSize = 255 - fuzzStep + 8; ibss.id = 6; ibss.len = dataSize; ibss.len_data = dataSize; //create data of datasize times 0xff u_char *data = malloc(dataSize); memset(data, 0xff, dataSize); ibss.data = data; } break; } case 3: //length with 0x00 data { if (fuzzStep < 8) { int dataSize = fuzzStep; ibss.id = 6; ibss.len = dataSize; ibss.len_data = dataSize; //create data of datasize times 0x00 u_char *data = malloc(dataSize); memset(data, 0x00, dataSize); ibss.data = data; } else { int dataSize = 255 - fuzzStep + 8; ibss.id = 6; ibss.len = dataSize; ibss.len_data = dataSize; //create data of datasize times 0x00 u_char *data = malloc(dataSize); memset(data, 0x00, dataSize); ibss.data = data; } break; } } } return ibss; }
c54ec4819d52b106f03643faaa03e4607ac6d28c
2e1465297cf42e43a8f8dc2de259adedba0106bd
/Include/susiaccess_handler_ex_api.h
77aa59eec5ec35bb224f031c32a335c76cea157c
[]
no_license
12019/WISEAgent
cecdc0e384fc96bef74af058f30096ae39e468f1
3e0ac013644d38107b4b05a12f3351c8a4b49736
refs/heads/master
2021-01-11T22:20:13.852283
2016-02-02T07:03:32
2016-02-02T07:03:32
78,949,980
0
1
null
2017-01-14T16:00:55
2017-01-14T16:00:55
null
UTF-8
C
false
false
1,954
h
#ifndef _CAGENT_HANDLER_EX_H_ #define _CAGENT_HANDLER_EX_H_ #include "susiaccess_handler_api.h" typedef AGENT_SEND_STATUS (*HandlerConnectServerCbf)(char const * ip, int port, char const * mqttauth, tls_type tlstype, char const * psk); typedef AGENT_SEND_STATUS (*HandlerDisconnectCbf)(); typedef AGENT_SEND_STATUS (*HandlerRenameCbf)(char const * name); typedef struct HANDLER_INFO_EX { #ifdef _MSC_VER struct HANDLER_INFO; #else char Name[MAX_TOPIC_LEN]; // The handler name char ServerIP[DEF_MAX_STRING_LENGTH]; int ServerPort; char WorkDir[DEF_MAX_STRING_LENGTH]; int RequestID; int ActionID; //key_t shmKey; // shared memory key void* loghandle; // log file handler //GetLibFNP GetLibAPI; // Get the Function Point of comman library api cagent_agent_info_body_t * agentInfo; // Info of the Agent HandlerSendCbf sendcbf; // Client Send information (in JSON format) to Cloud Server HandlerSendCustCbf sendcustcbf; // Client Send information (in JSON format) to Cloud Server with custom topic HandlerSubscribeCustCbf subscribecustcbf; // Client subscribe the custom topic to receive message from Cloud Server HandlerSendCapabilityCbf sendcapabilitycbf; // Client Send Spec.Info (in JSON format) to Cloud Server with SpecInfo topic HandlerAutoReportCbf sendreportcbf; // Client Send report (in JSON format) to Cloud Server with AutoReport topic HandlerSendEventCbf sendeventcbf; // Client Send Event Notify (in JSON format) to Cloud Server with EventNotify topic #endif HandlerConnectServerCbf connectservercbf; // connect to specific server callback function HandlerDisconnectCbf disconnectcbf; // disconnect callback function HandlerRenameCbf renamecbf; // rename callback function char serverAuth[DEF_USER_PASS_LENGTH]; tls_type TLSType; char PSK[DEF_USER_PASS_LENGTH]; }HANDLER_INFO_EX, Handler_info_ex; #endif /* _CAGENT_HANDLER_EX_H_ */
f54c2075455dbbae2bebf1dc6bdcb6c15f0e2f4e
8e1691fa76f47c62bbf6b8d83f5d5f13647aacaf
/GPIO_ThreadX/synergy_cfg/ssp_cfg/bsp/bsp_clock_cfg.h
47a403f5d281372a9704d146efcf5db92c174ae8
[]
no_license
dongdong-2009/Renesas_S7G2
4c9933a2ef29d1057c4f1493aaed0906b6612501
86379eb843825975a3c2f8b01efe91b93f6167ec
refs/heads/master
2021-07-04T19:02:16.126614
2017-09-25T01:15:45
2017-09-25T01:15:45
null
0
0
null
null
null
null
UTF-8
C
false
false
1,122
h
/* generated configuration header file - do not edit */ #ifndef BSP_CLOCK_CFG_H_ #define BSP_CLOCK_CFG_H_ #define BSP_CFG_XTAL_HZ (24000000) /* XTAL 24000000Hz */ #define BSP_CFG_PLL_SOURCE (CGC_CLOCK_MAIN_OSC) /* PLL Src: XTAL */ #define BSP_CFG_HOCO_FREQUENCY (0) /* HOCO 16MHz */ #define BSP_CFG_PLL_DIV (CGC_PLL_DIV_2) /* PLL Div /2 */ #define BSP_CFG_PLL_MUL (20.0) /* PLL Mul x20.0 */ #define BSP_CFG_CLOCK_SOURCE (CGC_CLOCK_PLL) /* Clock Src: PLL */ #define BSP_CFG_ICK_DIV (CGC_SYS_CLOCK_DIV_1) /* ICLK Div /1 */ #define BSP_CFG_PCKA_DIV (CGC_SYS_CLOCK_DIV_2) /* PCLKA Div /2 */ #define BSP_CFG_PCKB_DIV (CGC_SYS_CLOCK_DIV_4) /* PCLKB Div /4 */ #define BSP_CFG_PCKC_DIV (CGC_SYS_CLOCK_DIV_4) /* PCLKC Div /4 */ #define BSP_CFG_PCKD_DIV (CGC_SYS_CLOCK_DIV_2) /* PCLKD Div /2 */ #define BSP_CFG_SDCLK_OUTPUT (1) /* SDCLKout On */ #define BSP_CFG_BCK_DIV (CGC_SYS_CLOCK_DIV_2) /* BCLK Div /2 */ #define BSP_CFG_BCLK_OUTPUT (2) /* BCK/2 */ #define BSP_CFG_UCK_DIV (CGC_USB_CLOCK_DIV_5) /* UCLK Div /5 */ #define BSP_CFG_FCK_DIV (CGC_SYS_CLOCK_DIV_4) /* FCLK Div /4 */ #endif /* BSP_CLOCK_CFG_H_ */
e157b8e135f3e5e21ebb4321835563aa1cdfedbb
913a0efa1b36ac741a36b3f94d872562c51ef572
/Binaries/iOS/Classes/Native/mscorlib_System_Globalization_DateTimeStyles.h
4f519f026d26a3feaa7fbf00667a892a35a82905
[ "MIT" ]
permissive
masanori840816/SetMaterialsFromGallery
41d3a89488c349f54586bfb367eb021ca7356357
ce6d67874e42706feca5e5a66f9b6785992b9dda
refs/heads/master
2021-01-18T01:23:54.041302
2015-05-21T13:21:44
2015-05-21T13:21:44
34,765,403
5
2
null
null
null
null
UTF-8
C
false
false
340
h
#pragma once #include <stdint.h> // System.Enum #include "mscorlib_System_Enum.h" // System.Globalization.DateTimeStyles #include "mscorlib_System_Globalization_DateTimeStyles.h" // System.Globalization.DateTimeStyles struct DateTimeStyles_t1312 { // System.Int32 System.Globalization.DateTimeStyles::value__ int32_t ___value___1; };
a7921c5ce79c70d7e49741ac7babd44d860e2007
f0c9b1e8ac94382cc17d82d14b22ef82a31d1e82
/SFT1.0v/Design01.cydsn/Generated_Source/PSoC5/CW_CCW_2.h
9faaef867cdadb79c70cff56de8d45a8864d2ca9
[]
no_license
dsky7/PSoC
115b7dfcbf477932e73ce0bb755201133e676b43
303e8ada834d22dffc2de1bb5348882645f135ae
refs/heads/master
2020-05-29T10:33:39.095777
2015-08-20T09:54:28
2015-08-20T09:54:28
34,363,321
0
0
null
null
null
null
UTF-8
C
false
false
5,143
h
/******************************************************************************* * File Name: CW_CCW_2.h * Version 2.5 * * Description: * This file containts Control Register function prototypes and register defines * * Note: * ******************************************************************************** * Copyright 2008-2014, 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_PINS_CW_CCW_2_H) /* Pins CW_CCW_2_H */ #define CY_PINS_CW_CCW_2_H #include "cytypes.h" #include "cyfitter.h" #include "cypins.h" #include "CW_CCW_2_aliases.h" /* Check to see if required defines such as CY_PSOC5A are available */ /* They are defined starting with cy_boot v3.0 */ #if !defined (CY_PSOC5A) #error Component cy_pins_v2_5 requires cy_boot v3.0 or later #endif /* (CY_PSOC5A) */ /* APIs are not generated for P15[7:6] */ #if !(CY_PSOC5A &&\ CW_CCW_2__PORT == 15 && ((CW_CCW_2__MASK & 0xC0) != 0)) /*************************************** * Function Prototypes ***************************************/ void CW_CCW_2_Write(uint8 value) ; void CW_CCW_2_SetDriveMode(uint8 mode) ; uint8 CW_CCW_2_ReadDataReg(void) ; uint8 CW_CCW_2_Read(void) ; uint8 CW_CCW_2_ClearInterrupt(void) ; /*************************************** * API Constants ***************************************/ /* Drive Modes */ #define CW_CCW_2_DM_ALG_HIZ PIN_DM_ALG_HIZ #define CW_CCW_2_DM_DIG_HIZ PIN_DM_DIG_HIZ #define CW_CCW_2_DM_RES_UP PIN_DM_RES_UP #define CW_CCW_2_DM_RES_DWN PIN_DM_RES_DWN #define CW_CCW_2_DM_OD_LO PIN_DM_OD_LO #define CW_CCW_2_DM_OD_HI PIN_DM_OD_HI #define CW_CCW_2_DM_STRONG PIN_DM_STRONG #define CW_CCW_2_DM_RES_UPDWN PIN_DM_RES_UPDWN /* Digital Port Constants */ #define CW_CCW_2_MASK CW_CCW_2__MASK #define CW_CCW_2_SHIFT CW_CCW_2__SHIFT #define CW_CCW_2_WIDTH 1u /*************************************** * Registers ***************************************/ /* Main Port Registers */ /* Pin State */ #define CW_CCW_2_PS (* (reg8 *) CW_CCW_2__PS) /* Data Register */ #define CW_CCW_2_DR (* (reg8 *) CW_CCW_2__DR) /* Port Number */ #define CW_CCW_2_PRT_NUM (* (reg8 *) CW_CCW_2__PRT) /* Connect to Analog Globals */ #define CW_CCW_2_AG (* (reg8 *) CW_CCW_2__AG) /* Analog MUX bux enable */ #define CW_CCW_2_AMUX (* (reg8 *) CW_CCW_2__AMUX) /* Bidirectional Enable */ #define CW_CCW_2_BIE (* (reg8 *) CW_CCW_2__BIE) /* Bit-mask for Aliased Register Access */ #define CW_CCW_2_BIT_MASK (* (reg8 *) CW_CCW_2__BIT_MASK) /* Bypass Enable */ #define CW_CCW_2_BYP (* (reg8 *) CW_CCW_2__BYP) /* Port wide control signals */ #define CW_CCW_2_CTL (* (reg8 *) CW_CCW_2__CTL) /* Drive Modes */ #define CW_CCW_2_DM0 (* (reg8 *) CW_CCW_2__DM0) #define CW_CCW_2_DM1 (* (reg8 *) CW_CCW_2__DM1) #define CW_CCW_2_DM2 (* (reg8 *) CW_CCW_2__DM2) /* Input Buffer Disable Override */ #define CW_CCW_2_INP_DIS (* (reg8 *) CW_CCW_2__INP_DIS) /* LCD Common or Segment Drive */ #define CW_CCW_2_LCD_COM_SEG (* (reg8 *) CW_CCW_2__LCD_COM_SEG) /* Enable Segment LCD */ #define CW_CCW_2_LCD_EN (* (reg8 *) CW_CCW_2__LCD_EN) /* Slew Rate Control */ #define CW_CCW_2_SLW (* (reg8 *) CW_CCW_2__SLW) /* DSI Port Registers */ /* Global DSI Select Register */ #define CW_CCW_2_PRTDSI__CAPS_SEL (* (reg8 *) CW_CCW_2__PRTDSI__CAPS_SEL) /* Double Sync Enable */ #define CW_CCW_2_PRTDSI__DBL_SYNC_IN (* (reg8 *) CW_CCW_2__PRTDSI__DBL_SYNC_IN) /* Output Enable Select Drive Strength */ #define CW_CCW_2_PRTDSI__OE_SEL0 (* (reg8 *) CW_CCW_2__PRTDSI__OE_SEL0) #define CW_CCW_2_PRTDSI__OE_SEL1 (* (reg8 *) CW_CCW_2__PRTDSI__OE_SEL1) /* Port Pin Output Select Registers */ #define CW_CCW_2_PRTDSI__OUT_SEL0 (* (reg8 *) CW_CCW_2__PRTDSI__OUT_SEL0) #define CW_CCW_2_PRTDSI__OUT_SEL1 (* (reg8 *) CW_CCW_2__PRTDSI__OUT_SEL1) /* Sync Output Enable Registers */ #define CW_CCW_2_PRTDSI__SYNC_OUT (* (reg8 *) CW_CCW_2__PRTDSI__SYNC_OUT) #if defined(CW_CCW_2__INTSTAT) /* Interrupt Registers */ #define CW_CCW_2_INTSTAT (* (reg8 *) CW_CCW_2__INTSTAT) #define CW_CCW_2_SNAP (* (reg8 *) CW_CCW_2__SNAP) #endif /* Interrupt Registers */ #endif /* CY_PSOC5A... */ #endif /* CY_PINS_CW_CCW_2_H */ /* [] END OF FILE */
eb3fb6c567f172783a80a420497e807dce612365
417f92150d503a78747433df8ee1a5d292dc06db
/sysroot/usr/include/sm/cf.h
2ae87861af736ba1eb4677610efd63780652a626
[]
no_license
jaykrell/tru64
16424e389dded7cb6386b701f4714f720bbbb699
f4117dfdde98eb05fb5318b20c94bfdd4397b689
refs/heads/master
2023-06-15T04:48:06.150828
2021-07-10T09:35:09
2021-07-10T09:35:09
382,783,658
0
0
null
null
null
null
UTF-8
C
false
false
814
h
/* * @DEC_COPYRIGHT@ */ /* * HISTORY * $Log: cf.h,v $ * Revision 1.1.2.1 2006/07/18 11:15:40 Sunilkumar_Mummigatti * New for sendmail.v8.13.6 * * $EndLog$ */ /* * @(#)$RCSfile: cf.h,v $ $Revision: 1.1.2.1 $ (DEC) $Date: 2006/07/18 11:15:40 $ */ /* * Copyright (c) 2001 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * * $Id: cf.h,v 1.1.2.1 2006/07/18 11:15:40 Sunilkumar_Mummigatti Exp $ */ #ifndef SM_CF_H # define SM_CF_H #include <sm/gen.h> typedef struct { char *opt_name; char *opt_val; } SM_CF_OPT_T; extern int sm_cf_getopt __P(( char *path, int optc, SM_CF_OPT_T *optv)); #endif /* ! SM_CF_H */
096c9024e32e0d8fef6250da1a6b72140fa521c7
0d57893c36f0226335577773a7bf99cd98b3e3a3
/generated/MaximumIntegrityProtectedDataRate.h
7f3c6a59ce95d99c0beca57c0e56271b8981ab79
[]
no_license
cakir-enes/ransim
609c69adf8a3c3928494806ca0db9edd3f1f46ca
7c7a3de16446c74e4914f48f2f45d7a69d5fa5b6
refs/heads/master
2020-07-30T01:07:38.589174
2019-09-21T17:49:10
2019-09-21T17:49:10
210,029,354
0
0
null
null
null
null
UTF-8
C
false
false
1,944
h
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-IEs" * found in "NGAP-IEs.asn" * `asn1c -fcompound-names` */ #ifndef _MaximumIntegrityProtectedDataRate_H_ #define _MaximumIntegrityProtectedDataRate_H_ #include <asn_application.h> /* Including external dependencies */ #include <NativeEnumerated.h> #ifdef __cplusplus extern "C" { #endif /* Dependencies */ typedef enum MaximumIntegrityProtectedDataRate { MaximumIntegrityProtectedDataRate_bitrate64kbs = 0, MaximumIntegrityProtectedDataRate_maximum_UE_rate = 1 /* * Enumeration is extensible */ } e_MaximumIntegrityProtectedDataRate; /* MaximumIntegrityProtectedDataRate */ typedef long MaximumIntegrityProtectedDataRate_t; /* Implementation */ extern asn_per_constraints_t asn_PER_type_MaximumIntegrityProtectedDataRate_constr_1; extern asn_TYPE_descriptor_t asn_DEF_MaximumIntegrityProtectedDataRate; extern const asn_INTEGER_specifics_t asn_SPC_MaximumIntegrityProtectedDataRate_specs_1; asn_struct_free_f MaximumIntegrityProtectedDataRate_free; asn_struct_print_f MaximumIntegrityProtectedDataRate_print; asn_constr_check_f MaximumIntegrityProtectedDataRate_constraint; ber_type_decoder_f MaximumIntegrityProtectedDataRate_decode_ber; der_type_encoder_f MaximumIntegrityProtectedDataRate_encode_der; xer_type_decoder_f MaximumIntegrityProtectedDataRate_decode_xer; xer_type_encoder_f MaximumIntegrityProtectedDataRate_encode_xer; oer_type_decoder_f MaximumIntegrityProtectedDataRate_decode_oer; oer_type_encoder_f MaximumIntegrityProtectedDataRate_encode_oer; per_type_decoder_f MaximumIntegrityProtectedDataRate_decode_uper; per_type_encoder_f MaximumIntegrityProtectedDataRate_encode_uper; per_type_decoder_f MaximumIntegrityProtectedDataRate_decode_aper; per_type_encoder_f MaximumIntegrityProtectedDataRate_encode_aper; #ifdef __cplusplus } #endif #endif /* _MaximumIntegrityProtectedDataRate_H_ */ #include <asn_internal.h>
e40a4c9a6b90e09bc05c064ea2f6d4bffd99aa92
3242b4524ed78233f4ae1d9004ef6a8b7d8afa0e
/test/MergeFiles/myReduce_9.C
de5eee777a86d1c1c3c967cecdbf6a4b0a42e4de
[]
no_license
nsahoo/FourMuonPAT
5285d46e3c0cb1598db29afaffdda964ab023d42
2fe0cae78fc9bcbe551ce25f41b412ea852313a4
refs/heads/master
2020-05-16T15:08:47.253631
2018-09-11T02:23:58
2018-09-11T02:23:58
null
0
0
null
null
null
null
UTF-8
C
false
false
335
c
{ TChain* chain = new TChain("mkcands/X_data"); chain->Add("/eos/uscms/store/user/sdurgut/TrigMatch/Merged/Muonia2012B_5.root"); TFile *f2 = new TFile("/eos/uscms/store/user/sdurgut/TrigMatch/Reduced/Muonia2012B_5.root","recreate"); TTree *T2 = chain->CopyTree("MyFourMuonVtxCL>0.01 && MyFourMuonChg==0"); T2->Write(); }
36574a4fb995565f933045c4721e83ca5b566392
67a8c824902b83f76daf5075e5ddb730980a15e8
/RevivalPlus/scripts/4_World/RevivalPlus/Classes/Recipes/RPL_SprayPainting/Weapons/Repeater/Recipe_PaintRepeater_White.c
121e5d0767b92cf69f7a95c53c2d7c1968651d23
[ "MIT" ]
permissive
benedikz/RevivalPlus
8004e8ec5f0f9369957e3c412e8afc49626f8397
b51d90ede21f457d78aba8e175e7c9463678cac1
refs/heads/master
2023-07-16T07:20:50.675598
2021-09-06T22:26:11
2021-09-06T22:26:11
294,627,453
0
0
null
null
null
null
UTF-8
C
false
false
1,994
c
class PaintRepeater_White extends RecipeBase { override void Init() { /*************************************************************/ m_Name = "#STR_RPL_Recipe_SprayPaint"; m_IsInstaRecipe = false; // NoAnimation [true/false] m_AnimationLength = 4; // Animation length m_Specialty = -0.05; // + INCREASE ROUGNESS // - INCREASE PRECISSION /*************************************************************/ m_MinDamageIngredient[0] = -1; m_MaxDamageIngredient[0] = 3; m_MinQuantityIngredient[0] = 50; m_MaxQuantityIngredient[0] = -1; /*************************************************************/ m_MinDamageIngredient[1] = -1; m_MaxDamageIngredient[1] = 3; m_MinQuantityIngredient[1] = -1; m_MaxQuantityIngredient[1] = -1; /*************************************************************/ InsertIngredient(0, "RPL_SprayCan0_White"); InsertIngredient(0, "RPL_SprayCan1_White"); m_IngredientAddHealth[0] = 0; m_IngredientSetHealth[0] = -1; m_IngredientAddQuantity[0] = -50; m_IngredientDestroy[0] = false; m_IngredientUseSoftSkills[0] = false; /*************************************************************/ InsertIngredient(1, "Repeater"); m_IngredientAddHealth[1] = 0; m_IngredientSetHealth[1] = -1; m_IngredientAddQuantity[1] = 0; m_IngredientDestroy[1] = false; m_IngredientUseSoftSkills[1] = false; /*************************************************************/ } // Recipe validity check override bool CanDo(ItemBase ingredients[], PlayerBase player) { return RPL_PaintItem.CanPaintItem(ingredients[0], ingredients[1]); } // Called upon completion override void Do(ItemBase ingredients[], PlayerBase player, array<ItemBase> results, float specialty_weight) { RPL_PaintItem.Paint(ingredients[0], ingredients[1], "Repeater", player, specialty_weight); //Trace.Log(0, "<PaintRepeater_White> Called."); } };
65b0727225ae44aef3171c7c096b1c5977a21a35
e5699fc9424fba568b4ee5ffc1e3b8b38a9e066e
/motorola_chun/moto_upload.h
e7b08222afb5183db965ee98a4e5ac028d53cea0
[]
no_license
xfdingustc/smash
035a1bb894101cb79da833e496c02d504867552c
ba6db5730d4153f3151752e3095b3c1a855e9aa3
refs/heads/master
2020-12-02T07:54:37.085011
2017-07-10T06:49:06
2017-07-10T06:49:06
96,732,012
0
0
null
null
null
null
UTF-8
C
false
false
1,124
h
#ifndef __MOTO_UPLOAD_H_ #define __MOTO_UPLOAD_H_ 1 #include "elist.h" #include "moto_manifest.h" typedef struct chunk_header_item_s { char key[128]; char value[128]; list_head_t list_node; }chunk_header_item_t; typedef struct chunk_info_s { int chunk_start; int length; char url[1024]; list_head_t list_node; list_head_t header_list; }chunk_info_t; /* typedef struct file_info_s { char id[40]; char name[64]; int size; list_head_t chunk_list; }file_info_t; typedef struct upload_detail_s { file_info_t mp4_file; file_info_t pic_file; char complete_url[1024]; }upload_detail_t; */ typedef struct moto_upload_des_s moto_upload_des_t; int moto_camera_query_oauth_token(const char *host, int port, const char *tls_crt, const char *tls_key, char *token, int token_size); int moto_camera_query_incident(const char *host, int port, const char *tls_crt, const char *tls_key, const char *incident_id,const char *token, char *json, int json_size); int moto_camera_upload_request(moto_upload_des_t *pc, int *result); void moto_camera_free_upload_detail(moto_upload_des_t *pd); #endif //__MOTO_UPLOAD_H_
2bd5251acc207799b280f673c40282153f0c372d
6d5436affb79a9311829bc9f805033999f1153e6
/src/operations/swap.c
73f9a0955845b2b1065c692469c771f2544a1ce3
[]
no_license
qypec/push-swap
eb5d11559065e18f5a2fd2c4381975cc4aff70f2
41a92b806ef5f1ca2c4ebf5a811fb7de8be76099
refs/heads/master
2022-11-18T07:41:17.347719
2020-07-07T12:56:58
2020-07-07T12:56:58
220,012,177
0
0
null
null
null
null
UTF-8
C
false
false
1,437
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* swap.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: yquaro <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/09 18:25:43 by yquaro #+# #+# */ /* Updated: 2020/02/06 20:57:25 by yquaro ### ########.fr */ /* */ /* ************************************************************************** */ #include "push_swap.h" void swap_a(t_stack *stack) { size_t tmp; if (stack->a->used_size < 2) return ; tmp = stack->a->num[0]; stack->a->num[0] = stack->a->num[1]; stack->a->num[1] = tmp; add_operation(&(stack->operation), "sa"); } void swap_b(t_stack *stack) { size_t tmp; if (stack->b->used_size < 2) return ; tmp = stack->b->num[0]; stack->b->num[0] = stack->b->num[1]; stack->b->num[1] = tmp; add_operation(&(stack->operation), "sb"); } void swap_ab(t_stack *stack) { swap_a(stack); swap_b(stack); }
f8d5f1fd87747f5bc4a5572e5c88a40246f59b76
c1a8e75227512a30db772c92973c7b179d4eaa67
/Test/Classes/Native/mscorlib_System_Array_InternalEnumerator_1_gen_30.h
d52820092a898e9832069637a0a6d3c2a836a339
[]
no_license
joshtwynham/dissertation
266f5463d970e15bf5b0842c881ff65c9c85389c
b860fc4ae2b6152d0aea15b36036904b4a88bd15
refs/heads/master
2021-01-10T09:20:17.128871
2016-04-17T16:07:36
2016-04-17T16:07:36
49,824,777
0
0
null
2016-02-02T11:36:07
2016-01-17T16:14:25
C++
UTF-8
C
false
false
509
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Array struct Array_t; #include "mscorlib_System_ValueType.h" // System.Array/InternalEnumerator`1<UnityEngine.Color32> struct InternalEnumerator_1_t1886 { // System.Array System.Array/InternalEnumerator`1<UnityEngine.Color32>::array Array_t * ___array_0; // System.Int32 System.Array/InternalEnumerator`1<UnityEngine.Color32>::idx int32_t ___idx_1; };
b47cee8563535115fb1bae97d3bf5608162a16c7
4c0b9cb2ea2f2b2ad02f95203cde8c975d6bb4b6
/C01/ex05/ft_putstr.c
f30fb5cb9ab0c83bc7a4546b9ee3dd3e72b63d4d
[]
no_license
worldii/42SEOUL
5b6c179b5e989eb99ce99ea34f2a673239d7f72d
a592e4dabf7a3cb5fcee3b639073a5bb0b554d9e
refs/heads/master
2023-08-23T05:06:23.227548
2021-11-01T02:19:31
2021-11-01T02:19:31
423,310,648
0
0
null
null
null
null
UTF-8
C
false
false
1,074
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putstr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jonghapa <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/10 13:04:35 by jonghapa #+# #+# */ /* Updated: 2021/10/13 23:13:03 by jonghapa ### ########.fr */ /* */ /* ************************************************************************** */ #include<unistd.h> void ft_putchar(char a) { write(1, &a, 1); } void ft_putstr(char *str) { int idx; idx = 0; while (str[idx] != '\0') { ft_putchar(str[idx]); idx++; } }
459aa620f35801b7a112f3a6a6644554730345d1
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/f35deb29-2c46-4c19-b642-88ae78ea0432.c
a149feba1883a4752e9c3d510144be915a9e1217
[]
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
561
c
#include <string.h> #include <stdio.h> int main() { int i=0; int j=11; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = i/j; l = l%j; l = j%j; l = l-j; k = k-k*i; //variables //random /* START VULNERABILITY */ int a; char b[94]; char c[45]; a = 0; while (b[a] != 0) { /* START BUFFER SET */ *((char *)c + a) = *((char *)b + a); /* END BUFFER SET */ a++; } /* END VULNERABILITY */ printf("%d%d\n",k,l); return 0; }
168023a39a19083ffbf87635afd4ddcec691c1b6
259c101b7bbeef9efcc25134e7e21f037a7a4092
/DTSEmbed_LSC_solve_path/testcase/gcc/gcc.dg/asm-4.c
0e58c851f44791449c0eb0ac31df307449037bd9
[]
no_license
13001090108/dts-solve-path
a95c71c31d38afb2c55d85884b931f2938c1f75d
649b92eddcc76705bbb4926b33da00009303c04a
refs/heads/master
2020-04-16T23:17:21.340218
2019-01-24T09:34:50
2019-01-24T09:37:09
166,005,614
0
0
null
null
null
null
UTF-8
C
false
false
607
c
/* { dg-do compile } */ /* { dg-options "" } */ int main() { int x, y, z; asm volatile ("test0 X%0Y%[arg]Z" : [arg] "=g" (x)); asm volatile ("test1 X%[out]Y%[in]Z" : [out] "=g" (y) : [in] "0"(y)); asm volatile ("test2 X%a0Y%a[arg]Z" : : [arg] "p" (&z)); asm volatile ("test3 %[in]" : [inout] "=g"(x) : "[inout]" (x), [in] "g" (y)); } /* ??? Someone explain why the back reference dosn't work. */ /* { dontdg-final { scan-assembler "test0 X(.*)Y\1Z" } } */ /* { dontdg-final { scan-assembler "test1 X(.*)Y\1Z" } } */ /* { dontdg-final { scan-assembler "test2 X(.*)Y\1Z" } } */
b8de5534e71cf46ff6f2ac017666f85d18dbeee6
640cc3c15ab2fc667875e6453e955c5750ec7bee
/gnl/libft/ft_strtrim.c
3ab06ceda296d66e6a676fa2c65590a724bb6a42
[]
no_license
Zabilya/school_projects
d99b723547ebb58e43e0d0ea652f8a242024470c
bb12b3c963817770b06ee9ec62ecd3e108eb705e
refs/heads/master
2020-04-16T04:25:14.448941
2019-03-07T14:47:32
2019-03-07T14:47:32
165,266,343
0
0
null
null
null
null
UTF-8
C
false
false
1,739
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strtrim.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cschuste <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/26 12:23:59 by cschuste #+# #+# */ /* Updated: 2018/11/26 12:24:00 by cschuste ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" #include <stdlib.h> static int check_start(char const *s, int *start, int *end, int *j) { int i; i = 0; *j = 0; *start = 0; *end = 0; while (s[i] == ' ' || s[i] == '\n' || s[i] == '\t') i++; return (i); } static int check_end(char const *s, int end) { while (s[end]) ++end; --end; while (s[end] == ' ' || s[end] == '\n' || s[end] == '\t') end--; end++; return (end); } char *ft_strtrim(char const *s) { int start; int end; char *str; int i; if (!s) return (NULL); start = check_start(s, &start, &end, &i); if (start == (int)ft_strlen(s)) { str = (char *)malloc(1); *str = '\0'; return (str); } end = check_end(s, end); if (!(str = (char *)(malloc(sizeof(char) * (end - start + 1))))) return (NULL); while ((end - start)) str[i++] = s[start++]; str[i] = '\0'; return (str); }
27dc3c42edbdba70974a57014a5bed94c7f30cbb
54b08b28b8c1724499975f12acb690f0df19854e
/exercise/silsup_04/ssu_stat_1.c
2f987671fbbe0c543631319ffb60f1e795dbadbd
[]
no_license
ynifamily3/lsp_2019
6105a8b294bf8f6cb7f2e20e1ca309078e6615ff
0092b8ff852fd224601d6a555b3b9f2d9f49adc3
refs/heads/master
2021-06-11T22:48:52.648320
2021-04-11T12:31:27
2021-04-11T12:31:27
176,196,391
0
0
null
null
null
null
UTF-8
C
false
false
577
c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/time.h> #include "ssu_runtime.h" int main(int argc, char *argv[]) { struct timeval begin_t, end_t; struct stat statbuf; gettimeofday(&begin_t, NULL); if (argc != 2) { fprintf(stderr, "usage: %s <file>\n", argv[0]); exit(1); } if ((stat(argv[1], &statbuf)) < 0 ) { fprintf(stderr, "stat error\n"); exit(1); } printf("%s is %ld bytes\n", argv[1], statbuf.st_size); gettimeofday(&end_t, NULL); ssu_runtime(&begin_t, &end_t); exit(0); }