blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
333
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
58
| license_type
stringclasses 2
values | repo_name
stringlengths 5
113
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 604
values | visit_date
timestamp[us]date 2016-08-02 21:20:34
2023-09-06 10:17:08
| revision_date
timestamp[us]date 1970-01-01 00:00:00
2023-09-05 20:12:54
| committer_date
timestamp[us]date 1970-01-01 00:00:00
2023-09-05 20:12:54
| github_id
int64 966
664M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[us]date 2012-06-18 16:43:44
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-02-03 21:17:16
2023-07-07 15:57:14
⌀ | gha_language
stringclasses 121
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 128
17.8k
| extension
stringclasses 134
values | content
stringlengths 128
8.19k
| authors
listlengths 1
1
| author_id
stringlengths 1
143
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
016c154fcf69032ff39b53a878318ce02d79d98a | 43fc37d7211d538eb6681aa871fb99892a7d711a | /unix/errno.c | 6e8166e795c39b05819e0cdf55da858826af7369 | [] | no_license | gyhdtc/Unix_Systems_Programming | 6f9fcaa82eb694e56f01674f44be34ba7920c085 | 95bee106d7d17a754be94e61a55a34569f3cc6db | refs/heads/master | 2020-05-24T22:25:12.807771 | 2019-05-30T17:30:58 | 2019-05-30T17:30:58 | 187,496,659 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 618 | c | #include <unistd.h>
#include <stdio.h>
/* 对应于全局的错误信息变量 */
int errno;
int fildes;
/*
EBADF fildes 无效
EINTR close 信号中断
*/
int close(int fildes);
char *strerror(int errnum)
{
}
void perror(const char *s)
{
int error;
if (s != NULL)
{
error = errno;
fprintf(stderr, "%s descriptor %d: %s\n",s, fildes, strerror(errno));
// 输出对应于 errno 的错误信息
errno = error;
}
}
int main()
{
//while((errno = close(fildes) == -1) && (errno == EINTR));
if (close(fildes) == -1)
perror("Failed to close the file");
} | [
"[email protected]"
] | |
9c35a3a7f4cd15da9170af7613e86e7fd9484d24 | 9ee564c7022f5c2bc5715e153d66829d2e706e3e | /gyros/rt1020_gyro_test/cdh_prototype - Copy/gnc_build/FSW_Lib_ert_rtw/mrdivide_helper_23K2DU9e.c | 7b523d211c8a8f2ea03c8f10c0a6fa565ab376d5 | [] | no_license | william-pope/soci_gnc_capstone | cc974ed1fb52d258f7cfd209382f3a8c6dfe323e | a31e2061095960eabf6afd201c64375c5288c2f0 | refs/heads/main | 2023-05-26T14:21:54.361159 | 2021-06-11T06:57:49 | 2021-06-11T06:57:49 | 375,930,018 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,070 | c | /*
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* File: mrdivide_helper_23K2DU9e.c
*
* Code generated for Simulink model 'FSW_Lib'.
*
* Model version : 1.319
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Wed Feb 17 22:19:10 2021
*/
#include "rtwtypes.h"
#include <math.h>
#include <string.h>
#include "mrdivide_helper_23K2DU9e.h"
/* Function for MATLAB Function: '<S19>/QR_factorization' */
void mrdivide_helper_23K2DU9e(real_T A[36], const real_T B_0[36])
{
real_T b_A[36];
int8_T ipiv[6];
int32_T j;
int32_T ix;
real_T smax;
real_T s;
int32_T iy;
int32_T c_ix;
int32_T d;
int32_T ijA;
int32_T jBcol;
int32_T kBcol;
memcpy(&b_A[0], &B_0[0], 36U * sizeof(real_T));
for (d = 0; d < 6; d++) {
ipiv[d] = (int8_T)(1 + d);
}
for (j = 0; j < 5; j++) {
jBcol = j * 7;
iy = 0;
ix = jBcol;
smax = fabs(b_A[jBcol]);
for (kBcol = 2; kBcol <= 6 - j; kBcol++) {
ix++;
s = fabs(b_A[ix]);
if (s > smax) {
iy = kBcol - 1;
smax = s;
}
}
if (b_A[jBcol + iy] != 0.0) {
if (iy != 0) {
iy += j;
ipiv[j] = (int8_T)(iy + 1);
ix = j;
for (kBcol = 0; kBcol < 6; kBcol++) {
smax = b_A[ix];
b_A[ix] = b_A[iy];
b_A[iy] = smax;
ix += 6;
iy += 6;
}
}
iy = (jBcol - j) + 6;
for (ix = jBcol + 1; ix < iy; ix++) {
b_A[ix] /= b_A[jBcol];
}
}
iy = jBcol;
ix = jBcol + 6;
for (kBcol = 0; kBcol <= 4 - j; kBcol++) {
if (b_A[ix] != 0.0) {
smax = -b_A[ix];
c_ix = jBcol + 1;
d = (iy - j) + 12;
for (ijA = 7 + iy; ijA < d; ijA++) {
b_A[ijA] += b_A[c_ix] * smax;
c_ix++;
}
}
ix += 6;
iy += 6;
}
}
for (j = 0; j < 6; j++) {
jBcol = 6 * j;
iy = 6 * j;
for (ix = 0; ix < j; ix++) {
kBcol = 6 * ix;
smax = b_A[ix + iy];
if (smax != 0.0) {
for (c_ix = 0; c_ix < 6; c_ix++) {
d = c_ix + jBcol;
A[d] -= smax * A[c_ix + kBcol];
}
}
}
smax = 1.0 / b_A[j + iy];
for (iy = 0; iy < 6; iy++) {
d = iy + jBcol;
A[d] *= smax;
}
}
for (j = 5; j >= 0; j--) {
jBcol = 6 * j;
iy = 6 * j - 1;
for (ix = j + 2; ix < 7; ix++) {
kBcol = (ix - 1) * 6;
smax = b_A[ix + iy];
if (smax != 0.0) {
for (c_ix = 0; c_ix < 6; c_ix++) {
A[c_ix + jBcol] -= smax * A[c_ix + kBcol];
}
}
}
}
for (j = 4; j >= 0; j--) {
if (j + 1 != ipiv[j]) {
jBcol = ipiv[j] - 1;
for (iy = 0; iy < 6; iy++) {
smax = A[6 * j + iy];
A[iy + 6 * j] = A[6 * jBcol + iy];
A[iy + 6 * jBcol] = smax;
}
}
}
}
/*
* File trailer for generated code.
*
* [EOF]
*/
| [
"[email protected]"
] | |
c343e8bb1cd220c306e96a3d3b5d5002cf2cff75 | 93f635bbef282f8dcfbbfa682aec2c206e68f7b7 | /beginner_level_and_uva/13-3a-ii.c | e5f97af4c4e284d6babbcade47b2973648b2cbb2 | [] | no_license | Alimurrazi/Programming | 6ba828ea15e640f70311fab33cce1a6e9190db45 | cd4354616596d6c7865f4ccd835b1c0712f41c45 | refs/heads/master | 2023-08-01T14:23:31.342302 | 2021-09-14T03:53:50 | 2021-09-14T03:53:50 | 107,748,091 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 356 | c | #include<stdio.h>
#include<string.h>
int main()
{
int ara[30];
char str[30];
char str1[30];
int length,i,j,count=0;
gets(str);
length=strlen(str);
strcpy(str1,str);
for(i=0;i<length;i++)
{
if (str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
ara[i]++;}
printf(" %d",ara);
//str1[i]=str[i];
//count++;}
return 0;
}
| [
"[email protected]"
] | |
5f276c889afb5c8eef45b1ba9ebf65168cbc8fd3 | 2485f380b5e32ee950fb84e3ae4e1698e7c7eeb2 | /rt-smart/kernel/bsp/imx6ull/libs/lvgl/driver/lv_port_disp.c | 241d4c05bee04b35fad6065ee0127e6a99b5c560 | [
"Apache-2.0"
] | permissive | lkdingbao/rt_smart_imx6ull | e3ccade131125d92bced1bb3cabe963af7b393f8 | 4d9879e3d543a4e4ddd4b73ce0d30668127f5c5a | refs/heads/master | 2023-04-20T18:05:40.788109 | 2021-05-01T05:07:41 | 2021-05-01T05:07:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,810 | c | /**
* @file lv_port_disp_templ.c
*
*/
/*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/
#if 1
/*********************
* INCLUDES
*********************/
#include "lv_port_disp.h"
#include "bsp_lcdapi.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void disp_init(void);
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
#if LV_USE_GPU
static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color);
#endif
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_port_disp_init(void)
{
/*-------------------------
* Initialize your display
* -----------------------*/
disp_init();
/*-----------------------------
* Create a buffer for drawing
*----------------------------*/
/* LVGL requires a buffer where it internally draws the widgets.
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your display.
* The buffer has to be greater than 1 display row
*
* There are three buffering configurations:
* 1. Create ONE buffer with some rows:
* LVGL will draw the display's content here and writes it to your display
*
* 2. Create TWO buffer with some rows:
* LVGL will draw the display's content to a buffer and writes it your display.
* You should use DMA to write the buffer's content to the display.
* It will enable LVGL to draw the next part of the screen to the other buffer while
* the data is being sent form the first buffer. It makes rendering and flushing parallel.
*
* 3. Create TWO screen-sized buffer:
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
* whole frame to display. This way you only need to change the frame buffer's address instead of
* copying the pixels.
* */
static lv_disp_buf_t draw_buf;
static uint32_t frame_swap_buf[2][LV_HOR_RES_MAX*LV_VER_RES_MAX];
lv_disp_buf_init(&draw_buf, &frame_swap_buf[0], &frame_swap_buf[1], LV_HOR_RES_MAX*LV_VER_RES_MAX);
/*-----------------------------------
* Register the display in LVGL
*----------------------------------*/
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
/*Set the resolution of the display*/
disp_drv.hor_res = _g_lcd_info.width;
disp_drv.ver_res = _g_lcd_info.height;
/*Used to copy the buffer's content to the display*/
disp_drv.flush_cb = disp_flush;
/*Set a display buffer*/
disp_drv.buffer = &draw_buf;
#if LV_USE_GPU
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
/*Blend two color array using opacity*/
disp_drv.gpu_blend_cb = gpu_blend;
/*Fill a memory array with a color*/
disp_drv.gpu_fill_cb = gpu_fill;
#endif
/*Finally register the driver*/
lv_disp_drv_register(&disp_drv);
}
/**********************
* STATIC FUNCTIONS
**********************/
/* Initialize your display and the required peripherals. */
static void disp_init(void)
{
/*You code here*/
}
/* Flush the content of the internal buffer the specific area on the display
* You can use DMA or any hardware acceleration to do this operation in the background but
* 'lv_disp_flush_ready()' has to be called when finished. */
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
lcd_fill((uint32_t*)color_p, (uint32_t*)_g_lcd_info.fb_virt, _g_lcd_info.width*_g_lcd_info.height*_g_lcd_info.pxsz);
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
}
/*OPTIONAL: GPU INTERFACE*/
#if LV_USE_GPU
/* If your MCU has hardware accelerator (GPU) then you can use it to blend to memories using opacity
* It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{
/*It's an example code which should be done by your GPU*/
uint32_t i;
for(i = 0; i < length; i++) {
dest[i] = lv_color_mix(dest[i], src[i], opa);
}
}
/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color
* It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color)
{
/*It's an example code which should be done by your GPU*/
int32_t x, y;
dest_buf += dest_width * fill_area->y1; /*Go to the first line*/
for(y = fill_area->y1; y <= fill_area->y2; y++) {
for(x = fill_area->x1; x <= fill_area->x2; x++) {
dest_buf[x] = color;
}
dest_buf+=dest_width; /*Go to the next line*/
}
}
#endif /*LV_USE_GPU*/
#else /* Enable this file at the top */
/* This dummy typedef exists purely to silence -Wpedantic. */
typedef int keep_pedantic_happy;
#endif
| [
"[email protected]"
] | |
d29a8b623415e99f933a035efa718a6dca9d55b1 | acb8d4c4f974d872f31997f591fea4d748f94b93 | /p/fystreet/street5101.c | 017e49202366e7868fd02ae99bd11e660847308d | [] | no_license | MudRen/SZMUD | 8ae6b05718b1a83363478469185e0d776b0fda5c | e3b46e6efa6d353f7f0d00ef676f97d5c0ec3949 | refs/heads/master | 2023-05-27T16:04:35.845610 | 2021-06-18T12:47:19 | 2021-06-18T12:47:19 | 361,736,744 | 1 | 2 | null | null | null | null | GB18030 | C | false | false | 582 | c | #define ID 5101
#include <ansi.h>
inherit ROOM;
void create()
{ set("short",HIW"空地"NOR);
set("long",@LONG
这是拥挤的城市中难得一见的开阔地,不过,这里已经被打扫干净,
看上去正在寻找买家呢。想在这里拥有一套自己的房间可不容易,必须要
缴纳一大笔的购地款。
LONG );
set("roomid",ID);
if(ID%2) set("exits",(["east":__DIR__"street"+(string)(ID/100),]));
else set("exits",(["west":__DIR__"street"+(string)(ID/100),]));
set("coor/x",40+(ID%2)*20);
set("coor/y",20+(ID/100)*10);
set("coor/z",0);
setup();
} | [
"[email protected]"
] | |
007c18ba4a6e8da13363e19aca338c35fb60f965 | 7aa75215614411567b89382cd79e076b3360b654 | /.history/tpfinal-estructuras1/libs/shell_20201207105634.c | a29f0f98b644db9a7bb5e8aa3c6348badfc6043e | [
"Apache-2.0"
] | permissive | IgnacioKase/estructura-datos-1 | 7060173b2ddb7853bd68f199bd3b39048242c482 | 2a0be56a6546a214c011ccc38774b7625885cfd5 | refs/heads/master | 2021-04-17T11:29:00.419081 | 2020-12-10T02:06:21 | 2020-12-10T02:06:21 | 249,441,692 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,067 | c | #include "shell.h"
/* Funcion auxiliar para switch sobre los comandos
de longitud mayor a 1 */
SimpleCommands match_simple_command(char* comando) {
if (!strcmp(comando, "cargar_dataset"))
return DFS;
if (!strcmp(comando, "imprimir_dataset"))
return BFS;
if (!strcmp(comando, "imprimir_dataset"))
return BFS;
if (!strcmp(comando, "agregar_registro"))
return BFS;
if (!strcmp(comando, "eliminar_registro"))
return BFS;
if (!strcmp(comando, "buscar_pico"))
return BFS;
if (!strcmp(comando, "salir"))
return SALIR;
if (!strcmp(comando, "help"))
return HELP;
if (!strcmp(comando, "print"))
return IMPRIMIR2D;
return -1;
}
/* Funcion auxiliar para switch sobre los comandos
de longitud 1 */
IntervalCommands match_interval_command(char comando) {
if (comando == 'i')
return INSERTAR;
if (comando == 'e')
return ELIMINAR;
if (comando == '?')
return INTERSECAR;
return -1;
}
// Informacion sobre los comandos posibles
void help() {
printf("\nComandos:\n");
printf("i [a,b]: inserta el intervalo [a,b] en el arbol\n");
printf("e [a,b]: elimina el intervalo [a,b] del arbol\n");
printf("? [a,b]: interseca el intervalo [a,b] ");
printf("con los intervalos del arbol\n");
printf("dfs: imprime los intervalos del arbol ");
printf("con recorrido primero en profundidad\n");
printf("bfs: imprime los intervalos del arbol ");
printf("con recorrido primero a lo ancho\n");
printf("print: imprime los intervalos en forma de arbol\n");
printf("salir: destruye el arbol y termina el programa\n\n");
printf("Recuerde que los intervalos deben contener numeros\n\n");
}
// Procesamiento de los comandos que no reciben intervalo
int shell_simple_command(char comando[6], ITree itree) {
int continuar = 1;
switch (match_simple_command(comando)) {
case DFS:
itree_recorrer_dfs(itree, ITREE_RECORRIDO_IN, intervalo_imprimir);
puts("");
break;
case BFS:
itree_recorrer_bfs(itree, intervalo_imprimir);
puts("");
break;
case SALIR:
continuar = 0;
break;
case HELP:
help();
break;
case IMPRIMIR2D:
itree_imprimir_2d(itree);
break;
default:
printf("ERROR: comando invalido.\n");
printf("Ingrese 'help' para informacion sobre los comandos.\n");
break;
}
return continuar;
}
// Procesamiento de los comandos que reciben intervalo
ITree shell_interval_command(char comando[6], double* arg, ITree itree) {
/* los comandos que reciben intervalo tienen 1 caracter
y se debe chequear que el intervalo sea valido
(que el final no sea menor al comienzo) */
if (!intervalo_es_valido(arg)) {
printf("ERROR: intervalo invalido.\n");
printf("El extremo izquierdo no puede superar al derecho\n");
return itree;
}
if (strlen(comando) != 1) {
printf("ERROR: comando invalido.\n");
printf("Ingrese 'help' para informacion sobre los comandos.\n");
return itree;
}
switch (match_interval_command(comando[0])) {
case INSERTAR:
itree = itree_insertar(itree, arg);
break;
case ELIMINAR:
itree = itree_eliminar(itree, arg);
break;
case INTERSECAR:
if (itree_intersecar(itree, arg))
printf("Si\n");
else
printf("No\n");
break;
default:
printf("ERROR: comando invalido.\n");
printf("Ingrese 'help' para informacion sobre los comandos.\n");
break;
}
return itree;
}
/* Identifica el comando guardado en buf
(recibido por interprete o test_shell),
ejecuta la operacion (o el error) correspondiente
y retorna 0 si el comando indica salir del programa
o 1 en otro caso, y se usa en loop en los programas anteriores */
int loop_shell(char buf[MAX_STDIN], ITree* itree) {
int continuar = 1;
char comando[MAX_STDIN];
/* no hay comandos tan largos pero esto
previene fallas cuando se ingresa
un comando incorrecto largo */
double arg[2];
int args;
args = sscanf(buf, "%s [%lf, %lf]", comando, arg, &arg[1]);
// args = cant de elementos escaneados
switch (args) {
/* Se debe recibir 1 comando y para algunos casos
2 numeros correspondientes al intervalo,
por lo tanto debe haber 1 o 3 argumentos */
case 1:
continuar = shell_simple_command(comando, *itree);
break;
case 3:
*itree = shell_interval_command(comando, arg, *itree);
break;
default:
printf("ERROR: cantidad invalida de argumentos.\n");
printf("Ingrese 'help' para informacion sobre los comandos.\n");
break;
}
return continuar;
}
| [
"[email protected]"
] | |
84784feef251800edf5947205dbd8bb0d74d8ef2 | 109c2487947a17a74c6dd74b9feda01aed34d8d1 | /Scott-DFT/ATLAS/Dev1/include/atlas_cNCmm.h | 5754fc208718c7fa36d6aee88185213653704cd0 | [] | no_license | ebylaska/NWPW-C- | 93afad2309483d1dd9fe59546b71e1167926de58 | ea4da7c46fa604fe5de87eb90929c13071110148 | refs/heads/master | 2021-01-12T11:39:32.328672 | 2017-08-31T00:54:16 | 2017-08-31T00:54:16 | 72,255,209 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 454 | h | #ifndef CMM_H
#define CMM_H
#define ATL_mmMULADD
#define ATL_mmLAT 4
#define ATL_mmMU 4
#define ATL_mmNU 2
#define ATL_mmKU 72
#define MB 44
#define NB 44
#define KB 44
#define NBNB 1936
#define MBNB 1936
#define MBKB 1936
#define NBKB 1936
#define NB2 88
#define NBNB2 3872
#define ATL_MulByNB(N_) ((N_) * 44)
#define ATL_DivByNB(N_) ((N_) / 44)
#define ATL_MulByNBNB(N_) ((N_) * 1936)
#endif
| [
"[email protected]"
] | |
c78f624e06c447901685b7db15e8ffe2ce01aab9 | e1bc46edbe00f261282cb798eb59a25ad5227eff | /lte/gateway/c/oai/tasks/nas/ies/GprsTimer.h | 746eb26036dea8b0a9b53517a0e364315431e377 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 119Vik/magma-1 | 57f9a69036c742fcfcb97e84c59be78dec650609 | 107a7b374466a837fc0a49b283ba9d6ff1d702e3 | refs/heads/master | 2022-12-14T14:03:53.841221 | 2020-07-24T10:46:09 | 2020-07-24T11:29:37 | 279,833,292 | 0 | 0 | BSD-3-Clause | 2020-07-15T12:12:30 | 2020-07-15T10:05:13 | Go | UTF-8 | C | false | false | 1,814 | h | /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* [email protected]
*/
#ifndef GPRS_TIMER_H_
#define GPRS_TIMER_H_
#include <stdint.h>
#define GPRS_TIMER_MINIMUM_LENGTH 2
#define GPRS_TIMER_MAXIMUM_LENGTH 2
typedef struct GprsTimer_tag {
#define GPRS_TIMER_UNIT_2S 0b000 /* 2 seconds */
#define GPRS_TIMER_UNIT_60S 0b001 /* 1 minute */
#define GPRS_TIMER_UNIT_360S 0b010 /* decihours */
#define GPRS_TIMER_UNIT_0S 0b111 /* deactivated */
uint8_t unit : 3;
uint8_t timervalue : 5;
} GprsTimer;
int encode_gprs_timer(
GprsTimer *gprstimer,
uint8_t iei,
uint8_t *buffer,
uint32_t len);
void dump_gprs_timer_xml(GprsTimer *gprstimer, uint8_t iei);
int decode_gprs_timer(
GprsTimer *gprstimer,
uint8_t iei,
uint8_t *buffer,
uint32_t len);
long gprs_timer_value(GprsTimer *gprstimer);
#endif /* GPRS TIMER_H_ */
| [
"[email protected]"
] | |
f8399a4b5ef1c3f7b9f7ccbd2d5c9e71610d0ab7 | 243af6f697c16c54af3613988ddaef62a2b29212 | /firmware/uvc_controller/mbed-os/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/pinmap.c | e95ca501625a5ae4f9b1b09267b97ac22b382440 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"MIT"
] | permissive | davewhiiite/uvc | 0020fcc99d279a70878baf7cdc5c02c19b08499a | fd45223097eed5a824294db975b3c74aa5f5cc8f | refs/heads/main | 2023-05-29T10:18:08.520756 | 2021-06-12T13:06:40 | 2021-06-12T13:06:40 | 376,287,264 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,254 | c | /*******************************************************************************
* Copyright (c) 2010-2017 Analog Devices, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* - 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.
* - Modified versions of the software must be conspicuously marked as such.
* - This software is licensed solely and exclusively for use with processors
* manufactured by or for Analog Devices, Inc.
* - This software may not be combined or merged with other code in any manner
* that would cause the software to become subject to terms and conditions
* which differ from those listed here.
* - Neither the name of Analog Devices, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* - The use of this software may or may not infringe the patent rights of one
* or more patent holders. This license does not release you from the
* requirement that you obtain separate licenses from these patent holders
* to use this software.
*
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-
* INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF
* CLAIMS OF INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; 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 "mbed_assert.h"
#include "pinmap.h"
#include "mbed_error.h"
#include "PinNames.h"
#include "adi_gpio.h"
void pin_function(PinName pin, int function)
{
// pin is composed of port and pin
// function is the function number (the mux selection number shifted by the pin value
// and written to pin mux register, each pin mux takes 2 bits hence multiplying by 2)
MBED_ASSERT(pin != (PinName)NC);
uint8_t port = pin >> GPIO_PORT_SHIFT;
uint32_t cfg_reg, mask;
volatile uint32_t *pGPIO_CFG;
switch (port) {
case 0:
pGPIO_CFG = (volatile uint32_t *)REG_GPIO0_CFG;
break;
case 1:
pGPIO_CFG = (volatile uint32_t *)REG_GPIO1_CFG;
break;
case 2:
pGPIO_CFG = (volatile uint32_t *)REG_GPIO2_CFG;
break;
default:
return;
}
cfg_reg = *pGPIO_CFG;
// clear the corresponding 2 bit field first before writing the function
// bits
mask = ~(3 << (pin * 2));
cfg_reg = cfg_reg & mask | (function << (pin*2));
*pGPIO_CFG = cfg_reg;
}
void pin_mode(PinName pin, PinMode mode)
{
MBED_ASSERT(pin != (PinName)NC);
uint8_t port = pin >> GPIO_PORT_SHIFT;
uint32_t pin_reg_value = 2 ^ (0xFF & pin);
switch (mode) {
case PullNone:
adi_gpio_PullUpEnable((ADI_GPIO_PORT)port, (ADI_GPIO_DATA) pin_reg_value,false);
break;
case PullDown:
case PullUp:
adi_gpio_PullUpEnable((ADI_GPIO_PORT)port, (ADI_GPIO_DATA) pin_reg_value,true);
break;
default:
break;
}
}
| [
"[email protected]"
] | |
0369ec7e7989c9bfef4d09e25ce6d5cfbb78acc1 | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/agc011/A/2180127.c | 19db9ab1ca647faad766049b025a4a9e09860608 | [] | no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | WINDOWS-1250 | C | false | false | 942 | c | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
typedef long long ll;
int cmp(const void*a,const void*b)
{
return *(ll *)a-*(ll *)b;
}
int main(void)
{
int n,i;
ll c,k;
ll s[101000];
ll count=1,l=1,start;
scanf("%d %lld %lld",&n,&c,&k);
for(i=0;i<n;i++)
scanf("%lld",&s[i]);
qsort(s,n,sizeof(s[0]),cmp);
start=s[0];
for(i=1;i<n;i++)
{
if(s[i]<=(start+k)&&l<c)
l++;
else if(l==c)
{
count++;
l=1;
start=s[i];
}
else if(s[i]>(start+k))
{
count++;
l=1;
start=s[i];
}
}
printf("%lld\n",count);
} ./Main.c: In function ‘main’:
./Main.c:17:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %lld %lld",&n,&c,&k);
^
./Main.c:19:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&s[i]);
^ | [
"[email protected]"
] | |
16684a209671c46648d92c2df9a3371fcfbbf724 | a556c07ecfa1031dae46fd3433762941ceca68b1 | /kungfu/skill/backup/zimu-zhen/dinhun.c | 760432bbec855c0e8cba9da7dd1c911404573958 | [] | no_license | yqzcabao/pkuxkx-utf8 | 53c3c24f4e3a9125372bca72b6a4b10aa6293a7f | 0eaf237c9970795a51aa4cc04b5b762003300cbd | refs/heads/main | 2023-04-01T21:16:23.894845 | 2021-04-09T13:33:24 | 2021-04-09T13:33:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,288 | c | // 定魂 子母针特殊技
#include <ansi.h>
inherit F_SSERVER;
int perform(object me, object target)
{
object weapon;
string msg;
if( !target ) target = offensive_target(me);
if( !target
|| !target->is_character()
|| !me->is_fighting(target) )
return notify_fail("「定魂」只能对战斗中的对手使用。\n");
if (!objectp(weapon = me->query_temp("weapon"))
|| (string)weapon->query("skill_type") != "throwing")
return notify_fail("你使用的武器不对。\n");
if( target->is_busy() )
return notify_fail(target->name() + "已经神志恍惚,放胆攻击吧.\n");
if( (int)me->query_skill("zimu-zhen", 1) < 30 )
return notify_fail("你的子母针法不够娴熟,不会使用「定魂」。\n");
msg = HIG "$N双目突然泛过怪异绿光,中指在不易察觉间微微一动,一点银星悄无声息打向$n眉心。\n"NOR;
me->start_busy(1);
if( random(me->query("combat_exp")) > (int)target->query("combat_exp")/2 ) {
msg += HIR " 结果$p被$P的「定魂」打个正着,瞬间神志开始迷糊起来!\n" NOR;
target->start_busy( (int)me->query_skill("zimu-zhen") / 20 );
} else {
msg += "可是$p在千钧一发之间闪身躲过了这一击。\n" NOR;
}
message_vision(msg, me, target);
return 1;
}
| [
"[email protected]"
] | |
890d190885125c358bb171b8f515899f4e86a61c | 773561dffbed0d900118dc008b9e6d83ff1c7b3a | /ldd1/ldd_practice/dynamic_cdd/dynamic_cdd.mod.c | b479049fc50d35181faafb412f36458d9505dbb9 | [] | no_license | taraninomula/backup | 92fc46c7acb78241b707a1d0fc4ab98e992f34e8 | 3fc56435f0072b2a90ccbe19d58119741c9536c1 | refs/heads/master | 2020-07-23T10:44:21.974756 | 2019-09-20T06:03:41 | 2019-09-20T06:03:41 | 207,532,705 | 3 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,055 | c | #include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0x25701227, __VMLINUX_SYMBOL_STR(module_layout) },
{ 0x559f5aa, __VMLINUX_SYMBOL_STR(device_destroy) },
{ 0x7485e15e, __VMLINUX_SYMBOL_STR(unregister_chrdev_region) },
{ 0x2b08fecb, __VMLINUX_SYMBOL_STR(class_destroy) },
{ 0x5c5c9ac4, __VMLINUX_SYMBOL_STR(device_create) },
{ 0xb4b7177e, __VMLINUX_SYMBOL_STR(__class_create) },
{ 0x27e1a049, __VMLINUX_SYMBOL_STR(printk) },
{ 0x29537c9e, __VMLINUX_SYMBOL_STR(alloc_chrdev_region) },
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(srcversion, "53471C29DD1B3C8DCED822A");
| [
"[email protected]"
] | |
6574babbddbabd28263c5527d8e353e3628fe0b7 | 8ad162102111f5f011d9604a9e71854191806778 | /include/widgets/window.h | 0bbd20cce7b94f3315e55ab872fca93095048b5f | [] | no_license | Happy-Ferret/Claro | 4381de909d8735d22adfeba943554c62272a5fbb | ef2ae283ec7a32d5f6cdef7205dcb402f9c9e47b | refs/heads/master | 2021-01-17T05:36:53.261301 | 2015-08-20T22:23:59 | 2015-08-20T22:23:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,047 | h | /* Claro Graphics - an abstraction layer for native UI libraries
*
* $Id$
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* See the LICENSE file for more details.
*/
#ifndef _CLARO_GRAPHICS_WIDGETS_WINDOW_H
#define _CLARO_GRAPHICS_WIDGETS_WINDOW_H
/** \defgroup window_widget_t Window Widget
* \brief The Window Widget
* @{
*/
#define assert_only_window_widget(o,n) assert_type_check( o, n, "claro.graphics.widgets.window" )
#define assert_valid_window_widget(o,n) assert_not_null( o, n, "Window" ); \
assert_only_window_widget( o, n )
typedef struct window_widget_ window_widget_t;
struct layout_;
#define cWindowModalDialog 1
#define cWindowCenterParent 2
#define cWindowNoResizing 4
struct window_widget_
{
widget_t widget;
char title[512];
image_t *icon;
widget_t *menubar;
widget_t *workspace;
int exsp_tools, exsp_status, exsp_init;
};
enum
{
cWindowFixedSize = 1,
};
/* functions */
/**
* \brief Creates a Window widget
*
* \param parent The parent widget of this widget, NOT NULL.
* \param bounds The initial bounds of this widget, or NO_BOUNDS.
* \param flags Widget flags.
* \return A new Window widget object.
*/
CLFEXP object_t *window_widget_create( object_t *parent, bounds_t *bounds, int flags );
/**
* \brief Sets a Window's title
*
* \param w A valid Window widget object
* \param title The new title for the window
*/
CLFEXP void window_set_title( object_t *w, const char *title );
/**
* \brief Makes a window visible
*
* \param w A valid Window widget object
*/
CLFEXP void window_show( object_t *w );
/**
* \brief Makes a window invisible
*
* \param w A valid Window widget object
*/
CLFEXP void window_hide( object_t *w );
/**
* \brief Gives focus to a window
*
* \param w A valid Window widget object
*/
CLFEXP void window_focus( object_t *w );
/**
* \brief Maximises a window
*
* \param w A valid Window widget object
*/
CLFEXP void window_maximise( object_t *w );
/**
* \brief Minimises a window
*
* \param w A valid Window widget object
*/
CLFEXP void window_minimise( object_t *w );
/**
* \brief Restores a window
*
* \param w A valid Window widget object
*/
CLFEXP void window_restore( object_t *w );
/**
* \brief Sets a window's icon
*
* \param w A valid Window widget object
* \param icon A valid Image object
*/
CLFEXP void window_set_icon( object_t *w, image_t *icon );
#define window_maximize window_maximise
#define window_minimize window_minimise
/*\@}*/
#endif
| [
"[email protected]"
] | |
74e3687999340ba3ec403eb15e6e8263b3399259 | 2898fa4f2ad766afa0495a837f59fe95daa081a7 | /tests/unit-pass/j039.c | ea93e2d388be2e7a1e4f6fd5807ea63f12097fde | [
"NCSA"
] | permissive | kframework/c-semantics | 12fcc1b1bf1f7792636d1c37f6f7bb1b89a392b5 | e6879d14455771aa0cb3e3d201131d4d763a73a2 | refs/heads/master | 2023-07-31T23:57:03.316456 | 2022-02-01T17:50:31 | 2022-02-01T17:50:31 | 11,747,541 | 312 | 52 | NOASSERTION | 2022-02-01T17:50:33 | 2013-07-29T19:13:25 | C | UTF-8 | C | false | false | 388 | c | int f(int x, int y) {
return x;
}
int g(double x) {
return (int) x;
}
int main(void) {
((int (*)())f)(0, 0);
((int (*)())g)(0.0);
int bar();
bar(5.0);
int baz();
baz((char)5);
int bah();
bah(5);
return 0;
}
int bar(double a){
return 0;
}
int baz(int x){
return 0;
}
int bah(int x){
return x;
}
| [
"[email protected]"
] | |
5171de43f04379017f443facdeafdf218d860f69 | e25c8b65c0115053b14f8ecffaea94a964eefa1f | /ds/open/world1/world2/mainland1/map_18_22.c | 41b00a6397a5e419a2478af68a5e1cebee767ea3 | [] | no_license | zwshen/mudos-game-ds | c985b4b64c586bdc7347bd95d97ab12e78a2f20f | 07ea84ebdff5ee49cb482a520bdf1aaeda886cd0 | refs/heads/master | 2022-03-01T14:55:10.537294 | 2022-02-15T15:41:26 | 2022-02-15T15:41:26 | 244,925,365 | 4 | 1 | null | 2022-02-15T15:41:27 | 2020-03-04T14:44:49 | C | BIG5 | C | false | false | 374 | c | inherit ROOM;
void create()
{
set("short", "針葉林");
set("long", @LONG
LONG
);
set("exits",([
"south" : __DIR__"map_19_22",
"north" : __DIR__"map_17_22",
"east" : __DIR__"map_18_23",
]));
set("outdoors","land");
setup();
set("map_long",1); //show map as long
replace_program(ROOM); //加其他函式xxx()時請拿掉此行
}
| [
"[email protected]"
] | |
f29096f2f23d8cd1a53ffdaf3499b0c41a7a43c4 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/c1adb833-fce2-418b-8c5c-39ba1638f293.c | 4b1a6c23107ec69bade48a48def5ecf5096ba409 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 561 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = i/j;
l = l/j;
l = l-j;
l = l-j;
l = i-j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
long b[81];
long c[19];
a = 0;
while (b[a] != 0) {
/* START BUFFER SET */
*((long *)c + a) = *((long *)b + a);
/* END BUFFER SET */
a++;
}
/* END VULNERABILITY */
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
14bcfe2cd18e6441740c9b2640e7fc9b1ef53696 | fd1ddbde4deb74db1a3ba1599b0f7c6926978b80 | /008 --qpps_2_uart_BLEModule/001 -- 蓝牙模块源代码和bin文件/01 源代码/qpps_2_uart_BLEModule/src/app/app_task.h | 07441386cc167d270ce9050c73644745640c6c3a | [] | no_license | Wangwenxue/Qpps2Uart_SDK1.3.9 | 37793dd3674cdc667882681b1faa2723b1ff0ac8 | e16005564a3c84bb843bf9763a19c57abae8e7a2 | refs/heads/master | 2020-12-03T05:15:07.850841 | 2016-12-07T15:46:51 | 2016-12-07T15:46:51 | 68,714,983 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,921 | h | /**
****************************************************************************************
*
* @file app_task.h
*
* @brief APP Task implementation
*
* Copyright(C) 2015 NXP Semiconductors N.V.
* All rights reserved.
*
* $Rev: 1.0 $
*
****************************************************************************************
*/
#ifndef _APP_TASK_H_
#define _APP_TASK_H_
/**
****************************************************************************************
* @addtogroup APPTASK Task
* @ingroup APP
* @brief Routes ALL messages to/from APP block.
*
* The APPTASK is the block responsible for bridging the final application with the
* QNBLE software host stack. It communicates with the different modules of the BLE host,
* i.e. @ref SMP, @ref GAP and @ref GATT.
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "ke_task.h"
#include "ke_msg.h"
/*
* DEFINES
****************************************************************************************
*/
/// number of APP Instance
#define APP_IDX_MAX 0x01
/// states of APP task
enum
{
/// Init state
APP_INIT = 1,
/// Idle state
APP_IDLE,
/// Advertising state
APP_ADV,
/// Scan state
APP_SCAN,
/// Number of defined states.
APP_STATE_MAX
};
/// App Message Interface
enum
{
/// Debug UART received data
APP_SYS_UART_DATA_IND = KE_FIRST_MSG(TASK_APP),
APP_SYS_LED_1_TIMER,
APP_SYS_LED_2_TIMER,
APP_ADV_INTV_UPDATE_TIMER,
APP_SYS_RCO_CAL_TIMER,
APP_SYS_32K_XTAL_WAKEUP_TIMER,
APP_SYS_TIME_CHECK_TIMER,
APP_SYS_BUTTON_1_TIMER,
APP_SYS_BUTTON_2_TIMER,
//wenxue add
APP_SYS_UART_BAUD_TIMER, // wenxue add for contec
//wenxue end
// for ancsc
ANCS_ENABLE_SUVPER_TIMER0,
ANCS_ENABLE_SUVPER_TIMER1,
// end
APP_HTPT_PERIOD_MEAS_TIMER,
APP_HTPT_IDLE_CONNECTION_TIMEOUT_TIMER,
APP_PROXR_ALERT_STOP_TIMER,
APP_BLPS_PRESSURE_TIMER,
APP_HRPS_TIMER,
APP_TIPS_CURRENT_TIME_TIMER,
APP_SCPPS_SCAN_REFRESH_TIMER,
APP_BASS_BATT_LEVEL_TIMER,
APP_GLPS_MEAS_SEND_TIMER,
APP_RSCPS_MEAS_SEND_TIMER,
APP_CSCPS_MEAS_SEND_TIMER,
APP_PASPS_UPDATE_ALERT_STATUS_TIMER,
APP_PASPS_UPDATE_RINGER_TIMER,
APP_HOGPD_BOOT_KB_IN_REPORT_TIMER,
APP_HOGPD_BOOT_MOUSE_IN_REPORT_TIMER,
APP_HOGPD_REPORT_TIMER,
APP_MSG_MAX
};
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
extern const struct ke_state_handler app_state_handler[APP_STATE_MAX];
extern const struct ke_state_handler app_default_handler;
extern ke_state_t app_state[APP_IDX_MAX];
extern void task_app_desc_register(void);
#endif // APP_TASK_H_
| [
"[email protected]"
] | |
410b7df8dd55873125f79031d1e33c087e2957bd | 9bbc8db57e87d8e5df9f5b5162c6874b69fb5ce5 | /TraceRecorder/streamports/USB_CDC/trcStreamingPort.c | 5525858dec926697ceece59e05274d65f9588230 | [] | no_license | 89yanyu/STM32F429I-Discovery | 8e961e87b83ae38a552d438689950397aa156304 | 9c904582e0975805afde9de6a146cddd0c4b31c7 | refs/heads/master | 2021-07-05T21:30:51.811939 | 2017-09-30T15:27:28 | 2017-09-30T15:27:28 | 105,156,311 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,062 | c | #include "trcRecorder.h"
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#if(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#include "stdint.h"
/* Include files as needed, in this case it is files from STM32Cube FW_F7 V1.4.1 */
//#include "usb_device.h"
#include "usbd_cdc.h"
#include "usbd_cdc_if.h"
//#include "usb_device.h"
#define BUFSIZE 64
typedef struct{
uint32_t idx;
uint8_t data[BUFSIZE];
}recBuf;
/* Define size for the receive and transmit buffer over CDC */
#define APP_RX_DATA_SIZE 8
#define APP_TX_DATA_SIZE 64
/* Received Data over USB are stored in this buffer */
uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
/* Send Data over USB CDC are stored in this buffer */
uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
extern USBD_HandleTypeDef hUsbDeviceFS;
//extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
recBuf commandBuffer;
static int8_t CDC_Init_FS (void);
static int8_t CDC_DeInit_FS (void);
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length);
static int8_t CDC_Receive_FS (uint8_t* pbuf, uint32_t *Len);
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
{
CDC_Init_FS,
CDC_DeInit_FS,
CDC_Control_FS,
CDC_Receive_FS
};
/* Private functions ---------------------------------------------------------*/
/**
* @brief CDC_Init_FS
* Initializes the CDC media low layer over the FS USB IP
* @param None
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Init_FS(void)
{
/* Set Application Buffers */
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
return (USBD_OK);
}
/**
* @brief CDC_DeInit_FS
* DeInitializes the CDC media low layer
* @param None
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_DeInit_FS(void)
{
return (USBD_OK);
}
/**
* @brief CDC_Control_FS
* Manage the CDC class requests
* @param cmd: Command code
* @param pbuf: Buffer containing command data (request parameters)
* @param length: Number of data to be sent (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length)
{
switch (cmd)
{
case CDC_SEND_ENCAPSULATED_COMMAND:
break;
case CDC_GET_ENCAPSULATED_RESPONSE:
break;
case CDC_SET_COMM_FEATURE:
break;
case CDC_GET_COMM_FEATURE:
break;
case CDC_CLEAR_COMM_FEATURE:
break;
/*******************************************************************************/
/* Line Coding Structure */
/*-----------------------------------------------------------------------------*/
/* Offset | Field | Size | Value | Description */
/* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/
/* 4 | bCharFormat | 1 | Number | Stop bits */
/* 0 - 1 Stop bit */
/* 1 - 1.5 Stop bits */
/* 2 - 2 Stop bits */
/* 5 | bParityType | 1 | Number | Parity */
/* 0 - None */
/* 1 - Odd */
/* 2 - Even */
/* 3 - Mark */
/* 4 - Space */
/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
/*******************************************************************************/
case CDC_SET_LINE_CODING:
break;
case CDC_GET_LINE_CODING:
break;
case CDC_SET_CONTROL_LINE_STATE:
break;
case CDC_SEND_BREAK:
break;
default:
break;
}
return (USBD_OK);
}
/**
* @brief CDC_Receive_FS
* Data received over USB OUT endpoint are sent over CDC interface
* through this function.
*
* @note
* This function will block any OUT packet reception on USB endpoint
* until exiting this function. If you exit this function before transfer
* is complete on CDC interface (i.e. using DMA controller) it will result
* in receiving more data while previous ones are still not sent.
*
* @param Buf: Buffer of data to be received
* @param Len: Number of data received (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
for( uint32_t i=0;i<* Len;i++)
{
commandBuffer.data[commandBuffer.idx]=Buf[i];
commandBuffer.idx++;
}
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
}
/**
* @brief CDC_Transmit_FS
* Data send over USB IN endpoint are sent over CDC interface
* through this function.
* @note
*
*
* @param Buf: Buffer of data to be send
* @param Len: Number of data to be send (in bytes)
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
*/
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
if (hcdc->TxState != 0){
return USBD_BUSY;
}
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
return result;
}
int32_t trcCDCReceive(void *data, uint32_t size, int32_t* NumBytes)
{
uint32_t i,diff;
if(commandBuffer.idx>0)
{
if (size >= commandBuffer.idx) // more than what is stored, number of bytes will be .idx
{
memcpy(data,commandBuffer.data, commandBuffer.idx);
*NumBytes=commandBuffer.idx;
commandBuffer.idx=0; // Make the buffer ready for a new command
}
else //If some data in the buffer is not read
{
diff = commandBuffer.idx-size;
memcpy(data,commandBuffer.data, size);
for(i=0;i<diff;i++)
{
commandBuffer.data[i]=commandBuffer.data[i+size];
}
*NumBytes=size;
commandBuffer.idx=diff;
}
}
else
{
*NumBytes=0;
}
return 0;
}
int32_t trcCDCTransmit(void* data, uint32_t size, int32_t * noOfBytesSent )
{
int32_t result;
result=CDC_Transmit_FS(data,size);
*noOfBytesSent=size;
return result;
}
/**
* @brief This function handles USB On The Go FS global interrupt.
*/
void OTG_FS_IRQHandler(void)
{
//HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
}
#endif /*(TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)*/
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
| [
"[email protected]"
] | |
c2c05bd42d2080235d8aa69ab4666d0e0a0b9273 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/d3453b73-1ea2-421f-becd-66a139a6b08a.c | 1d8e8026adc9c9a581fc83555664a6f89b36a6d3 | [] | 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 | 535 | c | #include <string.h>
#include <stdio.h>
int main() {
float i;
float j;
float k;
float l;
i = 6;
j = 9;
//variables
/* START VULNERABILITY */
int a;
char b[11];
char c[84];
a = 0;
while (a < strlen(b)) {
//random
/* START BUFFER SET */
*((char *)c + a) = *((char *)b + a);
/* END BUFFER SET */
a++;
}
/* END VULNERABILITY */
k = 3;
l = j*j*l/9;
printf("vulnerabbiitty");
printf("%f\n",k);
return 0;
}
| [
"[email protected]"
] | |
abb8e7a17abe336b517ae61aa0571bb88aa4d458 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/8c77f91a-f994-4466-a9a5-658e915df4d1.c | 91b435b6329c8b15216586c4141f4ffea9edef8b | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 561 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=4;
int j=14;
int k;
int l;
j = 53;
l = 64;
k = i/j;
l = i/j;
l = i/j;
l = k-j;
l = l-j;
k = k-i*i;
//variables
/* START VULNERABILITY */
int a;
long b[65];
long c[10];
a = 0;
do {
a++;
/* START BUFFER SET */
*((long *)c + ( a - 1 )) = *((long *)b + ( a - 1 ));
/* END BUFFER SET */
} while(b[( a - 1 )] != 0);
/* END VULNERABILITY */
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
00752055a14c6bc7a0080ed367b9c27dff046bc7 | f4b65c8b91c51dea16b3f77c5e05f1e94f4fae18 | /sprint02/t00/mx_is_positive.c | cd3cb566d90170b9d0690b8c7d3c07176a14d799 | [] | no_license | okhramkov/Ucode-Marathone | 62a6df491a678d50f6c5c83f9cc6dd386c20618c | 67ee4f3b18ff14eda6373c6eba4be422bf0e2716 | refs/heads/master | 2023-01-20T10:55:48.237108 | 2020-11-08T17:02:37 | 2020-11-08T17:02:37 | 311,109,984 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 342 | c | void mx_printstr(const char *s);
void mx_is_positive(int i) {
if (i > 0) {
const char str[] = "Positive\n";
mx_printstr(str);
}
else if (i < 0) {
const char str[] = "Negative\n";
mx_printstr(str);
}
else if (i == 0) {
const char str[] = "Zero\n";
mx_printstr(str);
}
}
| [
"[email protected]"
] | |
9ea9138a7499548f525080ccd8855d68ba29f2a8 | e8302c75d770d1608b317d6af5c483bbad6c0493 | /tests/bluetooth/host/id/mocks/net_buf.c | dbdba3f4a3a39f52afbad24a8a3b3fbb31b96d5a | [
"Apache-2.0"
] | permissive | intel/zephyr | 819362089aa44ae378a5558f3b222197aaa811f7 | 06d5bc51b580777079bb0b7e769e4127598ea5ee | refs/heads/main | 2023-09-04T00:20:35.217393 | 2023-02-16T11:27:40 | 2023-02-16T14:59:16 | 65,052,293 | 32 | 32 | Apache-2.0 | 2022-04-05T17:14:07 | 2016-08-05T22:14:50 | C | UTF-8 | C | false | false | 560 | c | /*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/bluetooth/buf.h>
#include <zephyr/kernel.h>
#include <zephyr/net/buf.h>
#include <mocks/net_buf.h>
DEFINE_FAKE_VOID_FUNC(net_buf_unref, struct net_buf *);
DEFINE_FAKE_VALUE_FUNC(void *, net_buf_simple_add, struct net_buf_simple *, size_t);
DEFINE_FAKE_VALUE_FUNC(uint8_t *, net_buf_simple_add_u8, struct net_buf_simple *, uint8_t);
DEFINE_FAKE_VALUE_FUNC(void *, net_buf_simple_add_mem, struct net_buf_simple *, const void *,
size_t);
| [
"[email protected]"
] | |
da0f1d35866204737aa9fd5725cffbc926747c9d | 3ab591b9123fe4e7040c61d4e360c9ec4ec4a1c1 | /mps2_template/example/build/mdk/RTE/_V2M-MPS2-LiteNES/RTE_Components.h | e41aec6930cff3f8adbf4c77e68296c7bae5751c | [
"Apache-2.0"
] | permissive | ianhom/EmbeddedNES | 84b0e6a41659587f7c7625c5940cf6c0054b4838 | 41144274bc75a0b6d7f2752e305678d555c61b2a | refs/heads/master | 2020-03-12T08:23:35.828505 | 2018-06-03T22:46:23 | 2018-06-03T22:46:23 | 130,526,709 | 0 | 0 | Apache-2.0 | 2018-06-03T22:46:24 | 2018-04-22T01:55:53 | C | UTF-8 | C | false | false | 659 | h |
/*
* Auto generated Run-Time-Environment Component Configuration File
* *** Do not modify ! ***
*
* Project: 'Blinky'
* Target: 'V2M-MPS2-LiteNES'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "CMSDK_CM7_SP.h"
#define RTE_Compiler_IO_STDIN /* Compiler I/O: STDIN */
#define RTE_Compiler_IO_STDIN_User /* Compiler I/O: STDIN User */
#define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */
#define RTE_Compiler_IO_STDOUT_User /* Compiler I/O: STDOUT User */
#define RTE_Drivers_USART
#endif /* RTE_COMPONENTS_H */
| [
"[email protected]"
] | |
0eaa519f9ddf72fab067578c8c5ddb2546a8e780 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/xLua/build/lua-5.3.4/src/extr_liolib.c_test2.c | 75669d1150dbd4b44a8a5bf877e0715043f2a19c | [] | 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 | 662 | 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_1__ ;
/* Type definitions */
struct TYPE_4__ {char const c; } ;
typedef TYPE_1__ RN ;
/* Variables and functions */
int nextc (TYPE_1__*) ;
__attribute__((used)) static int test2 (RN *rn, const char *set) {
if (rn->c == set[0] || rn->c == set[1])
return nextc(rn);
else return 0;
} | [
"[email protected]"
] | |
ee6107f1ac73333f212eb422bb350f2c49301480 | f3b85ae8251c0d32b0b13f5f58896049cdc0f456 | /sys/libcrypto/err_prn.c | 367b7f85e797cc8395b628bda12662b60ec34547 | [] | no_license | walafc0/almos-mk | 9f8e1540f48bdfee08dd82336687a6555e7dd730 | 885636fce42faa73f7f9218124d1a40ce2a61907 | refs/heads/master | 2020-12-30T14:56:07.781381 | 2015-08-18T15:44:22 | 2015-08-18T15:44:22 | 40,980,913 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,614 | c | /* crypto/err/err_prn.c */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include <openssl/cryptlib.h>
#include <openssl/lhash.h>
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/err.h>
void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
void *u)
{
unsigned long l;
char buf[256];
char buf2[4096];
const char *file,*data;
int line,flags;
unsigned long es;
es=CRYPTO_thread_id();
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
{
ERR_error_string_n(l, buf, sizeof buf);
BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf,
file, line, (flags & ERR_TXT_STRING) ? data : "");
cb(buf2, strlen(buf2), u);
}
}
#ifndef OPENSSL_NO_FP_API
static int print_fp(const char *str, size_t len, void *fp)
{
return fwrite(str, 1, len, fp);
}
void ERR_print_errors_fp(FILE *fp)
{
ERR_print_errors_cb(print_fp, fp);
}
#endif
void ERR_error_string_n(unsigned long e, char *buf, size_t len)
{
char lsbuf[64], fsbuf[64], rsbuf[64];
const char *ls,*fs,*rs;
unsigned long l,f,r;
l=ERR_GET_LIB(e);
f=ERR_GET_FUNC(e);
r=ERR_GET_REASON(e);
ls=ERR_lib_error_string(e);
fs=ERR_func_error_string(e);
rs=ERR_reason_error_string(e);
if (ls == NULL)
BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
if (fs == NULL)
BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f);
if (rs == NULL)
BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r);
BIO_snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf,
fs?fs:fsbuf, rs?rs:rsbuf);
if (strlen(buf) == len-1)
{
/* output may be truncated; make sure we always have 5
* colon-separated fields, i.e. 4 colons ... */
#define NUM_COLONS 4
if (len > NUM_COLONS) /* ... if possible */
{
int i;
char *s = buf;
for (i = 0; i < NUM_COLONS; i++)
{
char *colon = strchr(s, ':');
if (colon == NULL || colon > &buf[len-1] - NUM_COLONS + i)
{
/* set colon no. i at last possible position
* (buf[len-1] is the terminating 0)*/
colon = &buf[len-1] - NUM_COLONS + i;
*colon = ':';
}
s = colon + 1;
}
}
}
}
/* BAD for multi-threading: uses a local buffer if ret == NULL */
/* ERR_error_string_n should be used instead for ret != NULL
* as ERR_error_string cannot know how large the buffer is */
char *ERR_error_string(unsigned long e, char *ret)
{
static char buf[256];
if (ret == NULL) ret=buf;
ERR_error_string_n(e, ret, 256);
return ret;
}
| [
"[email protected]"
] | |
6333ac052df2f28789a6c55a03e615651831b805 | 7d81ed90e8089fc0bae6625ef8389468ff15f1aa | /libs/lib_base/bl_file.h | 4187e7248e0e2209b1f8ce7febbca8013753fbd2 | [] | no_license | prj-common/00tools | b11a4645ef27dddb8915b9a258283c24f3ad61e0 | ff4e22383775ad9477c194da28f7bb923f51cc41 | refs/heads/master | 2021-01-16T20:50:57.687579 | 2016-09-16T03:41:10 | 2016-09-16T03:41:10 | 68,350,373 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 351 | h | #ifndef __BL_FILE_H__
#define __BL_FILE_H__
// get file size
int bl_get_file_size(char *file_name); // get file size
int bl_get_file_size_ex(char *file_name);
// file extract
int bl_file_extract(char *new_name, char *old_name,
int start_file_addr, int size);
int bl_file_append(char *file_name,char *append_file_name);
#endif
| [
"[email protected]"
] | |
c236133ac5f97b5c46ec12623c032a5a138a2dc1 | de8250e0390768dfb8829f3596a70b5901b498e4 | /txe_tt.c | ec827eacc09a3649fe9af14aaf0ca4ea56cb75e1 | [] | no_license | igou/tx | 8721cfdbd5a060172551913c1ad0ebd6ba422d7b | 72bd0d4cb66031f2b892e04161b2699dfc10d87a | refs/heads/master | 2021-01-10T10:17:54.621543 | 2016-01-23T08:04:26 | 2016-01-23T08:04:26 | 50,229,841 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 7,442 | c | /**************************************************************************/
/* */
/* Copyright (c) 1996-2003 by Express Logic Inc. */
/* */
/* This software is copyrighted by and is the sole property of Express */
/* Logic, Inc. All rights, title, ownership, or other interests */
/* in the software remain the property of Express Logic, Inc. This */
/* software may only be used in accordance with the corresponding */
/* license agreement. Any unauthorized use, duplication, transmission, */
/* distribution, or disclosure of this software is expressly forbidden. */
/* */
/* This Copyright notice may not be removed or modified without prior */
/* written consent of Express Logic, Inc. */
/* */
/* Express Logic, Inc. reserves the right to modify this software */
/* without notice. */
/* */
/* Express Logic, Inc. [email protected] */
/* 11423 West Bernardo Court http://www.expresslogic.com */
/* San Diego, CA 92127 */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread Control (THR) */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_thr.h"
#include "tx_tim.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _txe_thread_terminate PORTABLE C */
/* 4.0b */
/* AUTHOR */
/* */
/* William E. Lamie, Express Logic, Inc. */
/* */
/* DESCRIPTION */
/* */
/* This function checks for errors in the thread terminate function */
/* call. */
/* */
/* INPUT */
/* */
/* thread_ptr Pointer to thread to suspend */
/* */
/* OUTPUT */
/* */
/* TX_THREAD_ERROR Invalid thread pointer */
/* TX_CALLER_ERROR Invalid caller of function */
/* status Actual completion status */
/* */
/* CALLS */
/* */
/* _tx_thread_terminate Actual thread terminate */
/* function */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-31-1996 William E. Lamie Initial Version 3.0 */
/* 11-11-1997 William E. Lamie Modified comment(s), */
/* resulting in version 3.0b. */
/* 01-01-1999 William E. Lamie Modified comment(s), */
/* resulting in version 3.0e. */
/* 11-01-1999 William E. Lamie Modified comment(s), */
/* resulting in version 3.0f. */
/* 01-28-2001 William E. Lamie Modified comment(s), */
/* resulting in version 4.0. */
/* 07-15-2002 William E. Lamie Modified comment(s), */
/* resulting in version 4.0a. */
/* 01-01-2003 William E. Lamie Modified comment(s), */
/* resulting in version 4.0b. */
/* */
/**************************************************************************/
UINT _txe_thread_terminate(TX_THREAD *thread_ptr)
{
REG_1 UINT status; /* Return status */
/* First, check for an invalid thread pointer. */
if ((!thread_ptr) || (thread_ptr -> tx_thread_id != TX_THREAD_ID))
/* Thread pointer is invalid, return appropriate error code. */
return(TX_THREAD_ERROR);
/* Check for invalid caller of this function. */
if ((!_tx_thread_current_ptr) || (_tx_thread_system_state))
/* Invalid caller of this function, return appropriate error code. */
return(TX_CALLER_ERROR);
/* Call actual thread terminate function. */
status = _tx_thread_terminate(thread_ptr);
/* Return actual completion status. */
return(status);
}
| [
"[email protected]"
] | |
24958c8dfc7634187ca22836109ae0c9cfb58a9a | 5054e25b7ef7b2607e72e1420cb63784238c5f87 | /test/test_slist.c | 3324111d00e6d47400c4ac3d35c99a753633468d | [] | no_license | Brukmoon/algor | 0765ed7aa71d15184c431c7d090ac2a2b198e318 | d929f22fe2a5fb1fa038a99fb2ce522d1eb98538 | refs/heads/master | 2021-01-17T20:57:59.451444 | 2017-04-03T16:02:37 | 2017-04-03T16:02:37 | 62,649,022 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 856 | c | #include "slist.h"
#include "test_list.h"
TEST_CASE(slist_push)
{
int a = 1, b = 2, c = 3;
struct slist *list = slist_new();
REQUIRE_EQUAL(list->length, 0);
slist_push(list, &a);
slist_push(list, &b);
REQUIRE_EQUAL(list->length, 2);
slist_push(list, &c);
REQUIRE_EQUAL(list->length, 3);
slist_free(list, NULL);
}
TEST_CASE(slist_pull)
{
int a = 1, b = 2, c = 3;
struct slist *list = slist_new();
slist_pull(list, NULL);
slist_push(list, &a);
REQUIRE_EQUAL(list->length, 1);
slist_pull(list, NULL);
REQUIRE_EQUAL(list->length, 0);
slist_push(list, &a);
slist_push(list, &b);
slist_push(list, &c);
slist_pull(list, NULL);
REQUIRE_EQUAL(list->length, 2);
slist_free(list, NULL);
}
TEST_CASE(language)
{
int arr[5] = { 1, 2, 3, 4, 5 };
int *p = arr;
//printf("%p == %p, %p", arr, &arr[0], p);
} | [
"[email protected]"
] | |
30f00bfb04c9ffa2e7a5c83ba88fae07ab282de4 | 17d6e1b996d62468b00dafb5aa619a96c99eaf0d | /C언어 수업/0416/444/main.c | 7410a866c671487ef7216bacef2d192ca842b498 | [] | no_license | joohongkeem/JOOHONGgit | 91088059e613b58187a04a85a86f9857adf65081 | 7664cb6bd2ac31c7c40a384afb27e7d6d91ce18d | refs/heads/master | 2020-03-17T12:54:02.872904 | 2018-06-20T08:07:08 | 2018-06-20T08:07:08 | 133,608,287 | 0 | 0 | null | null | null | null | UHC | C | false | false | 475 | c | #include <stdio.h>
#include "hd.h"
//typedef struct eag{ // 구조체가 두개정의되어있어 에러가 발생할 것 같지만
// int fir; // 구조체는 메모리가 아닌 선언이므로 에러발생XXXX (선언은 많이써도 상관없다!!)
// int sec; // but, 보기 안좋으므로 헤더파일로 넣는게 굿굿굿
//}TAG;
TAG put (int a, int b);
int main()
{
TAG rlt;
rlt = put(10,5);
printf("%d %d\n", rlt.fir, rlt.sec);
return 0;
} | [
"[email protected]"
] | |
3c3665d2f063b15c99bab0b6f41f72679b985f88 | 60a15a584b00895e47628c5a485bd1f14cfeebbe | /comps/misc/input/Hamamatsu/inc/paramC4880_80.h | 998dc1a218ade1e4051870dbf2558ef7a3c26fb8 | [] | no_license | fcccode/vt5 | ce4c1d8fe819715f2580586c8113cfedf2ab44ac | c88049949ebb999304f0fc7648f3d03f6501c65b | refs/heads/master | 2020-09-27T22:56:55.348501 | 2019-06-17T20:39:46 | 2019-06-17T20:39:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,415 | h | // paramC4880_80.h
// [Jan.08,2002]
#ifndef _INCLUDE_PARAMC4880_80_H_
#define _INCLUDE_PARAMC4880_80_H_
struct DCAM_PARAM_C4880_80 {
DCAM_HDR_PARAM hdr; // id == DCAM_PARAMID_C4880_80
long AMD; // Acquire Mode Internal/External
long AET; // Acquire Exposure Time 0-255 (frame Number)
long SHT; // Shutter Time 0-509 (line Number) exptime = (aet - 1) + sht
long ACN; // Acquire Cycle Number 1-9999
long FCN; // Frame Cycle Number(External) 0-255
long SSP; // Scan Speed High/Slow
long SAG; // Scan Amp Gain Low/High/Super High
long SMD; // Scan Mode Normal/Extended(Subarray)
long SAR_XO; // Sub-Array X Offset
long SAR_YO; // Sub-Array Y Offset
long SAR_XW; // Sub-Array X Width 656
long SAR_YW; // Sub-Array Y Width 494
long SAR_B; // Binning 1, 2, 4, 8, 16, 32
long CEC; // Contrast Enhance Control Volume/External/Off
long CEG; // Contrast Enhance Gain 0-255
long CEO; // Contrast Enhance Offset 0-255
long CVG; // Read Contrast Enhance Volume Gain
long CVO; // Read Contrast Enhance Volume Offset
double FRT; // Frame Read Time
long SCA; // Status of Camera
long CAI_H; // Horizontal
long CAI_V; // Vertical
long CAI_I; // High Speed Mode A/D Bit
long CAI_S; // Slow Speed Mode A/D Bit
};
enum {
dcamparam_c4880_80_AMD = 0x00000001,
dcamparam_c4880_80_AET = 0x00000002,
dcamparam_c4880_80_SHT = 0x00000004,
dcamparam_c4880_80_ACN = 0x00000008,
dcamparam_c4880_80_FCN = 0x00000010,
dcamparam_c4880_80_SSP = 0x00000020,
dcamparam_c4880_80_SAG = 0x00000040,
dcamparam_c4880_80_SMD = 0x00000080,
dcamparam_c4880_80_SAR = 0x00000100,
dcamparam_c4880_80_CEC = 0x00001000,
dcamparam_c4880_80_CEG = 0x00002000,
dcamparam_c4880_80_CEO = 0x00004000,
dcamparam_c4880_80_CVG = 0x00008000,
dcamparam_c4880_80_CVO = 0x00010000,
dcamparam_c4880_80_FRT = 0x00020000,
dcamparam_c4880_80_SCA = 0x00040000,
dcamparam_c4880_80_CAI_H = 0x00080000,
dcamparam_c4880_80_CAI_V = 0x00100000,
dcamparam_c4880_80_CAI_I = 0x00200000,
dcamparam_c4880_80_CAI_S = 0x00400000,
};
enum {
c4880_80_kAET_min = 0,
c4880_80_kAET_max = 255,
c4880_80_kSHT_min = 0,
c4880_80_kSHT_max = 509,
c4880_80_kACN_min = 1,
c4880_80_kACN_max = 9999,
c4880_80_kFCN_min = 0,
c4880_80_kFCN_max = 255,
c4880_80_kCEG_min = 0,
c4880_80_kCEG_max = 255,
c4880_80_kCEO_min = 0,
c4880_80_kCEO_max = 255,
};
#endif // _INCLUDE_PARAMC4880_80_H_
| [
"[email protected]"
] | |
e7bc7955993118384f2fd99225158a825bee3167 | 3d0e2d4bf865833c5304792a126801d98f000f40 | /src/fielddata/script/d05r0118_def.h | 926c684cdbcb58596cf1eee89fad42aacfd8b5ac | [] | no_license | XLuma/retsam_00jupc | 86311fa2927798e45070f9922046ba5e5a9539ae | 9859bc2f4b5bedcadc791f39ce1e7c77172194e7 | refs/heads/main | 2023-07-25T04:24:49.694267 | 2021-07-30T23:08:09 | 2021-07-30T23:08:09 | 393,130,605 | 0 | 0 | null | 2021-08-05T17:56:40 | 2021-08-05T17:56:39 | null | SHIFT_JIS | C | false | false | 237 | h | #ifndef _D05R0118_DEF_H_
#define _D05R0118_DEF_H_
//スクリプトデータID定義
#define SCRID_D05R0118_POKE (1)
#define SCRID_D05R0118_FLAG_CHANGE (2)
#define SCRID_D05R0118_DATA_MAX (2) //最大数
#endif //_D05R0118_DEF_H_
| [
"[email protected]"
] | |
c0173e573eaad7b6e2a3480697d83802fa7d5c60 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/redis/src/extr_adlist.c_listCreate.c | 439bbeee625a8dae23325476cf28dc2ee116b2fa | [] | 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 | 878 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct list {int /*<<< orphan*/ * match; int /*<<< orphan*/ * free; int /*<<< orphan*/ * dup; scalar_t__ len; int /*<<< orphan*/ * tail; int /*<<< orphan*/ head; } ;
typedef struct list list ;
/* Variables and functions */
struct list* zmalloc (int) ;
list *listCreate(void)
{
struct list *list;
if ((list = zmalloc(sizeof(*list))) == NULL)
return NULL;
list->head = list->tail = NULL;
list->len = 0;
list->dup = NULL;
list->free = NULL;
list->match = NULL;
return list;
} | [
"[email protected]"
] | |
6813737232a6e27b3afc8deba686cbc58643f508 | a565dc8a731c4166548d3e3bf8156c149d793162 | /PLATFORM/TI_EVM_3530/SRC/APPS/Vox/Comm/comm.h | fb00716a7efa0730b7645bc4292d27fbaf20d8a4 | [] | no_license | radtek/MTI_WINCE317_BSP | eaaf3147d3de9a731a011b61f30d938dc48be5b5 | 32ea5df0f2918036f4b53a4b3aabecb113213cc6 | refs/heads/master | 2021-12-08T13:09:24.823090 | 2016-03-17T15:27:44 | 2016-03-17T15:30:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 769 | h | #ifndef _COMM_H_
#define _COMM_H_
#include <windows.h>
#define MAX_SIZE_TO_READ 80
#define MAX_PHONE_NUMBER 128
#define XON_CHAR 0x11
#define XOFF_CHAR 0x13
//extern bool g_bUseXonXoff;
typedef enum
{
RESP_COMM_OK = 0,
RESP_COMM_EMPTY_EVENT,
RESP_COMM_FAILURE,
} RESP_COMM_ERROR;
#ifdef __cplusplus
extern "C" {
#endif
HANDLE WINAPI __OpenComPort(LPCTSTR pszPortName);
//HANDLE OpenComPort(LPCTSTR pszPortName);
//BOOL WaitIncoming(HANDLE hCom);
//BOOL sendATCmd(HANDLE hCom, const char *cmdStr, char *respStr);
BOOL sendATCmdApp(HANDLE hCom, const char *cmdStr);
RESP_COMM_ERROR respATCmdApp(HANDLE hCom, char *respStr);
HANDLE WINAPI __OpenComPortTest(LPCTSTR pszPortName);
#ifdef __cplusplus
}
#endif
#endif //_COMM_H_ | [
"[email protected]"
] | |
0246f839551e4a5955de2d112a25dc4d87bcdeba | 65d8f5178e86e990caeabf8c25ead125e97184de | /dilithium1aes/PQCgenKAT_sign.c | 3aae484115e56d2f3f0516b4126ac8e59b9e96ca | [] | no_license | vazpeitiah/TLSLibrary | 30cee437d5fba8d3afa25b4e4791b9ed391c617d | cd1ea64f77bd5698173fef1922bc7bb9c3e8cc7b | refs/heads/master | 2023-07-11T07:24:30.747404 | 2021-08-23T01:55:51 | 2021-08-23T01:55:51 | 334,240,975 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,226 | c |
//
// PQCgenKAT_sign.c
//
// Created by Bassham, Lawrence E (Fed) on 8/29/17.
// Copyright © 2017 Bassham, Lawrence E (Fed). All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "rng.h"
#include "api.h"
#define MAX_MARKER_LEN 50
#define KAT_SUCCESS 0
#define KAT_FILE_OPEN_ERROR -1
#define KAT_DATA_ERROR -3
#define KAT_CRYPTO_FAILURE -4
int FindMarker(FILE *infile, const char *marker);
int ReadHex(FILE *infile, unsigned char *A, int Length, char *str);
void fprintBstr(FILE *fp, char *S, unsigned char *A, unsigned long long L);
char AlgName[] = "My Alg Name";
int
main()
{
char fn_req[32], fn_rsp[32];
FILE *fp_req, *fp_rsp;
unsigned char seed[48];
unsigned char msg[3300];
unsigned char entropy_input[48];
unsigned char *m, *sm, *m1;
unsigned long long mlen, smlen, mlen1;
int count;
int done;
unsigned char pk[CRYPTO_PUBLICKEYBYTES], sk[CRYPTO_SECRETKEYBYTES];
int ret_val;
// Create the REQUEST file
sprintf(fn_req, "PQCsignKAT_%d.req", CRYPTO_SECRETKEYBYTES);
if ( (fp_req = fopen(fn_req, "w")) == NULL ) {
printf("Couldn't open <%s> for write\n", fn_req);
return KAT_FILE_OPEN_ERROR;
}
sprintf(fn_rsp, "PQCsignKAT_%d.rsp", CRYPTO_SECRETKEYBYTES);
if ( (fp_rsp = fopen(fn_rsp, "w")) == NULL ) {
printf("Couldn't open <%s> for write\n", fn_rsp);
return KAT_FILE_OPEN_ERROR;
}
for (int i=0; i<48; i++)
entropy_input[i] = i;
randombytes_init(entropy_input, NULL, 256);
for (int i=0; i<100; i++) {
fprintf(fp_req, "count = %d\n", i);
randombytes(seed, 48);
fprintBstr(fp_req, "seed = ", seed, 48);
mlen = 33*(i+1);
fprintf(fp_req, "mlen = %llu\n", mlen);
randombytes(msg, mlen);
fprintBstr(fp_req, "msg = ", msg, mlen);
fprintf(fp_req, "pk =\n");
fprintf(fp_req, "sk =\n");
fprintf(fp_req, "smlen =\n");
fprintf(fp_req, "sm =\n\n");
}
fclose(fp_req);
//Create the RESPONSE file based on what's in the REQUEST file
if ( (fp_req = fopen(fn_req, "r")) == NULL ) {
printf("Couldn't open <%s> for read\n", fn_req);
return KAT_FILE_OPEN_ERROR;
}
fprintf(fp_rsp, "# %s\n\n", CRYPTO_ALGNAME);
done = 0;
do {
if ( FindMarker(fp_req, "count = ") )
fscanf(fp_req, "%d", &count);
else {
done = 1;
break;
}
fprintf(fp_rsp, "count = %d\n", count);
if ( !ReadHex(fp_req, seed, 48, "seed = ") ) {
printf("ERROR: unable to read 'seed' from <%s>\n", fn_req);
return KAT_DATA_ERROR;
}
fprintBstr(fp_rsp, "seed = ", seed, 48);
randombytes_init(seed, NULL, 256);
if ( FindMarker(fp_req, "mlen = ") )
fscanf(fp_req, "%llu", &mlen);
else {
printf("ERROR: unable to read 'mlen' from <%s>\n", fn_req);
return KAT_DATA_ERROR;
}
fprintf(fp_rsp, "mlen = %llu\n", mlen);
m = (unsigned char *)calloc(mlen, sizeof(unsigned char));
m1 = (unsigned char *)calloc(mlen+CRYPTO_BYTES_DILI, sizeof(unsigned char));
sm = (unsigned char *)calloc(mlen+CRYPTO_BYTES_DILI, sizeof(unsigned char));
if ( !ReadHex(fp_req, m, (int)mlen, "msg = ") ) {
printf("ERROR: unable to read 'msg' from <%s>\n", fn_req);
return KAT_DATA_ERROR;
}
fprintBstr(fp_rsp, "msg = ", m, mlen);
// Generate the public/private keypair
if ( (ret_val = crypto_sign_keypair(pk, sk)) != 0) {
printf("crypto_sign_keypair returned <%d>\n", ret_val);
return KAT_CRYPTO_FAILURE;
}
fprintBstr(fp_rsp, "pk = ", pk, CRYPTO_PUBLICKEYBYTES);
fprintBstr(fp_rsp, "sk = ", sk, CRYPTO_SECRETKEYBYTES);
if ( (ret_val = crypto_sign(sm, &smlen, m, mlen, sk)) != 0) {
printf("crypto_sign returned <%d>\n", ret_val);
return KAT_CRYPTO_FAILURE;
}
fprintf(fp_rsp, "smlen = %llu\n", smlen);
fprintBstr(fp_rsp, "sm = ", sm, smlen);
fprintf(fp_rsp, "\n");
if ( (ret_val = crypto_sign_open(m1, &mlen1, sm, smlen, pk)) != 0) {
printf("crypto_sign_open returned <%d>\n", ret_val);
return KAT_CRYPTO_FAILURE;
}
if ( mlen != mlen1 ) {
printf("crypto_sign_open returned bad 'mlen': Got <%llu>, expected <%llu>\n", mlen1, mlen);
return KAT_CRYPTO_FAILURE;
}
if ( memcmp(m, m1, mlen) ) {
printf("crypto_sign_open returned bad 'm' value\n");
return KAT_CRYPTO_FAILURE;
}
free(m);
free(m1);
free(sm);
} while ( !done );
fclose(fp_req);
fclose(fp_rsp);
return KAT_SUCCESS;
}
//
// ALLOW TO READ HEXADECIMAL ENTRY (KEYS, DATA, TEXT, etc.)
//
int
FindMarker(FILE *infile, const char *marker)
{
char line[MAX_MARKER_LEN];
int i, len;
int curr_line;
len = (int)strlen(marker);
if ( len > MAX_MARKER_LEN-1 )
len = MAX_MARKER_LEN-1;
for ( i=0; i<len; i++ )
{
curr_line = fgetc(infile);
line[i] = curr_line;
if (curr_line == EOF )
return 0;
}
line[len] = '\0';
while ( 1 ) {
if ( !strncmp(line, marker, len) )
return 1;
for ( i=0; i<len-1; i++ )
line[i] = line[i+1];
curr_line = fgetc(infile);
line[len-1] = curr_line;
if (curr_line == EOF )
return 0;
line[len] = '\0';
}
// shouldn't get here
return 0;
}
//
// ALLOW TO READ HEXADECIMAL ENTRY (KEYS, DATA, TEXT, etc.)
//
int
ReadHex(FILE *infile, unsigned char *A, int Length, char *str)
{
int i, ch, started;
unsigned char ich;
if ( Length == 0 ) {
A[0] = 0x00;
return 1;
}
memset(A, 0x00, Length);
started = 0;
if ( FindMarker(infile, str) )
while ( (ch = fgetc(infile)) != EOF ) {
if ( !isxdigit(ch) ) {
if ( !started ) {
if ( ch == '\n' )
break;
else
continue;
}
else
break;
}
started = 1;
if ( (ch >= '0') && (ch <= '9') )
ich = ch - '0';
else if ( (ch >= 'A') && (ch <= 'F') )
ich = ch - 'A' + 10;
else if ( (ch >= 'a') && (ch <= 'f') )
ich = ch - 'a' + 10;
else // shouldn't ever get here
ich = 0;
for ( i=0; i<Length-1; i++ )
A[i] = (A[i] << 4) | (A[i+1] >> 4);
A[Length-1] = (A[Length-1] << 4) | ich;
}
else
return 0;
return 1;
}
void
fprintBstr(FILE *fp, char *S, unsigned char *A, unsigned long long L)
{
unsigned long long i;
fprintf(fp, "%s", S);
for ( i=0; i<L; i++ )
fprintf(fp, "%02X", A[i]);
if ( L == 0 )
fprintf(fp, "00");
fprintf(fp, "\n");
}
| [
"[email protected]"
] | |
72f6b7dc4523119fccd0eb4e2c2f67bbdee72bc0 | 0d9a644ef4d90f3068d07228dfcf54ae940cfcba | /areas/tol-dhurath/forest-3/7x5.c | 81593b55b8df8c91a57a971ea90fb8b7839a831d | [] | no_license | cellboy/core-lib | 3584d8dec497a435d3742f2a7326c3b19beda0c8 | 9ddaa6416c538bbcd51a15c834ea6d5ec744ea40 | refs/heads/master | 2023-08-12T17:57:18.183853 | 2021-09-22T21:09:37 | 2021-09-22T21:09:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 841 | c | //*****************************************************************************
// Copyright (c) 2021 - Allen Cummings, RealmsMUD, All rights reserved. See
// the accompanying LICENSE file for details.
//*****************************************************************************
inherit "/lib/environment/generatedEnvironment.c";
/////////////////////////////////////////////////////////////////////////////
public void Setup()
{
setTerrain("/lib/environment/terrain/forest.c");
addFeature("/lib/environment/features/water/gorge-creek.c", "west");
addFeature("/lib/environment/features/water/brook.c", "northwest");
addExit("south", "/areas/tol-dhurath/forest-3/7x4.c");
addFeature("/lib/environment/features/paths/path.c", "south");
addRandomCreature(({"boar","timber wolf","coyote"}));
}
| [
"[email protected]"
] | |
3d0f1b89c0dd77136d32ea23118305c1b357df5d | bd9dce50b36e6e11f77f1bc210069d8122935f95 | /F0-nolib/F0_testbrd/usart.c | 4915aba8348d29ecc24ea5f4da8ff5e75612fbf9 | [] | no_license | olegkapitonov/stm32samples | 1c2b42f5bc4d4438af9bee5812635313033ec732 | d2576412a5b366e1fd99d8b1c6b1d5bb855be7f2 | refs/heads/master | 2023-04-29T14:15:05.642118 | 2021-05-24T16:54:20 | 2021-05-24T16:54:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,732 | c | /*
* usart.c
*
* Copyright 2017 Edward V. Emelianoff <[email protected], [email protected]>
*
* 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 "stm32f0.h"
#include "hardware.h"
#include "usart.h"
#include <string.h>
extern volatile uint32_t Tms;
static volatile int idatalen[2] = {0,0}; // received data line length (including '\n')
static volatile int odatalen[2] = {0,0};
volatile int linerdy = 0, // received data ready
dlen = 0, // length of data (including '\n') in current buffer
bufovr = 0, // input buffer overfull
txrdy = 1 // transmission done
;
int rbufno = 0, tbufno = 0; // current rbuf/tbuf numbers
static char rbuf[2][UARTBUFSZI], tbuf[2][UARTBUFSZO]; // receive & transmit buffers
static char *recvdata = NULL;
/**
* return length of received data (without trailing zero
*/
int usart_getline(char **line){
if(bufovr){
bufovr = 0;
linerdy = 0;
return 0;
}
*line = recvdata;
linerdy = 0;
return dlen;
}
// transmit current tbuf and swap buffers
void transmit_tbuf(){
uint32_t tmout = 16000000;
while(!txrdy){if(--tmout == 0) break;}; // wait for previos buffer transmission
register int l = odatalen[tbufno];
if(!l) return;
txrdy = 0;
odatalen[tbufno] = 0;
USARTDMA->CCR &= ~DMA_CCR_EN;
USARTDMA->CMAR = (uint32_t) tbuf[tbufno]; // mem
USARTDMA->CNDTR = l;
USARTDMA->CCR |= DMA_CCR_EN;
tbufno = !tbufno;
}
void usart_putchar(const char ch){
if(odatalen[tbufno] == UARTBUFSZO) transmit_tbuf();
tbuf[tbufno][odatalen[tbufno]++] = ch;
}
void usart_send(const char *str){
uint32_t x = 512;
while(*str && --x){
if(odatalen[tbufno] == UARTBUFSZO) transmit_tbuf();
tbuf[tbufno][odatalen[tbufno]++] = *str++;
}
}
void usart_sendn(const char *str, uint8_t L){
for(uint8_t i = 0; i < L; ++i){
if(odatalen[tbufno] == UARTBUFSZO) transmit_tbuf();
tbuf[tbufno][odatalen[tbufno]++] = *str++;
}
}
void newline(){
usart_putchar('\n');
transmit_tbuf();
}
void usart_setup(){
uint32_t tmout = 16000000;
// Nucleo's USART2 connected to VCP proxy of st-link
#if USARTNUM == 2
// setup pins: PA2 (Tx - AF1), PA15 (Rx - AF1)
// AF mode (AF1)
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER2|GPIO_MODER_MODER15))\
| (GPIO_MODER_MODER2_AF | GPIO_MODER_MODER15_AF);
GPIOA->AFR[0] = (GPIOA->AFR[0] &~GPIO_AFRH_AFRH2) | 1 << (2 * 4); // PA2
GPIOA->AFR[1] = (GPIOA->AFR[1] &~GPIO_AFRH_AFRH7) | 1 << (7 * 4); // PA15
RCC->APB1ENR |= RCC_APB1ENR_USART2EN; // clock
// USART1 of main board
#elif USARTNUM == 1
// PA9 - Tx, PA10 - Rx (AF1)
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER9 | GPIO_MODER_MODER10))\
| (GPIO_MODER_MODER9_AF | GPIO_MODER_MODER10_AF);
GPIOA->AFR[1] = (GPIOA->AFR[1] & ~(GPIO_AFRH_AFRH1 | GPIO_AFRH_AFRH2)) |
1 << (1 * 4) | 1 << (2 * 4); // PA9, PA10
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
#else
#error "Wrong USARTNUM"
#endif
// USARTX Tx DMA
USARTDMA->CPAR = (uint32_t) &USARTX->TDR; // periph
USARTDMA->CMAR = (uint32_t) tbuf; // mem
USARTDMA->CCR |= DMA_CCR_MINC | DMA_CCR_DIR | DMA_CCR_TCIE; // 8bit, mem++, mem->per, transcompl irq
// Tx CNDTR set @ each transmission due to data size
NVIC_SetPriority(DMAIRQn, 3);
NVIC_EnableIRQ(DMAIRQn);
NVIC_SetPriority(USARTIRQn, 0);
// setup usart1
USARTX->BRR = 480000 / 1152;
USARTX->CR3 = USART_CR3_DMAT; // enable DMA Tx
USARTX->CR1 = USART_CR1_TE | USART_CR1_RE | USART_CR1_UE; // 1start,8data,nstop; enable Rx,Tx,USART
while(!(USARTX->ISR & USART_ISR_TC)){if(--tmout == 0) break;} // polling idle frame Transmission
USARTX->ICR |= USART_ICR_TCCF; // clear TC flag
USARTX->CR1 |= USART_CR1_RXNEIE;
NVIC_EnableIRQ(USARTIRQn);
}
#if USARTNUM == 2
void usart2_isr(){
// USART1
#elif USARTNUM == 1
void usart1_isr(){
#else
#error "Wrong USARTNUM"
#endif
#ifdef CHECK_TMOUT
static uint32_t tmout = 0;
#endif
if(USARTX->ISR & USART_ISR_RXNE){ // RX not emty - receive next char
#ifdef CHECK_TMOUT
if(tmout && Tms >= tmout){ // set overflow flag
bufovr = 1;
idatalen[rbufno] = 0;
}
tmout = Tms + TIMEOUT_MS;
if(!tmout) tmout = 1; // prevent 0
#endif
// read RDR clears flag
uint8_t rb = USARTX->RDR;
if(idatalen[rbufno] < UARTBUFSZI){ // put next char into buf
rbuf[rbufno][idatalen[rbufno]++] = rb;
if(rb == '\n'){ // got newline - line ready
linerdy = 1;
dlen = idatalen[rbufno];
recvdata = rbuf[rbufno];
// prepare other buffer
rbufno = !rbufno;
idatalen[rbufno] = 0;
#ifdef CHECK_TMOUT
// clear timeout at line end
tmout = 0;
#endif
}
}else{ // buffer overrun
bufovr = 1;
idatalen[rbufno] = 0;
#ifdef CHECK_TMOUT
tmout = 0;
#endif
}
}
}
// return string buffer with val
char *u2str(uint32_t val){
static char bufa[11];
char bufb[10];
int l = 0, bpos = 0;
if(!val){
bufa[0] = '0';
l = 1;
}else{
while(val){
bufb[l++] = val % 10 + '0';
val /= 10;
}
int i;
bpos += l;
for(i = 0; i < l; ++i){
bufa[--bpos] = bufb[i];
}
}
bufa[l + bpos] = 0;
return bufa;
}
// print 32bit unsigned int
void printu(uint32_t val){
usart_send(u2str(val));
}
// print 32bit unsigned int as hex
void printuhex(uint32_t val){
usart_send("0x");
uint8_t *ptr = (uint8_t*)&val + 3, start = 1;
int i, j;
for(i = 0; i < 4; ++i, --ptr){
if(!*ptr && start) continue;
for(j = 1; j > -1; --j){
start = 0;
register uint8_t half = (*ptr >> (4*j)) & 0x0f;
if(half < 10) usart_putchar(half + '0');
else usart_putchar(half - 10 + 'a');
}
}
if(start){
usart_putchar('0');
usart_putchar('0');
}
}
// dump memory buffer
void hexdump(uint8_t *arr, uint16_t len){
for(uint16_t l = 0; l < len; ++l, ++arr){
for(int16_t j = 1; j > -1; --j){
register uint8_t half = (*arr >> (4*j)) & 0x0f;
if(half < 10) usart_putchar(half + '0');
else usart_putchar(half - 10 + 'a');
}
if(l % 16 == 15) usart_putchar('\n');
else if(l & 1) usart_putchar(' ');
}
}
#if USARTNUM == 2
void dma1_channel4_5_isr(){
if(DMA1->ISR & DMA_ISR_TCIF4){ // Tx
DMA1->IFCR |= DMA_IFCR_CTCIF4; // clear TC flag
txrdy = 1;
}
}
// USART1
#elif USARTNUM == 1
void dma1_channel2_3_isr(){
if(DMA1->ISR & DMA_ISR_TCIF2){ // Tx
DMA1->IFCR |= DMA_IFCR_CTCIF2; // clear TC flag
txrdy = 1;
}
}
#else
#error "Wrong USARTNUM"
#endif
| [
"[email protected]"
] | |
4fcc4c22a191c50cd9aa7e64539086c6dc6f5dd5 | 6260b1ce1152d97309d5c358d5c4163fd6cf4e70 | /code/core/hal/hal_uart.h | 6fddc772e0cc189e3a6dc0828bdffa75697254ca | [] | no_license | zhihanyu/ZG_RGB_RF | 0089cd084d2387316765e32f3fd9d8da88536f54 | a0954722b3ee4efea09f51d188847b4869d8d13d | refs/heads/master | 2020-09-16T17:52:09.482666 | 2019-11-25T02:33:13 | 2019-11-25T02:33:13 | 223,846,085 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,058 | h | #ifndef HAL_UART_H
#define HAL_UART_H
//S9070 uarts
#define UART_0 (0U)
#define UART_LOG (1U) //loguart
#define UART_MAX_ID (UART_LOG)
#define IS_UART_ID_VALID(x) (((x) <= UART_MAX_ID) ? TRUE : FALSE)
//data length
#define UART_DATALENGTH_7B ((uint32_t)0U)
#define UART_DATALENGTH_8B ((uint32_t)1U)
#define IS_UART_DATA_LENGTH(LENGTH) (((LENGTH) == UART_DATALENGTH_7B) || \
((LENGTH) == UART_DATALENGTH_8B))
//stop bits
#define UART_STOPBITS_1 ((uint32_t)0U)
#define UART_STOPBITS_2 ((uint32_t)1U)
#define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_1) || \
((STOPBITS) == UART_STOPBITS_2) )
//parity
#define UART_PARITY_NONE ((uint32_t)0U)
#define UART_PARITY_EVEN ((uint32_t)1U)
#define UART_PARITY_ODD ((uint32_t)2U)
#define IS_UART_PARITY(PARITY) (((PARITY) == UART_PARITY_NONE) || \
((PARITY) == UART_PARITY_EVEN) || \
((PARITY) == UART_PARITY_ODD))
#define UART_FIFO_SIZE (16)
//uart interrupt
#define UART_IT_ERROR (BIT0)
#define UART_IT_TXE (BIT1)
#define UART_IT_RXNE (BIT2)
#define UART_IT_RXTO (BIT3)
#if UART_MONITOR
#define UART_IT_MD (BIT4)
#define UART_IT_MS (BIT5)
#endif
#define UART_IT_ALL (BIT_ALL)
//power level
#define UART_LP_DISABLE 0 //disable
#define UART_LP_LV0 1 //higher power
#define UART_LP_LV1 2 //lower power
#define IS_UART_LPLV(LV) (((LV) == UART_LP_DISABLE) || \
((LV) == UART_LP_LV0) || \
((LV) == UART_LP_LV1))
//rx thd
#define UART_RX_THD_1BYTES (0)
#define UART_RX_THD_4BYTES (1)
#define UART_RX_THD_8BYTES (2)
#define UART_RX_THD_14BYTES (3)
typedef struct uart_dma_
{
u8 rx_burst_size;
u8 tx_burst_size;
hal_cb_t rx_complete;
hal_cb_t tx_complete;
u8 *rxbuf;
u32 rxlen;
u32 rx_complete_len;
u8 *last_rx_addr;
u8 *txbuf;
u32 txlen;
u32 tx_complete_len;
u32 rx_timeout_cnt;
}uart_dma_t;
typedef struct uart_int_
{
hal_cb_t trx_error;
hal_cb_t tx_complete;
hal_cb_t rx_complete;
hal_cb_t rx_timeout;
u8 *txbuf;
u32 txlen;
u8 *rxbuf;
u32 rxlen;
}uart_int_t;
typedef struct uart_config_
{
u32 idx; //rsvd for s90xx
u32 parity;
u32 datalen;
u32 stopbits;
u32 baud;
u32 lpmode;
u32 tx_thd;
u32 rx_thd;
}uart_config_t;
typedef struct uart_hdl_
{
u32 state;
uart_config_t config;
uart_int_t it;
uart_dma_t dma;
}uart_hdl_t;
//send recv always wait
#define uart_tx(a, b, c) s907x_hal_uart_tx((a), (b), (c), HAL_MAX_DELAY)
#define uart_rx(a, b, c) s907x_hal_uart_rx((a), (b), (c), HAL_MAX_DELAY)
//low level api
u8 uart_ll_rx_allow(void *uart);
u8 uart_ll_tx_allow(void *uart);
void uart_ll_send_byte(void *uart, u8 byte);
u8 uart_ll_recv_byte(void *uart);
//hal api
hal_status_e s907x_hal_uart_init(uart_hdl_t *uart);
hal_status_e s907x_hal_uart_deinit(uart_hdl_t *uart);
int s907x_hal_uart_tx(uart_hdl_t *uart, u8 *pbuf, uint16_t size, uint32_t timeout);
int s907x_hal_uart_rx(uart_hdl_t *uart, u8 *pbuf, uint16_t size, uint32_t timeout);
hal_status_e s907x_hal_uart_tx_it(uart_hdl_t *uart, u8 *pbuf, uint16_t size);
hal_status_e s907x_hal_uart_rx_it_to(uart_hdl_t *uart, u8*pbuf);
hal_status_e s907x_hal_uart_rx_it(uart_hdl_t *uart, u8 *pbuf, uint16_t size);
hal_status_e s907x_hal_uart_tx_dma(uart_hdl_t *uart, u8 *pbuf, uint16_t size);
hal_status_e s907x_hal_uart_rx_dma(uart_hdl_t *uart, u8 *pbuf, uint16_t size);
u32 s907x_hal_uart_rx_dma_adddress(uart_hdl_t *uart);
hal_status_e s907x_hal_uart_dma_txstop(uart_hdl_t *uart);
hal_status_e s907x_hal_uart_dma_rxstop(uart_hdl_t *uart);
#endif
| [
"[email protected]"
] | |
918e91ae6344e80eec2e1fc91afe8d7a2f182fdb | 5c255f911786e984286b1f7a4e6091a68419d049 | /code/cc3f6bb8-af00-4396-b4cc-a0137ef0f116.c | a89a51e1c5e4436e17dc89f48e6e4819109c5993 | [] | 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 | 206 | c | #include <stdio.h>
int main() {
int i=4;
int j=1;
int k;
int l;
k = 532;
l = l-4;
k = i%j;
l = i%j;
k = k-k*i;
printf("vulnerability");
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
0d6d204a45bdc913a0326cda6876449df69352f3 | ae5836900a4c403d860f8f431c0e452ee43705e0 | /src/vsip_vsumval_f.c | b0e9245d1ad50fac73850ea21da7460d3a83a3f8 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | connorimes/tasp-vsipl-core-plus | 224d1817f180fb4e6977ab227ee1bea41c5e6c58 | dba552a9b5e145b1289a0d415f37fd91baa1e1ef | refs/heads/master | 2021-01-21T23:58:44.018215 | 2015-11-17T18:23:51 | 2015-11-17T18:23:51 | 46,365,748 | 9 | 4 | null | null | null | null | UTF-8 | C | false | false | 1,449 | c | /* Created RJudd December 14, 1997 */
/* SPAWARSYSCEN D881 */
/**********************************************************************
// For TASP VSIPL Documentation and Code neither the United States /
// Government, the United States Navy, nor any of their employees, /
// makes any warranty, express or implied, including the warranties /
// of merchantability and fitness for a particular purpose, or /
// assumes any legal liability or responsibility for the accuracy, /
// completeness, or usefulness of any information, apparatus, /
// product, or process disclosed, or represents that its use would /
// not infringe privately owned rights /
**********************************************************************/
/* $Id: vsip_vsumval_f.c,v 2.0 2003/02/22 15:19:19 judd Exp $ */
/* Modified RJudd January 2, 1999 */
/* to add rstride */
/* Removed Tisdale error checking Sept 00 */
#include<vsip.h>
#include<vsip_vviewattributes_f.h>
vsip_scalar_f (vsip_vsumval_f)(
const vsip_vview_f* a) {
{
/*define variables*/
/* register */ vsip_length n = a->length;
/* register */ vsip_stride ast = a->stride * a->block->rstride;
vsip_scalar_f *ap = (a->block->array) + a->offset * a->block->rstride;
vsip_scalar_f t = 0;
/* do sum */
while(n-- > 0){
t += *ap;
ap += ast;
}
/* return sum */
return t;
}
}
| [
"[email protected]"
] | |
92d6d1a72bb2cfb8f31b3f6b957c1d6e0837efa0 | f9abb08e4e5c04516d213f41bdb7f2596d5bd2ff | /STM32智能指纹锁/ucos3/HARDWARE/KEYBOARD/keyboard.h | 0d18f94f6b5746a37d4acbf52766a3767e05ce36 | [] | no_license | Kysaiz/MyOwnProject | 52fd909dd931f59cf39413fa360310a20bbc32e0 | 57eea51f18d91bb2135c8e27cafd313f3a43ef1d | refs/heads/main | 2023-03-23T02:37:29.901208 | 2021-03-19T14:36:34 | 2021-03-19T14:36:34 | 349,411,652 | 0 | 0 | null | null | null | null | ISO-8859-7 | C | false | false | 209 | h | #ifndef __KEYBOARD_H__
#define __KEYBOARD_H__
#include "stm32f4xx.h"
#include "sys.h"
#include "delay.h"
// ³υΚΌ»―ΌόΕΜ
extern void key_board_init(void);
extern char get_key_board(void);
#endif
| [
"[email protected]"
] | |
ce13c8229b33804510adfe33f544c6190d077dd6 | bebb06d00e1b0b1085a41f089b491ae1c839d200 | /chapter07/charcount.c | a8a756eea3695048eb81b1de0bba5dee455b382a | [] | no_license | zhengjun1987/CPrimerPlus5thEdition | 01322b290705e59e8c75e81eb8462dd2af0c81c4 | 1909e13931eb0cc8a04d89aab691cf1b2a291249 | refs/heads/master | 2021-09-11T13:22:49.593855 | 2018-04-07T17:12:45 | 2018-04-07T17:12:45 | 115,200,511 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 456 | c | // Author:Zheng Jun
// Date:2018/1/5
// E-mail:[email protected]
#include <stdio.h>
#define PERIOD '.'
void cc(){
int ch,charcount = 0;
while ((ch = getchar()) != PERIOD){
if (ch != '"'&& ch != '\'')
charcount++;
}
printf("There are %d non-quote characters.\n",charcount);
}
//I didn't read the "I'm a programming fool" best seller.
//There are 50 non-quote characters.
//
//Process finished with exit code 35 | [
"[email protected]"
] | |
9069789010ebabe181d0a25c0a5d6f2aef0704ce | 789860364b415985fb04d577a84d9e718cd15a5e | /source/p90-6.c | b431eedb4cb542175b753206224dc5f47818e1c7 | [] | no_license | almajiro/teach-yourself-c | 9a145335452ded21383a138e8da7d40380276e06 | 36703155042083329ae025730ba875235f47f05a | refs/heads/master | 2021-09-01T00:59:54.220263 | 2017-12-24T00:51:26 | 2017-12-24T00:51:26 | 113,036,415 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 847 | c | #include "stdio.h"
int main()
{
int num;
float val;
do{
printf("変換\n");
printf("1. フィートからメートルへ\n");
printf("2. メートルからフィートへ\n");
printf("3. ポンドからキログラムへ\n");
printf("4. キログラムからポンドへ\n");
printf("5. 終了\n");
do{
printf("番号を選んで入力してください: ");
scanf("%d", &num);
}while(num < 0 || num > 5);
if(num > 0 && num < 5){
printf("数値を入力: ");
scanf("%f", &val);
}
switch(num){
case 1:
printf("%.1fメートル\n", val / 3.28);
break;
case 2:
printf("%.1fフィート\n", val * 3.28);
break;
case 3:
printf("%.1fキログラム\n", val / 0.4536);
break;
case 4:
printf("%.1fポンド\n", val * 0.4360);
break;
}
}while(num != 5);
return 0;
} | [
"[email protected]"
] | |
a22c77b2138a428d86fe3fe37f93a92df2de02eb | ec0634ad1f218943973beaec953d90e9b8fbc275 | /10-2.c | f0e36128eb65f34379f8b433b672b4dbc87bbc5f | [] | no_license | MiuraMao/SampleCode-C-Exercise- | c5b08e0e8679b7cf7a547acc5b0fe51a00e0c9f4 | c18fcfdd3b2f6f6c58138c48576beca1ab6116da | refs/heads/master | 2023-07-18T07:35:54.522751 | 2021-08-21T07:02:57 | 2021-08-21T07:02:57 | 340,798,910 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,662 | c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//行単位のファイル入力
#define MEIBOFILE "meibo.txt" //名簿ファイル名
enum{ //オブジェクト形式マクロでも良い
NAMESIZE = 55+1, //氏名の最大文字数 + 空文字分1バイト
MEIBOSIZE = 100, //名簿の最大人数
LINEBUFSIZE = 1024, //ファイルから1行読むバッファの大きさ(最後に「,」があるが規格によってはエラー)
};
struct student{
int id; //学生番号
char name[NAMESIZE]; //氏名
};
int read_meibo(struct student *, int);
int read_meibo(struct student *people, int n){ //nは最大人数
FILE *fp; //入力ストリーム
char buf[LINEBUFSIZE], *p, *name; //bufは入力バッファ
int i;
if ((fp = fopen(MEIBOFILE, "r")) == NULL){ //名簿ファイルを開く
perror("fopen");
exit(EXIT_FAILURE);
}
i = 0;
while (fgets(buf, sizeof(buf), fp) != NULL){ //名簿の各行について(fgetsはファイルの終わりに空ポインタを返す)
if ((p = strchr(buf, '\n')) != NULL) //改行文字を除去し
*p = '\0';
if ((p = strchr(buf, ',')) == NULL){ //コンマを探す
fprintf(stderr, "変なデータです:%s\n", buf);
continue; //コンマが無ければ変な行なので無視
}
name = p + 1; //コンマの次から氏名、ポインタnameで指しておく
*p = '\0'; //コンマを空文字でつぶす;bufが学生番号になる(終端文字)
people[i].id = atoi(buf); //構造体に学生番号を入れる
strncpy(people[i].name, name, NAMESIZE-1); //氏名を入れる
people[i].name[NAMESIZE-1] = '\0'; //長すぎた場合のため
if (++i >= n) //ループを終了
break;
}
fclose(fp);
return i; //読み込んだ項目数を返す
}
int main(void){
struct student poeple[MEIBOSIZE]; //名簿データを読み込む配列
int n;
n = read_meibo(poeple,MEIBOSIZE); //名簿を読み込む:読み込んだ項目数をnに
for (int i = 0; i < n; i++)
printf("[%d] %s\n", poeple[i].id, poeple[i].name); //各項目を表示
return 0;
} | [
"[email protected]"
] | |
7b18aa74ee2d2d1d687f3d4bdab446140a7af8b6 | dc4e8981de0851f81fbf87eb4c480865a14e2cb6 | /0x13-more_singly_linked_lists/lists.h | e9f038f9f5e70c782f0a7f18fea7c2b210c57e39 | [] | no_license | Alafresh/holbertonschool-low_level_programming | 08ba394519314e960ae0ddabd1b42a40d70a3527 | 485152f47af5d4afbc22111fc038e174a587a750 | refs/heads/master | 2020-06-06T13:27:31.558185 | 2020-01-17T04:36:56 | 2020-01-17T04:36:56 | 192,752,585 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 917 | h | #ifndef _LISTS_H_
#define _LISTS_H_
#include <stdlib.h>
/**
* struct listint_s - singly linked list
* @n: integer
* @next: points to the next node
*
* Description: singly linked list node structure
* for Holberton project
*/
typedef struct listint_s
{
int n;
struct listint_s *next;
} listint_t;
size_t print_listint(const listint_t *h);
size_t listint_len(const listint_t *h);
listint_t *add_nodeint(listint_t **head, const int n);
listint_t *add_nodeint_end(listint_t **head, const int n);
void free_listint(listint_t *head);
void free_listint2(listint_t **head);
int pop_listint(listint_t **head);
listint_t *get_nodeint_at_index(listint_t *head, unsigned int index);
int sum_listint(listint_t *head);
listint_t *insert_nodeint_at_index(listint_t **head, unsigned int idx, int n);
int delete_nodeint_at_index(listint_t **head, unsigned int index);
listint_t *reverse_listint(listint_t **head);
#endif
| [
"[email protected]"
] | |
d5919970179b7e876e8d1115a5be046f6a46ddc5 | 010145d88f62871af06de03f759a2d6a38ef73c0 | /mux_2x1/isim/mux_8x1frm4x1_tb_isim_beh.exe.sim/work/m_00000000004134447467_2073120511.c | 73654c8fc733c8db447213879b587167ec0106ef | [
"MIT"
] | permissive | Jayshil-Patel/Xilinx-Verilog | 07e07e85b1a722fc391df607a4d28bd9710b05a1 | 4c33040746809a116da442f5d310c45c18a1b2a5 | refs/heads/main | 2023-05-15T04:00:20.887724 | 2021-06-10T07:53:06 | 2021-06-10T07:53:06 | 364,207,133 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,973 | c | /**********************************************************************/
/* ____ ____ */
/* / /\/ / */
/* /___/ \ / */
/* \ \ \/ */
/* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */
/* / / All Right Reserved. */
/* /---/ /\ */
/* \ \ / \ */
/* \___\/\___\ */
/***********************************************************************/
/* This file is designed for use with ISim build 0x7708f090 */
#define XSI_HIDE_SYMBOL_SPEC true
#include "xsi.h"
#include <memory.h>
#ifdef __GNUC__
#include <stdlib.h>
#else
#include <malloc.h>
#define alloca _alloca
#endif
static const char *ng0 = "D:/softwares/14.7/ISE_DS/ISE/verilog/src/glbl.v";
static unsigned int ng1[] = {1U, 0U};
static unsigned int ng2[] = {0U, 0U};
static void NetDecl_16_0(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
char *t5;
char *t6;
char *t7;
unsigned int t8;
unsigned int t9;
char *t10;
unsigned int t11;
unsigned int t12;
char *t13;
unsigned int t14;
unsigned int t15;
char *t16;
LAB0: t1 = (t0 + 6960U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(16, ng0);
t2 = (t0 + 1960U);
t3 = *((char **)t2);
t2 = (t0 + 8648);
t4 = (t2 + 56U);
t5 = *((char **)t4);
t6 = (t5 + 56U);
t7 = *((char **)t6);
memset(t7, 0, 8);
t8 = 1U;
t9 = t8;
t10 = (t3 + 4);
t11 = *((unsigned int *)t3);
t8 = (t8 & t11);
t12 = *((unsigned int *)t10);
t9 = (t9 & t12);
t13 = (t7 + 4);
t14 = *((unsigned int *)t7);
*((unsigned int *)t7) = (t14 | t8);
t15 = *((unsigned int *)t13);
*((unsigned int *)t13) = (t15 | t9);
xsi_driver_vfirst_trans(t2, 0, 0U);
t16 = (t0 + 8520);
*((int *)t16) = 1;
LAB1: return;
}
static void Cont_48_1(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
char *t5;
char *t6;
char *t7;
char *t8;
char *t9;
unsigned int t10;
unsigned int t11;
char *t12;
unsigned int t13;
unsigned int t14;
char *t15;
unsigned int t16;
unsigned int t17;
char *t18;
LAB0: t1 = (t0 + 7208U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(48, ng0);
t2 = (t0 + 3640);
t3 = (t2 + 56U);
t4 = *((char **)t3);
t5 = (t0 + 8712);
t6 = (t5 + 56U);
t7 = *((char **)t6);
t8 = (t7 + 56U);
t9 = *((char **)t8);
memset(t9, 0, 8);
t10 = 1U;
t11 = t10;
t12 = (t4 + 4);
t13 = *((unsigned int *)t4);
t10 = (t10 & t13);
t14 = *((unsigned int *)t12);
t11 = (t11 & t14);
t15 = (t9 + 4);
t16 = *((unsigned int *)t9);
*((unsigned int *)t9) = (t16 | t10);
t17 = *((unsigned int *)t15);
*((unsigned int *)t15) = (t17 | t11);
xsi_driver_vfirst_trans(t5, 0, 0);
t18 = (t0 + 8536);
*((int *)t18) = 1;
LAB1: return;
}
static void Cont_49_2(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
char *t5;
char *t6;
char *t7;
char *t8;
char *t9;
unsigned int t10;
unsigned int t11;
char *t12;
unsigned int t13;
unsigned int t14;
char *t15;
unsigned int t16;
unsigned int t17;
char *t18;
LAB0: t1 = (t0 + 7456U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(49, ng0);
t2 = (t0 + 3800);
t3 = (t2 + 56U);
t4 = *((char **)t3);
t5 = (t0 + 8776);
t6 = (t5 + 56U);
t7 = *((char **)t6);
t8 = (t7 + 56U);
t9 = *((char **)t8);
memset(t9, 0, 8);
t10 = 1U;
t11 = t10;
t12 = (t4 + 4);
t13 = *((unsigned int *)t4);
t10 = (t10 & t13);
t14 = *((unsigned int *)t12);
t11 = (t11 & t14);
t15 = (t9 + 4);
t16 = *((unsigned int *)t9);
*((unsigned int *)t9) = (t16 | t10);
t17 = *((unsigned int *)t15);
*((unsigned int *)t15) = (t17 | t11);
xsi_driver_vfirst_trans(t5, 0, 0);
t18 = (t0 + 8552);
*((int *)t18) = 1;
LAB1: return;
}
static void Cont_50_3(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
char *t5;
char *t6;
char *t7;
char *t8;
char *t9;
unsigned int t10;
unsigned int t11;
char *t12;
unsigned int t13;
unsigned int t14;
char *t15;
unsigned int t16;
unsigned int t17;
char *t18;
LAB0: t1 = (t0 + 7704U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(50, ng0);
t2 = (t0 + 3960);
t3 = (t2 + 56U);
t4 = *((char **)t3);
t5 = (t0 + 8840);
t6 = (t5 + 56U);
t7 = *((char **)t6);
t8 = (t7 + 56U);
t9 = *((char **)t8);
memset(t9, 0, 8);
t10 = 1U;
t11 = t10;
t12 = (t4 + 4);
t13 = *((unsigned int *)t4);
t10 = (t10 & t13);
t14 = *((unsigned int *)t12);
t11 = (t11 & t14);
t15 = (t9 + 4);
t16 = *((unsigned int *)t9);
*((unsigned int *)t9) = (t16 | t10);
t17 = *((unsigned int *)t15);
*((unsigned int *)t15) = (t17 | t11);
xsi_driver_vfirst_trans(t5, 0, 0);
t18 = (t0 + 8568);
*((int *)t18) = 1;
LAB1: return;
}
static void Initial_52_4(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
LAB0: t1 = (t0 + 7952U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(52, ng0);
LAB4: xsi_set_current_line(53, ng0);
t2 = ((char*)((ng1)));
t3 = (t0 + 3640);
xsi_vlogvar_assign_value(t3, t2, 0, 0, 1);
xsi_set_current_line(54, ng0);
t2 = ((char*)((ng1)));
t3 = (t0 + 3960);
xsi_vlogvar_assign_value(t3, t2, 0, 0, 1);
xsi_set_current_line(55, ng0);
t2 = (t0 + 7760);
xsi_process_wait(t2, 100000LL);
*((char **)t1) = &&LAB5;
LAB1: return;
LAB5: xsi_set_current_line(56, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 3640);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(57, ng0);
t2 = ((char*)((ng2)));
t3 = (t0 + 3960);
xsi_vlogvar_assign_value(t3, t2, 0, 0, 1);
goto LAB1;
}
static void Initial_60_5(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
LAB0: t1 = (t0 + 8200U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(60, ng0);
LAB4: xsi_set_current_line(61, ng0);
t2 = ((char*)((ng1)));
t3 = (t0 + 3800);
xsi_vlogvar_assign_value(t3, t2, 0, 0, 1);
xsi_set_current_line(62, ng0);
t2 = (t0 + 8008);
xsi_process_wait(t2, 0LL);
*((char **)t1) = &&LAB5;
LAB1: return;
LAB5: xsi_set_current_line(63, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 3800);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
goto LAB1;
}
extern void work_m_00000000004134447467_2073120511_init()
{
static char *pe[] = {(void *)NetDecl_16_0,(void *)Cont_48_1,(void *)Cont_49_2,(void *)Cont_50_3,(void *)Initial_52_4,(void *)Initial_60_5};
xsi_register_didat("work_m_00000000004134447467_2073120511", "isim/mux_8x1frm4x1_tb_isim_beh.exe.sim/work/m_00000000004134447467_2073120511.didat");
xsi_register_executes(pe);
}
| [
"[email protected]"
] | |
5a6c2cb0f510849f94adcc0cbf3ad8358897bfa8 | 4a8d6bc74be31f05c2acf6ea86ef140294e7d27d | /Program_12/Main.c | 48b2f88aaab0417be85d613fe1eaaf1f8a037a65 | [] | no_license | prathamesh-1128/Work | d30e9526279f6b662fb0f43c72177eb04aef2bad | e85bf001c828533d246ec6fdde392f635da0c790 | refs/heads/master | 2022-12-24T07:07:17.247230 | 2020-09-25T08:39:18 | 2020-09-25T08:39:18 | 282,287,114 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 616 | c | /* 8.1
Accept number from user and if number is less than 50
then print small , if it is greater than 50 and less than 100 then print medium, if it is
greater than 100 then print large.
Input: 40 Output: Small
Input: 75 Output:Medium
Input: 123 Output:Greater
Input: -65 Output:Small
*/
/*
Algorithm:
Accept Number as No
Check Conditions
Display Result according to that
Continue
*/
#include "Header.h"
int main() // Entry Point Function
{
int iValue=0;
printf("Enter the number \n");
scanf("%d",&iValue);
CheckNo(iValue); // Goto function
return 0;
} | [
"[email protected]"
] | |
1d125a5071e7cb773d9a96d93c68ceb63043d786 | f6769add713ce318e9e4d15c78872c42b2ebcb19 | /carbkrnl/ob/obinit.c | b1cd4fe9fdb5f162d6cb9ff58deb15eede1757c9 | [] | no_license | gmh5225/carbon | 4c00258f939debc858ff091fae435c93e7bef473 | d466858830b7995ac57dda42847f5eb1d186b6d1 | refs/heads/main | 2023-04-06T16:11:35.122811 | 2021-04-14T00:43:52 | 2021-04-14T00:43:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,902 | c |
#include <carbsup.h>
#include "obp.h"
#include "../hal/halp.h"
#include "../ke/ki.h"
#include "../io/iop.h"
#include "../mm/mi.h"
#include "../ps/psp.h"
PLIST_ENTRY ObTypeList = NULL;
OBJECT_DIRECTORY ObRootDirectory = { RTL_CONSTANT_STRING( L"\\" ), NULL };
POBJECT_TYPE ObDirectoryObject;
POBJECT_TYPE IoSymbolicLinkObject;
POBJECT_TYPE IoDriverObject;
POBJECT_TYPE IoDeviceObject;
POBJECT_TYPE IoFileObject;
POBJECT_TYPE PsThreadObject;
POBJECT_TYPE PsProcessObject;
POBJECT_TYPE MmSectionObject;
POBJECT_TYPE KeEventObject;
POBJECT_TYPE MmDmaAdapterObject;
NTSTATUS
ObCreateObjectType(
_Out_ POBJECT_TYPE* ObjectType,
_In_ PUNICODE_STRING ObjectName,
_In_ ULONG Tag,
_In_opt_ OBJECT_CLEANUP Cleanup
)
{
*ObjectType = MmAllocatePoolWithTag( NonPagedPoolZeroed, sizeof( OBJECT_TYPE ), OB_TAG );
RtlCopyMemory( &( *ObjectType )->Name, ObjectName, sizeof( UNICODE_STRING ) );
( *ObjectType )->Tag = Tag;
( *ObjectType )->Cleanup = Cleanup;
if ( ObTypeList == NULL ) {
KeInitializeHeadList( &( *ObjectType )->TypeList );
ObTypeList = &( *ObjectType )->TypeList;
}
else {
KeInsertTailList( ObTypeList, &( *ObjectType )->TypeList );
}
return STATUS_SUCCESS;
}
POBJECT_DIRECTORY
ObCreateDirectory(
)
{
OBJECT_ATTRIBUTES DirectoryAttributes = { { 0, 0, NULL }, { 0, 0, NULL }, OBJ_PERMANENT_OBJECT };
POBJECT_DIRECTORY Directory;
ObCreateObject( &Directory, ObDirectoryObject, &DirectoryAttributes, sizeof( OBJECT_DIRECTORY ) );
return Directory;
}
POBJECT_DIRECTORY
ObCreateDirectoryHead(
)
{
//
// Directory heads are the first entries of complete directories
// the actual directory name is inside the directory object which
// points to this as an object.
//
OBJECT_ATTRIBUTES DirectoryAttributes = { { 0, 0, NULL }, { 0, 0, NULL }, OBJ_PERMANENT_OBJECT };
POBJECT_DIRECTORY Directory;
ObCreateObject( &Directory, ObDirectoryObject, &DirectoryAttributes, sizeof( OBJECT_DIRECTORY ) );
Directory->Object = NULL;
Directory->Name.Buffer = L"..";
Directory->Name.Length = sizeof( L".." ) - 2;
Directory->Name.MaximumLength = sizeof( L".." );
return Directory;
}
VOID
ObInsertDirectoryEntry(
_In_ POBJECT_DIRECTORY Directory,
_In_ PUNICODE_STRING Name,
_In_ PVOID Object
)
{
POBJECT_DIRECTORY Last;
//RtlDebugPrint( L"dir: %s, %s\n", Directory->Name.Buffer, Name->Buffer );
Last = Directory->DirectoryLink;
if ( Directory->DirectoryLink == NULL ) {
Directory->DirectoryLink = ObCreateDirectory( );
Directory->DirectoryLink->DirectoryLink = NULL;
Directory->DirectoryLink->Object = Object;
RtlCopyMemory( &Directory->DirectoryLink->Name, Name, sizeof( UNICODE_STRING ) );
}
else {
while ( Last->DirectoryLink != NULL ) {
Last = Last->DirectoryLink;
}
Last->DirectoryLink = ObCreateDirectory( );
Last->DirectoryLink->DirectoryLink = NULL;
Last->DirectoryLink->Object = Object;
RtlCopyMemory( &Last->DirectoryLink->Name, Name, sizeof( UNICODE_STRING ) );
}
}
VOID
ObInitializeObjectManager(
)
{
UNICODE_STRING ObjectDirectoryName = RTL_CONSTANT_STRING( L"Directory" );
UNICODE_STRING ObjectSymbolicLinkName = RTL_CONSTANT_STRING( L"SymbolicLink" );
UNICODE_STRING ObjectDriverName = RTL_CONSTANT_STRING( L"Driver" );
UNICODE_STRING ObjectDeviceName = RTL_CONSTANT_STRING( L"Device" );
UNICODE_STRING ObjectThreadName = RTL_CONSTANT_STRING( L"Thread" );
UNICODE_STRING ObjectEventName = RTL_CONSTANT_STRING( L"Event" );
UNICODE_STRING ObjectFileName = RTL_CONSTANT_STRING( L"File" );
UNICODE_STRING ObjectSectionName = RTL_CONSTANT_STRING( L"Section" );
UNICODE_STRING ObjectMutexName = RTL_CONSTANT_STRING( L"Mutex" );
UNICODE_STRING ObjectInterruptName = RTL_CONSTANT_STRING( L"Interrupt" );
UNICODE_STRING ObjectDmaAdapterName = RTL_CONSTANT_STRING( L"DmaAdapter" );
UNICODE_STRING DeviceDirectory = RTL_CONSTANT_STRING( L"Device" );
UNICODE_STRING GlobalDirectory = RTL_CONSTANT_STRING( L"??" );
UNICODE_STRING DriverDirectory = RTL_CONSTANT_STRING( L"Driver" );
UNICODE_STRING KnownDllsDirectory = RTL_CONSTANT_STRING( L"KnownDlls" );
//
// Implement object destroy callbacks for cleaning up
// extra buffers, like thread stacks and device extensions
//
ObCreateObjectType( &ObDirectoryObject, &ObjectDirectoryName, 'eriD', NULL );
ObCreateObjectType( &IoSymbolicLinkObject, &ObjectSymbolicLinkName, 'kniL', NULL );
ObCreateObjectType( &IoDriverObject, &ObjectDriverName, 'virD', NULL );
ObCreateObjectType( &PsThreadObject, &ObjectThreadName, 'erhT', ( OBJECT_CLEANUP )PspCleanupThread );
ObCreateObjectType( &PsProcessObject, &ObjectThreadName, 'corP', NULL );
ObCreateObjectType( &IoDeviceObject, &ObjectDeviceName, 'iveD', ( OBJECT_CLEANUP )IopCleanupDevice );
ObCreateObjectType( &KeEventObject, &ObjectEventName, 'nevE', NULL );
ObCreateObjectType( &IoFileObject, &ObjectFileName, 'eliF', ( OBJECT_CLEANUP )IopCleanupFile );
ObCreateObjectType( &MmSectionObject, &ObjectSectionName, 'tceS', ( OBJECT_CLEANUP )MiCleanupSection );
ObCreateObjectType( &KeMutexObject, &ObjectMutexName, 'etuM', NULL );
ObCreateObjectType( &IoInterruptObject, &ObjectInterruptName, ' tnI', NULL );
ObCreateObjectType( &MmDmaAdapterObject, &ObjectDmaAdapterName, ' AMD', NULL );
ObInsertDirectoryEntry( &ObRootDirectory, &DeviceDirectory, ObCreateDirectoryHead( ) );
ObInsertDirectoryEntry( &ObRootDirectory, &GlobalDirectory, ObCreateDirectoryHead( ) );
ObInsertDirectoryEntry( &ObRootDirectory, &DriverDirectory, ObCreateDirectoryHead( ) );
ObInsertDirectoryEntry( &ObRootDirectory, &KnownDllsDirectory, ObCreateDirectoryHead( ) );
}
| [
"[email protected]"
] | |
5e3885f1eb4fdd884a4296f0b0e3dffab243a338 | c2c1602af2fa8a5929859b536d915a44c00c4cfe | /dylan2/range.c | ebe44fd3850cd5a4b5357b6d62ecaddfdfb1682b | [] | no_license | netbsduser/vub-dylan | 1ce11b13ef2b48bb30f61bf375478badc1bb4503 | 8f0b3ff65546b66c2728870a932af3a6df7392f3 | refs/heads/master | 2021-05-28T17:21:42.383203 | 2015-02-04T16:57:26 | 2015-02-04T16:57:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,771 | c | #include "range.h"
#include "keyword.h"
#include <string.h>
/*
+------------------------------------------------------------------
| FUNCTION : range::range
| INPUT : -
| OUTPUT : -
| RETURN : een range
| DATE :
|
| ABSTRACT : Constructor voor een range (een range is een set van
| getallen )
|
| CHANGES :
+------------------------------------------------------------------
*/
range::range()
{
id = "<range>";
from = 0.0 ;
to = 0.0 ;
above = 0.0 ;
below = 0.0 ;
size = 0 ;
by = 1.0 ;
Abstract = FALSE ;
Sealed = FALSE;
Instantiable = TRUE ;
NbrSuperclasses = 1 ;
Superclass = new (GC) DylanObject * [1] ;
Superclass[0] = new sequence ;
}
/*
+------------------------------------------------------------------
| FUNCTION : range::GetElement
| INPUT : int : Ide element
| OUTPUT : -
| RETURN : een getal
| DATE :
|
| ABSTRACT : Ophalen van het ide element.
|
| CHANGES :
+------------------------------------------------------------------
*/
DylanObject *range::GetElement( int i )
{
local = i * by + from ;
if ( below != 0.0 && local > below ) local = below ;
if ( above != 0.0 && local < above ) local = above ;
if (i > size && size != 0 ) local = 0.0 ;
return new double_float( local );
}
/*
+------------------------------------------------------------------
| FUNCTION : Setter
| INPUT : double : ignored
| OUTPUT : -
| RETURN : -
| DATE :
|
| ABSTRACT : In een range kan men de waarden niet wijzigen.
|
| CHANGES :
+------------------------------------------------------------------
*/
void range::Setter( double x )
{
printf( "error : not applicable\n" ) ;
}
/*
+------------------------------------------------------------------
| FUNCTION : range::Instance
| INPUT :
| OUTPUT :
| RETURN :
| DATE :
|
| ABSTRACT : Maken van een instance van een range
|
| CHANGES :
+------------------------------------------------------------------
*/
DylanObject *range::Instance(DylanObject *X, List<DylanObject *> *InitList )
{
static DylanObject *O ;
if ( InitList != NULL )
{
O = new range( NULL, InitList ) ;
}
else
{
O = new range ;
}
return O ;
}
/*
+------------------------------------------------------------------
| FUNCTION : range::range
| INPUT : int : een dummy
| List<DylanObject *> : initialisatie keyworden
| OUTPUT : -
| RETURN : een range
| DATE :
|
| ABSTRACT : creatie van een range met init keywords, deze keywords
| zijn :
| from, to, below, above, size, by
|
| CHANGES :
+------------------------------------------------------------------
*/
range::range( int *dummy, List<DylanObject *> *InitList )
{
int i ;
char str[255] ;
id = "<range>";
from = 0 ;
by = 1 ;
above = 0 ;
below = 0 ;
size = 0 ;
for( i = 1; i <= InitList->GetSize(); i++ )
{
InitList->MoveTo(i) ;
InitList->GetItem()->Getter(str) ;
if ( strcmp( str, "from:" ) == 0 )
{
((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&from) ;
}
else if ( strcmp( str, "to:" ) == 0 )
{
((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&to) ;
}
else if ( strcmp( str, "above:" ) == 0 )
{
((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&above) ;
}
else if ( strcmp( str, "below:" ) == 0 )
{
((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&below) ;
}
else if ( strcmp( str, "by:" ) == 0 )
{
((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&by) ;
}
else if ( strcmp( str, "size:" ) == 0 )
{
((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&size) ;
}
else error( "Invalid keyword supplied to range !" ) ;
}
Abstract = FALSE ;
Sealed = FALSE;
Instantiable = TRUE ;
Superclass = new DylanObject * [1] ;
Superclass[0] = new sequence ;
}
/*
+------------------------------------------------------------------
| FUNCTION : operator==
| INPUT : een range
| OUTPUT : -
| RETURN : boolean
| DATE :
|
| ABSTRACT : test of 2 ranges gelijk zijn (ttz identieke keywords
| getallen )
|
| CHANGES :
+------------------------------------------------------------------
*/
int range::operator==( const DylanObject *X )
{
return( (this->from == ((range *) X)->from) &&
(this->by == ((range *) X)->by) &&
(this->above == ((range *) X)->above) &&
(this->below == ((range *) X)->below) &&
(this->size == ((range *) X)->size) ) ;
}
| [
"[email protected]"
] | |
159c26da67f06de1ae0984a945def3d15f001eea | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/arch/mips/lasat/extr_picvue_proc.c_pvc_scroll_proc_show.c | 645275be5dc5367dad315e532428273f412c7c51 | [] | 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 | 886 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct seq_file {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pvc_mutex ;
int scroll_dir ;
int scroll_interval ;
int /*<<< orphan*/ seq_printf (struct seq_file*,char*,int) ;
__attribute__((used)) static int pvc_scroll_proc_show(struct seq_file *m, void *v)
{
mutex_lock(&pvc_mutex);
seq_printf(m, "%d\n", scroll_dir * scroll_interval);
mutex_unlock(&pvc_mutex);
return 0;
} | [
"[email protected]"
] | |
603a23f00ea88b97e0b9277a95e1e3929124d100 | 59f633465472973aeafbbb7f92681dd2c757ce96 | /src/os/FlashFS/Flash/AT45DB321C/FS_SPI_FlashPrg.c | 874bfc02f4bca90fa57c4230baf5bb3dd5f45790 | [] | no_license | kentworld01/dlc_four | 629452604e26bce4a1704e73ec15ada003a81597 | d51e8fa9a124e832274578facee8427a75113744 | refs/heads/master | 2021-01-01T17:33:20.574925 | 2011-10-14T14:00:11 | 2011-10-14T14:00:11 | 2,300,829 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,901 | c | /*----------------------------------------------------------------------------
* R T L - F l a s h F i l e S y s t e m
*----------------------------------------------------------------------------
* Name: FS_SPI_FLASHPRG.C
* Purpose: Flash Programming Functions - Atmel Data Flash AT45DB321C (SPI)
* Rev.: V4.00
*----------------------------------------------------------------------------
* This code is part of the RealView Run-Time Library.
* Copyright (c) 2004-2007 KEIL - An ARM Company. All rights reserved.
*---------------------------------------------------------------------------*/
#include <File_Config.h>
#define PAGE_SZ 528 /* Page size */
#define BLOCK_SZ (8*PAGE_SZ) /* Block size (used for erase) */
#define SECT_SZ (16*BLOCK_SZ) /* Virtual sector size */
/* SPI Data Flash Commands */
#define SPI_READ_DATA 0xE8
#define SPI_READ_STATUS 0xD7
#define SPI_BLOCK_ERASE 0x50
#define SPI_BUF1_WRITE 0x84
#define SPI_PAGE_PROGRAM 0x83
#define SPI_PAGE_READ 0x53
/* Local functions */
static void set_adr (U8 *cmd, U32 adr);
static void spi_write (U8 cmnd, U8 cmndlen, U32 adr, U8 *buf, U32 sz);
/*----------------------------------------------------------------------------
* Initialize Flash Programming Functions
* Return Value: 0 - Init OK
* 1 - Init Failed
*---------------------------------------------------------------------------*/
int fs_spi_Init (void) {
/* Initialize SPI host interface. */
spi_init ();
return (0);
} /* end of fs_spi_Init */
/*----------------------------------------------------------------------------
* Erase Sector in Flash Memory.
* Parameter: adr: Virtual Sector Address
* Return Value: 0 - Erase OK
* 1 - Erase Failed
*---------------------------------------------------------------------------*/
int fs_spi_EraseSector (U32 adr) {
U32 i;
/* Virtual sector size is 16 blocks. */
for (i = 0; i < (SECT_SZ/BLOCK_SZ); i++) {
spi_write (SPI_BLOCK_ERASE, 4, adr, NULL, 0);
adr += BLOCK_SZ;
}
return (0);
} /* end of fs_spi_EraseSector */
/*----------------------------------------------------------------------------
* Program Page in Flash Memory.
* Parameter: adr: Start Address
* sz: Size
* buf: Data
* Return Value: 0 - Program OK
* 1 - Program failed
*---------------------------------------------------------------------------*/
int fs_spi_ProgramPage (U32 adr, U32 sz, U8 *buf) {
U32 cnt;
while (sz) {
/* Read Flash Page to Buf 1. */
spi_write (SPI_PAGE_READ, 4, adr, NULL, 0);
cnt = PAGE_SZ - (adr % PAGE_SZ);
if (cnt > sz) cnt = sz;
spi_write (SPI_BUF1_WRITE, 4, adr, buf, cnt);
spi_write (SPI_PAGE_PROGRAM, 4, adr, buf, PAGE_SZ);
adr += cnt;
buf += cnt;
sz -= cnt;
}
return (0);
} /* end of fs_spi_ProgramPage */
/*----------------------------------------------------------------------------
* Read Data from Flash Memory.
* Parameter: adr: Start Address
* sz: Size
* buf: Data
* Return Value: 0 - Read OK
* 1 - Read failed
*---------------------------------------------------------------------------*/
int fs_spi_ReadData (U32 adr, U32 sz, U8 *buf) {
U8 adrByte[3];
U32 i;
set_adr (&adrByte[0], adr);
spi_ss (0);
spi_send (SPI_READ_DATA);
spi_send (adrByte[0]);
spi_send (adrByte[1]);
spi_send (adrByte[2]);
for (i = 0; i < 4; i++) {
spi_send (0xFF); /* 4 bytes dont care */
}
for (i = 0; i < sz; i++) {
*(buf+i) = spi_send (0xFF);
}
spi_ss (1);
return (0);
} /* end of fs_spi_ReadData */
/*----------------------------------------------------------------------------
* Send SPI Command to Data Flash.
*---------------------------------------------------------------------------*/
static void spi_write (U8 cmnd, U8 cmndlen, U32 adr, U8 *buf, U32 sz) {
U8 adrByte[3];
U8 sr;
U32 i;
set_adr (&adrByte[0], adr);
switch (cmnd) {
case SPI_BLOCK_ERASE:
case SPI_PAGE_READ:
case SPI_PAGE_PROGRAM:
spi_ss (0);
spi_send (cmnd);
spi_send (adrByte[0]);
spi_send (adrByte[1]);
spi_send (adrByte[2]);
spi_ss (1);
break;
case SPI_BUF1_WRITE:
spi_ss (0);
spi_send (cmnd);
spi_send (adrByte[0]);
spi_send (adrByte[1]);
spi_send (adrByte[2]);
for (i = 0; i < sz; i++) {
spi_send (*(buf+i));
}
spi_ss (1);
break;
}
/* Wait while device is Busy. */
spi_ss (0);
spi_send (SPI_READ_STATUS);
spi_send (0xFF); /* dummy byte */
do {
sr = spi_send (0xFF);
} while ((sr & 0x80) == 0);
spi_ss (1);
}
/*----------------------------------------------------------------------------
* Convert linear address to segmented Data Flash address
*---------------------------------------------------------------------------*/
static void set_adr (U8 *cmd, U32 adr) {
U32 bl_adr, pg_adr;
bl_adr = adr / PAGE_SZ;
pg_adr = adr % PAGE_SZ;
adr = (bl_adr << 10) | pg_adr;
cmd[0] = (U8)(adr >> 16);
cmd[1] = (U8)(adr >> 8 );
cmd[2] = (U8)(adr >> 0 );
}
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
| [
"Administrator@.(none)"
] | Administrator@.(none) |
59124876fc71512b4797d2bfa7534d8c46c4f760 | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14651/function14651_schedule_25/function14651_schedule_25_wrapper.h | e1949bca053adee99f0dd20a513b2487e3cb03c7 | [] | 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 | 330 | h | #ifndef HALIDE__generated_function14651_schedule_25_h
#define HALIDE__generated_function14651_schedule_25_h
#include <tiramisu/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
int function14651_schedule_25(halide_buffer_t *buf00, halide_buffer_t *buf01, halide_buffer_t *buf0);
#ifdef __cplusplus
} // extern "C"
#endif
#endif | [
"[email protected]"
] | |
dcf46ca16c74bc0494c1f9ebdc1319aceeef8ccc | 4ea6a61aef7ddd8785d75513a8ea73576f103d1e | /benchmarks/real-verification/bind-8.2.1-src/lib/inet/nsap_addr.c | 650254caad3268ea1c3d49abd6cbad8a3784e131 | [
"LicenseRef-scancode-unknown-license-reference",
"ISC"
] | permissive | probertool/Prober | 287190a03b6d6a40ba77295ccef132226f800420 | c75047af835ba7ddf60fb3f72f686ea4c56a08b5 | refs/heads/master | 2020-09-09T07:45:33.005153 | 2019-11-13T05:39:15 | 2019-11-13T05:39:15 | 221,385,993 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,379 | c | /*
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAI!
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANT!
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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 TH!
* SOFTWARE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$Id: nsap_addr.c,v 8.9 1999/01/08 19:23:49 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <resolv.h>
#include "port_after.h"
static char
xtob(int c) {
return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
}
u_int
inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
u_char c, nib;
u_int len = 0;
while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
if (c == '.' || c == '+' || c == '/')
continue;
if (!isascii(c))
return (0);
if (islower(c))
c = toupper(c);
if (isxdigit(c)) {
nib = xtob(c);
c = *ascii++;
if (c != '\0') {
c = toupper(c);
if (isxdigit(c)) {
*binary++ = (nib << 4) | xtob(c);
len++;
} else
return (0);
}
else
return (0);
}
else
return (0);
}
return (len);
}
char *
inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
int nib;
int i;
static char tmpbuf[255*3];
char *start;
if (ascii)
start = ascii;
else {
ascii = tmpbuf;
start = tmpbuf;
}
if (binlen > 255)
binlen = 255;
for (i = 0; i < binlen; i++) {
nib = *binary >> 4;
*ascii++ = nib + (nib < 10 ? '0' : '7');
nib = *binary++ & 0x0f;
*ascii++ = nib + (nib < 10 ? '0' : '7');
if (((i % 2) == 0 && (i + 1) < binlen))
*ascii++ = '.';
}
*ascii = '\0';
return (start);
}
| [
"[email protected]"
] | |
ef416ca38906f00ec4368ae2d5225eef849c3eaa | 29cb7e03fb6f5abe5d1fa540d77776114addfd3f | /lab5/fs/fs.c | 9f871a00fada867e7dde61d91bda53ddb8abcbb9 | [] | no_license | sujanbolisetti/cse506 | b092a11348ff83380f92a8eabcf32921d0028d63 | 835a52709e221a896d1994155fbfcd70cac787b4 | refs/heads/master | 2021-01-25T04:52:42.669247 | 2015-01-02T02:28:00 | 2015-01-02T02:28:00 | 28,700,643 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,846 | c | #include <inc/string.h>
#include "fs.h"
// --------------------------------------------------------------
// Super block
// --------------------------------------------------------------
// Validate the file system super-block.
void
check_super(void)
{
if (super->s_magic != FS_MAGIC)
panic("bad file system magic number");
if (super->s_nblocks > DISKSIZE/BLKSIZE)
panic("file system is too large");
cprintf("superblock is good\n");
}
// --------------------------------------------------------------
// File system structures
// --------------------------------------------------------------
// Initialize the file system
void
fs_init(void)
{
static_assert(sizeof(struct File) == 256);
// Find a JOS disk. Use the second IDE disk (number 1) if available.
if (ide_probe_disk1())
ide_set_disk(1);
else
ide_set_disk(0);
bc_init();
// Set "super" to point to the super block.
super = diskaddr(1);
check_super();
}
// Find the disk block number slot for the 'filebno'th block in file 'f'.
// Set '*ppdiskbno' to point to that slot.
// The slot will be one of the f->f_direct[] entries,
// or an entry in the indirect block.
// When 'alloc' is set, this function will allocate an indirect block
// if necessary.
//
// Note, for the read-only file system (lab 5 without the challenge),
// alloc will always be false.
//
// Returns:
// 0 on success (but note that *ppdiskbno might equal 0).
// -E_NOT_FOUND if the function needed to allocate an indirect block, but
// alloc was 0.
// -E_NO_DISK if there's no space on the disk for an indirect block.
// -E_INVAL if filebno is out of range (it's >= NDIRECT + NINDIRECT).
//
// Analogy: This is like pgdir_walk for files.
// Hint: Don't forget to clear any block you allocate.
static int
file_block_walk(struct File *f, uint32_t filebno, uint32_t **ppdiskbno, bool alloc)
{
// LAB 5: Your code here.
if(filebno >= NDIRECT + NINDIRECT)
{
return -E_INVAL;
}
else if(filebno < NDIRECT)
{
*ppdiskbno= &f->f_direct[filebno];
return 0;
}
else
{
uint32_t *va = diskaddr(f->f_indirect);
*ppdiskbno = &va[filebno-NDIRECT];
return 0;
}
return 0;
}
// Set *blk to the address in memory where the filebno'th
// block of file 'f' would be mapped.
//
// Returns 0 on success, < 0 on error. Errors are:
// -E_NO_DISK if a block needed to be allocated but the disk is full.
// -E_INVAL if filebno is out of range.
//
int
file_get_block(struct File *f, uint32_t filebno, char **blk)
{
// LAB 5: Your code here.
uint32_t *ppdiskbno;
int r;
if(filebno >= NDIRECT + NINDIRECT)
{
return -E_INVAL;
}
if((r=file_block_walk(f,filebno,&ppdiskbno,false)<0))
{
return -E_INVAL;
}
else
{
*blk = diskaddr(*ppdiskbno);
}
return 0;
}
// Try to find a file named "name" in dir. If so, set *file to it.
//
// Returns 0 and sets *file on success, < 0 on error. Errors are:
// -E_NOT_FOUND if the file is not found
static int
dir_lookup(struct File *dir, const char *name, struct File **file)
{
int r;
uint32_t i, j, nblock;
char *blk;
struct File *f;
// Search dir for name.
// We maintain the invariant that the size of a directory-file
// is always a multiple of the file system's block size.
assert((dir->f_size % BLKSIZE) == 0);
nblock = dir->f_size / BLKSIZE;
for (i = 0; i < nblock; i++) {
if ((r = file_get_block(dir, i, &blk)) < 0)
return r;
f = (struct File*) blk;
for (j = 0; j < BLKFILES; j++)
if (strcmp(f[j].f_name, name) == 0) {
*file = &f[j];
return 0;
}
}
return -E_NOT_FOUND;
}
// Skip over slashes.
static const char*
skip_slash(const char *p)
{
while (*p == '/')
p++;
return p;
}
// Evaluate a path name, starting at the root.
// On success, set *pf to the file we found
// and set *pdir to the directory the file is in.
// If we cannot find the file but find the directory
// it should be in, set *pdir and copy the final path
// element into lastelem.
static int
walk_path(const char *path, struct File **pdir, struct File **pf, char *lastelem)
{
const char *p;
char name[MAXNAMELEN];
struct File *dir, *f;
int r;
// if (*path != '/')
// return -E_BAD_PATH;
path = skip_slash(path);
f = &super->s_root;
dir = 0;
name[0] = 0;
if (pdir)
*pdir = 0;
*pf = 0;
while (*path != '\0') {
dir = f;
p = path;
while (*path != '/' && *path != '\0')
path++;
if (path - p >= MAXNAMELEN)
return -E_BAD_PATH;
memmove(name, p, path - p);
name[path - p] = '\0';
path = skip_slash(path);
if (dir->f_type != FTYPE_DIR)
return -E_NOT_FOUND;
if ((r = dir_lookup(dir, name, &f)) < 0) {
if (r == -E_NOT_FOUND && *path == '\0') {
if (pdir)
*pdir = dir;
if (lastelem)
strcpy(lastelem, name);
*pf = 0;
}
return r;
}
}
if (pdir)
*pdir = dir;
*pf = f;
return 0;
}
// --------------------------------------------------------------
// File operations
// --------------------------------------------------------------
// Open "path". On success set *pf to point at the file and return 0.
// On error return < 0.
int
file_open(const char *path, struct File **pf)
{
return walk_path(path, 0, pf, 0);
}
// Read count bytes from f into buf, starting from seek position
// offset. This meant to mimic the standard pread function.
// Returns the number of bytes read, < 0 on error.
ssize_t
file_read(struct File *f, void *buf, size_t count, off_t offset)
{
int r, bn;
off_t pos;
char *blk;
if (offset >= f->f_size)
return 0;
count = MIN(count, f->f_size - offset);
for (pos = offset; pos < offset + count; ) {
if ((r = file_get_block(f, pos / BLKSIZE, &blk)) < 0)
return r;
bn = MIN(BLKSIZE - pos % BLKSIZE, offset + count - pos);
memmove(buf, blk + pos % BLKSIZE, bn);
pos += bn;
buf += bn;
}
return count;
}
| [
"[email protected]"
] | |
7e0819edb8ff18cf9be9cb3700d5ea099eefa9fb | 0f0fbd191f174c7386f1105148c3d55044339224 | /InterchangeMaxWithMinInArray/DataSets/DataSetsImplementation.h | 60c2e9ba6fbcc6ecec4123187962e3df599d5fbc | [
"MIT"
] | permissive | CiganOliviu/C-projects-tests | b23de03ddc21fa399d9c5342521edf7dce9d02c5 | 9c92aa496a2097d7d38ad9c3c6e05d7d2bc2e8c0 | refs/heads/main | 2023-02-09T06:57:07.709016 | 2021-01-03T17:22:13 | 2021-01-03T17:22:13 | 300,746,233 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 1,537 | h | //
// Created by cigan on 15.10.2020.
//
#ifndef INTERCHANGEMAXWITHMININARRAY_DATASETSIMPLEMENTATION_H
#define INTERCHANGEMAXWITHMININARRAY_DATASETSIMPLEMENTATION_H
#include "DataSetsDef.h"
void DataSetOne(OneDimensionalArrayType * Array) {
Array->Length = 5;
Array->OneDimensionalArray[0] = 12;
Array->OneDimensionalArray[1] = -12;
Array->OneDimensionalArray[2] = 13;
Array->OneDimensionalArray[3] = 234;
Array->OneDimensionalArray[4] = -5;
}
void DataSetTwo(OneDimensionalArrayType * Array) {
Array->Length = 7;
Array->OneDimensionalArray[0] = 7;
Array->OneDimensionalArray[1] = 1;
Array->OneDimensionalArray[2] = 5;
Array->OneDimensionalArray[3] = -4;
Array->OneDimensionalArray[4] = 3;
Array->OneDimensionalArray[5] = -2;
Array->OneDimensionalArray[6] = -6;
}
void ExpectedSetOne(OneDimensionalArrayType * Array) {
Array->Length = 5;
Array->OneDimensionalArray[0] = 12;
Array->OneDimensionalArray[1] = 234;
Array->OneDimensionalArray[2] = 13;
Array->OneDimensionalArray[3] = -12;
Array->OneDimensionalArray[4] = -5;
}
void ExpectedSetTwo(OneDimensionalArrayType * Array) {
Array->Length = 7;
Array->OneDimensionalArray[0] = -6;
Array->OneDimensionalArray[1] = 1;
Array->OneDimensionalArray[2] = 5;
Array->OneDimensionalArray[3] = -4;
Array->OneDimensionalArray[4] = 3;
Array->OneDimensionalArray[5] = -2;
Array->OneDimensionalArray[6] = 7;
}
#endif //INTERCHANGEMAXWITHMININARRAY_DATASETSIMPLEMENTATION_H
| [
"[email protected]"
] | |
484b5c3caca5f38b2d9e8d0dc2bb1122e9f49ad3 | eb266f888155c0fa59c923d7496e875c7259f1de | /include/lib/lib_cursor.h | b58e60c0944334295b30d5e03ddb765475a01e2b | [
"BSD-2-Clause"
] | permissive | werererer/japokwm | e7f46b210e7daf6a7d3a6bb8c61d912c40a2cb58 | 9cdc208ed70d4b58a805431992e4078171403edd | refs/heads/master | 2023-05-25T18:46:40.826666 | 2023-01-15T22:26:59 | 2023-01-15T22:26:59 | 297,172,042 | 121 | 4 | BSD-2-Clause | 2023-01-15T22:27:00 | 2020-09-20T22:06:29 | C | UTF-8 | C | false | false | 144 | h | #ifndef LIB_CURSOR_H
#define LIB_CURSOR_H
#include <lua.h>
#include <lauxlib.h>
void lua_load_cursor(lua_State *L);
#endif /* LIB_CURSOR_H */
| [
"[email protected]"
] | |
0ba3dd959cbb6737162fc8d1155c8a122e962119 | 5f9b26a41102c38da28b8f757a5586f9bc7cf71a | /crates/zig_build_bin_windows_x86_64/zig-windows-x86_64-0.5.0+80ff549e2/lib/zig/libc/musl/src/complex/ccos.c | 0d7511b4586405d5dbc5b5f9267420d9929cc8fb | [
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-musl-exception",
"MIT"
] | permissive | jeremyBanks/zig_with_cargo | f8e65f14adf17ed8d477f0856257422c2158c63f | f8ee46b891bbcdca7ff20f5cad64aa94c5a1d2d1 | refs/heads/master | 2021-02-06T10:26:17.614138 | 2020-03-09T04:46:26 | 2020-03-09T04:46:26 | 243,905,553 | 4 | 1 | null | null | null | null | UTF-8 | C | false | false | 146 | c | #include "complex_impl.h"
/* cos(z) = cosh(i z) */
double complex ccos(double complex z)
{
return ccosh(CMPLX(-cimag(z), creal(z)));
}
| [
"[email protected]"
] | |
1e2ce7bdc53a715aeb8864f82e8628cfec191d47 | a3c1435f81aec000a21c7c6195d45ec20c102fc7 | /CycloneTCP_SSL_Crypto_Open_1_8_6/cyclone_tcp/coap/coap_client_block.h | 37fa5a36877a43739f83bfe21fd29882118fb86f | [] | no_license | koson/TI-modbus | bd75657550fb867dedaf4b8da0d38c58e2d06195 | f7fd89deac773700714c8e9bf70943b37adf36af | refs/heads/master | 2020-05-09T00:10:30.235887 | 2019-04-08T19:45:37 | 2019-04-08T19:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,768 | h | /**
* @file coap_client_block.h
* @brief CoAP block-wise transfer
*
* @section License
*
* Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
*
* This file is part of CycloneTCP Open.
*
* 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.
*
* @author Oryx Embedded SARL (www.oryx-embedded.com)
* @version 1.8.6
**/
#ifndef _COAP_CLIENT_BLOCK_H
#define _COAP_CLIENT_BLOCK_H
//Dependencies
#include "core/net.h"
#include "coap/coap_client.h"
//C++ guard
#ifdef __cplusplus
extern "C" {
#endif
//CoAP client related functions
error_t coapClientSetTxBlockSize(CoapClientRequest *request, uint_t blockSize);
error_t coapClientSetRxBlockSize(CoapClientRequest *request, uint_t blockSize);
error_t coapClientWriteBody(CoapClientRequest *request, const void *data,
size_t length, size_t *written, bool_t last);
error_t coapClientReadBody(CoapClientRequest *request, void *data,
size_t size, size_t *received);
CoapBlockSize coapClientGetMaxBlockSize(void);
//C++ guard
#ifdef __cplusplus
}
#endif
#endif
| [
"[email protected]"
] | |
d9039ed1a1ce7802129b9e9de194b3d08fa099b2 | c2cedcf36667730f558ab354bea4505b616c90d2 | /players/mizan/opl/vehicles/yellow_h2.c | 7ffe272acc224fd828eb7aa4548c43a6ebae779f | [] | no_license | wugouzi/Nirvlp312mudlib | 965ed876c7080ab00e28c5d8cd5ea9fc9e46258f | 616cad7472279cc97c9693f893940f5336916ff8 | refs/heads/master | 2023-03-16T03:45:05.510851 | 2017-09-21T17:05:00 | 2017-09-21T17:05:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,716 | c | inherit "/players/mizan/opl/core/vehicle.c";
#include "/obj/ansi.h"
/*
* our reset method
*
*/
reset(arg)
{
string tmp_ldesc;
string tmp_long;
object bin;
tmp_ldesc = " You are inside the massively boxy Hummer H2. Although concieved as\n";
tmp_ldesc += " the more budget version of the original H1, it is more sought after\n";
tmp_ldesc += " than its military-birthed sibling. It's offroading performance is\n";
tmp_ldesc += " also more suspect as well. However none of this matters, as it is\n";
tmp_ldesc += " a big, tough-looking vehicle that people will march in horedes to buy.\n";
tmp_long = " This is the monstrosity known as the Hummer H2. Surrounded by 6400 lbs.\n\n";
tmp_long += " of truck, you can't help but feel safe and secure. But are you? None of that\n";
tmp_long += " is particularly relevant, since you are inside the vehicle which has caused\n";
tmp_long += " more buzz and publicity for any Detroit-generated vehicle for some time.\n";
::reset(arg);
if(arg) return;
set_name("Hummer H2");
set_race("hummer");
set_alias("h2");
set_short(BLK + HBYEL + "A bright yellow Hummer H2 SUV" + NORM + NORM);
set_long(tmp_long);
set_level(10);
set_hp(1000);
set_al(0);
set_wc(3);
set_ac(30);
set_aggressive(0);
set_hatch_id("door");
set_maximum_fuel(100);
set_maximum_occupants(8);
set_key_id("h2hummer_key");
set_engine_key_id("h2hummer_ignition_key");
set_fuel(85);
set_fuel_id("gasoline_fuel");
set_inside_short_desc("Inside the Hummer H2");
set_inside_long_desc(tmp_ldesc);
set_exit_mess("leaves with a deafening roar");
set_enter_mess("arrives, it's sheer bulk terrifying you");
set_engine_startup_message("The Hummer H2's engine kicks to life with a deafening roar!\n");
set_engine_stop_message("The Hummer H2's engine shuts off.\nSilence can be enjoyed again.\n");
set_fuel_idle_consumption(20);
set_fuel_overflow_mess("The tank is full, and some extra gasoline gushes out.\n");
enable_horn();
set_horn_verb("honk");
set_horn_mess("The Hummer H2's horn goes off... HOOOOONK! HOOOOONK!\n");
enable_headlights();
set_maximum_battery(50);
set_battery_id("battery");
set_headlight_consumption(40);
/* an array of just idle messages */
arr_idle_chat_mess = ({
"You boggle at the sheer mass and wastefulness of the Hummer H2.",
});
/* an array of engine noise messages */
arr_engine_chat_mess = ({
"The Hummer H2's engine rumbles noisily.",
});
set_idle_chat_chance(1);
set_engine_chat_chance(2);
}
/* end function reset(); */
| [
"[email protected]"
] | |
104d96c58fff702e13ea8bd73026c9e565ddc41b | 021a3ccdcb91d84629f1de7343981b572840b169 | /src/mat/examples/tests/ex220.c | 642edd8e206c97f553bb2751b841642582521b09 | [
"BSD-2-Clause"
] | permissive | firedrakeproject/petsc | dcf7b32e83bdc88d37099904960d7a4c3c4a89e4 | 7afe75c1a0a66862f32d7a0f5c0c5ae5079c4c77 | refs/heads/master | 2023-08-31T22:16:45.175956 | 2019-08-06T14:24:54 | 2019-08-06T14:24:54 | 52,269,402 | 2 | 8 | NOASSERTION | 2023-04-11T09:20:08 | 2016-02-22T11:40:41 | C | UTF-8 | C | false | false | 1,160 | c |
#include <petscmat.h>
static char help[PETSC_MAX_PATH_LEN] = "Tests MatLoad() with MatCreateDense() for memory leak ";
int main(int argc, char **argv)
{
PetscErrorCode ierr;
PetscViewer viewer;
Mat A;
char filename[PETSC_MAX_PATH_LEN];
PetscBool flg;
ierr = PetscInitialize(&argc, &argv, (char*)0, help);if (ierr) return ierr;
ierr = PetscOptionsGetString(NULL, NULL, "-f", filename, sizeof(filename), &flg);CHKERRQ(ierr);
if (!flg) SETERRQ(PETSC_COMM_WORLD, 1, "Must indicate a filename for input with the -f option");
ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, filename, FILE_MODE_READ, &viewer);CHKERRQ(ierr);
ierr = MatCreateDense(PETSC_COMM_WORLD, PETSC_DECIDE, PETSC_DECIDE, 36, 36, NULL, &A);CHKERRQ(ierr);
ierr = MatLoad(A, viewer);CHKERRQ(ierr);
ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
ierr = MatDestroy(&A);CHKERRQ(ierr);
ierr = PetscFinalize();
return ierr;
}
/*TEST
test:
requires: double !complex !define(PETSC_USE_64BIT_INDICES) datafilespath
args: -f ${DATAFILESPATH}/matrices/small
TEST*/
| [
"[email protected]"
] | |
da098ca35bcc6b55376402d60e673ec6fc3635c1 | b71b8bd385c207dffda39d96c7bee5f2ccce946c | /testcases/CWE427_Uncontrolled_Search_Path_Element/CWE427_Uncontrolled_Search_Path_Element__char_environment_17.c | 4717581c29fe88df7165dd320f947b8543bc7118 | [] | no_license | Sporknugget/Juliet_prep | e9bda84a30bdc7938bafe338b4ab2e361449eda5 | 97d8922244d3d79b62496ede4636199837e8b971 | refs/heads/master | 2023-05-05T14:41:30.243718 | 2021-05-25T16:18:13 | 2021-05-25T16:18:13 | 369,334,230 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,893 | c | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE427_Uncontrolled_Search_Path_Element__char_environment_17.c
Label Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml
Template File: sources-sink-17.tmpl.c
*/
/*
* @description
* CWE: 427 Uncontrolled Search Path Element
* BadSource: environment Read input from an environment variable
* GoodSource: Use a hardcoded path
* Sink:
* BadSink : Set the environment variable
* Flow Variant: 17 Control flow: for loops
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define NEW_PATH "%SystemRoot%\\system32"
#define PUTENV _putenv
#else
#define NEW_PATH "/bin"
#define PUTENV putenv
#endif
#define ENV_VARIABLE "ADD"
#ifdef _WIN32
#define GETENV getenv
#else
#define GETENV getenv
#endif
#ifndef OMITBAD
void CWE427_Uncontrolled_Search_Path_Element__char_environment_17_bad()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
{
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 250-dataLen-1);
}
}
}
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() - use goodsource and badsink by changing the conditions on the for statements */
static void goodG2B()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
{
/* FIX: Set the path as the "system" path */
strcat(data, NEW_PATH);
}
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
void CWE427_Uncontrolled_Search_Path_Element__char_environment_17_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE427_Uncontrolled_Search_Path_Element__char_environment_17_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE427_Uncontrolled_Search_Path_Element__char_environment_17_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| [
"[email protected]"
] | |
a5948aa034633c10014f10b276473125e92d0027 | d25ed4f74abd95bf8f7e6dba52a7a7c2eca2f0ea | /src/deemon/fs/native_fs.c | 6946e584c8c5a695a774e2d850b2ea4e199742d5 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | GrieferAtWork/deemon-legacy- | 95a83dee1b261a94caa95eba0a17f741958037c9 | 4b79f9c4dec76292f40f072c3a601683cfc4bd58 | refs/heads/master | 2021-07-14T19:26:58.952725 | 2017-10-16T09:33:17 | 2017-10-16T09:33:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,252 | c | /* Copyright (c) 2016 - deemon by Griefer@Work *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy *
* of this software and associated documentation files (the "Software"), to deal *
* in the Software without restriction, including without limitation the rights *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in all *
* copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
* SOFTWARE. *
*/
#ifndef GUARD_DEEMON_FS_NATIVE_FS_C
#define GUARD_DEEMON_FS_NATIVE_FS_C 1
#define DEE_LIMITED_API 1
#include <deemon/__conf.inl>
#include <deemon/fs/native_fs.h>
DEE_DECL_BEGIN
DEE_DECL_END
#ifndef __INTELLISENSE__
#include "native_fs.chdir.c.inl"
#include "native_fs.chmod.c.inl"
#include "native_fs.chown.c.inl"
#include "native_fs.copy.c.inl"
#include "native_fs.delenv.c.inl"
#include "native_fs.enumenv.c.inl"
#include "native_fs.exists.c.inl"
#include "native_fs.getcwd.c.inl"
#include "native_fs.getenv.c.inl"
#include "native_fs.gethome.c.inl"
#include "native_fs.getmod.c.inl"
#include "native_fs.getown.c.inl"
#include "native_fs.gettimes.c.inl"
#include "native_fs.gettmp.c.inl"
#include "native_fs.getuserhome.c.inl"
#include "native_fs.hasenv.c.inl"
#include "native_fs.hasproperty.c.inl"
#include "native_fs.isabs.c.inl"
#include "native_fs.isblockdev.c.inl"
#include "native_fs.ischardev.c.inl"
#include "native_fs.isdir.c.inl"
#include "native_fs.isdrive.c.inl"
#include "native_fs.isexecutable.c.inl"
#include "native_fs.isfifo.c.inl"
#include "native_fs.isfile.c.inl"
#include "native_fs.ishidden.c.inl"
#include "native_fs.islink.c.inl"
#include "native_fs.ismount.c.inl"
#include "native_fs.issocket.c.inl"
#include "native_fs.link.c.inl"
#include "native_fs.mkdir.c.inl"
#include "native_fs.move.c.inl"
#include "native_fs.open.c.inl"
#include "native_fs.opendir.c.inl"
#include "native_fs.readlink.c.inl"
#include "native_fs.remove.c.inl"
#include "native_fs.rmdir.c.inl"
#include "native_fs.setenv.c.inl"
#include "native_fs.settimes.c.inl"
#include "native_fs.unlink.c.inl"
#endif
#endif /* !GUARD_DEEMON_FS_NATIVE_FS_H */
| [
"[email protected]"
] | |
b2e9e8651b4deea40f5fdcc934a5ab36f2883aca | 353a990108802fe3157b01512370c8111d342d8e | /fib.h | b7a4071ef0deca74aae8ff472a9f80aff972b1ba | [] | no_license | IsraelBanez/Asgn-6 | e46f33f04117bfed56b607e95cc3cd30250a2714 | ff5bf6aee6de217c22af8481b2ff3dc7d9236b97 | refs/heads/master | 2023-02-26T16:01:21.681781 | 2020-08-10T23:35:51 | 2020-08-10T23:35:51 | 335,799,693 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 161 | h | /*
* Declares functions for computing Fibonacci numbers.
* CSC 225, Assignment 6
* Given code, Winter '20
* NOTE: Do not alter this file.
*/
int fib(int);
| [
"[email protected]"
] | |
f6c818fb488fadac68573b901553ed154bc62d86 | b356adc9bd515d919edcdda9b2aceded1b7dc905 | /include/linux/atm.h | ea09022197bc783cccf7263275655d81a02d85a2 | [] | no_license | wisen/tiny_kernel_comment | ca57b10a4df8eef989435ac5974fae5df0f1cc20 | 3401fe62392c62f735fc6dac1d96c51cca44d249 | refs/heads/master | 2020-03-17T21:48:36.830903 | 2018-11-05T16:52:57 | 2018-11-05T16:52:57 | 133,976,587 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 296 | h | /* atm.h - general ATM declarations */
#ifndef _LINUX_ATM_H
#define _LINUX_ATM_H
#include <uapi/linux/atm.h>
#if 0//#ifdef CONFIG_COMPAT//CONFIG_COMPAT is not set
#include <linux/compat.h>
struct compat_atmif_sioc {
int number;
int length;
compat_uptr_t arg;
};
#endif
#endif
| [
"[email protected]"
] | |
5aea769ca62fff8d98d4065743db0ee2e9bc6a87 | 7b55cacf46bf2fd6298315bccfa4b6f0375e3865 | /src/sys/compat/linux/arch/amd64/linux_commons.c | 0f67b6a3a0fb21055f0c90c611b101feb1e5c1e6 | [
"MIT",
"LicenseRef-scancode-bsd-3-clause-jtag",
"BSD-2-Clause"
] | permissive | libos-nuse/frankenlibc | 7f33a86f277ea13eeae573e0339b03c5e2a9ff58 | b2e9db0084847aaa63fcddce2f5bf2e0e43669d5 | refs/heads/lkl-musl | 2021-01-21T23:30:07.179889 | 2018-06-21T07:46:36 | 2018-08-14T03:52:22 | 47,620,000 | 9 | 6 | NOASSERTION | 2019-02-21T14:53:00 | 2015-12-08T12:13:28 | C | UTF-8 | C | false | false | 1,179 | c | /* $NetBSD: linux_commons.c,v 1.11 2011/05/30 17:50:31 alnsn Exp $ */
/*
* This file includes C files from the common
* area to decrese the number of files to compile
* in order to make building a kernel go faster.
*
* Option headers and headers which depend on
* certain options being set need to be included
* here. This ensures that a header file sees
* the options it needs even if one of included
* C files doesn't use it.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.11 2011/05/30 17:50:31 alnsn Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
#endif
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_signal.h>
#include <compat/linux/common/linux_types.h>
#include <compat/linux/common/linux_ipc.h>
#include <compat/linux/common/linux_sem.h>
#include <compat/linux/linux_syscallargs.h>
#include "../../common/linux_pipe.c"
#include "../../common/linux_file64.c"
#include "../../common/linux_misc_notalpha.c"
#include "../../common/linux_sig_notalpha.c"
#include "../../common/linux_futex.c"
#include "../../common/linux_fadvise64.c"
| [
"[email protected]"
] | |
1fc19348a83173d2ba368e928d250280bf8129ec | 979e60122a70a21110ef891ae62a2b2929af7415 | /third_party/machinarium/sources/coroutine_cache.c | d155a3a4e3dbf9f80ac51860643120d0ce15e983 | [
"BSD-3-Clause"
] | permissive | efimkin/odyssey | f07679e3b1bc08394c4ccd673986efbf341305e0 | 1bace0fedbe1636bc26e0c493e4418e73e0d0a8c | refs/heads/master | 2020-12-21T16:22:47.680513 | 2020-02-14T07:15:29 | 2020-02-14T07:15:29 | 236,488,735 | 0 | 0 | BSD-3-Clause | 2020-01-27T12:45:38 | 2020-01-27T12:45:37 | null | UTF-8 | C | false | false | 1,789 | c |
/*
* machinarium.
*
* cooperative multitasking engine.
*/
#include <machinarium.h>
#include <machinarium_private.h>
void mm_coroutine_cache_init(mm_coroutine_cache_t *cache,
int stack_size,
int stack_size_guard,
int limit)
{
mm_list_init(&cache->list);
cache->count_free = 0;
cache->count_total = 0;
cache->stack_size = stack_size;
cache->stack_size_guard = stack_size_guard;
cache->limit = limit;
}
void mm_coroutine_cache_free(mm_coroutine_cache_t *cache)
{
mm_list_t *i, *n;
mm_list_foreach_safe(&cache->list, i, n) {
mm_coroutine_t *coroutine;
coroutine = mm_container_of(i, mm_coroutine_t, link);
mm_coroutine_free(coroutine);
}
}
void mm_coroutine_cache_stat(mm_coroutine_cache_t *cache,
uint64_t *count,
uint64_t *count_free)
{
*count = cache->count_total - cache->count_free;
*count_free = cache->count_free;
}
mm_coroutine_t*
mm_coroutine_cache_pop(mm_coroutine_cache_t *cache)
{
mm_coroutine_t *coroutine;
if (cache->count_free > 0) {
mm_list_t *first = mm_list_pop(&cache->list);
cache->count_free--;
coroutine = mm_container_of(first, mm_coroutine_t, link);
return coroutine;
}
cache->count_total++;
coroutine = mm_coroutine_allocate(cache->stack_size, cache->stack_size_guard);
if (coroutine == NULL)
cache->count_total--;
return coroutine;
}
void mm_coroutine_cache_push(mm_coroutine_cache_t *cache, mm_coroutine_t *coroutine)
{
assert(coroutine->state == MM_CFREE);
if (cache->count_free >= cache->limit) {
cache->count_total--;
mm_coroutine_free(coroutine);
return;
}
mm_list_init(&coroutine->link);
mm_list_append(&cache->list, &coroutine->link);
cache->count_free++;
}
| [
"[email protected]"
] | |
19cd60de49419a3cf5ee9345e67a2c0131bbe2d0 | f0e2df670e69d9a6ee6500bada82622bd8e888fc | /ext/phalcon/mvc/viewbaseinterface.zep.c | bef481ba4bbeef902f3909a40a8064e8bed2698d | [
"BSD-3-Clause",
"Zend-2.0"
] | permissive | wl6179/cphalcon | 25824301614d5cb46d5374b8b729f98e6ce35e73 | a66c99e924aa986687cd21efb651b2f47b06fc74 | refs/heads/master | 2018-12-22T12:57:24.771374 | 2018-12-20T01:59:28 | 2018-12-20T01:59:28 | 119,639,692 | 1 | 0 | NOASSERTION | 2018-09-30T18:43:57 | 2018-01-31T05:32:17 | PHP | UTF-8 | C | false | true | 1,683 | c |
#ifdef HAVE_CONFIG_H
#include "../../ext_config.h"
#endif
#include <php.h>
#include "../../php_ext.h"
#include "../../ext.h"
#include <Zend/zend_exceptions.h>
#include "kernel/main.h"
/**
* Phalcon\Mvc\ViewInterface
*
* Interface for Phalcon\Mvc\View and Phalcon\Mvc\View\Simple
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_ViewBaseInterface) {
ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ViewBaseInterface, phalcon, mvc_viewbaseinterface, phalcon_mvc_viewbaseinterface_method_entry);
return SUCCESS;
}
/**
* Sets views directory. Depending of your platform, always add a trailing slash or backslash
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setViewsDir);
/**
* Gets views directory
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getViewsDir);
/**
* Adds parameters to views (alias of setVar)
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setParamToView);
/**
* Adds parameters to views
*
* @param string key
* @param mixed value
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setVar);
/**
* Returns parameters to views
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getParamsToView);
/**
* Returns the cache instance used to cache
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getCache);
/**
* Cache the actual view render to certain level
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, cache);
/**
* Externally sets the view content
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setContent);
/**
* Returns cached output from another view stage
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getContent);
/**
* Renders a partial view
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, partial);
| [
"[email protected]"
] | |
e27ae7034cc489f5ac6cafc399d0c09b5eebd933 | 637fcd60a4e2a98ebbeaaa9551554a13e1ebfdba | /quad/ctrl/paparazzi/sw/airborne/subsystems/electrical.c | 54ecb6f4355c44cfcf1e49eeccfc167f99bc9f78 | [] | no_license | zoomx/lxyppc-tetrix | b7079c07aee9b85a34207245f526e1613fdb0498 | 884027f37594f9f006f88d634c4392a60c482491 | refs/heads/master | 2021-01-10T21:04:54.219013 | 2015-05-10T08:45:33 | 2015-05-10T08:45:33 | 35,362,463 | 12 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,662 | c | #include "subsystems/electrical.h"
#include "mcu_periph/adc.h"
#include "commands.h"
#include "generated/airframe.h"
#include BOARD_CONFIG
#ifdef MILLIAMP_PER_PERCENT
#warning "deprecated MILLIAMP_PER_PERCENT --> Please use MILLIAMP_AT_FULL_THROTTLE"
#endif
#if defined BATTERY_SENS || defined BATTERY_OFFSET
#warning "BATTERY_SENS and BATTERY_OFFSET are deprecated, please remove them --> if you want to change the default use VoltageOfAdc"
#endif
struct Electrical electrical;
static struct {
struct adc_buf vsupply_adc_buf;
#ifdef ADC_CHANNEL_CURRENT
struct adc_buf current_adc_buf;
#endif
#ifdef MILLIAMP_AT_FULL_THROTTLE
float nonlin_factor;
#endif
} electrical_priv;
#ifndef VoltageOfAdc
#define VoltageOfAdc(adc) DefaultVoltageOfAdc(adc)
#endif
#ifndef MilliAmpereOfAdc
#define MilliAmpereOfAdc(adc) DefaultMilliAmpereOfAdc(adc)
#endif
#ifndef CURRENT_ESTIMATION_NONLINEARITY
#define CURRENT_ESTIMATION_NONLINEARITY 1.2
#endif
void electrical_init(void) {
electrical.vsupply = 0;
electrical.current = 0;
adc_buf_channel(ADC_CHANNEL_VSUPPLY, &electrical_priv.vsupply_adc_buf, DEFAULT_AV_NB_SAMPLE);
#ifdef ADC_CHANNEL_CURRENT
adc_buf_channel(ADC_CHANNEL_CURRENT, &electrical_priv.current_adc_buf, DEFAULT_AV_NB_SAMPLE);
#endif
#ifdef MILLIAMP_AT_FULL_THROTTLE
electrical_priv.nonlin_factor = CURRENT_ESTIMATION_NONLINEARITY;
#endif
}
void electrical_periodic(void) {
#ifndef SITL
electrical.vsupply = VoltageOfAdc((10*(electrical_priv.vsupply_adc_buf.sum/electrical_priv.vsupply_adc_buf.av_nb_sample)));
#endif
#ifdef ADC_CHANNEL_CURRENT
#ifndef SITL
electrical.current = MilliAmpereOfAdc((electrical_priv.current_adc_buf.sum/electrical_priv.current_adc_buf.av_nb_sample));
#endif
#else
#if defined MILLIAMP_AT_FULL_THROTTLE && defined COMMAND_THROTTLE
/*
* Superellipse: abs(x/a)^n + abs(y/b)^n = 1
* with a = 1
* b = mA at full throttle
* n = 1.2 This defines nonlinearity (1 = linear)
* x = throttle
* y = current
*
* define CURRENT_ESTIMATION_NONLINEARITY in your airframe file to change the default nonlinearity factor of 1.2
*/
float b = (float)MILLIAMP_AT_FULL_THROTTLE;
float x = ((float)commands[COMMAND_THROTTLE]) / ((float)MAX_PPRZ);
/* electrical.current y = ( b^n - (b* x/a)^n )^1/n
* a=1, n = electrical_priv.nonlin_factor
*/
electrical.current = b - pow((pow(b,electrical_priv.nonlin_factor)-pow((b*x),electrical_priv.nonlin_factor)), (1./electrical_priv.nonlin_factor));
#endif
#endif /* ADC_CHANNEL_CURRENT */
}
| [
"[email protected]@a1e0bfe9-9f80-e943-2008-5ec03726fcf4"
] | [email protected]@a1e0bfe9-9f80-e943-2008-5ec03726fcf4 |
94bd27b2152f3a3dde9bfff41c0647dbf90b5e4a | feda0c02bcdb1b27e38ed60c289f4abb12d38282 | /examples/heart/Piha/Cells/Generated/LeftBundleBranch.c | f16c9d7070be8c3efdc8740dd07340c14538a04a | [] | no_license | sidns5/DATE2016_codegen | 6c7ea963b4712a6848aa3db24d9ee102b140a2bf | f2d77d0280ce1496f526b04327f6307a59ef79b2 | refs/heads/master | 2020-04-09T05:52:06.753157 | 2015-11-27T00:57:39 | 2015-11-27T00:57:39 | 40,632,137 | 0 | 2 | null | null | null | null | UTF-8 | C | false | false | 6,348 | c | #include "LeftBundleBranch.h"
#define True 1
#define False 0
#include <math.h>
static double f(double theta) {
if(theta >= 0.04)
return 4.03947;
return 0.29*exp(62.89*theta) + 0.70*exp(-10.99*theta);
}
static double t1_ode_1(LeftBundleBranch* me) {
double t1_ode_1_change = -0.0087 * me->v_x;
return me->v_x + STEP_SIZE * t1_ode_1_change;
}
static double t1_ode_2(LeftBundleBranch* me) {
double t1_ode_2_change = -0.1909 * me->v_y;
return me->v_y + STEP_SIZE * t1_ode_2_change;
}
static double t1_ode_3(LeftBundleBranch* me) {
double t1_ode_3_change = -0.1904 * me->v_z;
return me->v_z + STEP_SIZE * t1_ode_3_change;
}
static double t2_ode_1(LeftBundleBranch* me) {
double t2_ode_1_change = -0.0236 * me->v_x + 0.7772 * me->g;
return me->v_x + STEP_SIZE * t2_ode_1_change;
}
static double t2_ode_2(LeftBundleBranch* me) {
double t2_ode_2_change = -0.0455 * me->v_y + 0.0589 * me->g;
return me->v_y + STEP_SIZE * t2_ode_2_change;
}
static double t2_ode_3(LeftBundleBranch* me) {
double t2_ode_3_change = -0.0129 * me->v_z + 0.2766 * me->g;
return me->v_z + STEP_SIZE * t2_ode_3_change;
}
static double t3_ode_1(LeftBundleBranch* me) {
double t3_ode_1_change = -0.0069 * me->v_x;
return me->v_x + STEP_SIZE * t3_ode_1_change;
}
static double t3_ode_2(LeftBundleBranch* me) {
double t3_ode_2_change = 0.0759 * me->v_y;
return me->v_y + STEP_SIZE * t3_ode_2_change;
}
static double t3_ode_3(LeftBundleBranch* me) {
double t3_ode_3_change = 6.8265 * me->v_z;
return me->v_z + STEP_SIZE * t3_ode_3_change;
}
static double t4_ode_1(LeftBundleBranch* me) {
double t4_ode_1_change = -0.0332 * me->v_x * me->f_theta;
return me->v_x + STEP_SIZE * t4_ode_1_change;
}
static double t4_ode_2(LeftBundleBranch* me) {
double t4_ode_2_change = 0.011 * me->v_y * me->f_theta;
return me->v_y + STEP_SIZE * t4_ode_2_change;
}
static double t4_ode_3(LeftBundleBranch* me) {
double t4_ode_3_change = 0.002 * me->v_z;
return me->v_z + STEP_SIZE * t4_ode_3_change;
}
// Initialization function
void LeftBundleBranchInit(LeftBundleBranch* me) {
me->state = t1;
me->v_x = 0;
me->v_y = 0;
me->v_z = 0;
me->v = 0;
me->theta = 0;
me->v_O = 0;
me->g = 0;
}
// Execution function
void LeftBundleBranchRun(LeftBundleBranch* me) {
enum cellStates state_u = me->state;
double v_x_u = me->v_x;
double v_y_u = me->v_y;
double v_z_u = me->v_z;
double v_u = me->v;
double theta_u = me->theta;
double v_O_u = me->v_O;
double f_theta_u = me->f_theta;
me->g = 0;
me->g += (100 * 0.1 * (me->v_i_0 - me->v)) / (100 * 0.01 * 10);
me->g += (100 * 0.1 * (me->v_i_1 - me->v)) / (100 * 0.01 * 10);
switch (me->state) {
case (t1):
if(me->v <= 44.5 && me->g <= 44.5) {
v_x_u = t1_ode_1(me);
v_y_u = t1_ode_2(me);
v_z_u = t1_ode_3(me);
v_u = v_x_u - v_y_u + v_z_u;
state_u = t1;
}
else if(me->g > 44.5) {
v_x_u = 0.3*me->v;
v_y_u = 0;
v_z_u = 0.7*me->v;
v_u = v_x_u - v_y_u + v_z_u;
theta_u = v_u / 30;
v_O_u = (131.1 - 80.1*sqrt(theta_u));
f_theta_u = f(theta_u);
state_u = t2;
}
else {
fprintf(stderr,"Unreachable state!");
exit(1);
}
break;
case (t2):
if(me->v < 44.5 && me->g > 0) {
v_x_u = t2_ode_1(me);
v_y_u = t2_ode_2(me);
v_z_u = t2_ode_3(me);
v_u = v_x_u - v_y_u + v_z_u;
if(v_u > 44.5) {
double frac = (44.5 - me->v) / (v_u - me->v);
v_x_u = me->v_x + frac * (v_x_u - me->v_x);
v_y_u = me->v_y + frac * (v_y_u - me->v_y);
v_z_u = 44.5 - v_x_u + v_y_u;
v_u = 44.5;
}
state_u = t2;
}
else if(me->g <= 0 && me->v < 44.5) {
v_x_u = me->v_x;
v_y_u = me->v_y;
v_z_u = me->v_z;
v_u = v_x_u - v_y_u + v_z_u;
state_u = t1;
}
else if(me->v >= 44.5) {
v_x_u = me->v_x;
v_y_u = me->v_y;
v_z_u = me->v_z;
v_u = v_x_u - v_y_u + v_z_u;
state_u = t3;
}
else {
fprintf(stderr,"Unreachable state!");
exit(1);
}
break;
case (t3):
if(me->v < me->v_O) {
v_x_u = t3_ode_1(me);
v_y_u = t3_ode_2(me);
v_z_u = t3_ode_3(me);
v_u = v_x_u - v_y_u + v_z_u;
if(v_u > me->v_O) {
double frac = (me->v_O - me->v) / (v_u - me->v);
v_x_u = me->v_x + frac * (v_x_u - me->v_x);
v_y_u = me->v_y + frac * (v_y_u - me->v_y);
v_z_u = me->v_O - v_x_u + v_y_u;
v_u = me->v_O;
}
state_u = t3;
}
else if(me->v >= me->v_O) {
v_x_u = me->v_x;
v_y_u = me->v_y;
v_z_u = me->v_z;
v_u = v_x_u - v_y_u + v_z_u;
state_u = t4;
}
else {
fprintf(stderr,"Unreachable state!");
exit(1);
}
break;
case (t4):
if(me->v > 30) {
v_x_u = t4_ode_1(me);
v_y_u = t4_ode_2(me);
v_z_u = t4_ode_3(me);
v_u = v_x_u - v_y_u + v_z_u;
if(v_u < 30) {
double frac = (30 - me->v) / (v_u - me->v);
v_x_u = me->v_x + frac * (v_x_u - me->v_x);
v_y_u = me->v_y + frac * (v_y_u - me->v_y);
v_z_u = 30 - v_x_u + v_y_u;
v_u = 30;
}
state_u = t4;
}
else if(me->v <= 30) {
v_x_u = me->v_x;
v_y_u = me->v_y;
v_z_u = me->v_z;
v_u = v_x_u - v_y_u + v_z_u;
state_u = t1;
}
else {
fprintf(stderr,"Unreachable state!");
exit(1);
}
break;
default: exit(1);
}
me->state = state_u;
me->v_x = v_x_u;
me->v_y = v_y_u;
me->v_z = v_z_u;
me->v = v_u;
me->theta = theta_u;
me->v_O = v_O_u;
me->f_theta = f_theta_u;
}
| [
"[email protected]"
] | |
f5ac22bca029b56281167909018acdec2617c21d | a556c07ecfa1031dae46fd3433762941ceca68b1 | /newbiequest/wudang/milin/milin5.c | 108a9fce3670db4efe83a96b388b12d8d780adca | [] | no_license | yqzcabao/pkuxkx-utf8 | 53c3c24f4e3a9125372bca72b6a4b10aa6293a7f | 0eaf237c9970795a51aa4cc04b5b762003300cbd | refs/heads/main | 2023-04-01T21:16:23.894845 | 2021-04-09T13:33:24 | 2021-04-09T13:33:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 645 | c | // milin5.c 密林
// seagate@pkuxkx 路径动态更新
inherit ROOM;
void create()
{
set("short", "密林");
set("long",
"林中阴森森的,除了几声鸟叫外再没有其他的声音,四周\n"
"都是参天大树,遮天蔽日。脚下是厚厚的落叶,看不出有什么\n"
"人迹,显得格外怕人。\n"
);
set("exits", ([
"north" : __DIR__"milin2",
"west" : __DIR__"milin1",
"east" : __DIR__"milin1",
]));
set("outdoors", "wudang");
set("dynroom/type",1); //1为动态房间,0为固定房间
set("no_clean_up",1);
setup();
}
void reset()
{
::reset();
set("no_clean_up",1);
} | [
"[email protected]"
] | |
7f8a1e8f6db3c9e48b24de1823d2591e34e32fe1 | c8abb7c0a610348eb0b8474ce66463584ec5bc98 | /third_party/liblfds711@da3494fef10df4681e267d8b2b8cce2c90d5a9fa/src/lfds711_queue_bounded_manyproducer_manyconsumer/lfds711_queue_bounded_manyproducer_manyconsumer_query.c | cdabb6a315cb30f8fbb31f3e5a87be01438b0996 | [
"GPL-1.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | microsoft/BuildXL | d31b74ba23057dd251bcd9040390a7e751f04fae | f884dd1e34ed50f76d27d3fb1b8679235995653d | refs/heads/main | 2023-08-31T21:19:44.385093 | 2023-08-30T23:36:57 | 2023-08-30T23:36:57 | 152,813,045 | 436 | 114 | MIT | 2023-09-13T09:49:08 | 2018-10-12T22:16:45 | C# | UTF-8 | C | false | false | 4,483 | c | /***** includes *****/
#include "lfds711_queue_bounded_manyproducer_manyconsumer_internal.h"
/***** private prototypes *****/
static void lfds711_queue_bmm_internal_validate( struct lfds711_queue_bmm_state *qbmms,
struct lfds711_misc_validation_info *vi,
enum lfds711_misc_validity *lfds711_validity );
/****************************************************************************/
void lfds711_queue_bmm_query( struct lfds711_queue_bmm_state *qbmms,
enum lfds711_queue_bmm_query query_type,
void *query_input,
void *query_output )
{
LFDS711_PAL_ASSERT( qbmms != NULL );
// TRD : query_type can be any value in its range
switch( query_type )
{
case LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT:
{
lfds711_pal_uint_t
local_read_index,
local_write_index;
LFDS711_PAL_ASSERT( query_input == NULL );
LFDS711_PAL_ASSERT( query_output != NULL );
LFDS711_MISC_BARRIER_LOAD;
local_read_index = qbmms->read_index;
local_write_index = qbmms->write_index;
*(lfds711_pal_uint_t *) query_output = +( local_write_index - local_read_index );
if( local_read_index > local_write_index )
*(lfds711_pal_uint_t *) query_output = ((lfds711_pal_uint_t) -1) - *(lfds711_pal_uint_t *) query_output;
}
break;
case LFDS711_QUEUE_BMM_QUERY_SINGLETHREADED_VALIDATE:
// TRD : query_input can be NULL
LFDS711_PAL_ASSERT( query_output != NULL );
lfds711_queue_bmm_internal_validate( qbmms, (struct lfds711_misc_validation_info *) query_input, (enum lfds711_misc_validity *) query_output );
break;
}
return;
}
/****************************************************************************/
static void lfds711_queue_bmm_internal_validate( struct lfds711_queue_bmm_state *qbmms,
struct lfds711_misc_validation_info *vi,
enum lfds711_misc_validity *lfds711_validity )
{
lfds711_pal_uint_t
expected_sequence_number,
loop,
number_elements,
sequence_number;
LFDS711_PAL_ASSERT( qbmms != NULL );
// TRD : vi can be NULL
LFDS711_PAL_ASSERT( lfds711_validity != NULL );
*lfds711_validity = LFDS711_MISC_VALIDITY_VALID;
/* TRD : starting from the read_index, we should find number_elements of incrementing sequence numbers
we then perform a second scan from the write_index onwards, which should have (max elements in queue - number_elements) incrementing sequence numbers
*/
lfds711_queue_bmm_query( qbmms, LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements );
expected_sequence_number = qbmms->element_array[ qbmms->read_index & qbmms->mask ].sequence_number;
for( loop = 0 ; loop < number_elements ; loop++ )
{
sequence_number = qbmms->element_array[ (qbmms->read_index + loop) & qbmms->mask ].sequence_number;
if( sequence_number != expected_sequence_number )
*lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_ORDER;
if( sequence_number == expected_sequence_number )
expected_sequence_number = sequence_number + 1;
}
// TRD : now the write_index onwards
expected_sequence_number = qbmms->element_array[ qbmms->write_index & qbmms->mask ].sequence_number;
for( loop = 0 ; loop < qbmms->number_elements - number_elements ; loop++ )
{
sequence_number = qbmms->element_array[ (qbmms->write_index + loop) & qbmms->mask ].sequence_number;
if( sequence_number != expected_sequence_number )
*lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_ORDER;
if( sequence_number == expected_sequence_number )
expected_sequence_number = sequence_number + 1;
}
// TRD : now check against the expected number of elements
if( *lfds711_validity == LFDS711_MISC_VALIDITY_VALID and vi != NULL )
{
lfds711_pal_uint_t
number_elements;
lfds711_queue_bmm_query( qbmms, LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements );
if( number_elements < vi->min_elements )
*lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_MISSING_ELEMENTS;
if( number_elements > vi->max_elements )
*lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS;
}
return;
}
| [
"[email protected]"
] | |
1c9c2f0db0d7a3112d5657457e0d19ae0040f61c | ae0da0c1ce410f894f588319d1677c26d7ec1403 | /libft/libft_srcs/ft_lstdel.c | 72950e3879f4f4377f1a5010f6368518b1abca3b | [] | no_license | Draeyo/malloc2 | 85b10121d02c224b683ed7c4509e3949dae16903 | 147438a17be2a3c473201663d4184e3f8f077bd4 | refs/heads/master | 2020-05-09T09:43:26.052342 | 2019-07-05T09:47:58 | 2019-07-05T09:47:58 | 181,013,762 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,127 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vlistrat <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/12/01 17:47:10 by vlistrat #+# #+# */
/* Updated: 2015/12/05 14:50:52 by vlistrat ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *list;
list = *alst;
while (list->next)
{
ft_lstdelone(&list, del);
list = (*alst)->next;
}
ft_lstdelone(&list, del);
*alst = NULL;
}
| [
"[email protected]"
] | |
d45afa416e4a2fecdddb3393fa26e3fa86b4abdc | 53b6f891e264f35625bc9ad227c766be03eaff9a | /15-PWM调光/PWM调光.c | b73ac15e4e8595710a5c5a1cc2aef2055beaee40 | [] | no_license | xiaoyaoltian/51-single-chip-microcomputer | 5dc7f60a7e50b5bf86e1f0142856dbbaad3d94a4 | 826e4ae21608e67bb6b365868f5bc28da20fd97e | refs/heads/master | 2020-03-26T22:53:03.895888 | 2018-09-17T01:48:56 | 2018-09-17T01:48:56 | 145,493,783 | 11 | 1 | null | null | null | null | UTF-8 | C | false | false | 2,293 | c | /*******************************************************************************
* 版 权 : 红梅科技工作室
* 论 坛 :https://blog.csdn.net/Qingzhusshuiyun
* Q Q :2369099714
* 版权所有,盗版必究。
* 工 程 : PWM调光
* 文件名 : PWM调光.c
* 处理器 : STC89C52RC
* 编译环境 : Keil 5
* 系统时钟 : 12MHZ
* 版 本 : V1.0
* 生成日期 : 2018-05-14
* 修改日期 :
* 简单描述 : 通过PWM(脉宽调制)调节LED的亮度
*******************************************************************************/
#include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义
//sbit LED0=P1^0;// 用sbit 关键字 定义 LED到P1.0端口,LED是自己任意定义且容易记忆的符号
sbit P20=P2^0;
void Delay(unsigned int t); //函数声明
/*------------------------------------------------
主函数
------------------------------------------------*/
void main (void)
{
//unsigned int kk;
unsigned int CYCLE=100,PWM_LOW=0;//定义周期并赋值 //
while (1) //主循环
{
if(P20==0){Delay(3);if(P20==0){CYCLE=CYCLE+100;if(CYCLE==600){CYCLE=100;}while(P20==0);}}
P1=0XFF;// LED0=1;
Delay(60000); //特意加延时,可以看到熄灭的过程
for(PWM_LOW=1;PWM_LOW<CYCLE;PWM_LOW++){ //PWM_LOW表示低
//电平时间,这个循环中低电平时长从1累加到CYCLE(周期)的值,即600次
P1=0X00; // LED0=0; //点亮LED
Delay(PWM_LOW);//延时长度,600次循环中从1加至599
P1=0XFF; // LED0=1; //熄灭LED
Delay(CYCLE-PWM_LOW);//延时长度,600次循环中从599减至1
}
P1=0X00;// LED0=0;
for(PWM_LOW=CYCLE-1;PWM_LOW>0;PWM_LOW--){ //与逐渐变亮相反的过程
P1=0X00; // LED0=0;
Delay(PWM_LOW);
P1=0XFF; // LED0=1;
Delay(CYCLE-PWM_LOW);
}
//主循环中添加其他需要一直工作的程序
}
}
/*------------------------------------------------
延时函数,含有输入参数 unsigned int t,无返回值
unsigned int 是定义无符号整形变量,其值的范围是
0~65535
------------------------------------------------*/
void Delay(unsigned int t)
{
while(--t);
} | [
"[email protected]"
] | |
dc98bebb4600d29746f7985d87ac6e96ab652ea0 | 4c2ecdfebb4499570fd0c62976b111e39f26626d | /includes/libft.h | f8e35f85b39bfb7e05351700b62f003542b62f34 | [] | no_license | NoelleMostert/push_swap | 28f6205f81461f4daa075906139f5e43ba7d55e4 | 6fa833728d87d72d47f005d38814d7daa43f7c64 | refs/heads/master | 2020-03-27T06:15:16.724503 | 2018-09-07T07:23:26 | 2018-09-07T07:23:26 | 146,092,691 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,535 | h | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nmostert <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/30 10:44:33 by nmostert #+# #+# */
/* Updated: 2018/09/04 09:38:53 by nmostert ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef LIBFT_H
# define LIBFT_H
# include <string.h>
# include <stdlib.h>
# include <unistd.h>
# include "colours.h"
# define BUFF_SIZE 1
typedef struct s_list
{
void *content;
size_t content_size;
struct s_list *next;
} t_list;
int ft_isupper(int c);
int ft_islower(int c);
int ft_toupper(int c);
int ft_tolower(int c);
int ft_isalpha(int c);
int ft_isdigit(int c);
int ft_isascii(int c);
int ft_isalnum(int c);
int ft_isprint(int c);
int ft_isspace(int c);
int ft_strcmp(const char *s1, const char *s2);
int ft_strncmp(const char *s1, const char *s2, size_t n);
int ft_atoi(const char *str);
int ft_memcmp(const void *s1, const void *s2, size_t n);
int ft_strequ(char const *s1, char const *s2);
int ft_strnequ(char const *s1, char const *s2, size_t n);
int get_next_line(const int fd, char **line);
int ft_containscol(char **s, int col, int height, int c);
int ft_containsrow(const char *s, int c);
void *ft_memcpy(void *dst, const void *src, size_t n);
void *ft_memset(void *str, int c, size_t n);
void ft_bzero(void *s, size_t n);
void *ft_memccpy(void *dst, const void *src, int c, size_t n);
void *ft_memchr(const void *s, int c, size_t n);
void *ft_memmove(void *dst, const void *src, size_t len);
void *ft_memalloc(size_t size);
void ft_memdel(void **ap);
void ft_strdel(char **as);
void ft_strclr(char *s);
void ft_striter(char *s, void (*f)(char *));
void ft_striteri(char *s, void (*f)(unsigned int, char *));
void ft_putchar(char c);
void ft_putstr(char const *s);
void ft_putendl(char const *s);
void ft_putnbr(int n);
void ft_putchar_fd(char c, int fd);
void ft_putnbr_fd(int n, int fd);
void ft_putstr_fd(char const *s, int fd);
void ft_putstr_clr(char const *clr, char const *str);
void ft_putendl_fd(char const *s, int fd);
void ft_puttab(char **s);
void ft_puttab_fd(char **s, int fd);
char *ft_lastdigits(char *str);
char *ft_secondword(char *str);
char *ft_strdup(const char *s1);
char *ft_itoa(int n);
char **ft_strsplit(char const *s, char c);
char *ft_strtrim(char const *s);
char *ft_strjoin(char const *s1, char const *s2);
char *ft_strsub(char const *s, unsigned int start, size_t len);
char *ft_strmap(char const *s, char (*f)(char));
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
char *ft_strnew(size_t size);
char *ft_strchr(const char *s, int c);
char *ft_strrchr(const char *s, int c);
char *ft_strcpy(char *dst, const char *src);
char *ft_strncpy(char *dst, const char *src, size_t len);
char *ft_strnstr(const char *haystack, const char *needle,
size_t len);
char *ft_strcat(char *s1, const char *s2);
char *ft_strncat(char *s1, const char *s2, size_t n);
char *ft_strstr(const char *haystack, const char *needle);
char *ft_strndup(const char *s1, size_t n);
char *ft_strsplit_word(char const *s, char c, size_t num);
long ft_atol(const char *str);
size_t ft_strlen(const char *s);
size_t ft_strlcat(char *dst, const char *src, size_t dstsize);
char *ft_strjoin(char const *s1, char const *s2);
char *ft_stringput(char *dest, const char *src, int dcount);
char *ft_strcopy(char *ret, const char *s, int start, int end);
int ft_remspace(const char *str, int c);
int ft_wordcount(const char *str, char c);
t_list *ft_lstnew(const void *content, size_t content_size);
void ft_lstdelone(t_list **alst, void (*del)(void *, size_t));
void ft_lstdel(t_list **alst, void (*del)(void *, size_t));
void ft_lstadd(t_list **alst, t_list *new);
void ft_lstiter(t_list *lst, void (*f)(t_list *elem));
#endif
| [
"[email protected]"
] | |
13566f16ff076035c151b2ddc71dc222909d537a | d04b3215a8e667b4a1499378934d78da5c71f86a | /6_국제로봇콘테스트/App SW/cam_disp.c | f0eb98c9ee0fd77f23b96eb1b9677778eb98abae | [] | no_license | JuyeonHong/OPTC | 6f6b3e23de3d3a44eaef6291373df5fcee7f0204 | d41ec9498123692ec275e4865540ffe7f4570703 | refs/heads/master | 2020-09-28T02:45:53.552517 | 2019-12-08T13:18:13 | 2019-12-08T13:18:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 734 | c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "cam_disp.h"
#define SDK_DEV_NAME "/dev/eagle_sdk"
#define EAGLE_CAMERA_DISP_OFF (0x12480)
#define EAGLE_CAMERA_DISP_ON (0x12481)
int eagle_camera_off(void)
{
int handle;
if ((handle = open(SDK_DEV_NAME, O_RDWR)) < 0) {
printf("Open Error %s\n", SDK_DEV_NAME);
return -1;
}
ioctl(handle, EAGLE_CAMERA_DISP_OFF, 0);
close(handle);
return 0;
}
int eagle_camera_on(void)
{
int handle;
if ((handle = open(SDK_DEV_NAME, O_RDWR)) < 0) {
printf("Open Error %s\n", SDK_DEV_NAME);
return -1;
}
ioctl(handle, EAGLE_CAMERA_DISP_ON, 0);
close(handle);
return 0;
}
| [
"[email protected]"
] | |
629869dc031bb656671951df4a591303a660bcb1 | aca31b63c0c5defba8dd91913154f589ef89523a | /chapter (3)/myseek.c | 146e4aa337cc4b8693dc91b683d3dc9d7012d3ba | [] | no_license | Forasen/chapter_linux_git | 47e6416b95945ebf02c5b24f4c11f31fd98d3f13 | 9fd77d90cdc7595e15b7471b7ff15b1ef59c38a2 | refs/heads/master | 2021-06-18T10:17:54.486707 | 2015-08-09T15:19:28 | 2015-08-09T15:19:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 504 | c | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
typedef struct stu
{
int st_id ;
char st_name[20];
}stu_t, *pstu_t;
int main(int argc, char* argv[])// file_name
{
int fd = open(argv[1], O_RDONLY);
if(fd == -1)
{
perror("open");
exit(1);
}
stu_t stu = {0, ""} ;
lseek(fd, 2 * sizeof(stu_t), SEEK_SET);
read(fd, &stu, sizeof(stu));
printf("id: %d, name: %s\n", stu.st_id, stu.st_name);
close(fd);
}
| [
"[email protected]"
] | |
1c1ec89f975b3d692ba4f4f05734d86c649ab3e6 | 82a2ef67760561afa8168a4627c8fce03bc0ff71 | /OTL_Header.h | e581eded883972446ff929695aaa84b32ce266ba | [] | no_license | Olernov/TAP3.Loader | ddd3bb4f86097d00781e1deea8284718e9e90842 | 0411268778ea5b8fc6203c61896870db6c933d85 | refs/heads/master | 2020-04-16T17:23:34.972239 | 2017-05-25T15:00:07 | 2017-05-25T15:00:07 | 37,660,857 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,209 | h | #pragma once
#define OTL_ORA9I // Compile OTL 4.0/OCI9i
// #define OTL_ORA8
// #define OTL_ORA8I
#if defined(_MSC_VER) // VC++
// Enabling support for 64-bit signed integers
// Since 64-bit integers are not part of the ANSI C++
// standard, this definition is compiler specific.
#define OTL_BIGINT __int64
// Defining a bigint constant that is larger than
// the max 32-bit integer value.
const OTL_BIGINT BIGINT_VAL1=12345678901234000;
// Defining a string-to-bigint conversion
// that is used by OTL internally.
// Since 64-bit ineteger conversion functions are
// not part of the ANSI C++ standard, the code
// below is compiler specific
#define OTL_STR_TO_BIGINT(str,n) \
{ \
n=_atoi64(str); \
}
// Defining a bigint-to-string conversion
// that is used by OTL internally.
// Since 64-bit ineteger conversion functions are
// not part of the ANSI C++ standard, the code
// below is compiler specific
#define OTL_BIGINT_TO_STR(n,str) \
{ \
_i64toa(n,str,10); \
}
#elif defined(__GNUC__) // GNU C++
#include <stdlib.h>
// Enabling support for 64-bit signed integers
// Since 64-bit integers are not part of the ANSI C++
// standard, this definition is compiler specific.
#define OTL_BIGINT long long
const OTL_BIGINT BIGINT_VAL1=12345678901234000LL;
// Defining a string-to-bigint conversion
// that is used by OTL internally.
// Since 64-bit ineteger conversion functions are
// not part of the ANSI C++ standard, the code
// below is compiler specific.
#define OTL_STR_TO_BIGINT(str,n) \
{ \
n=strtoll(str,0,10); \
}
// Defining a bigint-to-string conversion
// that is used by OTL internally.
// Since 64-bit ineteger conversion functions are
// not part of the ANSI C++ standard, the code
// below is compiler specific
#define OTL_BIGINT_TO_STR(n,str) \
{ \
sprintf(str,"%lld",n); \
}
#endif
#define OTL_STL
#include "otlv4.h"
| [
"[email protected]"
] | |
8a68f9da0e87f2ddd2c346832bb4f7c1f7617f9e | b4764dab45feaaaeac0ecafef58971a4bc19d494 | /components/bt/esp_ble_mesh/mesh_models/server/include/server_common.h | d1a313ee73af79588f305e99f802bde94d046022 | [
"Apache-2.0"
] | permissive | brunocasu/esp-idf | cca813644766844e1e5cb8544c39dc5be8ae3a1e | dfcb844445185f3c095b2b8f655d8f09cb67607c | refs/heads/master | 2020-12-23T21:43:26.021536 | 2020-08-20T19:23:06 | 2020-08-20T19:23:06 | 237,282,722 | 1 | 0 | Apache-2.0 | 2020-01-30T18:54:11 | 2020-01-30T18:54:11 | null | UTF-8 | C | false | false | 4,965 | h | // Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _SERVER_COMMON_H_
#define _SERVER_COMMON_H_
#include <string.h>
#include <stdint.h>
#include "mesh_buf.h"
#include "mesh_access.h"
#include "mesh_kernel.h"
#define BLE_MESH_SERVER_RSP_MAX_LEN 384
#define BLE_MESH_SERVER_TRANS_MIC_SIZE 4
#define BLE_MESH_CHECK_SEND_STATUS(_func) do { \
int __status = (_func); \
if (__status) { \
BT_ERR("%s, Send failed, err %d", __func__, __status); \
} \
} while(0);
#define BLE_MESH_STATE_OFF 0x00
#define BLE_MESH_STATE_ON 0x01
#define BLE_MESH_STATE_RESTORE 0x02
/* Following 4 values are as per Mesh Model specification */
#define BLE_MESH_LIGHTNESS_MIN 0x0001
#define BLE_MESH_LIGHTNESS_MAX 0xFFFF
#define BLE_MESH_TEMPERATURE_MIN 0x0320
#define BLE_MESH_TEMPERATURE_MAX 0x4E20
#define BLE_MESH_TEMPERATURE_UNKNOWN 0xFFFF
/* Refer 7.2 of Mesh Model Specification */
#define BLE_MESH_RANGE_UPDATE_SUCCESS 0x00
#define BLE_MESH_CANNOT_SET_RANGE_MIN 0x01
#define BLE_MESH_CANNOT_SET_RANGE_MAX 0x02
#define BLE_MESH_UNKNOWN_REMAIN_TIME 0x3F
#define BLE_MESH_DEVICE_SPECIFIC_RESOLUTION 10
#define BLE_MESH_INVALID_DEVICE_PROPERTY_ID 0x0000
enum {
BLE_MESH_TRANS_TIMER_START, /* Proper transition timer has been started */
BLE_MESH_TRANS_FLAG_MAX,
};
struct bt_mesh_state_transition {
bool just_started;
u8_t trans_time;
u8_t remain_time;
u8_t delay;
u32_t quo_tt;
u32_t counter;
u32_t total_duration;
s64_t start_timestamp;
BLE_MESH_ATOMIC_DEFINE(flag, BLE_MESH_TRANS_FLAG_MAX);
struct k_delayed_work timer;
};
struct bt_mesh_last_msg_info {
u8_t tid;
u16_t src;
u16_t dst;
s64_t timestamp;
};
#define BLE_MESH_SERVER_RSP_BY_APP 0
#define BLE_MESH_SERVER_AUTO_RSP 1
struct bt_mesh_server_rsp_ctrl {
/**
* @brief BLE Mesh Server Response Option
* 1. If get_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response
* of Client Get messages need to be replied by the application;
* 2. If get_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
* of Client Get messages will be replied by the server models;
* 3. If set_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response
* of Client Set messages need to be replied by the application;
* 4. If set_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
* of Client Set messages will be replied by the server models;
* 5. If status_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response
* of Server Status messages need to be replied by the application;
* 6. If status_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
* of Server status messages will be replied by the server models;
*/
u8_t get_auto_rsp : 1, /* Response for Client Get messages */
set_auto_rsp : 1, /* Response for Client Set messages */
status_auto_rsp : 1; /* Response for Server Status messages */
};
u8_t bt_mesh_get_default_trans_time(struct bt_mesh_model *model);
int bt_mesh_get_light_lc_trans_time(struct bt_mesh_model *model, u8_t *trans_time);
int bt_mesh_server_get_optional(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf,
u8_t *trans_time, u8_t *delay,
bool *optional);
void bt_mesh_server_alloc_ctx(struct k_work *work);
bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last,
u8_t tid, u16_t src, u16_t dst, s64_t *now);
void bt_mesh_server_update_last_msg(struct bt_mesh_last_msg_info *last,
u8_t tid, u16_t src, u16_t dst, s64_t *now);
struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, u16_t msg_len);
#endif /* _SERVER_COMMON_H_ */
| [
"[email protected]"
] | |
ee05adfb5f32c6082cbe6ca9498053f4b7e47771 | c44b288ed44960d6b3eb7cc28f00d0f209e8d8c9 | /ebox/other_svn/svn3_old/RobotArm/RA1_et_rtw/rtwtypes.h | 83c318823c92ba96198fa38cb9dc57249a4f3533 | [] | no_license | MartinPlantinga/Edrive | 1fb6ac09766ff16196449620e4f55a5c734eecc7 | 6397a083ceab5dc2b00c54ee2ab9fba88bdf0afd | refs/heads/master | 2023-03-01T14:16:34.204694 | 2017-03-16T19:20:34 | 2017-03-16T19:20:34 | 80,610,028 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,084 | h | /*
* rtwtypes.h
*
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* Code generation for model "RA1".
*
* Model version : 1.900
* Simulink Coder version : 8.9 (R2015b) 13-Aug-2015
* C source code generated on : Thu Mar 24 12:53:29 2016
*
* Target selection: ectarget.tlc
* Note: GRT includes extra infrastructure and instrumentation for prototyping
* Embedded hardware selection: 32-bit Generic
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#ifndef __RTWTYPES_H__
#define __RTWTYPES_H__
#include "tmwtypes.h"
#include "simstruc_types.h"
#ifndef POINTER_T
# define POINTER_T
typedef void * pointer_T;
#endif
/* Logical type definitions */
#if (!defined(__cplusplus))
# ifndef false
# define false (0U)
# endif
# ifndef true
# define true (1U)
# endif
#endif
#endif /* __RTWTYPES_H__ */
| [
"[email protected]"
] | |
cc0ccb958867222b641a8bea3ec1fb3c996367c8 | 8d34fc4bcca2d7bb9f12094dada3179147ea3b43 | /mudlib/room/entryroom.c | b33f0fda39951b0b36a644c4aacde792fb77d67f | [] | no_license | Shea690901/fr | 20c8adffb1b130f77ef3cd2a73ef60cdef8995d6 | 16308bd1b17caafba478a16c032bbeb996eb7d42 | refs/heads/master | 2021-04-28T13:53:23.280635 | 1998-11-10T20:06:02 | 1998-11-10T20:06:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,077 | c | inherit "/std/room.c";
void setup()
{
set_short("FR:Illumitech Entrance");
set_long("You find yourself in a great hall that looks not unlike most "+
"entrances to colleges. Various academic-looking people mill "+
"about here. Most of them have the aspect of someone who doesn't "+
"quite know where to begin or what to do. Thankfully "+
"for you, there is a large sign in front of you that might give "+
"you an idea of what's going on and where to go.\n" +
"%^RED%^BOLD%^You may wish to examine the sign.%^RESET%^\n" +
"To the west is the meeting-room, and to the east is the post "+
"office.\n\n");
set_light(80);
add_item("sign",
" +==========================================================+\n" +
" | FR:Illumitech -- Dedicated to Mud Instruction and the |\n" +
" | Continuing Development of the FR:Mudlib |\n" +
" | |\n" +
" | New Applicants: |\n" +
" | Please enter the Post Office (to the east |\n" +
" | of here) and mail Benedick your request |\n" +
" | to become a student here. Please include |\n" +
" | your Real Name, Email Address, The name |\n" +
" | and IP address of the MUD you're normally |\n" +
" | on, What you would like to learn (and how |\n" +
" | much you might know about coding already) |\n" +
" | and lastly how you heard about us. |\n" +
" | |\n" +
" +==========================================================+\n");
add_item("hall","It's a hall, but your eyes are rather drawn to looking "+
"at the sign.\n");
add_item("people","You see the people are examining the sign.\n");
add_exit("west","/room/meeting","door");
add_exit("east","/room/post","door");
}
| [
"[email protected]"
] | |
cbc3f57d1d2ef5d90c2c6fac1a376c2e7059c10f | 8a2b21ab53f0c66ceac3c25ede8aea7f4f9f79f0 | /HC32F460Temp_FreeRTOS/PeripheralDriver/Hw_Uart3_DMA.h | a6d03696c2f111f38bcd6f284e13f2894d7cac42 | [] | no_license | SourceWolf/HC32F460_FreeRTOS | 3cb79bc2e715fb45cd163573a8e0cff34f1f8c87 | f2fd8e591fb263abbb13a17b4c36508ea2151557 | refs/heads/master | 2023-03-07T06:32:33.435187 | 2021-02-24T08:33:24 | 2021-02-24T08:33:24 | 197,676,821 | 10 | 6 | null | null | null | null | GB18030 | C | false | false | 1,307 | h | #ifndef UART_DMA_H
#define UART_DMA_H
#define USART3_UNIT M4_USART3
#define USART3_BAUDRATE (115200)
#define USART3_RX_PORT PortE
#define USART3_RX_PIN Pin04
#define USART3_RX_FUNC Func_Usart3_Rx
#define USART3_TX_PORT PortE
#define USART3_TX_PIN Pin05
#define USART3_TX_FUNC Func_Usart3_Tx
#define USART3_RI_NUM INT_USART3_RI
#define USART3_EI_NUM INT_USART3_EI
#define USART3_TI_NUM INT_USART3_TI
#define USART3_CLK PWC_FCG1_PERIPH_USART3
//#define USART3_RX_IRQn Int022_IRQn
#define USART3_ER_IRQn Int023_IRQn
#define USART3_RTO_IRQn Int024_IRQn
//#define TIMER02_CHA_IRQn Int025_IRQn
#define UART3_DMA2_UNIT (M4_DMA2)
#define UART3_DMA_RXCH (DmaCh0)
#define UART3_DMA_CLK PWC_FCG0_PERIPH_DMA2
#define UART3_DMA_TRNCNT (40u)//传输次数,最大包长
#define UART3_DMA_BLKSIZE (1u)
#define UART3_DMA_RPT_SIZE UART3_DMA_TRNCNT
#define UART3_DMA_INT_SRC INT_DMA2_BTC0
#define UART3_DMA_Trg_Src EVT_USART3_RI
//#define DMA2_CH0_IRQn Int009_IRQn
void hw_rxdma_init(void);
void hw_uart3Init(void);
void UART_RTO_Timer_Init(void);
void Test_UART_TX(void);
#endif
| [
"[email protected]"
] | |
1bf72913d65fc865a8050a23698c221717c198e5 | a364f5e25e4ec3563c2a6e366069488786927948 | /lib/libcurses/curses_private.h | fbbd7d82ea026e9e1dd883379d9aba88ae735860 | [] | no_license | noud/mouse-bsd | b044db5ba4085794b94ea729eb4148e1c86d73b5 | a16ee9b253dbd25c931216ef9be36611fb847411 | refs/heads/main | 2023-02-24T06:22:20.517329 | 2020-08-25T20:21:40 | 2020-08-25T20:21:40 | 334,500,331 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,627 | h | /* $NetBSD: curses_private.h,v 1.10 2000/05/20 15:12:15 mycroft Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
* ([email protected], [email protected])
* All rights reserved.
*
* This code has been donated to The NetBSD Foundation by the Author.
*
* 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. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/
/* Private structure definitions for curses. */
/*
* A window an array of __LINE structures pointed to by the 'lines' pointer.
* A line is an array of __LDATA structures pointed to by the 'line' pointer.
*
* IMPORTANT: the __LDATA structure must NOT induce any padding, so if new
* fields are added -- padding fields with *constant values* should ensure
* that the compiler will not generate any padding when storing an array of
* __LDATA structures. This is to enable consistent use of memcmp, and memcpy
* for comparing and copying arrays.
*/
struct __ldata {
wchar_t ch; /* Character */
attr_t attr; /* Attributes */
wchar_t bch; /* Background character */
attr_t battr; /* Background attributes */
};
#define __LDATASIZE (sizeof(__LDATA))
struct __line {
#define __ISDIRTY 0x01 /* Line is dirty. */
#define __ISPASTEOL 0x02 /* Cursor is past end of line */
unsigned int flags;
unsigned int hash; /* Hash value for the line. */
int *firstchp, *lastchp; /* First and last chngd columns ptrs */
int firstch, lastch; /* First and last changed columns. */
__LDATA *line; /* Pointer to the line text. */
};
struct __window { /* Window structure. */
struct __window *nextp, *orig; /* Subwindows list and parent. */
int begy, begx; /* Window home. */
int cury, curx; /* Current x, y coordinates. */
int maxy, maxx; /* Maximum values for curx, cury. */
short ch_off; /* x offset for firstch/lastch. */
__LINE **lines; /* Array of pointers to the lines */
__LINE *lspace; /* line space (for cleanup) */
__LDATA *wspace; /* window space (for cleanup) */
#define __ENDLINE 0x00000001 /* End of screen. */
#define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */
#define __FULLWIN 0x00000004 /* Window is a screen. */
#define __IDLINE 0x00000008 /* Insert/delete sequences. */
#define __SCROLLWIN 0x00000010 /* Last char will scroll window. */
#define __SCROLLOK 0x00000020 /* Scrolling ok. */
#define __CLEAROK 0x00000040 /* Clear on next refresh. */
#define __LEAVEOK 0x00000100 /* If cursor left */
#define __KEYPAD 0x00010000 /* If interpreting keypad codes */
#define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */
unsigned int flags;
int delay; /* delay for getch() */
attr_t wattr; /* Character attributes */
wchar_t bch; /* Background character */
attr_t battr; /* Background attributes */
};
/* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */
#define __TERMATTR \
(__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT)
struct __winlist {
struct __window *winp; /* The window. */
struct __winlist *nextp; /* Next window. */
};
/* Private functions. */
#ifdef DEBUG
void __CTRACE(const char *fmt, ...);
#endif
int __delay(void);
unsigned int __hash(char *s, int len);
void __id_subwins(WINDOW *orig);
void __init_getch(void);
void __init_acs(void);
char *__longname(char *bp, char *def); /* Original BSD version */
int __mvcur(int ly, int lx, int y, int x, int in_refresh);
int __nodelay(void);
int __notimeout(void);
char *__parse_cap(const char *, ...);
void __restartwin(void);
void __restore_colors(void);
void __restore_cursor_vis(void);
void __restore_meta_state(void);
void __restore_termios(void);
void __restore_stophandler(void);
void __save_termios(void);
void __set_color(attr_t attr);
void __set_stophandler(void);
void __set_subwin(WINDOW *orig, WINDOW *win);
void __startwin(void);
void __stop_signal_handler(int signo);
int __stopwin(void);
void __swflags(WINDOW *win);
int __timeout(int delay);
int __touchline(WINDOW *win, int y, int sx, int ex);
int __touchwin(WINDOW *win);
char *__tscroll(const char *cap, int n1, int n2);
void __unsetattr(int);
int __waddch(WINDOW *win, __LDATA *dp);
/* Private #defines. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
/* Private externs. */
extern int __echoit;
extern int __endwin;
extern int __pfast;
extern int __rawmode;
extern int __noqch;
extern attr_t __nca;
extern attr_t __mask_OP, __mask_ME, __mask_UE, __mask_SE;
extern struct __winlist *__winlistp;
extern WINDOW *__virtscr;
| [
"[email protected]"
] | |
24b72093f8e8d22334cb7e2834572b1afa357d3a | 5878c2cff7ef1ed2d05e7ff7628dcba0fd134020 | /MCUXpresso_11.1.1_3241/workspace/CMSISv2p00_DSPLIB_SRC/src/Cortex-M4-M3/BasicMathFunctions/arm_mult_f32.c | 83cf90a369fb4d120e58c9c1b6ad7863171b9413 | [
"MIT"
] | permissive | gov466/Embedded-C | 16c580b1e87542b4c755c8f604a302010c32cc33 | febf81fbda55d38a587335057dd561fc486f5103 | refs/heads/master | 2023-01-23T10:21:41.458449 | 2020-11-25T04:22:33 | 2020-11-25T04:22:33 | 210,986,393 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,984 | c | /* ----------------------------------------------------------------------
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* $Date: 29. November 2010
* $Revision: V1.0.3
*
* Project: CMSIS DSP Library
* Title: arm_mult_f32.c
*
* Description: Floating-point vector multiplication.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Version 1.0.3 2010/11/29
* Re-organized the CMSIS folders and updated documentation.
*
* Version 1.0.2 2010/11/11
* Documentation updated.
*
* Version 1.0.1 2010/10/05
* Production release and review comments incorporated.
*
* Version 1.0.0 2010/09/20
* Production release and review comments incorporated.
*
* Version 0.0.5 2010/04/26
* incorporated review comments and updated with latest CMSIS layer
*
* Version 0.0.3 2010/03/10
* Initial version
* -------------------------------------------------------------------- */
#include "arm_math.h"
/**
* @ingroup groupMath
*/
/**
* @defgroup BasicMult Vector Multiplication
*
* Element-by-element multiplication of two vectors.
*
* <pre>
* pDst[n] = pSrcA[n] * pSrcB[n], 0 <= n < blockSize.
* </pre>
*
* There are separate functions for floating-point, Q7, Q15, and Q31 data types.
*/
/**
* @addtogroup BasicMult
* @{
*/
/**
* @brief Floating-point vector multiplication.
* @param[in] *pSrcA points to the first input vector
* @param[in] *pSrcB points to the second input vector
* @param[out] *pDst points to the output vector
* @param[in] blockSize number of samples in each vector
* @return none.
*/
void arm_mult_f32(
float32_t * pSrcA,
float32_t * pSrcB,
float32_t * pDst,
uint32_t blockSize)
{
uint32_t blkCnt; /* loop counters */
/* loop Unrolling */
blkCnt = blockSize >> 2u;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
while(blkCnt > 0u)
{
/* C = A * B */
/* Multiply the inputs and store the results in output buffer */
*pDst++ = (*pSrcA++) * (*pSrcB++);
*pDst++ = (*pSrcA++) * (*pSrcB++);
*pDst++ = (*pSrcA++) * (*pSrcB++);
*pDst++ = (*pSrcA++) * (*pSrcB++);
/* Decrement the blockSize loop counter */
blkCnt--;
}
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
blkCnt = blockSize % 0x4u;
while(blkCnt > 0u)
{
/* C = A * B */
/* Multiply the inputs and store the results in output buffer */
*pDst++ = (*pSrcA++) * (*pSrcB++);
/* Decrement the blockSize loop counter */
blkCnt--;
}
}
/**
* @} end of BasicMult group
*/
| [
"[email protected]"
] | |
df0c66ba02221e21329ea94b38fea8e1b8e11d0e | c6e14f68ba25b6c8a8699bebd14b6146793e59ab | /RRC/code/asn1c/ThresholdEUTRA.h | d6194fa3c27400034d5d5caeac608b5e22d42653 | [] | no_license | Captain-One/C_Programe | 2a049e0530b863c5ffa53fc55e4f0d96b1ce116f | 2c2bc608a1f42f7ecf95e049cf48e45fdf090889 | refs/heads/master | 2021-07-13T14:49:09.308017 | 2020-06-16T06:49:46 | 2020-06-16T06:49:46 | 136,001,747 | 0 | 3 | null | null | null | null | UTF-8 | C | false | false | 1,115 | h | /*
* Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
* From ASN.1 module "EUTRA-RRC-Definitions"
* found in "36331-b00.asn"
* `asn1c -S /usr/local/share/asn1c -fcompound-names -fskeletons-copy -gen-PER -pdu=auto`
*/
#ifndef _ThresholdEUTRA_H_
#define _ThresholdEUTRA_H_
#include "asn_application.h"
/* Including external dependencies */
#include "RSRP-Range.h"
#include "RSRQ-Range.h"
#include "constr_CHOICE.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum ThresholdEUTRA_PR {
ThresholdEUTRA_PR_NOTHING, /* No components present */
ThresholdEUTRA_PR_threshold_RSRP,
ThresholdEUTRA_PR_threshold_RSRQ
} ThresholdEUTRA_PR;
/* ThresholdEUTRA */
typedef struct ThresholdEUTRA {
ThresholdEUTRA_PR present;
union ThresholdEUTRA_u {
RSRP_Range_t threshold_RSRP;
RSRQ_Range_t threshold_RSRQ;
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ThresholdEUTRA_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_ThresholdEUTRA;
#ifdef __cplusplus
}
#endif
#endif /* _ThresholdEUTRA_H_ */
#include "asn_internal.h"
| [
"[email protected]"
] | |
6b842a15bd488472175fba521abe0be61fcee8a7 | ca0b02d38560f039706bdc0d6c663d2181fec2ce | /components/imu/imu.c | 5855381b99b06be93ce73901e7e15c50d593a2e8 | [
"BSD-2-Clause"
] | permissive | danielealbano/bikenav-esp32 | c690c162c53d2a2861036ee9119aaf3c6eff54f0 | 5328719d547a196c054af14b4d7326e2d1c60713 | refs/heads/master | 2020-03-18T23:25:52.049862 | 2018-05-30T21:57:54 | 2018-05-30T21:57:54 | 135,402,277 | 3 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,162 | c | #include "esp_log.h"
#include "driver/gpio.h"
#include "driver/i2c.h"
#include "soc/gpio_struct.h"
#include "imu.h"
int8_t imu_bmi160_user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t length, void* cb_user_data)
{
imu_t* imu = (imu_t*)cb_user_data;
if (length == 0) {
return (int8_t)ESP_ERR_INVALID_SIZE;
}
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_WRITE, I2C_ACK_CHECK_EN);
i2c_master_write_byte(cmd, reg_addr, I2C_ACK_CHECK_DIS);
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_READ, I2C_ACK_CHECK_EN);
if (length > 1) {
i2c_master_read(cmd, reg_data, length - 1, I2C_ACK_VAL);
}
i2c_master_read_byte(cmd, reg_data+length-1, I2C_NACK_VAL);
i2c_master_stop(cmd);
esp_err_t ret = i2c_master_cmd_begin(imu->i2c.port_number, cmd, IMU_I2C_MAX_WAIT);
i2c_cmd_link_delete(cmd);
return (int8_t)ret;
}
int8_t imu_bmi160_user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t length, void* cb_user_data)
{
imu_t* imu = (imu_t*)cb_user_data;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_WRITE, I2C_ACK_CHECK_EN);
i2c_master_write_byte(cmd, reg_addr, I2C_ACK_CHECK_EN);
i2c_master_write(cmd, reg_data, length, I2C_ACK_CHECK_EN);
i2c_master_stop(cmd);
esp_err_t ret = i2c_master_cmd_begin(imu->i2c.port_number, cmd, IMU_I2C_MAX_WAIT);
i2c_cmd_link_delete(cmd);
return (int8_t)ret;
}
void imu_bmi160_user_delay_ms(uint32_t period)
{
uint32_t start = xTaskGetTickCount() * portTICK_PERIOD_MS;
do {
// do nothing
} while((xTaskGetTickCount() * portTICK_PERIOD_MS) - start <= period);
}
int8_t imu_bmm150_user_read(uint8_t id, uint8_t reg_addr, uint8_t *aux_data, uint16_t len, void* cb_user_data)
{
imu_t* imu = (imu_t*)cb_user_data;
return bmi160_aux_read(reg_addr, aux_data, len, &imu->sensor_bmi160);
}
int8_t imu_bmm150_user_write(uint8_t id, uint8_t reg_addr, uint8_t *aux_data, uint16_t len, void* cb_user_data)
{
imu_t* imu = (imu_t*)cb_user_data;
return bmi160_aux_write(reg_addr, aux_data, len, &imu->sensor_bmi160);
}
void imu_bmm150_user_delay_ms(uint32_t period)
{
uint32_t start = xTaskGetTickCount() * portTICK_PERIOD_MS;
do {
// do nothing
} while((xTaskGetTickCount() * portTICK_PERIOD_MS) - start <= period);
}
void imu_init_i2c(imu_t *imu)
{
i2c_config_t conf;
memset(&conf, 0, sizeof(conf));
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = imu->i2c.pins.sda;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_io_num = imu->i2c.pins.scl;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = imu->i2c.frequency_hz;
i2c_param_config(imu->i2c.port_number, &conf);
i2c_driver_install(imu->i2c.port_number, conf.mode, 0, 0, 0);
}
void imu_init_bmi160(imu_t *imu)
{
int8_t result;
imu->sensor_bmi160.id = imu->i2c.bmi160_address;
imu->sensor_bmi160.interface = BMI160_I2C_INTF;
imu->sensor_bmi160.read = imu_bmi160_user_i2c_read;
imu->sensor_bmi160.write = imu_bmi160_user_i2c_write;
imu->sensor_bmi160.delay_ms = imu_bmi160_user_delay_ms;
imu->sensor_bmi160.cb_user_data = (void*)imu;
if ((result = bmi160_init(&imu->sensor_bmi160)) != BMI160_OK) {
ESP_LOGE(TAG, "bmi160_init failed: %d", result);
return;
}
ESP_LOGI(TAG, "BMI160 CHIP ID : %d", imu->sensor_bmi160.chip_id);
/* Select the Output data rate, range of accelerometer sensor */
imu->sensor_bmi160.accel_cfg.odr = BMI160_ACCEL_ODR_800HZ;
imu->sensor_bmi160.accel_cfg.range = BMI160_ACCEL_RANGE_4G;
imu->sensor_bmi160.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4;
imu->sensor_bmi160.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
/* Select the Output data rate, range of Gyroscope sensor */
imu->sensor_bmi160.gyro_cfg.odr = BMI160_GYRO_ODR_800HZ;
imu->sensor_bmi160.gyro_cfg.range = BMI160_GYRO_RANGE_2000_DPS;
imu->sensor_bmi160.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;
imu->sensor_bmi160.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE;
if ((result = bmi160_set_sens_conf(&imu->sensor_bmi160)) != BMI160_OK) {
ESP_LOGE(TAG, "bmi160_set_sens_conf failed: %d", result);
return;
}
}
void imu_init_perform_self_testing(imu_t *imu)
{
// TODO: add support for self testing
}
void imu_init_bmm150_aux(imu_t *imu)
{
int8_t result;
imu->sensor_bmi160.aux_cfg.aux_sensor_enable = 1;
imu->sensor_bmi160.aux_cfg.aux_i2c_addr = imu->i2c.bmm150_address;
imu->sensor_bmi160.aux_cfg.manual_enable = 0;
imu->sensor_bmi160.aux_cfg.aux_rd_burst_len = 2;
imu->sensor_bmm150.read = imu_bmm150_user_read;
imu->sensor_bmm150.write = imu_bmm150_user_write;
imu->sensor_bmm150.delay_ms = imu_bmm150_user_delay_ms;
imu->sensor_bmm150.dev_id = imu->i2c.bmm150_address;
imu->sensor_bmm150.intf = BMM150_I2C_INTF;
imu->sensor_bmm150.cb_user_data = (void*)imu;
if ((result = bmi160_aux_init(&imu->sensor_bmi160)) != BMI160_OK) {
ESP_LOGE(TAG, "bmi160_init failed: %d", result);
return;
}
if ((result = bmm150_init(&imu->sensor_bmm150)) != BMI160_OK) {
ESP_LOGE(TAG, "bmm150_init failed: %d", result);
return;
}
ESP_LOGI(TAG, "BMM150 CHIP ID : %d", imu->sensor_bmm150.chip_id);
imu->sensor_bmm150.settings.pwr_mode = BMM150_NORMAL_MODE;
if ((result = bmm150_set_op_mode(&imu->sensor_bmm150)) != BMI160_OK) {
ESP_LOGE(TAG, "bmm150_set_op_mode failed: %d", result);
return;
}
imu->sensor_bmm150.settings.preset_mode = BMM150_PRESETMODE_LOWPOWER;
if ((result = bmm150_set_presetmode(&imu->sensor_bmm150)) != BMI160_OK) {
ESP_LOGE(TAG, "bmm150_set_presetmode failed: %d", result);
return;
}
imu->sensor_bmi160.aux_cfg.aux_odr = 8;
if ((result = bmi160_config_aux_mode(&imu->sensor_bmi160)) != BMI160_OK) {
ESP_LOGE(TAG, "bmi160_config_aux_mode failed: %d", result);
return;
}
if ((result = bmi160_set_aux_auto_mode(&imu->sensor_bmi160.aux_cfg.aux_i2c_addr, &imu->sensor_bmi160)) != BMI160_OK) {
ESP_LOGE(TAG, "bmi160_set_aux_auto_mode failed: %d", result);
return;
}
}
imu_t* imu_alloc(uint8_t i2c_bmi160_address, uint8_t i2c_bmm150_address, gpio_num_t i2c_pins_sda,
gpio_num_t i2c_pins_scl, uint8_t i2c_port_number, uint32_t frequency_hz)
{
imu_t *imu = (imu_t*)malloc(sizeof(imu_t));
memset(imu, 0, sizeof(imu_t));
imu->i2c.bmi160_address = i2c_bmi160_address;
imu->i2c.bmm150_address = i2c_bmm150_address;
imu->i2c.port_number = i2c_port_number;
imu->i2c.frequency_hz = frequency_hz;
imu->i2c.pins.sda = i2c_pins_sda;
imu->i2c.pins.scl = i2c_pins_scl;
return imu;
}
void imu_init(imu_t *imu)
{
imu_init_i2c(imu);
imu_init_bmi160(imu);
imu_init_perform_self_testing(imu);
imu_init_bmm150_aux(imu);
}
void imu_free(imu_t *imu)
{
free(imu);
}
| [
"[email protected]"
] | |
e9e307a260c02ff41b91a89ba1d2b211830872c8 | 72f2992a3659ff746ba5ce65362acbe85a918df9 | /apps-src/apps/external/freerdp/server/proxy/pf_graphics.c | 23755d93c3a3321cde8481cb4891f640f6840b70 | [
"BSD-2-Clause"
] | permissive | chongtianfeiyu/Rose | 4742f06ee9ecd55f9717ac6378084ccf8bb02a15 | 412175b57265ba2cda1e33dd2047a5a989246747 | refs/heads/main | 2023-05-23T14:03:08.095087 | 2021-06-19T13:23:58 | 2021-06-19T14:00:25 | 391,238,554 | 0 | 1 | BSD-2-Clause | 2021-07-31T02:39:25 | 2021-07-31T02:39:24 | null | UTF-8 | C | false | false | 4,179 | c | /**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2019 Mati Shabtay <[email protected]>
* Copyright 2019 Kobi Mizrachi <[email protected]>
* Copyright 2019 Idan Freiberg <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(_WIN32) || defined(ANDROID) || defined(__APPLE__)
#include "freerdp_config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/codec/bitmap.h>
#include "pf_graphics.h"
#include "pf_log.h"
#include "pf_gdi.h"
#include "pf_context.h"
#include <freerdp/gdi/dc.h>
#include <freerdp/gdi/shape.h>
#include <freerdp/gdi/region.h>
#include <freerdp/gdi/bitmap.h>
#include <freerdp/gdi/bitmap.h>
#include <freerdp/graphics.h>
#include <freerdp/log.h>
#define TAG PROXY_TAG("graphics")
/* Bitmap Class */
static BOOL pf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
return TRUE;
}
static void pf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
{
}
static BOOL pf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
return TRUE;
}
static BOOL pf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
return TRUE;
}
/* Pointer Class */
static BOOL pf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
return TRUE;
}
static void pf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
{
}
static BOOL pf_Pointer_Set(rdpContext* context, const rdpPointer* pointer)
{
return TRUE;
}
static BOOL pf_Pointer_SetNull(rdpContext* context)
{
return TRUE;
}
static BOOL pf_Pointer_SetDefault(rdpContext* context)
{
return TRUE;
}
static BOOL pf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
{
return TRUE;
}
/* Glyph Class */
static BOOL pf_Glyph_New(rdpContext* context, const rdpGlyph* glyph)
{
return TRUE;
}
static void pf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
{
}
static BOOL pf_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, INT32 x, INT32 y, INT32 w,
INT32 h, INT32 sx, INT32 sy, BOOL fOpRedundant)
{
return TRUE;
}
static BOOL pf_Glyph_BeginDraw(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height,
UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
{
return TRUE;
}
static BOOL pf_Glyph_EndDraw(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height,
UINT32 bgcolor, UINT32 fgcolor)
{
return TRUE;
}
/* Graphics Module */
BOOL pf_register_pointer(rdpGraphics* graphics)
{
rdpPointer* pointer = NULL;
if (!(pointer = (rdpPointer*)calloc(1, sizeof(rdpPointer))))
return FALSE;
pointer->size = sizeof(rdpPointer);
pointer->New = pf_Pointer_New;
pointer->Free = pf_Pointer_Free;
pointer->Set = pf_Pointer_Set;
pointer->SetNull = pf_Pointer_SetNull;
pointer->SetDefault = pf_Pointer_SetDefault;
pointer->SetPosition = pf_Pointer_SetPosition;
graphics_register_pointer(graphics, pointer);
free(pointer);
return TRUE;
}
BOOL pf_register_graphics(rdpGraphics* graphics)
{
rdpBitmap bitmap;
rdpGlyph glyph;
if (!graphics || !graphics->Bitmap_Prototype || !graphics->Glyph_Prototype)
return FALSE;
bitmap = *graphics->Bitmap_Prototype;
glyph = *graphics->Glyph_Prototype;
bitmap.size = sizeof(rdpBitmap);
bitmap.New = pf_Bitmap_New;
bitmap.Free = pf_Bitmap_Free;
bitmap.Paint = pf_Bitmap_Paint;
bitmap.SetSurface = pf_Bitmap_SetSurface;
graphics_register_bitmap(graphics, &bitmap);
glyph.size = sizeof(rdpGlyph);
glyph.New = pf_Glyph_New;
glyph.Free = pf_Glyph_Free;
glyph.Draw = pf_Glyph_Draw;
glyph.BeginDraw = pf_Glyph_BeginDraw;
glyph.EndDraw = pf_Glyph_EndDraw;
graphics_register_glyph(graphics, &glyph);
return TRUE;
} | [
"[email protected]"
] | |
b37ff6f30c935e2a1a64a5ca91b1a09a4da83e3c | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/tools/testing/nvdimm/test/extr_nfit.c_nfit_test_evaluate_dsm.c | 02bb635f90ba8c2e7cd938adc8203a5286e8a8cc | [] | 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 | 953 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef union acpi_object {int dummy; } acpi_object ;
typedef int /*<<< orphan*/ u64 ;
typedef int /*<<< orphan*/ guid_t ;
typedef int /*<<< orphan*/ * acpi_handle ;
/* Variables and functions */
int /*<<< orphan*/ ENXIO ;
union acpi_object* ERR_PTR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nfit_ctl_handle ;
union acpi_object* result ;
__attribute__((used)) static union acpi_object *nfit_test_evaluate_dsm(acpi_handle handle,
const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4)
{
if (handle != &nfit_ctl_handle)
return ERR_PTR(-ENXIO);
return result;
} | [
"[email protected]"
] | |
991dc4fde7ee9fd5037b65d49c5f7332143b13ba | 3c883e1084f0a61e558c2d210bb1b4ae8a5e6a06 | /third_party/nvxs-1.0.2/CLAPACK/SRC/cpptri.c | 4bc772fe4981ab76919f667462ebdb28ce5bf5b9 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"Python-2.0",
"BSD-3-Clause"
] | permissive | nya3jp/python-animeface | 7e48aa333c9f365a80acdf43e5d516edc8d0b189 | 15caf8b1ca29847f0dceb54e4b91c77726c4111c | refs/heads/main | 2022-04-29T20:17:01.198810 | 2022-04-04T10:17:59 | 2022-04-04T10:17:59 | 10,998,381 | 150 | 14 | Apache-2.0 | 2022-04-03T07:18:40 | 2013-06-27T14:06:08 | C | UTF-8 | C | false | false | 4,357 | c | #include "f2c.h"
#include "blaswrap.h"
/* Table of constant values */
static real c_b8 = 1.f;
static integer c__1 = 1;
/* Subroutine */ int cpptri_(char *uplo, integer *n, complex *ap, integer *
info)
{
/* System generated locals */
integer i__1, i__2, i__3;
real r__1;
complex q__1;
/* Local variables */
integer j, jc, jj;
real ajj;
integer jjn;
extern /* Subroutine */ int chpr_(char *, integer *, real *, complex *,
integer *, complex *);
extern /* Complex */ VOID cdotc_(complex *, integer *, complex *, integer
*, complex *, integer *);
extern logical lsame_(char *, char *);
extern /* Subroutine */ int ctpmv_(char *, char *, char *, integer *,
complex *, complex *, integer *);
logical upper;
extern /* Subroutine */ int csscal_(integer *, real *, complex *, integer
*), xerbla_(char *, integer *), ctptri_(char *, char *,
integer *, complex *, integer *);
/* -- LAPACK routine (version 3.1) -- */
/* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
/* November 2006 */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* Purpose */
/* ======= */
/* CPPTRI computes the inverse of a complex Hermitian positive definite */
/* matrix A using the Cholesky factorization A = U**H*U or A = L*L**H */
/* computed by CPPTRF. */
/* Arguments */
/* ========= */
/* UPLO (input) CHARACTER*1 */
/* = 'U': Upper triangular factor is stored in AP; */
/* = 'L': Lower triangular factor is stored in AP. */
/* N (input) INTEGER */
/* The order of the matrix A. N >= 0. */
/* AP (input/output) COMPLEX array, dimension (N*(N+1)/2) */
/* On entry, the triangular factor U or L from the Cholesky */
/* factorization A = U**H*U or A = L*L**H, packed columnwise as */
/* a linear array. The j-th column of U or L is stored in the */
/* array AP as follows: */
/* if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j; */
/* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n. */
/* On exit, the upper or lower triangle of the (Hermitian) */
/* inverse of A, overwriting the input factor U or L. */
/* INFO (output) INTEGER */
/* = 0: successful exit */
/* < 0: if INFO = -i, the i-th argument had an illegal value */
/* > 0: if INFO = i, the (i,i) element of the factor U or L is */
/* zero, and the inverse could not be computed. */
/* ===================================================================== */
/* .. Parameters .. */
/* .. */
/* .. Local Scalars .. */
/* .. */
/* .. External Functions .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. Executable Statements .. */
/* Test the input parameters. */
/* Parameter adjustments */
--ap;
/* Function Body */
*info = 0;
upper = lsame_(uplo, "U");
if (! upper && ! lsame_(uplo, "L")) {
*info = -1;
} else if (*n < 0) {
*info = -2;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("CPPTRI", &i__1);
return 0;
}
/* Quick return if possible */
if (*n == 0) {
return 0;
}
/* Invert the triangular Cholesky factor U or L. */
ctptri_(uplo, "Non-unit", n, &ap[1], info);
if (*info > 0) {
return 0;
}
if (upper) {
/* Compute the product inv(U) * inv(U)'. */
jj = 0;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
jc = jj + 1;
jj += j;
if (j > 1) {
i__2 = j - 1;
chpr_("Upper", &i__2, &c_b8, &ap[jc], &c__1, &ap[1]);
}
i__2 = jj;
ajj = ap[i__2].r;
csscal_(&j, &ajj, &ap[jc], &c__1);
/* L10: */
}
} else {
/* Compute the product inv(L)' * inv(L). */
jj = 1;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
jjn = jj + *n - j + 1;
i__2 = jj;
i__3 = *n - j + 1;
cdotc_(&q__1, &i__3, &ap[jj], &c__1, &ap[jj], &c__1);
r__1 = q__1.r;
ap[i__2].r = r__1, ap[i__2].i = 0.f;
if (j < *n) {
i__2 = *n - j;
ctpmv_("Lower", "Conjugate transpose", "Non-unit", &i__2, &ap[
jjn], &ap[jj + 1], &c__1);
}
jj = jjn;
/* L20: */
}
}
return 0;
/* End of CPPTRI */
} /* cpptri_ */
| [
"[email protected]"
] | |
0c8e3f50cbbb45e0e1854406e677e12660e96fff | 715c03062cd15cc7d28e3bfe92a972e5d890f40a | /2060.c | 4a6947005dbb582409b3cec80a45ebcee491eeb8 | [] | no_license | ashwinipatankar/urionlinejudgesolutions | f6f3e5488b8b3996f3f87adb1dce568dae208ce2 | 9b0f1eb194f8c2cb7cdd76a37bbbe383f86f766c | refs/heads/master | 2018-09-24T16:14:59.806786 | 2018-06-10T03:36:01 | 2018-06-10T03:36:01 | 118,068,099 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 478 | c | #include <stdio.h>
int main() {
int n = 0, i = 0, j = 0;
int two, three, four, five = 0;
scanf("%d", &n);
for (i=0; i < n; i++) {
scanf("%d", &j);
if (j%2 == 0) two++;
if (j%3 == 0) three++;
if (j%4 == 0) four++;
if (j%5 == 0) five++;
}
printf("%d Multiplo(s) de 2\n", two);
printf("%d Multiplo(s) de 3\n", three);
printf("%d Multiplo(s) de 4\n", four);
printf("%d Multiplo(s) de 5\n", five);
}
| [
"[email protected]"
] | |
1ecf64f92509fdc1c8582059641c680aa8cd2c8d | f4dc3450a1cfedf352774cba95dc68b32cbfbf11 | /Sources/Emulator/src/mame/video/playch10.c | dd60373c83e88c9de178a991856fb7b3f9a158f8 | [] | no_license | Jaku2k/MAMEHub | ae85696aedf3f1709b98090c843c752d417874a9 | faa98abc278cd52dd599584f7de5e2dd39cf6f87 | refs/heads/master | 2021-01-18T07:48:32.570205 | 2013-10-10T01:42:06 | 2013-10-10T01:42:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,535 | c | #include "emu.h"
#include "video/ppu2c0x.h"
#include "includes/playch10.h"
WRITE8_MEMBER(playch10_state::playch10_videoram_w)
{
UINT8 *videoram = m_videoram;
if (m_pc10_sdcs)
{
videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
}
void playch10_state::palette_init()
{
const UINT8 *color_prom = memregion("proms")->base();
ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
int i;
for (i = 0; i < 256; i++)
{
int bit0, bit1, bit2, bit3, r, g, b;
/* red component */
bit0 = ~(color_prom[0] >> 0) & 0x01;
bit1 = ~(color_prom[0] >> 1) & 0x01;
bit2 = ~(color_prom[0] >> 2) & 0x01;
bit3 = ~(color_prom[0] >> 3) & 0x01;
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* green component */
bit0 = ~(color_prom[256] >> 0) & 0x01;
bit1 = ~(color_prom[256] >> 1) & 0x01;
bit2 = ~(color_prom[256] >> 2) & 0x01;
bit3 = ~(color_prom[256] >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* blue component */
bit0 = ~(color_prom[2*256] >> 0) & 0x01;
bit1 = ~(color_prom[2*256] >> 1) & 0x01;
bit2 = ~(color_prom[2*256] >> 2) & 0x01;
bit3 = ~(color_prom[2*256] >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette_set_color(machine(),i,MAKE_RGB(r,g,b));
color_prom++;
}
ppu->init_palette_rgb(machine(), 256);
}
void playch10_state::ppu_irq(int *ppu_regs)
{
machine().device("cart")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE );
m_pc10_int_detect = 1;
}
/* our ppu interface */
/* things like mirroring and whether to use vrom or vram */
/* can be set by calling 'ppu2c0x_override_hardware_options' */
const ppu2c0x_interface playch10_ppu_interface =
{
"cart",
"bottom",
1, /* gfxlayout num */
256, /* color base */
PPU_MIRROR_NONE /* mirroring */
};
TILE_GET_INFO_MEMBER(playch10_state::get_bg_tile_info)
{
UINT8 *videoram = m_videoram;
int offs = tile_index * 2;
int code = videoram[offs] + ((videoram[offs + 1] & 0x07) << 8);
int color = (videoram[offs + 1] >> 3) & 0x1f;
SET_TILE_INFO_MEMBER(0, code, color, 0);
}
void playch10_state::video_start()
{
const UINT8 *bios = memregion("maincpu")->base();
m_pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(playch10_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,
8, 8, 32, 32);
}
VIDEO_START_MEMBER(playch10_state,playch10_hboard)
{
const UINT8 *bios = memregion("maincpu")->base();
m_pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(playch10_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,
8, 8, 32, 32);
}
/***************************************************************************
Display refresh
***************************************************************************/
UINT32 playch10_state::screen_update_playch10_single(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
rectangle top_monitor = screen.visible_area();
top_monitor.max_y = ( top_monitor.max_y - top_monitor.min_y ) / 2;
if(m_pc10_dispmask_old != m_pc10_dispmask)
{
m_pc10_dispmask_old = m_pc10_dispmask;
if(m_pc10_dispmask)
m_pc10_game_mode ^= 1;
}
if ( m_pc10_game_mode )
/* render the ppu */
ppu->render(bitmap, 0, 0, 0, 0 );
else
{
/* When the bios is accessing vram, the video circuitry can't access it */
if ( !m_pc10_sdcs )
m_bg_tilemap->draw(bitmap, top_monitor, 0, 0);
}
return 0;
}
UINT32 playch10_state::screen_update_playch10_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
/* Single Monitor version */
if (m_pc10_bios != 1)
return screen_update_playch10_single(screen, bitmap, cliprect);
if (!m_pc10_dispmask)
/* render the ppu */
ppu->render(bitmap, 0, 0, 0, 0);
else
bitmap.fill(0, cliprect);
return 0;
}
UINT32 playch10_state::screen_update_playch10_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* Single Monitor version */
if (m_pc10_bios != 1)
return screen_update_playch10_single(screen, bitmap, cliprect);
/* When the bios is accessing vram, the video circuitry can't access it */
if ( !m_pc10_sdcs )
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
else
bitmap.fill(0, cliprect);
return 0;
}
| [
"[email protected]"
] | |
f43b8220b0a0f3a69b51ec530c4667fb33d8d784 | 290a486ed2dc1aa944a7f08780a80a423d8f74cd | /src/usnet/socket.h | b19e92690c119c9e70b288a42d8e73b8b1de8d4c | [
"BSD-3-Clause"
] | permissive | huiweics/libusnet | b56071a8230a619d54e195896f49431c6147206c | ded6b1339a2e79c84e9e73cc3ee354ef9ff5b699 | refs/heads/master | 2021-01-17T20:58:20.916587 | 2015-05-07T16:41:24 | 2015-05-07T16:41:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,188 | h | /*
* Copyright (c) 2015 Jackie Dinh <[email protected]>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1 Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2 Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3 Neither the name of the <organization> 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 <COPYRIGHT HOLDER> 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.
*
* @(#)socket.h
*/
#ifndef USNET_SOCKET_H_
#define USNET_SOCKET_H_
#include <stdint.h>
#include "types.h"
#define SO_DEFAULT_BACKLOG 500;
struct backlog_queue {
int bq_head;
int bq_tail;
int bq_size;
uint32_t *bq_connq;
};
struct usn_socket {
uint32_t so_fd;
uint16_t so_dom;
uint16_t so_type;
uint16_t so_proto;
uint16_t so_state;
uint16_t so_sport;
uint16_t so_dport;
uint32_t so_saddr;
uint32_t so_daddr;
uint16_t so_options;
void *so_tcb;
struct backlog_queue *so_backlogq;
};
/* so_options */
#define SO_BIND 0x0001 /* bound to local address */
#define SO_ACCEPT 0x0002 /* socket has had listen() */
//#define SO_REUSEADDR 0x0004 /* allow local address reuse */
//#define SO_KEEPALIVE 0x0008 /* keep connections alive */
//#define SO_DONTROUTE 0x0010 /* just use interface addresses */
//#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
//#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
//#define SO_LINGER 0x0080 /* linger on close if data present */
//#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
//#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
/* so_state */
#define SO_NOFDREF 0x001 /* no file table ref any more */
#define SO_ISCONNECTED 0x002 /* socket connected to a peer */
#define SO_ISCONNECTING 0x004 /* in process of connecting to peer */
#define SO_ISDISCONNECTING 0x008 /* in process of disconnecting */
#define SO_CANTSENDMORE 0x010 /* can't send more data to peer */
#define SO_CANTRCVMORE 0x020 /* can't receive more data from peer */
#define SO_RCVATMARK 0x040 /* at mark on input */
#define SO_PRIV 0x080 /* privileged for broadcast, raw... */
#define SO_NBIO 0x100 /* non-blocking ops, user-space */
#define SO_ASYNC 0x200 /* async i/o notify, user-space */
#define SO_ISCONFIRMING 0x400 /* deciding to accept connection req */
void
usnet_socket_init(usn_context_t *ctx, int create);
inline usn_socket_t*
usnet_get_socket(usn_context_t *ctx, usn_socket_t *key);
inline usn_socket_t*
usnet_search_socket(usn_context_t *ctx, usn_socket_t *sitem);
inline usn_socket_t*
usnet_insert_socket(usn_context_t *ctx, usn_socket_t *sitem);
inline int
usnet_remove_socket(usn_context_t *ctx, usn_socket_t *sitem);
/* socket events */
int
usnet_send_listen_event(usn_context_t *ctx, uint32_t fd, uint32_t addr, uint16_t port);
#endif //USNET_SOCKET_H_
| [
"[email protected]"
] | |
3ce62b54f0b4b6c8a50c1661d38a9b4b7e6d393f | 7a6733a608a48eac778515fb40acf0084f0c4710 | /0327/0327/01.c | 9d2e3260f9ad78e9b7a619cead91536c0be5288e | [] | no_license | Consini/C-practice | c31e9162536de7cf818a76c298dfad4a6d8a5686 | 7fc6ab6c467aa37a4db871efd9002ca1e9b80d54 | refs/heads/master | 2020-05-16T17:23:18.352078 | 2019-10-23T14:52:50 | 2019-10-23T14:52:50 | 183,193,152 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 2,756 | c | #define _CRT_SECURE_NO_WARNINGS 1
// 0 '\0' '0' NULL
#if 0
//递归实现二分查找
#include<stdio.h>
#include<string.h>
int binary(int arr[], int k, int left, int right)
{
//int arr[]代表的是数组地址,若在函数内部定义int right = sizeof(arr) / sizeof(arr[0])- 1;则right=1。
while (left <= right)
{
int mid = left + (right - left) / 2; //放在while内部,mid的值要改变
if (arr[mid] < k)
{
return binary(arr,k,mid+1,right);
}
else if (arr[mid] > k)
{
return binary(arr, k,left,mid-1);
}
else
{
return mid;
}
}
return -1;
}
int main()
{
int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int left = 0;
int right = sizeof(arr) / sizeof(arr[0]) - 1;
int ret = binary(arr, 6, left, right);
if (-1 == ret)
{
printf("找不到\n");
}
else
{
printf("找到了,下标是%d\n", ret);
}
system("pause");
return 0;
}
#endif
//二分查找
#if 0
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int binary(int arr[], int k, int left, int right)
{
//int arr[]代表的是数组地址,若在函数内部定义int right = sizeof(arr) / sizeof(arr[0])- 1;则right=1。
while (left <= right)
{
int mid = left + (right - left) / 2; //放在while内部,mid的值要改变
if (arr[mid] < k)
{
left = mid + 1;
}
else if (arr[mid] > k)
{
right = mid - 1;
}
else
{
return mid;
}
}
return -1;
}
int main()
{
int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int left = 0;
int right = sizeof(arr) / sizeof(arr[0]) - 1;
int ret = binary(arr, 3, left, right);
if (-1 == ret)
{
printf("找不到\n");
}
else
{
printf("找到了,下标是%d\n", ret);
}
system("pause");
return 0;
}
#endif
#if 0
//转换字符--调用函数
#include<stdio.h>
char translation(ch)
{
while ((ch = getchar()) != EOF)//end of file(输入结束符)文件的结尾在<stdio.h>文件中定义为-1 ctr+z退出程序,ctr+c直接结束
{
if (ch >= 'a' && ch <= 'z')
{
putchar(ch - 32);
}
else if (ch >= 'A' && ch <= 'Z')
{
putchar(ch + 32);
}
else if (ch >= '0' && ch <= '9')
;
}
}
int main()
{
char ch = 0;
char m = translation(ch);
return 0;
}
#endif
#if 0
//C陷阱与缺陷 高质量C++ 程序员的自我修养 第一,二,三,六,十章
//转换字符
//getchar()的返回类型为什么是int? 用更大范围区间的int 型接收,使程序更加稳健
#include<stdio.h>
int main()
{
int ch = 0;
while ((ch=getchar()) != EOF)//end of file文件的结尾代表-1 ctr+z退出程序,ctr+c直接结束
{
if (ch >= 'a' && ch <= 'z')
{
putchar(ch -32);
}
else if (ch >= 'A' && ch <= 'Z')
{
putchar(ch + 32);
}
else if (ch >= '0' && ch <= '9')
;
}
return 0;
}
#endif
| [
"[email protected]"
] | |
b502f5d8c30453fcf317b8b695590aa86ef56cd4 | a6294c597815711104e0c7ea6b30359fbb5c69df | /firmware/irq.c | 755fea0a4b5c1a4c68658513840f477a038c668f | [] | no_license | jeanthom/chubby75-blinken | a550415045d924b2cd3101e9b538052553f492d4 | 072c801ad414812e0fc4272c8839a9525bc1395c | refs/heads/master | 2020-05-31T18:25:41.641088 | 2019-06-21T08:08:12 | 2019-06-21T08:08:12 | 190,433,950 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 818 | c | #include <stdarg.h>
#include <generated/csr.h>
#include <irq.h>
#include <uart.h>
static void emerg_printf(const char *fmt, ...)
{
char buf[512];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
char *p = buf;
while(*p) {
while(uart_txfull_read());
uart_rxtx_write(*p++);
}
}
void isr(void);
void isr(void) {
unsigned int irqs;
irqs = irq_pending() & irq_getmask();
if(irqs & (1 << UART_INTERRUPT)) {
uart_isr();
} else if (irqs & (1 << EBREAK_ECALL_ILLEGAL_INTERRUPT)) {
emerg_printf("EBREAK_ECALL_ILLEGAL_INTERRUPT :-(\n");
while (1) {}
} else if (irqs & (1 << BUS_ERROR_INTERRUPT)) {
emerg_printf("BUS_ERROR_INTERRUPT :-(\n");
while (1) {}
} else {
if (irqs != 0) {
emerg_printf("unknown irq (%d) :-(\n", irqs);
while (1) {}
}
}
}
| [
"[email protected]"
] | |
bc299e2b581e7d2b02618e6bf02268add1f7e927 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/63e8e21f-e409-4052-9615-7c0e6730a93d.c | c5869b5cbb922793a49eb59e453fb14c6f5aa280 | [] | 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 | 600 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=0;
int j=14;
int k;
int l;
k = 3;
l = 64;
k = i/j;
l = i/j;
l = l/j;
l = i/j;
l = i%j;
l = l%j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
long b[90];
long c[6];
a = 0;
do {
a--;
/* START BUFFER SET */
*((long *)c + ( a - 1 )) = *((long *)b + ( a - 1 ));
/* END BUFFER SET */
//random
} while(( a - 1 ) > -1);
/* END VULNERABILITY */
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
1737b0f6d2f75d4bdb275df893376859b069389e | 2c12b475aa8f4e5b09e2a17ce99f21f619771a72 | /TaskCMEv2A.C | b191cf03264c8d12251990199290a7471371cd79 | [] | no_license | sayanchatterjee38/AliceCMW | 1b443495455e3e9143ec9485f0ac8de009e44fff | 3c212cc85a9e868ce2aa3fe2138dff097c785c31 | refs/heads/master | 2022-03-06T16:41:15.621592 | 2019-11-19T15:33:29 | 2019-11-19T15:33:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,380 | c | const char *anatype = "AOD";
void TaskCMEv2A()
{
// Analysis using AOD data
// Automatically generated analysis steering macro executed in grid subjobs
TStopwatch timer;
timer.Start();
// connect to AliEn and make the chain
if (!TGrid::Connect("alien://")) return;
// Set temporary merging directory to current one
gSystem->Setenv("TMPDIR", gSystem->pwd());
// Set temporary compilation directory to current one
gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
// Reset existing include path and add current directory first in the search
gSystem->SetIncludePath("-I.");
// load base root libraries
gSystem->Load("libTree");
gSystem->Load("libGeom");
gSystem->Load("libVMC");
gSystem->Load("libPhysics");
gSystem->Load("libMinuit");
// Load analysis framework libraries
gSystem->Load("libSTEERBase");
gSystem->Load("libESD");
gSystem->Load("libAOD");
gSystem->Load("libANALYSIS");
gSystem->Load("libOADB");
gSystem->Load("libANALYSISalice");
gSystem->Load("libCORRFW");
// include path
TString intPath = gInterpreter->GetIncludePath();
TObjArray *listpaths = intPath.Tokenize(" ");
TIter nextpath(listpaths);
TObjString *pname;
while ((pname=(TObjString*)nextpath())) {
TString current = pname->GetName();
if (current.Contains("AliRoot") || current.Contains("ALICE_ROOT")) continue;
gSystem->AddIncludePath(current);
}
if (listpaths) delete listpaths;
gROOT->ProcessLine(".include $ALICE_ROOT/include");
printf("Include path: %s\n", gSystem->GetIncludePath());
// Add aditional AliRoot libraries
// analysis source to be compiled at runtime (if any)
gROOT->ProcessLine(".L AliAnalysisTaskCMEv2A.cxx+g");
// read the analysis manager from file
AliAnalysisManager *mgr = AliAnalysisAlien::LoadAnalysisManager("TaskCMEv2A.root");
if (!mgr) return;
mgr->PrintStatus();
AliLog::SetGlobalLogLevel(AliLog::kWarning);
TChain *chain = CreateChain("wn.xml", anatype);
mgr->StartAnalysis("localfile", chain);
timer.Stop();
timer.Print();
}
//________________________________________________________________________________
TChain* CreateChain(const char *xmlfile, const char *type="ESD")
{
// Create a chain using url's from xml file
TString filename;
Int_t run = 0;
TString treename = type;
treename.ToLower();
treename += "Tree";
printf("***************************************\n");
printf(" Getting chain of trees %s\n", treename.Data());
printf("***************************************\n");
TAlienCollection *coll = TAlienCollection::Open(xmlfile);
if (!coll) {
::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
return NULL;
}
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
TChain *chain = new TChain(treename);
coll->Reset();
while (coll->Next()) {
filename = coll->GetTURL();
if (mgr) {
Int_t nrun = AliAnalysisManager::GetRunFromAlienPath(filename);
if (nrun && nrun != run) {
printf("### Run number detected from chain: %d\n", nrun);
mgr->SetRunFromPath(nrun);
run = nrun;
}
}
chain->Add(filename);
}
if (!chain->GetNtrees()) {
::Error("CreateChain", "No tree found from collection %s", xmlfile);
return NULL;
}
return chain;
}
| [
"[email protected]"
] | |
53843dfd1d3cffb12e3e3fd736d73f2c61f86c3f | c7377c3dec984c45e43b3138bd94e5e0abc1f5a4 | /includes/board/chip/telink_sig_mesh_sdk/sdk/vendor/common/mi_api/mijia_ble_api/mible_api.h | d5c1b7f4bb1cfadca598d28618c2b0e674625323 | [] | no_license | wwpcwzf/TuyaBTSigSDK_Reengineering | 6117dce2ea4a41e4052ebdd2695a99e9438c2412 | 5d56b21019e2dc93c56d6521d9e3e5419492f9d5 | refs/heads/master | 2023-06-03T03:16:23.541895 | 2021-06-23T08:07:06 | 2021-06-23T08:07:06 | 332,637,793 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,318 | h | #ifndef MIBLE_API_H__
#define MIBLE_API_H__
// Copyright [2017] [Beijing Xiaomi Mobile Software Co., Ltd]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "mible_port.h"
#include "mible_type.h"
#include "../telink_sdk_mible_api.h"
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
void mible_gap_event_callback(mible_gap_evt_t evt, mible_gap_evt_param_t* param);
void mible_gatts_event_callback(mible_gatts_evt_t evt,
mible_gatts_evt_param_t* param);
void mible_gattc_event_callback(mible_gattc_evt_t evt,
mible_gattc_evt_param_t* param);
void mible_arch_event_callback(mible_arch_event_t evt,
mible_arch_evt_param_t* param);
mible_status_t mible_gap_address_get(mible_addr_t mac);
mible_status_t mible_gap_scan_start(mible_gap_scan_type_t scan_type,
mible_gap_scan_param_t scan_param);
mible_status_t mible_gap_scan_stop(void);
mible_status_t mible_gap_adv_start(mible_gap_adv_param_t *p_adv_param);
mible_status_t mible_gap_adv_data_set(uint8_t const * p_data, uint8_t dlen,
uint8_t const *p_sr_data, uint8_t srdlen);
mible_status_t mible_gap_adv_stop(void);
mible_status_t mible_gap_connect(mible_gap_scan_param_t scan_param,
mible_gap_connect_t conn_param);
mible_status_t mible_gap_update_conn_params(uint16_t conn_handle,
mible_gap_conn_param_t conn_params);
mible_status_t mible_gap_disconnect(uint16_t conn_handle);
mible_status_t mible_gatts_service_init(
mible_gatts_db_t *mible_service_database);
mible_status_t mible_gatts_value_set(uint16_t srv_handle, uint16_t char_handle,
uint8_t offset, uint8_t* buf, uint8_t len);
mible_status_t mible_gatts_value_get(uint16_t srv_handle, uint16_t char_handle,
uint8_t* pdata, uint8_t *plen);
mible_status_t mible_gatts_notify_or_indicate(uint16_t conn_handle,
uint16_t srv_handle, uint16_t char_value_handle, uint8_t offset,
uint8_t* p_value, uint8_t len, uint8_t type);
mible_status_t mible_gatts_rw_auth_reply(uint16_t conn_handle, uint8_t status,
uint16_t char_value_handle, uint8_t offset, uint8_t* p_value,
uint8_t len, uint8_t type);
mible_status_t mible_gattc_primary_service_discover_by_uuid(
uint16_t conn_handle, mible_handle_range_t handle_range,
mible_uuid_t* p_srv_uuid);
mible_status_t
mible_gattc_char_discover_by_uuid(uint16_t conn_handle,
mible_handle_range_t handle_range, mible_uuid_t* p_char_uuid);
mible_status_t
mible_gattc_clt_cfg_descriptor_discover(uint16_t conn_handle,
mible_handle_range_t handle_range);
mible_status_t
mible_gattc_read_char_value_by_uuid(uint16_t conn_handle,
mible_handle_range_t handle_range, mible_uuid_t *p_char_uuid);
mible_status_t mible_gattc_write_with_rsp(uint16_t conn_handle, uint16_t handle,
uint8_t* p_value, uint8_t len);
mible_status_t mible_gattc_write_cmd(uint16_t conn_handle, uint16_t handle,
uint8_t* p_value, uint8_t len);
mible_status_t mible_timer_create(void** p_timer_id,
mible_timer_handler timeout_handler, mible_timer_mode mode);
mible_status_t mible_timer_delete(void* timer_id);
mible_status_t mible_timer_start(void* timer_id, uint32_t timeout_value,
void* p_context);
mible_status_t mible_timer_stop(void* timer_id);
mible_status_t mible_record_create(uint16_t record_id, uint8_t len);
mible_status_t mible_record_delete(uint16_t record_id);
mible_status_t mible_record_read(uint16_t record_id, uint8_t* p_data,
uint8_t len);
mible_status_t mible_record_write(uint16_t record_id, const uint8_t* p_data,
uint8_t len);
mible_status_t mible_rand_num_generator(uint8_t* p_buf, uint8_t len);
mible_status_t mible_aes128_encrypt(const uint8_t* key,
const uint8_t* plaintext, uint8_t plen, uint8_t* ciphertext);
mible_status_t mible_task_post(mible_handler_t handler, void *param);
void mible_tasks_exec(void);
mible_status_t mible_iic_init(const iic_config_t * p_config, mible_handler_t handler);
void mible_iic_uninit(void);
mible_status_t mible_iic_tx(uint8_t addr, uint8_t * p_out, uint16_t len,
bool no_stop);
mible_status_t mible_iic_rx(uint8_t addr, uint8_t * p_in, uint16_t len);
int mible_iic_scl_pin_read(uint8_t port, uint8_t pin);
int mible_gap_register(mible_gap_callback_t cb);
int mible_gattc_register(mible_gattc_callback_t cb);
int mible_gatts_register(mible_gatts_callback_t cb);
int mible_arch_register(mible_arch_callback_t cb);
int mible_gap_register(mible_gap_callback_t cb);
int mible_gattc_register(mible_gattc_callback_t cb);
int mible_gatts_register(mible_gatts_callback_t cb);
int mible_arch_register(mible_arch_callback_t cb);
mible_status_t mible_nvm_init(void);
mible_status_t mible_nvm_write(void * p_data, uint32_t length, uint32_t address);
mible_status_t mible_nvm_read(void * p_data, uint32_t length, uint32_t address);
mible_status_t mible_upgrade_firmware(void);
mible_status_t mible_upgrade_firmware_fail(void);
#endif
| [
"[email protected]"
] | |
b87c2564ca0981da72ee7dac4e265f6ed8c4cc6f | 82505684fa4be1a73f4c1548b6dc95a384ddf5d6 | /0x14-bit_manipulation/3-set_bit.c | 6af7b5ca9cafccc636081b43f8287599ce67fd2e | [] | no_license | dagute/holbertonschool-low_level_programming | fe26706e6bf3ecf13ddd549c039428b5aaa9648f | c2cde86d8417328046c34d089e3da166a40ceba1 | refs/heads/master | 2020-07-28T06:50:30.907943 | 2020-04-16T22:49:47 | 2020-04-16T22:49:47 | 209,342,967 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 379 | c | #include "holberton.h"
/**
* set_bit - sets the value of a bit to 1 at a given index
* @n: number
* @index: is the index, starting from 0 of the bit you want to set
* Return: 1 if it worked, or -1 if an error occurred
*/
int set_bit(unsigned long int *n, unsigned int index)
{
if (index > (8 * (sizeof(*n)) - 1))
{
return (-1);
}
*n = *n | 1 << index;
return (1);
}
| [
"[email protected]"
] | |
2a9c059a4b88e46e956abf2a4998d6c6793f9bb2 | 9643d03df9fcc2525ba82a05642830ba79bc9e72 | /soundbank/weconduit/conduit/cnd_dmp2genh/error_stuff.h | 90d747c06c6ace7aeae14810c57b679cea9d0293 | [
"MIT"
] | permissive | hcs64/vgm_ripping | e3659f60acb680028bfe5c6db0178780e83d586f | ff6c0093534fb65f86589dc876355607cc368707 | refs/heads/master | 2022-11-02T05:11:21.160638 | 2022-10-18T18:02:26 | 2022-10-18T18:02:26 | 23,389,787 | 95 | 17 | MIT | 2020-03-14T21:26:39 | 2014-08-27T13:01:30 | C | UTF-8 | C | false | false | 937 | h | #ifndef _ERROR_STUFF_H_INCLUDED
#define _ERROR_STUFF_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#ifdef DEBUG
# define DEBUG_EXIT abort()
#else
# define DEBUG_EXIT exit(EXIT_FAILURE)
#endif
#define CHECK_ERROR(condition,message) \
do {if (condition) { \
fprintf(stderr, "%s:%d:%s: %s\n",__FILE__,__LINE__,__func__,message); \
DEBUG_EXIT; \
}}while(0)
#define CHECK_ERRNO(condition, message) \
do {if (condition) { \
fprintf(stderr, "%s:%d:%s:%s: ",__FILE__,__LINE__,__func__,message); \
fflush(stderr); \
perror(NULL); \
DEBUG_EXIT; \
}}while(0)
#define CHECK_FILE(condition,file,message) \
do {if (condition) { \
fprintf(stderr, "%s:%d:%s:%s: ",__FILE__,__LINE__,__func__,message); \
fflush(stderr); \
if (feof(file)) { \
fprintf(stderr,"unexpected EOF\n"); \
} else { \
perror(message); \
} \
DEBUG_EXIT; \
}}while(0)
#endif /* _ERROR_STUFF_H_INCLUDED */
| [
"[email protected]"
] | |
d56e5c987a9615f3da55f0757c9e2de9ed5e163e | edbf22becc37057d2fb21c68e1a480a6b4c37f45 | /day05/ex08.c | f34b3763c75112491a7ea67714b56d5f93ec5634 | [] | no_license | pgj234/unity_c | 2233a1838b17c3c2f50f3bc7c76ef2ff43ccef0d | 494e5b78b13555d83478ec36064af26b456ad964 | refs/heads/master | 2023-08-16T01:15:42.051478 | 2021-10-12T04:28:27 | 2021-10-12T04:28:27 | 290,987,668 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 170 | c | #include <stdio.h>
int main() {
int data = 0;
if(3 == data) {
printf("data equal to 3 \n");
}
printf("complete %d \n", data);
return 1;
} | [
"[email protected]"
] | |
b6f00479ddfd6ef399102dbb83dc1cc86c71b498 | bb8b8e03308ddccb9443810e3208483fc0ea3221 | /main.c | 744406383add9382f0e89e15b6a31b7c8d73d76e | [] | no_license | cglens/fractol | 53a75bf3e17cfb64894ea849213c9903bdbfdcc0 | b07042ecf86b82fb3fc28ae16e3a67a2a2da6aa3 | refs/heads/master | 2021-01-09T06:44:17.992022 | 2016-11-16T13:59:12 | 2016-11-16T13:59:12 | 68,569,509 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,508 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cglens <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/05 15:18:58 by cglens #+# #+# */
/* Updated: 2016/10/23 13:41:28 by cglens ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
int main(int ac, char **av)
{
t_graph *put;
t_point *pt;
put = (t_graph *)malloc(sizeof(t_graph));
pt = (t_point *)ft_memalloc(sizeof(t_point));
if (ac != 2)
return (ft_error());
pt->e = av[1];
pt->frequency = .01;
if (ft_strcmp(pt->e, "Julia") == 0 ||
ft_strcmp(pt->e, "Julia_2") == 0 ||
ft_strcmp(pt->e, "Lapin_de_Douady") == 0 ||
ft_strcmp(pt->e, "Mandelbrot") == 0)
{
if (!(put->mlx = mlx_init()))
return (0);
if (!(put->win = mlx_new_window(put->mlx, W, H, "fractol")))
return (0);
ft_init_model(put, pt);
}
else
return (ft_error());
return (0);
}
| [
"[email protected]"
] | |
70e7d0d36761bc4ecf99a5c9fc073d248c4a4e57 | 1720a7f297dfd43f917a15deb33046dc4e89655b | /src/_filwbuf.c | d5d3b328c3efcaf9fd820afb402f634b65fc5214 | [] | no_license | cansou/msvcrt | f3458674a6e2e24e8e5b39d8b8321e050e7cbe5b | cbbce9b9b1617bee5df6dbba7fb8d99a9174b66c | refs/heads/master | 2020-04-03T14:13:16.369753 | 2018-03-30T03:29:02 | 2018-03-30T03:29:02 | 155,315,043 | 15 | 6 | null | 2018-10-30T02:54:57 | 2018-10-30T02:54:57 | null | UTF-8 | C | false | false | 511 | c | /***
*_filwbuf.c - fill buffer and get wide character
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines _filwbuf() - fill buffer and read first character, allocate
* buffer if there is none. Used from getwc().
*
*******************************************************************************/
#ifndef _UNICODE
#define _UNICODE 1
#endif /* _UNICODE */
#ifndef UNICODE
#define UNICODE 1
#endif /* UNICODE */
#include "_filbuf.c"
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.