type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define mach_vm_allocate vm_allocate
defines
#define mach_vm_deallocate vm_deallocate
defines
#define mach_vm_write vm_write
defines
#define mach_vm_remap vm_remap
defines
#define mach_vm_protect vm_protect
defines
#define NSLookupSymbolInImage(...) ((void)0)
defines
#define NSAddressOfSymbol(...) ((void)0)
defines
#define RDErrorLog(format, ...) fprintf(stderr, "%s:%d:\n\terror: "format"\n", \
defines
#define LC_SEGMENT_ARCH_INDEPENDENT LC_SEGMENT_64
defines
#define LC_SEGMENT_ARCH_INDEPENDENT LC_SEGMENT
includes
#include <errno.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <stdbool.h>
includes
#include <string.h>
includes
#include <math.h>
includes
#include <teatime.h>
defines
#define TEATIME_BREAKONERROR(FN,RC) if ((RC = teatime_check_gl_errors(__LINE__, #FN )) < 0) break
defines
#define TEATIME_BREAKONERROR_FB(FN,RC) if ((RC = teatime_check_gl_fb_errors(__LINE__, #FN )) < 0) break
defines
#define TEA_ENCRYPT_SOURCE \
defines
#define TEA_DECRYPT_SOURCE \
functions
void teatime_cleanup(teatime_t *obj) { if (obj) { teatime_delete_program(obj); teatime_delete_textures(obj); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glDeleteFramebuffersEXT(1, &(obj->ofb)); glFlush(); free(obj); obj = NULL; }
functions
int teatime_set_viewport(teatime_t *obj, uint32_t ilen) { uint32_t texsz = (uint32_t)((long)(sqrt(ilen / 4.0))); if (obj && texsz > 0 && texsz < (GLuint)obj->maxtexsz) { /* viewport mapping 1:1 pixel = texel = data mapping */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrth...
functions
else if (obj) { fprintf(stderr, "Max. texture size is %d. Calculated: %u from input length: %u\n", obj->maxtexsz, texsz, ilen); }
functions
int teatime_create_textures(teatime_t *obj, const uint32_t *input, uint32_t ilen) { if (obj && input && ilen > 0) { int rc = 0; do { uint32_t texsz = (uint32_t)((long)(sqrt(ilen / 4.0))); if (texsz != obj->tex_size) { fprintf(stderr, "Viewport texture size(%u)...
functions
int teatime_read_textures(teatime_t *obj, uint32_t *output, uint32_t olen) { if (obj && output && olen > 0 && obj->otexid > 0) { int rc = 0; do { uint32_t texsz = (uint32_t)((long)(sqrt(olen / 4.0))); if (texsz != obj->tex_size) { fprintf(stderr, "Viewport tex...
functions
int teatime_create_program(teatime_t *obj, const char *source) { if (obj && source) { int rc = 0; do { obj->program = glCreateProgram(); TEATIME_BREAKONERROR(glCreateProgram, rc); obj->shader = glCreateShader(GL_FRAGMENT_SHADER_ARB); TEATIME_BREAKONERR...
functions
int teatime_run_program(teatime_t *obj, const uint32_t ikey[4], uint32_t rounds) { if (obj && obj->program > 0) { int rc = 0; do { glUseProgram(obj->program); TEATIME_BREAKONERROR(glUseProgram, rc); glActiveTexture(GL_TEXTURE0); TEATIME_BREAKONERROR(g...
functions
void teatime_delete_textures(teatime_t *obj) { if (obj) { if (obj->itexid != 0) { glDeleteTextures(1, &(obj->itexid)); obj->itexid = 0; }
functions
void teatime_delete_program(teatime_t *obj) { if (obj) { if (obj->shader > 0 && obj->program > 0) { glDetachShader(obj->program, obj->shader); }
functions
void teatime_print_version(FILE *fp) { const GLubyte *version = NULL; version = glGetString(GL_VERSION); fprintf(fp, "GL Version: %s\n", (const char *)version); version = glGetString(GL_SHADING_LANGUAGE_VERSION); fprintf(fp, "GLSL Version: %s\n", (const char *)version); version = glGetString(GL_...
functions
int teatime_check_gl_version(uint32_t *major, uint32_t *minor) { const GLubyte *version = NULL; version = glGetString(GL_VERSION); if (version) { uint32_t ver[2] = { 0, 0 }
functions
int teatime_check_gl_errors(int line, const char *fn_name) { GLenum err = glGetError(); if (err != GL_NO_ERROR) { const GLubyte *estr = gluErrorString(err); fprintf(stderr, "%s(): GL Error(%d) on line %d: %s\n", fn_name, err, line, (const char *)estr); return -1; }
functions
int teatime_check_gl_fb_errors(int line, const char *fn_name) { GLenum st = (GLenum)glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); switch (st) { case GL_FRAMEBUFFER_COMPLETE_EXT: return 0; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: fprintf(stderr, "%s(): GL FB error on line %d: inc...
functions
int teatime_check_program_errors(GLuint program) { GLint ilen = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &ilen); if (ilen > 1) { GLsizei wb = 0; GLchar *buf = calloc(ilen, sizeof(GLchar)); if (!buf) { fprintf(stderr, "Out of memory allocating %d bytes\n", ilen); ...
functions
int teatime_check_shader_errors(GLuint shader) { GLint ilen = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &ilen); if (ilen > 1) { GLsizei wb = 0; GLchar *buf = calloc(ilen, sizeof(GLchar)); if (!buf) { fprintf(stderr, "Out of memory allocating %d bytes\n", ilen); ...
functions
void main(void) {\n" \ " uvec4 x = texture(idata, gl_TexCoord[0].st);\n" \ " uint delta = uint(0x9e3779b9); \n" \ " uint sum = uint(0); \n" \ " for (uint i = uint(0); i < rounds; ++i) {\n" \ " sum += delta; \n" \ " x[0] += (((x[1] << 4) + ikey[0]) ^ (x[1] + sum)) ^ ((x[1] >> 5) + ikey[1]);\n" \ " x[1] += (((x[0] << ...
functions
void main(void) {\n" \ " uvec4 x = texture(idata, gl_TexCoord[0].st);\n" \ " uint delta = uint(0x9e3779b9); \n" \ " uint sum = delta * rounds; \n" \ " for (uint i = uint(0); i < rounds; ++i) {\n" \ " x[1] -= (((x[0] << 4) + ikey[2]) ^ (x[0] + sum)) ^ ((x[0] >> 5) + ikey[3]);\n" \ " x[0] -= (((x[1] << 4) + ikey[0]) ^ ...
functions
task main() { //Program begins, insert code within curly braces while (true) { //Input Conveior Belt startMotor(InputBeltMotor, 127); wait(2.5); stopMotor(InputBeltMotor); //Elevator startMotor(ElevatorMotor, 127); wait(1.5); stopMotor(ElevatorMotor); //Move Coo...
includes
#include <math.h>
includes
#include <stdlib.h>
functions
ALuint NextPowerOf2(ALuint value) { ALuint powerOf2 = 1; if(value) { value--; while(value) { value >>= 1; powerOf2 <<= 1; }
functions
ALfloat DelayLineOut(DelayLine *Delay, ALuint offset) { return Delay->Line[offset&Delay->Mask]; }
functions
ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfloat in) { Delay->Line[offset&Delay->Mask] = in; }
functions
ALfloat EarlyDelayLineOut(ALverbState *State, ALuint index) { return State->Early.Coeff[index] * DelayLineOut(&State->Early.Delay[index], State->Offset - State->Early.Offset[index]); }
functions
ALvoid EarlyReflection(ALverbState *State, ALfloat in, ALfloat *out) { ALfloat d[4], v, f[4]; // Obtain the decayed results of each early delay line. d[0] = EarlyDelayLineOut(State, 0); d[1] = EarlyDelayLineOut(State, 1); d[2] = EarlyDelayLineOut(State, 2); d[3] = EarlyDelayLineOut(State, 3); ...
functions
ALfloat LateAllPassInOut(ALverbState *State, ALuint index, ALfloat in) { ALfloat out; out = State->Late.ApCoeff[index] * DelayLineOut(&State->Late.ApDelay[index], State->Offset - State->Late.ApOffset[index]); out -= (State->Late.ApFeedCoeff * in); DelayLineIn(&State->La...
functions
ALfloat LateDelayLineOut(ALverbState *State, ALuint index) { return State->Late.Coeff[index] * DelayLineOut(&State->Late.Delay[index], State->Offset - State->Late.Offset[index]); }
functions
ALfloat LateLowPassInOut(ALverbState *State, ALuint index, ALfloat in) { State->Late.LpSample[index] = in + ((State->Late.LpSample[index] - in) * State->Late.LpCoeff[index]); return State->Late.LpSample[index]; }
functions
ALvoid LateReverb(ALverbState *State, ALfloat *in, ALfloat *out) { ALfloat d[4], f[4]; // Obtain the decayed results of the cyclical delay lines, and add the // corresponding input channels attenuated by density. Then pass the // results through the low-pass filters. d[0] = LateLowPassInOut(State,...
functions
ALvoid ReverbInOut(ALverbState *State, ALfloat in, ALfloat *early, ALfloat *late) { ALfloat taps[4]; // Low-pass filter the incoming sample. in = lpFilter2P(&State->LpFilter, 0, in); // Feed the initial delay line. DelayLineIn(&State->Delay, State->Offset, in); // Calculate the early reflecti...
functions
ALvoid VerbDestroy(ALeffectState *effect) { ALverbState *State = (ALverbState*)effect; if(State) { free(State->SampleBuffer); State->SampleBuffer = NULL; free(State); }
functions
ALint aluCart2LUTpos(ALfloat re, ALfloat im) { ALint pos = 0; ALfloat denom = aluFabs(re) + aluFabs(im); if(denom > 0.0f) pos = (ALint)(QUADRANT_NUM*aluFabs(im) / denom + 0.5); if(re < 0.0) pos = 2 * QUADRANT_NUM - pos; if(im < 0.0) pos = LUT_NUM - pos; return pos%LUT_NU...
functions
ALvoid VerbUpdate(ALeffectState *effect, ALCcontext *Context, ALeffect *Effect) { ALverbState *State = (ALverbState*)effect; ALuint index; ALfloat length, mixCoeff, cw, g, coeff; ALfloat hfRatio = Effect->Reverb.DecayHFRatio; // Calculate the master low-pass filter (from the master effect HF gain)....
includes
#include <stdio.h>
includes
#include <unistd.h>
includes
#include <fcntl.h>
includes
#include <errno.h>
includes
#include <assert.h>
includes
#include <sys/epoll.h>
structs
struct state { reactor_handler input; reactor_handler output; char buffer[4096]; data remaining; };
functions
int fill(struct state *state) { ssize_t n; n = read(0, state->buffer, sizeof state->buffer); if (n == 0) { reactor_delete(&state->input, 0); reactor_delete(&state->output, 1); return -1; }
functions
int flush(struct state *state) { ssize_t n; n = write(1, data_base(state->remaining), data_size(state->remaining)); if (n == -1 && errno == EAGAIN) return -1; assert(n > 0); state->remaining = data_select(state->remaining, n, data_size(state->remaining) - n); if (!data_size(state->remaining)) { r...
functions
void input(reactor_event *event) { struct state *state = event->state; int e; while (!data_size(state->remaining)) { e = fill(state); if (e == -1) break; e = flush(state); if (e == -1) break; }
functions
void output(reactor_event *event) { struct state *state = event->state; int e; while (data_size(state->remaining)) { e = flush(state); if (e == -1) break; }
main
int main() { struct state state = {0}
functions
int NextState(int m, char* pattern, int state, int symbol) { if (state < m && pattern[state] == symbol) { return state + 1; }
functions
void GenerateTable(int m, char* pattern, int Table[m][CHAR_MAX]) { for (int state = 0, symbol = 0; symbol < CHAR_MAX || (symbol = 0, ++state) < m; symbol++) { Table[state][symbol] = NextState(m, pattern, state, symbol); }
functions
int Search(int n, char* haystack, int m, char* needle) { int Table[m + 1][CHAR_MAX], state = 0; GenerateTable(m + 1, needle, Table); for (int i = 0; i < n; i++) { state = Table[state][haystack[i]]; if (state == m) { return (i - m + 1); }
includes
#include <stdio.h>
includes
#include <sys/socket.h>
includes
#include <sys/wait.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <netinet/in.h>
includes
#include <time.h>
includes
#include <arpa/inet.h>
includes
#include <unistd.h>
includes
#include <errno.h>
includes
#include <signal.h>
defines
#define MAXLINE 4096 /* max text line length */
defines
#define LISTENQ 1024 /* 2nd argument to listen() , 排队的最大连接数*/
defines
#define LISTEN_PORT 9669 //服务器监听端口
structs
struct sockaddr { unsigned short int sa_family; char sa_data[14]; };
structs
struct socketaddr_in { unsigned short int sin_family; uint16_t sin_port; struct in_addr sin_addr; unsigned char sin_zero[8]; };
structs
struct in_addr { uint32_t s_addr; };
includes
#include <compiler.h>
includes
#include <common/strres.h>
includes
#include <cpucore.h>
includes
#include <pccore.h>
includes
#include <io/iocore.h>
includes
#include <generic/memdbg32.h>
defines
#define MEMDBG32_MAXMEM 16
defines
#define MEMDBG32_DATAPERLINE 128
defines
#define MEMDBG32_LEFTMARGIN 8
functions
void memdbg32_initialize(void) { ZeroMemory(&memdbg32, sizeof(memdbg32)); memdbg32.width = (MEMDBG32_BLOCKW * MEMDBG32_DATAPERLINE) + MEMDBG32_LEFTMARGIN; memdbg32.height = (MEMDBG32_BLOCKH * 2 * MEMDBG32_MAXMEM) + 8; }
functions
void memdbg32_getsize(int *width, int *height) { if (width) { *width = memdbg32.width; }
functions
REG8 memdbg32_process(void) { return(MEMDBG32_FLAGDRAW); }
functions
BOOL memdbg32_paint(CMNVRAM *vram, CMNPALCNV cnv, BOOL redraw) { UINT mode; UINT8 use[MEMDBG32_MAXMEM*MEMDBG32_DATAPERLINE*2 + 256]; UINT32 pd[1024]; UINT pdmax; UINT i, j; UINT32 pde; UINT32 pdea; UINT32 pte; char str[4]; mode = 0; if (CPU_STAT_PM) { mode = 1; }
functions
else if (!use[pte >> 12]) { use[pte >> 12] = MEMDBG32_PALPAGE0; }