type
stringclasses
5 values
content
stringlengths
9
163k
functions
int BG_ComposeUserCmdValue( int weapon ) { int value = 0; int bitsUsed = 0; BG_ComposeBits( &value, &bitsUsed, weapon, WEAPONNUM_BITS ); return value; }
functions
void BG_DecomposeUserCmdValue( int value, int *weapon ) { int bitsUsed = 0; BG_DecomposeBits( value, &bitsUsed, weapon, WEAPONNUM_BITS ); }
functions
void SnapVectorTowards( vec3_t v, vec3_t to ) { int i; for ( i = 0 ; i < 3 ; i++ ) { if ( to[i] <= v[i] ) { v[i] = floor(v[i]); }
functions
int cmdcmp( const void *a, const void *b ) { return Q_stricmp( (const char *)a, ((dummyCmd_t *)b)->name ); }
functions
void PC_SourceWarning(int handle, char *format, ...) { int line; char filename[128]; va_list argptr; static char string[4096]; va_start (argptr, format); Q_vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); filename[0] = '\0'; line = 0; trap_PC_SourceFileAndLine(handle, filename, &line); ...
functions
void PC_SourceError(int handle, char *format, ...) { int line; char filename[128]; va_list argptr; static char string[4096]; va_start (argptr, format); Q_vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); filename[0] = '\0'; line = 0; trap_PC_SourceFileAndLine(handle, filename, &line); C...
functions
int PC_CheckTokenString(int handle, char *string) { pc_token_t tok; if (!trap_PC_ReadToken(handle, &tok)) return qfalse; //if the token is available if (!strcmp(tok.string, string)) return qtrue; // trap_PC_UnreadToken(handle); return qfalse; }
functions
int PC_ExpectTokenString(int handle, char *string) { pc_token_t token; if (!trap_PC_ReadToken(handle, &token)) { PC_SourceError(handle, "couldn't find expected %s", string); return qfalse; }
functions
int PC_ExpectTokenType(int handle, int type, int subtype, pc_token_t *token) { char str[MAX_TOKENLENGTH]; if (!trap_PC_ReadToken(handle, token)) { PC_SourceError(handle, "couldn't read expected token"); return qfalse; }
functions
else if (token->type == TT_PUNCTUATION) { if (token->subtype != subtype) { PC_SourceError(handle, "found %s", token->string); return qfalse; }
functions
int PC_ExpectAnyToken(int handle, pc_token_t *token) { if (!trap_PC_ReadToken(handle, token)) { PC_SourceError(handle, "couldn't read expected token"); return qfalse; }
functions
qboolean ReadNumber(int source, fielddef_t *fd, void *p) { pc_token_t token; int negative = qfalse; long int intval, intmin = 0, intmax = 0; double floatval; if (!PC_ExpectAnyToken(source, &token)) return 0; //check for minus sign if (token.type == TT_PUNCTUATION) { if (fd->type & FT_UNSIGNED) { PC_Sou...
functions
number if (token.type != TT_NUMBER) { PC_SourceError(source, "expected number, found %s", token.string); return 0; }
functions
value if (token.subtype & TT_FLOAT) { if ((fd->type & FT_TYPE) != FT_FLOAT) { PC_SourceError(source, "unexpected float"); return 0; }
functions
if if (intval < intmin || intval > intmax) { PC_SourceError(source, "value %ld out of range [%ld, %ld]", intval, intmin, intmax); return 0; }
functions
qboolean ReadChar(int source, fielddef_t *fd, void *p) { pc_token_t token; if (!PC_ExpectAnyToken(source, &token)) return 0; //take literals into account if (token.type == TT_LITERAL) { *(char *) p = token.string[0]; }
functions
int ReadString(int source, fielddef_t *fd, void *p) { pc_token_t token; if (!PC_ExpectTokenType(source, TT_STRING, 0, &token)) return 0; //copy the string strncpy((char *) p, token.string, MAX_STRINGFIELD); //make sure the string is closed with a zero ((char *)p)[MAX_STRINGFIELD-1] = '\0'; // return 1; }
functions
qboolean PC_ReadStructure(int source, structdef_t *def, void *structure) { pc_token_t token; fielddef_t *fd; void *p; int num; if (!PC_ExpectTokenString(source, "{")) return 0; while(1) { if (!PC_ExpectAnyToken(source, &token)) return qfalse; //if end of structure if (!strcmp(token.string, "}
functions
if if (fd->type & FT_ARRAY) { num = fd->maxarray; if (!PC_ExpectTokenString(source, "{")) return qfalse; }
functions
if switch(fd->type & FT_TYPE) { case FT_CHAR: { if (!ReadChar(source, fd, p)) return qfalse; p = (char *) p + sizeof(char); break; }
functions
switch if (fd->type & FT_ARRAY) { if (!PC_ExpectAnyToken(source, &token)) return qfalse; if (!strcmp(token.string, "}
includes
#include <stdint.h>
functions
void drm_context_add_screen(struct drm_context_t* context, drmModeConnector* connector) { struct screen* screen = &context->screens[context->screen_idx]; screen->connector_id = connector->connector_id; context->screen_idx++; }
functions
void drm_context_scan(drm_context_t* context) { drmModeRes *resources; drmModeConnector *connector; drmModeEncoder *encoder; uint8_t i; resources = drmModeGetResources(context->fd); if (!resources) { fprintf(stderr, "drmModeGetResources failed\n"); return 1; }
functions
uint8_t drm_context_card(struct drm_context_t* context, const char* device) { context->fd = open(device, O_RDWR); if (context->fd < 0) { fprintf(stderr, "couldn't open, skipping\n"); return 1; }
includes
#include<ncurses.h>
includes
#include<locale.h>
includes
#include<time.h>
includes
#include<stdlib.h>
functions
void data_hora() { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); //printf ( "The current date/time is: %s", asctime (timeinfo) ); }
functions
void start() { has_colors(); start_color(); }
functions
void menu() { move(0,0); initscr(); start_color(); init_pair(1,COLOR_BLACK,COLOR_CYAN); attrset(A_BOLD | COLOR_PAIR(1)); bkgd(COLOR_PAIR(1)); attron(A_UNDERLINE); printw("SISTEMA DE SUPERMERCADO!\t"); time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); p...
functions
void padaria() { }
functions
void cadastroitens() { }
functions
void estoque() { }
main
int main(void) { //data_hora(); //start(); setlocale(LC_ALL,""); menu(); getchar(); endwin(); }
includes
#include <Windows.h>
functions
void crt_fatal_error(const char *msg) { //printf("fatal error : %s",msg); exit(1); }
functions
void mini_crt_entry(void) { long ret; #ifdef WIN32 long flag = 0; long argc = 0; char* argv[16]; char* cl = GetCommandLineA(); argv[0] = cl; argc++; while (*cl) { if (*cl == '\"') { if (flag == 0) { flag = 1; }
functions
else if (*cl == ' ' && flag == 0) { if (*(cl + 1)) { argv[argc] = cl + 1; argc++; }
functions
void exit(long exitCode) { //mini_crt_call_exit_routine(); #ifdef WIN32 ExitProcess(exitCode); #else asm( "movq %0,%%rbx \n\t" "movq $1,%%rax \n\t" "int $0x80 \n\t" "hlt \n\t"::"m"(exitCode)); #endif }
includes
#include <gtk/gtk.h>
includes
#include <stdint.h>
includes
#include <stdlib.h>
includes
#include <xmmintrin.h>
functions
int operation_tags() { return IOP_TAG_DISTORT; }
functions
int flags() { return IOP_FLAGS_ALLOW_TILING | IOP_FLAGS_TILING_FULL_ROI | IOP_FLAGS_ONE_INSTANCE; }
functions
int groups() { return IOP_GROUP_BASIC; }
functions
void init_presets(dt_iop_module_so_t *self) { DT_DEBUG_SQLITE3_EXEC(dt_database_get(darktable.db), "BEGIN", NULL, NULL, NULL); dt_gui_presets_add_generic(_("passthrough"), self->op, self->version(), &(dt_iop_rawprepare_params_t){.crop.array = { 0, 0, 0, 0 }
functions
void init_key_accels(dt_iop_module_so_t *self) { for(int i = 0; i < 4; i++) { gchar *label = g_strdup_printf(_("black level %i"), i); dt_accel_register_slider_iop(self, FALSE, NC_("accel", label)); g_free(label); }
functions
void connect_key_accels(dt_iop_module_t *self) { dt_iop_rawprepare_gui_data_t *g = (dt_iop_rawprepare_gui_data_t *)self->gui_data; for(int i = 0; i < 4; i++) { gchar *label = g_strdup_printf(_("black level %i"), i); dt_accel_connect_slider_iop(self, label, g->black_level_separate[i]); g_free(label); ...
functions
int round_smart(float val, int ref) { // first, just round it int round = (int)roundf(val); if((ref & 1) ^ (round & 1)) round++; return round; }
functions
int compute_proper_crop(dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_in, int value) { const float scale = roi_in->scale / piece->iscale; return round_smart((float)value * scale, value); }
functions
int distort_transform(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count) { dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; const float scale = piece->buf_in.scale / piece->iscale; const float x = (float)d->x * scale, y = (float)d->y * scale; for(s...
functions
int distort_backtransform(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count) { dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; const float scale = piece->buf_in.scale / piece->iscale; const float x = (float)d->x * scale, y =...
functions
void modify_roi_out(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *const roi_in) { *roi_out = *roi_in; dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; roi_out->x = roi_out->y = 0; int32_t x = d->x + d->width, y = d->y...
functions
void modify_roi_in(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_out, dt_iop_roi_t *roi_in) { *roi_in = *roi_out; dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; int32_t x = d->x + d->width, y = d->y + d->height; const float scale...
functions
void output_format(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc) { default_output_format(self, pipe, piece, dsc); dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; dsc->rawprepare.raw_black_level = d->rawprepare....
functions
void adjust_xtrans_filters(dt_dev_pixelpipe_t *pipe, uint32_t crop_x, uint32_t crop_y) { for(int i = 0; i < 6; ++i) { for(int j = 0; j < 6; ++j) { pipe->dsc.xtrans[j][i] = pipe->image.buf_dsc.xtrans[(j + crop_y) % 6][(i + crop_x) % 6]; }
functions
int BL(const dt_iop_roi_t *const roi_out, const dt_iop_rawprepare_data_t *const d, const int row, const int col) { return ((((row + roi_out->y + d->y) & 1) << 1) + ((col + roi_out->x + d->x) & 1)); }
functions
void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) { const dt_iop_rawprepare_data_t *const d = (dt_iop_rawprepare_data_t *)piece->data; // fprintf(stderr, "roi in %d ...
functions
else if(piece->pipe->dsc.filters && piece->dsc_in.channels == 1 && piece->dsc_in.datatype == TYPE_FLOAT) { // raw mosaic, fp, unnormalized const float *const in = (const float *const)ivoid; float *const out = (float *const)ovoid; #ifdef _OPENMP #pragma omp parallel for SIMD() default(none) schedule(static) ...
functions
endif for(int j = 0; j < roi_out->height; j++) { for(int i = 0; i < roi_out->width; i++) { for(int c = 0; c < ch; c++) { const size_t pin = (size_t)ch * (roi_in->width * (j + csy) + csx + i) + c; const size_t pout = (size_t)ch * (j * roi_out->width + i) + c; ...
functions
void process_sse2(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) { const dt_iop_rawprepare_data_t *const d = (dt_iop_rawprepare_data_t *)piece->data; // fprintf(stderr, "roi in ...
functions
rest for(; i < roi_out->width; i++, in++, out++) { const int id = BL(roi_out, d, j, i); *out = (((float)(*in)) - d->sub[id]) / d->div[id]; }
functions
else if(piece->pipe->dsc.filters && piece->dsc_in.channels == 1 && piece->dsc_in.datatype == TYPE_FLOAT) { // raw mosaic, fp, unnormalized #ifdef _OPENMP #pragma omp parallel for default(none) schedule(static) #endif for(int j = 0; j < roi_out->height; j++) { const float *in = ((float *)ivoid) + ((size_...
functions
rest for(; i < roi_out->width; i++, in++, out++) { const int id = BL(roi_out, d, j, i); *out = (*in - d->sub[id]) / d->div[id]; }
functions
endif for(int j = 0; j < roi_out->height; j++) { const float *in = ((float *)ivoid) + (size_t)4 * (roi_in->width * (j + csy) + csx); float *out = ((float *)ovoid) + (size_t)4 * roi_out->width * j; // process aligned pixels with SSE for(int i = 0; i < roi_out->width; i++, in += 4, out +=...
functions
int process_cl(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) { dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; dt_iop_rawprepare_global_data_t *gd = (dt_iop_rawprepare_gl...
functions
else if(piece->pipe->dsc.filters && piece->dsc_in.channels == 1 && piece->dsc_in.datatype == TYPE_FLOAT) { kernel = gd->kernel_rawprepare_1f_unnormalized; }
functions
int image_is_normalized(const dt_image_t *const image) { // if raw with floating-point data, if not special magic whitelevel, then it needs normalization if((image->flags & DT_IMAGE_HDR) == DT_IMAGE_HDR) { // magic, see dt_imageio_dng_write_tiff_header() const float normalized_float = 1.0f; uint32_t n...
functions
void commit_params(dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) { const dt_iop_rawprepare_params_t *const p = (dt_iop_rawprepare_params_t *)params; dt_iop_rawprepare_data_t *d = (dt_iop_rawprepare_data_t *)piece->data; d->x = p->crop....
functions
void init_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) { piece->data = calloc(1, sizeof(dt_iop_rawprepare_data_t)); self->commit_params(self, self->default_params, pipe, piece); }
functions
void cleanup_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) { free(piece->data); piece->data = NULL; }
functions
void reload_defaults(dt_iop_module_t *self) { dt_iop_rawprepare_params_t tmp = { { { 0 }
functions
void init_global(dt_iop_module_so_t *self) { const int program = 2; // basic.cl, from programs.conf self->data = malloc(sizeof(dt_iop_rawprepare_global_data_t)); dt_iop_rawprepare_global_data_t *gd = self->data; gd->kernel_rawprepare_1f = dt_opencl_create_kernel(program, "rawprepare_1f"); gd->kernel_rawprepa...
functions
void init(dt_iop_module_t *self) { const dt_image_t *const image = &(self->dev->image_storage); self->params = calloc(1, sizeof(dt_iop_rawprepare_params_t)); self->default_params = calloc(1, sizeof(dt_iop_rawprepare_params_t)); self->hide_enable_button = 1; self->default_enabled = dt_image_is_raw(image) && !...
functions
void cleanup(dt_iop_module_t *self) { free(self->params); self->params = NULL; }
functions
void cleanup_global(dt_iop_module_so_t *self) { dt_iop_rawprepare_global_data_t *gd = (dt_iop_rawprepare_global_data_t *)self->data; dt_opencl_free_kernel(gd->kernel_rawprepare_4f); dt_opencl_free_kernel(gd->kernel_rawprepare_1f_unnormalized); dt_opencl_free_kernel(gd->kernel_rawprepare_1f); free(self->data);...
functions
void gui_update(dt_iop_module_t *self) { dt_iop_rawprepare_gui_data_t *g = (dt_iop_rawprepare_gui_data_t *)self->gui_data; dt_iop_rawprepare_params_t *p = (dt_iop_rawprepare_params_t *)self->params; for(int i = 0; i < 4; i++) { dt_bauhaus_slider_set_soft(g->black_level_separate[i], p->raw_black_level_separ...
functions
void callback(GtkWidget *widget, gpointer *user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(self->dt->gui->reset) return; dt_iop_rawprepare_gui_data_t *g = (dt_iop_rawprepare_gui_data_t *)self->gui_data; dt_iop_rawprepare_params_t *p = (dt_iop_rawprepare_params_t *)self->params; for(int...
functions
void gui_init(dt_iop_module_t *self) { self->gui_data = malloc(sizeof(dt_iop_rawprepare_gui_data_t)); dt_iop_rawprepare_gui_data_t *g = (dt_iop_rawprepare_gui_data_t *)self->gui_data; dt_iop_rawprepare_params_t *p = (dt_iop_rawprepare_params_t *)self->params; self->widget = gtk_box_new(GTK_ORIENTATION_VERTICA...
functions
void gui_cleanup(dt_iop_module_t *self) { free(self->gui_data); self->gui_data = NULL; }
includes
#include <assert.h>
includes
#include <errno.h>
includes
#include <stdarg.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
functions
void print_usage(void) { printf( "otama_vacuum_index [OPTIONS] -c file\n" " -h display this help and exit.\n" " -d log_level = DEBUG.\n" " -c file path to configuration file.(config.yaml)\n" "%s %s\n", OTAMA_PACKAGE, OTAMA_VERSION); }
main
int main(int argc, char **argv) { otama_t *otama; otama_variant_pool_t *pool = otama_variant_pool_alloc(); otama_variant_t *config = NULL; otama_status_t ret; otama_log_level_e level = OTAMA_LOG_LEVEL_NOTICE; int opt; while ((opt = nv_getopt(argc, argv, "hdc:")) != -1){ switch (opt) { case 'h': print_us...
includes
#include <linux/delay.h>
includes
#include <linux/kernel.h>
includes
#include <linux/init.h>
includes
#include <linux/pci.h>
includes
#include <linux/platform_device.h>
includes
#include <linux/resource.h>
includes
#include <linux/signal.h>
includes
#include <linux/types.h>
includes
#include <linux/interrupt.h>