blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
333
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
58
| license_type
stringclasses 2
values | repo_name
stringlengths 5
113
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 604
values | visit_date
timestamp[us]date 2016-08-02 21:20:34
2023-09-06 10:17:08
| revision_date
timestamp[us]date 1970-01-01 00:00:00
2023-09-05 20:12:54
| committer_date
timestamp[us]date 1970-01-01 00:00:00
2023-09-05 20:12:54
| github_id
int64 966
664M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[us]date 2012-06-18 16:43:44
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-02-03 21:17:16
2023-07-07 15:57:14
⌀ | gha_language
stringclasses 121
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 128
17.8k
| extension
stringclasses 134
values | content
stringlengths 128
8.19k
| authors
sequencelengths 1
1
| author_id
stringlengths 1
143
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c3f00fbda25680f07e6bae71aeb18ae6756b1bc8 | 8d2ee0a3280ba50cf672140b9d037b63264c4d2b | /ass/dam1.c | af0126403e126e8cd48dbd37d76611141b124ae7 | [] | no_license | sandy5497/My_Work | 40a6ad872c35eb209fb223bc83ebe18d28ce028f | fb8f1c212b416fdaa4c6e18b9f132ceedac43110 | refs/heads/master | 2021-01-05T05:39:51.231964 | 2020-02-16T19:32:40 | 2020-02-16T19:32:40 | 240,900,234 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 339 | c |
#include<stdio.h>
#include<stdlib.h>
int main()
{
int **db=NULL;
int cnt=5,i;
db=calloc(5,sizeof(int *));
for(i=0;i<5;i++)
db[i]=calloc(5,sizeof(int));
puts("enter value");
for(i=0;i<5;i++)
for(int j=0;j<5;j++)
{
scanf("%d",&db[i][j]);
}
for(i=0;i<5;i++)
for(int j=0;j<5;j++)
{
printf("%d ,",db[i][j]);
}
}
| [
"[email protected]"
] | |
3140241074e6f78eeeb08c1cab8f6b41a979a7d9 | fe4f40c794009d2e4e43c73200c934cdce02ed9c | /TA5/tool-evaluation-3/simple-uav-slang-example/uav-project/src/c/library/art/type-art_art_Connection_E82682.h | dfad2f4d96232430cebe2c271bce26d637e4b82d | [] | no_license | loonwerks/CASE | 204b15f688fd345d231e7d0b1e9df3be00c2855c | a959ce7f89000de3ab288d43746cff822930130f | refs/heads/master | 2022-07-08T18:06:54.803247 | 2022-06-29T21:18:35 | 2022-06-29T21:18:35 | 129,441,109 | 15 | 8 | null | 2021-06-03T16:05:21 | 2018-04-13T18:44:46 | C | UTF-8 | C | false | false | 534 | h | #ifndef SIREUM_TYPE_H_art_art_Connection_E82682
#define SIREUM_TYPE_H_art_art_Connection_E82682
#include <misc.h>
// art.Connection[ACT_Demo_Dec2018__camkes_X.SW.Mission]
#include <type-art_art_Port_D7D05E.h>
#include <type-art_art_Port_D7D05E.h>
typedef struct art_Connection_E82682 *art_Connection_E82682;
struct art_Connection_E82682 {
TYPE type;
struct art_Port_D7D05E from;
struct art_Port_D7D05E to;
};
#define DeclNewart_Connection_E82682(x) struct art_Connection_E82682 x = { .type = Tart_Connection_E82682 }
#endif | [
"[email protected]"
] | |
ec2336f9efbbac4f8e52e98ce9bc4e6535d590e9 | 40cffd9d70cf8ee94a90e23df1ade391d4b29e94 | /practica2.3/ejercicio12.c | d1fadf455ec7687599bbd73394b68030fcb7d012 | [] | no_license | ExEl15/asor_repo | 88c82407c1b332e361f3896fbf845a8ff2c342b6 | 3521ed617d5608f7380b844ea52483a6e965db53 | refs/heads/master | 2023-02-22T16:33:57.088992 | 2021-01-24T14:05:16 | 2021-01-24T14:05:16 | 317,154,830 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 732 | c | #include <stdlib.h>
#include <signal.h>
#include <stdio.h>
volatile int sig_int = 0;
volatile int sig_tstp = 0;
void handler(int senial){
if(senial == SIGINT) sig_int++;
if(senial == SIGTSTP) sig_tstp++;
}
int main(){
struct sigaction act;
//Recuperamos el handler antiguo
sigaction(SIGINT,NULL, &act);
act.sa_handler = handler;
sigaction(SIGINT,&act, NULL);
sigaction(SIGTSTP,NULL, &act);
act.sa_handler = handler;
sigaction(SIGTSTP,&act, NULL);
sigset_t blk_set;
sigemptyset(&blk_set);
while(sig_int + sig_tstp < 10){
//sigsuspend(&blk_set);
}
printf("La señal SIGINT ha aparecido: %i veces\n",sig_int);
printf("La señal SIGTSTP ha aparecido: %i veces\n", sig_tstp);
return 0;
}
| [
"[email protected]"
] | |
ecb9348415b1ba846dae4214494ae09ea94434dd | 3a30d943296777de5cba2c82deebc1931bd7ad9d | /space_defender_1/EIFGENs/space_defender_1/W_code/C2/uc994d.c | f1bb5eae93bb05515a04ccca75506e8ff8d8d0da | [] | no_license | brittanydanishevsky/EECS3311 | 3123317b27c571f8519c48a58a40d84ec7f8d215 | 82f5d972d375fe3bf28af28a4c1bccb21042ab53 | refs/heads/master | 2023-01-03T06:29:44.147388 | 2020-10-25T15:13:50 | 2020-10-25T15:13:50 | 307,118,774 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,650 | c | /*
* Class UC_SHARED_STRING_EQUALITY_TESTER
*/
#include "eif_macros.h"
#ifdef __cplusplus
extern "C" {
#endif
static const EIF_TYPE_INDEX egt_0_994 [] = {0xFF01,232,0xFFFF};
static const EIF_TYPE_INDEX egt_1_994 [] = {0xFF01,246,993,0xFFFF};
static const EIF_TYPE_INDEX egt_2_994 [] = {0xFF01,993,0xFFFF};
static const EIF_TYPE_INDEX egt_3_994 [] = {0,0xFFFF};
static const EIF_TYPE_INDEX egt_4_994 [] = {0,0xFFFF};
static const EIF_TYPE_INDEX egt_5_994 [] = {0xFF01,993,0xFFFF};
static const EIF_TYPE_INDEX egt_6_994 [] = {0xFF01,993,0xFFFF};
static const EIF_TYPE_INDEX egt_7_994 [] = {0,0xFFFF};
static const EIF_TYPE_INDEX egt_8_994 [] = {0xFF01,15,0xFFFF};
static const EIF_TYPE_INDEX egt_9_994 [] = {0xFF01,232,0xFFFF};
static const EIF_TYPE_INDEX egt_10_994 [] = {0xFF01,232,0xFFFF};
static const EIF_TYPE_INDEX egt_11_994 [] = {0xFF01,25,0xFFFF};
static const EIF_TYPE_INDEX egt_12_994 [] = {0xFF01,993,0xFFFF};
static const EIF_TYPE_INDEX egt_13_994 [] = {0xFF01,1158,0xFFFF};
static const struct desc_info desc_994[] = {
{EIF_GENERIC(NULL), 0xFFFFFFFF, 0xFFFFFFFF},
{EIF_GENERIC(egt_0_994), 0, 0xFFFFFFFF},
{EIF_GENERIC(egt_1_994), 1, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 2, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 3, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 4, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 5, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 6, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 7, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 8, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x0191 /*200*/), 9, 0xFFFFFFFF},
{EIF_GENERIC(egt_2_994), 10, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 11, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 12, 0xFFFFFFFF},
{EIF_GENERIC(egt_3_994), 13, 0xFFFFFFFF},
{EIF_GENERIC(egt_4_994), 14, 0xFFFFFFFF},
{EIF_GENERIC(egt_5_994), 15, 0xFFFFFFFF},
{EIF_GENERIC(egt_6_994), 16, 0xFFFFFFFF},
{EIF_GENERIC(egt_7_994), 17, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 18, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 19, 0xFFFFFFFF},
{EIF_GENERIC(egt_8_994), 20, 0xFFFFFFFF},
{EIF_GENERIC(egt_9_994), 21, 0xFFFFFFFF},
{EIF_GENERIC(egt_10_994), 22, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 23, 0xFFFFFFFF},
{EIF_GENERIC(egt_11_994), 24, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 25, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 26, 0xFFFFFFFF},
{EIF_GENERIC(NULL), 27, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x07C3 /*993*/), 28, 0xFFFFFFFF},
{EIF_NON_GENERIC(0x01C7 /*227*/), 29, 0xFFFFFFFF},
{EIF_GENERIC(egt_12_994), 30, 0xFFFFFFFF},
{EIF_GENERIC(egt_13_994), 14916, 0xFFFFFFFF},
};
void Init994(void)
{
IDSC(desc_994, 0, 993);
IDSC(desc_994 + 1, 1, 993);
IDSC(desc_994 + 32, 920, 993);
}
#ifdef __cplusplus
}
#endif
| [
"[email protected]"
] | |
c90839abaf715c0670d9e053bc5ade9c20ea52c9 | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14721/function14721_schedule_9/function14721_schedule_9_wrapper.h | cd110eecc63e43e5158eccae918433c9ae4aee25 | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C | false | false | 399 | h | #ifndef HALIDE__generated_function14721_schedule_9_h
#define HALIDE__generated_function14721_schedule_9_h
#include <tiramisu/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
int function14721_schedule_9(halide_buffer_t *buf00, halide_buffer_t *buf01, halide_buffer_t *buf02, halide_buffer_t *buf03, halide_buffer_t *buf04, halide_buffer_t *buf0);
#ifdef __cplusplus
} // extern "C"
#endif
#endif | [
"[email protected]"
] | |
ed0b6f0f9c58ddcf2f0facf1ecb229fd30b7728a | 1d11a89368f3a6a95c4c5fec7a3a054b23ea9662 | /C/gui/broncho_ui/ft_type.h | c416cecf7575c6873970b128d27e7a7813e848b2 | [] | no_license | vmudhire4u/parrot | 61ec951a9b2cfeab15a6e218c8b0d07b4b6f8bee | 11752ee0f31799935c2d4d43d1cd232d3d0b99c1 | refs/heads/master | 2021-09-18T22:17:18.461774 | 2018-07-20T11:07:35 | 2018-07-20T11:07:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 985 | h |
#ifndef _FT_TYPE_H_
#define _FT_TYPE_H_
#define FT_SUCCESS ( 0)
#define FT_FAIL (-1)
#define FT_STATUS_NORMAL (0)
#define FT_STATUS_OK (1)
#define FT_STATUS_FAIL (2)
#define FT_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
enum
{
FT_ITEM_VER = 0,
FT_ITEM_CALIBRATE,
FT_ITEM_KEY,
FT_ITEM_LED,
FT_ITEM_MOTOR,
FT_ITEM_SPK,
FT_ITEM_LOOP,
FT_ITEM_HEADSET,
FT_ITEM_LCD,
FT_ITEM_HDMI,
FT_ITEM_MATRIX,
FT_ITEM_ADC,
FT_ITEM_IC,
FT_ITEM_CAMERA_FORE,
FT_ITEM_CAMERA_BACK,
FT_ITEM_CAMERA,
FT_ITEM_RIL,
FT_ITEM_IMEI_SN,
FT_ITEM_BT,
FT_ITEM_WIFI,
FT_ITEM_FM,
FT_ITEM_GPS,
FT_ITEM_SD,
FT_ITEM_USBHOST,
FT_ITEM_G_SENS,
FT_ITEM_L_SENS,
FT_ITEM_INFRA_SENS,
FT_ITEM_OPTI_SENS,
};
enum
{
FT_TOOL_CLEAR_RESULT = 0,
FT_TOOL_IMEI_SN,
FT_TOOL_COUPLING,
FT_TOOL_WIPEDATA,
FT_TOOL_SHUTDOWN,
FT_TOOL_SCREEN_CALIBRATE
};
#endif/*_FT_TYPE_H_*/
| [
"[email protected]"
] | |
4e797a4d1666c0de9919435e89f2ddc97dea2273 | 826508a013c798f0805d0ee6bcbc9f4ed6ff0f3a | /lib/my_putstr.c | 53e403953db68e6a09348e5b3a378102495922ba | [] | no_license | WilliamPiloz/minishell2 | 01ba7fecd88d627f7a0155070772a87a46765487 | 6afe8a8ba5d861e4fd601915448169d9c5128630 | refs/heads/master | 2023-04-18T09:49:34.573158 | 2021-05-04T18:53:20 | 2021-05-04T18:53:20 | 364,175,280 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 320 | c | /*
** EPITECH PROJECT, 2020
** B-CPE-110-MPL-1-1-bsbsq-william1.piloz
** File description:
** my_putstr.c
*/
#include "minishell.h"
int my_putstr(char const *str)
{
int i = 0;
int n = 0;
for (n = 0; str[n]; n = n + 1);
for (i = 0; i < n; i = i + 1) {
my_putchar(str[i]);
}
return (0);
} | [
"[email protected]"
] | |
c8b7c6592ada6af71e606a1c69bad7c202937980 | c4c7545914a96843dc297acdfac72b835e028fba | /Source/malloc_for_name_tetrimino.c | 7a13c4a04876ec303eb1dc4e65c32ef6857a012e | [] | no_license | EArminjon/Tetris | 7b357c13238026fff7a0a7e13134c964f5e1d97b | f4c99f2eb439b077cf5bbf1662509e9c0cf92859 | refs/heads/master | 2020-03-21T21:11:36.594327 | 2018-06-28T17:50:19 | 2018-06-28T17:50:19 | 139,050,965 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,760 | c | /*
** malloc_for_name_tetrimino.c for in /home/armin.pc/delivery/PSU_2016_tetris
**
** Made by Enguerrand Arminjon
** Login <[email protected]>
**
** Started on Thu Feb 23 10:58:05 2017 Enguerrand Arminjon
** Last update Sun Mar 19 09:52:50 2017 Enguerrand Arminjon
*/
#include <dirent.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include "my_error.h"
#include "my.h"
#define SIZE_FILE 11
char **order_my_tab(char **tab)
{
int i;
int j;
char *tmp;
i = 0;
j = 0;
while (tab[i] != NULL)
{
if (tab[i + 1] != NULL && tab[i][j] > tab[i + 1][j])
{
tmp = tab[i];
tab[i] = tab[i + 1];
tab[i + 1] = tmp;
i = 0;
j = 0;
}
else if (tab[i + 1] != NULL && tab[i][j] == tab[i + 1][j])
j++;
else
{
i++;
j = 0;
}
}
return (tab);
}
char **malloc_name(char **tab, int row, int col)
{
int i;
i = 0;
if ((tab = malloc(sizeof(char *) * (row + 1))) == NULL)
return (FAIL_WITH_ALLOC_MEM);
while (i < row)
{
if ((tab[i] = malloc(sizeof(char) * (col + SIZE_FILE + 1))) == NULL)
return (FAIL_WITH_ALLOC_MEM);
tab[i][0] = '\0';
i++;
}
tab[i] = NULL;
return (tab);
}
char **malloc_for_name_tetrimino(char **tab)
{
DIR *rep;
struct dirent *entry;
int max;
int i;
int j;
i = 0;
max = 0;
if ((rep = opendir("tetriminos")) == NULL)
return (TETRIMINOS_REP_NOT_FOUND);
while ((entry = readdir(rep)) != NULL)
{
j = 0;
if (is_a_tetri_file(entry->d_name) == 0)
{
j = my_strlen(entry->d_name);
if (j >= max)
max = j;
i++;
}
}
closedir(rep);
if ((tab = malloc_name(tab, i, max)) == NULL)
return (FAIL_WITH_ALLOC_MEM);
return (tab);
}
| [
"[email protected]"
] | |
d7f7bfe3f98315e4548953fe2b7820f183c535b0 | 09ae7a1e40916e2b22c0704a2b64610c58e2389d | /lib/netd/netd_private.h | b10fd578e82a82bc486074aeea62fe89f905a459 | [
"MIT",
"LicenseRef-scancode-dco-1.1",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | satnam6502/barrelfish | 358338d2e0871d3b5e5c6ba88476cc0b1a4ffa31 | 2e415737c7ab3266107143879e2f45643a71366f | refs/heads/master | 2020-06-10T23:23:33.357610 | 2019-06-25T22:39:38 | 2019-06-25T22:39:38 | 193,788,422 | 0 | 0 | MIT | 2019-06-25T21:54:30 | 2019-06-25T21:54:29 | null | UTF-8 | C | false | false | 2,231 | h | /**
* \file
* \brief the private header file for the net "daemon" library
*
* This file is part of the net "daemon" library
*/
/*
* Copyright (c) 2007-12 ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: NetOS Group.
*/
#ifndef _NETD_PRIVATE_H_
#define _NETD_PLIVATE_H_
// keeping it for DHCP timers
#include <barrelfish/deferred.h>
#include <netif/bfeth.h>
#include <if/net_ARP_defs.h>
#include <procon/procon.h>
struct netd_state;
struct ARP_user_cl {
// This will be used to remember who all are waiting for response
struct net_ARP_binding *cl; // binding
struct ARP_user_cl *next; // for singly linked list
bool died; // is the user still connected
struct netd_state *state;
};
struct netd_state {
bool do_dhcp;
// IP information for static configuration
char *ip_addr_str;
char *netmask_str;
char *gateway_str;
char *dns_str;
struct netif *netif_ptr;
struct periodic_event dhcp_fine_timer; // fine-grain timer for DHCP
struct periodic_event dhcp_coarse_timer; // coarse-grain timer for DHCP
// local ip address. Used to keep track of changing IP addresses
struct ip_addr local_ip;
bool subsequent_call;
// state variable indicating if dhcp is done or not
bool dhcp_completed;
// The name of exported service for ARP lookup (which we are implementing)
char ARP_service_name[MAX_NET_SERVICE_NAME_LEN];
// is service exported? marks that initialization is done
bool ARP_service_exported;
// singly linked list of apps connected with this service
struct ARP_user_cl *registered_user_list;
};
typedef net_ARP_ipv4addr_t ipv4addr_t;
/**
* @brief initializes LWIP. not a lot left after I changed the subsystems
*
* @param state netd library state
* @param card_name the name of the card.
* @param queueid the queue number
*/
void startlwip(struct netd_state *state, char *card_name, uint64_t queueid);
int init_ARP_lookup_service(struct netd_state *state, char *dev_name);
#endif // _NETD_PRIVATE_H_
| [
"[email protected]"
] | |
99cd976f1a2b898d88a8322bfdba23465b22bd02 | ef3840934f0fef5dc7d08797d37cc88cf4be17fb | /Software/AL-Curtain/PrivateInc/Type_Private.h | 2d63445e898a3b32448d1affb603c5e4eb9aac47 | [] | no_license | StephonChin/SL9xSeries | 5ae728f791474c4327b9db0a758960919a6b801a | b8650e504c50a8dae5f71bfc7aa76af5b469fa39 | refs/heads/master | 2020-04-27T11:08:40.129193 | 2019-03-06T09:41:47 | 2019-03-06T09:41:47 | 174,284,462 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,464 | h | /*******************************************************************************
*
* FILE NAME
* Type_Private.h
* BRIEF
* This file has define the device type
* AL91 | AL92 | AL94 | AL95 | AL96 | AL99
* _AL91A_ | _AL91B_ | _AL91C_ | _AL91D_ | _AL92A_ | _AL92B_ | _AL92C_ | _AL94_ | _AL95_ | _AL96_ | _AL99A_ | _AL67D_
*
*******************************************************************************/
#ifndef __TYPE_PRIVATE_H__
#define __TYPE_PRIVATE_H__
//----------------------------------------------------------------
// Device & Serias selected
// 91A - ICICLE
// 91B - C9
// 91C - G40
// 91D - C6
// 92A - CANDY CANE
// 92B - SNOW
// 92C - CHRISTMAS TREE
// 94 - LIGHT STRINGS
// 95 - SPOT LIGHTS
// 96 - BALL
// 99 - 4.5' TREE
//----------------------------------------------------------------
//#define AL91 (1)
//#define AL92 (1)
//#define AL94 (1)
//#define AL95 (1)
//#define AL96 (1)
//#define _AL91A_ (1)
//#define _AL91_48_ (1)
//#define _AL91B_ (1)
//#define _AL91C_ (1)
//#define _AL91D_ (1)
//#define _AL92A_ (1)
//#define _AL92B_ (1)
//#define _AL92C_ (1)
//#define _AL94_ (1)
//#define _AL95_ (1)
//#define _AL96_ (1)
//#define _AL99B_ (1)
#ifndef _AL_CURTAIN_
#define _AL_CURTAIN_ (1)
#endif
#ifndef AL_CURTAIN
#define AL_CURTAIN (1)
#endif
#endif
| [
"[email protected]"
] | |
f602e67bfb665454434adc7764b05306a6769cdd | b61818b74d0f10c0580ddec16d085aa5e9171fb2 | /src/qvk/qvk.h | f83c7703b9470f54e871971115303570ead84bbd | [
"LGPL-2.0-only",
"BSD-2-Clause"
] | permissive | hanatos/vkdt | 8d52444b40d3e0478bbaf0100b66e21f8bf05561 | 04ef97d5a7e091661b66dbee1fb71994bfbb6ffb | refs/heads/master | 2023-08-03T16:12:49.335070 | 2023-08-01T13:25:47 | 2023-08-01T13:26:13 | 196,389,968 | 249 | 28 | BSD-2-Clause | 2023-09-08T19:09:54 | 2019-07-11T12:27:14 | C | UTF-8 | C | false | false | 5,053 | h | #pragma once
/*
Copyright (C) 2018 Christoph Schied
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "core/core.h"
#include "core/threads.h"
#include "qvk_util.h"
#include <vulkan/vulkan.h>
#define LENGTH(a) ((sizeof (a)) / (sizeof(*(a))))
#define QVK(...) \
do { \
VkResult _res = __VA_ARGS__; \
if(_res != VK_SUCCESS) { \
dt_log(s_log_qvk, "error %s executing %s!", qvk_result_to_string(_res), # __VA_ARGS__); \
} \
} while(0)
// check error and also return it if fail
#define QVKR(...) \
do { \
VkResult _res = __VA_ARGS__; \
if(_res != VK_SUCCESS) { \
dt_log(s_log_qvk, "error %s executing %s!", qvk_result_to_string(_res), # __VA_ARGS__); \
return _res; \
} \
} while(0)
#define QVKL(mutex, ...) \
do { \
if(mutex) threads_mutex_lock(mutex);\
VkResult _res = __VA_ARGS__; \
if(mutex) threads_mutex_unlock(mutex);\
if(_res != VK_SUCCESS) { \
dt_log(s_log_qvk, "error %s executing %s!", qvk_result_to_string(_res), # __VA_ARGS__); \
} \
} while(0)
// lock mutex, check error, return if fail
#define QVKLR(mutex, ...) \
do { \
if(mutex) threads_mutex_lock(mutex);\
VkResult _res = __VA_ARGS__; \
if(mutex) threads_mutex_unlock(mutex);\
if(_res != VK_SUCCESS) { \
dt_log(s_log_qvk, "error %s executing %s!", qvk_result_to_string(_res), # __VA_ARGS__); \
return _res; \
} \
} while(0)
#define QVK_MAX_FRAMES_IN_FLIGHT 2
#define QVK_MAX_SWAPCHAIN_IMAGES 4
#define QVK_LOAD(FUNCTION_NAME) PFN_##FUNCTION_NAME q##FUNCTION_NAME = (PFN_##FUNCTION_NAME) vkGetInstanceProcAddr(qvk.instance, #FUNCTION_NAME)
// forward declare
typedef struct GLFWwindow GLFWwindow;
typedef struct qvk_t
{
VkInstance instance;
VkPhysicalDevice physical_device;
VkPhysicalDeviceMemoryProperties mem_properties;
VkDevice device;
threads_mutex_t queue_mutex;
VkQueue queue_graphics;
VkQueue queue_compute;
VkQueue queue_work0;
VkQueue queue_work1;
threads_mutex_t queue_work0_mutex;
threads_mutex_t queue_work1_mutex;
int32_t queue_idx_graphics;
int32_t queue_idx_compute;
int32_t queue_idx_work0;
int32_t queue_idx_work1;
VkSurfaceKHR surface;
VkSwapchainKHR swap_chain;
VkSurfaceFormatKHR surf_format;
VkPresentModeKHR present_mode;
VkExtent2D extent;
VkCommandPool command_pool;
uint32_t num_swap_chain_images;
VkImage swap_chain_images[QVK_MAX_SWAPCHAIN_IMAGES];
VkImageView swap_chain_image_views[QVK_MAX_SWAPCHAIN_IMAGES];
VkSampler tex_sampler;
VkSampler tex_sampler_nearest;
VkSampler tex_sampler_yuv;
VkSamplerYcbcrConversion yuv_conversion;
uint32_t num_extensions;
VkExtensionProperties *extensions;
uint32_t num_layers;
VkLayerProperties *layers;
VkDebugUtilsMessengerEXT dbg_messenger;
int win_width;
int win_height;
uint64_t frame_counter;
GLFWwindow *window;
uint32_t num_glfw_extensions;
const char **glfw_extensions;
uint32_t current_image_index;
float ticks_to_nanoseconds;
uint64_t uniform_alignment;
uint64_t raytracing_acc_min_align;
int raytracing_supported;
int float_atomics_supported;
}
qvk_t;
extern qvk_t qvk;
#ifdef QVK_ENABLE_VALIDATION
#define _VK_EXTENSION_LIST \
_VK_EXTENSION_DO(vkDebugMarkerSetObjectNameEXT)
#else
#define _VK_EXTENSION_LIST
#endif
#define _VK_EXTENSION_DO(a) extern PFN_##a q##a;
_VK_EXTENSION_LIST
#undef _VK_EXTENSION_DO
// global initialisation. pick device by that name if it is not null,
// same for the direct id if it is not negative (use for multiple identical devices)
VkResult qvk_init(const char *preferred_device_name, int preferred_device_id);
VkResult qvk_cleanup();
VkResult qvk_create_swapchain();
| [
"[email protected]"
] | |
f4ab202b9da43314f85f0980ba9ab6ea3d0e6f11 | 4e298b59e91f9088f36e9c488eb8c062b8a16c07 | /open/marksman/npc/cheng-chong.c | fe24078f9f5ecb1ec697cd54d9f8eca191fde6dd | [] | no_license | HexColors60/fs2 | 07714b1dbd27d666febf7ccc5e8d3476edaf0146 | c1bc56122142ac741d2432551508d04c9be4694e | refs/heads/master | 2021-05-27T11:06:07.272106 | 2012-08-03T04:15:15 | 2012-08-03T04:15:15 | null | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 1,105 | c | #include <ansi.h>
#include "/open/open.h"
inherit F_VENDOR;
void create()
{
set_name("陈总",({"cheng chong","cheng","chong"})); set("gender", "男性" );
set("age",40);
set("long", "天龙客栈的掌柜 , 整天在那里数着不完的银票 .\n");
set("attitude", "friendly");
set("combat_exp",20000);
set("nickname",HIG"财迷心窍"NOR);
set("dodge",50);
set("parry",50);
set("unarmed",50);
set("chat_chance",20);
set("chat_msg",({
"陈总惊慌的说:我可是没有什么钱喔,你去找别人吧。\n",
}));
setup();
}
void greeting(object ob)
{
if( !ob || environment(ob) != environment() ) return;
say("陈总说道: 这位"+RANK_D->query_respect(ob)+"你好 , 来吃点东西吧 !\n");
return;
}
int accept_kill(object ob)
{
command("say 天呀!救命呀!有人要抢劫呀!");
command("kill"+ob->query("id"));
return 1;
}
int accept_fight(object ob)
{
command("say 你好烦喔!!我忙着数钱都来不急了,走开走开别烦我数钱。");
return 0;
}
| [
"[email protected]"
] | |
a8e6857d198a0a5d418cc9f310d3f788968493e7 | 327c9a664918c5afff6154966dd1067b5eaed0ef | /libft/ft_printf/tools_ft_printf/ft_wstrsub.c | ef797e36a90ed53e762a64902d024a146002e6b1 | [] | no_license | jsj2008/scop | a0ea8bdcc5f04357e423e8af6f81fc8011560086 | 64a6eb959752a8670235d1bc5f28e0c7a8f78523 | refs/heads/master | 2020-05-07T08:31:14.884901 | 2018-10-17T12:17:22 | 2018-10-17T12:17:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,610 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_wstrsub.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ntoniolo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/15 19:27:11 by ntoniolo #+# #+# */
/* Updated: 2017/09/12 16:34:28 by ntoniolo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static int ft_size_wstr(const wchar_t *str, size_t len)
{
size_t i;
size_t size;
size = 0;
i = 0;
while (str[i])
{
size += ft_wcharlen(str[i]);
if (size > len)
return (i);
i++;
}
return (i);
}
wchar_t *ft_wstrsub(const wchar_t *s, unsigned int start, size_t len)
{
wchar_t *str;
size_t i;
size_t size;
size = 0;
i = 0;
if (s == NULL)
return (NULL);
if (ft_wstrlen(&s[start]) < len)
return (NULL);
str = ft_wstrnew(ft_size_wstr(&s[start], len));
if (str == NULL)
return (NULL);
size += ft_wcharlen(s[start]);
while (s[start] && size <= len)
{
str[i] = s[start];
start++;
size += ft_wcharlen(s[start]);
i++;
}
str[i] = '\0';
return (str);
}
| [
"[email protected]"
] | |
f89eefde32cbced214303e22c7798e977e51642d | 27b3c7fa81a61d9f600ec3010c1e82002ef79b80 | /arm/xtask3 mod/config_data.c | 463edb077df0fac72c5d90d113025efd09bcee0f | [] | no_license | siemens-elfloader/elf | d9222a44481d3a6d2669446cd08c110a80f26225 | 878f7315e755a061967e6d8e0f59566829a9fbdf | refs/heads/master | 2023-02-13T06:59:48.187208 | 2021-01-06T09:41:52 | 2021-01-06T09:41:52 | 327,263,185 | 2 | 0 | null | null | null | null | WINDOWS-1251 | C | false | false | 2,714 | c | #include "..\inc\cfg_items.h"
//Конфигурация
__root const CFG_HDR cfghdr0={CFG_STR_UTF8,"CSM list file",3,127};
#ifdef NEWSGOLD
__root const char csmlist_fname[128]="4:\\ZBin\\etc\\CSMlist.txt";
#else
__root const char csmlist_fname[128]="0:\\ZBin\\etc\\CSMlist.txt";
#endif
__root const CFG_HDR cfghdr23={CFG_CBOX,"Activation style",0,4};
__root const int ACTIVE_KEY_STYLE=0;
__root const CFG_CBOX_ITEM cfgcbox23[4]={"Short press","Long press","* + #","Enter Button"};
#ifndef NEWSGOLD
__root const CFG_HDR cfghdr24={CFG_UINT,"Activation key",0,99};
__root const int ACTIVE_KEY=99;
#else
#ifdef ELKA
__root const CFG_HDR cfghdr24={CFG_UINT,"Activation key",0,99};
__root const int ACTIVE_KEY=0x15;
#else
__root const CFG_HDR cfghdr24={CFG_UINT,"Activation key",0,99};
__root const int ACTIVE_KEY=0x11;
#endif
#endif
__root const CFG_HDR cfghdr25={CFG_STR_WIN1251,"UnderIdleCSM_DESC",0,8};
__root const char UNDER_IDLE_CONSTR[9]="";
__root const CFG_HDR cfghdr2={CFG_CBOX,"Extra: on longpress",0,5};
__root const int ENA_LONG_PRESS=2;
__root const CFG_CBOX_ITEM cfgcbox2[5]={"As in FW","Do nothing","Hide all tasks","Launch XTask","Hide & Lock"};
#ifdef NEWSGOLD
__root const CFG_HDR cfghdr3={CFG_CBOX,"Red button mode",0,3};
__root const int RED_BUT_MODE=2;
__root const CFG_CBOX_ITEM cfgcbox3[3]={"As in FW","Classic","Hide all tasks"};
#endif
__root const CFG_HDR cfghdr22={CFG_CBOX,"Enable if keyboard locked",0,2};
__root const int ENA_LOCK=1;
__root const CFG_CBOX_ITEM cfgcbox22[2]={"No","Yes"};
__root const CFG_HDR cfghdr27={CFG_CBOX,"Show NewStyleDaemons",0,2};
__root const int SHOW_DAEMONS=1;
__root const CFG_CBOX_ITEM cfgcbox27[2]={"No","Yes"};
__root const CFG_HDR cfghdr28={CFG_STR_UTF8,"background",3,127};
__root const char background_img[128]="4:\\ZBin\\xtask3\\background.png";
__root const CFG_HDR cfghdr29={CFG_STR_UTF8,"cursor",3,127};
__root const char cursor_img[128]="4:\\ZBin\\xtask3\\cursor.png";
__root const CFG_HDR cfghdr34={CFG_STR_UTF8,"selection img",3,127};
__root const char selection_img[128]="4:\\ZBin\\xtask3\\selection.png";
__root const CFG_HDR cfghdr35={CFG_STR_UTF8,"tasks img",3,127};
__root const char tasks_img[128]="4:\\ZBin\\xtask3\\tasks.png";
__root const CFG_HDR cfghdr36={CFG_STR_UTF8,"bookmarks img",3,127};
__root const char bookmarks_img[128]="4:\\ZBin\\xtask3\\bookmarks.png";
__root const CFG_HDR cfghdr30={CFG_STR_UTF8,"icon list",3,127};
__root const char icon_list_path[128]="4:\\ZBin\\xtask3\\icon_list.txt";
__root const CFG_HDR cfghdr31={CFG_STR_UTF8,"bookmark list",3,127};
__root const char bokmark_list_path[128]="4:\\ZBin\\xtask3\\bookmark_list.txt";
| [
"[email protected]"
] | |
8587a6cd717d7be107c5a3015bd9564bee0ccec6 | 487758b0f371df3233c0651a042c26e7fc6b0765 | /vendors/redpine/wmcu_lib/1.2.0/Peripheral_Library/rom_driver/inc/rsi_packing.h | d1e536efedeb742610ac8146cf94f295aed88517 | [] | no_license | redpinesignalsinc/amazon-freertos | bcd30d43d759b905f4e47973d53db777e57b7117 | 22f470e30ee8c3cfe7861551dff4849212668f87 | refs/heads/master | 2020-12-22T04:54:16.742019 | 2020-01-28T07:39:15 | 2020-01-28T07:39:15 | 235,995,037 | 0 | 0 | null | 2020-01-27T10:45:52 | 2020-01-24T12:00:47 | null | UTF-8 | C | false | false | 179 | h | #ifndef __PACKING_H_
#define __PACKING_H_
#define PRE_PACK /* Nothing */
#define POST_PACK /* Nothing */
#define ALIGNED(n) /* Nothing */
#endif /* __PACKING_H_ */
| [
"[email protected]"
] | |
ab743f6c99da2d9a5dc62c53f8ab68685d56a6ea | b53f25a8f3de951086780d6e7c3fb04bc50267a3 | /Linux内核API完全参考手册/chapter6/vmalloc_user/vmalloc_user.c | a18fd6896363e501ae30024417ef3435ca0b7394 | [] | no_license | nivekhah/Linux_Kernel_API_Index | 5fac588a8ecbee787a55e277cf7572ba9e2f39d9 | f09c95bba5ff290416f0f21017da8c0a3e78bac8 | refs/heads/master | 2021-10-24T05:38:55.917683 | 2018-07-02T19:38:13 | 2018-07-02T19:38:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,208 | c | /********************************************************************************
* File Name: vmalloc_user.c
* Description: 第6章实例训练
* Reference book:《Linux内核API完全参考手册》邱铁,周玉,邓莹莹 ,机械工业出版社.2010.9
* E_mail:[email protected]
*
********************************************************************************/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/security.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
MODULE_LICENSE("GPL");
static int __init vmalloc_user_init(void);
static void __exit vmalloc_user_exit(void);
#define VMALLOC_user_SIZE 8092
char * addr;
int __init vmalloc_user_init(void)
{
addr = (char *)vmalloc_user(VMALLOC_user_SIZE);
if( addr == NULL )
printk("<0>vmalloc failed!\n");
else
{
printk("<0>vmalloc successfully! addr = %lx\n",(unsigned long)addr);
printk("<0> *addr = %d\n",*addr);
printk("<0> *(addr+50) = %d\n",*(addr+50));
}
return 0;
}
void __exit vmalloc_user_exit(void)
{
if(addr != NULL)
vfree( addr );
printk("<0>exit!\n");
}
module_init(vmalloc_user_init);
module_exit(vmalloc_user_exit);
| [
"[email protected]"
] | |
4464cf12e15de842698c917fb4b9d157786f7a22 | ba3c943e12361accdc98116d27d72a2c992072ed | /daisy/wm8731_frame.h | 5728a46555dbe8d20d7f4418ea21279d3bf9b4fb | [
"MIT"
] | permissive | PaulBatchelor/daisyverb | 23342f11bcd74731f109701d829909034c0a4d59 | 0da82381801f5554d76d62e29dce2aca31f57ccc | refs/heads/master | 2022-04-07T12:45:59.375527 | 2020-01-02T17:47:50 | 2020-01-02T17:47:50 | 224,527,365 | 6 | 0 | null | null | null | null | UTF-8 | C | false | false | 210 | h | #ifndef CODEC_FRAME_H
#define CODEC_FRAME_H
#include <stddef.h>
typedef struct {
short l;
short r;
}codec_frame_t;
typedef void (*sa_audio_callback)(codec_frame_t* , codec_frame_t* , size_t);
#endif
| [
"[email protected]"
] | |
8c51aa42b3517c8caab1137455143e3e5bdd23fe | f14f13f038339aa180b38b11535cec725bdeefab | /tests/test_mbsrtowcs_s.c | 4a3353b86c684f90330fc8622d744c059436f8b7 | [
"MIT"
] | permissive | hauke/safeclib | df8717a5dfa555cc677545e5a7f3537a7178f4b3 | ad76c7b1dbd0403b0c9decf54164fcce271c590f | refs/heads/master | 2020-09-08T07:44:25.563643 | 2019-11-06T08:49:52 | 2019-11-06T08:49:52 | 221,065,753 | 0 | 0 | NOASSERTION | 2019-11-11T20:37:34 | 2019-11-11T20:37:33 | null | UTF-8 | C | false | false | 7,532 | c | /*------------------------------------------------------------------
* test_mbsrtowcs_s
* File 'wchar/mbsrtowcs_s.c'
* Lines executed:91.89% of 37
* locale specific, sets it to C and UTF-8
*
*------------------------------------------------------------------
*/
#include "test_private.h"
#include "safe_str_lib.h"
#ifdef HAVE_MBSRTOWCS_S
#define HAVE_NATIVE 1
#else
#define HAVE_NATIVE 0
#endif
#include "test_msvcrt.h"
#define MAX (128)
#define LEN (128)
static wchar_t dest[LEN];
#ifndef HAVE_CT_BOS_OVR
static char src[LEN];
#endif
#ifdef HAVE_WCHAR_H
#include <stdlib.h>
#include <locale.h>
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
#define CLRPS memset(&ps, '\0', sizeof(mbstate_t))
int test_mbsrtowcs_s(void);
int test_mbsrtowcs_s(void) {
errno_t rc;
size_t ind;
/*uint32_t i;*/
const char *cs;
mbstate_t ps;
const char *lang;
const char *lc_cat;
int errs = 0;
/*--------------------------------------------------*/
cs = "a";
#ifndef HAVE_CT_BOS_OVR
print_msvcrt(use_msvcrt);
EXPECT_BOS("empty retvalp") EXPECT_BOS("empty *srcp or len")
rc = mbsrtowcs_s(NULL, NULL, LEN, &cs, 0, &ps);
init_msvcrt(rc == ESNULLP, &use_msvcrt);
ERR_MSVC(ESNULLP, EINVAL);
CLRPS;
EXPECT_BOS("empty ps") EXPECT_BOS("empty *srcp or len")
rc = mbsrtowcs_s(&ind, NULL, LEN, &cs, 0, NULL);
ERR_MSVC(ESNULLP, EINVAL);
EXPECT_BOS("empty srcp") EXPECT_BOS("empty *srcp or len")
rc = mbsrtowcs_s(&ind, dest, LEN, NULL, 0, &ps);
ERR_MSVC(ESNULLP, EINVAL);
CLRPS;
{
const char **srcp = (const char **)(void *)&src;
*src = 0;
/*EXPECT_BOS_TODO("empty *srcp or len")*/
rc = mbsrtowcs_s(&ind, dest, LEN, srcp, 1, &ps);
ERR_MSVC(ESNULLP, EINVAL);
CLRPS;
}
cs = "a";
EXPECT_BOS("empty dmax")
rc = mbsrtowcs_s(&ind, dest, 0, &cs, 3, &ps);
ERR_MSVC(ESZEROL, EINVAL);
CLRPS;
EXPECT_BOS("dest overflow")
rc = mbsrtowcs_s(&ind, dest, RSIZE_MAX_STR + 1, &cs, 3, &ps);
ERR_MSVC(ESLEMAX, 0);
CLRPS;
#ifdef HAVE___BUILTIN_OBJECT_SIZE
EXPECT_BOS("dest overflow")
rc = mbsrtowcs_s(&ind, dest, LEN + 1, &cs, 3, &ps);
ERR(EOVERFLOW);
CLRPS;
#endif
{
void *p1;
cs = "abcdef";
p1 = &cs;
EXPECT_BOS_TODO("dest overlap")
rc = mbsrtowcs_s(&ind, (wchar_t *)p1, 1, &cs, 1, &ps);
ERR_MSVC(ESOVRLP, ERANGE);
CLRPS;
}
#endif
/*--------------------------------------------------*/
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "abcdef", &cs), 3, &ps);
ERR(EOK);
INDCMP(!= 3);
WCHECK_SLACK(&dest[3], LEN - 3);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "abcdef", &cs), 8, &ps);
ERR(EOK);
INDCMP(!= 6);
WCHECK_SLACK(&dest[6], LEN - 6);
CLRPS;
rc = mbsrtowcs_s(&ind, NULL, LEN, (cs = "abcdef", &cs), 2, &ps);
ERR(EOK);
#ifndef __MINGW32__ /* ind=2 */
INDCMP(!= 6);
#endif
CLRPS;
SETLOCALE_C;
SETLANG("C");
CHKLOCALE_C;
/* no-breaking space illegal in ASCII, but legal in C */
rc = mbsrtowcs_s(&ind, dest, LEN,
(cs = "\xa0"
"abc",
&cs),
32, &ps);
if (rc == 0) { /* legal */
ERR(EOK);
INDCMP(!= 4);
WCHECK_SLACK(&dest[4], LEN - 4);
/* musl on ASCII converts \xa0 to \xdfa0 */
if ((int)dest[0] != 0xa0 && (int)dest[0] != 0xdfa0) {
printf("%s %u Error ind=%d rc=%d 0x%lx\n", __FUNCTION__, __LINE__,
(int)ind, rc, (long)dest[0]);
errs++;
}
if (dest[1] != L'a') {
printf("%s %u Error ind=%d rc=%d 0x%lx\n", __FUNCTION__, __LINE__,
(int)ind, rc, (long)dest[1]);
errs++;
}
if (cs) { /* needs to be at the end */
printf("%s %u Error ind=%d rc=%d %s\n", __FUNCTION__, __LINE__,
(int)ind, rc, cs);
errs++;
}
} else {
ERR(EILSEQ); /* or illegal */
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
if (dest[0] != L'\0') {
printf("%s %u Error ind=%d rc=%d 0x%lx\n", __FUNCTION__, __LINE__,
(int)ind, rc, (long)dest[0]);
errs++;
}
}
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\x78", &cs), 1, &ps);
ERR(EOK);
INDCMP(!= 1);
WCHECK_SLACK(&dest[1], LEN - 1);
CLRPS;
SETLOCALE_UTF8;
SETLANG("default");
REQLOCALE("UTF-8")
/* illegal sequences (locale dependent) */
/* illegal initial */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xc0", &cs), 1, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xc2", &cs), 1, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* aliasing nul */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xc0\x80", &cs), 2, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* aliasing slashes */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xc0\xaf", &cs), 2, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xe0\x80\xaf", &cs), 3, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xf0\x80\x80\xaf", &cs), 4, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xf8\x80\x80\x80\xaf", &cs), 5,
&ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xfc\x80\x80\x80\x80\xaf", &cs), 6,
&ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* aliasing U+0080 */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xe0\x82\x80", &cs), 3, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* aliasing U+07FF */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xe0\x9f\xbf", &cs), 3, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* aliasing U+0800 */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xf0\x80\xa0\x80", &cs), 4, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* aliasing U+FFFD */
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xf0\x8f\xbf\xbd", &cs), 4, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
/* check enough space for src and conversion errors */
rc = mbsrtowcs_s(&ind, dest, 6, (cs = "abcdef", &cs), 6, &ps);
ERR_MSVC(ESNOSPC, ERANGE);
WCHECK_SLACK(dest, 6);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, 3, (cs = "\xf0\x8f\xbf\xbd", &cs), 4, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\x80\xbf\x80", &cs), 3, &ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
CLRPS;
rc = mbsrtowcs_s(&ind, dest, LEN, (cs = "\xfc\x80\x80\x80\x80\x80", &cs), 6,
&ps);
ERR(EILSEQ);
INDCMP(!= -1);
WCHECK_SLACK(dest, LEN);
/*--------------------------------------------------*/
return (errs);
}
#endif
int main(void) {
#ifdef HAVE_WCHAR_H
return (test_mbsrtowcs_s());
#else
return 0;
#endif
}
| [
"[email protected]"
] | |
0cf2aa0cc45174be70bf38f79b176df297ec8f38 | 2af8fc41807353dd1f4bdb6445d43d608ee700ef | /Src/radio/radio-log.c | 04bad0f95d0ef93026394e39c6c5e0efde39b080 | [] | no_license | weiyang-github/lw-demo-stm32cube-die | 481bb5db989ee33e05a5f4780d3b0f7552568c42 | 756e6b6683ac72d6db8e9cc6429cd485b7c9c230 | refs/heads/master | 2023-04-11T18:03:03.741412 | 2021-04-28T04:21:58 | 2021-04-28T05:52:06 | 362,354,492 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,971 | c | /*
_/_/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/ _/_/_/_/
_/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
_/_/_/ _/ _/_/ _/ _/ _/ _/ _/ _/_/ _/_/_/_/ _/_/_/
_/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
_/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/ _/
(C)2021 RisingHF, all rights reserved.
*/
#include <log.h>
#include <radio-log.h>
#include <utilities.h>
static LogRf_t LogRf;
void RadioLogInit(void)
{
memset(&LogRf, 0, sizeof(LogRf_t));
}
LogRf_t *RadioLogObjectGet(void)
{
return &LogRf;
}
/*
Element structure:
len | type | rssi | snr | buf
*/
void RadioLogRfDataPush(uint8_t dt_type, uint8_t *buf, int len, int16_t rssi, uint8_t snr)
{
if(DEBUG > log_get_level() ) {
return;
}
LogRf_t *log_rf = &LogRf;
int i;
CRITICAL_SECTION_BEGIN();
if ((log_rf->cnt + len + 5) > RADIO_LOG_BUF_LEN) {
CRITICAL_SECTION_END();
return;
}
log_rf->buf[log_rf->wr++] = len;
log_rf->buf[log_rf->wr++] = dt_type;
log_rf->buf[log_rf->wr++] = (rssi >> 0);
log_rf->buf[log_rf->wr++] = (rssi >> 8);
log_rf->buf[log_rf->wr++] = snr;
for (i = 0; i < len; i++) {
log_rf->buf[log_rf->wr] = buf[i];
log_rf->wr++;
}
log_rf->cnt += len + 5;
CRITICAL_SECTION_END();
}
void RadioLogPop(void)
{
if(DEBUG > log_get_level() ) {
return;
}
LogRf_t *log_rf = &LogRf;;
const char *radio_name = RADIO_NAME;
if(log_rf->flag == true){
switch(log_rf->bw){
case 7:
log_rf->bw = 125;
break;
case 8:
log_rf->bw = 250;
break;
case 9:
log_rf->bw = 500;
break;
}
switch (log_rf->op_type) {
case 0:
/* RX */
if(log_rf->sf != 50000){
log_puts(DEBUG, radio_name, "%s, %d, SF%d, %dKHz, %d", "RX", log_rf->freq, log_rf->sf, log_rf->bw, log_rf->pream);
}else{
log_puts(DEBUG, radio_name, "%s, %d, FSK %dbps", "RX", log_rf->freq, log_rf->sf);
}
break;
case 1:
/* TX */
if(log_rf->sf != 50000){
log_puts(DEBUG, radio_name, "%s, %d, SF%d, %dKHz, %d, %d", "TX", log_rf->freq, log_rf->sf, log_rf->bw, log_rf->pream, log_rf->pow);
}else{
log_puts(DEBUG, radio_name, "%s, %d, FSK %dbps, %d", "TX", log_rf->freq, log_rf->sf, log_rf->pow);
}
break;
case 2:
/* CAD */
log_puts(DEBUG, radio_name, "%s, %d, SF%d, %dKHz", "CAD", log_rf->freq, log_rf->sf, log_rf->bw);
break;
}
log_rf->flag = false;
}
{
int i;
uint8_t dt_type;
uint16_t len;
uint16_t rssi;
int8_t snr;
len = 0;
if (log_rf->cnt > 0) {
i = 0;
len = log_rf->buf[i++];
dt_type = log_rf->buf[i++];
rssi = ((uint16_t)log_rf->buf[i++] << 0);
rssi |= ((uint16_t)log_rf->buf[i++] << 8);
snr = (int8_t)log_rf->buf[i++];
if (dt_type) {
log_puts(DEBUG, radio_name, "%s, %h",
"TX",
log_rf->buf + 5,
len);
} else {
log_puts(DEBUG, radio_name, "%s, %h, %d, %d",
"RX",
log_rf->buf + 5, len,
(int16_t)rssi,
(int)(((int8_t)snr)/4.0+0.5));
}
CRITICAL_SECTION_BEGIN();
log_rf->cnt -= (len + 5);
for (i = 0; i < log_rf->cnt; i++) {
log_rf->buf[i] = log_rf->buf[len + 5 + i];
}
log_rf->wr = log_rf->cnt;
CRITICAL_SECTION_END();
}
}
}
| [
"[email protected]"
] | |
00ebd596c908bf65f465c07718844435b400e6fe | 3a56b1155d39c8e4dfaff52f0ec2e43b64304c28 | /frames/05277.h | b9748c0090d58afa828d7075fdd6de2ed74384bd | [] | no_license | RippedOrigami/GBA-Rick | 6a610bde18e8dda978730b2d754565e9cdcbfe1d | 0953de71ad0a392f5d3a0bcedc54d55e478925b7 | refs/heads/master | 2021-05-28T17:10:33.260039 | 2014-11-28T17:14:04 | 2014-11-28T17:14:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 660 | h |
//{{BLOCK(_5277)
//======================================================================
//
// _5277, 40x40@8,
// + palette 256 entries, not compressed
// + 25 tiles lz77 compressed
// Total size: 512 + 1516 = 2028
//
// Time-stamp: 2014-11-28, 05:20:15
// Exported by Cearn's GBA Image Transmogrifier, v0.8.12
// ( http://www.coranac.com/projects/#grit )
//
//======================================================================
#ifndef GRIT__5277_H
#define GRIT__5277_H
#define _5277TilesLen 1516
extern const unsigned int _5277Tiles[379];
#define _5277PalLen 512
extern const unsigned short _5277Pal[256];
#endif // GRIT__5277_H
//}}BLOCK(_5277)
| [
"[email protected]"
] | |
b97bd3c771e872caf564d55b05a639c5184c5be9 | 0a54678568dff233c45c8cce2cbcb4c8d6237133 | /DUMP/BP_UIStyle_Label_Heading1_classes.h | 22cb4b779e0b1f9bfb37c0c5e19db8ab758e82a5 | [] | no_license | xkp95175333/NineToFiveClient-Win64-Shipping | 4ebf211a147a0b6b809e4067d58d248ee9ba290d | 43f2252de5992ef6e907b8fd9ac5bf25645295d0 | refs/heads/main | 2023-07-27T02:53:26.014095 | 2021-09-06T17:55:41 | 2021-09-06T17:55:41 | 403,714,603 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 177 | h | // BlueprintGeneratedClass BP_UIStyle_Label_Heading1.BP_UIStyle_Label_Heading1_C
// Size: 0xa9 (Inherited: 0xa9)
struct UBP_UIStyle_Label_Heading1_C : UBP_UIStyle_Label_C {
};
| [
"[email protected]"
] | |
46e3c9ddf3ca5a0410438e74f4523d07de8a7403 | 07e557360f781783f8c7710561369e8c6aa890b0 | /Software/Embedded_Linux/source/module_2015-01-09/SSP_ALSA128/codec/fi2s-tw2968-c1.c | 8e5297fca3cbe2651bbd4814cda91b2294d05d3d | [] | no_license | irwin0112/gm8136_sdk | 44a50bf6c69300daf42e258d08c8d901bdf5c1f6 | 34d03991c6a6e46ac9e1097459c569df3489149a | refs/heads/main | 2023-03-16T21:16:56.776114 | 2020-11-10T14:26:14 | 2020-11-10T14:26:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,549 | c | #include <linux/init.h>
#include <linux/module.h>
#include <ftssp010-ssp.h>
#undef PFX
#define PFX "NVP1918"
#define SSP_SLAVE_MODE 1
#define DEBUG_NVP1918 0
//debug helper
#if DEBUG_NVP1918
#define DEBUG_NVP1918_PRINT(FMT, ARGS...) printk(FMT, ##ARGS)
#else
#define DEBUG_NVP1918_PRINT(FMT, ARGS...)
#endif
struct ftssp010_nvp1918_t {
ftssp010_pcm_ops_t ops;
ftssp010_card_t *card;
u_int32_t sample_rate;
};
static struct ftssp010_nvp1918_t *my_chip = NULL;
static u_int32_t g_fstable[] =
{ 8000 , 16000};
static u_int32_t g_mclk[] =
{FTSSP_MCLK_24576K, FTSSP_MCLK_24576K};
static u_int32_t g_bclk[] =
{ 2048000, 4096000};
static ftssp_clock_table_t g_clock_table = {
.fs_table = g_fstable,
.sspclk_table = g_mclk,
.bclk_table = g_bclk,
.number = ARRAY_SIZE(g_fstable),
};
static int ftssp010_nvp1918_open(ftssp010_pcm_ops_t * ops, snd_pcm_substream_t * substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_pcm_hardware *hw = &runtime->hw;
hw->formats &= (SNDRV_PCM_FORMAT_S8|SNDRV_PCM_FORMAT_U8|SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE);
hw->rates &= (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 );
hw->rate_min = 8000;
hw->rate_max = 16000;
return 0;
}
static int ftssp010_nvp1918_close(ftssp010_pcm_ops_t * ops, snd_pcm_substream_t * stream)
{
return 0;
}
static int ftssp010_nvp1918_prepare(ftssp010_pcm_ops_t * ops, snd_pcm_substream_t * stream,
struct snd_pcm_runtime * run)
{
struct ftssp010_nvp1918_t *chip = container_of(ops, struct ftssp010_nvp1918_t, ops);
DEBUG_NVP1918_PRINT("%s: set fs %d\n", __FUNCTION__, run->rate);
chip->sample_rate = run->rate;
return 0;
}
static int ftssp010_nvp1918_get_dma_parameters(ftssp010_pcm_ops_t * ops,
snd_pcm_substream_t * substream, int *dma_width)
{
snd_pcm_format_t sample_size = substream->runtime->format;
DEBUG_NVP1918_PRINT("In %s: sample_size(ALSA define SYM) = %d\n", __FUNCTION__,
substream->runtime->format);
switch (sample_size) {
case SNDRV_PCM_FORMAT_S8:
case SNDRV_PCM_FORMAT_U8:
case SNDRV_PCM_FORMAT_S16_LE:
case SNDRV_PCM_FORMAT_U16_LE:
*dma_width = 4;
break;
default:
return -1;
}
return 0;
}
static int ftssp010_nvp1918_startup(ftssp010_pcm_ops_t * ops)
{
return 0;
}
static struct ftssp010_pcm_ops ftssp010_nvp1918_ops = {
.owner = THIS_MODULE,
.startup = ftssp010_nvp1918_startup,
.open = ftssp010_nvp1918_open,
.close = ftssp010_nvp1918_close,
.prepare = ftssp010_nvp1918_prepare,
.get_dma_parameters = ftssp010_nvp1918_get_dma_parameters
};
static int fi2s_nvp1918_init(void)
{
int ret = -ENOMEM;
ftssp010_card_t *card = NULL;
my_chip = kmalloc(sizeof(struct ftssp010_nvp1918_t), GFP_KERNEL);
if (my_chip == NULL) {
ret = -ENOMEM;
goto exit_err1;
}
memset(my_chip, 0, sizeof(struct ftssp010_nvp1918_t));
card = ftssp010_ssp_probe(1, THIS_MODULE);
if (IS_ERR(card)) {
ret = PTR_ERR(card);
goto exit_err2;
}
card->codec_fmtbit = 16;
card->clock_table = &g_clock_table;
card->total_channels = 16;
my_chip->card = card;
my_chip->ops = ftssp010_nvp1918_ops;
card->chip_ops = &my_chip->ops;
card->client = my_chip;
#if SSP_SLAVE_MODE
card->SSP_CR0 = I2S_FORMAT | SSP_FSDIST(1) | SSP_OPM_SLST | SSP_FSPO_LOW; /* SSP as Slave */
#else
card->SSP_CR0 = I2S_FORMAT | SSP_FSDIST(1) | SSP_OPM_MSST | SSP_FSPO_LOW; /* SSP as Master */
#endif
ftssp010_ssp_hw_init(card->vbase);
ret = snd_card_register(card->card);
if (ret) {
goto exit_err3;
}
DEBUG_NVP1918_PRINT("I2S probe ok in %s mode.\n",
(card->SSP_CR0 & SSP_MS_MASK) ? "Master" : "Slave");
return 0;
exit_err3:
ftssp010_ssp_remove(my_chip->card);
exit_err2:
kfree(my_chip);
exit_err1:
DEBUG_NVP1918_PRINT("I2S probe fail in %s mode.",
(card->SSP_CR0 & SSP_MS_MASK) ? "Master" : "Slave");
return ret;
}
static void fi2s_nvp1918_exit(void)
{
ftssp010_ssp_remove(my_chip->card);
kfree(my_chip);
my_chip = NULL;
}
module_init(fi2s_nvp1918_init);
module_exit(fi2s_nvp1918_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("GM Technology Corp.");
MODULE_DESCRIPTION("FTSSP010 - NVP1918");
MODULE_VERSION(FTSSP101_VERSION);
| [
"[email protected]"
] | |
3ec530baec5ae558343a2a011fa3a33775f5ea79 | 74874ec666e60c56a7e1143aa0b2460b71ffc15b | /BloksAIPlugin/Vendor/illustratorapi/illustrator/legacy/AI90Document.h | e65bb51e45db8c7687a69aeca007f6c920f346e8 | [
"MIT"
] | permissive | stephanie-walter/Bloks | 8102428dcc4a8dc11d8f1eda8997085c980eda00 | d5c59807b17d4d52f7cb2e3ec952b6e6127b4e27 | refs/heads/master | 2021-01-23T02:10:29.141440 | 2016-08-07T17:04:33 | 2016-08-07T17:04:33 | 65,363,270 | 1 | 0 | null | 2016-08-10T08:09:06 | 2016-08-10T08:09:06 | null | UTF-8 | C | false | false | 4,845 | h | #ifndef __AI90Document__
#define __AI90Document__
/*
* Name: AI90Document.h
* $Revision: 25 $
* Author:
* Date:
* Purpose: Adobe Illustrator 9.0 Document Suite.
*
* ADOBE SYSTEMS INCORPORATED
* Copyright 1986-2007 Adobe Systems Incorporated.
* All rights reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file
* in accordance with the terms of the Adobe license agreement
* accompanying it. If you have received this file from a source other
* than Adobe, then your use, modification, or distribution of it
* requires the prior written permission of Adobe.
*
*/
/*******************************************************************************
**
** Imports
**
**/
#include "AI120Document.h"
#include "AIHeaderBegin.h"
/*******************************************************************************
**
** Constants
**
**/
#define kAI90DocumentSuite kAIDocumentSuite
#define kAIDocumentSuiteVersion6 AIAPI_VERSION(6)
#define kAI90DocumentSuiteVersion kAIDocumentSuiteVersion6
/*******************************************************************************
**
** Suite
**
**/
typedef struct {
AIAPI AIErr (*GetDocumentPageOrigin) ( AIRealPoint *origin );
AIAPI AIErr (*SetDocumentPageOrigin) ( AIRealPoint *origin );
AIAPI AIErr (*SetDocumentRulerOrigin) ( AIRealPoint *origin );
AIAPI AIErr (*GetDocumentRulerUnits) ( short *units );
AIAPI AIErr (*SetDocumentRulerUnits) ( short units );
AIAPI AIErr (*GetDocumentCropBoxGroupHandle) ( AIArtHandle *cropHandle );
AIAPI AIErr (*GetDocumentCropBox) ( AIRealRect *cropBox );
AIAPI AIErr (*SetDocumentCropBox) ( AIRealRect *cropBox );
AIAPI AIErr (*GetDocumentCropStyle) ( AICropMarkStyle *cropStyle );
AIAPI AIErr (*SetDocumentCropStyle) ( AICropMarkStyle cropStyle );
AIAPI AIErr (*GetDocumentPrintRecord) ( AIDocumentPlatformPrintRecord *print );
AIAPI AIErr (*SetDocumentPrintRecord) ( AIDocumentPlatformPrintRecord print );
AIAPI AIErr (*GetDocumentSetup) ( AI120DocumentSetup *setup );
AIAPI AIErr (*SetDocumentSetup) ( AI120DocumentSetup *setup );
AIAPI AIErr (*GetDocumentModified) ( AIBoolean *modified );
AIAPI AIErr (*SetDocumentModified) ( AIBoolean modified );
AIAPI AIErr (*GetDocumentFileFormat) ( AIFileFormatHandle *fileFormat );
AIAPI AIErr (*SetDocumentFileFormat) ( AIFileFormatHandle fileFormat );
AIAPI AIErr (*GetDocumentFileFormatParameters) ( AIDocumentFileFormatParameters *parameters );
AIAPI AIErr (*SetDocumentFileFormatParameters) ( AIDocumentFileFormatParameters parameters );
AIAPI AIErr (*RedrawDocument) ( void );
AIAPI AIErr (*GetDocument) ( AIDocumentHandle *document );
AIAPI AIErr (*GetDocumentMiPrintRecord) ( AIDocumentMiPrintRecordPtr print );
AIAPI AIErr (*SetDocumentMiPrintRecord) ( AIDocumentMiPrintRecordPtr print );
AIAPI AIErr (*GetDocumentRulerOrigin) ( AIRealPoint *origin );
AIAPI AIErr (*UpdateLinks) ( AIBoolean *updatedSomething );
AIAPI AIErr (*GetDocumentZoomLimit) ( AIReal *min, AIReal *max );
AIAPI AIErr (*GetDocumentMaxArtboardBounds)( AIRealRect *bounds );
AIAPI AIErr (*DocumentExists) ( AIDocumentHandle document, AIBoolean *exists );
/* Returns the recorded dictionary associated with the document. Note that dictionaries
are reference counted. You must call sAIDictionary->Release() when you're
done with it. */
AIAPI AIErr (*GetDictionary) ( struct _AIDictionary** dictionary );
AIAPI AIErr (*GetDocumentColorModel) ( short *colorModel);
AIAPI AIErr (*SetDocumentColorModel) ( short colorModel);
AIAPI AIErr (*GetDocumentProfiles) ( AIColorProfile *rgbProfile, AIColorProfile *cmykProfile, AIColorProfile *grayProfile );
AIAPI AIErr (*SetDocumentProfiles) ( AIColorProfile rgbProfile, AIColorProfile cmykProfile, AIColorProfile grayProfile );
AIAPI AIErr (*Copy) ();
AIAPI AIErr (*Cut) ();
AIAPI AIErr (*Paste) ();
AIAPI AIErr (*SyncDocument) ( void );
AIAPI AIErr (*GetDocumentTargeting) ( short *paintTarget, short *transparencyTarget, short *effectsTarget );
AIAPI AIErr (*SetDocumentTargeting) ( short paintTarget, short transparencyTarget, short effectsTarget );
/* Returns the dictionary associated with the document for which changes to the
dictionary and its contents will not be recorded for undo/redo purposes. You
must call sAIDictionary->Release() when you're done with it.*/
AIAPI AIErr (*GetNonRecordedDictionary) ( struct _AIDictionary** dictionary );
// Returns AI version of the current document. If unknown, or not an AI file, returns 0.
// Version 2 is Illustrator 88.
AIAPI int (*GetAIVersion) ();
AIAPI AIErr (*DocumentHasTransparency) ( AIBoolean *hasTransparency, AIBoolean detectOverprint );
AIAPI AIErr (*DocumentHasSpotColorArt) ( AIBoolean *hasSpotColorArt );
} AI90DocumentSuite;
#include "AIHeaderEnd.h"
#endif
| [
"[email protected]"
] | |
7c8c14846550e194b0b88a30cf6085e1d1e5a58d | 0b90650a7fdb479c68a8bd463dae1fc94fee381a | /C-Higher/项目/chat_server.c | 946bd15967423bee070a947892c36dcae83aed30 | [] | no_license | cwx5319019/demo1 | 4d0fe27ed649a93c1f04af0781616b86a15181f3 | 89c4fb63059316d6cde00f22eaed0f72e37ec10c | refs/heads/master | 2023-01-10T02:54:14.427133 | 2020-11-15T13:02:32 | 2020-11-15T13:02:32 | 312,771,911 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,112 | c | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include "protocol.h"
void* do_server(void* arg)
{
int retval;
int clientfd = *((int*)arg);
printf("%s ,clientfd=%d\n",__FUNCTION__,clientfd);
protocol pack;
memset((void*)&pack,0,sizeof(protocol));
while(1)
{
retval = read(clientfd,(void*)&pack,sizeof(protocol));
printf("从%d #客户端读到 %d 字节:type=%d\n",clientfd,retval,pack.type);
if(retval==0)
{
printf("%d# 客户端已断开...\n",clientfd);
break;
}
switch(pack.type)
{
case TYPE_REG:// 处理注册包
//遍历链表,检查是否有已经注册的用户
// if(check_name()==0)//没有注册,则返回TYPE_OK
{
pack.type = TYPE_OK;
retval = write(clientfd,(void*)&pack,sizeof(protocol));
printf("发送了%d字节到客户端\n",retval);
// }else{//该用户存在,返回TYPE_ERR
}
break;
case TYPE_LOGIN://处理登录包
break;
case TYPE_EXIT:
break;
default:
printf("接收的包类型有误....\n");
break;
}
}
close(clientfd);
return NULL;
}
int main(void)
{
//int socket(int domain, int type, int protocol);
//功能:创建一个套接字
//返回值:文件描述符--代表网络链接
int fd;
/**************第一步:创建套接字************/
//创建一个基于TCP的IPV4套接字
fd = socket(AF_INET,SOCK_STREAM,0);
printf("fd=%d\n",fd);
// int setsockopt(int sockfd, int level, int optname,const voi d *optval, socklen_t optlen);
int on = 1;
setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,&on,sizeof(int));
/**************第二步:绑定*****************/
//int bind(int sockfd, const struct sockaddr *addr,socklen_t addrlen);
struct sockaddr_in server;
server.sin_family = AF_INET;// 设置IPV4地址
server.sin_port = htons(8990);//host short 把端口号转为网络字节序
server.sin_addr.s_addr = inet_addr("192.168.91.129"); //设置IP地址
int retval;
retval = bind(fd,(struct sockaddr*)&server,(socklen_t)sizeof(struct sockaddr_in));
printf("bind的返回值=%d\n",retval);
if(retval==-1)
{
perror("bind failed...");
goto out;
}
/******************第3步:监听********************/
// int listen(int sockfd, int backlog);
retval = listen(fd,10);//设置监听队列的长度
printf("listen的返回值=%d\n",retval);
if(retval==-1)
{
perror("listen failed...");
}
/****************第4步:接收(接收客户端的链接)****************/
int clientfd;
struct sockaddr_in client;//用于保存客户端的IP地址和端口号
socklen_t len=0;
pthread_t thread[100];
int client_no = 0;
pthread_attr_t attr[100];
//int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
while(1){
printf("accept...\n");
clientfd = accept(fd,(struct sockaddr*)&client,&len);
printf("客户端fd=%d:IP=%s,PORT=%d\n",clientfd,inet_ntoa(client.sin_addr),ntohs(client.sin_port));
/****************第五步:与客户端通信*****************/
char *str = "欢迎光临...";
retval = write(clientfd,str,strlen(str));
printf("发送%d字节到客户端...\n",retval);
pthread_attr_init(&attr[client_no]);
pthread_attr_setdetachstate(&attr[client_no],PTHREAD_CREATE_DETACHED);
pthread_create(&thread[client_no],&attr[client_no],do_server,(void*)&clientfd);
client_no++;
}
out://标号
printf("goto here....\n");
close(fd);//关闭套接字
return 0;
}
| [
"[email protected]"
] | |
bfb4479b899ad619d9473e76c512958d4ec5529b | 5d417f03f724f4e23000f28cd629c92bc9297a23 | /avr32/applications/uc3-audio-player/user_interface/gui/gui.h | ab071c77406d52c462e1a2bf44de0adbe1ac2495 | [] | no_license | siliconunited/atmel-asf | 5ac78a123cb0f5026ffb9a0ba66b75abcccb788f | 19e02800a6cc33d203f5d12f7dfca0c39195d879 | refs/heads/master | 2021-01-22T21:34:10.563981 | 2017-03-19T04:45:30 | 2017-03-19T04:45:30 | 85,439,630 | 6 | 3 | null | 2020-03-08T01:34:35 | 2017-03-18T23:56:24 | C | UTF-8 | C | false | false | 6,748 | h | /*****************************************************************************
*
* \file
*
* \brief Graphical User Interface.
*
* Copyright (c) 2014-2015 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
*
*****************************************************************************/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _GUI_H_
#define _GUI_H_
#include "com_task.h"
/*! \name View to update
*/
//! \{
enum gui_update_view
{
//! \brief No view selected
GUI_UPDATE_VIEW_NONE,
//! \brief Idle view
GUI_UPDATE_VIEW_IDLE,
//! \brief Transition to the idle view
GUI_UPDATE_VIEW_IDLE_TRANSITION,
//! \brief Navigation view
GUI_UPDATE_VIEW_NAVIGATION,
//! \brief Transition to the navigation view
GUI_UPDATE_VIEW_NAVIGATION_TRANSITION,
//! \brief Playback view
GUI_UPDATE_VIEW_PLAYBACK,
//! \brief Transition to the playback view
GUI_UPDATE_VIEW_PLAYBACK_TRANSITION,
//! \brief Configuration view
GUI_UPDATE_VIEW_CONFIG,
//! \brief Transition to the configuration view
GUI_UPDATE_VIEW_CONFIG_TRANSITION
};
//! \}
/*! \name Elements of the view to update
*/
//! \{
enum gui_update_elt
{
//! \brief No element selected
GUI_UPDATE_ELT_NONE = 0x00000000,
//! \brief In progress element
GUI_UPDATE_ELT_IN_PROGRESS = 0x80000000,
//! \brief Device connected, mounted and ready to operate
GUI_UPDATE_ELT_CONNECTED = 0x40000000,
//! \brief Device disconnected
GUI_UPDATE_ELT_DISCONNECTED = 0x20000000,
//! \brief Device not supported message in the idle view
GUI_UPDATE_ELT_IDLE_NOT_SUPPORTED = 0x00000001,
//! \brief Device present message in the idle view
GUI_UPDATE_ELT_IDLE_DEVICE_PRESENT = 0x00000002,
//! \brief No device present message in the idle view
GUI_UPDATE_ELT_IDLE_NO_DEVICE_PRESENT = 0x00000004,
//! \brief File list update in the navigation view
GUI_UPDATE_ELT_NAVIGATION_FILE_LIST = 0x00000001,
//! \brief Cursor display in the navigation view
GUI_UPDATE_ELT_NAVIGATION_CURSOR = 0x00000002,
//! \brief Raised when a directory with no files/folders is opened
GUI_UPDATE_ELT_NAVIGATION_NO_FILES = 0x00000004,
//! \brief Play key display in the playback view
GUI_UPDATE_ELT_PLAYBACK_PLAY = 0x00000001,
//! \brief Pause key display in the playback view
GUI_UPDATE_ELT_PLAYBACK_PAUSE = 0x00000002,
//! \brief Stop key display in the playback view
GUI_UPDATE_ELT_PLAYBACK_STOP = 0x00000004,
//! \brief Fast forward key display in the playback view
GUI_UPDATE_ELT_PLAYBACK_FFW = 0x00000008,
//! \brief Fast rewind key display in the playback view
GUI_UPDATE_ELT_PLAYBACK_FRW = 0x00000010,
//! \brief Elapsed time display in the playback view
GUI_UPDATE_ELT_PLAYBACK_ELAPSED_TIME = 0x00000020,
//! \brief Volume bar display in the playback view
GUI_UPDATE_ELT_PLAYBACK_VOLUME = 0x00000040,
//! \brief Artist name display in the playback view
GUI_UPDATE_ELT_PLAYBACK_ARTIST = 0x00000080,
//! \brief Track title display in the playback view
GUI_UPDATE_ELT_PLAYBACK_TITLE = 0x00000100,
//! \brief Total time display in the playback view
GUI_UPDATE_ELT_PLAYBACK_TOTAL_TIME = 0x00000200,
//! \brief Cover art display in the playback view
GUI_UPDATE_ELT_PLAYBACK_COVER_ART = 0x00000400,
//! \brief Current song file name display in the playback view
GUI_UPDATE_ELT_PLAYBACK_FILE_NAME = 0x00000800,
//! \brief Apple Logo (in case on Local UI mode)
GUI_UPDATE_ELT_APPLE_LOGO = 0x00001000,
//! \brief Repeat option display in the configuration view
GUI_UPDATE_ELT_CONFIG_REPEAT = 0x00000001,
//! \brief Shuffle option display in the configuration view
GUI_UPDATE_ELT_CONFIG_SHUFFLE = 0x00000002,
//! \brief Cursor display in the configuration view
GUI_UPDATE_ELT_CONFIG_CURSOR = 0x00000004
};
//! \}
/*! \brief Initialization function of the GUI interface.
*
* \param fcpu_hz CPU frequency.
* \param fhsb_hz HSB frequency.
* \param fpbb_hz PBB frequency.
* \param fpba_hz PBA frequency.
*/
void gui_init(uint32_t fcpu_hz, uint32_t fhsb_hz, uint32_t fpbb_hz, uint32_t fpba_hz);
/*! \brief Shutdown the GUI
*/
void gui_shutdown(void);
/*! \brief GUI main task update
*
* \param view The view to update.
* \param element The elements of the view to be update.
* \param lst_str The list of file in the current directory.
* \param info Information of the selected file.
* \param player Information about the player itself.
*/
void gui_update(enum gui_update_view view, enum gui_update_elt *element,
struct display_file_list *lst_str, struct file_info *info,
struct player_info *player);
/*! \brief Make the display darker in order to simulate an idle mode and reduce
* power consumption.
*/
void gui_enter_idle(void);
/*! \brief Restore the display in the running mode.
*
*/
void gui_leave_idle(void);
#endif // _GUI_H_
| [
"[email protected]"
] | |
9bbd2de550c5952c3dea1c0298d981181a4c6c65 | 5742e5df1240da9be4955d42e4f402ca9f51cf0f | /ros2-osx/include/map_msgs/srv/set_map_projections.h | d0a20676181abae2f46419cb2e3051a1dea35207 | [] | no_license | unmelted/ros_prj | b15b9961c313eff210636e7f65d40292f7252e9c | ec5e926147d7d9ac0606ea847cc4f5c4fb8fceed | refs/heads/master | 2023-02-13T08:44:25.007130 | 2021-01-18T21:21:35 | 2021-01-18T21:21:35 | 330,076,208 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 499 | h | // generated from rosidl_generator_c/resource/idl.h.em
// with input from map_msgs:srv/SetMapProjections.idl
// generated code does not contain a copyright notice
#ifndef MAP_MSGS__SRV__SET_MAP_PROJECTIONS_H_
#define MAP_MSGS__SRV__SET_MAP_PROJECTIONS_H_
#include "map_msgs/srv/detail/set_map_projections__struct.h"
#include "map_msgs/srv/detail/set_map_projections__functions.h"
#include "map_msgs/srv/detail/set_map_projections__type_support.h"
#endif // MAP_MSGS__SRV__SET_MAP_PROJECTIONS_H_
| [
"[email protected]"
] | |
4fc1e0d78e97fd0a703a9e53dd50200f6e073ac8 | a61ae1cc31def08eaac082df57811c354563afe5 | /src/pchatbox.c | 5fd80593464e8b607c5de0757f668ab1d2b8d34f | [] | no_license | youngtrips/iFreeChat | 7aeabf5a12ac1a484041f52660d856c6d6727e09 | e329c026bb304b765c60b1d99512bee8598be0ee | refs/heads/master | 2020-05-19T09:01:59.437079 | 2011-02-22T09:01:44 | 2011-02-22T09:01:44 | 1,288,077 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,819 | c | /*
* Author: youngtrips([email protected])
* Created Time: 2011-02-10
* File Name: pchatbox.c
* Description:
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <time.h>
#include "user.h"
#include "pchatbox.h"
#include "ifreechat.h"
#include "emotion_box.h"
void on_send_message(GtkWidget *widget, pchatbox_t *chatbox);
pchatbox_t *new_pchatbox(ifreechat_t *ifc, user_t *user) {
pchatbox_t *pchatbox;
dlist_t *pchatbox_list;
char title[128];
GladeXML *xml;
GtkTextBuffer *display_buffer;
pchatbox = (pchatbox_t*)malloc(sizeof(pchatbox_t));
init_chatbox(ifc, pchatbox, PCHATBOX, (void*)user);
pthread_mutex_lock(&(ifc->pchatbox_lock));
dlist_add_tail(&(pchatbox->chatbox_node), &(ifc->pchatbox));
pthread_mutex_unlock(&(ifc->pchatbox_lock));
sprintf(title, "Chat with %s", user->nickname);
gtk_window_set_title((GtkWindow*)pchatbox->window, title);
gtk_image_set_from_file(pchatbox->avatar_image, user->avatar);
gtk_label_set_text(pchatbox->first_label, user->nickname);
gtk_label_set_text(pchatbox->second_label, ""/*user->signature*/);
chatbox_set_sendmsg_func(pchatbox, on_send_message);
show_chatbox(pchatbox);
return pchatbox;
}
void on_send_message(GtkWidget *widget, pchatbox_t *chatbox) {
pchatbox_t *pchatbox;
ifreechat_t *ifc;
user_t *user;
char buf[65535];
char *msg;
time_t pno;
GtkTextView *input_textview;
GtkTextView *output_textview;
GtkTextBuffer *input_buffer;
GtkTextBuffer *output_buffer;
GtkTextIter start;
GtkTextIter end;
GtkTextMark *mark;
GdkPixbuf *pixbuf;
pchatbox = (pchatbox_t*)(chatbox);
ifc = (ifreechat_t*)pchatbox->ifreechat;
user = (user_t*)pchatbox->data;
pno = time(NULL);
input_textview = pchatbox->input_textview;
output_textview = pchatbox->display_textview;
input_buffer = gtk_text_view_get_buffer(input_textview);
output_buffer = gtk_text_view_get_buffer(output_textview);
gtk_text_buffer_get_start_iter(input_buffer, &start);
gtk_text_buffer_get_end_iter(input_buffer, &end);
if (gtk_text_iter_equal(&start, &end)) {
printf("Please enter message!!!\n");
return;
}
msg = gtk_text_buffer_get_text(input_buffer, &start, &end, TRUE);
gtk_text_buffer_delete(input_buffer, &start, &end);
sprintf(buf, "%s(%s):\n", ifc->nickname, my_ctime(&pno));
gtk_text_buffer_get_end_iter(output_buffer, &end);
gtk_text_buffer_insert_with_tags_by_name(output_buffer, &end,
buf, -1, "blue_fg", "lmarg", "title_font", NULL);
insert_msg_with_emotion_to_textview(output_textview, msg);
gtk_text_buffer_get_end_iter(output_buffer, &end);
mark = gtk_text_buffer_create_mark(output_buffer, NULL, &end, FALSE);
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(output_textview), mark,
0.0, TRUE, 0.0, 0.0);
gtk_text_buffer_delete_mark(output_buffer, mark);
// printf("msg: [%s]\n", msg);
sprintf(buf, "1_lbt4_%d#128#%s#0#0#0:%lu:%s:%s:%u:%s",
ifc->avatar_id,
ifc->macaddr,
pno,
ifc->username,
ifc->hostname,
0x120,
msg);
// printf("buf: %s\n", buf);
udp_send_msg((ifreechat_t*)chatbox->ifreechat, user->ipaddr, ifc->port, buf, strlen(buf));
}
| [
"[email protected]"
] | |
1419a45e0ced8c1477217142c20cdc7b1b5f5cd7 | 6a86d740f9b17721677b9ee193f2009a2333a3be | /lib/tests/support/research/comboPartResearchItemA.c | b13b0d4d241825f266c52a640845c46cbd33dce0 | [] | no_license | realms-mud/core-lib | b2a0cc727fd0b1eb47fa244d6fb05de322abe88f | 293089e8900b5a0d46f64619f89c78deea7477e5 | refs/heads/master | 2023-07-06T07:04:25.390271 | 2023-06-27T21:20:29 | 2023-06-27T21:20:29 | 113,914,065 | 69 | 20 | null | null | null | null | UTF-8 | C | false | false | 1,450 | c | //*****************************************************************************
// Copyright (c) 2023 - Allen Cummings, RealmsMUD, All rights reserved. See
// the accompanying LICENSE file for details.
//*****************************************************************************
inherit "/lib/modules/research/instantaneousActiveResearchItem.c";
/////////////////////////////////////////////////////////////////////////////
protected void Setup()
{
addSpecification("name", "blarg");
addSpecification("source", "blarg");
addSpecification("description", "This is limited active research");
addSpecification("usage summary", "This blargifies stuff.");
addSpecification("scope", "targeted");
addSpecification("research type", "granted");
addSpecification("research cost", 1);
addSpecification("spell point cost", 10);
addSpecification("hit point cost", 10);
addSpecification("damage hit points", ({ ([
"probability": 100,
"base damage": 25,
"range": 0
]) }));
addSpecification("damage type", "physical");
addSpecification("cooldown", 4);
addSpecification("event handler", "usedResearchEvent");
addSpecification("command template", "blarg [at ##Target##]");
addSpecification("use ability message", "##InitiatorName## ##Infinitive::throw## a turnip at ##TargetName##.");
addSpecification("use combination message", "blarg swimmingly");
}
| [
"[email protected]"
] | |
63d7dc43cacdc3427b1ff218841e6d9924308159 | 510ce89e9cb90f7b56b0a539d647c710a220f8d8 | /stm32_chassis_fw/Src/gpio.c | aab6523b71b7927012f47f243ff7ec80b703a766 | [] | no_license | OuyangJunyuan/chassis_2020_tr-Firmware | b7aa24935d549ea5892f80c6bcc119ad8ac3768e | 52a23c5c96a38cb90513c7826006ee702593f40e | refs/heads/master | 2021-02-17T21:54:15.106193 | 2020-03-05T11:19:03 | 2020-03-05T11:19:03 | 245,129,748 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,734 | c | /**
******************************************************************************
* File Name : gpio.c
* Description : This file provides code for the configuration
* of all used GPIO pins.
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "gpio.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/*----------------------------------------------------------------------------*/
/* Configure GPIO */
/*----------------------------------------------------------------------------*/
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
*/
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11|GPIO_PIN_12, GPIO_PIN_RESET);
/*Configure GPIO pin : PC13 */
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PB10 */
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : PB11 PB12 */
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
64dec1834a47ee6befb5dfaee7edd6226ebf37c2 | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/printscan/print/drivers/usermode/inc/appcompat.h | aa7c7e7171cc652e4d8bc454ee140f84598ae67c | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C | false | false | 637 | h | /*++
Copyright (c) 2000, Microsoft Corporation
Module Name:
appcompat.h
Abstract:
Definitions and prototypes for the app compat functions that are not
published in the DDK but that we need to build the printer drivers off it.
Normally they reside in winuserp.h/user32p.lib.
--*/
#ifndef _WINUSERP_
#ifndef _PRINTAPPCOMPAT_
#define _PRINTAPPCOMPAT_
#ifdef BUILD_FROM_DDK
#define GACF2_NOCUSTOMPAPERSIZES 0x00001000 // PostScript driver bit for Harvard Graphics
#define VER40 0x0400
#else
#include <winuserp.h>
#endif
DWORD GetAppCompatFlags2(WORD);
#endif
#endif
| [
"[email protected]"
] | |
a7a3b5399110f7ca5c8e5b2bc5dbea54a61809c1 | bc949cbcded25afc8511d07c8d86509d5746b2a8 | /dataset/18303.c | cf6863c2fab3b15b2c671c52c2e09befd8cd8737 | [] | no_license | hqjenny/CSmith_random_pgm | 52aa1face59749a9d0656fc4088f6f921aac2dab | 0ebf41b85201cbe791a13304cdb45e22504f0ce7 | refs/heads/master | 2023-08-17T23:28:24.519500 | 2021-09-15T19:55:23 | 2021-09-15T19:55:23 | 406,904,982 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,022 | c | /*
* This is a RANDOMLY GENERATED PROGRAM.
*
* Generator: csmith 2.2.0
* Git version: dcef523
* Options: --no-structs --no-pointers --no-math64 --max-funcs 4 --no-unions --output 18303.c
* Seed: 249396358
*/
#include "csmith.h"
static long __undefined;
/* --- Struct/Union Declarations --- */
/* --- GLOBAL VARIABLES --- */
static volatile int8_t g_4 = 0x75L;/* VOLATILE GLOBAL g_4 */
static int32_t g_9 = 0x68819570L;
static uint32_t g_18 = 0xFBDE283BL;
/* --- FORWARD DECLARATIONS --- */
static const uint8_t func_1(void);
/* --- FUNCTIONS --- */
/* ------------------------------------------ */
/*
* reads : g_4 g_9 g_18
* writes: g_18
*/
static const uint8_t func_1(void)
{ /* block id: 0 */
int16_t l_5 = 0xA9D1L;
int32_t l_19 = 4L;
l_19 |= (safe_sub_func_int16_t_s_s(0xC789L, (((g_4 ^ l_5) ^ (safe_unary_minus_func_int32_t_s((((safe_add_func_int32_t_s_s(8L, (g_9 > ((((safe_mod_func_uint8_t_u_u(g_9, 254UL)) <= (((((safe_add_func_uint16_t_u_u(g_9, ((safe_sub_func_uint8_t_u_u((g_18 = (((safe_rshift_func_int8_t_s_u(l_5, l_5)) | l_5) , 0x78L)), g_9)) && g_9))) & 0x456574B6L) >= g_9) ^ g_9) , g_18)) & l_5) == l_5)))) , l_5) != l_5)))) || 0x80BFE737L)));
return g_9;
}
/* ---------------------------------------- */
int main (int argc, char* argv[])
{
int print_hash_value = 0;
platform_main_begin();
crc32_gentab();
func_1();
transparent_crc(g_4, "g_4", print_hash_value);
transparent_crc(g_9, "g_9", print_hash_value);
transparent_crc(g_18, "g_18", print_hash_value);
int checksum = platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return checksum;
}
/************************ statistics *************************
XXX max struct depth: 0
breakdown:
depth: 0, occurrence: 5
XXX total union variables: 0
XXX non-zero bitfields defined in structs: 0
XXX zero bitfields defined in structs: 0
XXX const bitfields defined in structs: 0
XXX volatile bitfields defined in structs: 0
XXX structs with bitfields in the program: 0
breakdown:
XXX full-bitfields structs in the program: 0
breakdown:
XXX times a bitfields struct's address is taken: 0
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 0
XXX times a single bitfield on LHS: 0
XXX times a single bitfield on RHS: 0
XXX max expression depth: 24
breakdown:
depth: 1, occurrence: 2
depth: 24, occurrence: 1
XXX total number of pointers: 0
XXX times a non-volatile is read: 17
XXX times a non-volatile is write: 2
XXX times a volatile is read: 1
XXX times read thru a pointer: 0
XXX times a volatile is write: 0
XXX times written thru a pointer: 0
XXX times a volatile is available for access: 1
XXX percentage of non-volatile access: 95
XXX forward jumps: 0
XXX backward jumps: 0
XXX stmts: 2
XXX max block depth: 0
breakdown:
depth: 0, occurrence: 2
XXX percentage a fresh-made variable is used: 25
XXX percentage an existing variable is used: 75
********************* end of statistics **********************/
| [
"[email protected]"
] | |
4d26bcebc6c3a007238094d5f8e3dbe1d97ed50a | 8e57fb3326191826b8fa26e5a1b9843f648f49e3 | /push_swap./libft/ft_isascii.c | 39d06bd10daf8497f212a1e20d6f26ef368cec17 | [] | no_license | bphafoli/push_swap | 919ef988bcd49d4102e508d7506ab6643842d51e | 501cb6e21884c641d0021ded89a91de8191140c6 | refs/heads/master | 2020-08-12T19:32:41.555098 | 2019-10-13T14:14:35 | 2019-10-13T14:14:35 | 214,829,838 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,004 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isascii.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bphafoli <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/21 09:27:40 by bphafoli #+# #+# */
/* Updated: 2019/09/23 15:25:32 by bphafoli ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_isascii(int c)
{
if (c >= 0 && c <= 127)
return (TRUE);
else
return (FALSE);
}
| [
"[email protected]"
] | |
6438b0773882b41e168678dd400a79a749fdb349 | 985beab07c05b613aa8ac3edbcd0987f89344eaf | /fy4/d/fy/npc/an_huoji.c | 5357d485a69368e7fe60ce70a5288062eb834920 | [] | no_license | Yeeler/fy2005 | f6b308592c5037f5b5d40c18b748259447b6abe1 | cd244d4fed63ba57cd72a4e7119353a29df1f3c0 | refs/heads/master | 2021-01-06T20:37:29.371119 | 2017-08-08T07:54:16 | 2017-08-08T07:54:16 | 99,530,241 | 2 | 1 | null | null | null | null | GB18030 | C | false | false | 904 | c | #include <ansi.h>
inherit NPC;
void create()
{
set_name("安生店伙计", ({"huo ji"}) );
set("gender", "男性" );
set("long", "安生堂新来的活计,忙时帮着老板招呼客人,没事就拿着把刨斧修补棺木。\n");
set("attitude", "friendly");
set("age", 25);
set("cor", 25);
set("combat_exp", 380000);
set_skill("axe",100);
set_skill("unarmed", 100);
set_skill("parry", 100);
set_skill("dodge", 100);
set_skill("move", 100);
set_skill("wuche-axe",60);
set_skill("puti-steps",100);
set_skill("dabei-strike",100);
map_skill("unarmed","dabei-strike");
map_skill("dodge","puti-steps");
map_skill("axe","wuche-axe");
map_skill("parry","wuche-axe");
setup();
carry_object(__DIR__"obj/heicloth")->wear();
carry_object(__DIR__"obj/paoaxe")->wield();
}
| [
"[email protected]"
] | |
4c9c000cad7bbb49dc219a501bac2e65c088bcaa | b2d48aac47dc3a3050f9cb562808f0e6f19a36e4 | /disksim/include/disksim/modules/disksim_disk_param.h | b59192c02f100c7855933e71246ae84d5ca72997 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | bhagavansprasad/students | 7f7df2f4c2350025d58406794a7d94d9c8a9d7be | 2822fb81cfb6714d48dea1e4957d6011ffa6198b | refs/heads/master | 2023-08-04T04:44:11.346963 | 2023-07-24T06:09:00 | 2023-07-24T06:09:00 | 193,177,404 | 0 | 0 | null | 2022-11-30T23:33:00 | 2019-06-22T01:21:59 | C | UTF-8 | C | false | false | 6,207 | h |
#ifndef _DISKSIM_DISK_PARAM_H
#define _DISKSIM_DISK_PARAM_H
#include <libparam/libparam.h>
#ifdef __cplusplus
extern"C"{
#endif
struct dm_disk_if;
/* prototype for disksim_disk param loader function */
struct disk *disksim_disk_loadparams(struct lp_block *b, int *num);
typedef enum {
DISKSIM_DISK_MODEL,
DISKSIM_DISK_SCHEDULER,
DISKSIM_DISK_MAX_QUEUE_LENGTH,
DISKSIM_DISK_BULK_SECTOR_TRANSFER_TIME,
DISKSIM_DISK_SEGMENT_SIZE_,
DISKSIM_DISK_NUMBER_OF_BUFFER_SEGMENTS,
DISKSIM_DISK_PRINT_STATS,
DISKSIM_DISK_PER_REQUEST_OVERHEAD_TIME,
DISKSIM_DISK_TIME_SCALE_FOR_OVERHEADS,
DISKSIM_DISK_HOLD_BUS_ENTIRE_READ_XFER,
DISKSIM_DISK_HOLD_BUS_ENTIRE_WRITE_XFER,
DISKSIM_DISK_ALLOW_ALMOST_READ_HITS,
DISKSIM_DISK_ALLOW_SNEAKY_FULL_READ_HITS,
DISKSIM_DISK_ALLOW_SNEAKY_PARTIAL_READ_HITS,
DISKSIM_DISK_ALLOW_SNEAKY_INTERMEDIATE_READ_HITS,
DISKSIM_DISK_ALLOW_READ_HITS_ON_WRITE_DATA,
DISKSIM_DISK_ALLOW_WRITE_PREBUFFERING,
DISKSIM_DISK_PRESEEKING_LEVEL,
DISKSIM_DISK_NEVER_DISCONNECT,
DISKSIM_DISK_AVG_SECTORS_PER_CYLINDER,
DISKSIM_DISK_MAXIMUM_NUMBER_OF_WRITE_SEGMENTS,
DISKSIM_DISK_USE_SEPARATE_WRITE_SEGMENT,
DISKSIM_DISK_LOW__WATER_MARK,
DISKSIM_DISK_HIGH__WATER_MARK,
DISKSIM_DISK_SET_WATERMARK_BY_REQSIZE,
DISKSIM_DISK_CALC_SECTOR_BY_SECTOR,
DISKSIM_DISK_ENABLE_CACHING_IN_BUFFER,
DISKSIM_DISK_BUFFER_CONTINUOUS_READ,
DISKSIM_DISK_MINIMUM_READ_AHEAD_,
DISKSIM_DISK_MAXIMUM_READ_AHEAD_,
DISKSIM_DISK_READ_AHEAD_OVER_REQUESTED,
DISKSIM_DISK_READ_AHEAD_ON_IDLE_HIT,
DISKSIM_DISK_READ_ANY_FREE_BLOCKS,
DISKSIM_DISK_FAST_WRITE_LEVEL,
DISKSIM_DISK_COMBINE_SEQ_WRITES,
DISKSIM_DISK_STOP_PREFETCH_IN_SECTOR,
DISKSIM_DISK_DISCONNECT_WRITE_IF_SEEK,
DISKSIM_DISK_WRITE_HIT_STOP_PREFETCH,
DISKSIM_DISK_READ_DIRECTLY_TO_BUFFER,
DISKSIM_DISK_IMMED_TRANSFER_PARTIAL_HIT,
DISKSIM_DISK_READ_HIT_OVER_AFTER_READ,
DISKSIM_DISK_READ_HIT_OVER_AFTER_WRITE,
DISKSIM_DISK_READ_MISS_OVER_AFTER_READ,
DISKSIM_DISK_READ_MISS_OVER_AFTER_WRITE,
DISKSIM_DISK_WRITE_HIT_OVER_AFTER_READ,
DISKSIM_DISK_WRITE_HIT_OVER_AFTER_WRITE,
DISKSIM_DISK_WRITE_MISS_OVER_AFTER_READ,
DISKSIM_DISK_WRITE_MISS_OVER_AFTER_WRITE,
DISKSIM_DISK_READ_COMPLETION_OVERHEAD,
DISKSIM_DISK_WRITE_COMPLETION_OVERHEAD,
DISKSIM_DISK_DATA_PREPARATION_OVERHEAD,
DISKSIM_DISK_FIRST_RESELECT_OVERHEAD,
DISKSIM_DISK_OTHER_RESELECT_OVERHEAD,
DISKSIM_DISK_READ_DISCONNECT_AFTERREAD,
DISKSIM_DISK_READ_DISCONNECT_AFTERWRITE,
DISKSIM_DISK_WRITE_DISCONNECT_OVERHEAD,
DISKSIM_DISK_EXTRA_WRITE_DISCONNECT,
DISKSIM_DISK_EXTRADISC_COMMAND_OVERHEAD,
DISKSIM_DISK_EXTRADISC_DISCONNECT_OVERHEAD,
DISKSIM_DISK_EXTRADISC_INTER_DISCONNECT_DELAY,
DISKSIM_DISK_EXTRADISC_2ND_DISCONNECT_OVERHEAD,
DISKSIM_DISK_EXTRADISC_SEEK_DELTA,
DISKSIM_DISK_MINIMUM_SEEK_DELAY,
DISKSIM_DISK_IMMEDIATE_BUFFER_READ,
DISKSIM_DISK_IMMEDIATE_BUFFER_WRITE
} disksim_disk_param_t;
#define DISKSIM_DISK_MAX_PARAM DISKSIM_DISK_IMMEDIATE_BUFFER_WRITE
extern void * DISKSIM_DISK_loaders[];
extern lp_paramdep_t DISKSIM_DISK_deps[];
static struct lp_varspec disksim_disk_params [] = {
{"Model", BLOCK, 1 },
{"Scheduler", BLOCK, 1 },
{"Max queue length", I, 1 },
{"Bulk sector transfer time", D, 1 },
{"Segment size (in blks)", I, 1 },
{"Number of buffer segments", I, 1 },
{"Print stats", I, 1 },
{"Per-request overhead time", D, 1 },
{"Time scale for overheads", D, 1 },
{"Hold bus entire read xfer", I, 1 },
{"Hold bus entire write xfer", I, 1 },
{"Allow almost read hits", I, 1 },
{"Allow sneaky full read hits", I, 1 },
{"Allow sneaky partial read hits", I, 1 },
{"Allow sneaky intermediate read hits", I, 1 },
{"Allow read hits on write data", I, 1 },
{"Allow write prebuffering", I, 1 },
{"Preseeking level", I, 1 },
{"Never disconnect", I, 1 },
{"Avg sectors per cylinder", I, 1 },
{"Maximum number of write segments", I, 1 },
{"Use separate write segment", I, 1 },
{"Low (write) water mark", D, 1 },
{"High (read) water mark", D, 1 },
{"Set watermark by reqsize", I, 1 },
{"Calc sector by sector", I, 1 },
{"Enable caching in buffer", I, 1 },
{"Buffer continuous read", I, 1 },
{"Minimum read-ahead (blks)", I, 1 },
{"Maximum read-ahead (blks)", I, 1 },
{"Read-ahead over requested", I, 1 },
{"Read-ahead on idle hit", I, 1 },
{"Read any free blocks", I, 1 },
{"Fast write level", I, 1 },
{"Combine seq writes", I, 1 },
{"Stop prefetch in sector", I, 1 },
{"Disconnect write if seek", I, 1 },
{"Write hit stop prefetch", I, 1 },
{"Read directly to buffer", I, 1 },
{"Immed transfer partial hit", I, 1 },
{"Read hit over. after read", D, 1 },
{"Read hit over. after write", D, 1 },
{"Read miss over. after read", D, 1 },
{"Read miss over. after write", D, 1 },
{"Write hit over. after read", D, 1 },
{"Write hit over. after write", D, 1 },
{"Write miss over. after read", D, 1 },
{"Write miss over. after write", D, 1 },
{"Read completion overhead", D, 1 },
{"Write completion overhead", D, 1 },
{"Data preparation overhead", D, 1 },
{"First reselect overhead", D, 1 },
{"Other reselect overhead", D, 1 },
{"Read disconnect afterread", D, 1 },
{"Read disconnect afterwrite", D, 1 },
{"Write disconnect overhead", D, 1 },
{"Extra write disconnect", I, 1 },
{"Extradisc command overhead", D, 1 },
{"Extradisc disconnect overhead", D, 1 },
{"Extradisc inter-disconnect delay", D, 1 },
{"Extradisc 2nd disconnect overhead", D, 1 },
{"Extradisc seek delta", D, 1 },
{"Minimum seek delay", D, 1 },
{"Immediate buffer read", I, 1 },
{"Immediate buffer write", I, 1 },
{0,0,0}
};
#define DISKSIM_DISK_MAX 65
static struct lp_mod disksim_disk_mod = { "disksim_disk", disksim_disk_params, DISKSIM_DISK_MAX, (lp_modloader_t)disksim_disk_loadparams, 0, 0, DISKSIM_DISK_loaders, DISKSIM_DISK_deps };
#ifdef __cplusplus
}
#endif
#endif // _DISKSIM_DISK_PARAM_H
| [
"[email protected]"
] | |
312e7d98ef8c5cfb9868382e515e348983b8679a | 33f4cf37d65745a05df261bf55346fd4eb69d0cb | /test2/extension_lib.h | b92cf56b47b73300ae70641b5335a529f49ac0ef | [
"MIT"
] | permissive | library1010/c-advance | 4886660a0e9672b8256bcf5229034871c4d98cd6 | 374d216169e3fcd3c9ea750c8f7b5162d7eea0b6 | refs/heads/master | 2020-12-25T05:07:44.333653 | 2016-05-20T15:04:51 | 2016-05-20T15:04:51 | 59,302,512 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 977 | h | #ifndef __EXTENSION_LIB_H__
#define __EXTENSION_LIB_H__
#include <time.h>
#include <ctype.h>
#include "my_input_lib.h"
#include "file_handle.h"
#include "fs_lib.h"
#include "shortest_path.h"
#define MAXSIZE 100
#define SIZE 100
#define TEMPSIZE 50
int solve(FILE *f);
void readData(FILE *f, Graph graph);
void printArray(int *array, int amount);
void loadToGraph(Graph graph, int *array, int amount);
void setUp(Graph graph, int *array, int amount, int iCurrent, int jCurrent);
void setDown(Graph graph, int *array, int amount, int iCurrent, int jCurrent);
void setLeft(Graph graph, int *array, int amount, int iCurrent, int jCurrent);
void setRight(Graph graph, int *array, int amount, int iCurrent, int jCurrent);
int getKeyAtPosition(Graph graph, int i, int j);
void option1(FILE *f, Graph graph);
void option2(Graph graph);
void option3(Graph graph);
void option4(Graph graph);
void option5(Graph graph);
void option6(Graph graph);
void option7(Graph graph);
#endif | [
"[email protected]"
] | |
2049915300195da3953ec3b85cf88c5fb1a80d0f | efddc7f30731f95c32b371f70acce78b7faee4bb | /src/liboqs/src/kem/ntruprime/pqclean_sntrup857_avx2/crypto_encode_857xint16.c | 9ae268149468567beb2c150166f5cfd6c237b4b8 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | Qubit-coin/qubit-coin | 3dc9f52639ffa92531c8cf4d1f1a7da30bc29d38 | 050c947065e3911c16c94c767d4fc8aae1d0edd4 | refs/heads/master | 2023-03-24T04:58:17.623399 | 2021-03-19T21:00:03 | 2021-03-19T21:00:03 | 310,509,431 | 0 | 0 | MIT | 2021-03-05T02:12:22 | 2020-11-06T06:18:00 | C | UTF-8 | C | false | false | 307 | c | #include "crypto_encode_857xint16.h"
void PQCLEAN_SNTRUP857_AVX2_crypto_encode_857xint16(unsigned char *s, const void *v) {
const uint16_t *x = v;
int i;
for (i = 0; i < 857; ++i) {
uint16_t u = *x++;
*s++ = (unsigned char) u;
*s++ = (unsigned char) (u >> 8);
}
}
| [
"[email protected]"
] | |
de1fbec52eb70549d47da6fe5af27c0197271961 | d761fd11ddd77c891969e35f2e743b253ee4d09c | /bucket_D7/wayland/patches/patch-tests_test-runner.c | be73c177018d531401ef5386f3223fc73e24f587 | [
"ISC"
] | permissive | ftigeot/ravensource | ccfd35bee4820ddb4653d653548f8ceb296acf90 | d55fddec4c96f20c09e2351d1fb72ce32bf53604 | refs/heads/master | 2020-04-22T12:46:17.294212 | 2019-02-12T19:44:14 | 2019-02-12T20:12:50 | 144,263,007 | 0 | 0 | null | 2018-08-10T08:59:38 | 2018-08-10T08:59:37 | null | UTF-8 | C | false | false | 2,535 | c | --- tests/test-runner.c.orig 2018-08-24 18:04:36 UTC
+++ tests/test-runner.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
@@ -37,7 +38,9 @@
#include <errno.h>
#include <limits.h>
#include <sys/ptrace.h>
+#ifndef __DragonFly__
#include <sys/prctl.h>
+#endif
#ifndef PR_SET_PTRACER
# define PR_SET_PTRACER 0x59616d61
#endif
@@ -308,17 +311,22 @@ is_debugger_attached(void)
close(pipefd[0]);
if (buf == '-')
_exit(1);
+#ifndef __DragonFly__
if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) != 0)
_exit(1);
+#endif
if (!waitpid(-1, NULL, 0))
_exit(1);
+#ifndef __DragonFly__
ptrace(PTRACE_CONT, NULL, NULL);
ptrace(PTRACE_DETACH, ppid, NULL, NULL);
+#endif
_exit(0);
} else {
close(pipefd[0]);
/* Enable child to ptrace the parent process */
+#ifndef __DragonFly__
rc = prctl(PR_SET_PTRACER, pid);
if (rc != 0 && errno != EINVAL) {
/* An error prevents us from telling if a debugger is attached.
@@ -332,6 +340,7 @@ is_debugger_attached(void)
/* Signal to client that parent is ready by passing '+' */
write(pipefd[1], "+", 1);
}
+#endif
close(pipefd[1]);
waitpid(pid, &status, 0);
@@ -346,7 +355,11 @@ int main(int argc, char *argv[])
const struct test *t;
pid_t pid;
int total, pass;
+#ifdef __DragonFly__
+ int status;
+#else
siginfo_t info;
+#endif
/* Load system malloc, free, and realloc */
sys_calloc = dlsym(RTLD_NEXT, "calloc");
@@ -395,6 +408,12 @@ int main(int argc, char *argv[])
if (pid == 0)
run_test(t); /* never returns */
+#ifdef __DragonFly__
+ if (wait(&status)) {
+ fprintf(stderr, "waitid failed: %m\n");
+ abort();
+ }
+#else
if (waitid(P_PID, pid, &info, WEXITED)) {
stderr_set_color(RED);
fprintf(stderr, "waitid failed: %m\n");
@@ -402,7 +421,20 @@ int main(int argc, char *argv[])
abort();
}
+#endif
+ fprintf(stderr, "test \"%s\":\t", t->name);
+#ifdef __DragonFly__
+ if (WIFEXITED(status)) {
+ fprintf(stderr, "exit status %d", WEXITSTATUS(status));
+ if (WEXITSTATUS(status) == EXIT_SUCCESS)
+ success = 1;
+ break;
+ } else if (WIFSIGNALED(status) || WCOREDUMP(status)) {
+ fprintf(stderr, "signal %d", WTERMSIG(status));
+ break;
+ }
+#else
switch (info.si_code) {
case CLD_EXITED:
if (info.si_status == EXIT_SUCCESS)
@@ -426,6 +458,7 @@ int main(int argc, char *argv[])
break;
}
+#endif
if (success) {
pass++;
| [
"[email protected]"
] | |
1d8e06f838315dfd02493b19c82537de355a35cd | 83214753e9183327e98af0e6768e9be5385e5282 | /d/dingxiang/npc/kehan.c | 758d771bc3ef27bfb63b2e6c9523209fe2e77cbf | [] | 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 | WINDOWS-1252 | C | false | false | 672 | c |
inherit NPC;
#include <ansi.h>
int do_action1();
void create()
{
set_name("ò¡Àû´óº¹",({ "da han","da","han" }) );
set("gender", "ÄÐÐÔ" );
set("age", 50);
set("combat_exp",6000000);
set("str", 25);
set("per", 22);
set_skill("dodge",300);
set_skill("parry",300);
set_skill("force",300);
set_skill("whip",300);
set_skill("literate",300);
set("max_jing",30000);
set("max_qi",30000);
set("max_sen",30000);
set("neili",30000);
set("max_neili",30000);
create_family("Í»ØÊ",2,"´óº¹");
setup();
carry_object(__DIR__"obj/cloth")->wear();
carry_object(__DIR__"obj/whip")->wield();
}
| [
"[email protected]"
] | |
485f67e5fe2c5f567a74769fdf9afdb038b73050 | 82dc3cc4c97c05e384812cc9aa07938e2dbfe24b | /spooles/src/FrontMtx/FrontMtx.postponed.c | 6dd0efb892dce3507a7ce883ad0835918aea3b7f | [] | no_license | samanseifi/Tahoe | ab40da0f8d952491943924034fa73ee5ecb2fecd | 542de50ba43645f19ce4b106ac8118c4333a3f25 | refs/heads/master | 2020-04-05T20:24:36.487197 | 2017-12-02T17:09:11 | 2017-12-02T17:24:23 | 38,074,546 | 3 | 0 | null | null | null | null | UTF-8 | C | false | false | 6,495 | c | /* postponed.c */
#include "FrontMtx.h"
#define MYDEBUG 0
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------
purpose -- to assemble any postponed data into frontJ
frontJ -- pointer to Chv objec that contains current front
chvlist -- pointer to a ChvList object that handles the
lists of postponed Chv objects
chvmanager -- pointer to a ChvManager object for the list
of free Chv objects
pndelay -- pointer to address to contain the # of delayed rows
and columns that were assembled into the front
return value -- pointer to Chv object that contains the new front
created -- 98may04, cca
------------------------------------------------------------------
*/
Chv *
FrontMtx_assemblePostponedData (
FrontMtx *frontmtx,
Chv *frontJ,
ChvList *chvlist,
ChvManager *chvmanager,
int *pndelay
) {
Chv *child, *child2, *firstchild, *newfrontJ, *nextchild, *prev ;
int nbytes, nDnew ;
if ( (firstchild = ChvList_getList(chvlist, frontJ->id)) == NULL ) {
/*
-------------------------------------
quick return, no children to assemble
-------------------------------------
*/
*pndelay = 0 ;
return(frontJ) ;
}
/*
-------------------------------------------------------
order the children in ascending order of their front id
this is done to ensure that the serial, multithreaded
and MPI codes all assemble the same frontal matrix.
-------------------------------------------------------
*/
#if MYDEBUG > 0
fprintf(stdout, "\n postponed children of %d :", frontJ->id) ;
for ( child = firstchild ; child != NULL ; child = child->next ) {
fprintf(stdout, " %d", child->id) ;
}
fflush(stdout) ;
#endif
for ( child = firstchild, firstchild = NULL ;
child != NULL ;
child = nextchild ) {
nextchild = child->next ;
for ( child2 = firstchild, prev = NULL ;
child2 != NULL ;
child2 = child2->next ) {
if ( child2->id > child->id ) {
break ;
}
prev = child2 ;
}
if ( prev == NULL ) {
firstchild = child ;
} else {
prev->next = child ;
}
child->next = child2 ;
}
#if MYDEBUG > 0
fprintf(stdout, "\n front %d, postponed children reordered :",
frontJ->id) ;
for ( child = firstchild ; child != NULL ; child = child->next ) {
fprintf(stdout, " %d", child->id) ;
}
fflush(stdout) ;
#endif
/*
--------------------------
compute the new dimensions
--------------------------
*/
nDnew = frontJ->nD ;
for ( child = firstchild ; child != NULL ; child = child->next ) {
nDnew += child->nD ;
}
/*
------------------------
get a new chevron object
------------------------
*/
nbytes = Chv_nbytesNeeded(nDnew, frontJ->nL, frontJ->nU,
frontJ->type, frontJ->symflag) ;
newfrontJ = ChvManager_newObjectOfSizeNbytes(chvmanager, nbytes) ;
Chv_init(newfrontJ, frontJ->id, nDnew, frontJ->nL, frontJ->nU,
frontJ->type, frontJ->symflag) ;
/*
----------------------------------------------------------
pivoting has been enabled, assemble any postponed chevrons
----------------------------------------------------------
*/
*pndelay = Chv_assemblePostponedData(newfrontJ, frontJ, firstchild) ;
/*
--------------------------------------------------
now put the postponed chevrons onto the free list.
--------------------------------------------------
*/
ChvManager_releaseListOfObjects(chvmanager, firstchild) ;
/*
-------------------------------------
set the delay to zero if a root front
-------------------------------------
*/
if ( frontJ->nU == 0 ) {
*pndelay = 0 ;
}
return(newfrontJ) ; }
/*--------------------------------------------------------------------*/
/*
---------------------------------------------------------
purpose -- extract and store the postponed data
frontJ -- pointer to present front object
npost -- # of postponed rows and columns in frontJ
K -- parent of J
chvlist -- pointer to a ChvList object that handles the
lists of postponed Chv objects
a singly linked list to assemble
chvmanager -- pointer to a ChvManager object for the list
of free Chv objects
created -- 98may04, cca
---------------------------------------------------------
*/
void
FrontMtx_storePostponedData (
FrontMtx *frontmtx,
Chv *frontJ,
int npost,
int K,
ChvList *chvlist,
ChvManager *chvmanager
) {
Chv *chv ;
int nbytes, nD, nent, nind, nL, nU ;
if ( npost <= 0 && chvlist != NULL ) {
if ( K == -1 ) {
ChvList_addObjectToList(chvlist, NULL, frontmtx->nfront) ;
} else {
ChvList_addObjectToList(chvlist, NULL, K) ;
}
return ;
}
/*
--------------------------------------
find the number of indices and entries
necessary to store the delayed data
--------------------------------------
*/
Chv_dimensions(frontJ, &nD, &nL, &nU) ;
#if MYDEBUG > 0
fprintf(stdout, "\n\n front %d: npost = %d, nD = %d, nL = %d, nU = %d",
frontJ->id, npost, nD, nL, nU) ;
fflush(stdout) ;
#endif
if ( CHV_IS_SYMMETRIC(frontJ) || CHV_IS_HERMITIAN(frontJ) ) {
nind = npost + nU ;
nent = (npost*(npost+1))/2 + npost*nU ;
} else if ( CHV_IS_NONSYMMETRIC(frontJ) ) {
nind = 2*(npost + nU) ;
nent = npost*(npost + 2*nU) ;
}
/*
------------------------------------
get a Chv object from the free list
------------------------------------
*/
nbytes = Chv_nbytesNeeded(npost, nL, nU, frontJ->type, frontJ->symflag);
chv = ChvManager_newObjectOfSizeNbytes(chvmanager, nbytes) ;
Chv_init(chv, frontJ->id, npost, nL, nU, frontJ->type, frontJ->symflag);
/*
----------------------
store the delayed data
----------------------
*/
Chv_copyTrailingPortion(chv, frontJ, nD - npost) ;
frontJ->nD -= npost ;
frontJ->nL += npost ;
frontJ->nU += npost ;
#if MYDEBUG > 0
fprintf(stdout, "\n\n postponed chevron %p", chv) ;
Chv_writeForHumanEye(chv, stdout) ;
fflush(stdout) ;
#endif
/*
------------------------------
link the postponed Chv object
------------------------------
*/
if ( K == -1 ) {
ChvList_addObjectToList(chvlist, chv, frontmtx->nfront) ;
} else {
ChvList_addObjectToList(chvlist, chv, K) ;
}
return ; }
/*--------------------------------------------------------------------*/
| [
"saman@bu.(none)"
] | saman@bu.(none) |
d37ad609be6e4d813b32c49521d63ca09c4f272c | 9ff45f1dc6ba0ad9c204d487acac4dfd109bf450 | /test/mock.h | 7eef1f26ffaeecb4c47787710df3104e6750ffb1 | [] | no_license | zxzx9898/HomaModule_ori | e84b68cec827faafa2d1b2c0576a58eed4a87a9e | 741639d0029bdddf7ba2d99784df309173f675f4 | refs/heads/master | 2023-09-05T16:36:27.616784 | 2021-11-20T01:37:01 | 2021-11-20T01:37:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,640 | h | /* Copyright (c) 2019, Stanford University
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* Functions for mocking that are exported to test code. */
extern int cpu_number;
extern int mock_alloc_skb_errors;
extern int mock_copy_data_errors;
extern int mock_copy_to_user_errors;
extern int mock_cpu_idle;
extern cycles_t mock_cycles;
extern int mock_import_iovec_errors;
extern int mock_import_single_range_errors;
extern int mock_ip_queue_xmit_errors;
extern int mock_kmalloc_errors;
extern char mock_xmit_prios[];
extern int mock_log_rcu_sched;
extern int mock_max_grants;
extern int mock_mtu;
extern struct net_device
mock_net_device;
extern int mock_route_errors;
extern void (*mock_schedule_hook)(void);
extern int mock_spin_lock_held;
extern void (*mock_spin_lock_hook)(void);
extern struct task_struct
mock_task;
extern int mock_trylock_errors;
extern int mock_vmalloc_errors;
extern int mock_xmit_log_verbose;
extern int mock_check_error(int *errorMask);
extern void mock_clear_xmit_prios(void);
extern void mock_data_ready(struct sock *sk);
extern cycles_t mock_get_cycles(void);
extern unsigned int
mock_get_mtu(const struct dst_entry *dst);
extern void mock_rcu_read_lock(void);
extern void mock_rcu_read_unlock(void);
extern void mock_spin_lock(spinlock_t *lock);
extern void mock_spin_unlock(spinlock_t *lock);
extern int mock_skb_count(void);
extern struct sk_buff *
mock_skb_new(__be32 saddr, struct common_header *h,
int extra_bytes, int first_value);
extern void mock_sock_destroy(struct homa_sock *hsk,
struct homa_socktab *socktab);
extern void mock_sock_init(struct homa_sock *hsk, struct homa *homa,
int port);
extern void mock_teardown(void); | [
"[email protected]"
] | |
6b9bcd59428285c1081ec64c0165da227e82d096 | f8c0a188d1cf8ae5221c4cd11552c221a86e259a | /Software/AX3/omconvert/calc-svm.h | b14d70eb1bb1197090df82364ae15315b6ce4df2 | [
"BSD-2-Clause",
"CC-BY-3.0"
] | permissive | digitalinteraction/openmovement | 6310abf35b379655073485e84719cc2521733c0e | 9c2ee2eeb5eae457673e60699b2842c6df82abb1 | refs/heads/master | 2023-08-03T23:48:42.973605 | 2023-07-26T17:52:37 | 2023-07-26T17:52:37 | 27,082,024 | 135 | 86 | null | 2018-06-21T23:32:43 | 2014-11-24T15:38:43 | C | UTF-8 | C | false | false | 3,416 | h | /*
* Copyright (c) 2014, Newcastle University, UK.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY 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.
*/
// Open Movement SVM Processor
// Dan Jackson, 2014
#ifndef SVM_H
#define SVM_H
//#include <stdint.h>
#include <stdbool.h>
//#include <stdlib.h>
#include <stdio.h>
// SVM Mode
enum SVM_MODE {
SVMMO_ABS = 0, // 0: abs(SVM-1)
SVMMO_CLAMP = 1, // 1: max(SVM-1, 0)
SVMMO = 2, // 2: SVM-1
_SVMMO_RESERVED = 3, // 3: (reserved)
SVM_ABS = 4, // 4: abs(SVM) (VM input won't be below zero, but filtered output can be)
SVM_CLAMP = 5, // 5: max(SVM, 0) (VM input won't be below zero, but filtered output can be)
SVM = 6, // 6: SVM (VM input won't be below zero, but filtered output can be)
_SVM_RESERVED = 7, // 7: (reserved)
};
// SVM configuration
typedef struct
{
char headerCsv;
double sampleRate;
const char *filename;
char filter;
char mode;
char extended; // Extended reporting (range, std, etc)
double epoch;
double startTime;
} svm_configuration_t;
#include "butter.h"
// SVM status
typedef struct
{
svm_configuration_t *configuration;
// Standard SVM
FILE *file;
double epochStartTime; // Start time of current epoch
int sample; // Sample number
int intervalSample; // Valid samples within this interval
// Standard SVM Filter values
double B[BUTTERWORTH_MAX_COEFFICIENTS(BUTTERWORTH_MAX_ORDER)];
double A[BUTTERWORTH_MAX_COEFFICIENTS(BUTTERWORTH_MAX_ORDER)];
double z[BUTTERWORTH_MAX_COEFFICIENTS(BUTTERWORTH_MAX_ORDER)]; // Final/initial condition tracking
int numCoefficients;
// For average SVM
double sumSvm;
double sumTemperature;
// StdDev & range
double axisSum[3];
double axisSumSquared[3];
double axisMin[3];
double axisMax[3];
// Per-ecoch stats
int countInvalid;
int countClipped;
int countClippedInput;
int countClippedOutput;
int rawIndex;
int countRaw;
} svm_status_t;
// Load data
char SvmInit(svm_status_t *status, svm_configuration_t *configuration);
// Processes the specified value
bool SvmAddValue(svm_status_t *status, double *value, double temp, char validity, int rawIndex);
// Free data resources
int SvmClose(svm_status_t *status);
#endif
| [
"[email protected]"
] | |
66dc838303147e5209c256a169a34ad9b3a75977 | fa97fe28b488122edca6c9c3fcc42b363715d8df | /DevClub/BC-W2/14 upperCase.c | 7e1148b4d4bf8f3c9dbee5332bfbd3936cd69608 | [] | no_license | EvgorEvgor/Study | f1b74133eddce03648e32aafa9ff94ee91bce5dd | b295b9a138f706995328847b8291e5f18c0e5780 | refs/heads/master | 2021-01-10T17:15:00.030189 | 2015-10-03T22:04:59 | 2015-10-03T22:04:59 | 43,535,820 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 824 | c | // Задача upperCase
// Условие задачи
// В файле task.in дана последовательность символов.
// Перевести все буквы в верхний регистр и вывести результирующую последовательность
// в файл task.out
// Пример ввода
// abcd
// Пример вывода
// ABCD
// code works
#include <stdio.h>
int main() {
FILE *read = fopen("task.in", "r");
FILE *write = fopen("task.out", "w");
for ( char a; fscanf(read, "%c", &a) == 1; ) {
if ( a >= 'a' && a <= 'z' ) {
fprintf(write, "%c", a-32);
} else {
fprintf(write, "%c", a);
}
}
fprintf(write, "\n");
fclose(read);
fclose(write);
return 0;
}
| [
"[email protected]"
] | |
ca947512e00c8650236941667f1973cba7130274 | ace26cc33ebc9fa02199b0627699999adfba2164 | /kernel/linux-5.4.152/drivers/tty/ttynull.mod.c | ef4341d2c5570ef6a7779d95238f0219eb072839 | [] | no_license | YJbonobono/linux-design | 936d5b9880e2aac4d86c07c3ca6c260d90b3e135 | 1684b19645bcd523d51fe2d12805d0bbcdea6599 | refs/heads/main | 2023-08-07T21:55:30.484704 | 2021-10-12T17:01:04 | 2021-10-12T17:01:04 | 413,645,550 | 0 | 0 | null | 2021-10-05T02:34:49 | 2021-10-05T02:15:12 | Shell | UTF-8 | C | false | false | 1,263 | c | #include <linux/build-salt.h>
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
BUILD_SALT;
MODULE_INFO(vermagic, VERMAGIC_STRING);
MODULE_INFO(name, KBUILD_MODNAME);
__visible struct module __this_module
__section(.gnu.linkonce.this_module) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
MODULE_INFO(intree, "Y");
#ifdef CONFIG_RETPOLINE
MODULE_INFO(retpoline, "Y");
#endif
static const struct modversion_info ____versions[]
__used __section(__versions) = {
{ 0xf6b02092, "module_layout" },
{ 0x32f0ff4e, "tty_unregister_driver" },
{ 0x552748e0, "unregister_console" },
{ 0xdca121b6, "register_console" },
{ 0xf5dcbe39, "tty_port_destroy" },
{ 0xe1f109b, "put_tty_driver" },
{ 0x56f7cf2d, "tty_register_driver" },
{ 0xc7dccae3, "tty_port_link_device" },
{ 0x61991828, "tty_set_operations" },
{ 0x67b27ec1, "tty_std_termios" },
{ 0x521ce967, "tty_port_init" },
{ 0xc39ba767, "__tty_alloc_driver" },
{ 0xc9bede2e, "tty_port_open" },
{ 0xc24598ae, "tty_port_close" },
{ 0x509612e2, "tty_port_hangup" },
{ 0xbdfb6dbb, "__fentry__" },
};
MODULE_INFO(depends, "");
MODULE_INFO(srcversion, "F5B253AB01C338BDF703B18");
| [
"[email protected]"
] | |
939863a44182dc91c9291c8988393f32946a1745 | 4871b520a2514a93727a73e01eb5792ae18ec711 | /get_next_line.h | 8ef7f0c99465cf83f91bacfe697afcdffff0e910 | [] | no_license | RadioPotin/getnextline42 | 166ee6c3309ee1cd376f33c7beca4b6d2a16bd9f | 09f69e92d436a49e7bd2453e3f57c6d47f158c37 | refs/heads/master | 2022-04-03T17:21:11.594944 | 2019-12-15T15:31:12 | 2019-12-15T15:31:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,144 | h | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dapinto <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/19 15:11:48 by dapinto #+# #+# */
/* Updated: 2018/12/03 08:24:59 by dapinto ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef GET_NEXT_LINE_H
# define GET_NEXT_LINE_H
# define BUFF_SIZE 4096
# define OPN_MX 4896
# include "./libft/includes/libft.h"
# include <unistd.h>
# include <stdlib.h>
# include <fcntl.h>
int get_next_line(const int fd, char **line);
#endif
| [
"[email protected]"
] | |
9c836dbe8fae787cb0e1bcb4909f830751eee0b5 | 5d417f03f724f4e23000f28cd629c92bc9297a23 | /common2/services/gfx_mono/example_spinctrl/saml21_xplained_pro/iar/asf.h | 639337449aecc8ea5e6830e6ecd0d30023a5a18a | [] | no_license | siliconunited/atmel-asf | 5ac78a123cb0f5026ffb9a0ba66b75abcccb788f | 19e02800a6cc33d203f5d12f7dfca0c39195d879 | refs/heads/master | 2021-01-22T21:34:10.563981 | 2017-03-19T04:45:30 | 2017-03-19T04:45:30 | 85,439,630 | 6 | 3 | null | 2020-03-08T01:34:35 | 2017-03-18T23:56:24 | C | UTF-8 | C | false | false | 3,572 | 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: GFX Monochrome - Monochrome Graphic Library
#include <gfx_mono.h>
// From module: GFX Monochrome - Spinner/Spin control widget
#include <gfx_mono_spinctrl.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: SSD1306 OLED controller
#include <ssd1306.h>
// From module: SYSTEM - Clock Management for SAML21
#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 For SAML21
#include <system_interrupt.h>
// From module: SYSTEM - Power Management for SAM L21
#include <power.h>
// From module: SYSTEM - Reset Management for SAM L21
#include <reset.h>
#endif // ASF_H
| [
"[email protected]"
] | |
2896d6515ab0e367bdac1dbd3ff1e4b66e87b5c7 | e22e03d9761f5c6d581b5af2e77343e8ee4b201d | /edk2/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.c | 30d9669129b56498915d5f99221edf35799eb945 | [
"OpenSSL",
"BSD-2-Clause"
] | permissive | SamuelTulach/SecureFakePkg | 759975fcc84d62f05ac577da48353752e5334878 | f34080a6c0efb6ca3dd755365778d0bcdca6b991 | refs/heads/main | 2023-08-17T07:51:22.175924 | 2021-10-01T10:46:14 | 2021-10-01T10:46:14 | 410,938,306 | 94 | 14 | null | null | null | null | UTF-8 | C | false | false | 2,476 | c | /** @file
Status Code Handler Driver which produces general handlers and hook them
onto the SMM status code router.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "StatusCodeHandlerSmm.h"
EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
/**
Dispatch initialization request to sub status code devices based on
customized feature flags.
**/
VOID
InitializationDispatcherWorker (
VOID
)
{
EFI_STATUS Status;
//
// If enable UseSerial, then initialize serial port.
// if enable UseRuntimeMemory, then initialize runtime memory status code worker.
//
if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
//
// Call Serial Port Lib API to initialize serial port.
//
Status = SerialPortInitialize ();
ASSERT_EFI_ERROR (Status);
}
if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
Status = MemoryStatusCodeInitializeWorker ();
ASSERT_EFI_ERROR (Status);
}
}
/**
Entry point of SMM Status Code Driver.
This function is the entry point of SMM Status Code Driver.
@param ImageHandle The firmware allocated handle for the EFI image.
@param SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
**/
EFI_STATUS
EFIAPI
StatusCodeHandlerSmmEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
Status = gSmst->SmmLocateProtocol (
&gEfiSmmRscHandlerProtocolGuid,
NULL,
(VOID **) &mRscHandlerProtocol
);
ASSERT_EFI_ERROR (Status);
//
// Dispatch initialization request to supported devices
//
InitializationDispatcherWorker ();
if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);
}
if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);
}
return EFI_SUCCESS;
}
| [
"[email protected]"
] | |
7878300a059e9709bef677be1c1305948c9032ca | 031f0f222881f127f5eb2d40a5ba36990878ac10 | /npiper.c | ac96c9676d5bb6c41bc1229f07592ca0fd651a98 | [] | no_license | abhilabh/SystemProg | 3fafe87c4568bf9e30d3bb06477bf275d9dc544e | 7c1772410247abdd95c6107755287cc71d67dd9a | refs/heads/master | 2021-01-10T21:58:18.790506 | 2015-07-26T20:51:41 | 2015-07-26T20:51:41 | 39,741,205 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 461 | c | #include"common.h"
#define BUFSIZE 100
int main(int argc, char *argv[])
{
int fd,fd1, spcount, n, k;
char buf[BUFSIZE+1];
fd1=open("try.c",O_RDONLY);
n=read(fd1,buf,BUFSIZE);
mkfifo("fifo", 0660);
fd = open("fifo", O_WRONLY);
n = write(fd, buf, BUFSIZE);
// buf[n] = 0;
// printf("%s\n", buf);
spcount = 0;
for (k=0; k < n; ++k) {
if (buf[k] == ' ') ++spcount;
}
printf("%d\n", spcount);
}
| [
"[email protected]"
] | |
52c0d00feb7153b0167cac781f7c9558c1ef4741 | 04ad1e5adbf9c8011629cce5251ac6e2f6b657e4 | /d/quanzhou/yuanhe.c | 28e891b9b04250308d9502884b7bcf8dc138794b | [] | no_license | cao777/mudwllz2-utf8 | 7398dd2dc702e8ab9a3c98895d2afc3392c07232 | 19ae1d998a871b9ad7f29c467481015143ffb7a8 | refs/heads/master | 2023-03-16T08:34:07.707561 | 2020-05-09T00:04:07 | 2020-05-09T00:04:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 430 | c | // yuanhe.c 源和堂
inherit ROOM;
void create()
{
set("short", "源和堂");
set("long", @LONG
这是远近闻名的蜜饯制作铺,各色水果经过他们的加工后风味独特,
甜而不腻,咸而不过,酸而不涩,又可以长期保存,远销海内外。
LONG
);
set("exits", ([ /* sizeof() == 4 */
"northeast" : __DIR__"minzai2",
"east" : __DIR__"minzai3",
]));
setup();
replace_program(ROOM);
}
| [
"[email protected]"
] | |
dcbda0865d81d87563188dbac55943fd8979c38b | 3d0de0f2549d9025540fcec88624c72c079b406f | /Integration/MCAL/Include/Can.h | 0c9622485e3c96b1a913ae66a7c7739ab5ce846f | [] | no_license | ongbut999/Jenkins_Test | ee19936e1577bd93d2755d21299ed3fbec553db6 | abb74480c4ce938dd1c7463627c4074071580af4 | refs/heads/master | 2023-06-23T21:26:57.794427 | 2021-07-22T08:05:20 | 2021-07-22T08:05:20 | 388,372,287 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,725 | h |
#ifndef CAN_H
#define CAN_H
#include "Can_17_MCanP.h"
#define CAN_AR_RELEASE_MAJOR_VERSION 4
#define CAN_AR_RELEASE_MINOR_VERSION 2 /* CIX2SGH */
#define CAN_AR_RELEASE_REVISION_VERSION 3
#define Can_Init(a) Can_17_MCanP_Init(a)
#if (CAN_CHANGE_BAUDRATE_API == STD_ON)
#define Can_CheckBaudrate(a,b) Can_17_MCanP_CheckBaudrate(a,b)
#else
#define Can_CheckBaudrate(a,b) ERROR_CanChangeBaudrateApi_NOT_SELECTED
#endif /* #if (CAN_CHANGE_BAUDRATE_API == STD_ON) */
#if (CAN_CHANGE_BAUDRATE_API == STD_ON)
#define CanP_ChangeBaudrate(a,b) Can_17_MCanP_ChangeBaudrate(a,b)
#else
#define CanP_ChangeBaudrate(a,b) ERROR_CanChangeBaudrateApi_NOT_SELECTED
#endif /* #if (CAN_CHANGE_BAUDRATE_API == STD_ON) */
#define Can_SetControllerMode(a,b) Can_17_MCanP_SetControllerMode(a,b)
#define Can_DisableControllerInterrupts(a) Can_17_MCanP_DisableControllerInterrupts(a)
#define Can_EnableControllerInterrupts(a) Can_17_MCanP_EnableControllerInterrupts(a)
#define Can_Write(a,b) Can_17_MCanP_Write(a,b)
#define Can_MainFunction_Wakeup() Can_17_MCanP_MainFunction_Wakeup()
#define Can_MainFunction_Mode() Can_17_MCanP_MainFunction_Mode()
#define Can_CheckWakeup(a) Can_17_MCanP_CheckWakeup(a)
#define Can_IsrBusOffHandler(a) Can_17_MCanP_IsrBusOffHandler(a)
#define Can_IsrReceiveHandler(a) Can_17_MCanP_IsrReceiveHandler(a)
#define Can_IsrTransmitHandler(a) Can_17_MCanP_IsrTransmitHandler(a)
#define Can_MainFunction_Write(void) Can_17_MCanP_MainFunction_Write(void)
#define Can_MainFunction_Read(void) Can_17_MCanP_MainFunction_Read(void)
#define Can_MainFunction_BusOff(void) Can_17_MCanP_MainFunction_BusOff(void)
#endif /* CAN_H */
| [
"[email protected]"
] | |
915e19c750a3b226cc314f49ab308e944f472632 | 7ab8d084803c371cf87b796e25d8102177b35a6f | /solutions/epi/lab1/inc/memlayout.h | d86b95fb4486424a6efb51a3ee43690ed8838b42 | [
"BSD-4-Clause-UC"
] | permissive | OSLL/os-hse-1h2019 | 8c89612406d5b54dc00135caf56fab3a9e7fa4ae | 8f50f40ea44d90a705b24df0056f039eedcdd653 | refs/heads/master | 2020-05-06T12:18:37.700966 | 2019-10-14T11:19:46 | 2019-10-14T11:19:46 | 180,115,834 | 41 | 8 | null | 2019-10-14T11:19:47 | 2019-04-08T09:31:14 | C | UTF-8 | C | false | false | 6,446 | h | #ifndef JOS_INC_MEMLAYOUT_H
#define JOS_INC_MEMLAYOUT_H
#ifndef __ASSEMBLER__
#include <inc/types.h>
#include <inc/mmu.h>
#endif /* not __ASSEMBLER__ */
/*
* This file contains definitions for memory management in our OS,
* which are relevant to both the kernel and user-mode software.
*/
// Global descriptor numbers
#define GD_KT 0x08 // kernel text
#define GD_KD 0x10 // kernel data
#define GD_UT 0x18 // user text
#define GD_UD 0x20 // user data
#define GD_TSS0 0x28 // Task segment selector for CPU 0
/*
* Virtual memory map: Permissions
* kernel/user
*
* 4 Gig --------> +------------------------------+
* | | RW/--
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* : . :
* : . :
* : . :
* |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| RW/--
* | | RW/--
* | Remapped Physical Memory | RW/--
* | | RW/--
* KERNBASE, ----> +------------------------------+ 0xf0000000 --+
* KSTACKTOP | CPU0's Kernel Stack | RW/-- KSTKSIZE |
* | - - - - - - - - - - - - - - -| |
* | Invalid Memory (*) | --/-- KSTKGAP |
* +------------------------------+ |
* | CPU1's Kernel Stack | RW/-- KSTKSIZE |
* | - - - - - - - - - - - - - - -| PTSIZE
* | Invalid Memory (*) | --/-- KSTKGAP |
* +------------------------------+ |
* : . : |
* : . : |
* MMIOLIM ------> +------------------------------+ 0xefc00000 --+
* | Memory-mapped I/O | RW/-- PTSIZE
* ULIM, MMIOBASE --> +------------------------------+ 0xef800000
* | Cur. Page Table (User R-) | R-/R- PTSIZE
* UVPT ----> +------------------------------+ 0xef400000
* | RO PAGES | R-/R- PTSIZE
* UPAGES ----> +------------------------------+ 0xef000000
* | RO ENVS | R-/R- PTSIZE
* UTOP,UENVS ------> +------------------------------+ 0xeec00000
* UXSTACKTOP -/ | User Exception Stack | RW/RW PGSIZE
* +------------------------------+ 0xeebff000
* | Empty Memory (*) | --/-- PGSIZE
* USTACKTOP ---> +------------------------------+ 0xeebfe000
* | Normal User Stack | RW/RW PGSIZE
* +------------------------------+ 0xeebfd000
* | |
* | |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* . .
* . .
* . .
* |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
* | Program Data & Heap |
* UTEXT --------> +------------------------------+ 0x00800000
* PFTEMP -------> | Empty Memory (*) | PTSIZE
* | |
* UTEMP --------> +------------------------------+ 0x00400000 --+
* | Empty Memory (*) | |
* | - - - - - - - - - - - - - - -| |
* | User STAB Data (optional) | PTSIZE
* USTABDATA ----> +------------------------------+ 0x00200000 |
* | Empty Memory (*) | |
* 0 ------------> +------------------------------+ --+
*
* (*) Note: The kernel ensures that "Invalid Memory" (ULIM) is *never*
* mapped. "Empty Memory" is normally unmapped, but user programs may
* map pages there if desired. JOS user programs map pages temporarily
* at UTEMP.
*/
// All physical memory mapped at this address
#define KERNBASE 0xF0000000
// At IOPHYSMEM (640K) there is a 384K hole for I/O. From the kernel,
// IOPHYSMEM can be addressed at KERNBASE + IOPHYSMEM. The hole ends
// at physical address EXTPHYSMEM.
#define IOPHYSMEM 0x0A0000
#define EXTPHYSMEM 0x100000
// Kernel stack.
#define KSTACKTOP KERNBASE
#define KSTKSIZE (8*PGSIZE) // size of a kernel stack
#define KSTKGAP (8*PGSIZE) // size of a kernel stack guard
// Memory-mapped IO.
#define MMIOLIM (KSTACKTOP - PTSIZE)
#define MMIOBASE (MMIOLIM - PTSIZE)
#define ULIM (MMIOBASE)
/*
* User read-only mappings! Anything below here til UTOP are readonly to user.
* They are global pages mapped in at env allocation time.
*/
// User read-only virtual page table (see 'uvpt' below)
#define UVPT (ULIM - PTSIZE)
// Read-only copies of the Page structures
#define UPAGES (UVPT - PTSIZE)
// Read-only copies of the global env structures
#define UENVS (UPAGES - PTSIZE)
/*
* Top of user VM. User can manipulate VA from UTOP-1 and down!
*/
// Top of user-accessible VM
#define UTOP UENVS
// Top of one-page user exception stack
#define UXSTACKTOP UTOP
// Next page left invalid to guard against exception stack overflow; then:
// Top of normal user stack
#define USTACKTOP (UTOP - 2*PGSIZE)
// Where user programs generally begin
#define UTEXT (2*PTSIZE)
// Used for temporary page mappings. Typed 'void*' for convenience
#define UTEMP ((void*) PTSIZE)
// Used for temporary page mappings for the user page-fault handler
// (should not conflict with other temporary page mappings)
#define PFTEMP (UTEMP + PTSIZE - PGSIZE)
// The location of the user-level STABS data structure
#define USTABDATA (PTSIZE / 2)
#ifndef __ASSEMBLER__
typedef uint32_t pte_t;
typedef uint32_t pde_t;
#endif /* !__ASSEMBLER__ */
#endif /* !JOS_INC_MEMLAYOUT_H */
| [
"[email protected]"
] | |
9e08fec5f2f62a1c36515744dc4a1cdf3d785571 | 2a34ed1b2996b4dd9ec92bef7c72b9f66534c332 | /src/fmtutil-miniz.c | 3c851cc5ad460a5b557d1e177e7292f3f9bd5803 | [
"MIT"
] | permissive | gingerbeardman/deark | 593a8fff0b12cfc1c09d90e194d6732def7a02d9 | ef578c0b079a6e367be779f2c788acae00191352 | refs/heads/master | 2022-12-26T08:15:00.197291 | 2020-09-13T16:37:18 | 2020-09-13T19:02:23 | 295,477,051 | 0 | 0 | NOASSERTION | 2020-09-14T16:37:17 | 2020-09-14T16:37:16 | null | UTF-8 | C | false | false | 8,114 | c | // This file is part of Deark.
// Copyright (C) 2016-2019 Jason Summers
// See the file COPYING for terms of use.
// Compression and decompression of Deflate and zlib
#define DE_NOT_IN_MODULE
#include "deark-config.h"
#include "deark-private.h"
#include "deark-fmtutil.h"
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#define MINIZ_NO_STDIO
#define MINIZ_NO_ARCHIVE_APIS
#include "../foreign/miniz.h"
void fmtutil_inflate_codectype1(deark *c, struct de_dfilter_in_params *dcmpri,
struct de_dfilter_out_params *dcmpro, struct de_dfilter_results *dres,
void *codec_private_params)
{
struct de_inflate_params *inflparams = (struct de_inflate_params*)codec_private_params;
mz_stream strm;
int ret;
int ok = 0;
#define DE_DFL_INBUF_SIZE 32768
#define DE_DFL_OUTBUF_SIZE (DE_DFL_INBUF_SIZE*4)
u8 *inbuf = NULL;
u8 *outbuf = NULL;
i64 inbuf_num_valid_bytes; // Number of valid bytes in inbuf, starting with [0].
i64 inbuf_num_consumed_bytes; // Of inbuf_num_valid_bytes, the number that have been consumed.
i64 inbuf_num_consumed_bytes_this_time;
unsigned int orig_avail_in;
i64 input_cur_pos;
i64 output_bytes_this_time;
i64 nbytes_to_read;
i64 nbytes_to_write;
i64 nbytes_written_total = 0;
int stream_open_flag = 0;
static const char *modname = "inflate";
dres->bytes_consumed = 0;
if(dcmpri->len<0) {
de_dfilter_set_errorf(c, dres, modname, "Internal error");
goto done;
}
inbuf = de_malloc(c, DE_DFL_INBUF_SIZE);
outbuf = de_malloc(c, DE_DFL_OUTBUF_SIZE);
de_zeromem(&strm, sizeof(strm));
if(inflparams->flags&DE_DEFLATEFLAG_ISZLIB) {
ret = mz_inflateInit(&strm);
}
else {
ret = mz_inflateInit2(&strm, -MZ_DEFAULT_WINDOW_BITS);
}
if(ret!=MZ_OK) {
de_dfilter_set_errorf(c, dres, modname, "Inflate error");
goto done;
}
if(inflparams->starting_dict) {
inflate_state *pDecomp = (inflate_state *)strm.state;
de_memcpy(pDecomp->m_dict, inflparams->starting_dict, 32768);
}
stream_open_flag = 1;
input_cur_pos = dcmpri->pos;
inbuf_num_valid_bytes = 0;
inbuf_num_consumed_bytes = 0;
de_dbg2(c, "inflating up to %d bytes", (int)dcmpri->len);
while(1) {
de_dbg3(c, "input remaining: %d", (int)(dcmpri->pos+dcmpri->len-input_cur_pos));
// If we have written enough bytes, stop.
if((dcmpro->len_known) && (nbytes_written_total >= dcmpro->expected_len)) {
break;
}
if(inbuf_num_consumed_bytes>0) {
if(inbuf_num_valid_bytes>inbuf_num_consumed_bytes) {
// Move unconsumed bytes to the beginning of the input buffer
de_memmove(inbuf, &inbuf[inbuf_num_consumed_bytes], (size_t)(inbuf_num_valid_bytes-inbuf_num_consumed_bytes));
inbuf_num_valid_bytes -= inbuf_num_consumed_bytes;
inbuf_num_consumed_bytes = 0;
}
else {
inbuf_num_valid_bytes = 0;
inbuf_num_consumed_bytes = 0;
}
}
nbytes_to_read = dcmpri->pos+dcmpri->len-input_cur_pos;
if(nbytes_to_read>DE_DFL_INBUF_SIZE-inbuf_num_valid_bytes) {
nbytes_to_read = DE_DFL_INBUF_SIZE-inbuf_num_valid_bytes;
}
// top off input buffer
dbuf_read(dcmpri->f, &inbuf[inbuf_num_valid_bytes], input_cur_pos, nbytes_to_read);
input_cur_pos += nbytes_to_read;
inbuf_num_valid_bytes += nbytes_to_read;
strm.next_in = inbuf;
strm.avail_in = (unsigned int)inbuf_num_valid_bytes;
orig_avail_in = strm.avail_in;
strm.next_out = outbuf;
strm.avail_out = DE_DFL_OUTBUF_SIZE;
ret = mz_inflate(&strm, MZ_SYNC_FLUSH);
if(ret!=MZ_STREAM_END && ret!=MZ_OK) {
de_dfilter_set_errorf(c, dres, modname, "Inflate error (%d)", (int)ret);
goto done;
}
output_bytes_this_time = DE_DFL_OUTBUF_SIZE - strm.avail_out;
de_dbg3(c, "got %d output bytes", (int)output_bytes_this_time);
nbytes_to_write = output_bytes_this_time;
if((dcmpro->len_known) &&
(nbytes_to_write > dcmpro->expected_len - nbytes_written_total))
{
nbytes_to_write = dcmpro->expected_len - nbytes_written_total;
}
dbuf_write(dcmpro->f, outbuf, nbytes_to_write);
nbytes_written_total += nbytes_to_write;
if(ret==MZ_STREAM_END) {
de_dbg2(c, "inflate finished normally");
ok = 1;
goto done;
}
inbuf_num_consumed_bytes_this_time = (i64)(orig_avail_in - strm.avail_in);
if(inbuf_num_consumed_bytes_this_time<1 && output_bytes_this_time<1) {
de_dfilter_set_errorf(c, dres, modname, "Inflate error");
goto done;
}
inbuf_num_consumed_bytes += inbuf_num_consumed_bytes_this_time;
}
done:
if(ok) {
dres->bytes_consumed = (i64)strm.total_in;
dres->bytes_consumed_valid = 1;
de_dbg2(c, "inflated %u to %u bytes", (unsigned int)strm.total_in,
(unsigned int)strm.total_out);
}
if(stream_open_flag) {
mz_inflateEnd(&strm);
}
de_free(c, inbuf);
de_free(c, outbuf);
}
// flags:
// DE_DEFLATEFLAG_ISZLIB
// DE_DEFLATEFLAG_USEMAXUNCMPRSIZE
int fmtutil_decompress_deflate(dbuf *inf, i64 inputstart, i64 inputsize, dbuf *outf,
i64 maxuncmprsize, i64 *bytes_consumed, unsigned int flags)
{
deark *c = inf->c;
struct de_dfilter_results dres;
struct de_dfilter_in_params dcmpri;
struct de_dfilter_out_params dcmpro;
struct de_inflate_params inflparams;
de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
if(bytes_consumed) *bytes_consumed = 0;
dcmpri.f = inf;
dcmpri.pos = inputstart;
dcmpri.len = inputsize;
dcmpro.f = outf;
if(flags & DE_DEFLATEFLAG_USEMAXUNCMPRSIZE) {
dcmpro.len_known = 1;
dcmpro.expected_len = maxuncmprsize;
flags -= DE_DEFLATEFLAG_USEMAXUNCMPRSIZE;
}
de_zeromem(&inflparams, sizeof(struct de_inflate_params));
inflparams.flags = flags;
fmtutil_inflate_codectype1(c, &dcmpri, &dcmpro, &dres, (void*)&inflparams);
if(bytes_consumed && dres.bytes_consumed_valid) {
*bytes_consumed = dres.bytes_consumed;
}
if(dres.errcode != 0) {
de_err(c, "%s", de_dfilter_get_errmsg(c, &dres));
return 0;
}
return 1;
}
// flags:
// DE_DEFLATEFLAG_ISZLIB
void fmtutil_decompress_deflate_ex(deark *c, struct de_dfilter_in_params *dcmpri,
struct de_dfilter_out_params *dcmpro, struct de_dfilter_results *dres,
unsigned int flags)
{
struct de_inflate_params inflparams;
de_zeromem(&inflparams, sizeof(struct de_inflate_params));
inflparams.flags = flags;
fmtutil_inflate_codectype1(c, dcmpri, dcmpro, dres, (void*)&inflparams);
}
struct fmtutil_tdefl_ctx {
deark *c;
tdefl_compressor pComp;
};
static mz_bool my_fmtutil_tdefl_output_buffer_putter(const void *pBuf, int len, void *pUser)
{
dbuf *f = (dbuf*)pUser;
dbuf_write(f, (const u8*)pBuf, (i64)len);
return MZ_TRUE;
}
struct fmtutil_tdefl_ctx *fmtutil_tdefl_create(deark *c, dbuf *outf, int flags)
{
struct fmtutil_tdefl_ctx *tdctx = NULL;
tdctx = de_malloc(c, sizeof(struct fmtutil_tdefl_ctx));
tdctx->c = c;
tdefl_init(&tdctx->pComp, my_fmtutil_tdefl_output_buffer_putter, (void*)outf,
flags);
return tdctx;
}
static enum fmtutil_tdefl_status tdefl_status_to_fmtutil(tdefl_status n)
{
switch(n) {
case TDEFL_STATUS_BAD_PARAM: return FMTUTIL_TDEFL_STATUS_BAD_PARAM;
case TDEFL_STATUS_PUT_BUF_FAILED: return FMTUTIL_TDEFL_STATUS_PUT_BUF_FAILED;
case TDEFL_STATUS_OKAY: return FMTUTIL_TDEFL_STATUS_OKAY;
case TDEFL_STATUS_DONE: return FMTUTIL_TDEFL_STATUS_DONE;
}
return FMTUTIL_TDEFL_STATUS_PUT_BUF_FAILED;
}
static tdefl_flush fmtutil_flush_to_tdefl(enum fmtutil_tdefl_flush n)
{
switch(n) {
case FMTUTIL_TDEFL_NO_FLUSH: return TDEFL_NO_FLUSH;
case FMTUTIL_TDEFL_SYNC_FLUSH: return TDEFL_SYNC_FLUSH;
case FMTUTIL_TDEFL_FULL_FLUSH: return TDEFL_FULL_FLUSH;
case FMTUTIL_TDEFL_FINISH: return TDEFL_FINISH ;
}
return TDEFL_NO_FLUSH;
}
enum fmtutil_tdefl_status fmtutil_tdefl_compress_buffer(struct fmtutil_tdefl_ctx *tdctx,
const void *pIn_buf, size_t in_buf_size, enum fmtutil_tdefl_flush flush)
{
tdefl_status st;
st = tdefl_compress_buffer(&tdctx->pComp, pIn_buf, in_buf_size,
fmtutil_flush_to_tdefl(flush));
return tdefl_status_to_fmtutil(st);
}
void fmtutil_tdefl_destroy(struct fmtutil_tdefl_ctx *tdctx)
{
deark *c;
if(!tdctx) return;
c = tdctx->c;
de_free(c, tdctx);
}
unsigned int fmtutil_tdefl_create_comp_flags_from_zip_params(int level, int window_bits,
int strategy)
{
return (unsigned int)tdefl_create_comp_flags_from_zip_params(level, window_bits,
strategy);
}
| [
"[email protected]"
] | |
09622d48aa7cf5521cefccecf7c88270b362c0bf | 854946bdd7428a7f35990282c34b12af095955f4 | /HAL_Driver/Inc/stm32f4xx_hal_hash_ex.h | 696f0a88a1cb4f31940991854fbb7c983dd4c606 | [
"MIT"
] | permissive | liangyongxiang/lv_port_stm32f429_disco | a932b9345f134733a0f7c4c989ccae4ee24cecc6 | bf87483032ba53f69ab336d636a0391544bb5bfa | refs/heads/master | 2022-11-14T04:24:37.139369 | 2020-05-19T08:37:49 | 2020-05-19T08:37:49 | 275,533,315 | 0 | 0 | MIT | 2020-06-28T07:41:02 | 2020-06-28T07:41:01 | null | UTF-8 | C | false | false | 6,582 | h | /**
******************************************************************************
* @file stm32f4xx_hal_hash_ex.h
* @author MCD Application Team
* @version V1.7.0
* @date 17-February-2017
* @brief Header file of HASH HAL Extension module.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_HAL_HASH_EX_H
#define __STM32F4xx_HAL_HASH_EX_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx)
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal_def.h"
/** @addtogroup STM32F4xx_HAL_Driver
* @{
*/
/** @addtogroup HASHEx
* @brief HASHEx HAL Extension module driver
* @{
*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup HASHEx_Exported_Functions HASHEx Exported Functions
* @{
*/
/** @defgroup HASHEx_Exported_Functions_Group1 HASHEx processing using polling functions
* @{
*/
HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
HAL_StatusTypeDef HAL_HASHEx_SHA224_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
HAL_StatusTypeDef HAL_HASHEx_SHA256_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
/**
* @}
*/
/** @defgroup HASHEx_Exported_Functions_Group2 HMAC processing using polling functions
* @{
*/
HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
/**
* @}
*/
/** @defgroup HASHEx_Exported_Functions_Group3 HASHEx processing using functions
* @{
*/
HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
/**
* @}
*/
/** @defgroup HASHEx_Exported_Functions_Group4 HASHEx processing using DMA
* @{
*/
HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
/**
* @}
*/
/** @defgroup HASHEx_Exported_Functions_Group5 HMAC processing using DMA
* @{
*/
HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
/**
* @}
*/
/** @defgroup HASHEx_Exported_Functions_Group6 HASHEx processing functions
* @{
*/
void HAL_HASHEx_IRQHandler(HASH_HandleTypeDef *hhash);
/**
* @}
*/
/**
* @}
*/
/* Private types -------------------------------------------------------------*/
/** @defgroup HASHEx_Private_Types HASHEx Private Types
* @{
*/
/**
* @}
*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup HASHEx_Private_Variables HASHEx Private Variables
* @{
*/
/**
* @}
*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup HASHEx_Private_Constants HASHEx Private Constants
* @{
*/
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup HASHEx_Private_Macros HASHEx Private Macros
* @{
*/
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup HASHEx_Private_Functions HASHEx Private Functions
* @{
*/
/**
* @}
*/
#endif /* STM32F437xx || STM32F439xx || STM32F479xx */
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_HAL_HASH_EX_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
83c63b77075937b7e6a381cd0427459a7bb2cdeb | 58969d3d19802479fa7f88e553fb60efb5ab3dbd | /算法库/编程/数组的输入和输出.c | fd83efae3c1b0b604087f66988cbd95179b6a827 | [] | no_license | Saikikky/MyLeetcode | eda26ec8565a3de4ffb44b28c9bfdf56089aba30 | 7b97abd53a5dbbe79d55816e82182c2250268686 | refs/heads/master | 2020-04-09T10:58:20.388037 | 2020-03-23T07:29:25 | 2020-03-23T07:29:25 | 160,290,050 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 803 | c | #include <stdio.h>
#include "MyMath.h"
#include "MyRArray.h"
void InputRArray(REAL array[],INTEGER size);
//输入全部数组元素
void OutputRArray(REAL array[],INTEGER size);
//输出全部数组元素
int main()
{
REAL a[maxRArraySize];
INTEGER n;
printf("项数: ");
scanf(ISF, &n);
if (n < 1 || n > maxRArraySize)
{
puts("不正确的项数!");
exit(1);
}
// 输入数组
printf("数组: ");
InputRArray(a, n);
// 输出数组
printf("数组:");
OutputRArray(a, n);
putchar('\n');
return 0;
}
void InputRArray(REAL array[],INTEGER size)
{
int k;
for(k = 0;k < size;k++)
{
scanf("%lg",&array[k]);
}
}
void OutputRArray(REAL array[],INTEGER size)
{
int k;
for(k = 0;k < size;k++)
{
printf(" %g",array[k]);
}
}
| [
"[email protected]"
] | |
6a75f8f20f9de96d52692aec51f3addec021c123 | 656243ae84ca3a2280cc9cc3aad95afca8e10565 | /Code/CryEngine/CryAction/Network/ExplosiveObjectState.h | 90e88a0bcdaa1626350a2d8ddcbeb60cf75cd56b | [] | no_license | NightOwlsEntertainment/PetBox_A_Journey_to_Conquer_Elementary_Algebra | 914ff61bb210862401acb4d3a2eb19d323b00548 | 8383c5c1162d02310f460a1359f04891e5e85bff | refs/heads/master | 2021-01-22T09:48:55.961703 | 2015-11-11T11:26:27 | 2015-11-11T11:26:27 | 45,846,131 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,202 | h | /*************************************************************************
Crytek Source File.
Copyright (C), Crytek Studios, 2007.
-------------------------------------------------------------------------
$Id$
$DateTime$
Description: network breakability: state of an object pre-explosion
-------------------------------------------------------------------------
History:
- 22/01/2007 10:34 : Created by Craig Tiller
*************************************************************************/
#ifndef __EXPLOSIVEOBJECTSTATE_H__
#define __EXPLOSIVEOBJECTSTATE_H__
#pragma once
struct SExplosiveObjectState
{
bool isEnt;
// for entity
EntityId entId;
Vec3 entPos;
Quat entRot;
Vec3 entScale;
// for statobj
Vec3 eventPos;
uint32 hash;
};
bool ExplosiveObjectStateFromPhysicalEntity( SExplosiveObjectState& out, IPhysicalEntity * pEnt);
struct SDeclareExplosiveObjectState : public SExplosiveObjectState
{
SDeclareExplosiveObjectState() : breakId(-1) {}
SDeclareExplosiveObjectState(int bid, const SExplosiveObjectState& eos) : breakId(bid), SExplosiveObjectState(eos) {}
int breakId;
void SerializeWith( TSerialize ser );
};
#endif
| [
"[email protected]"
] | |
4c3557e8ae13359831448510694bf175e18697ae | c4c62caff67517a608102a97577e9cd01ebd6624 | /growhouse/end-devices/gecko_sdk_suite/v2.3/platform/radio/rail_lib/chip/efr32/rf/common/cortex/pa.h | 2effe9bbaa36a03fb5e9d5e063e48d566b469695 | [] | no_license | ArrowElectronics/Growhouse | 30ab3b6990206490b12188e7cc9a2982fc47f711 | 0d2eb763947be25704eb23f58da09a27319c7427 | refs/heads/master | 2023-02-17T15:07:34.363647 | 2021-01-19T17:02:44 | 2021-01-19T17:02:44 | 265,281,716 | 5 | 2 | null | 2020-06-03T10:14:03 | 2020-05-19T15:10:20 | C | UTF-8 | C | false | false | 8,157 | h | /***************************************************************************//**
* @file pa.h
* @brief RADIO PA API
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, www.silabs.com</b>
*******************************************************************************
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
* obligation to support this Software. Silicon Labs is providing the
* Software "AS IS", with no express or implied warranties of any kind,
* including, but not limited to, any implied warranties of merchantability
* or fitness for any particular purpose or warranties against infringement
* of any proprietary rights of a third party.
*
* Silicon Labs will not be liable for any consequential, incidental, or
* special damages, or any other relief, or for any claim by any third party,
* arising from your use of this Software.
*
******************************************************************************/
#ifndef __RADIO_PA_H
#define __RADIO_PA_H
#include <stdint.h>
#include <stdbool.h>
#include "timing_state.h"
#include "rail_chip_specific.h"
// Once this is a RAIL API this code can be removed as rail-types.h does this
#ifndef RAIL_ENUM
#ifdef DOXYGEN_SHOULD_SKIP_THIS
/// The RAIL library does not use actual enums because the ARM EABI leaves their
/// size ambiguous. This ambiguity causes problems if the application is built
/// with different flags than the library. To work around this we use uint8_t
/// typedefs in compiled code for all enums. For documentation purposes this is
/// converted to an actual enum since it's much easier to read in Doxygen.
#define RAIL_ENUM(name) enum name
#else
/// Define used for the actual RAIL library which sets each enum to a uint8_t
/// typedef and creates a named enum structure for the enumeration values.
#define RAIL_ENUM(name) typedef uint8_t name; enum name##_enum
// For debugging use the following define to turn this back into a proper enum
// #define RAIL_ENUM(name) typedef enum name##_enum name; enum name##_enum
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************//**
* @addtogroup Chip_Specific
* @{
******************************************************************************/
/***************************************************************************//**
* @addtogroup EFR32xG1x_PA
* @{
******************************************************************************/
/*******************************************************************************
****************************** PROTOTYPES *********************************
******************************************************************************/
/**
* @brief
* Initilize the PA settings based on the settings provided in the paInit
* structure.
*
* @param[in] paConfig
* Pointer to a structure containing the desired PA configuration settings.
*
* @param[in] timings
* Pointer to a structure containing the current state transition timings.
*
* @return
* RAIL_Status_t indicating success
*
* @warning
* The radio should not be transmitting when this function is called!
*/
RAIL_Status_t PA_Config(const RAIL_TxPowerConfig_t *paConfig,
const StateTimings_t *timings);
/**
* @brief
* Get the current PA settings in use
*
* @param[out] config
* Pointer to memory location into which the configuration will be
* copied
*
* @return
* RAIL_Status_t indicating success
*/
RAIL_Status_t PA_GetTxPowerConfig(RAIL_TxPowerConfig_t *config);
/**
* @brief
* Returns the current power level of transmit power
*
* @return
* Current power level in deci-dBm
*/
RAIL_TxPowerLevel_t PA_GetPowerLevel(void);
/**
* @brief
* Return the current ramp time.
* param[in] ns
* Whether to return result in ns (true) or us (false).
*
* @return
* Current ramp time in nanoseconds
*/
uint32_t PA_GetRampTime(void);
/**
* @brief
* Sets up the ramp configuration so that it best matches the given ramp time
*
* @details
* Each PA has a distinct ramp level and ramp rate that can be used to
* achieve various ramp times. This API will pick the ramp rate that closest
* approximates the desired ramp time.
*
* @param[in] ramptime
* Desired ramp time in nanoseconds.
*
* @param[in] timings
* Pointer to a structure containing the current state transition timings.
*
* @return
* The actual ramp time that was set in nanoseconds.
*
* @warning
* The radio should not be transmitting when this function is called!
*/
uint32_t PA_SetRampTime(uint32_t rampTime, const StateTimings_t *timings);
/**
* Enable/Disable PA calibration
*
* @param[in] enable Enables/Disables PA calibration
* @return void
*
* Enabling this will ensure that the PA power remains constant chip to chip.
* By default this feature is disabled after reset.
*/
void PA_EnableCal(bool enable);
/***************************************************************************//**
* @addtogroup EFR32xG1x_PA_Advanced
* @{
******************************************************************************/
/**
* @brief
* Set PACTUNE value for TX and RX mode.
*
* This value can vary depending on band and match and board design.
*
* @param[in] txPaCtuneValue
* Transmit value for pa ctune
* @param[in] rxPaCtuneValue
* Receive value for pa ctune
*
* @note PACTUNE will reset to default values when PA_Config() or
* RAIL_ConfigRadio() are called.
*
* @warning
* The radio should not be transmitting when this function is called!
*/
void PA_SetCTune(uint8_t txPaCtuneValue, uint8_t rxPaCtuneValue);
/**
* @brief
* Set the output power level based on power steps available in the chosen PA.
*
* @details
* Each PA has distinct maximum power, minimum power, and power step sizes.
* This API allows direct access to these power steps to tune between the
* maximum and minimum output power the selected PA is capable of.
*
* @param[in] pwrLevel
* Output power level. Note that the maximum power level will change
* depending on PA selection.
*
* @return
* Power level set in the current PA.
*
* @warning
* The radio should not be transmitting when this function is called!
*/
RAIL_TxPowerLevel_t PA_SetPowerLevel(RAIL_TxPowerLevel_t powerLevel);
/** @} (end addtogroup EFR32xG1x_PA_Advanced) */
/** @} (end addtogroup EFR32xG1x_PA) */
/** @} (end addtogroup Chip_Specific) */
/**
* Non RAIL functions.
*
* The following functions can only be safely used by customers not yet on the
* RAIL platform yet. For those on RAIL, please see RAIL_ConvertDbmToRaw and
* RAIL_ConvertRawToDbm.
*/
/**
* Function used to convert deci-dBm values to raw values that can be used in
* SetTxPower.
*
* @param[in] power deci-dBm value that should be converted to the appropriate
* raw power for the current PA
* @return equivalent raw power for the deci-dBm value supplied, for the active
* PA.
*/
RAIL_TxPowerLevel_t PA_ConvertDbmToRaw(RAIL_TxPower_t power);
/**
* Function to convert the raw power levels returned from GetTxPower to
* the equivalent deci-dBm value for the current PA.
*
* @param[in] powerLevel Raw PA power level that should be converted into
* the equivalent deci-dBm value for the active PA
* @return equivalent deci-dBm value for the raw power level passed in.
*/
RAIL_TxPower_t PA_ConvertRawToDbm(RAIL_TxPowerLevel_t powerLevel);
#ifdef __cplusplus
}
#endif
#endif /* __RADIO_PA_H */
| [
"[email protected]"
] | |
1ceaf5685b0bb186cac1ad4536fb5221e30b0e0e | bc20ad10ca3917ace45aa85eb3a9fc043055486f | /test/unit/lib/bdev/part.c/part_ut.c | a32d4dabf4f1b27981f1ffe5142c110b22bc69c7 | [
"BSD-3-Clause"
] | permissive | morganwang010/spdk | 3deb3f8a5d19ad6d803a7c376c71fb3840f9fca6 | e84f0061dd90efe3ed572d0d3647bf935e744df7 | refs/heads/master | 2021-01-13T15:51:07.580854 | 2018-03-08T14:49:28 | 2018-03-08T14:49:28 | 76,867,602 | 0 | 0 | null | 2018-03-08T14:49:29 | 2016-12-19T14:11:01 | C | UTF-8 | C | false | false | 4,191 | c | /*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* 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 Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk_cunit.h"
#include "lib/test_env.c"
/* HACK: disable VTune integration so the unit test doesn't need VTune headers and libs to build */
#undef SPDK_CONFIG_VTUNE
#include "bdev/bdev.c"
#include "bdev/part.c"
void
spdk_scsi_nvme_translate(const struct spdk_bdev_io *bdev_io,
int *sc, int *sk, int *asc, int *ascq)
{
}
SPDK_DECLARE_BDEV_MODULE(vbdev_ut);
static void
vbdev_ut_examine(struct spdk_bdev *bdev)
{
spdk_bdev_module_examine_done(SPDK_GET_BDEV_MODULE(vbdev_ut));
}
SPDK_BDEV_MODULE_REGISTER(bdev_ut, NULL, NULL, NULL, NULL, NULL)
SPDK_BDEV_MODULE_REGISTER(vbdev_ut, NULL, NULL, NULL, NULL, vbdev_ut_examine)
static int
__destruct(void *ctx)
{
return 0;
}
static struct spdk_bdev_fn_table base_fn_table = {
.destruct = __destruct,
};
static struct spdk_bdev_fn_table part_fn_table = {
.destruct = __destruct,
};
static void
__base_free(struct spdk_bdev_part_base *base)
{
free(base);
}
static void
part_test(void)
{
struct spdk_bdev_part_base *base;
struct spdk_bdev_part part1, part2;
struct spdk_bdev bdev_base = {};
SPDK_BDEV_PART_TAILQ tailq = TAILQ_HEAD_INITIALIZER(tailq);
int rc;
base = calloc(1, sizeof(*base));
SPDK_CU_ASSERT_FATAL(base != NULL);
bdev_base.name = "base";
bdev_base.fn_table = &base_fn_table;
bdev_base.module = SPDK_GET_BDEV_MODULE(bdev_ut);
rc = spdk_bdev_register(&bdev_base);
CU_ASSERT(rc == 0);
spdk_bdev_part_base_construct(base, &bdev_base, NULL, SPDK_GET_BDEV_MODULE(vbdev_ut),
&part_fn_table, &tailq, __base_free, 0, NULL, NULL);
spdk_bdev_part_construct(&part1, base, "test1", 0, 100, "test");
spdk_bdev_part_construct(&part2, base, "test2", 100, 100, "test");
spdk_bdev_part_base_hotremove(&bdev_base, &tailq);
/*
* The base device was removed - ensure that the partition vbdevs were
* removed from the base's vbdev list.
*/
CU_ASSERT(TAILQ_EMPTY(&bdev_base.vbdevs));
spdk_bdev_part_base_free(base);
spdk_bdev_unregister(&bdev_base, NULL, NULL);
}
int
main(int argc, char **argv)
{
CU_pSuite suite = NULL;
unsigned int num_failures;
if (CU_initialize_registry() != CUE_SUCCESS) {
return CU_get_error();
}
suite = CU_add_suite("bdev_part", NULL, NULL);
if (suite == NULL) {
CU_cleanup_registry();
return CU_get_error();
}
if (
CU_add_test(suite, "part", part_test) == NULL
) {
CU_cleanup_registry();
return CU_get_error();
}
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
num_failures = CU_get_number_of_failures();
CU_cleanup_registry();
return num_failures;
}
| [
"[email protected]"
] | |
01fe874668db40a02f9374aea833940f3114a6b8 | e5030a4bd6385694cb8cecd05cc38d11b00da496 | /03_SDK/xr871sdk/src/ota/ota_i.h | f5971285d2e422a13bbce321af97d06f12587439 | [] | no_license | 13824125580/XR871 | a299919c66707a2a5ba49f735cad19fea4883d3d | 206ffefe41ea6801f3e49704b2697d2d5c46fe4a | refs/heads/master | 2021-01-01T17:51:38.089412 | 2017-07-24T05:45:15 | 2017-07-24T05:45:15 | 98,179,255 | 2 | 0 | null | 2017-07-24T10:34:08 | 2017-07-24T10:34:08 | null | UTF-8 | C | false | false | 2,751 | h | /*
* Copyright (C) 2017 XRADIO TECHNOLOGY CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of XRADIO TECHNOLOGY CO., LTD. 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.
*/
#include <stdio.h>
#include <string.h>
#include "types.h"
#include "kernel/os/os.h"
#include "sys/ota.h"
#ifndef _OTA_I_H_
#define _OTA_I_H_
#define DBG_OTA 0
#if DBG_OTA
#define OTA_DBG(fmt, arg...) printf("[OTA] "fmt, ##arg)
#define OTA_WRN OTA_DBG
#define OTA_ERR OTA_DBG
#else /* DBG_OTA */
#define OTA_DBG(...)
#define OTA_WRN(...)
#define OTA_ERR(...)
#endif /* DBG_OTA */
#define ota_malloc(l) malloc(l)
#define ota_free(p) free(p)
#define ota_memcpy(d, s, n) memcpy(d, s, n)
#define ota_memset(s, c, n) memset(s, c, n)
#define OTA_BUF_SIZE (2 << 10)
#define OTA_BOOT_IMAGE_1ST (0x5555)
#define OTA_BOOT_IMAGE_2ND (0xAAAA)
#define OTA_BOOT_STATE_UNVERIFIED (0x6996)
#define OTA_BOOT_STATE_VERIFIED (0x9669)
typedef struct {
uint16_t boot_image;
uint16_t boot_state;
} ota_boot_cfg;
#define OTA_BOOT_CFG_SIZE sizeof(ota_boot_cfg)
typedef struct {
uint32_t boot_offset;
uint32_t boot_cfg_offset;
uint32_t image_offset_1st;
uint32_t image_offset_2nd;
ota_flash_init_cb init_cb;
ota_flash_deinit_cb deinit_cb;
} ota_priv_t;
#endif /* _OTA_I_H_ */
| [
"[email protected]"
] | |
de93514e3ee2b7abd069f936e43c17573a80660b | 2a9b2ec98267c8760b86bcdf4973e985d55be96f | /poc/lib/control/vel/dev/cart.h | f68eab9471f2137e6e7527ac8ade94c8a091533f | [] | no_license | uDeviceX/uDeviceX | 51af1a37bc5d1a1e0131dfcb6c008b8528c20746 | c783450b43340177abfad4b02c8e23c8079f6bec | refs/heads/master | 2023-01-24T18:22:12.536904 | 2023-01-20T12:33:56 | 2023-01-20T12:33:56 | 18,841,165 | 20 | 9 | null | null | null | null | UTF-8 | C | false | false | 176 | h | static __device__ float3 transform(Coords_v, TCart, const Particle p) {
enum {X, Y, Z};
float3 u;
u.x = p.v[X];
u.y = p.v[Y];
u.z = p.v[Z];
return u;
}
| [
"[email protected]"
] | |
7a5091b07b5d57f7407d5be99dce59a1383e306a | 72fda86c971fec9c5e15bd02a02fa3ee49563845 | /vendor/libftm/src/mat4/ftm_mat4init_frustum_sym.c | 276376546ec892ef649a78d8dcf2d9d25247540a | [] | no_license | cacharle/scop | f6bfca9e0744fe489ca7a3f86e30d4359da8ac5d | 84a5a84861c95174e6dc4b28301fc4bcb0192069 | refs/heads/master | 2022-07-04T08:45:13.075590 | 2020-05-14T17:40:07 | 2020-05-14T17:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,211 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ftm_mat4init_frustum_sym.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: charles <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/12 15:47:45 by charles #+# #+# */
/* Updated: 2020/05/12 17:21:06 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftm_mat4.h"
t_ftmmat4 *ftm_mat4init_frustum_sym(t_ftmmat4 *mat4, t_ftmfrustum_sym *frustum)
{
t_ftmfrustum f;
f.right = frustum->width / 2;
f.left = -f.right;
f.top = frustum->height / 2;
f.bottom = -f.top;
f.near = frustum->near;
f.far = frustum->far;
return (ftm_mat4init_frustum(mat4, &f));
}
| [
"[email protected]"
] | |
2a3e8ca458312ad94284f0df328d536d669950f4 | 2875e427d9931ab8cfe2e066e1568c3130fcc3f2 | /Solaris_2.6/os_net/src_ws/usr/src/lib/nsswitch/files/getspent.c | 5b37f72d1196ad46f822a99527f64020ee406a9a | [] | no_license | legacy-codedigger/Solaris-2.6-Source-Code | 3afaff70487fb96c864d55bd5845dd11c6c5c871 | 60a0b3093caa7d84e63dd891a23df0e8e720bf3d | refs/heads/master | 2022-05-23T16:05:32.631954 | 2020-04-25T01:07:08 | 2020-04-25T01:07:08 | 258,658,903 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 1,001 | c | /*
* Copyright (c) 1988-1995 Sun Microsystems Inc
* All Rights Reserved.
*
* files/getspent.c -- "files" backend for nsswitch "shadow" database
*/
#pragma ident "@(#)getspent.c 1.7 95/07/13 SMI"
#include <shadow.h>
#include "files_common.h"
static int
check_spnamp(argp)
nss_XbyY_args_t *argp;
{
struct spwd *s = (struct spwd *)argp->returnval;
return (strcmp(s->sp_namp, argp->key.name) == 0);
}
static nss_status_t
getbyname(be, a)
files_backend_ptr_t be;
void *a;
{
nss_XbyY_args_t *argp = (nss_XbyY_args_t *) a;
return (_nss_files_XY_all(be, argp, 0, argp->key.name, check_spnamp));
}
static files_backend_op_t shadow_ops[] = {
_nss_files_destr,
_nss_files_endent,
_nss_files_setent,
_nss_files_getent_rigid,
getbyname
};
nss_backend_t *
_nss_files_shadow_constr(dummy1, dummy2, dummy3)
const char *dummy1, *dummy2, *dummy3;
{
return (_nss_files_constr(shadow_ops,
sizeof (shadow_ops) / sizeof (shadow_ops[0]),
SHADOW,
NSS_LINELEN_SHADOW,
NULL));
}
| [
"[email protected]"
] | |
1d6d852818b65f897062750894325faaeba1daf3 | dcbb0174cef26164c1749661c5ac3ff45ef338ee | /xbook2/library/xlibc/include/sys/socket.h | d0c842713cf6c436e0e302ce3fd781b2a70d5408 | [
"MIT"
] | permissive | huloves/kernel | ea699dd122d66538b725cd0d5d9e2619e6971763 | 918e2bfed022733148c7e768234d6ba06914f1ad | refs/heads/master | 2022-03-08T07:36:20.095085 | 2022-02-18T09:56:51 | 2022-02-18T09:56:51 | 234,358,664 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,108 | h | #ifndef _SYS_SOCKET_H
#define _SYS_SOCKET_H
#include <types.h>
#include <stdint.h>
typedef uint32_t socklen_t;
typedef uint32_t u32_t;
typedef uint16_t u16_t;
typedef uint8_t u8_t;
/* These macros should be calculated by the preprocessor and are used
with compile-time constants only (so that there is no little-endian
overhead at runtime). */
#define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
#define PP_NTOHS(x) PP_HTONS(x)
#define PP_HTONL(x) ((((x) & 0xff) << 24) | \
(((x) & 0xff00) << 8) | \
(((x) & 0xff0000UL) >> 8) | \
(((x) & 0xff000000UL) >> 24))
#define PP_NTOHL(x) PP_HTONL(x)
/* Socket family */
#define AF_UNSPEC 0
#define AF_INET 2
#define PF_INET AF_INET
#define PF_UNSPEC AF_UNSPEC
/* Socket protocol types (TCP/UDP/RAW) */
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define SOCK_RAW 3
#define IPPROTO_IP 0
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define IPPROTO_UDPLITE 136
/* Shutdown how */
#ifndef SHUT_RD
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#endif
/*
* Level number for (get/set)sockopt() to apply to socket itself.
*/
#define SOL_SOCKET 0xfff /* options for socket level */
/*
* Option flags per-socket. These must match the SOF_ flags in ip.h (checked in init.c)
*/
#define SO_DEBUG 0x0001 /* Unimplemented: turn on debugging info recording */
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* Allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_DONTROUTE 0x0010 /* Unimplemented: just use interface addresses */
#define SO_BROADCAST 0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
#define SO_USELOOPBACK 0x0040 /* Unimplemented: bypass hardware when possible */
#define SO_LINGER 0x0080 /* linger on close if data present */
#define SO_OOBINLINE 0x0100 /* Unimplemented: leave received OOB data in line */
#define SO_REUSEPORT 0x0200 /* Unimplemented: allow local address & port reuse */
#define SO_DONTLINGER ((int)(~SO_LINGER))
/*
* Additional options, not kept in so_options.
*/
#define SO_SNDBUF 0x1001 /* Unimplemented: send buffer size */
#define SO_RCVBUF 0x1002 /* receive buffer size */
#define SO_SNDLOWAT 0x1003 /* Unimplemented: send low-water mark */
#define SO_RCVLOWAT 0x1004 /* Unimplemented: receive low-water mark */
#define SO_SNDTIMEO 0x1005 /* Unimplemented: send timeout */
#define SO_RCVTIMEO 0x1006 /* receive timeout */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
#define SO_CONTIMEO 0x1009 /* Unimplemented: connect timeout */
#define SO_NO_CHECK 0x100a /* don't create UDP checksum */
struct in_addr {
u32_t s_addr;
};
/* This is the aligned version of ip_addr_t,
used as local variable, on the stack, etc. */
struct ip_addr {
u32_t addr;
};
typedef struct ip_addr ip_addr_t;
/** 255.255.255.255 */
#define IPADDR_NONE ((u32_t)0xffffffffUL)
/** IPv4 only: set the IP address given as an u32_t */
#define ip4_addr_set_u32(dest_ipaddr, src_u32) ((dest_ipaddr)->addr = (src_u32))
/** IPv4 only: get the IP address as an u32_t */
#define ip4_addr_get_u32(src_ipaddr) ((src_ipaddr)->addr)
/* members are in network byte order */
struct sockaddr_in {
u8_t sin_len;
u8_t sin_family;
u16_t sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
struct sockaddr {
u8_t sa_len;
u8_t sa_family;
char sa_data[14];
};
int socket(int domain, int type, int protocol);
int bind(int sockfd, struct sockaddr *my_addr, int addrlen);
int connect(int sockfd, struct sockaddr *serv_addr, int addrlen);
int listen(int sockfd, int backlog);
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int send(int sockfd, const void *buf, int len, int flags);
int recv(int sockfd, void *buf, int len, unsigned int flags);
int sendto(int sockfd, const void *buf, int len, unsigned int flags,
const struct sockaddr *to, int tolen);
int recvfrom(int sockfd, void *buf, int len, unsigned int flags,
struct sockaddr *from, int *fromlen);
int sockread(int sockfd, void *buf, size_t len);
int sockwrite(int sockfd, const void *buf, size_t len);
int shutdown(int sockfd, int how);
int sockclose(int sockfd);
int getpeername(int sockfd, struct sockaddr *serv_addr, socklen_t *addrlen);
int getsockname(int sockfd, struct sockaddr *my_addr, socklen_t *addrlen);
int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
int sockioctl(int sockfd, int request, void *arg);
int sockfcntl(int sockfd, int cmd, long arg);
//int select(int maxfdp, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
#define inet_addr(cp) _ipaddr_addr(cp)
u32_t
_ipaddr_addr(const char *cp);
#endif /* _SYS_SOCKET_H */ | [
"[email protected]"
] | |
fd1b388f66e2d27a1e367c2265db461631a8fc15 | 4cba6096a61c0ccda0adfa0e3de6b9402c93a005 | /gimp/data/blueprints/back/usr/include/x86_64-linux-gnu/asm/kvm.h | e1e7ab4c3ed458ba3e974700dc7e467858e8a5d2 | [] | no_license | StanfordSNR/gg-results | da3de3ce52235c187c6178b0ceab32df2526abf5 | 16ac020603e4b1ef96b2d8c27d1683724cbb30b8 | refs/heads/master | 2021-08-06T16:11:06.747488 | 2019-01-05T21:41:24 | 2019-01-05T21:41:24 | 103,858,663 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 2,011 | h | // GGHASH:VamoA5TGh_jZR7ybL.zDpyUvxYB854EVPa7WYnjgbvEo00001bc1
#ifndef _ASM_X86_KVM_H
#define _ASM_X86_KVM_H
#include <linux/types.h>
#include <linux/ioctl.h>
#define KVM_PIO_PAGE_OFFSET 1
#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
#define DE_VECTOR 0
#define DB_VECTOR 1
#define BP_VECTOR 3
#define OF_VECTOR 4
#define BR_VECTOR 5
#define UD_VECTOR 6
#define NM_VECTOR 7
#define DF_VECTOR 8
#define TS_VECTOR 10
#define NP_VECTOR 11
#define SS_VECTOR 12
#define GP_VECTOR 13
#define PF_VECTOR 14
#define MF_VECTOR 16
#define AC_VECTOR 17
#define MC_VECTOR 18
#define XM_VECTOR 19
#define VE_VECTOR 20
#define __KVM_HAVE_PIT
#define __KVM_HAVE_IOAPIC
#define __KVM_HAVE_IRQ_LINE
#define __KVM_HAVE_MSI
#define __KVM_HAVE_USER_NMI
#define __KVM_HAVE_GUEST_DEBUG
#define __KVM_HAVE_MSIX
#define __KVM_HAVE_MCE
#define __KVM_HAVE_PIT_STATE2
#define __KVM_HAVE_XEN_HVM
#define __KVM_HAVE_VCPU_EVENTS
#define __KVM_HAVE_DEBUGREGS
#define __KVM_HAVE_XSAVE
#define __KVM_HAVE_XCRS
#define __KVM_HAVE_READONLY_MEM
#define KVM_NR_INTERRUPTS 256
#define KVM_IOAPIC_NUM_PINS 24
#define KVM_IRQCHIP_PIC_MASTER 0
#define KVM_IRQCHIP_PIC_SLAVE 1
#define KVM_IRQCHIP_IOAPIC 2
#define KVM_NR_IRQCHIPS 3
#define KVM_RUN_X86_SMM (1 << 0)
#define KVM_APIC_REG_SIZE 0x400
#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0)
#define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1)
#define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2)
#define KVM_GUESTDBG_USE_SW_BP 0x00010000
#define KVM_GUESTDBG_USE_HW_BP 0x00020000
#define KVM_GUESTDBG_INJECT_DB 0x00040000
#define KVM_GUESTDBG_INJECT_BP 0x00080000
#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
#define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001
#define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
#define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
#define KVM_VCPUEVENT_VALID_SMM 0x00000008
#define KVM_X86_SHADOW_INT_MOV_SS 0x01
#define KVM_X86_SHADOW_INT_STI 0x02
#define KVM_MAX_XCRS 16
#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
#endif
| [
"[email protected]"
] | |
bd77cdc3ce5ba1f1de1328b1e42ed6530882c081 | 719c0bf5f224b3558719c85011cfba27cf2463a2 | /sdk/docs/doxygen/source/doc_license.h | b74b6e61350398fb794d21dae16d5857763f750e | [
"DOC",
"Zlib"
] | permissive | tstavrianos/angelscript | 02b03b48facd6f2afb669c4336b699eb070c1c7b | 1b188559812a8f281020c9128ad9650ccd10782b | refs/heads/master | 2020-03-25T03:13:12.764127 | 2019-10-22T18:51:21 | 2019-10-22T18:51:21 | 143,329,120 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 999 | h | /**
\page doc_license License
\section doc_lic_1 AngelCode Scripting Library
Copyright © 2003-2019 Andreas Jönsson
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
<ol>
<li>The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
<li>Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
<li>This notice may not be removed or altered from any source
distribution.
</ol>
*/
| [
"angelcode@404ce1b2-830e-0410-a2e2-b09542c77caf"
] | angelcode@404ce1b2-830e-0410-a2e2-b09542c77caf |
464ed034e494884bae58b58114892f211f268b25 | 93ec90cc5c55c5fcd802b16be0584e06ef1609cd | /C_ProgrammingLessons/03_12_return1.c | b2e684318e3defc46105ae90bd000dcf4f63479c | [] | no_license | emzan/C_ProgrammingLessons | 26b2735dbc7b78dee302c5d10dd04ff0e1fea869 | 7f52838a6c176590b898a5483a6155915cf73bb6 | refs/heads/master | 2021-04-27T19:49:27.865879 | 2018-03-04T02:13:35 | 2018-03-04T02:13:35 | 122,364,860 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 222 | c | #include <stdio.h>
char gimmeAnA(void);
int main()
{
char grade;
grade = gimmeAnA();
printf("On this test you received an %c.\n",grade);
return (0);
}
char gimmeAnA(void)
{
return('A');
}
| [
"[email protected]"
] | |
910146b0d0c255e9b84efbb7fb1f58066c2c6c8f | 805666a84218be543410ff5089588f1572dd20ec | /d/xingxiu/obj/yujian.c | b8fe679e5e6b0940a11c76ed167961fda97c668e | [] | no_license | mudchina/xkx2001 | d47a9caca686ab7c89fe0b9140fbaf9d3601e1f5 | 4e8f8a13a72884d5dbe4b589542eb34e29e89d70 | refs/heads/master | 2021-01-10T06:50:29.517433 | 2016-02-20T14:09:12 | 2016-02-20T14:09:12 | 52,156,038 | 24 | 23 | null | null | null | null | GB18030 | C | false | false | 633 | c | //Cracked by Roath
// jadesword.c 玉剑
#include <ansi.h>
#include <weapon.h>
inherit SWORD;
void create()
{
set_name(HIW"玉剑"NOR, ({ "jade sword", "jian", "sword" }));
set_weight(2500);
if (clonep())
set_default_object(__FILE__);
else {
set("unit", "柄");
set("long", "一柄白色长剑,是白玉所造成,刃口磨得很是锋锐,和钢铁兵器不相上下。\n");
set("value", 10000);
set("material", "jade");
set("rigidity", -10);
set("wield_msg", "$N「唰」的一声抽出一柄$n握在手中。\n");
set("unwield_msg", "$N将手中的$n插回剑鞘。\n");
}
init_sword(25);
setup();
}
| [
"[email protected]"
] | |
d3f76ca16198dca2f55032a304cd8a13d9e23f82 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/dc97abbc-aef8-4a78-8039-2d4626928546.c | 6a05209f9ef6988a5c48c4308e58c329ed881100 | [] | 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 | 606 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=4;
int j=11;
int k;
int l;
j = 533;
l = 64;
k = i/j;
l = i/j;
l = i/j;
l = j/j;
l = k%j;
l = l-j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
int b[53];
int c[92];
a = 0;
do {
a++;
/* START BUFFER SET */
*((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 ));
/* END BUFFER SET */
//random
} while(( a - 1 ) < strlen(b));
/* END VULNERABILITY */
printf("%d%d\n",k,i);
return 0;
}
| [
"[email protected]"
] | |
8e5b222142b56ab2e18c596ddd97ece179933598 | 5b69b19b6cfcc1cd1528be9f3286396c04510dbd | /mediatek/custom/e6902/kernel/leds/mt65xx/cust_leds.c | 7835d5feceb91c319a518880afc3640667d12796 | [] | no_license | bq/edison-3 | 54c65a515c417943037a0cc7135261287ef0eba9 | d4971e1bb170321893348739dad16f28c3c93fc7 | HEAD | 2016-09-10T22:58:07.001997 | 2015-11-18T09:09:04 | 2015-11-18T09:09:04 | 27,552,861 | 3 | 3 | null | null | null | null | UTF-8 | C | false | false | 4,624 | c | #include <cust_leds.h>
#include <cust_leds_def.h>
#include <mach/mt_pwm.h>
#include <linux/kernel.h>
#include <mach/pmic_mt6329_hw_bank1.h>
#include <mach/pmic_mt6329_sw_bank1.h>
#include <mach/pmic_mt6329_hw.h>
#include <mach/pmic_mt6329_sw.h>
#include <mach/upmu_common_sw.h>
#include <mach/upmu_hw.h>
extern int disp_bls_set_backlight(unsigned int level);
// Only support 64 levels of backlight (when lcd-backlight = MT65XX_LED_MODE_PWM)
#define BACKLIGHT_LEVEL_PWM_64_FIFO_MODE_SUPPORT 64
// Support 256 levels of backlight (when lcd-backlight = MT65XX_LED_MODE_PWM)
#define BACKLIGHT_LEVEL_PWM_256_SUPPORT 256
// Configure the support type "BACKLIGHT_LEVEL_PWM_256_SUPPORT" or "BACKLIGHT_LEVEL_PWM_64_FIFO_MODE_SUPPORT" !!
#define BACKLIGHT_LEVEL_PWM_MODE_CONFIG BACKLIGHT_LEVEL_PWM_256_SUPPORT
unsigned int Cust_GetBacklightLevelSupport_byPWM(void)
{
return BACKLIGHT_LEVEL_PWM_MODE_CONFIG;
}
unsigned int brightness_mapping(unsigned int level)
{
unsigned int mapped_level;
mapped_level = level;
return mapped_level;
}
/*
unsigned int Cust_SetBacklight(int level, int div)
{
kal_uint32 ret=0;
// mtkfb_set_backlight_pwm(div);
// mtkfb_set_backlight_level(brightness_mapping(level));
* To explain How to set these para for cust_led_list[] of led/backlight
* "name" para: led or backlight
* "mode" para:which mode for led/backlight
* such as:
* MT65XX_LED_MODE_NONE,
* MT65XX_LED_MODE_PWM,
* MT65XX_LED_MODE_GPIO,
* MT65XX_LED_MODE_PMIC,
* MT65XX_LED_MODE_CUST_LCM,
* MT65XX_LED_MODE_CUST_BLS_PWM
*
*"data" para: control methord for led/backlight
* such as:
* MT65XX_LED_PMIC_LCD_ISINK=0,
* MT65XX_LED_PMIC_NLED_ISINK0,
* MT65XX_LED_PMIC_NLED_ISINK1,
* MT65XX_LED_PMIC_NLED_ISINK2,
* MT65XX_LED_PMIC_NLED_ISINK3
*
*"PWM_config" para:PWM(AP side Or BLS module), by default setting{0,0,0,0,0} Or {0}
*struct PWM_config {
* int clock_source;
* int div;
* int low_duration;
* int High_duration;
* BOOL pmic_pad;//AP side PWM pin in PMIC chip (only 89 needs confirm); 1:yes 0:no(default)
*};
*-------------------------------------------------------------------------------------------
* for AP PWM setting as follow:
*1. PWM config data
* clock_source: clock source frequency, can be 0/1
* div: clock division, can be any value within 0~7 (i.e. 1/2^(div) = /1, /2, /4, /8, /16, /32, /64, /128)
* low_duration: only for BACKLIGHT_LEVEL_PWM_64_FIFO_MODE_SUPPORT
* High_duration: only for BACKLIGHT_LEVEL_PWM_64_FIFO_MODE_SUPPORT
*
*2. PWM freq.
* If BACKLIGHT_LEVEL_PWM_MODE_CONFIG = BACKLIGHT_LEVEL_PWM_256_SUPPORT,
* PWM freq. = clock source / 2^(div) / 256
*
* If BACKLIGHT_LEVEL_PWM_MODE_CONFIG = BACKLIGHT_LEVEL_PWM_64_FIFO_MODE_SUPPORT,
* PWM freq. = clock source / 2^(div) / [(High_duration+1)(Level')+(low_duration+1)(64 - Level')]
* = clock source / 2^(div) / [(High_duration+1)*64] (when low_duration = High_duration)
*Clock source:
* 0: block clock/1625 = 26M/1625 = 16K (MT6571)
* 1: block clock = 26M (MT6571)
*Div: 0~7
*
*For example, in MT6571, PWM_config = {1,1,0,0,0}
* ==> PWM freq. = 26M/2^1/256 = 50.78 KHz ( when BACKLIGHT_LEVEL_PWM_256_SUPPORT )
* ==> PWM freq. = 26M/2^1/(0+1)*64 = 203.13 KHz ( when BACKLIGHT_LEVEL_PWM_64_FIFO_MODE_SUPPORT )
*-------------------------------------------------------------------------------------------
* for BLS PWM setting as follow:
*1. PWM config data
* clock_source: clock source frequency, can be 0/1/2/3
* div: clock division, can be any value within 0~1023
* low_duration: non-use
* High_duration: non-use
* pmic_pad: non-use
*
*2. PWM freq.= clock source / (div + 1) /1024
*Clock source:
* 0: 26 MHz
* 1: 104 MHz
* 2: 124.8 MHz
* 3: 156 MHz
*Div: 0~1023
*
*By default, clock_source = 0 and div = 0 => PWM freq. = 26 KHz
*-------------------------------------------------------------------------------------------
*/
static struct cust_mt65xx_led cust_led_list[MT65XX_LED_TYPE_TOTAL] = {
{"red", MT65XX_LED_MODE_PMIC, MT65XX_LED_PMIC_NLED_ISINK1,{0}},
{"green", MT65XX_LED_MODE_PMIC, MT65XX_LED_PMIC_NLED_ISINK0,{0}},
{"blue", MT65XX_LED_MODE_PMIC, MT65XX_LED_PMIC_NLED_ISINK2,{0}},
{"jogball-backlight", MT65XX_LED_MODE_NONE, -1,{0}},
{"keyboard-backlight",MT65XX_LED_MODE_NONE, -1,{0}},
{"button-backlight", MT65XX_LED_MODE_NONE, -1,{0}},
{"lcd-backlight", MT65XX_LED_MODE_CUST_BLS_PWM, (int)disp_bls_set_backlight,{0,0,0,0,0}},
};
struct cust_mt65xx_led *get_cust_led_list(void)
{
return cust_led_list;
}
| [
"[email protected]"
] | |
691456b36a5168a1811cf39b40001440aa10276f | de21f9075f55640514c29ef0f1fe3f0690845764 | /regression/contracts-dfcc/assigns_enforce_havoc_object/main.c | 072c4bc9dcebee9c780d4af4487f43b611135537 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-4-Clause"
] | permissive | diffblue/cbmc | 975a074ac445febb3b5715f8792beb545522dc18 | decd2839c2f51a54b2ad0f3e89fdc1b4bf78cd16 | refs/heads/develop | 2023-08-31T05:52:05.342195 | 2023-08-30T13:31:51 | 2023-08-30T13:31:51 | 51,877,056 | 589 | 309 | NOASSERTION | 2023-09-14T18:49:17 | 2016-02-16T23:03:52 | C++ | UTF-8 | C | false | false | 712 | c | #include <assert.h>
#include <stdlib.h>
int x = 0;
typedef struct stc
{
int i;
int j;
} stc;
typedef struct stb
{
stc *c;
} stb;
typedef struct sta
{
union
{
stb *b;
int i;
int j;
} u;
} sta;
int nondet_int();
void bar(sta *a)
{
if(nondet_bool())
return;
__CPROVER_havoc_object(a->u.b->c);
return;
}
void foo(sta *a1, sta *a2) __CPROVER_assigns(__CPROVER_object_whole(a1->u.b->c))
{
bar(a1);
bar(a2);
return;
}
sta *allocate_sta()
{
stc *c = malloc(sizeof(*c));
stb *b = malloc(sizeof(*b));
sta *a = malloc(sizeof(*a));
b->c = c;
a->u.b = b;
return a;
}
int main()
{
sta *a1 = allocate_sta();
sta *a2 = allocate_sta();
foo(a1, a2);
return 0;
}
| [
"[email protected]"
] | |
feebba75f338ef05c6d94d5c173e994b6e84ad83 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/drivers/net/ethernet/chelsio/cxgb4/extr_cudbg_lib.c_cudbg_get_mem_region.c | 21eab4e2c087c4dbb261a48780d9e61cb0894248 | [] | 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 | 2,323 | 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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
struct cudbg_meminfo {size_t mem_c; TYPE_2__* mem; TYPE_1__* avail; } ;
struct cudbg_mem_desc {int dummy; } ;
struct adapter {int dummy; } ;
struct TYPE_4__ {size_t idx; scalar_t__ limit; scalar_t__ base; } ;
struct TYPE_3__ {scalar_t__ base; scalar_t__ limit; } ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ *) ;
int EINVAL ;
int cudbg_meminfo_get_mem_index (struct adapter*,struct cudbg_meminfo*,size_t,size_t*) ;
int /*<<< orphan*/ * cudbg_region ;
int /*<<< orphan*/ memcpy (struct cudbg_mem_desc*,TYPE_2__*,int) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char const*) ;
__attribute__((used)) static int cudbg_get_mem_region(struct adapter *padap,
struct cudbg_meminfo *meminfo,
u8 mem_type, const char *region_name,
struct cudbg_mem_desc *mem_desc)
{
u8 mc, found = 0;
u32 i, idx = 0;
int rc;
rc = cudbg_meminfo_get_mem_index(padap, meminfo, mem_type, &mc);
if (rc)
return rc;
for (i = 0; i < ARRAY_SIZE(cudbg_region); i++) {
if (!strcmp(cudbg_region[i], region_name)) {
found = 1;
idx = i;
break;
}
}
if (!found)
return -EINVAL;
found = 0;
for (i = 0; i < meminfo->mem_c; i++) {
if (meminfo->mem[i].idx >= ARRAY_SIZE(cudbg_region))
continue; /* Skip holes */
if (!(meminfo->mem[i].limit))
meminfo->mem[i].limit =
i < meminfo->mem_c - 1 ?
meminfo->mem[i + 1].base - 1 : ~0;
if (meminfo->mem[i].idx == idx) {
/* Check if the region exists in @mem_type memory */
if (meminfo->mem[i].base < meminfo->avail[mc].base &&
meminfo->mem[i].limit < meminfo->avail[mc].base)
return -EINVAL;
if (meminfo->mem[i].base > meminfo->avail[mc].limit)
return -EINVAL;
memcpy(mem_desc, &meminfo->mem[i],
sizeof(struct cudbg_mem_desc));
found = 1;
break;
}
}
if (!found)
return -EINVAL;
return 0;
} | [
"[email protected]"
] | |
3707a68b51744133db9d311436d8f1eaf1484d13 | 06e40eabf2c8d5de5f4457e4a3dab4b148c2d52d | /ports/w600/chip/driver/wm_i2c.c | 178f22cb2b674f8e69d3f72f4b5f90e34f30db44 | [
"MIT"
] | permissive | purencai/micropython-1 | 65d68225269f3da245ef676aebef5a6d7fe77d76 | d810656717e9faa8f0e8c2bc45c1cdc820062ea0 | refs/heads/master | 2020-05-17T17:30:51.314908 | 2019-04-16T13:35:59 | 2019-04-16T13:35:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,105 | c | /**************************************************************************//**
* @file wm_i2c.c
* @author
* @version
* @date
* @brief
*
* Copyright (c) 2014 Winner Microelectronics Co., Ltd. All rights reserved.
*****************************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "wm_regs.h"
#include "wm_i2c.h"
#include "wm_cpu.h"
#include "wm_irq.h"
#define I2C_FREQ_MAX (400000)
#define I2C_FREQ_MIN (100000)
#define I2C_WRITE (0x80)
#define I2C_READ (0x00)
typedef struct {
uint8_t addr;
uint8_t dev_addr;
uint8_t state;
uint8_t *buf;
uint16_t len;
uint16_t cnt;
uint8_t cmd;
void (*transfer_done)(void);
} i2c_desc;
enum {
START,
RESTART,
TRANSMIT,
PRERECEIVE,
RECEIVE,
STOP,
DONE,
IDLE,
};
static i2c_desc i2c_transfer;
void tls_i2c_init(u32 freq)
{
u32 div = 0;
tls_sys_clk clk;
if (freq < I2C_FREQ_MIN)
{
freq = I2C_FREQ_MIN;
}
else if (freq > I2C_FREQ_MAX)
{
freq = I2C_FREQ_MAX;
}
tls_sys_clk_get(&clk);
div = (clk.apbclk * 1000000)/(5 * freq) - 1;
tls_reg_write32(HR_I2C_PRER_LO, div & 0xff);
tls_reg_write32(HR_I2C_PRER_HI, (div>>8) & 0xff);
/** enable I2C | Disable Int*/
tls_reg_write32(HR_I2C_CTRL, I2C_CTRL_INT_DISABLE | I2C_CTRL_ENABLE);
tls_irq_enable(I2C_IRQn);
}
/**
* @brief send stop signal
*
*/
void tls_i2c_stop(void)
{
tls_reg_write32(HR_I2C_CR_SR, I2C_CR_STO);
while(tls_reg_read32(HR_I2C_CR_SR) & I2C_SR_TIP);
}
/**
* @brief waiting for ack signal
* @retval
* - \ref WM_FAILED
* - \ref WM_SUCCESS
*/
int tls_i2c_wait_ack(void)
{
u16 errtime=0;
u32 value;
while(tls_reg_read32(HR_I2C_CR_SR) & I2C_SR_TIP);
value = tls_reg_read32(HR_I2C_CR_SR);
while(value & I2C_SR_NAK)
{
errtime ++;
if(errtime > 512)
{
// printf("wait ack err\n");
tls_i2c_stop();
return WM_FAILED;
}
value = tls_reg_read32(HR_I2C_CR_SR);
}
return WM_SUCCESS;
}
/**
* @brief writes the data to data register of I2C module
* when \ifstart one the start signal will be sent followed by the \data
* when \ifstart zero only the \data will be send
* @param[in] data the data will be write to the data register of I2C module
* @param[in] ifstart when one send start signal, when zero don't
* @retval
*
*/
void tls_i2c_write_byte(u8 data,u8 ifstart)
{
tls_reg_write32(HR_I2C_TX_RX, data);
if(ifstart)
tls_reg_write32(HR_I2C_CR_SR, I2C_CR_STA | I2C_CR_WR);
else
tls_reg_write32(HR_I2C_CR_SR, I2C_CR_WR);
while(tls_reg_read32(HR_I2C_CR_SR) & I2C_SR_TIP);
}
/**
* @brief get the data stored in data register of I2C module
* @param[in] ifack when one send ack after reading the data register,when zero don't
* @param[in] ifstop when one send stop signal after read, when zero do not send stop
* @retval the received data
*/
u8 tls_i2c_read_byte(u8 ifack,u8 ifstop)
{
u8 data;
u32 value = I2C_CR_RD;
if(!ifack)
value |= I2C_CR_NAK;
if(ifstop)
value |= I2C_CR_STO;
tls_reg_write32(HR_I2C_CR_SR, value);
/** Waiting finish */
while(tls_reg_read32(HR_I2C_CR_SR) & I2C_SR_TIP);
data = tls_reg_read32(HR_I2C_TX_RX);
return data;
}
/**
* @brief start write through int mode
* @param[in] devaddr the device address
* @param[in] wordaddr when one send stop signal after read, when zero do not send stop
* @param[in] buf the address point where data shoule be stored
* @param[in] len the length of data will be received
* @retval
* - \ref WM_FAILED
* - \ref WM_SUCCESS
*/
int wm_i2c_start_write_it(uint8_t devaddr, uint8_t wordaddr, uint8_t * buf, uint16_t len)
{
if (buf == NULL)
{
return WM_FAILED;
}
I2C->TX_RX = devaddr;
i2c_transfer.dev_addr = devaddr;
i2c_transfer.state = START;
i2c_transfer.cmd = I2C_WRITE;
i2c_transfer.buf = buf;
i2c_transfer.len = len;
i2c_transfer.cnt = 0;
i2c_transfer.addr = wordaddr;
I2C->CR_SR = I2C_CR_STA | I2C_CR_WR;
return WM_SUCCESS;
}
/**
* @brief start read through int mode
* @param[in] devaddr the device address
* @param[in] wordaddr when one send stop signal after read, when zero do not send stop
* @param[in] buf the address point where data shoule be stored
* @param[in] len the length of data will be received
* @retval
* - \ref WM_FAILED
* - \ref WM_SUCCESS
*/
int wm_i2c_start_read_it(uint8_t devaddr, uint8_t wordaddr, uint8_t * buf, uint16_t len)
{
if (buf == NULL)
{
return WM_FAILED;
}
I2C->TX_RX = devaddr;
i2c_transfer.dev_addr = devaddr;
i2c_transfer.state = START;
i2c_transfer.cmd = I2C_READ;
i2c_transfer.buf = buf;
i2c_transfer.len = len;
i2c_transfer.cnt = 0;
i2c_transfer.addr = wordaddr;
I2C->CR_SR = I2C_CR_STA | I2C_CR_WR;
return WM_SUCCESS;
}
/**
* @brief This function is used to register i2c transfer done callback function.
* @param[in] done is the i2c transfer done callback function.
* @retval None
* @note None
*/
void wm_i2c_transfer_done_register(void (*done)(void))
{
i2c_transfer.transfer_done = done;
}
void I2C_IRQHandler(void)
{
int i2c_sr;
i2c_sr = I2C->CR_SR;
I2C->CR_SR = 1;
if (i2c_sr & 0x20)
{
printf("I2C AL lost\r\n");
}
if (i2c_sr & 0x01)
{
if ((i2c_sr & 0x80) == 0)
{
switch(i2c_transfer.state)
{
case START:
I2C->TX_RX = i2c_transfer.addr;
I2C->CR_SR = I2C_CR_WR;
if ((i2c_transfer.cmd & I2C_WRITE) == I2C_WRITE)
{
i2c_transfer.state = TRANSMIT;
}
else
{
i2c_transfer.state = RESTART;
}
break;
case RESTART:
I2C->TX_RX = (i2c_transfer.dev_addr | 0x01);
I2C->CR_SR = (I2C_CR_STA | I2C_CR_WR);
i2c_transfer.state = PRERECEIVE;
break;
case TRANSMIT:
I2C->TX_RX = i2c_transfer.buf[i2c_transfer.cnt++];
I2C->CR_SR = I2C_CR_WR;
if (i2c_transfer.cnt == i2c_transfer.len)
{
i2c_transfer.state = STOP;
}
break;
case PRERECEIVE:
i2c_transfer.state = RECEIVE;
I2C->CR_SR = I2C_CR_RD;
break;
case RECEIVE:
i2c_transfer.buf[i2c_transfer.cnt++] = I2C->TX_RX;
if (i2c_transfer.cnt == (i2c_transfer.len - 1))
{
I2C->CR_SR = (I2C_CR_STO | I2C_CR_NAK | I2C_CR_RD);
i2c_transfer.state = STOP;
}
else if (i2c_transfer.len == 1)
{
I2C->CR_SR = (I2C_CR_STO | I2C_CR_NAK | I2C_CR_RD);
i2c_transfer.state = DONE;
if (i2c_transfer.transfer_done)
{
i2c_transfer.transfer_done();
}
}
else
{
I2C->CR_SR = I2C_CR_RD;
}
break;
case STOP:
I2C->CR_SR = I2C_CR_STO;
i2c_transfer.state = DONE;
if (i2c_transfer.transfer_done)
{
i2c_transfer.transfer_done();
}
break;
}
}
else
{
if ((i2c_transfer.state == STOP) && i2c_transfer.cmd != I2C_WRITE)
{
i2c_transfer.buf[i2c_transfer.cnt] = I2C->TX_RX;
i2c_transfer.state = DONE;
if (i2c_transfer.transfer_done)
{
i2c_transfer.transfer_done();
}
}
}
}
// if ((i2c_sr & 0x40) == 0)
// {
// i2c_transfer.state = IDLE;
// }
}
/*** (C) COPYRIGHT 2014 Winner Microelectronics Co., Ltd. ***/
| [
"[email protected]"
] | |
2567a606ba923e260fd44dc49b60e948615c6693 | 63c8abf02d738ec62a9ec49fa5d5204d6b3fb2ec | / scope-ocr --username [email protected]/tess-two/eyes-two/jni/hydrogen/include/leptonica/bmf.h | 6ed6e076e0d69b7251ebbe64f80379be250fe525 | [
"CC-BY-3.0",
"Apache-2.0"
] | permissive | salmangadit/scope | 84c5d5e7a227af3cc015a67e6330728d20d5eac5 | d4d4feae21e30beed513cf3ad55d23d28eeaf06a | refs/heads/master | 2021-01-19T02:44:11.788730 | 2016-06-23T13:13:19 | 2016-06-23T13:13:19 | 26,875,576 | 1 | 0 | null | 2016-06-23T13:13:19 | 2014-11-19T18:35:48 | D | UTF-8 | C | false | false | 2,526 | h | /*====================================================================*
- Copyright (C) 2001 Leptonica. All rights reserved.
- This software is distributed in the hope that it will be
- useful, but with NO WARRANTY OF ANY KIND.
- No author or distributor accepts responsibility to anyone for the
- consequences of using this software, or for whether it serves any
- particular purpose or works at all, unless he or she says so in
- writing. Everyone is granted permission to copy, modify and
- redistribute this source code, for commercial or non-commercial
- purposes, with the following restrictions: (1) the origin of this
- source code must not be misrepresented; (2) modified versions must
- be plainly marked as such; and (3) this notice may not be removed
- or altered from any source or modified source distribution.
*====================================================================*/
#ifndef LEPTONICA_BMF_H
#define LEPTONICA_BMF_H
/*
* bmf.h
*
* Simple data structure to hold bitmap fonts and related data
*/
/* Constants for deciding when text block is divided into paragraphs */
enum {
SPLIT_ON_LEADING_WHITE = 1, /* tab or space at beginning of line */
SPLIT_ON_BLANK_LINE = 2, /* newline with optional white space */
SPLIT_ON_BOTH = 3 /* leading white space or newline */
};
struct L_Bmf
{
struct Pixa *pixa; /* pixa of bitmaps for 93 characters */
l_int32 size; /* font size (in points at 300 ppi) */
char *directory; /* directory containing font bitmaps */
l_int32 baseline1; /* baseline offset for ascii 33 - 57 */
l_int32 baseline2; /* baseline offset for ascii 58 - 91 */
l_int32 baseline3; /* baseline offset for ascii 93 - 126 */
l_int32 lineheight; /* max height of line of chars */
l_int32 kernwidth; /* pixel dist between char bitmaps */
l_int32 spacewidth; /* pixel dist between word bitmaps */
l_int32 vertlinesep; /* extra vertical space between text lines */
l_int32 *fonttab; /* table mapping ascii --> font index */
l_int32 *baselinetab; /* table mapping ascii --> baseline offset */
l_int32 *widthtab; /* table mapping ascii --> char width */
};
typedef struct L_Bmf L_BMF;
#endif /* LEPTONICA_BMF_H */
| [
"[email protected]"
] | |
2fda2511696a19ebd6d5c1903d65cb2240952c97 | 3db023edb0af1dcf8a1da83434d219c3a96362ba | /windows_nt_3_5_source_code/NT-782/PRIVATE/NET/SOCKETS/SOCKREG/LOCAL.H | c70af4af7cbe50b96424a52aa29a65338d2601d6 | [] | no_license | xiaoqgao/windows_nt_3_5_source_code | de30e9b95856bc09469d4008d76191f94379c884 | d2894c9125ff1c14028435ed1b21164f6b2b871a | refs/heads/master | 2022-12-23T17:58:33.768209 | 2020-09-28T20:20:18 | 2020-09-28T20:20:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,074 | h | /*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
local.h
Abstract:
Common header file for all sockutil modules.
Author:
David Treadwell (davidtr) 5-06-92
Revision History:
--*/
#ifndef _LOCAL_
#define _LOCAL_
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#define NOGDI
#define NOMINMAX
#include <windows.h>
#include <winsock.h>
#include <sys/stropts.h>
#include <ntstapi.h>
#include <direct.h>
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <winsock.h>
#include <sys/types.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <ctype.h>
#include <malloc.h>
#include <process.h>
#include <sys\uio.h>
#include "..\libuemul\uemul.h"
#include "sockreg.h"
struct netent *
getnetent(
void
);
void
s_perror(
char *yourmsg, // your message to be displayed
int lerrno // errno to be converted
);
#define perror(string) s_perror(string, (int)GetLastError())
#endif // _LOCAL_
| [
"[email protected]"
] | |
89d5b68f50799f128246026b5e42097e070133fe | e9dfe13e813320ce346307164dd52616f11ff88e | /Específicos/Repaso (final)/Modelos/Primer Parcial/P_P1_2010_3_02/Ejercicio 4/funciones.c | af80e9e3b6a4df9594bb62c0f60676376597541f | [] | no_license | Squiro/progra-unlam | 4b4ecb622e426b71f7e3cfbcba51cb804ece9940 | 117e9419561739c1de8f440c36325acd726de0ba | refs/heads/master | 2021-01-08T02:01:24.124541 | 2020-08-31T14:59:19 | 2020-08-31T14:59:19 | 241,879,398 | 4 | 1 | null | null | null | null | UTF-8 | C | false | false | 678 | c | #include "funciones.h"
int chequearSuma(float mat[][TAM], int fil, int col)
{
return sumaTriangularInferior(mat, fil, col) == sumaTriangularSuperior(mat, fil, col);
}
float sumaTriangularSuperior(float mat[][TAM], int fil, int col)
{
float suma = 0;
int i, j;
for (i = 0; i < fil; i++)
for (j = i; j < col; j++)
suma += mat[i][j];
printf("SUMA SUP: %f\n", suma);
return suma;
}
float sumaTriangularInferior(float mat[][TAM], int fil, int col)
{
float suma = 0;
int i, j;
for (i = 0; i < fil; i++)
for (j = 0; j <= i; j++)
suma += mat[i][j];
printf("SUMA INF: %f\n", suma);
return suma;
}
| [
"[email protected]"
] | |
418efd6cca6d415dae8ae39692b302da0866eae3 | 4128b2191e2a63c3fcd284548869fd09daa628a2 | /Work/ConsoleApplication9/ConsoleApplication9/ex09-05(예시).c | c84556470c8f40438d8a82605d76b442cb9472fe | [] | no_license | yeona98/project_C | 7ae77fb941bfef34f414aa9885556acee57461bc | 8396196aa83332a0094c948493b55c544cce3ff5 | refs/heads/master | 2021-09-06T06:31:28.685947 | 2018-02-03T07:03:33 | 2018-02-03T07:03:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 570 | c | #include <stdio.h>
#include <stdlib.h>
int Add(int x, int y)
{
return x + y;
}
int Sub(int x, int y)
{
return x - y;
}
int Mul(int x, int y)
{
return x * y;
}
double Div(int x, int y)
{
return (double)x / y;
}
void main(void)
{
int a = 0, b = 0;
int sum = 0;
printf("First num : ");
scanf("%d", &a);
printf("Second num :");
scanf("%d", &b);
sum = Add(a, b);
printf("Add : %d\n", sum);
sum = Sub(a, b);
printf("Sub : %d\n", sum);
sum = Mul(a, b);
printf("Mul : %d\n", sum);
double r = Div(a, b);
printf("Div : %f\n", r);
system("pause");
} | [
"[email protected]"
] | |
9b84d249b13b6190b026dd9130db54ab00fd4647 | f3e813535f75fb461e2306f1ad18596ac233e758 | /odb_api_bundle-0.17.6-Source/odb/src/tools/mr2d_create.c | 1d84c5d85d8853231694e9421582cd047871e28c | [] | no_license | vyesubabu/metview | 47f9de3eb5f1bf418e513ed306aa2279635b79c7 | 74c2b9bc28673001fd02e00194e92c53a897fb62 | refs/heads/master | 2021-05-17T16:42:41.697859 | 2018-04-09T15:08:19 | 2018-04-09T15:08:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,835 | c | #include "mr2d_hdr.h"
static char program[]="mr2d_create";
/*
mr2d_create: Creates a MR2D-concatenated file from given input file(s)
Notes: Works only in a single processor mode i.e.
no parallel $MRFSDIR access is available on VPP
*/
#define USAGE \
"mr2d_create -i input_file[.%d]\n" \
" -o output_file\n" \
" -n number_of_input_files_in_connection_with_%d_format\n" \
" -r read_buf_size\n" \
" -w write_buf_size\n" \
" -p preallocation_size (VPP only)\n" \
" -e extent_size (VPP only)\n" \
" -v [verbose output]\n" \
" -A [input files are concatenated in ascending order]\n" \
" -D [input files are concatenated in descending order; the default]\n" \
" -V [print version number of the software]\n" \
" -help"
#define FLAGS "ADe:hi:n:o:p:r:vVw:"
#define CHECK_ERROR(f,n) if (rc != (n)) { perror(f); return(1); }
#define mr2d_create main
int mr2d_create(int argc, char *argv[])
{
int rc, fs;
FILE *fp_out;
int verbose = 0;
int print_version = 0;
int extent = 0;
int prealloc = 0;
int readbufsize = 0;
int writebufsize = 0;
int descending = 1;
int nfiles = 0;
char *infile = NULL;
char *outfile = NULL;
IObuf in, out;
unsigned int mr2dword = MR2D;
unsigned int numchunks = 0;
unsigned int *hdr = NULL;
int hdrsize;
unsigned int *index = NULL;
unsigned int *chunk = NULL;
int j, k;
int c;
int errflg = 0;
extern char *optarg;
extern int optind;
/* Get command line options */
while ((c = getopt(argc, argv, FLAGS)) != -1) {
switch (c) {
case 'A':
descending = 0;
break;
case 'D':
descending = 1;
break;
case 'e':
extent = atoi(KiloMegaGiga(optarg));
extent = MAX(0,extent);
break;
case 'i':
infile = STRDUP(optarg);
break;
case 'n':
nfiles = atoi(optarg);
nfiles = MAX(0,nfiles);
break;
case 'o':
outfile = STRDUP(optarg);
break;
case 'p':
prealloc = atoi(KiloMegaGiga(optarg));
prealloc = MAX(0,prealloc);
break;
case 'r':
readbufsize = atoi(KiloMegaGiga(optarg));
readbufsize = MAX(-1,readbufsize);
break;
case 'v':
verbose = 1;
break;
case 'V':
print_version = 1;
break;
case 'w':
writebufsize = atoi(KiloMegaGiga(optarg));
writebufsize = MAX(0,writebufsize);
break;
case 'h':
errflg++;
break;
default:
case '?':
errflg++;
break;
}
}
if (print_version) {
fprintf(stderr,"%s: Version %s, on %s %s %s\n",
program, vers, time_str, date_str, system_name);
fprintf(stderr,"Copyright (c) 1998 ECMWF. All Rights Reserved.\n");
}
if (!infile) errflg++;
if (!outfile) errflg++;
if (argc != optind) errflg++;
if (nfiles <= 0) errflg++;
if (errflg) {
fprintf(stderr,"%s\n",USAGE);
return(errflg);
}
numchunks = nfiles;
hdrsize = 2 + 2 * numchunks;
/* Open the output file */
fp_out = fopen_prealloc(outfile,"w",prealloc,extent);
if (!fp_out) {
perror(outfile);
return(1);
}
/* Obtain input file sizes */
if (has_no_percent_sign(infile)) {
char *p;
ALLOC(p, strlen(infile) + 20);
strcpy(p,infile);
strcat(p,".%d");
FREE(infile);
infile = p;
}
/* Calculate chunk sizes */
ALLOC(hdr, hdrsize);
ALLOC(index, numchunks);
ALLOC(chunk, numchunks);
if (descending) {
k = 0;
for (j=numchunks; j>=1; j--) {
index[k] = j;
k++;
}
}
else {
for (j=1; j<=numchunks; j++) {
index[j-1] = j;
}
}
for (j=0; j<numchunks; j++) {
char *file;
ALLOC(file, strlen(infile) + 20);
sprintf(file,infile,index[j]);
chunk[j] = filesize(file);
FREE(file);
}
hdr[0] = mr2dword;
hdr[1] = numchunks;
k = 2;
for (j=0; j<numchunks; j++) {
hdr[k + 0] = index[j];
hdr[k + 1] = chunk[j];
k += 2;
}
fs = hdrsize * sizeof(unsigned int);
for (j=0; j<numchunks; j++) {
fs += chunk[j];
}
if (writebufsize > 0 || writebufsize == -1) {
out.len = (writebufsize == -1) ? fs : writebufsize;
out.len = MIN(out.len, fs);
SETBUF(fp_out, out);
}
else {
out.len = 0;
out.p = NULL;
}
rc = fwrite(hdr, sizeof(unsigned int), hdrsize, fp_out);
CHECK_ERROR(outfile,hdrsize);
FREE(hdr);
/* Read in file-by-file and write to the file */
if (verbose) {
printf("%s: Concatenating input files to the '%s'\n",program,outfile);
printf("Writing order %s\n",descending ? "descending" : "ascending");
for (j=0; j<numchunks; j++) {
printf("Chunk#%d for PE#%d : size = %d bytes\n",
j+1,index[j],chunk[j]);
}
}
for (j=0; j<numchunks; j++) {
unsigned char *data;
int datasize;
char *file;
FILE *fp_in;
ALLOC(file, strlen(infile) + 20);
sprintf(file,infile,index[j]);
datasize = chunk[j];
if (verbose) {
printf("Reading %d bytes from the file '%s' ...\n",
datasize,file);
}
fp_in = fopen(file,"r");
if (!fp_in) {
perror(file);
return(1);
}
if (readbufsize == -1) readbufsize = datasize;
if (readbufsize > 0) {
in.len = MIN(readbufsize,datasize);
SETBUF(fp_in, in);
}
else {
in.len = 0;
in.p = NULL;
}
ALLOC(data, datasize);
rc = fread(data, sizeof(unsigned char), datasize, fp_in);
CHECK_ERROR(infile,datasize);
rc = fwrite(data, sizeof(unsigned char), datasize, fp_out);
CHECK_ERROR(file,datasize);
fclose(fp_in);
FREEIOBUF(in);
FREE(data);
FREE(file);
}
fclose(fp_out);
FREEIOBUF(out);
FREE(index);
FREE(chunk);
return(0);
}
| [
"[email protected]"
] | |
a513a8f5d15a65c23be6bf0da1beed29dd6bfcf6 | 2de3a81ae3989467d5d51f4c583e88603efc9d4e | /orca/hawk/rts/include/po/pdg.h | 2d279b0f6cf8707c0aa4ab518a77dafeaf7aecdf | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive"
] | permissive | Abhiroop/orca | 087e9b1ff50c0f99bfbf0da14cae4ae448a35351 | a51a1e09f98af04f73701bce8160d41e9ba04c12 | refs/heads/master | 2020-06-17T09:07:01.379914 | 2019-07-08T19:17:27 | 2019-07-08T19:17:27 | 195,872,398 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,115 | h | #ifndef __pdg__
#define __pdg__
#include "sys_po.h"
#include "misc.h"
#include "graph.h"
struct pdg_s {
graph_p graph;
int with_rdeps; /* Number of partitions with remote dependencies. */
int with_ldeps; /* Number of partitions with no remote dependencies. */
int *nrdeps; /* Number of remote dependencies for each partition. */
int *ldeps; /* Partitions that have local dependencies only. */
int *rdeps; /* Partitions that have remote dependencies. */
boolean valid; /* Indicates whether all platforms have the same pdg. */
};
int init_pdg(int moi, int gsize, int pdebug);
int finish_pdg(void);
pdg_p new_pdg(int num_partitions);
int free_pdg(pdg_p pdg);
int print_pdg(pdg_p pdg);
int add_edge(pdg_p pdg, int source, int sowner, int destination, int downer);
int remove_edge(pdg_p pdg, int source, int sowner, int destination, int downer);
int *get_remote_dependencies(pdg_p, int *with_rdeps);
int *get_local_dependencies(pdg_p, int *with_ldeps);
int analyze_pdg(pdg_p);
void build_deps(pdg_p pdg, int *owner);
void *marshall_pdg(pdg_p);
pdg_p unmarshall_pdg(void *buffer);
#endif
| [
"[email protected]"
] | |
545600c352fd0188d1cbdf0d3f8e9c8e804463dc | 8e377046f9a1dd9ea369ceb9e9e4d4a194f5d064 | /firebirdsrc/sjtubbs/branch/fleg/1128/httpd/bbstdoc.c | 85654b5e555d2987233c54ee25d6cbf8a3ee8d11 | [] | no_license | teracs/thegreatnykz | 67c937fdcba145927f9bd30a10f33475d83f306b | 0065d7872641e5caaf40dbb38b3ae1ffc95c2770 | refs/heads/master | 2021-05-30T03:21:20.154961 | 2013-12-21T12:20:55 | 2013-12-21T12:20:55 | 13,188,715 | 1 | 0 | null | null | null | null | GB18030 | C | false | false | 3,943 | c | #include "www.h"
char *stat1();
int bbstdoc_main()
{
FILE *fp;
char board[80], dir[80];
struct shortfile *x1;
struct fileheader *data;
int i, start, total2 = 0, total, sum = 0;
init_all();
strsncpy(board, getparm("board"), 32);
x1 = getbcache(board);
if (x1 == 0)
http_fatal("错误的讨论区");
strcpy(board, x1->filename);
if (!has_read_perm(¤tuser, board))
http_fatal("错误的讨论区");
printf("<body>\n");
//u_info->board=getbnum(board);
sprintf(dir, "boards/%s/.DIR", board);
fp = fopen(dir, "r");
if (fp == 0)
http_fatal("错误的讨论区目录");
total = file_size(dir) / sizeof(struct fileheader);
data = calloc(sizeof(struct fileheader), total);
if (data == 0)
http_fatal("内存溢出");
total = fread(data, sizeof(struct fileheader), total, fp);
fclose(fp);
for (i = 0; i < total; i++)
if (strncmp(data[i].title, "Re:", 3))
total2++;
start = atoi(getparm("start"));
if (strlen(getparm("start")) == 0 || start > total2 - 19)
start = total2 - 19;
if (start < 0)
start = 0;
printf("<nobr><center>\n");
printf
("%s -<font class=\"title\"> 主题阅读 </font>[讨论区: %s] 板主[%s] 文章%d, 主题%d个<hr>\n",
BBSNAME, board, userid_str(x1->BM), total, total2);
if (total <= 0)
http_fatal("本讨论区目前没有文章");
printf("<table width=670>\n");
//printf("<tr bgcolor=e8e8e8><td>序号<td>状态<td>作者<td width=72>日期<td>标题<td>回帖/人气\n");
printf
("<tr bgcolor=e8e8e8><td>序号<td>状态<td>作者<td width=100>日期<td>标题<td>回帖/人气\n");
for (i = 0; i < total; i++)
{
if (!strncmp(data[i].title, "Re:", 3))
continue;
if (data[i].title[0] == 0)
continue;
sum++;
if (sum - 1 < start)
continue;
if (sum - 1 > start + 19)
break;
printf("<tr><td>%d<td>%s<td>%s",
sum, flag_str(data[i].accessed[0]),
userid_str(data[i].owner));
printf("<td>%12.12s", Ctime(atoi(data[i].filename + 2)) + 4);
printf("<td><a href=bbstcon?board=%s&file=%s>○ %s </a><td>%s",
board, data[i].filename,
void1(nohtml2(data[i].title)), stat1(data, i, total));
}
printf("</table><hr>\n");
if (start > 0)
printf("<a href=bbstdoc?board=%s&start=%d>上一页</a> ", board,
start - 19);
if (start < total2 - 19)
printf("<a href=bbstdoc?board=%s&start=%d>下一页</a> ", board,
start + 19);
printf("<a href=bbsnot?board=%s>进板画面</a> ", board);
printf("<a href=bbsdoc?board=%s>一般模式</a> ", board);
printf("<a href=bbsgdoc?board=%s>文摘区</a> ", board);
printf("<a href=bbs0an?path=%s>精华区</a> ", anno_path_of(board));
// printf("<a href=/an/%s.tar.gz>下载精华区</a> ", board);
printf("<a href=bbspst?board=%s>发表文章</a> <br>\n", board);
free(data);
printf
("<form action=bbstdoc?board=%s method=post onsubmit='this.start.value-=1'>\n",
board);
printf
("<input type=submit value=跳转到> 第 <input type=text name=start size=4> 篇");
printf("</form>\n");
http_quit();
}
char *stat1(struct fileheader *data, int from, int total)
{
static char buf[256];
char *ptr = data[from].title;
int i, re = 0, click = *(int *) (data[from].title + 73);
for (i = from; i < total; i++)
{
if (!strncmp(ptr, data[i].title + 4, 40))
{
re++;
data[i].title[0] = 0;
click += *(int *) (data[i].title + 73);
}
}
sprintf(buf, "<font color=%s>%d</font>/<font color=%s>%d</font>",
re > 9 ? "red" : "black", re, click > 499 ? "red" : "black",
click);
return buf;
}
| [
"[email protected]"
] | |
11eeeca4d63d5745324adb4cd47c75601b52827c | b10d7eba9647afcbe44a43f9feb87c5e8118ec13 | /ADC_sharp.cydsn/codegentemp/project.h | d4f1ab54c344ddfad1e32268ac78661ef5f65bd4 | [] | no_license | NRDaza/Sharp-Psoc5- | b0502036f1ddc68c21cc6fc84c5181c36a66df2e | a2ff1de9cd860643c0451f0c39fd800673ca27be | refs/heads/master | 2020-04-29T00:41:29.925439 | 2019-03-14T22:42:34 | 2019-03-14T22:42:34 | 175,703,912 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,525 | h | /*******************************************************************************
* File Name: project.h
*
* PSoC Creator 4.2
*
* Description:
* It contains references to all generated header files and should not be modified.
* This file is automatically generated by PSoC Creator.
*
********************************************************************************
* Copyright (c) 2007-2018 Cypress Semiconductor. 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.
********************************************************************************/
#include "cyfitter_cfg.h"
#include "cydevice.h"
#include "cydevice_trm.h"
#include "cyfitter.h"
#include "cydisabledsheets.h"
#include "ADC.h"
#include "Opamp.h"
#include "LCD.h"
#include "Sharp_aliases.h"
#include "Sharp.h"
#include "RS_aliases.h"
#include "RS.h"
#include "E_aliases.h"
#include "E.h"
#include "D4_aliases.h"
#include "D4.h"
#include "D5_aliases.h"
#include "D5.h"
#include "D6_aliases.h"
#include "D6.h"
#include "D7_aliases.h"
#include "D7.h"
#include "ADC_AMux.h"
#include "ADC_Ext_CP_Clk.h"
#include "ADC_IRQ.h"
#include "ADC_theACLK.h"
#include "LCD_Cntl_Port.h"
#include "cy_em_eeprom.h"
#include "core_cm3_psoc5.h"
#include "CyDmac.h"
#include "CyFlash.h"
#include "CyLib.h"
#include "cypins.h"
#include "cyPm.h"
#include "CySpc.h"
#include "cytypes.h"
/*[]*/
| [
"[email protected]"
] | |
4b01755d75dc6d1d5b12e79a03dca165c2f945da | 7eb688b16098d66ff9c21f5aa5589c7a05766036 | /src/frtos_skeleton/task_function.h | 5fa1857777e0fa454a47852ddb9c9acb1e12add9 | [] | no_license | xxxMIBCxxx/RX65N_FreeRTOS_ADPCM | 71e2805ba29084cc0dc379714e1c8da2a0d0753b | 3c0e508794a29f0a51f70331c578a7e5a150a3b5 | refs/heads/master | 2022-12-22T15:05:59.772541 | 2020-09-27T12:28:51 | 2020-09-27T12:28:51 | 299,026,980 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,701 | 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 WARRANTIES REGARDING
* 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) 2019 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
#ifndef TASK_FUNCTION_H_
#define TASK_FUNCTION_H_
void Task_Usb(void * pvParameters);
void Task_Adpcm(void * pvParameters);
#endif /* TASK_FUNCTION_H_ */
| [
"[email protected]"
] | |
4e38c95918a57663cf03d6126a4d45f4224749d5 | 0c5d3b088080577388f5766431487534f93a2c40 | /Github-Projects-Origin/emscripten-master/system/lib/libc/musl/src/env/__init_security.c.bak.c | c0cd7d3056ffbe4f8c3b8a4113037133c41a52d9 | [] | no_license | zhiyuanjia/WoBench | 878255ce45e76ef57f88743c7f43acdfa59e93e7 | 6b337780cbd598de98fc0eabd19efaf1a01b6012 | refs/heads/master | 2021-09-23T03:12:08.091319 | 2018-06-14T10:17:59 | 2018-06-14T10:17:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 669 | c | #include <assert.h>
#include <string.h>
#define INCLUDEMAIN
#include <elf.h>
#include <poll.h>
#include <fcntl.h>
#include "syscall.h"
#include "libc.h"
#include "atomic.h"
static void dummy(void *ent)
{
}
weak_alias(dummy, __init_ssp);
void __init_security(size_t *aux)
{
struct pollfd pfd[3] = { {.fd=0}, {.fd=1}, {.fd=2} };
int i;
#ifndef SHARED
__init_ssp((void *)aux[AT_RANDOM]);
#endif
if (aux[AT_UID]==aux[AT_EUID] && aux[AT_GID]==aux[AT_EGID]
&& !aux[AT_SECURE]) return;
__syscall(SYS_poll, pfd, 3, 0);
for (i=0; i<3; i++) if (pfd[i].revents&POLLNVAL)
if (__syscall(SYS_open, "/dev/null", O_RDWR|O_LARGEFILE)<0)
a_crash();
libc.secure = 1;
}
| [
"[email protected]"
] | |
971af9a46691fb0785b59e0d712db9eb90cc42fe | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/5b749b56-07b5-45e2-b4bf-158eb610a980.c | 6b979457a7a6fcd5de1db3e5a7cd631543e76945 | [] | 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 | 590 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=0;
int j=22;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = i/j;
l = l/j;
l = i%j;
l = j-j;
k = i-k*i;
//variables
/* START VULNERABILITY */
int a;
int b[11];
int c[36];
a = 0;
while (b[( a - 1 )] != 0) {
a++;
//random
/* START BUFFER SET */
*((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 ));
/* END BUFFER SET */
//random
}
/* END VULNERABILITY */
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
d2dbd4d5d9905b409fd4e89930b0080f55be1701 | 10e64f8dca0b596b339169f80c8706edb51eed9f | /linux-devkit/sysroots/x86_64-arago-linux/usr/share/ti/cgt-c6x/lib/src/bcmp.c | 478ad2da10bbbc9a0438cdc44fc069dcf2c88d72 | [] | no_license | wangy2000/LeezBoard_TI5708 | 264cea03d04402cf14714e35f1ca9efd4a1ef7cb | 1c0e92c5b61de16f8d8aeb86852c9d53ed99ac58 | refs/heads/master | 2020-06-16T22:01:26.340391 | 2019-04-23T13:21:54 | 2019-04-23T13:21:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,929 | c | /****************************************************************************/
/* bcmp v8.2.2 */
/* */
/* Copyright (c) 2012-2017 Texas Instruments Incorporated */
/* http://www.ti.com/ */
/* */
/* 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. */
/* */
/****************************************************************************/
#undef _INLINE
#define _STRINGS_IMPLEMENTATION
#define _BCMP
#include <strings.h>
| [
"[email protected]"
] | |
c008835be4604e5eb94648f22d07cb7f2e3b1d4b | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/51cadbfd-1858-4a95-a760-f2cc2df2d1ab.c | 08b22e94381c489d3f826368ba0d53d53d7e7d59 | [] | 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 | 539 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
k = 53;
l = 54;
k = i/j;
l = i/j;
l = l/j;
l = l-j;
k = k-k*i;
//variables
/* START VULNERABILITY */
int a;
int b[60];
int c[20];
a = 0;
while (( a - 1 ) > -1) {
a--;
/* START BUFFER SET */
*((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 ));
/* END BUFFER SET */
}
/* END VULNERABILITY */
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
9d1194bc0fdfeee15cf7c023f487b35c0d13bc53 | 34499e81e35bb4328fa901bd9f9ac1874c409414 | /0x0B-malloc_free/3-alloc_grid.c | 7e05ecb95c56b83875cee70f5fac66dd0b29e9dc | [] | no_license | maroua199525/holbertonschool-low_level_programming | 189d5236cf774c739bf2f4ccad09d92ceaf4f819 | c7316391fc3bfe9e165bdd93f000a9d3f5d8bfbf | refs/heads/master | 2023-07-20T01:10:41.729240 | 2021-09-01T20:25:00 | 2021-09-01T20:25:00 | 335,627,260 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 609 | c | #include "holberton.h"
#include <stdlib.h>
/**
* alloc_grid - create an array of integers
*@width:integer
*@height:integer
*Return: 0
*/
int **alloc_grid(int width, int height)
{
int i, j, k;
int **array;
if (width <= 0 || height <= 0)
return (NULL);
array = malloc(sizeof(int *) * height);
if (array == NULL)
return (NULL);
for (i = 0; i < height; i++)
{
array[i] = malloc(width * sizeof(int));
if (array[i] == NULL)
{
for (k = 0; k < i; k++)
free(array[k]);
free(array);
return (NULL);
}
for (j = 0; j < width; j++)
{
array[i][j] = 0;
}
}
return (array);
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.