type
stringclasses
5 values
content
stringlengths
9
163k
functions
value switch (kp) { //case 10: kp = 42; break; // '*' // Uncomment this block for keypad4x3 //case 11: kp = 48; break; // '0' //case 12: kp = 35; break; // '#' //default: kp += 48; //case 0: kpzero(plinha,slinha);break; case 1: fraseum(plinha, penter); break; // 1 /...
includes
#include <sys/mman.h>
includes
#include <sys/types.h>
includes
#include <sys/stat.h>
includes
#include <fcntl.h>
includes
#include <unistd.h>
includes
#include <stdlib.h>
includes
#include <stdint.h>
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <errno.h>
main
int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "usage: %s <gpio> <mode>\n", argv[0]); exit(1); }
includes
#include <termios.h>
functions
HAVE_TERMIOS_H if (!echo) { tcgetattr(fileno(termin), &t); t_orig = t; t.c_lflag &= ~ECHO; tcsetattr(fileno(termin), TCSAFLUSH, &t); }
functions
WIN32 if (!echo) { /* get a new handle to turn echo off */ t_orig = (LPDWORD) malloc(sizeof(DWORD)); t = GetStdHandle(STD_INPUT_HANDLE); /* save the old configuration first */ GetConsoleMode(t, t_orig); /* set to the new mode */ SetConsoleMode(t, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT); }
functions
endif if (prompt) { fputs(_(prompt), termout); fflush(termout); }
functions
HAVE_TERMIOS_H if (!echo) { tcsetattr(fileno(termin), TCSAFLUSH, &t_orig); fputs("\n", termout); fflush(termout); }
functions
WIN32 if (!echo) { /* reset to the original console mode */ SetConsoleMode(t, *t_orig); fputs("\n", termout); fflush(termout); free(t_orig); }
functions
endif if (termin != stdin) { fclose(termin); fclose(termout); }
defines
#define S1856
includes
#include <stdlib.h>
includes
#include <unistd.h>
includes
#include <arpa/inet.h>
includes
#include <sys/socket.h>
includes
#include <sys/poll.h>
includes
#include <string.h>
includes
#include <stdio.h>
includes
#include <errno.h>
includes
#include <stdbool.h>
defines
#define MAXCONN 100
defines
#define READBUF 65535
functions
int NetSock_GenMaster() { struct sockaddr_in server; int fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); if(fd != -1) { server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(GetPort()); if(bind(fd, (struct sockaddr*)&server, sizeof(server)) >= 0) { listen(fd, MA...
functions
else if (fd == -2) { GuiSetStat("Master Socket: Failed to bind", 0); }
functions
void NetSock_Destroy(int fd) { close(fd); }
functions
void NetSock_Accept(int fd, Dynastore* ds) { struct sockaddr_in addrInfo; socklen_t addrInfoSiz = sizeof(addrInfo); const int maxAccept = 500; int newfd = -1; int i = 0; do { i++; newfd = accept(fd, (struct sockaddr*)&addrInfo, &addrInfoSiz); if(newfd > 0) { DynastoreAdd(ds, newfd); }
functions
else if (retCode == 0) { // timeout retVal = NULL; *fdCount = 0; }
functions
pointer if(retVal == NULL) { retVal = malloc(4 * sizeof(NetClient*)); for(k = 0; k < 4; k++) { retVal[k] = NULL; }
functions
else if (j % 4 == 0) { retVal = realloc(retVal, (j + 4) * sizeof(NetClient*)); for(k = j; k < (j + 4); k++) { retVal[k] = NULL; }
functions
void NetSock_Send(NetClient *cli, char* text) { if(strlen(text) > 0) { write(cli->fd, text, strlen(text)); }
functions
socket for(readLoop = 1; exitReadLoop == false && readLoopError == false; readLoop++) { readCount = read(cli->fd, buffer, READBUF - 1); readSize += readCount; strcat(retStr, buffer); if(readCount == READBUF - 1) { // There's still more data memset(buffer, 0, sizeof(char) * READBUF); retStr = ...
functions
else if (readCount < READBUF && readCount >= 0) { // We've reached the end of the data stream free(buffer); exitReadLoop = true; }
includes
#include <descrip.h>
functions
void jnl_write_trunc_rec(sgmnt_addrs *csa, uint4 orig_total_blks, uint4 orig_free_blocks, uint4 total_blks_after_trunc) { struct_jrec_trunc trunc_rec; jnl_private_control *jpc; assert(csa->now_crit); jpc = csa->jnl; trunc_rec.prefix.jrec_type = JRT_TRUNC; trunc_rec.prefix.forwptr = trunc_rec.suffix.backptr = ...
functions
void SystemClock_Config(void) { RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_OscInitTypeDef RCC_OscInitStruct; HAL_StatusTypeDef ret = HAL_OK; /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); /* The voltage scaling allows optimizing the power consumption when the device is clocked...
functions
void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) {}
main
int main(void) { /* Reset of all peripherals and Initialize the Systick. */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Set the Vector Table base location at 0x08004000 (this is already done in system_stm32f4xx.c file) */ /* Add your own code here...
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <sys/types.h>
includes
#include <sys/stat.h>
includes
#include <openssl/crypto.h>
includes
#include <openssl/rand.h>
includes
#include <openssl/bn.h>
includes
#include <openssl/dsa.h>
functions
int dsa_test(void) { BN_GENCB *cb; DSA *dsa = NULL; int counter, ret = 0, i, j; unsigned char buf[256]; unsigned long h; unsigned char sig[256]; unsigned int siglen; const BIGNUM *p = NULL, *q = NULL, *g = NULL; if (!TEST_ptr(cb = BN_GENCB_new())) goto end; BN_GENCB_set...
functions
int dsa_cb(int p, int n, BN_GENCB *arg) { static int ok = 0, num = 0; if (p == 0) num++; if (p == 2) ok++; if (!ok && (p == 0) && (num > 1)) { TEST_error("dsa_cb error"); return 0; }
functions
int setup_tests(void) { #ifndef OPENSSL_NO_DSA ADD_TEST(dsa_test); #endif return 1; }
functions
int XX_httplib_get_request_len( const char *buf, int buflen ) { const char *s; const char *e; int len; len = 0; s = buf; e = s+buflen-1; while ( len <= 0 && s < e ) { /* * Control characters are not allowed but >=128 is. */ if ( ! isprint( *(const unsigned char *)s) && *s != '\r' && *s != ...
includes
#include <errno.h>
includes
#include <math.h>
includes
#include <stdint.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
defines
#define CLAMP(in, max) \
defines
#define MB_SB_WRAPPER(name, function) \
defines
#define MB_SB_OSC_WRAPPER(name, function) \
functions
void bmo_mix_sb(float *out, float *f1, float *f2, uint32_t samples) { vec4f *vec_f1 = (vec4f *)f1; vec4f *vec_f2 = (vec4f *)f2; vec4f *vec_out = (vec4f *)out; if (samples % 4 == 0) { samples /= 4; while (samples--) vec_out[samples] = vec_f1[samples] + vec_f2[samples]; }
functions
void bmo_mix_mb( float **out, float **f1, float **f2, uint32_t channels, uint32_t frames) { while (channels--) { bmo_mix_sb(out[channels], f1[channels], f2[channels], frames); }
functions
void bmo_sbcpy(float *out, float *in, uint32_t samples) { vec4f *vec_in = (vec4f *)in; // FIXME test on non x86_64 platforms vec4f *vec_out = (vec4f *)out; if (samples % 4 == 0) { samples /= 4; while (samples--) vec_out[samples] = vec_in[samples]; }
functions
void bmo_sbcpy_offset( float *out, float *in, uint32_t out_offset, uint32_t in_offset, uint32_t samples) { out = out + out_offset; in = in + in_offset; for (uint32_t i = 0; i < samples; i++) { out[i] = in[i]; }
functions
void bmo_dither_sb(float *buffer, uint32_t resolution) { (void)buffer; (void)resolution; BMO_NOT_IMPLEMENTED; }
functions
void bmo_mb_cpy_offset( float **dest, float **src, size_t src_off, size_t dest_off, uint32_t channels, uint32_t frames) { for (uint32_t ch = 0; ch < channels; ch++) { for (uint32_t i = 0; i < frames; i++) { dest[ch][i + dest_off] = src[ch][i + src_off]; }
functions
void bmo_mb_cpy(float **dest, float **src, uint32_t channels, size_t frames) { while (channels--) { bmo_sbcpy(dest[channels], src[channels], frames); }
functions
double bmo_osc_sine_mix_sb( float *buffer, float freq, double phase, float amplitude, uint32_t rate, uint32_t samples) { const double rad_per_sample = (2. * M_PI * freq) / rate; for (size_t f = 0; f < samples; f++) { buffer[f] += sin(phase) * amplitude; phase += rad_per_sample; }
functions
double bmo_osc_sq_mix_sb(float *buffer, float freq, double phase, float amplitude, uint32_t rate, uint32_t samples) { // uses the fast sine generator from above and clamps the peaks of the sine // wave. The resultant wave is an approximate bandlimited squarewave, though // not a tru...
functions
double bmo_osc_saw_sb( float *buffer, float freq, double phase, float amplitude, uint32_t rate, uint32_t samples) { float a1; float inc; a1 = rate / freq; inc = (2.0 * amplitude) / a1; phase = fmod(phase, 360.); phase /= 360.; phase *= a1; while (samples--) buffer[sample...
functions
void bmo_gain_sb(float *buffer, uint32_t samples, float gain_db) { double gain = pow(10.0, gain_db * 0.05); vec4f *vec_buf = (vec4f *)buffer; vec4f gain_vec = {gain, gain, gain, gain}
functions
void bmo_inv_sb(float *buffer, uint32_t samples) { uint32_t *int_buf = (uint32_t *)buffer; vec4u *vec_buf = (vec4u *)buffer; const unsigned sign = 1u << SIGN_BIT; const vec4u sign_vec = {sign, sign, sign, sign}
functions
void bmo_zero_sb(float *buffer, uint32_t samples) { // ieee 754 has all bits set to zero for 0.0 memset(buffer, 0, samples * sizeof(float)); }
functions
void bmo_zero_sb2(float *in, uint32_t samples) { int *int_buf = (int *)in; vec4i *vec_buf = (vec4i *)in; if (samples % 4 == 0) { samples /= 4; while (samples--) vec_buf[samples] ^= vec_buf[samples]; }
functions
void bmo_zero_sb3(float *in, uint32_t samples) { int *int_buf = (int *)in; vec4i *vec_buf = (vec4i *)in; static const vec4i vec_zero = {0x0, 0x0, 0x0, 0x0}
functions
void bmo_zero_mb(float **in, uint32_t channels, uint32_t frames) { for (uint32_t i = 0; i < channels; i++) { bmo_zero_sb(in[i], frames); }
functions
void bmo_zero_mb_offset(float **in, uint32_t channels, uint32_t frames, uint32_t offset) { for (uint32_t i = 0; i < channels; i++) { bmo_zero_sb(in[i] + offset, frames); }
functions
void bmo_convolve_sb(float *out, float *in, float *impulse, uint32_t samples, uint32_t impulselen) { // float *tmp; // float *freeme; // // FIXME this is not suitable for a realtime context. remove malloc call and // // try and avoid temporary storage. // freeme = tmp = calloc(samples, sizeof(float)); // if (!tmp...
functions
void bmo_lerp_sb(float *out, float *in, float ratio, size_t out_frames) { /** bmo_lerp_sb() is a fast linear interpolator based on simple trig. For linear interpolation, the intermediate value is calculated by scaling the right triangle created between the next and previous origf1l s...
includes
#include <stdio.h>
includes
#include <errno.h>
includes
#include <stdlib.h>
main
int main(int argc, char ** argv) { diminuto_timer_t timer; diminuto_sticks_t result; diminuto_ticks_t hertz; diminuto_ticks_t frequency; diminuto_ticks_t then; diminuto_ticks_t now; diminuto_sticks_t measured; diminuto_ticks_t remaining; diminuto_sticks_t claimed; diminuto_sticks...
includes
#include <config.h>
defines
#define VIR_FROM_THIS VIR_FROM_LIBXL
defines
#define TUNNEL_SEND_BUF_SIZE 65536
structs
struct _libxlMigrationCookie { /* Host properties */ char *srcHostname; uint32_t xenMigStreamVer; /* Guest properties */ unsigned char uuid[VIR_UUID_BUFLEN]; char *name; };
structs
struct _libxlTunnelMigrationThread { virStreamPtr st; int srcFD; };
structs
struct libxlTunnelControl { libxlTunnelMigrationThread tmThread; virThread thread; int dataFD[2]; };
functions
void libxlMigrationCookieFree(libxlMigrationCookiePtr mig) { if (!mig) return; VIR_FREE(mig->srcHostname); VIR_FREE(mig->name); VIR_FREE(mig); }
functions
libxlMigrationCookiePtr libxlMigrationCookieNew(virDomainObjPtr dom) { libxlMigrationCookiePtr mig = NULL; if (VIR_ALLOC(mig) < 0) goto error; if (VIR_STRDUP(mig->name, dom->def->name) < 0) goto error; memcpy(mig->uuid, dom->def->uuid, VIR_UUID_BUFLEN); if (!(mig->srcHostname = v...
functions
int libxlMigrationBakeCookie(libxlMigrationCookiePtr mig, char **cookieout, int *cookieoutlen) { virBuffer buf = VIR_BUFFER_INITIALIZER; char uuidstr[VIR_UUID_STRING_BUFLEN]; if (!cookieout || !cookieoutlen) return 0; *cookieoutlen = 0; vir...